[4664] | 1 | ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=generic < %s | FileCheck %s |
---|
| 2 | |
---|
| 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 |
---|
| 7 | ; CHECK: retq |
---|
| 8 | entry: |
---|
| 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 |
---|
| 14 | ret i32 %1 |
---|
| 15 | } |
---|
| 16 | |
---|
| 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 |
---|
| 20 | ; CHECK-NOT: pxor |
---|
| 21 | ; CHECK: retq |
---|
| 22 | entry: |
---|
| 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 |
---|
| 28 | ret i32 %1 |
---|
| 29 | } |
---|
| 30 | |
---|
| 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 |
---|
| 34 | ; CHECK-NEXT: retq |
---|
| 35 | entry: |
---|
| 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 |
---|
| 41 | ret i32 %1 |
---|
| 42 | } |
---|
| 43 | |
---|
| 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 |
---|
| 48 | ; CHECK: retq |
---|
| 49 | entry: |
---|
| 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 |
---|
| 55 | ret i32 %1 |
---|
| 56 | } |
---|
| 57 | |
---|
| 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 |
---|
| 61 | ; CHECK-NOT: pxor |
---|
| 62 | ; CHECK: retq |
---|
| 63 | entry: |
---|
| 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 |
---|
| 69 | ret i32 %1 |
---|
| 70 | } |
---|
| 71 | |
---|
| 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 |
---|
| 75 | ; CHECK: retq |
---|
| 76 | entry: |
---|
| 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 |
---|
| 82 | ret i32 %1 |
---|
| 83 | } |
---|
| 84 | |
---|
| 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 |
---|
| 89 | ; CHECK: retq |
---|
| 90 | entry: |
---|
| 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 |
---|
| 96 | ret i32 %1 |
---|
| 97 | } |
---|
| 98 | |
---|
| 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 |
---|
| 102 | ; CHECK-NOT: pxor |
---|
| 103 | ; CHECK: retq |
---|
| 104 | entry: |
---|
| 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 |
---|
| 110 | ret i32 %1 |
---|
| 111 | } |
---|
| 112 | |
---|
| 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 |
---|
| 117 | ; CHECK: retq |
---|
| 118 | entry: |
---|
| 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 |
---|
| 124 | ret i32 %1 |
---|
| 125 | } |
---|
| 126 | |
---|
| 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 |
---|
| 130 | ; CHECK: retq |
---|
| 131 | entry: |
---|
| 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 |
---|
| 137 | ret i32 %1 |
---|
| 138 | } |
---|
| 139 | |
---|
| 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 |
---|
| 143 | ; CHECK-NOT: pxor |
---|
| 144 | ; CHECK: retq |
---|
| 145 | entry: |
---|
| 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 |
---|
| 151 | ret i32 %1 |
---|
| 152 | } |
---|
| 153 | |
---|
| 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 |
---|
| 157 | ; CHECK-NOT: pxor |
---|
| 158 | ; CHECK: retq |
---|
| 159 | entry: |
---|
| 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 |
---|
| 165 | ret i32 %1 |
---|
| 166 | } |
---|