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