aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/X86
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-08-18 06:11:57 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-08-18 06:11:57 +0000
commit1594b9883673d8048e3f0b79575ad2140fbb6b3c (patch)
treecf57a0ed5fccafbad14e974aab592a6b86c9e6b8 /test/CodeGen/X86
parent571c4788d5d1527af39f9904e14983d9229c2443 (diff)
downloadexternal_llvm-1594b9883673d8048e3f0b79575ad2140fbb6b3c.zip
external_llvm-1594b9883673d8048e3f0b79575ad2140fbb6b3c.tar.gz
external_llvm-1594b9883673d8048e3f0b79575ad2140fbb6b3c.tar.bz2
Test dag xform: Fold C ? 0 : 1 to ~C or zext(~C) or trunc(~C)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86')
-rw-r--r--test/CodeGen/X86/select-zero-one.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGen/X86/select-zero-one.ll b/test/CodeGen/X86/select-zero-one.ll
new file mode 100644
index 0000000..70785e9
--- /dev/null
+++ b/test/CodeGen/X86/select-zero-one.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep cmov
+; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep xor
+; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movzbl | count 1
+
+@r1 = weak global i32 0
+
+define void @t1(i32 %a, double %b) {
+ %tmp114 = fcmp ugt double %b, 1.000000e-09
+ %tmp120 = icmp eq i32 %a, 0 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp114, %tmp120 ; <i1> [#uses=1]
+ %storemerge = select i1 %bothcond, i32 0, i32 1 ; <i32> [#uses=2]
+ store i32 %storemerge, i32* @r1, align 4
+ ret void
+}
+
+@r2 = weak global i8 0
+
+define void @t2(i32 %a, double %b) {
+ %tmp114 = fcmp ugt double %b, 1.000000e-09
+ %tmp120 = icmp eq i32 %a, 0 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp114, %tmp120 ; <i1> [#uses=1]
+ %storemerge = select i1 %bothcond, i8 0, i8 1 ; <i32> [#uses=2]
+ store i8 %storemerge, i8* @r2, align 4
+ ret void
+}