• Home
  • Raw
  • Download

Lines Matching refs:vector

6 func @create_vector_mask_to_constant_mask() -> (vector<4x3xi1>) {
9 // CHECK: vector.constant_mask [3, 2] : vector<4x3xi1>
10 %0 = vector.create_mask %c3, %c2 : vector<4x3xi1>
11 return %0 : vector<4x3xi1>
16 func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
17 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
18 %1 = vector.extract_strided_slice %0
20 : vector<4x3xi1> to vector<2x2xi1>
21 // CHECK: vector.constant_mask [2, 2] : vector<2x2xi1>
22 return %1 : vector<2x2xi1>
27 func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
28 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
29 %1 = vector.extract_strided_slice %0
31 : vector<4x3xi1> to vector<2x2xi1>
32 // CHECK: vector.constant_mask [1, 2] : vector<2x2xi1>
33 return %1 : vector<2x2xi1>
38 func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
39 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
40 %1 = vector.extract_strided_slice %0
42 : vector<4x3xi1> to vector<2x2xi1>
43 // CHECK: vector.constant_mask [2, 1] : vector<2x2xi1>
44 return %1 : vector<2x2xi1>
49 func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) {
50 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
51 %1 = vector.extract_strided_slice %0
53 : vector<4x3xi1> to vector<2x2xi1>
54 // CHECK: vector.constant_mask [0, 0] : vector<2x2xi1>
55 return %1 : vector<2x2xi1>
60 func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
61 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
62 %1 = vector.extract_strided_slice %0
64 : vector<4x3xi1> to vector<2x1xi1>
65 // CHECK: vector.constant_mask [0, 0] : vector<2x1xi1>
66 return %1 : vector<2x1xi1>
71 func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
72 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
73 %1 = vector.extract_strided_slice %0
75 : vector<4x3xi1> to vector<2x1xi1>
76 // CHECK: vector.constant_mask [2, 1] : vector<2x1xi1>
77 return %1 : vector<2x1xi1>
82 func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) {
83 %0 = vector.constant_mask [2, 2] : vector<4x3xi1>
84 %1 = vector.extract_strided_slice %0
86 : vector<4x3xi1> to vector<2x1xi1>
87 // CHECK: vector.constant_mask [1, 1] : vector<2x1xi1>
88 return %1 : vector<2x1xi1>
94 // CHECK-SAME: (%[[ARG:.*]]: vector<4x3xi1>)
95 // CHECK-NEXT: return %[[ARG]] : vector<4x3xi1>
96 func @extract_strided_fold(%arg : vector<4x3xi1>) -> (vector<4x3xi1>) {
97 %0 = vector.extract_strided_slice %arg
99 : vector<4x3xi1> to vector<4x3xi1>
100 return %0 : vector<4x3xi1>
106 // CHECK-SAME: (%[[ARG:.*]]: vector<4x4xf32>
107 // CHECK-NEXT: return %[[ARG]] : vector<4x4xf32>
108 func @extract_strided_fold_insert(%a: vector<4x4xf32>, %b: vector<8x16xf32>)
109 -> (vector<4x4xf32>) {
110 %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]}
111 : vector<4x4xf32> into vector<8x16xf32>
112 %1 = vector.extract_strided_slice %0
114 : vector<8x16xf32> to vector<4x4xf32>
115 return %1 : vector<4x4xf32>
120 // Case where the vector inserted is a subset of the vector extracted.
122 // CHECK-SAME: (%[[ARG0:.*]]: vector<6x4xf32>
123 // CHECK-NEXT: %[[EXT:.*]] = vector.extract_strided_slice %[[ARG0]]
125 // CHECK-SAME: : vector<6x4xf32> to vector<4x4xf32>
126 // CHECK-NEXT: return %[[EXT]] : vector<4x4xf32>
127 func @extract_strided_fold_insert(%a: vector<6x4xf32>, %b: vector<8x16xf32>)
128 -> (vector<4x4xf32>) {
129 %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]}
130 : vector<6x4xf32> into vector<8x16xf32>
131 %1 = vector.extract_strided_slice %0
133 : vector<8x16xf32> to vector<4x4xf32>
134 return %1 : vector<4x4xf32>
141 // CHECK-SAME: (%[[ARG0:.*]]: vector<4x4xf32>, %[[ARG1:.*]]: vector<8x16xf32>
142 // CHECK: %[[INS:.*]] = vector.insert_strided_slice %[[ARG0]], %[[ARG1]]
144 // CHECK-SAME: : vector<4x4xf32> into vector<8x16xf32>
145 // CHECK: %[[EXT:.*]] = vector.extract_strided_slice %[[INS]]
147 // CHECK-SAME: : vector<8x16xf32> to vector<6x4xf32>
148 // CHECK-NEXT: return %[[EXT]] : vector<6x4xf32>
149 func @extract_strided_fold_negative(%a: vector<4x4xf32>, %b: vector<8x16xf32>)
150 -> (vector<6x4xf32>) {
151 %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]}
152 : vector<4x4xf32> into vector<8x16xf32>
153 %1 = vector.extract_strided_slice %0
155 : vector<8x16xf32> to vector<6x4xf32>
156 return %1 : vector<6x4xf32>
163 // CHECK-SAME: (%[[ARG0:.*]]: vector<2x8xf32>, %[[ARG1:.*]]: vector<1x4xf32>,
164 // CHECK-NEXT: %[[EXT:.*]] = vector.extract_strided_slice %[[ARG1]]
166 // CHECK-SAME: : vector<1x4xf32> to vector<1x1xf32>
167 // CHECK-NEXT: return %[[EXT]] : vector<1x1xf32>
168 func @extract_strided_fold_insert(%a: vector<2x8xf32>, %b: vector<1x4xf32>,
169 %c : vector<1x4xf32>) -> (vector<1x1xf32>) {
170 %0 = vector.insert_strided_slice %b, %a {offsets = [0, 1], strides = [1, 1]}
171 : vector<1x4xf32> into vector<2x8xf32>
172 %1 = vector.insert_strided_slice %c, %0 {offsets = [1, 0], strides = [1, 1]}
173 : vector<1x4xf32> into vector<2x8xf32>
174 %2 = vector.extract_strided_slice %1
176 : vector<2x8xf32> to vector<1x1xf32>
177 return %2 : vector<1x1xf32>
183 // CHECK-SAME: ([[ARG:%.*]]: vector<4xf32>)
184 func @transpose_1D_identity(%arg : vector<4xf32>) -> vector<4xf32> {
186 %0 = vector.transpose %arg, [0] : vector<4xf32> to vector<4xf32>
188 return %0 : vector<4xf32>
194 // CHECK-SAME: ([[ARG:%.*]]: vector<4x3xf32>)
195 func @transpose_2D_identity(%arg : vector<4x3xf32>) -> vector<4x3xf32> {
197 %0 = vector.transpose %arg, [0, 1] : vector<4x3xf32> to vector<4x3xf32>
199 return %0 : vector<4x3xf32>
205 // CHECK-SAME: ([[ARG:%.*]]: vector<4x3x2xf32>)
206 func @transpose_3D_identity(%arg : vector<4x3x2xf32>) -> vector<4x3x2xf32> {
208 %0 = vector.transpose %arg, [0, 1, 2] : vector<4x3x2xf32> to vector<4x3x2xf32>
210 return %0 : vector<4x3x2xf32>
216 // CHECK-SAME: ([[ARG:%.*]]: vector<4x3xf32>)
217 func @transpose_2D_sequence(%arg : vector<4x3xf32>) -> vector<4x3xf32> {
219 %0 = vector.transpose %arg, [1, 0] : vector<4x3xf32> to vector<3x4xf32>
220 %1 = vector.transpose %0, [0, 1] : vector<3x4xf32> to vector<3x4xf32>
221 %2 = vector.transpose %1, [1, 0] : vector<3x4xf32> to vector<4x3xf32>
222 %3 = vector.transpose %2, [0, 1] : vector<4x3xf32> to vector<4x3xf32>
224 %4 = addf %2, %3 : vector<4x3xf32>
226 return %4 : vector<4x3xf32>
232 // CHECK-SAME: ([[ARG:%.*]]: vector<4x3x2xf32>)
233 func @transpose_3D_sequence(%arg : vector<4x3x2xf32>) -> vector<4x3x2xf32> {
234 // CHECK: [[T0:%.*]] = vector.transpose [[ARG]], [2, 1, 0]
235 %0 = vector.transpose %arg, [1, 2, 0] : vector<4x3x2xf32> to vector<3x2x4xf32>
236 %1 = vector.transpose %0, [1, 0, 2] : vector<3x2x4xf32> to vector<2x3x4xf32>
238 %2 = vector.transpose %1, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32>
239 %3 = vector.transpose %2, [2, 1, 0] : vector<4x3x2xf32> to vector<2x3x4xf32>
241 %4 = mulf %1, %3 : vector<2x3x4xf32>
242 // CHECK: [[T5:%.*]] = vector.transpose [[MUL]], [2, 1, 0]
243 %5 = vector.transpose %4, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32>
245 %6 = vector.transpose %3, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32>
247 %7 = addf %5, %6 : vector<4x3x2xf32>
249 return %7 : vector<4x3x2xf32>
255 func @cast_transfers(%A: memref<4x8xf32>) -> (vector<4x8xf32>) {
260 …// CHECK: vector.transfer_read %{{.*}} {masked = [false, false]} : memref<4x8xf32>, vector<4x8xf32>
261 %1 = vector.transfer_read %0[%c0, %c0], %f0 : memref<?x?xf32>, vector<4x8xf32>
263 …// CHECK: vector.transfer_write %{{.*}} {masked = [false, false]} : vector<4x8xf32>, memref<4x8xf3…
264 vector.transfer_write %1, %0[%c0, %c0] : vector<4x8xf32>, memref<?x?xf32>
265 return %1 : vector<4x8xf32>
271 // CHECK-SAME: %[[V:[a-zA-Z0-9]*]]: vector<2x3xf32>,
277 %v: vector<2x3xf32>, %f0: f32, %f1: f32, %f2: f32, %f3: f32)
280 %0 = vector.insert %f0, %v[0, 0] : f32 into vector<2x3xf32>
281 %1 = vector.insert %f1, %0[0, 1] : f32 into vector<2x3xf32>
282 %2 = vector.insert %f2, %1[1, 0] : f32 into vector<2x3xf32>
283 %3 = vector.insert %f3, %2[1, 1] : f32 into vector<2x3xf32>
284 %4 = vector.transpose %3, [1, 0] : vector<2x3xf32> to vector<3x2xf32>
285 %5 = vector.insert %f3, %4[1, 0] : f32 into vector<3x2xf32>
286 %6 = vector.transpose %5, [1, 0] : vector<3x2xf32> to vector<2x3xf32>
288 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0].
289 %r1 = vector.extract %3[1, 0] : vector<2x3xf32>
291 // Expected %f1 from %1 = vector.insert %f1, %0[0, 1] followed by
293 %r2 = vector.extract %4[1, 0] : vector<3x2xf32>
295 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0] followed by double
297 %r3 = vector.extract %6[1, 0] : vector<2x3xf32>
306 // CHECK-SAME: %[[V:[a-zA-Z0-9]*]]: vector<2x3x4xf32>,
312 %v: vector<2x3x4xf32>, %f0: f32, %f1: f32, %f2: f32, %f3: f32)
315 %0 = vector.insert %f0, %v[0, 0, 0] : f32 into vector<2x3x4xf32>
316 %1 = vector.insert %f1, %0[0, 1, 0] : f32 into vector<2x3x4xf32>
317 %2 = vector.insert %f2, %1[1, 0, 0] : f32 into vector<2x3x4xf32>
318 %3 = vector.insert %f3, %2[0, 0, 1] : f32 into vector<2x3x4xf32>
319 %4 = vector.transpose %3, [1, 2, 0] : vector<2x3x4xf32> to vector<3x4x2xf32>
320 %5 = vector.insert %f3, %4[1, 0, 0] : f32 into vector<3x4x2xf32>
321 %6 = vector.transpose %5, [1, 2, 0] : vector<3x4x2xf32> to vector<4x2x3xf32>
322 %7 = vector.insert %f3, %6[1, 0, 0] : f32 into vector<4x2x3xf32>
323 %8 = vector.transpose %7, [1, 2, 0] : vector<4x2x3xf32> to vector<2x3x4xf32>
325 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0, 0].
326 %r1 = vector.extract %3[1, 0, 0] : vector<2x3x4xf32>
328 // Expected %f1 from %1 = vector.insert %f1, %0[0, 1, 0] followed by
330 %r2 = vector.extract %4[1, 0, 0] : vector<3x4x2xf32>
332 // Expected %f3 from %3 = vector.insert %f3, %0[0, 0, 1] followed by double
334 %r3 = vector.extract %6[1, 0, 0] : vector<4x2x3xf32>
336 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0, 0] followed by triple
338 %r4 = vector.extract %8[1, 0, 0] : vector<2x3x4xf32>
347 // CHECK-SAME: %[[V:[a-zA-Z0-9]*]]: vector<2x3x4xf32>,
348 // CHECK-SAME: %[[F0:[a-zA-Z0-9]*]]: vector<4xf32>,
349 // CHECK-SAME: %[[F1:[a-zA-Z0-9]*]]: vector<4xf32>,
350 // CHECK-SAME: %[[F2:[a-zA-Z0-9]*]]: vector<4xf32>,
351 // CHECK-SAME: %[[F3:[a-zA-Z0-9]*]]: vector<4xf32>
353 %v: vector<2x3x4xf32>,
354 %f0: vector<4xf32>, %f1: vector<4xf32>, %f2: vector<4xf32>, %f3: vector<4xf32>)
355 -> (vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32>)
357 %0 = vector.insert %f0, %v[0, 0] : vector<4xf32> into vector<2x3x4xf32>
358 %1 = vector.insert %f1, %0[0, 1] : vector<4xf32> into vector<2x3x4xf32>
359 %2 = vector.insert %f2, %1[1, 0] : vector<4xf32> into vector<2x3x4xf32>
360 %3 = vector.insert %f3, %2[1, 1] : vector<4xf32> into vector<2x3x4xf32>
361 %4 = vector.transpose %3, [1, 0, 2] : vector<2x3x4xf32> to vector<3x2x4xf32>
362 %5 = vector.transpose %4, [1, 0, 2] : vector<3x2x4xf32> to vector<2x3x4xf32>
364 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0].
365 %r1 = vector.extract %3[1, 0] : vector<2x3x4xf32>
367 // Expected %f1 from %1 = vector.insert %f1, %0[0, 1] followed by
369 %r2 = vector.extract %4[1, 0] : vector<3x2x4xf32>
371 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0, 0] followed by double
373 %r3 = vector.extract %5[1, 0] : vector<2x3x4xf32>
375 %6 = vector.transpose %3, [1, 2, 0] : vector<2x3x4xf32> to vector<3x4x2xf32>
376 %7 = vector.transpose %6, [1, 2, 0] : vector<3x4x2xf32> to vector<4x2x3xf32>
377 %8 = vector.transpose %7, [1, 2, 0] : vector<4x2x3xf32> to vector<2x3x4xf32>
379 // Expected %f2 from %2 = vector.insert %f2, %1[1, 0, 0] followed by triple
381 %r4 = vector.extract %8[1, 0] : vector<2x3x4xf32>
384 // CHECK-SAME: vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32>
385 return %r1, %r2, %r3, %r4 : vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32>
391 // CHECK-SAME: %[[A:[a-zA-Z0-9]*]]: vector<3x4x5x6xf32>
392 func @fold_extracts(%a : vector<3x4x5x6xf32>) -> (f32, vector<4x5x6xf32>) {
393 %b = vector.extract %a[0] : vector<3x4x5x6xf32>
394 %c = vector.extract %b[1, 2] : vector<4x5x6xf32>
395 // CHECK-NEXT: vector.extract %[[A]][0, 1, 2, 3] : vector<3x4x5x6xf32>
396 %d = vector.extract %c[3] : vector<6xf32>
398 // CHECK-NEXT: vector.extract %[[A]][0] : vector<3x4x5x6xf32>
399 %e = vector.extract %a[0] : vector<3x4x5x6xf32>
402 return %d, %e : f32, vector<4x5x6xf32>
408 // CHECK-SAME: %[[A:[a-zA-Z0-9]*]]: vector<3x4x5x6xf32>
409 // CHECK-SAME: %[[B:[a-zA-Z0-9]*]]: vector<3x6x5x6xf32>
411 %a : vector<3x4x5x6xf32>, %b : vector<3x6x5x6xf32>) -> (
412 vector<6xf32>, vector<6xf32>, vector<6xf32>) {
417 // CHECK-NEXT: vector.extract %[[A]][0, 2, 1] : vector<3x4x5x6xf32>
418 %0 = vector.transpose %a, [0, 2, 1, 3] : vector<3x4x5x6xf32> to vector<3x5x4x6xf32>
419 %1 = vector.extract %0[0, 1, 2] : vector<3x5x4x6xf32>
425 // CHECK-NEXT: vector.extract %[[A]][2, 0, 1] : vector<3x4x5x6xf32>
426 %2 = vector.transpose %a, [1, 2, 0, 3] : vector<3x4x5x6xf32> to vector<4x5x3x6xf32>
427 %3 = vector.extract %2[0, 1, 2] : vector<4x5x3x6xf32>
429 // Not a minor identity map so intra-vector level has been permuted
430 // CHECK-NEXT: vector.transpose %[[B]], [0, 2, 3, 1]
431 // CHECK-NEXT: vector.extract %{{.*}}[0, 1, 2]
432 %4 = vector.transpose %b, [0, 2, 3, 1] : vector<3x6x5x6xf32> to vector<3x5x6x6xf32>
433 %5 = vector.extract %4[0, 1, 2] : vector<3x5x6x6xf32>
435 return %1, %3, %5 : vector<6xf32>, vector<6xf32>, vector<6xf32>
444 %b = vector.broadcast %a : f32 to vector<1x2x4xf32>
445 %r = vector.extract %b[0, 1, 2] : vector<1x2x4xf32>
452 // CHECK-SAME: %[[A:.*]]: vector<4xf32>
453 // CHECK: return %[[A]] : vector<4xf32>
454 func @fold_extract_broadcast_vector(%a : vector<4xf32>) -> vector<4xf32> {
455 %b = vector.broadcast %a : vector<4xf32> to vector<1x2x4xf32>
456 %r = vector.extract %b[0, 1] : vector<1x2x4xf32>
457 return %r : vector<4xf32>
463 // CHECK-SAME: %[[A:.*]]: vector<4xf32>
464 // CHECK: %[[R:.*]] = vector.extract %[[A]][2] : vector<4xf32>
466 func @fold_extract_broadcast(%a : vector<4xf32>) -> f32 {
467 %b = vector.broadcast %a : vector<4xf32> to vector<1x2x4xf32>
468 %r = vector.extract %b[0, 1, 2] : vector<1x2x4xf32>
475 // doesn't match the type of vector.extract.
477 // CHECK: %[[B:.*]] = vector.broadcast %{{.*}} : f32 to vector<1x2x4xf32>
478 // CHECK: %[[R:.*]] = vector.extract %[[B]][0, 1] : vector<1x2x4xf32>
479 // CHECK: return %[[R]] : vector<4xf32>
480 func @fold_extract_broadcast_negative(%a : f32) -> vector<4xf32> {
481 %b = vector.broadcast %a : f32 to vector<1x2x4xf32>
482 %r = vector.extract %b[0, 1] : vector<1x2x4xf32>
483 return %r : vector<4xf32>
489 // CHECK-SAME: (%[[A0:.*]]: vector<5x1x3x2xf32>, %[[A1:.*]]: vector<8x4x2xf32>
490 // CHECK: %[[R0:.*]] = vector.extract %[[A0]][1, 0, 1, 1] : vector<5x1x3x2xf32>
491 // CHECK: %[[R1:.*]] = vector.extract %[[A0]][1, 0, 2] : vector<5x1x3x2xf32>
492 // CHECK: %[[R2:.*]] = vector.extract %[[A1]][7] : vector<8x4x2xf32>
493 // CHECK: return %[[R0]], %[[R1]], %[[R2]] : f32, vector<2xf32>, vector<4x2xf32>
494 func @fold_extract_shapecast(%arg0 : vector<5x1x3x2xf32>,
495 %arg1 : vector<8x4x2xf32>)
496 -> (f32, vector<2xf32>, vector<4x2xf32>) {
497 %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<15x2xf32>
498 %1 = vector.shape_cast %arg1 : vector<8x4x2xf32> to vector<4x2x4x2xf32>
499 %r1 = vector.extract %0[4, 1] : vector<15x2xf32>
500 %r2 = vector.extract %0[5] : vector<15x2xf32>
501 %r3 = vector.extract %1[3, 1] : vector<4x2x4x2xf32>
502 return %r1, %r2, %r3 : f32, vector<2xf32>, vector<4x2xf32>
508 // CHECK: %[[V:.*]] = vector.shape_cast %{{.*}} : vector<16xf32> to vector<2x4x2xf32>
509 // CHECK: %[[R:.*]] = vector.extract %[[V]][1] : vector<2x4x2xf32>
510 // CHECK: return %[[R]] : vector<4x2xf32>
511 func @fold_extract_shapecast_negative(%arg0 : vector<16xf32>,
512 %arg1 : vector<8x4x2xf32>) -> vector<4x2xf32> {
513 %0 = vector.shape_cast %arg0 : vector<16xf32> to vector<2x4x2xf32>
514 %r = vector.extract %0[1] : vector<2x4x2xf32>
515 return %r : vector<4x2xf32>
522 func @fold_vector_transfers(%A: memref<?x8xf32>) -> (vector<4x8xf32>, vector<4x9xf32>) {
526 // CHECK: vector.transfer_read %{{.*}} {masked = [true, false]}
527 %1 = vector.transfer_read %A[%c0, %c0], %f0 : memref<?x8xf32>, vector<4x8xf32>
529 // CHECK: vector.transfer_write %{{.*}} {masked = [true, false]}
530 vector.transfer_write %1, %A[%c0, %c0] : vector<4x8xf32>, memref<?x8xf32>
533 // CHECK: vector.transfer_read %{{.*}}
535 %2 = vector.transfer_read %A[%c0, %c0], %f0 : memref<?x8xf32>, vector<4x9xf32>
538 // CHECK: vector.transfer_write %{{.*}}
540 vector.transfer_write %2, %A[%c0, %c0] : vector<4x9xf32>, memref<?x8xf32>
543 return %1, %2 : vector<4x8xf32>, vector<4x9xf32>
549 // CHECK-SAME: %[[A:.*]]: vector<4x8xf32>
550 // CHECK-SAME: %[[B:.*]]: vector<2xi32>
551 // CHECK: return %[[A]], %[[B]] : vector<4x8xf32>, vector<2xi32>
552 func @bitcast_folding(%I1: vector<4x8xf32>, %I2: vector<2xi32>) -> (vector<4x8xf32>, vector<2xi32>)…
553 %0 = vector.bitcast %I1 : vector<4x8xf32> to vector<4x8xf32>
554 %1 = vector.bitcast %I2 : vector<2xi32> to vector<4xi16>
555 %2 = vector.bitcast %1 : vector<4xi16> to vector<2xi32>
556 return %0, %2 : vector<4x8xf32>, vector<2xi32>
562 // CHECK: %[[CST:.*]] = constant dense<42> : vector<4xi32>
563 // CHECK-NOT: vector.broadcast
565 func @broadcast_folding1() -> vector<4xi32> {
567 %1 = vector.broadcast %0 : i32 to vector<4xi32>
568 return %1 : vector<4xi32>
574 // CHECK: %[[CST:.*]] = constant dense<42> : vector<4x16xi32>
575 // CHECK-NOT: vector.broadcast
577 func @broadcast_folding2() -> vector<4x16xi32> {
579 %1 = vector.broadcast %0 : i32 to vector<16xi32>
580 %2 = vector.broadcast %1 : vector<16xi32> to vector<4x16xi32>
581 return %2 : vector<4x16xi32>
587 // CHECK: %[[CST0:.*]] = constant dense<2.000000e+00> : vector<20x2xf32>
588 // CHECK: %[[CST1:.*]] = constant dense<1> : vector<3x4x2xi32>
589 // CHECK: return %[[CST0]], %[[CST1]] : vector<20x2xf32>, vector<3x4x2xi32>
590 func @shape_cast_constant() -> (vector<20x2xf32>, vector<3x4x2xi32>) {
591 %cst = constant dense<2.000000e+00> : vector<5x4x2xf32>
592 %cst_1 = constant dense<1> : vector<12x2xi32>
593 %0 = vector.shape_cast %cst : vector<5x4x2xf32> to vector<20x2xf32>
594 %1 = vector.shape_cast %cst_1 : vector<12x2xi32> to vector<3x4x2xi32>
595 return %0, %1 : vector<20x2xf32>, vector<3x4x2xi32>
601 // CHECK: %[[CST0:.*]] = constant dense<2.000000e+00> : vector<12x2xf32>
602 // CHECK: %[[CST1:.*]] = constant dense<1> : vector<2x13x3xi32>
603 // CHECK: return %[[CST0]], %[[CST1]] : vector<12x2xf32>, vector<2x13x3xi32>
604 func @extract_strided_constant() -> (vector<12x2xf32>, vector<2x13x3xi32>) {
605 %cst = constant dense<2.000000e+00> : vector<29x7xf32>
606 %cst_1 = constant dense<1> : vector<4x37x9xi32>
607 %0 = vector.extract_strided_slice %cst
609 : vector<29x7xf32> to vector<12x2xf32>
610 %1 = vector.extract_strided_slice %cst_1
612 : vector<4x37x9xi32> to vector<2x13x3xi32>
613 return %0, %1 : vector<12x2xf32>, vector<2x13x3xi32>