OLD | NEW |
(Empty) | |
| 1 ; RUN: opt -constant-insert-extract-element-index %s -S | FileCheck %s |
| 2 |
| 3 ; The datalayout is needed to determine the alignment of the load/stores. |
| 4 target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64
:64:64-p:32:32:32-v128:32:32" |
| 5 |
| 6 |
| 7 ; The following insert/extract elements are all indexed with an in-range |
| 8 ; constant, they should remain unchanged. |
| 9 |
| 10 define void @test_16xi1_unchanged(<16 x i1> %in) { |
| 11 ; CHECK-LABEL: test_16xi1_unchanged |
| 12 ; CHECK-NOT: alloca |
| 13 ; CHECK: extractelement |
| 14 %e.0 = extractelement <16 x i1> %in, i32 0 |
| 15 %e.1 = extractelement <16 x i1> %in, i32 1 |
| 16 %e.2 = extractelement <16 x i1> %in, i32 2 |
| 17 %e.3 = extractelement <16 x i1> %in, i32 3 |
| 18 %e.4 = extractelement <16 x i1> %in, i32 4 |
| 19 %e.5 = extractelement <16 x i1> %in, i32 5 |
| 20 %e.6 = extractelement <16 x i1> %in, i32 6 |
| 21 %e.7 = extractelement <16 x i1> %in, i32 7 |
| 22 %e.8 = extractelement <16 x i1> %in, i32 8 |
| 23 %e.9 = extractelement <16 x i1> %in, i32 9 |
| 24 %e.10 = extractelement <16 x i1> %in, i32 10 |
| 25 %e.11 = extractelement <16 x i1> %in, i32 11 |
| 26 %e.12 = extractelement <16 x i1> %in, i32 12 |
| 27 %e.13 = extractelement <16 x i1> %in, i32 13 |
| 28 %e.14 = extractelement <16 x i1> %in, i32 14 |
| 29 %e.15 = extractelement <16 x i1> %in, i32 15 |
| 30 ; CHECK-NOT: alloca |
| 31 ; CHECK: insertelement |
| 32 %i.0 = insertelement <16 x i1> %in, i1 true, i32 0 |
| 33 %i.1 = insertelement <16 x i1> %in, i1 true, i32 1 |
| 34 %i.2 = insertelement <16 x i1> %in, i1 true, i32 2 |
| 35 %i.3 = insertelement <16 x i1> %in, i1 true, i32 3 |
| 36 %i.4 = insertelement <16 x i1> %in, i1 true, i32 4 |
| 37 %i.5 = insertelement <16 x i1> %in, i1 true, i32 5 |
| 38 %i.6 = insertelement <16 x i1> %in, i1 true, i32 6 |
| 39 %i.7 = insertelement <16 x i1> %in, i1 true, i32 7 |
| 40 %i.8 = insertelement <16 x i1> %in, i1 true, i32 8 |
| 41 %i.9 = insertelement <16 x i1> %in, i1 true, i32 9 |
| 42 %i.10 = insertelement <16 x i1> %in, i1 true, i32 10 |
| 43 %i.11 = insertelement <16 x i1> %in, i1 true, i32 11 |
| 44 %i.12 = insertelement <16 x i1> %in, i1 true, i32 12 |
| 45 %i.13 = insertelement <16 x i1> %in, i1 true, i32 13 |
| 46 %i.14 = insertelement <16 x i1> %in, i1 true, i32 14 |
| 47 %i.15 = insertelement <16 x i1> %in, i1 true, i32 15 |
| 48 ; CHECK-NOT: alloca |
| 49 ret void |
| 50 } |
| 51 |
| 52 define void @test_8xi1_unchanged(<8 x i1> %in) { |
| 53 ; CHECK-LABEL: test_8xi1_unchanged |
| 54 ; CHECK-NOT: alloca |
| 55 ; CHECK: extractelement |
| 56 %e.0 = extractelement <8 x i1> %in, i32 0 |
| 57 %e.1 = extractelement <8 x i1> %in, i32 1 |
| 58 %e.2 = extractelement <8 x i1> %in, i32 2 |
| 59 %e.3 = extractelement <8 x i1> %in, i32 3 |
| 60 %e.4 = extractelement <8 x i1> %in, i32 4 |
| 61 %e.5 = extractelement <8 x i1> %in, i32 5 |
| 62 %e.6 = extractelement <8 x i1> %in, i32 6 |
| 63 %e.7 = extractelement <8 x i1> %in, i32 7 |
| 64 ; CHECK-NOT: alloca |
| 65 ; CHECK: insertelement |
| 66 %i.0 = insertelement <8 x i1> %in, i1 true, i32 0 |
| 67 %i.1 = insertelement <8 x i1> %in, i1 true, i32 1 |
| 68 %i.2 = insertelement <8 x i1> %in, i1 true, i32 2 |
| 69 %i.3 = insertelement <8 x i1> %in, i1 true, i32 3 |
| 70 %i.4 = insertelement <8 x i1> %in, i1 true, i32 4 |
| 71 %i.5 = insertelement <8 x i1> %in, i1 true, i32 5 |
| 72 %i.6 = insertelement <8 x i1> %in, i1 true, i32 6 |
| 73 %i.7 = insertelement <8 x i1> %in, i1 true, i32 7 |
| 74 ; CHECK-NOT: alloca |
| 75 ret void |
| 76 } |
| 77 |
| 78 define void @test_4xi1_unchanged(<4 x i1> %in) { |
| 79 ; CHECK-LABEL: test_4xi1_unchanged |
| 80 ; CHECK-NOT: alloca |
| 81 ; CHECK: extractelement |
| 82 %e.0 = extractelement <4 x i1> %in, i32 0 |
| 83 %e.1 = extractelement <4 x i1> %in, i32 1 |
| 84 %e.2 = extractelement <4 x i1> %in, i32 2 |
| 85 %e.3 = extractelement <4 x i1> %in, i32 3 |
| 86 ; CHECK-NOT: alloca |
| 87 ; CHECK: insertelement |
| 88 %i.0 = insertelement <4 x i1> %in, i1 true, i32 0 |
| 89 %i.1 = insertelement <4 x i1> %in, i1 true, i32 1 |
| 90 %i.2 = insertelement <4 x i1> %in, i1 true, i32 2 |
| 91 %i.3 = insertelement <4 x i1> %in, i1 true, i32 3 |
| 92 ; CHECK-NOT: alloca |
| 93 ret void |
| 94 } |
| 95 |
| 96 define void @test_16xi8_unchanged(<16 x i8> %in) { |
| 97 ; CHECK-LABEL: test_16xi8_unchanged |
| 98 ; CHECK-NOT: alloca |
| 99 ; CHECK: extractelement |
| 100 %e.0 = extractelement <16 x i8> %in, i32 0 |
| 101 %e.1 = extractelement <16 x i8> %in, i32 1 |
| 102 %e.2 = extractelement <16 x i8> %in, i32 2 |
| 103 %e.3 = extractelement <16 x i8> %in, i32 3 |
| 104 %e.4 = extractelement <16 x i8> %in, i32 4 |
| 105 %e.5 = extractelement <16 x i8> %in, i32 5 |
| 106 %e.6 = extractelement <16 x i8> %in, i32 6 |
| 107 %e.7 = extractelement <16 x i8> %in, i32 7 |
| 108 %e.8 = extractelement <16 x i8> %in, i32 8 |
| 109 %e.9 = extractelement <16 x i8> %in, i32 9 |
| 110 %e.10 = extractelement <16 x i8> %in, i32 10 |
| 111 %e.11 = extractelement <16 x i8> %in, i32 11 |
| 112 %e.12 = extractelement <16 x i8> %in, i32 12 |
| 113 %e.13 = extractelement <16 x i8> %in, i32 13 |
| 114 %e.14 = extractelement <16 x i8> %in, i32 14 |
| 115 %e.15 = extractelement <16 x i8> %in, i32 15 |
| 116 ; CHECK-NOT: alloca |
| 117 ; CHECK: insertelement |
| 118 %i.0 = insertelement <16 x i8> %in, i8 42, i32 0 |
| 119 %i.1 = insertelement <16 x i8> %in, i8 42, i32 1 |
| 120 %i.2 = insertelement <16 x i8> %in, i8 42, i32 2 |
| 121 %i.3 = insertelement <16 x i8> %in, i8 42, i32 3 |
| 122 %i.4 = insertelement <16 x i8> %in, i8 42, i32 4 |
| 123 %i.5 = insertelement <16 x i8> %in, i8 42, i32 5 |
| 124 %i.6 = insertelement <16 x i8> %in, i8 42, i32 6 |
| 125 %i.7 = insertelement <16 x i8> %in, i8 42, i32 7 |
| 126 %i.8 = insertelement <16 x i8> %in, i8 42, i32 8 |
| 127 %i.9 = insertelement <16 x i8> %in, i8 42, i32 9 |
| 128 %i.10 = insertelement <16 x i8> %in, i8 42, i32 10 |
| 129 %i.11 = insertelement <16 x i8> %in, i8 42, i32 11 |
| 130 %i.12 = insertelement <16 x i8> %in, i8 42, i32 12 |
| 131 %i.13 = insertelement <16 x i8> %in, i8 42, i32 13 |
| 132 %i.14 = insertelement <16 x i8> %in, i8 42, i32 14 |
| 133 %i.15 = insertelement <16 x i8> %in, i8 42, i32 15 |
| 134 ; CHECK-NOT: alloca |
| 135 ret void |
| 136 } |
| 137 |
| 138 define void @test_8xi16_unchanged(<8 x i16> %in) { |
| 139 ; CHECK-LABEL: test_8xi16_unchanged |
| 140 ; CHECK-NOT: alloca |
| 141 ; CHECK: extractelement |
| 142 %e.0 = extractelement <8 x i16> %in, i32 0 |
| 143 %e.1 = extractelement <8 x i16> %in, i32 1 |
| 144 %e.2 = extractelement <8 x i16> %in, i32 2 |
| 145 %e.3 = extractelement <8 x i16> %in, i32 3 |
| 146 %e.4 = extractelement <8 x i16> %in, i32 4 |
| 147 %e.5 = extractelement <8 x i16> %in, i32 5 |
| 148 %e.6 = extractelement <8 x i16> %in, i32 6 |
| 149 %e.7 = extractelement <8 x i16> %in, i32 7 |
| 150 ; CHECK-NOT: alloca |
| 151 ; CHECK: insertelement |
| 152 %i.0 = insertelement <8 x i16> %in, i16 42, i32 0 |
| 153 %i.1 = insertelement <8 x i16> %in, i16 42, i32 1 |
| 154 %i.2 = insertelement <8 x i16> %in, i16 42, i32 2 |
| 155 %i.3 = insertelement <8 x i16> %in, i16 42, i32 3 |
| 156 %i.4 = insertelement <8 x i16> %in, i16 42, i32 4 |
| 157 %i.5 = insertelement <8 x i16> %in, i16 42, i32 5 |
| 158 %i.6 = insertelement <8 x i16> %in, i16 42, i32 6 |
| 159 %i.7 = insertelement <8 x i16> %in, i16 42, i32 7 |
| 160 ; CHECK-NOT: alloca |
| 161 ret void |
| 162 } |
| 163 |
| 164 define void @test_4xi32_unchanged(<4 x i32> %in) { |
| 165 ; CHECK-LABEL: test_4xi32_unchanged |
| 166 ; CHECK-NOT: alloca |
| 167 ; CHECK: extractelement |
| 168 %e.0 = extractelement <4 x i32> %in, i32 0 |
| 169 %e.1 = extractelement <4 x i32> %in, i32 1 |
| 170 %e.2 = extractelement <4 x i32> %in, i32 2 |
| 171 %e.3 = extractelement <4 x i32> %in, i32 3 |
| 172 ; CHECK-NOT: alloca |
| 173 ; CHECK: insertelement |
| 174 %i.0 = insertelement <4 x i32> %in, i32 42, i32 0 |
| 175 %i.1 = insertelement <4 x i32> %in, i32 42, i32 1 |
| 176 %i.2 = insertelement <4 x i32> %in, i32 42, i32 2 |
| 177 %i.3 = insertelement <4 x i32> %in, i32 42, i32 3 |
| 178 ; CHECK-NOT: alloca |
| 179 ret void |
| 180 } |
| 181 |
| 182 define void @test_4xfloat_unchanged(<4 x float> %in) { |
| 183 ; CHECK-LABEL: test_4xfloat_unchanged |
| 184 ; CHECK-NOT: alloca |
| 185 ; CHECK: extractelement |
| 186 %e.0 = extractelement <4 x float> %in, i32 0 |
| 187 %e.1 = extractelement <4 x float> %in, i32 1 |
| 188 %e.2 = extractelement <4 x float> %in, i32 2 |
| 189 %e.3 = extractelement <4 x float> %in, i32 3 |
| 190 ; CHECK-NOT: alloca |
| 191 ; CHECK: insertelement |
| 192 %i.0 = insertelement <4 x float> %in, float 42.0, i32 0 |
| 193 %i.1 = insertelement <4 x float> %in, float 42.0, i32 1 |
| 194 %i.2 = insertelement <4 x float> %in, float 42.0, i32 2 |
| 195 %i.3 = insertelement <4 x float> %in, float 42.0, i32 3 |
| 196 ; CHECK-NOT: alloca |
| 197 ret void |
| 198 } |
| 199 |
| 200 |
| 201 ; The following insert/extract elements are all indexed with an |
| 202 ; out-of-range constant, they should get modified so that the constant |
| 203 ; is now in-range. |
| 204 |
| 205 define <16 x i1> @test_16xi1_out_of_range(<16 x i1> %in) { |
| 206 ; CHECK-LABEL: test_16xi1_out_of_range |
| 207 ; CHECK-NEXT: extractelement <16 x i1> %in, i32 0 |
| 208 %e.16 = extractelement <16 x i1> %in, i32 16 |
| 209 ; CHECK-NEXT: %i.16 = insertelement <16 x i1> %in, i1 %e.16, i32 0 |
| 210 %i.16 = insertelement <16 x i1> %in, i1 %e.16, i32 16 |
| 211 ; CHECK-NEXT: ret <16 x i1> %i.16 |
| 212 ret <16 x i1> %i.16 |
| 213 } |
| 214 |
| 215 define <8 x i1> @test_8xi1_out_of_range(<8 x i1> %in) { |
| 216 ; CHECK-LABEL: test_8xi1_out_of_range |
| 217 ; CHECK-NEXT: %e.8 = extractelement <8 x i1> %in, i32 0 |
| 218 %e.8 = extractelement <8 x i1> %in, i32 8 |
| 219 ; CHECK-NEXT: %i.8 = insertelement <8 x i1> %in, i1 %e.8, i32 0 |
| 220 %i.8 = insertelement <8 x i1> %in, i1 %e.8, i32 8 |
| 221 ; CHECK-NEXT: ret <8 x i1> %i.8 |
| 222 ret <8 x i1> %i.8 |
| 223 } |
| 224 |
| 225 define <4 x i1> @test_4xi1_out_of_range(<4 x i1> %in) { |
| 226 ; CHECK-LABEL: test_4xi1_out_of_range |
| 227 ; CHECK-NEXT: %e.4 = extractelement <4 x i1> %in, i32 0 |
| 228 %e.4 = extractelement <4 x i1> %in, i32 4 |
| 229 ; CHECK-NEXT: %i.4 = insertelement <4 x i1> %in, i1 %e.4, i32 0 |
| 230 %i.4 = insertelement <4 x i1> %in, i1 %e.4, i32 4 |
| 231 ; CHECK-NEXT: ret <4 x i1> %i.4 |
| 232 ret <4 x i1> %i.4 |
| 233 } |
| 234 |
| 235 define <16 x i8> @test_16xi8_out_of_range(<16 x i8> %in) { |
| 236 ; CHECK-LABEL: test_16xi8_out_of_range |
| 237 ; CHECK-NEXT: %e.16 = extractelement <16 x i8> %in, i32 0 |
| 238 %e.16 = extractelement <16 x i8> %in, i32 16 |
| 239 ; CHECK-NEXT: %i.16 = insertelement <16 x i8> %in, i8 %e.16, i32 0 |
| 240 %i.16 = insertelement <16 x i8> %in, i8 %e.16, i32 16 |
| 241 ; CHECK-NEXT: ret <16 x i8> %i.16 |
| 242 ret <16 x i8> %i.16 |
| 243 } |
| 244 |
| 245 define <8 x i16> @test_8xi16_out_of_range(<8 x i16> %in) { |
| 246 ; CHECK-LABEL: test_8xi16_out_of_range |
| 247 ; CHECK-NEXT: %e.8 = extractelement <8 x i16> %in, i32 0 |
| 248 %e.8 = extractelement <8 x i16> %in, i32 8 |
| 249 ; CHECK-NEXT: %i.8 = insertelement <8 x i16> %in, i16 %e.8, i32 0 |
| 250 %i.8 = insertelement <8 x i16> %in, i16 %e.8, i32 8 |
| 251 ; CHECK-NEXT: ret <8 x i16> %i.8 |
| 252 ret <8 x i16> %i.8 |
| 253 } |
| 254 |
| 255 define <4 x i32> @test_4xi32_out_of_range(<4 x i32> %in) { |
| 256 ; CHECK-LABEL: test_4xi32_out_of_range |
| 257 ; CHECK-NEXT: %e.4 = extractelement <4 x i32> %in, i32 0 |
| 258 %e.4 = extractelement <4 x i32> %in, i32 4 |
| 259 ; CHECK-NEXT: %i.4 = insertelement <4 x i32> %in, i32 %e.4, i32 0 |
| 260 %i.4 = insertelement <4 x i32> %in, i32 %e.4, i32 4 |
| 261 ; CHECK-NEXT: ret <4 x i32> %i.4 |
| 262 ret <4 x i32> %i.4 |
| 263 } |
| 264 |
| 265 define <4 x float> @test_4xfloat_out_of_range(<4 x float> %in) { |
| 266 ; CHECK-LABEL: test_4xfloat_out_of_range |
| 267 ; CHECK-NEXT: %e.4 = extractelement <4 x float> %in, i32 0 |
| 268 %e.4 = extractelement <4 x float> %in, i32 4 |
| 269 ; CHECK-NEXT: %i.4 = insertelement <4 x float> %in, float %e.4, i32 0 |
| 270 %i.4 = insertelement <4 x float> %in, float %e.4, i32 4 |
| 271 ; CHECK-NEXT: ret <4 x float> %i.4 |
| 272 ret <4 x float> %i.4 |
| 273 } |
| 274 |
| 275 define <4 x i32> @test_4xi32_out_of_range_urem(<4 x i32> %in) { |
| 276 ; CHECK-LABEL: test_4xi32_out_of_range_urem |
| 277 %e.4 = extractelement <4 x i32> %in, i32 4 ; CHECK-NEXT: {{.*}} extractelement
{{.*}} i32 0 |
| 278 %e.5 = extractelement <4 x i32> %in, i32 5 ; CHECK-NEXT: {{.*}} extractelement
{{.*}} i32 1 |
| 279 %e.6 = extractelement <4 x i32> %in, i32 6 ; CHECK-NEXT: {{.*}} extractelement
{{.*}} i32 2 |
| 280 %e.7 = extractelement <4 x i32> %in, i32 7 ; CHECK-NEXT: {{.*}} extractelement
{{.*}} i32 3 |
| 281 %e.8 = extractelement <4 x i32> %in, i32 8 ; CHECK-NEXT: {{.*}} extractelement
{{.*}} i32 0 |
| 282 %i.4 = insertelement <4 x i32> %in, i32 %e.4, i32 4 ; CHECK-NEXT: {{.*}} inser
telement {{.*}} i32 0 |
| 283 %i.5 = insertelement <4 x i32> %in, i32 %e.5, i32 5 ; CHECK-NEXT: {{.*}} inser
telement {{.*}} i32 1 |
| 284 %i.6 = insertelement <4 x i32> %in, i32 %e.6, i32 6 ; CHECK-NEXT: {{.*}} inser
telement {{.*}} i32 2 |
| 285 %i.7 = insertelement <4 x i32> %in, i32 %e.7, i32 7 ; CHECK-NEXT: {{.*}} inser
telement {{.*}} i32 3 |
| 286 %i.8 = insertelement <4 x i32> %in, i32 %e.8, i32 8 ; CHECK-NEXT: {{.*}} inser
telement {{.*}} i32 0 |
| 287 ; CHECK-NEXT: ret <4 x i32> %i.4 |
| 288 ret <4 x i32> %i.4 |
| 289 } |
| 290 |
| 291 ; The following insert/extract elements are all indexed with a variable, |
| 292 ; they should get modified. |
| 293 |
| 294 define <16 x i1> @test_16xi1_variable(<16 x i1> %in, i32 %idx) { |
| 295 ; CHECK-LABEL: test_16xi1_variable |
| 296 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 16, align 16 |
| 297 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <16 x i1>* |
| 298 ; CHECK-NEXT: store <16 x i1> %in, <16 x i1>* %[[ECAST]], align 16 |
| 299 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 %idx |
| 300 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 |
| 301 %e.16 = extractelement <16 x i1> %in, i32 %idx |
| 302 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 16, align 16 |
| 303 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <16 x i1>* |
| 304 ; CHECK-NEXT: store <16 x i1> %in, <16 x i1>* %[[ICAST]], align 16 |
| 305 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 %idx |
| 306 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 |
| 307 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <16 x i1>* %[[ICAST]], align 16 |
| 308 %i.16 = insertelement <16 x i1> %in, i1 %e.16, i32 %idx |
| 309 ; CHECK-NEXT: ret <16 x i1> %[[ILOAD]] |
| 310 ret <16 x i1> %i.16 |
| 311 } |
| 312 |
| 313 define <8 x i1> @test_8xi1_variable(<8 x i1> %in, i32 %idx) { |
| 314 ; CHECK-LABEL: test_8xi1_variable |
| 315 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 8, align 8 |
| 316 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <8 x i1>* |
| 317 ; CHECK-NEXT: store <8 x i1> %in, <8 x i1>* %[[ECAST]], align 8 |
| 318 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 %idx |
| 319 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 |
| 320 %e.8 = extractelement <8 x i1> %in, i32 %idx |
| 321 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 8, align 8 |
| 322 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <8 x i1>* |
| 323 ; CHECK-NEXT: store <8 x i1> %in, <8 x i1>* %[[ICAST]], align 8 |
| 324 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 %idx |
| 325 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 |
| 326 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <8 x i1>* %[[ICAST]], align 8 |
| 327 %i.8 = insertelement <8 x i1> %in, i1 %e.8, i32 %idx |
| 328 ; CHECK-NEXT: ret <8 x i1> %[[ILOAD]] |
| 329 ret <8 x i1> %i.8 |
| 330 } |
| 331 |
| 332 define <4 x i1> @test_4xi1_variable(<4 x i1> %in, i32 %idx) { |
| 333 ; CHECK-LABEL: test_4xi1_variable |
| 334 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 4, align 4 |
| 335 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <4 x i1>* |
| 336 ; CHECK-NEXT: store <4 x i1> %in, <4 x i1>* %[[ECAST]], align 4 |
| 337 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 %idx |
| 338 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 |
| 339 %e.4 = extractelement <4 x i1> %in, i32 %idx |
| 340 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 4, align 4 |
| 341 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <4 x i1>* |
| 342 ; CHECK-NEXT: store <4 x i1> %in, <4 x i1>* %[[ICAST]], align 4 |
| 343 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 %idx |
| 344 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 |
| 345 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x i1>* %[[ICAST]], align 4 |
| 346 %i.4 = insertelement <4 x i1> %in, i1 %e.4, i32 %idx |
| 347 ; CHECK-NEXT: ret <4 x i1> %[[ILOAD]] |
| 348 ret <4 x i1> %i.4 |
| 349 } |
| 350 |
| 351 define <16 x i8> @test_16xi8_variable(<16 x i8> %in, i32 %idx) { |
| 352 ; CHECK-LABEL: test_16xi8_variable |
| 353 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i8, i32 16, align 4 |
| 354 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i8* %[[EALLOCA]] to <16 x i8>* |
| 355 ; CHECK-NEXT: store <16 x i8> %in, <16 x i8>* %[[ECAST]], align 4 |
| 356 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i8* %[[EALLOCA]], i32 %idx |
| 357 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i8* %[[EGEP]], align 1 |
| 358 %e.16 = extractelement <16 x i8> %in, i32 %idx |
| 359 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i8, i32 16, align 4 |
| 360 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i8* %[[IALLOCA]] to <16 x i8>* |
| 361 ; CHECK-NEXT: store <16 x i8> %in, <16 x i8>* %[[ICAST]], align 4 |
| 362 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i8* %[[IALLOCA]], i32 %idx |
| 363 ; CHECK-NEXT: store i8 %[[ELOAD]], i8* %[[IGEP]], align 1 |
| 364 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <16 x i8>* %[[ICAST]], align 4 |
| 365 %i.16 = insertelement <16 x i8> %in, i8 %e.16, i32 %idx |
| 366 ; CHECK-NEXT: ret <16 x i8> %[[ILOAD]] |
| 367 ret <16 x i8> %i.16 |
| 368 } |
| 369 |
| 370 define <8 x i16> @test_8xi16_variable(<8 x i16> %in, i32 %idx) { |
| 371 ; CHECK-LABEL: test_8xi16_variable |
| 372 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i16, i32 8, align 4 |
| 373 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i16* %[[EALLOCA]] to <8 x i16>* |
| 374 ; CHECK-NEXT: store <8 x i16> %in, <8 x i16>* %[[ECAST]], align 4 |
| 375 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i16* %[[EALLOCA]], i32 %idx |
| 376 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i16* %[[EGEP]], align 2 |
| 377 %e.8 = extractelement <8 x i16> %in, i32 %idx |
| 378 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i16, i32 8, align 4 |
| 379 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i16* %[[IALLOCA]] to <8 x i16>* |
| 380 ; CHECK-NEXT: store <8 x i16> %in, <8 x i16>* %[[ICAST]], align 4 |
| 381 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i16* %[[IALLOCA]], i32 %idx |
| 382 ; CHECK-NEXT: store i16 %[[ELOAD]], i16* %[[IGEP]], align 2 |
| 383 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <8 x i16>* %[[ICAST]], align 4 |
| 384 %i.8 = insertelement <8 x i16> %in, i16 %e.8, i32 %idx |
| 385 ; CHECK-NEXT: ret <8 x i16> %[[ILOAD]] |
| 386 ret <8 x i16> %i.8 |
| 387 } |
| 388 |
| 389 define <4 x i32> @test_4xi32_variable(<4 x i32> %in, i32 %idx) { |
| 390 ; CHECK-LABEL: test_4xi32_variable |
| 391 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i32, i32 4, align 4 |
| 392 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i32* %[[EALLOCA]] to <4 x i32>* |
| 393 ; CHECK-NEXT: store <4 x i32> %in, <4 x i32>* %[[ECAST]], align 4 |
| 394 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i32* %[[EALLOCA]], i32 %idx |
| 395 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i32* %[[EGEP]], align 4 |
| 396 %e.4 = extractelement <4 x i32> %in, i32 %idx |
| 397 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i32, i32 4, align 4 |
| 398 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i32* %[[IALLOCA]] to <4 x i32>* |
| 399 ; CHECK-NEXT: store <4 x i32> %in, <4 x i32>* %[[ICAST]], align 4 |
| 400 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i32* %[[IALLOCA]], i32 %idx |
| 401 ; CHECK-NEXT: store i32 %[[ELOAD]], i32* %[[IGEP]], align 4 |
| 402 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x i32>* %[[ICAST]], align 4 |
| 403 %i.4 = insertelement <4 x i32> %in, i32 %e.4, i32 %idx |
| 404 ; CHECK-NEXT: ret <4 x i32> %[[ILOAD]] |
| 405 ret <4 x i32> %i.4 |
| 406 } |
| 407 |
| 408 define <4 x float> @test_4xfloat_variable(<4 x float> %in, i32 %idx) { |
| 409 ; CHECK-LABEL: test_4xfloat_variable |
| 410 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca float, i32 4, align 4 |
| 411 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast float* %[[EALLOCA]] to <4 x float>* |
| 412 ; CHECK-NEXT: store <4 x float> %in, <4 x float>* %[[ECAST]], align 4 |
| 413 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr float* %[[EALLOCA]], i32 %idx |
| 414 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load float* %[[EGEP]], align 4 |
| 415 %e.4 = extractelement <4 x float> %in, i32 %idx |
| 416 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca float, i32 4, align 4 |
| 417 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast float* %[[IALLOCA]] to <4 x float>* |
| 418 ; CHECK-NEXT: store <4 x float> %in, <4 x float>* %[[ICAST]], align 4 |
| 419 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr float* %[[IALLOCA]], i32 %idx |
| 420 ; CHECK-NEXT: store float %[[ELOAD]], float* %[[IGEP]], align 4 |
| 421 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x float>* %[[ICAST]], align 4 |
| 422 %i.4 = insertelement <4 x float> %in, float %e.4, i32 %idx |
| 423 ; CHECK-NEXT: ret <4 x float> %[[ILOAD]] |
| 424 ret <4 x float> %i.4 |
| 425 } |
OLD | NEW |