4
4
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
5
5
6
6
typedef int vi4 __attribute__ ((ext_vector_type(4 )));
7
- typedef int vi3 __attribute__ ((ext_vector_type(3 )));
8
7
typedef int vi2 __attribute__ ((ext_vector_type(2 )));
9
8
typedef double vd2 __attribute__ ((ext_vector_type(2 )));
10
9
typedef long vl2 __attribute__ ((ext_vector_type(2 )));
11
10
typedef unsigned short vus2 __attribute__ ((ext_vector_type(2 )));
12
11
12
+ typedef int vi7 __attribute__ ((ext_vector_type(7 )));
13
+
13
14
// CIR: cir.func {{@.*vector_int_test.*}}
14
15
// LLVM: define void {{@.*vector_int_test.*}}
15
16
void vector_int_test (int x) {
@@ -259,9 +260,9 @@ void vector_extend() {
259
260
// CIR-NEXT: %[[#PVECB:]] = cir.alloca !cir.vector<!s32i x 2>
260
261
// LLVM-NEXT: %[[#PVECB:]] = alloca <2 x i32>
261
262
262
- vi3 c = {};
263
- // CIR-NEXT: %[[#PVECC:]] = cir.alloca !cir.vector<!s32i x 3 >
264
- // LLVM-NEXT: %[[#PVECC:]] = alloca <3 x i32>
263
+ vi7 c = {};
264
+ // CIR-NEXT: %[[#PVECC:]] = cir.alloca !cir.vector<!s32i x 7 >
265
+ // LLVM-NEXT: %[[#PVECC:]] = alloca <7 x i32>
265
266
266
267
a.lo = b;
267
268
// CIR: %[[#VECB:]] = cir.load %[[#PVECB]] : !cir.ptr<!cir.vector<!s32i x 2>>, !cir.vector<!s32i x 2>
@@ -280,31 +281,30 @@ void vector_extend() {
280
281
// The suffixes .lo (or .even) and .hi (or .odd) for a 3-component vector type
281
282
// operate as if the 3-component vector type is a 4-component vector type with
282
283
// the value in the w component undefined.
283
- b = c.hi ;
284
-
285
- // CIR-NEXT: %[[#VECC:]] = cir.load %[[#PVECC]] : !cir.ptr<!cir.vector<!s32i x 3>>, !cir.vector<!s32i x 3>
286
- // CIR-NEXT: %[[#HIPART:]] = cir.vec.shuffle(%[[#VECC]], %[[#VECC]] : !cir.vector<!s32i x 3>) [#cir.int<2> : !s32i, #cir.int<3> : !s32i] : !cir.vector<!s32i x 2>
287
- // CIR-NEXT: cir.store %[[#HIPART]], %[[#PVECB]] : !cir.vector<!s32i x 2>, !cir.ptr<!cir.vector<!s32i x 2>>
284
+ a = c.hi ;
288
285
289
- // LLVM -NEXT: %[[#VECC:]] = load <3 x i32>, ptr %[[#PVECC]], align 16
290
- // LLVM -NEXT: %[[#HIPART:]] = shufflevector <3 x i32> %[[#VECC]], <3 x i32> %[[#VECC]], <2 x i32> <i32 2, i32 3 >
291
- // LLVM -NEXT: store <2 x i32> %[[#HIPART]], ptr %[[#PVECB]], align 8
286
+ // CIR -NEXT: %[[#VECC:]] = cir. load %[[#PVECC]] : !cir.ptr<!cir.vector<!s32i x 7>>, !cir.vector<!s32i x 7>
287
+ // CIR -NEXT: %[[#HIPART:]] = cir.vec.shuffle( %[[#VECC]], %[[#VECC]] : !cir.vector<!s32i x 7>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<!s32i x 4 >
288
+ // CIR -NEXT: cir. store %[[#HIPART]], %[[#PVECA]] : !cir.vector<!s32i x 4>, !cir.ptr<!cir.vector<!s32i x 4>>
292
289
293
- // c.hi is c[2, 3], in which 3 should be ignored in CIRGen for store
294
- c.hi = b;
290
+ // LLVM-NEXT: %[[#VECC:]] = load <7 x i32>, ptr %[[#PVECC]], align 32
291
+ // LLVM-NEXT: %[[#HIPART:]] = shufflevector <7 x i32> %[[#VECC]], <7 x i32> %[[#VECC]], <4 x i32> <i32 4, i32 5, i32 6, i32 7>
292
+ // LLVM-NEXT: store <4 x i32> %[[#HIPART]], ptr %[[#PVECA]], align 16
295
293
296
- // CIR-NEXT: %[[#VECB:]] = cir.load %[[#PVECB]] : !cir.ptr<!cir.vector<!s32i x 2>>, !cir.vector<!s32i x 2>
297
- // CIR-NEXT: %[[#VECC:]] = cir.load %[[#PVECC]] : !cir.ptr<!cir.vector<!s32i x 3>>, !cir.vector<!s32i x 3>
298
- // CIR-NEXT: %[[#EXTVECB:]] = cir.vec.shuffle(%[[#VECB]], %[[#VECB]] : !cir.vector<!s32i x 2>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<-1> : !s32i] : !cir.vector<!s32i x 3>
299
- // CIR-NEXT: %[[#RESULT:]] = cir.vec.shuffle(%[[#VECC]], %[[#EXTVECB]] : !cir.vector<!s32i x 3>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<3> : !s32i] : !cir.vector<!s32i x 3>
300
- // CIR-NEXT: cir.store %[[#RESULT]], %[[#PVECC]] : !cir.vector<!s32i x 3>, !cir.ptr<!cir.vector<!s32i x 3>>
294
+ // c.hi is c[4, 5, 6, 7], in which 7 should be ignored in CIRGen for store
295
+ c.hi = a;
301
296
302
- // LLVM -NEXT: %[[#VECB :]] = load <2 x i32>, ptr %[[#PVECB]], align 8
303
- // LLVM -NEXT: %[[#VECC:]] = load <3 x i32>, ptr %[[#PVECC]], align 16
304
- // LLVM -NEXT: %[[#EXTVECB :]] = shufflevector <2 x i32> %[[#VECB ]], <2 x i32> %[[#VECB]], <3 x i32> <i32 0, i32 1, i32 poison >
305
- // LLVM -NEXT: %[[#RESULT:]] = shufflevector <3 x i32> %[[#VECC]], <3 x i32> %[[#EXTVECB]], <3 x i32> <i32 0, i32 1, i32 3 >
306
- // LLVM -NEXT: store <3 x i32> %[[#RESULT]], ptr %[[#PVECC]], align 16
297
+ // CIR -NEXT: %[[#VECA :]] = cir. load %[[#PVECA]] : !cir.ptr<!cir.vector<!s32i x 4>>, !cir.vector<!s32i x 4>
298
+ // CIR -NEXT: %[[#VECC:]] = cir. load %[[#PVECC]] : !cir.ptr<!cir.vector<!s32i x 7>>, !cir.vector<!s32i x 7>
299
+ // CIR -NEXT: %[[#EXTVECA :]] = cir.vec.shuffle( %[[#VECA ]], %[[#VECA]] : !cir.vector<!s32i x 4>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<-1> : !s32i, #cir.int<-1> : !s32i, #cir.int<-1> : !s32i] : !cir.vector<!s32i x 7 >
300
+ // CIR -NEXT: %[[#RESULT:]] = cir.vec.shuffle( %[[#VECC]], %[[#EXTVECA]] : !cir.vector<!s32i x 7>) [#cir.int<0> : !s32i, #cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i, #cir.int<7> : !s32i, #cir.int<8> : !s32i, #cir.int<9> : !s32i] : !cir.vector<!s32i x 7 >
301
+ // CIR -NEXT: cir. store %[[#RESULT]], %[[#PVECC]] : !cir.vector<!s32i x 7>, !cir.ptr<!cir.vector<!s32i x 7>>
307
302
303
+ // LLVM-NEXT: %[[#VECA:]] = load <4 x i32>, ptr %[[#PVECA]], align 16
304
+ // LLVM-NEXT: %[[#VECC:]] = load <7 x i32>, ptr %[[#PVECC]], align 32
305
+ // LLVM-NEXT: %[[#EXTVECA:]] = shufflevector <4 x i32> %[[#VECA]], <4 x i32> %[[#VECA]], <7 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison>
306
+ // LLVM-NEXT: %[[#RESULT:]] = shufflevector <7 x i32> %[[#VECC]], <7 x i32> %[[#EXTVECA]], <7 x i32> <i32 0, i32 1, i32 2, i32 3, i32 7, i32 8, i32 9>
307
+ // LLVM-NEXT: store <7 x i32> %[[#RESULT]], ptr %[[#PVECC]], align 32
308
308
}
309
309
310
310
// TODO(cir): Enable concat test when OpenCL lands
0 commit comments