OLD | NEW |
(Empty) | |
| 1 ; This checks support for insertelement and extractelement. |
| 2 |
| 3 ; RUN: %llvm2ice --verbose inst %s | FileCheck %s |
| 4 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 5 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 6 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 7 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 8 |
| 9 ; insertelement operations |
| 10 |
| 11 define <4 x float> @insertelement_v4f32(<4 x float> %vec, float %elt) { |
| 12 entry: |
| 13 %res = insertelement <4 x float> %vec, float %elt, i32 1 |
| 14 ret <4 x float> %res |
| 15 ; CHECK-LABEL: insertelement_v4f32: |
| 16 ; CHECK: shufps |
| 17 ; CHECK: shufps |
| 18 } |
| 19 |
| 20 define <4 x i32> @insertelement_v4i32(<4 x i32> %vec, i32 %elt) { |
| 21 entry: |
| 22 %res = insertelement <4 x i32> %vec, i32 %elt, i32 1 |
| 23 ret <4 x i32> %res |
| 24 ; CHECK-LABEL: insertelement_v4i32: |
| 25 ; CHECK: shufps |
| 26 ; CHECK: shufps |
| 27 } |
| 28 |
| 29 define <8 x i16> @insertelement_v8i16(<8 x i16> %vec, i32 %elt.arg) { |
| 30 entry: |
| 31 %elt = trunc i32 %elt.arg to i16 |
| 32 %res = insertelement <8 x i16> %vec, i16 %elt, i32 1 |
| 33 ret <8 x i16> %res |
| 34 ; CHECK-LABEL: insertelement_v8i16 |
| 35 ; CHECK: pinsrw |
| 36 } |
| 37 |
| 38 define <16 x i8> @insertelement_v16i8(<16 x i8> %vec, i32 %elt.arg) { |
| 39 entry: |
| 40 %elt = trunc i32 %elt.arg to i8 |
| 41 %res = insertelement <16 x i8> %vec, i8 %elt, i32 1 |
| 42 ret <16 x i8> %res |
| 43 ; CHECK-LABEL: insertelement_v16i8: |
| 44 ; CHECK: movups |
| 45 ; CHECK: lea |
| 46 ; CHECK: mov |
| 47 } |
| 48 |
| 49 define <4 x i1> @insertelement_v4i1(<4 x i1> %vec, i32 %elt.arg) { |
| 50 entry: |
| 51 %elt = trunc i32 %elt.arg to i1 |
| 52 %res = insertelement <4 x i1> %vec, i1 %elt, i32 1 |
| 53 ret <4 x i1> %res |
| 54 ; CHECK-LABEL: insertelement_v4i1: |
| 55 ; CHECK: shufps |
| 56 ; CHECK: shufps |
| 57 } |
| 58 |
| 59 define <8 x i1> @insertelement_v8i1(<8 x i1> %vec, i32 %elt.arg) { |
| 60 entry: |
| 61 %elt = trunc i32 %elt.arg to i1 |
| 62 %res = insertelement <8 x i1> %vec, i1 %elt, i32 1 |
| 63 ret <8 x i1> %res |
| 64 ; CHECK-LABEL: insertelement_v8i1: |
| 65 ; CHECK: pinsrw |
| 66 } |
| 67 |
| 68 define <16 x i1> @insertelement_v16i1(<16 x i1> %vec, i32 %elt.arg) { |
| 69 entry: |
| 70 %elt = trunc i32 %elt.arg to i1 |
| 71 %res = insertelement <16 x i1> %vec, i1 %elt, i32 1 |
| 72 ret <16 x i1> %res |
| 73 ; CHECK-LABEL: insertelement_v16i1: |
| 74 ; CHECK: movups |
| 75 ; CHECK: lea |
| 76 ; CHECK: mov |
| 77 } |
| 78 |
| 79 ; extractelement operations |
| 80 |
| 81 define float @extractelement_v4f32(<4 x float> %vec) { |
| 82 entry: |
| 83 %res = extractelement <4 x float> %vec, i32 1 |
| 84 ret float %res |
| 85 ; CHECK-LABEL: extractelement_v4f32: |
| 86 ; CHECK: pshufd |
| 87 } |
| 88 |
| 89 define i32 @extractelement_v4i32(<4 x i32> %vec) { |
| 90 entry: |
| 91 %res = extractelement <4 x i32> %vec, i32 1 |
| 92 ret i32 %res |
| 93 ; CHECK-LABEL: extractelement_v4i32: |
| 94 ; CHECK: pshufd |
| 95 } |
| 96 |
| 97 define i32 @extractelement_v8i16(<8 x i16> %vec) { |
| 98 entry: |
| 99 %res = extractelement <8 x i16> %vec, i32 1 |
| 100 %res.ext = zext i16 %res to i32 |
| 101 ret i32 %res.ext |
| 102 ; CHECK-LABEL: extractelement_v8i16: |
| 103 ; CHECK: pextrw |
| 104 } |
| 105 |
| 106 define i32 @extractelement_v16i8(<16 x i8> %vec) { |
| 107 entry: |
| 108 %res = extractelement <16 x i8> %vec, i32 1 |
| 109 %res.ext = zext i8 %res to i32 |
| 110 ret i32 %res.ext |
| 111 ; CHECK-LABEL: extractelement_v16i8: |
| 112 ; CHECK: movups |
| 113 ; CHECK: lea |
| 114 ; CHECK: mov |
| 115 } |
| 116 |
| 117 define i32 @extractelement_v4i1(<4 x i1> %vec) { |
| 118 entry: |
| 119 %res = extractelement <4 x i1> %vec, i32 1 |
| 120 %res.ext = zext i1 %res to i32 |
| 121 ret i32 %res.ext |
| 122 ; CHECK-LABEL: extractelement_v4i1: |
| 123 ; CHECK: pshufd |
| 124 } |
| 125 |
| 126 define i32 @extractelement_v8i1(<8 x i1> %vec) { |
| 127 entry: |
| 128 %res = extractelement <8 x i1> %vec, i32 1 |
| 129 %res.ext = zext i1 %res to i32 |
| 130 ret i32 %res.ext |
| 131 ; CHECK-LABEL: extractelement_v8i1: |
| 132 ; CHECK: pextrw |
| 133 } |
| 134 |
| 135 define i32 @extractelement_v16i1(<16 x i1> %vec) { |
| 136 entry: |
| 137 %res = extractelement <16 x i1> %vec, i32 1 |
| 138 %res.ext = zext i1 %res to i32 |
| 139 ret i32 %res.ext |
| 140 ; CHECK-LABEL: extractelement_v16i1: |
| 141 ; CHECK: movups |
| 142 ; CHECK: lea |
| 143 ; CHECK: mov |
| 144 } |
| 145 |
| 146 ; ERRORS-NOT: ICE translation error |
| 147 ; DUMP-NOT: SZ |
OLD | NEW |