1 ; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=X32
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
3 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64
5 ; Though it is undefined, we want xor undef,undef to produce zero.
6 define <4 x i32> @test1() nounwind {
7 %tmp = xor <4 x i32> undef, undef
11 ; X32: pxor %xmm0, %xmm0
15 ; Though it is undefined, we want xor undef,undef to produce zero.
16 define i32 @test2() nounwind{
17 %tmp = xor i32 undef, undef
20 ; X32: xorl %eax, %eax
24 define i32 @test3(i32 %a, i32 %b) nounwind {
26 %tmp1not = xor i32 %b, -2
27 %tmp3 = and i32 %tmp1not, %a
28 %tmp4 = lshr i32 %tmp3, 1
32 ; X64: notl [[A1:%esi|%edx]]
33 ; X64: andl [[A0:%edi|%ecx]], [[A1]]
34 ; X64: movl [[A1]], %eax
39 ; X32: movl 8(%esp), %eax
41 ; X32: andl 4(%esp), %eax
46 define i32 @test4(i32 %a, i32 %b) nounwind {
50 %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ]
51 %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ]
52 %tmp3 = xor i32 %a_addr.0, %b_addr.0
53 %tmp4not = xor i32 %tmp3, 2147483647
54 %tmp6 = and i32 %tmp4not, %b_addr.0
55 %tmp8 = shl i32 %tmp6, 1
56 %tmp10 = icmp eq i32 %tmp8, 0
57 br i1 %tmp10, label %bb12, label %bb
62 ; X64: notl [[REG:%[a-z]+]]
63 ; X64: andl {{.*}}[[REG]]
65 ; X32: notl [[REG:%[a-z]+]]
66 ; X32: andl {{.*}}[[REG]]
69 define i16 @test5(i16 %a, i16 %b) nounwind {
73 %b_addr.0 = phi i16 [ %b, %entry ], [ %tmp8, %bb ]
74 %a_addr.0 = phi i16 [ %a, %entry ], [ %tmp3, %bb ]
75 %tmp3 = xor i16 %a_addr.0, %b_addr.0
76 %tmp4not = xor i16 %tmp3, 32767
77 %tmp6 = and i16 %tmp4not, %b_addr.0
78 %tmp8 = shl i16 %tmp6, 1
79 %tmp10 = icmp eq i16 %tmp8, 0
80 br i1 %tmp10, label %bb12, label %bb
84 ; X64: notl [[REG:%[a-z]+]]
85 ; X64: andl {{.*}}[[REG]]
87 ; X32: notl [[REG:%[a-z]+]]
88 ; X32: andl {{.*}}[[REG]]
91 define i8 @test6(i8 %a, i8 %b) nounwind {
95 %b_addr.0 = phi i8 [ %b, %entry ], [ %tmp8, %bb ]
96 %a_addr.0 = phi i8 [ %a, %entry ], [ %tmp3, %bb ]
97 %tmp3 = xor i8 %a_addr.0, %b_addr.0
98 %tmp4not = xor i8 %tmp3, 127
99 %tmp6 = and i8 %tmp4not, %b_addr.0
100 %tmp8 = shl i8 %tmp6, 1
101 %tmp10 = icmp eq i8 %tmp8, 0
102 br i1 %tmp10, label %bb12, label %bb
106 ; X64: notb [[REG:%[a-z]+]]
107 ; X64: andb {{.*}}[[REG]]
109 ; X32: notb [[REG:%[a-z]+]]
110 ; X32: andb {{.*}}[[REG]]
113 define i32 @test7(i32 %a, i32 %b) nounwind {
117 %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ]
118 %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ]
119 %tmp3 = xor i32 %a_addr.0, %b_addr.0
120 %tmp4not = xor i32 %tmp3, 2147483646
121 %tmp6 = and i32 %tmp4not, %b_addr.0
122 %tmp8 = shl i32 %tmp6, 1
123 %tmp10 = icmp eq i32 %tmp8, 0
124 br i1 %tmp10, label %bb12, label %bb
128 ; X64: xorl $2147483646, [[REG:%[a-z]+]]
129 ; X64: andl {{.*}}[[REG]]
131 ; X32: xorl $2147483646, [[REG:%[a-z]+]]
132 ; X32: andl {{.*}}[[REG]]
135 define i32 @test8(i32 %a) nounwind {
139 %t2 = add i32 %t1, -1