]> granicus.if.org Git - llvm/commitdiff
Merging r200830:
authorTom Stellard <thomas.stellard@amd.com>
Mon, 24 Mar 2014 18:21:38 +0000 (18:21 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Mon, 24 Mar 2014 18:21:38 +0000 (18:21 +0000)
------------------------------------------------------------------------
r200830 | michel.daenzer | 2014-02-05 01:48:05 -0800 (Wed, 05 Feb 2014) | 8 lines

R600/SI: Add pattern for zero-extending i1 to i32

Fixes opencl-example if_* tests with radeonsi.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74469

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@204646 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/R600/SIInstructions.td
test/CodeGen/R600/zero_extend.ll

index ae641164b4e0087059b911f9e3767156c3846ca4..37a77ce71bb0044b2921685ab941a2d989896c47 100644 (file)
@@ -1818,6 +1818,11 @@ def : Pat <
   (V_CNDMASK_B32_e64 (i32 0), (i32 -1), $src0)
 >;
 
+def : Pat <
+  (i32 (zext i1:$src0)),
+  (V_CNDMASK_B32_e64 (i32 0), (i32 1), $src0)
+>;
+
 // 1. Offset as 8bit DWORD immediate
 def : Pat <
   (SIload_constant i128:$sbase, IMM8bitDWORD:$offset),
index 481b3b328259bbf1d1b8bbc6a1ebc4bf5d128841..a114bfc4a02b49cd3b84bc81f7ead977ae95a3f1 100644 (file)
@@ -16,3 +16,13 @@ entry:
   store i64 %2, i64 addrspace(1)* %out
   ret void
 }
+
+; SI-CHECK-LABEL: @testi1toi32
+; SI-CHECK: V_CNDMASK_B32
+define void @testi1toi32(i32 addrspace(1)* %out, i32 %a, i32 %b) {
+entry:
+  %0 = icmp eq i32 %a, %b
+  %1 = zext i1 %0 to i32
+  store i32 %1, i32 addrspace(1)* %out
+  ret void
+}