1 ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=generic < %s | FileCheck %s
3 define i32 @test_eq_1(<4 x i32> %A, <4 x i32> %B) {
4 ; CHECK-LABEL: test_eq_1:
5 ; CHECK: pcmpgtd %xmm0, %xmm1
6 ; CHECK-NEXT: pxor {{.*}}(%rip), %xmm1
9 %cmp = icmp slt <4 x i32> %A, %B
10 %sext = sext <4 x i1> %cmp to <4 x i32>
11 %cmp1 = icmp eq <4 x i32> %sext, zeroinitializer
12 %0 = extractelement <4 x i1> %cmp1, i32 1
13 %1 = sext i1 %0 to i32
17 define i32 @test_ne_1(<4 x i32> %A, <4 x i32> %B) {
18 ; CHECK-LABEL: test_ne_1:
19 ; CHECK: pcmpgtd %xmm0, %xmm1
23 %cmp = icmp slt <4 x i32> %A, %B
24 %sext = sext <4 x i1> %cmp to <4 x i32>
25 %cmp1 = icmp ne <4 x i32> %sext, zeroinitializer
26 %0 = extractelement <4 x i1> %cmp1, i32 1
27 %1 = sext i1 %0 to i32
31 define i32 @test_le_1(<4 x i32> %A, <4 x i32> %B) {
32 ; CHECK-LABEL: test_le_1:
33 ; CHECK: movl $-1, %eax
36 %cmp = icmp slt <4 x i32> %A, %B
37 %sext = sext <4 x i1> %cmp to <4 x i32>
38 %cmp1 = icmp sle <4 x i32> %sext, zeroinitializer
39 %0 = extractelement <4 x i1> %cmp1, i32 1
40 %1 = sext i1 %0 to i32
44 define i32 @test_ge_1(<4 x i32> %A, <4 x i32> %B) {
45 ; CHECK-LABEL: test_ge_1:
46 ; CHECK: pcmpgtd %xmm0, %xmm1
47 ; CHECK: pxor {{.*}}(%rip), %xmm1
50 %cmp = icmp slt <4 x i32> %A, %B
51 %sext = sext <4 x i1> %cmp to <4 x i32>
52 %cmp1 = icmp sge <4 x i32> %sext, zeroinitializer
53 %0 = extractelement <4 x i1> %cmp1, i32 1
54 %1 = sext i1 %0 to i32
58 define i32 @test_lt_1(<4 x i32> %A, <4 x i32> %B) {
59 ; CHECK-LABEL: test_lt_1:
60 ; CHECK: pcmpgtd %xmm0, %xmm1
64 %cmp = icmp slt <4 x i32> %A, %B
65 %sext = sext <4 x i1> %cmp to <4 x i32>
66 %cmp1 = icmp slt <4 x i32> %sext, zeroinitializer
67 %0 = extractelement <4 x i1> %cmp, i32 1
68 %1 = sext i1 %0 to i32
72 define i32 @test_gt_1(<4 x i32> %A, <4 x i32> %B) {
73 ; CHECK-LABEL: test_gt_1:
74 ; CHECK: xorl %eax, %eax
77 %cmp = icmp slt <4 x i32> %A, %B
78 %sext = sext <4 x i1> %cmp to <4 x i32>
79 %cmp1 = icmp sgt <4 x i32> %sext, zeroinitializer
80 %0 = extractelement <4 x i1> %cmp1, i32 1
81 %1 = sext i1 %0 to i32
85 define i32 @test_eq_2(<4 x i32> %A, <4 x i32> %B) {
86 ; CHECK-LABEL: test_eq_2:
87 ; CHECK: pcmpgtd %xmm1, %xmm0
88 ; CHECK-NEXT: pxor {{.*}}(%rip), %xmm0
91 %cmp = icmp slt <4 x i32> %B, %A
92 %sext = sext <4 x i1> %cmp to <4 x i32>
93 %cmp1 = icmp eq <4 x i32> %sext, zeroinitializer
94 %0 = extractelement <4 x i1> %cmp1, i32 1
95 %1 = sext i1 %0 to i32
99 define i32 @test_ne_2(<4 x i32> %A, <4 x i32> %B) {
100 ; CHECK-LABEL: test_ne_2:
101 ; CHECK: pcmpgtd %xmm1, %xmm0
105 %cmp = icmp slt <4 x i32> %B, %A
106 %sext = sext <4 x i1> %cmp to <4 x i32>
107 %cmp1 = icmp ne <4 x i32> %sext, zeroinitializer
108 %0 = extractelement <4 x i1> %cmp1, i32 1
109 %1 = sext i1 %0 to i32
113 define i32 @test_le_2(<4 x i32> %A, <4 x i32> %B) {
114 ; CHECK-LABEL: test_le_2:
115 ; CHECK: pcmpgtd %xmm1, %xmm0
116 ; CHECK: pxor {{.*}}(%rip), %xmm0
119 %cmp = icmp slt <4 x i32> %B, %A
120 %sext = sext <4 x i1> %cmp to <4 x i32>
121 %cmp1 = icmp sle <4 x i32> zeroinitializer, %sext
122 %0 = extractelement <4 x i1> %cmp1, i32 1
123 %1 = sext i1 %0 to i32
127 define i32 @test_ge_2(<4 x i32> %A, <4 x i32> %B) {
128 ; CHECK-LABEL: test_ge_2:
129 ; CHECK: movl $-1, %eax
132 %cmp = icmp slt <4 x i32> %B, %A
133 %sext = sext <4 x i1> %cmp to <4 x i32>
134 %cmp1 = icmp sge <4 x i32> zeroinitializer, %sext
135 %0 = extractelement <4 x i1> %cmp1, i32 1
136 %1 = sext i1 %0 to i32
140 define i32 @test_lt_2(<4 x i32> %A, <4 x i32> %B) {
141 ; CHECK-LABEL: test_lt_2:
142 ; CHECK: pcmpgtd %xmm1, %xmm0
146 %cmp = icmp slt <4 x i32> %B, %A
147 %sext = sext <4 x i1> %cmp to <4 x i32>
148 %cmp1 = icmp slt <4 x i32> zeroinitializer, %sext
149 %0 = extractelement <4 x i1> %cmp, i32 1
150 %1 = sext i1 %0 to i32
154 define i32 @test_gt_2(<4 x i32> %A, <4 x i32> %B) {
155 ; CHECK-LABEL: test_gt_2:
156 ; CHECK: pcmpgtd %xmm1, %xmm0
160 %cmp = icmp slt <4 x i32> %B, %A
161 %sext = sext <4 x i1> %cmp to <4 x i32>
162 %cmp1 = icmp sgt <4 x i32> zeroinitializer, %sext
163 %0 = extractelement <4 x i1> %cmp1, i32 1
164 %1 = sext i1 %0 to i32