Skip to content

Commit 214d3a4

Browse files
committed
[CIR][NFC] Add LLVM test for build_lvalue
1 parent 8d75348 commit 214d3a4

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

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

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,20 +298,31 @@ void test_build_lvalue() {
298298

299299
vi4 *pv, v;
300300

301-
// CIR: %[[#ALLOCAPV:]] = cir.alloca !cir.ptr<!cir.vector<!s32i x 4>>, !cir.ptr<!cir.ptr<!cir.vector<!s32i x 4>>>, ["pv"] {alignment = 8 : i64}
301+
// CIR-NEXT: %[[#ALLOCAPV:]] = cir.alloca !cir.ptr<!cir.vector<!s32i x 4>>, !cir.ptr<!cir.ptr<!cir.vector<!s32i x 4>>>, ["pv"] {alignment = 8 : i64}
302302
// CIR-NEXT: %[[#ALLOCAV:]] = cir.alloca !cir.vector<!s32i x 4>, !cir.ptr<!cir.vector<!s32i x 4>>, ["v"] {alignment = 16 : i64}
303303
// CIR-NEXT: %[[#ALLOCAS:]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["s", init] {alignment = 4 : i64}
304304
// CIR-NEXT: %[[#ALLOCATMP:]] = cir.alloca !cir.vector<!s32i x 4>, !cir.ptr<!cir.vector<!s32i x 4>>, ["tmp"] {alignment = 16 : i64}
305305
// CIR-NEXT: %[[#ALLOCAR:]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["r", init] {alignment = 4 : i64}
306306

307+
// LLVM-NEXT: %[[#ALLOCAPV:]] = alloca ptr, i64 1, align 8
308+
// LLVM-NEXT: %[[#ALLOCAV:]] = alloca <4 x i32>, i64 1, align 16
309+
// LLVM-NEXT: %[[#ALLOCAS:]] = alloca i32, i64 1, align 4
310+
// LLVM-NEXT: %[[#ALLOCATMP:]] = alloca <4 x i32>, i64 1, align 16
311+
// LLVM-NEXT: %[[#ALLOCAR:]] = alloca i32, i64 1, align 4
312+
307313
pv->x = 99;
308-
// CIR: %[[#VAL:]] = cir.const #cir.int<99> : !s32i
309-
// CIR-NEXT: %[[#PV:]] = cir.load %{{[0-9]+}} : !cir.ptr<!cir.ptr<!cir.vector<!s32i x 4>>>, !cir.ptr<!cir.vector<!s32i x 4>>
314+
// CIR-NEXT: %[[#VAL:]] = cir.const #cir.int<99> : !s32i
315+
// CIR-NEXT: %[[#PV:]] = cir.load %[[#ALLOCAPV]] : !cir.ptr<!cir.ptr<!cir.vector<!s32i x 4>>>, !cir.ptr<!cir.vector<!s32i x 4>>
310316
// CIR-NEXT: %[[#V:]] = cir.load %[[#PV]] : !cir.ptr<!cir.vector<!s32i x 4>>, !cir.vector<!s32i x 4>
311317
// CIR-NEXT: %[[#IDX:]] = cir.const #cir.int<0> : !s64i
312318
// CIR-NEXT: %[[#RESULT:]] = cir.vec.insert %[[#VAL]], %[[#V]][%[[#IDX]] : !s64i] : !cir.vector<!s32i x 4>
313319
// CIR-NEXT: cir.store %[[#RESULT]], %[[#PV]] : !cir.vector<!s32i x 4>, !cir.ptr<!cir.vector<!s32i x 4>>
314320

321+
// LLVM-NEXT: %[[#PV:]] = load ptr, ptr %[[#ALLOCAPV]], align 8
322+
// LLVM-NEXT: %[[#V:]] = load <4 x i32>, ptr %[[#PV]], align 16
323+
// LLVM-NEXT: %[[#RESULT:]] = insertelement <4 x i32> %[[#V]], i32 99, i64 0
324+
// LLVM-NEXT: store <4 x i32> %[[#RESULT]], ptr %[[#PV]], align 16
325+
315326
int s = (v+v).x;
316327

317328
// CIR-NEXT: %[[#LOAD1:]] = cir.load %[[#ALLOCAV]] : !cir.ptr<!cir.vector<!s32i x 4>>, !cir.vector<!s32i x 4>
@@ -323,10 +334,22 @@ void test_build_lvalue() {
323334
// CIR-NEXT: %[[#RESULT:]] = cir.vec.extract %[[#TMP]][%[[#IDX]] : !s64i] : !cir.vector<!s32i x 4>
324335
// CIR-NEXT: cir.store %[[#RESULT]], %[[#ALLOCAS]] : !s32i, !cir.ptr<!s32i>
325336

337+
// LLVM-NEXT: %[[#LOAD1:]] = load <4 x i32>, ptr %2, align 16
338+
// LLVM-NEXT: %[[#LOAD2:]] = load <4 x i32>, ptr %2, align 16
339+
// LLVM-NEXT: %[[#SUM:]] = add <4 x i32> %9, %10
340+
// LLVM-NEXT: store <4 x i32> %11, ptr %[[#ALLOCATMP]], align 16
341+
// LLVM-NEXT: %[[#TMP:]] = load <4 x i32>, ptr %[[#ALLOCATMP]], align 16
342+
// LLVM-NEXT: %[[#RESULT:]] = extractelement <4 x i32> %12, i64 0
343+
// LLVM-NEXT: store i32 %[[#RESULT]], ptr %[[#ALLOCAS]], align 4
344+
326345
int r = v.xy.x;
327346
// CIR-NEXT: %[[#V:]] = cir.load %[[#ALLOCAV]] : !cir.ptr<!cir.vector<!s32i x 4>>, !cir.vector<!s32i x 4>
328347
// CIR-NEXT: %[[#IDX:]] = cir.const #cir.int<0> : !s64i
329348
// CIR-NEXT: %[[#RESULT:]] = cir.vec.extract %[[#V]][%[[#IDX]] : !s64i] : !cir.vector<!s32i x 4>
330349
// CIR-NEXT: cir.store %[[#RESULT]], %[[#ALLOCAR]] : !s32i, !cir.ptr<!s32i>
331350

351+
// LLVM-NEXT: %[[#V:]] = load <4 x i32>, ptr %[[#ALLOCAV]], align 16
352+
// LLVM-NEXT: %[[#RESULT:]] = extractelement <4 x i32> %[[#V]], i64 0
353+
// LLVM-NEXT: store i32 %[[#RESULT]], ptr %[[#ALLOCAR]], align 4
354+
332355
}

0 commit comments

Comments
 (0)