[PATCH] D16233: AMDGPU/SI: Promote i1 SETCC operations
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 10:49:44 PST 2016
tstellarAMD created this revision.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.
While working on uniform branching, I've hit a few cases where we emit
i1 SETCC operations.
http://reviews.llvm.org/D16233
Files:
lib/Target/AMDGPU/SIISelLowering.cpp
test/CodeGen/AMDGPU/setcc.ll
Index: test/CodeGen/AMDGPU/setcc.ll
===================================================================
--- test/CodeGen/AMDGPU/setcc.ll
+++ test/CodeGen/AMDGPU/setcc.ll
@@ -389,3 +389,22 @@
endif:
ret void
}
+
+; FUNC-LABEL: setcc-i1-and
+; SI-DAG: v_cmp_le_f32_e64 [[A:s\[[0-9]+:[0-9]+\]]], 0, s{{[0-9]+}}
+; SI-DAG: v_cmp_ge_f32_e64 [[B:s\[[0-9]+:[0-9]+\]]], 1.0, s{{[0-9]+}}
+; SI: s_and_b64 s[2:3], [[A]], [[B]]
+define void @setcc-i1-and(i32 addrspace(1)* %out, float %cond) #0 {
+bb0:
+ %tmp5 = fcmp oge float %cond, 0.000000e+00
+ %tmp7 = fcmp ole float %cond, 1.000000e+00
+ %tmp9 = and i1 %tmp5, %tmp7
+ br i1 %tmp9, label %bb1, label %bb2
+
+bb1:
+ store i32 0, i32 addrspace(1)* %out
+ br label %bb2
+
+bb2:
+ ret void
+}
Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -103,6 +103,7 @@
setOperationAction(ISD::SELECT_CC, MVT::i64, Expand);
setOperationAction(ISD::SELECT_CC, MVT::f64, Expand);
+ setOperationAction(ISD::SETCC, MVT::i1, Promote);
setOperationAction(ISD::SETCC, MVT::v2i1, Expand);
setOperationAction(ISD::SETCC, MVT::v4i1, Expand);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16233.45012.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160115/267864a6/attachment.bin>
More information about the llvm-commits
mailing list