diff options
author | Justin Holewinski <justin.holewinski@gmail.com> | 2011-06-20 18:42:48 +0000 |
---|---|---|
committer | Justin Holewinski <justin.holewinski@gmail.com> | 2011-06-20 18:42:48 +0000 |
commit | c882df2560f4d789daf0353de155e4bb46c12ffa (patch) | |
tree | 8c7b2186ef156b56794194aef1905d02862292a6 /test | |
parent | 1bd15700a0eb3057d3e2d65070c3fc6b99e0d8a2 (diff) | |
download | external_llvm-c882df2560f4d789daf0353de155e4bb46c12ffa.zip external_llvm-c882df2560f4d789daf0353de155e4bb46c12ffa.tar.gz external_llvm-c882df2560f4d789daf0353de155e4bb46c12ffa.tar.bz2 |
PTX: Fix conversion between predicates and value types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/PTX/cvt.ll | 88 | ||||
-rw-r--r-- | test/CodeGen/PTX/setp.ll | 30 |
2 files changed, 64 insertions, 54 deletions
diff --git a/test/CodeGen/PTX/cvt.ll b/test/CodeGen/PTX/cvt.ll index bf18bd7..f723369 100644 --- a/test/CodeGen/PTX/cvt.ll +++ b/test/CodeGen/PTX/cvt.ll @@ -4,8 +4,10 @@ ; (note: we convert back to i32 to return) define ptx_device i32 @cvt_pred_i16(i16 %x, i1 %y) { -; CHECK: cvt.pred.u16 p0, rh1; -; CHECK: ret; +; CHECK: setp.gt.b16 p0, rh1, 0 +; CHECK-NEXT: and.pred p0, p0, p1; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; +; CHECK-NEXT: ret; %a = trunc i16 %x to i1 %b = and i1 %a, %y %c = zext i1 %b to i32 @@ -13,8 +15,10 @@ define ptx_device i32 @cvt_pred_i16(i16 %x, i1 %y) { } define ptx_device i32 @cvt_pred_i32(i32 %x, i1 %y) { -; CHECK: cvt.pred.u32 p0, r1; -; CHECK: ret; +; CHECK: setp.gt.b32 p0, r1, 0 +; CHECK-NEXT: and.pred p0, p0, p1; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; +; CHECK-NEXT: ret; %a = trunc i32 %x to i1 %b = and i1 %a, %y %c = zext i1 %b to i32 @@ -22,8 +26,10 @@ define ptx_device i32 @cvt_pred_i32(i32 %x, i1 %y) { } define ptx_device i32 @cvt_pred_i64(i64 %x, i1 %y) { -; CHECK: cvt.pred.u64 p0, rd1; -; CHECK: ret; +; CHECK: setp.gt.b64 p0, rd1, 0 +; CHECK-NEXT: and.pred p0, p0, p1; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; +; CHECK-NEXT: ret; %a = trunc i64 %x to i1 %b = and i1 %a, %y %c = zext i1 %b to i32 @@ -31,8 +37,10 @@ define ptx_device i32 @cvt_pred_i64(i64 %x, i1 %y) { } define ptx_device i32 @cvt_pred_f32(float %x, i1 %y) { -; CHECK: cvt.rzi.pred.f32 p0, r1; -; CHECK: ret; +; CHECK: setp.gt.b32 p0, r1, 0 +; CHECK-NEXT: and.pred p0, p0, p1; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; +; CHECK-NEXT: ret; %a = fptoui float %x to i1 %b = and i1 %a, %y %c = zext i1 %b to i32 @@ -40,8 +48,10 @@ define ptx_device i32 @cvt_pred_f32(float %x, i1 %y) { } define ptx_device i32 @cvt_pred_f64(double %x, i1 %y) { -; CHECK: cvt.rzi.pred.f64 p0, rd1; -; CHECK: ret; +; CHECK: setp.gt.b64 p0, rd1, 0 +; CHECK-NEXT: and.pred p0, p0, p1; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; +; CHECK-NEXT: ret; %a = fptoui double %x to i1 %b = and i1 %a, %y %c = zext i1 %b to i32 @@ -51,36 +61,36 @@ define ptx_device i32 @cvt_pred_f64(double %x, i1 %y) { ; i16 define ptx_device i16 @cvt_i16_preds(i1 %x) { -; CHECK: cvt.u16.pred rh0, p1; -; CHECK: ret; +; CHECK: selp.u16 rh0, 1, 0, p1; +; CHECK-NEXT: ret; %a = zext i1 %x to i16 ret i16 %a } define ptx_device i16 @cvt_i16_i32(i32 %x) { ; CHECK: cvt.u16.u32 rh0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = trunc i32 %x to i16 ret i16 %a } define ptx_device i16 @cvt_i16_i64(i64 %x) { ; CHECK: cvt.u16.u64 rh0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = trunc i64 %x to i16 ret i16 %a } define ptx_device i16 @cvt_i16_f32(float %x) { ; CHECK: cvt.rzi.u16.f32 rh0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fptoui float %x to i16 ret i16 %a } define ptx_device i16 @cvt_i16_f64(double %x) { ; CHECK: cvt.rzi.u16.f64 rh0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fptoui double %x to i16 ret i16 %a } @@ -88,36 +98,36 @@ define ptx_device i16 @cvt_i16_f64(double %x) { ; i32 define ptx_device i32 @cvt_i32_preds(i1 %x) { -; CHECK: cvt.u32.pred r0, p1; -; CHECK: ret; +; CHECK: selp.u32 r0, 1, 0, p1; +; CHECK-NEXT: ret; %a = zext i1 %x to i32 ret i32 %a } define ptx_device i32 @cvt_i32_i16(i16 %x) { ; CHECK: cvt.u32.u16 r0, rh1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = zext i16 %x to i32 ret i32 %a } define ptx_device i32 @cvt_i32_i64(i64 %x) { ; CHECK: cvt.u32.u64 r0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = trunc i64 %x to i32 ret i32 %a } define ptx_device i32 @cvt_i32_f32(float %x) { ; CHECK: cvt.rzi.u32.f32 r0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fptoui float %x to i32 ret i32 %a } define ptx_device i32 @cvt_i32_f64(double %x) { ; CHECK: cvt.rzi.u32.f64 r0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fptoui double %x to i32 ret i32 %a } @@ -125,29 +135,29 @@ define ptx_device i32 @cvt_i32_f64(double %x) { ; i64 define ptx_device i64 @cvt_i64_preds(i1 %x) { -; CHECK: cvt.u64.pred rd0, p1; -; CHECK: ret; +; CHECK: selp.u64 rd0, 1, 0, p1; +; CHECK-NEXT: ret; %a = zext i1 %x to i64 ret i64 %a } define ptx_device i64 @cvt_i64_i16(i16 %x) { ; CHECK: cvt.u64.u16 rd0, rh1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = zext i16 %x to i64 ret i64 %a } define ptx_device i64 @cvt_i64_i32(i32 %x) { ; CHECK: cvt.u64.u32 rd0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = zext i32 %x to i64 ret i64 %a } define ptx_device i64 @cvt_i64_f32(float %x) { ; CHECK: cvt.rzi.u64.f32 rd0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fptoui float %x to i64 ret i64 %a } @@ -162,36 +172,36 @@ define ptx_device i64 @cvt_i64_f64(double %x) { ; f32 define ptx_device float @cvt_f32_preds(i1 %x) { -; CHECK: cvt.rn.f32.pred r0, p1; -; CHECK: ret; +; CHECK: selp.f32 r0, 0F3F800000, 0F00000000, p1; +; CHECK-NEXT: ret; %a = uitofp i1 %x to float ret float %a } define ptx_device float @cvt_f32_i16(i16 %x) { ; CHECK: cvt.rn.f32.u16 r0, rh1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = uitofp i16 %x to float ret float %a } define ptx_device float @cvt_f32_i32(i32 %x) { ; CHECK: cvt.rn.f32.u32 r0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = uitofp i32 %x to float ret float %a } define ptx_device float @cvt_f32_i64(i64 %x) { ; CHECK: cvt.rn.f32.u64 r0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = uitofp i64 %x to float ret float %a } define ptx_device float @cvt_f32_f64(double %x) { ; CHECK: cvt.rn.f32.f64 r0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fptrunc double %x to float ret float %a } @@ -199,36 +209,36 @@ define ptx_device float @cvt_f32_f64(double %x) { ; f64 define ptx_device double @cvt_f64_preds(i1 %x) { -; CHECK: cvt.rn.f64.pred rd0, p1; -; CHECK: ret; +; CHECK: selp.f64 rd0, 0D3F80000000000000, 0D0000000000000000, p1; +; CHECK-NEXT: ret; %a = uitofp i1 %x to double ret double %a } define ptx_device double @cvt_f64_i16(i16 %x) { ; CHECK: cvt.rn.f64.u16 rd0, rh1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = uitofp i16 %x to double ret double %a } define ptx_device double @cvt_f64_i32(i32 %x) { ; CHECK: cvt.rn.f64.u32 rd0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = uitofp i32 %x to double ret double %a } define ptx_device double @cvt_f64_i64(i64 %x) { ; CHECK: cvt.rn.f64.u64 rd0, rd1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = uitofp i64 %x to double ret double %a } define ptx_device double @cvt_f64_f32(float %x) { ; CHECK: cvt.f64.f32 rd0, r1; -; CHECK: ret; +; CHECK-NEXT: ret; %a = fpext float %x to double ret double %a } diff --git a/test/CodeGen/PTX/setp.ll b/test/CodeGen/PTX/setp.ll index 5836122..a5d7484 100644 --- a/test/CodeGen/PTX/setp.ll +++ b/test/CodeGen/PTX/setp.ll @@ -2,7 +2,7 @@ define ptx_device i32 @test_setp_eq_u32_rr(i32 %x, i32 %y) { ; CHECK: setp.eq.u32 p0, r1, r2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp eq i32 %x, %y %z = zext i1 %p to i32 @@ -11,7 +11,7 @@ define ptx_device i32 @test_setp_eq_u32_rr(i32 %x, i32 %y) { define ptx_device i32 @test_setp_ne_u32_rr(i32 %x, i32 %y) { ; CHECK: setp.ne.u32 p0, r1, r2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ne i32 %x, %y %z = zext i1 %p to i32 @@ -20,7 +20,7 @@ define ptx_device i32 @test_setp_ne_u32_rr(i32 %x, i32 %y) { define ptx_device i32 @test_setp_lt_u32_rr(i32 %x, i32 %y) { ; CHECK: setp.lt.u32 p0, r1, r2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ult i32 %x, %y %z = zext i1 %p to i32 @@ -29,7 +29,7 @@ define ptx_device i32 @test_setp_lt_u32_rr(i32 %x, i32 %y) { define ptx_device i32 @test_setp_le_u32_rr(i32 %x, i32 %y) { ; CHECK: setp.le.u32 p0, r1, r2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ule i32 %x, %y %z = zext i1 %p to i32 @@ -38,7 +38,7 @@ define ptx_device i32 @test_setp_le_u32_rr(i32 %x, i32 %y) { define ptx_device i32 @test_setp_gt_u32_rr(i32 %x, i32 %y) { ; CHECK: setp.gt.u32 p0, r1, r2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ugt i32 %x, %y %z = zext i1 %p to i32 @@ -47,7 +47,7 @@ define ptx_device i32 @test_setp_gt_u32_rr(i32 %x, i32 %y) { define ptx_device i32 @test_setp_ge_u32_rr(i32 %x, i32 %y) { ; CHECK: setp.ge.u32 p0, r1, r2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp uge i32 %x, %y %z = zext i1 %p to i32 @@ -56,7 +56,7 @@ define ptx_device i32 @test_setp_ge_u32_rr(i32 %x, i32 %y) { define ptx_device i32 @test_setp_eq_u32_ri(i32 %x) { ; CHECK: setp.eq.u32 p0, r1, 1; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp eq i32 %x, 1 %z = zext i1 %p to i32 @@ -65,7 +65,7 @@ define ptx_device i32 @test_setp_eq_u32_ri(i32 %x) { define ptx_device i32 @test_setp_ne_u32_ri(i32 %x) { ; CHECK: setp.ne.u32 p0, r1, 1; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ne i32 %x, 1 %z = zext i1 %p to i32 @@ -74,7 +74,7 @@ define ptx_device i32 @test_setp_ne_u32_ri(i32 %x) { define ptx_device i32 @test_setp_lt_u32_ri(i32 %x) { ; CHECK: setp.eq.u32 p0, r1, 0; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ult i32 %x, 1 %z = zext i1 %p to i32 @@ -83,7 +83,7 @@ define ptx_device i32 @test_setp_lt_u32_ri(i32 %x) { define ptx_device i32 @test_setp_le_u32_ri(i32 %x) { ; CHECK: setp.lt.u32 p0, r1, 2; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ule i32 %x, 1 %z = zext i1 %p to i32 @@ -92,7 +92,7 @@ define ptx_device i32 @test_setp_le_u32_ri(i32 %x) { define ptx_device i32 @test_setp_gt_u32_ri(i32 %x) { ; CHECK: setp.gt.u32 p0, r1, 1; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp ugt i32 %x, 1 %z = zext i1 %p to i32 @@ -101,7 +101,7 @@ define ptx_device i32 @test_setp_gt_u32_ri(i32 %x) { define ptx_device i32 @test_setp_ge_u32_ri(i32 %x) { ; CHECK: setp.ne.u32 p0, r1, 0; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %p = icmp uge i32 %x, 1 %z = zext i1 %p to i32 @@ -111,7 +111,7 @@ define ptx_device i32 @test_setp_ge_u32_ri(i32 %x) { define ptx_device i32 @test_setp_4_op_format_1(i32 %x, i32 %y, i32 %u, i32 %v) { ; CHECK: setp.gt.u32 p0, r3, r4; ; CHECK-NEXT: setp.eq.and.u32 p0, r1, r2, p0; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %c = icmp eq i32 %x, %y %d = icmp ugt i32 %u, %v @@ -121,9 +121,9 @@ define ptx_device i32 @test_setp_4_op_format_1(i32 %x, i32 %y, i32 %u, i32 %v) { } define ptx_device i32 @test_setp_4_op_format_2(i32 %x, i32 %y, i32 %w) { -; CHECK: cvt.pred.u32 p0, r3; +; CHECK: setp.gt.b32 p0, r3, 0; ; CHECK-NEXT: setp.eq.and.u32 p0, r1, r2, !p0; -; CHECK-NEXT: cvt.u32.pred r0, p0; +; CHECK-NEXT: selp.u32 r0, 1, 0, p0; ; CHECK-NEXT: ret; %c = trunc i32 %w to i1 %d = icmp eq i32 %x, %y |