Skip to content

Commit 3fd0829

Browse files
committed
[CIR][NFC] Use vi7 instead to workaround dependency on vec3 special treatment
1 parent 48ee38e commit 3fd0829

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

clang/test/CIR/CodeGen/vectype-ext.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
55

66
typedef int vi4 __attribute__((ext_vector_type(4)));
7-
typedef int vi3 __attribute__((ext_vector_type(3)));
87
typedef int vi2 __attribute__((ext_vector_type(2)));
98
typedef double vd2 __attribute__((ext_vector_type(2)));
109
typedef long vl2 __attribute__((ext_vector_type(2)));
1110
typedef unsigned short vus2 __attribute__((ext_vector_type(2)));
1211

12+
typedef int vi7 __attribute__((ext_vector_type(7)));
13+
1314
// CIR: cir.func {{@.*vector_int_test.*}}
1415
// LLVM: define void {{@.*vector_int_test.*}}
1516
void vector_int_test(int x) {
@@ -259,9 +260,9 @@ void vector_extend() {
259260
// CIR-NEXT: %[[#PVECB:]] = cir.alloca !cir.vector<!s32i x 2>
260261
// LLVM-NEXT: %[[#PVECB:]] = alloca <2 x i32>
261262

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>
265266

266267
a.lo = b;
267268
// CIR: %[[#VECB:]] = cir.load %[[#PVECB]] : !cir.ptr<!cir.vector<!s32i x 2>>, !cir.vector<!s32i x 2>
@@ -280,31 +281,30 @@ void vector_extend() {
280281
// The suffixes .lo (or .even) and .hi (or .odd) for a 3-component vector type
281282
// operate as if the 3-component vector type is a 4-component vector type with
282283
// 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;
288285

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>>
292289

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
295293

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;
301296

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>>
307302

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
308308
}
309309

310310
// TODO(cir): Enable concat test when OpenCL lands

0 commit comments

Comments
 (0)