| OLD | NEW |
| 1 ; This file checks support for comparing vector values with the fcmp | 1 ; This file checks support for comparing vector values with the fcmp |
| 2 ; instruction. | 2 ; instruction. |
| 3 | 3 |
| 4 ; RUN: %p2i -i %s -a -O2 --verbose none \ | 4 ; RUN: %p2i -i %s --assemble --disassemble -a -O2 --verbose none \ |
| 5 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 5 ; RUN: | FileCheck %s |
| 6 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 6 ; RUN: %p2i -i %s --assemble --disassemble -a -Om1 --verbose none \ |
| 7 ; RUN: %p2i -i %s -a -Om1 --verbose none \ | 7 ; RUN: | FileCheck %s |
| 8 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | |
| 9 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | |
| 10 | 8 |
| 11 ; Check that sext elimination occurs when the result of the comparison | 9 ; Check that sext elimination occurs when the result of the comparison |
| 12 ; instruction is alrady sign extended. Sign extension to 4 x i32 uses | 10 ; instruction is alrady sign extended. Sign extension to 4 x i32 uses |
| 13 ; the pslld instruction. | 11 ; the pslld instruction. |
| 14 define <4 x i32> @sextElimination(<4 x float> %a, <4 x float> %b) { | 12 define <4 x i32> @sextElimination(<4 x float> %a, <4 x float> %b) { |
| 15 entry: | 13 entry: |
| 16 %res.trunc = fcmp oeq <4 x float> %a, %b | 14 %res.trunc = fcmp oeq <4 x float> %a, %b |
| 17 %res = sext <4 x i1> %res.trunc to <4 x i32> | 15 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 18 ret <4 x i32> %res | 16 ret <4 x i32> %res |
| 19 ; CHECK-LABEL: sextElimination: | 17 ; CHECK-LABEL: sextElimination |
| 20 ; CHECK: cmpeqps | 18 ; CHECK: cmpeqps |
| 21 ; CHECK-NOT: pslld | 19 ; CHECK-NOT: pslld |
| 22 } | 20 } |
| 23 | 21 |
| 24 define <4 x i32> @fcmpFalseVector(<4 x float> %a, <4 x float> %b) { | 22 define <4 x i32> @fcmpFalseVector(<4 x float> %a, <4 x float> %b) { |
| 25 entry: | 23 entry: |
| 26 %res.trunc = fcmp false <4 x float> %a, %b | 24 %res.trunc = fcmp false <4 x float> %a, %b |
| 27 %res = sext <4 x i1> %res.trunc to <4 x i32> | 25 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 28 ret <4 x i32> %res | 26 ret <4 x i32> %res |
| 29 ; CHECK-LABEL: fcmpFalseVector: | 27 ; CHECK-LABEL: fcmpFalseVector |
| 30 ; CHECK: pxor | 28 ; CHECK: pxor |
| 31 } | 29 } |
| 32 | 30 |
| 33 define <4 x i32> @fcmpOeqVector(<4 x float> %a, <4 x float> %b) { | 31 define <4 x i32> @fcmpOeqVector(<4 x float> %a, <4 x float> %b) { |
| 34 entry: | 32 entry: |
| 35 %res.trunc = fcmp oeq <4 x float> %a, %b | 33 %res.trunc = fcmp oeq <4 x float> %a, %b |
| 36 %res = sext <4 x i1> %res.trunc to <4 x i32> | 34 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 37 ret <4 x i32> %res | 35 ret <4 x i32> %res |
| 38 ; CHECK-LABEL: fcmpOeqVector: | 36 ; CHECK-LABEL: fcmpOeqVector |
| 39 ; CHECK: cmpeqps | 37 ; CHECK: cmpeqps |
| 40 } | 38 } |
| 41 | 39 |
| 42 define <4 x i32> @fcmpOgeVector(<4 x float> %a, <4 x float> %b) { | 40 define <4 x i32> @fcmpOgeVector(<4 x float> %a, <4 x float> %b) { |
| 43 entry: | 41 entry: |
| 44 %res.trunc = fcmp oge <4 x float> %a, %b | 42 %res.trunc = fcmp oge <4 x float> %a, %b |
| 45 %res = sext <4 x i1> %res.trunc to <4 x i32> | 43 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 46 ret <4 x i32> %res | 44 ret <4 x i32> %res |
| 47 ; CHECK-LABEL: fcmpOgeVector: | 45 ; CHECK-LABEL: fcmpOgeVector |
| 48 ; CHECK: cmpleps | 46 ; CHECK: cmpleps |
| 49 } | 47 } |
| 50 | 48 |
| 51 define <4 x i32> @fcmpOgtVector(<4 x float> %a, <4 x float> %b) { | 49 define <4 x i32> @fcmpOgtVector(<4 x float> %a, <4 x float> %b) { |
| 52 entry: | 50 entry: |
| 53 %res.trunc = fcmp ogt <4 x float> %a, %b | 51 %res.trunc = fcmp ogt <4 x float> %a, %b |
| 54 %res = sext <4 x i1> %res.trunc to <4 x i32> | 52 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 55 ret <4 x i32> %res | 53 ret <4 x i32> %res |
| 56 ; CHECK-LABEL: fcmpOgtVector: | 54 ; CHECK-LABEL: fcmpOgtVector |
| 57 ; CHECK: cmpltps | 55 ; CHECK: cmpltps |
| 58 } | 56 } |
| 59 | 57 |
| 60 define <4 x i32> @fcmpOleVector(<4 x float> %a, <4 x float> %b) { | 58 define <4 x i32> @fcmpOleVector(<4 x float> %a, <4 x float> %b) { |
| 61 entry: | 59 entry: |
| 62 %res.trunc = fcmp ole <4 x float> %a, %b | 60 %res.trunc = fcmp ole <4 x float> %a, %b |
| 63 %res = sext <4 x i1> %res.trunc to <4 x i32> | 61 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 64 ret <4 x i32> %res | 62 ret <4 x i32> %res |
| 65 ; CHECK-LABEL: fcmpOleVector: | 63 ; CHECK-LABEL: fcmpOleVector |
| 66 ; CHECK: cmpleps | 64 ; CHECK: cmpleps |
| 67 } | 65 } |
| 68 | 66 |
| 69 define <4 x i32> @fcmpOltVector(<4 x float> %a, <4 x float> %b) { | 67 define <4 x i32> @fcmpOltVector(<4 x float> %a, <4 x float> %b) { |
| 70 entry: | 68 entry: |
| 71 %res.trunc = fcmp olt <4 x float> %a, %b | 69 %res.trunc = fcmp olt <4 x float> %a, %b |
| 72 %res = sext <4 x i1> %res.trunc to <4 x i32> | 70 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 73 ret <4 x i32> %res | 71 ret <4 x i32> %res |
| 74 ; CHECK-LABEL: fcmpOltVector: | 72 ; CHECK-LABEL: fcmpOltVector |
| 75 ; CHECK: cmpltps | 73 ; CHECK: cmpltps |
| 76 } | 74 } |
| 77 | 75 |
| 78 define <4 x i32> @fcmpOneVector(<4 x float> %a, <4 x float> %b) { | 76 define <4 x i32> @fcmpOneVector(<4 x float> %a, <4 x float> %b) { |
| 79 entry: | 77 entry: |
| 80 %res.trunc = fcmp one <4 x float> %a, %b | 78 %res.trunc = fcmp one <4 x float> %a, %b |
| 81 %res = sext <4 x i1> %res.trunc to <4 x i32> | 79 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 82 ret <4 x i32> %res | 80 ret <4 x i32> %res |
| 83 ; CHECK-LABEL: fcmpOneVector: | 81 ; CHECK-LABEL: fcmpOneVector |
| 84 ; CHECK: cmpneqps | 82 ; CHECK: cmpneqps |
| 85 ; CHECK: cmpordps | 83 ; CHECK: cmpordps |
| 86 ; CHECK: pand | 84 ; CHECK: pand |
| 87 } | 85 } |
| 88 | 86 |
| 89 define <4 x i32> @fcmpOrdVector(<4 x float> %a, <4 x float> %b) { | 87 define <4 x i32> @fcmpOrdVector(<4 x float> %a, <4 x float> %b) { |
| 90 entry: | 88 entry: |
| 91 %res.trunc = fcmp ord <4 x float> %a, %b | 89 %res.trunc = fcmp ord <4 x float> %a, %b |
| 92 %res = sext <4 x i1> %res.trunc to <4 x i32> | 90 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 93 ret <4 x i32> %res | 91 ret <4 x i32> %res |
| 94 ; CHECK-LABEL: fcmpOrdVector: | 92 ; CHECK-LABEL: fcmpOrdVector |
| 95 ; CHECK: cmpordps | 93 ; CHECK: cmpordps |
| 96 } | 94 } |
| 97 | 95 |
| 98 define <4 x i32> @fcmpTrueVector(<4 x float> %a, <4 x float> %b) { | 96 define <4 x i32> @fcmpTrueVector(<4 x float> %a, <4 x float> %b) { |
| 99 entry: | 97 entry: |
| 100 %res.trunc = fcmp true <4 x float> %a, %b | 98 %res.trunc = fcmp true <4 x float> %a, %b |
| 101 %res = sext <4 x i1> %res.trunc to <4 x i32> | 99 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 102 ret <4 x i32> %res | 100 ret <4 x i32> %res |
| 103 ; CHECK-LABEL: fcmpTrueVector: | 101 ; CHECK-LABEL: fcmpTrueVector |
| 104 ; CHECK: pcmpeqd | 102 ; CHECK: pcmpeqd |
| 105 } | 103 } |
| 106 | 104 |
| 107 define <4 x i32> @fcmpUeqVector(<4 x float> %a, <4 x float> %b) { | 105 define <4 x i32> @fcmpUeqVector(<4 x float> %a, <4 x float> %b) { |
| 108 entry: | 106 entry: |
| 109 %res.trunc = fcmp ueq <4 x float> %a, %b | 107 %res.trunc = fcmp ueq <4 x float> %a, %b |
| 110 %res = sext <4 x i1> %res.trunc to <4 x i32> | 108 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 111 ret <4 x i32> %res | 109 ret <4 x i32> %res |
| 112 ; CHECK-LABEL: fcmpUeqVector: | 110 ; CHECK-LABEL: fcmpUeqVector |
| 113 ; CHECK: cmpeqps | 111 ; CHECK: cmpeqps |
| 114 ; CHECK: cmpunordps | 112 ; CHECK: cmpunordps |
| 115 ; CHECK: por | 113 ; CHECK: por |
| 116 } | 114 } |
| 117 | 115 |
| 118 define <4 x i32> @fcmpUgeVector(<4 x float> %a, <4 x float> %b) { | 116 define <4 x i32> @fcmpUgeVector(<4 x float> %a, <4 x float> %b) { |
| 119 entry: | 117 entry: |
| 120 %res.trunc = fcmp uge <4 x float> %a, %b | 118 %res.trunc = fcmp uge <4 x float> %a, %b |
| 121 %res = sext <4 x i1> %res.trunc to <4 x i32> | 119 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 122 ret <4 x i32> %res | 120 ret <4 x i32> %res |
| 123 ; CHECK-LABEL: fcmpUgeVector: | 121 ; CHECK-LABEL: fcmpUgeVector |
| 124 ; CHECK: cmpnltps | 122 ; CHECK: cmpnltps |
| 125 } | 123 } |
| 126 | 124 |
| 127 define <4 x i32> @fcmpUgtVector(<4 x float> %a, <4 x float> %b) { | 125 define <4 x i32> @fcmpUgtVector(<4 x float> %a, <4 x float> %b) { |
| 128 entry: | 126 entry: |
| 129 %res.trunc = fcmp ugt <4 x float> %a, %b | 127 %res.trunc = fcmp ugt <4 x float> %a, %b |
| 130 %res = sext <4 x i1> %res.trunc to <4 x i32> | 128 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 131 ret <4 x i32> %res | 129 ret <4 x i32> %res |
| 132 ; CHECK-LABEL: fcmpUgtVector: | 130 ; CHECK-LABEL: fcmpUgtVector |
| 133 ; CHECK: cmpnleps | 131 ; CHECK: cmpnleps |
| 134 } | 132 } |
| 135 | 133 |
| 136 define <4 x i32> @fcmpUleVector(<4 x float> %a, <4 x float> %b) { | 134 define <4 x i32> @fcmpUleVector(<4 x float> %a, <4 x float> %b) { |
| 137 entry: | 135 entry: |
| 138 %res.trunc = fcmp ule <4 x float> %a, %b | 136 %res.trunc = fcmp ule <4 x float> %a, %b |
| 139 %res = sext <4 x i1> %res.trunc to <4 x i32> | 137 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 140 ret <4 x i32> %res | 138 ret <4 x i32> %res |
| 141 ; CHECK-LABEL: fcmpUleVector: | 139 ; CHECK-LABEL: fcmpUleVector |
| 142 ; CHECK: cmpnltps | 140 ; CHECK: cmpnltps |
| 143 } | 141 } |
| 144 | 142 |
| 145 define <4 x i32> @fcmpUltVector(<4 x float> %a, <4 x float> %b) { | 143 define <4 x i32> @fcmpUltVector(<4 x float> %a, <4 x float> %b) { |
| 146 entry: | 144 entry: |
| 147 %res.trunc = fcmp ult <4 x float> %a, %b | 145 %res.trunc = fcmp ult <4 x float> %a, %b |
| 148 %res = sext <4 x i1> %res.trunc to <4 x i32> | 146 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 149 ret <4 x i32> %res | 147 ret <4 x i32> %res |
| 150 ; CHECK-LABEL: fcmpUltVector: | 148 ; CHECK-LABEL: fcmpUltVector |
| 151 ; CHECK: cmpnleps | 149 ; CHECK: cmpnleps |
| 152 } | 150 } |
| 153 | 151 |
| 154 define <4 x i32> @fcmpUneVector(<4 x float> %a, <4 x float> %b) { | 152 define <4 x i32> @fcmpUneVector(<4 x float> %a, <4 x float> %b) { |
| 155 entry: | 153 entry: |
| 156 %res.trunc = fcmp une <4 x float> %a, %b | 154 %res.trunc = fcmp une <4 x float> %a, %b |
| 157 %res = sext <4 x i1> %res.trunc to <4 x i32> | 155 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 158 ret <4 x i32> %res | 156 ret <4 x i32> %res |
| 159 ; CHECK-LABEL: fcmpUneVector: | 157 ; CHECK-LABEL: fcmpUneVector |
| 160 ; CHECK: cmpneqps | 158 ; CHECK: cmpneqps |
| 161 } | 159 } |
| 162 | 160 |
| 163 define <4 x i32> @fcmpUnoVector(<4 x float> %a, <4 x float> %b) { | 161 define <4 x i32> @fcmpUnoVector(<4 x float> %a, <4 x float> %b) { |
| 164 entry: | 162 entry: |
| 165 %res.trunc = fcmp uno <4 x float> %a, %b | 163 %res.trunc = fcmp uno <4 x float> %a, %b |
| 166 %res = sext <4 x i1> %res.trunc to <4 x i32> | 164 %res = sext <4 x i1> %res.trunc to <4 x i32> |
| 167 ret <4 x i32> %res | 165 ret <4 x i32> %res |
| 168 ; CHECK-LABEL: fcmpUnoVector: | 166 ; CHECK-LABEL: fcmpUnoVector |
| 169 ; CHECK: cmpunordps | 167 ; CHECK: cmpunordps |
| 170 } | 168 } |
| OLD | NEW |