Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,13 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
addr = addr.withPointer(
createPtrBitcast(addr.getPointer(), addr.getElementType()));

mlir::IntegerAttr align;
uint64_t alignment = addr.getAlignment().getQuantity();
if (alignment)
align = getI64IntegerAttr(alignment);
return create<cir::LoadOp>(
loc, addr.getElementType(), addr.getPointer(), /*isDeref=*/false,
/*is_volatile=*/isVolatile, /*is_nontemporal=*/isNontemporal,
/*alignment=*/mlir::IntegerAttr{},
/*is_volatile=*/isVolatile, /*is_nontemporal=*/isNontemporal, align,
/*mem_order=*/cir::MemOrderAttr{}, /*tbaa=*/cir::TBAAAttr{});
}

Expand Down
13 changes: 3 additions & 10 deletions clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2946,16 +2946,9 @@ mlir::Value CIRGenFunction::emitLoadOfScalar(Address addr, bool isVolatile,
llvm_unreachable("NYI");
}

// TODO(cir): modernize this with addr.withElementType(convertTypeForLoadStore
auto Ptr = addr.getPointer();
if (mlir::isa<cir::VoidType>(eltTy)) {
eltTy = cir::IntType::get(&getMLIRContext(), 8, true);
auto ElemPtrTy = cir::PointerType::get(eltTy);
Ptr = builder.create<cir::CastOp>(loc, ElemPtrTy, cir::CastKind::bitcast,
Ptr);
}
auto loadOp =
builder.CIRBaseBuilderTy::createLoad(loc, Ptr, isVolatile, isNontemporal);
if (mlir::isa<cir::VoidType>(eltTy))
addr = addr.withElementType(builder, builder.getUIntNTy(8));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the code I'm replacing here used a bitcast to a signed i8. An unsigned i8 seemed more appropriate for a void pointer, but the only test that hits this case (pointer-arith-ext.c) doesn't check for the type.

auto loadOp = builder.createLoad(loc, addr, isVolatile, isNontemporal);

CGM.decorateOperationWithTBAA(loadOp, tbaaInfo);

Expand Down
36 changes: 18 additions & 18 deletions clang/test/CIR/CallConvLowering/AArch64/aarch64-cc-structs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typedef struct {
// CHECK: cir.func {{.*@ret_lt_64}}() -> !u16i
// CHECK: %[[#V0:]] = cir.alloca !rec_LT_64, !cir.ptr<!rec_LT_64>, ["__retval"]
// CHECK: %[[#V1:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_LT_64>), !cir.ptr<!u16i>
// CHECK: %[[#V2:]] = cir.load %[[#V1]] : !cir.ptr<!u16i>, !u16i
// CHECK: %[[#V2:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!u16i>, !u16i
// CHECK: cir.return %[[#V2]] : !u16i
LT_64 ret_lt_64() {
LT_64 x;
Expand All @@ -40,7 +40,7 @@ LT_64 ret_lt_64() {
// CHECK: cir.func {{.*@ret_eq_64}}() -> !u64i
// CHECK: %[[#V0:]] = cir.alloca !rec_EQ_64, !cir.ptr<!rec_EQ_64>, ["__retval"]
// CHECK: %[[#V1:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_EQ_64>), !cir.ptr<!u64i>
// CHECK: %[[#V2:]] = cir.load %[[#V1]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#V2:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!u64i>, !u64i
// CHECK: cir.return %[[#V2]] : !u64i
EQ_64 ret_eq_64() {
EQ_64 x;
Expand All @@ -50,7 +50,7 @@ EQ_64 ret_eq_64() {
// CHECK: cir.func {{.*@ret_lt_128}}() -> !cir.array<!u64i x 2>
// CHECK: %[[#V0:]] = cir.alloca !rec_LT_128, !cir.ptr<!rec_LT_128>, ["__retval"]
// CHECK: %[[#V1:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_LT_128>), !cir.ptr<!cir.array<!u64i x 2>>
// CHECK: %[[#V2:]] = cir.load %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: %[[#V2:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: cir.return %[[#V2]] : !cir.array<!u64i x 2>
LT_128 ret_lt_128() {
LT_128 x;
Expand All @@ -60,7 +60,7 @@ LT_128 ret_lt_128() {
// CHECK: cir.func {{.*@ret_eq_128}}() -> !cir.array<!u64i x 2>
// CHECK: %[[#V0:]] = cir.alloca !rec_EQ_128, !cir.ptr<!rec_EQ_128>, ["__retval"]
// CHECK: %[[#V1:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_EQ_128>), !cir.ptr<!cir.array<!u64i x 2>>
// CHECK: %[[#V2:]] = cir.load %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: %[[#V2:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: cir.return %[[#V2]] : !cir.array<!u64i x 2>
EQ_128 ret_eq_128() {
EQ_128 x;
Expand All @@ -87,7 +87,7 @@ typedef struct {
// CHECK: %[[#V3:]] = cir.cast(bitcast, %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>), !cir.ptr<!void>
// CHECK: %[[#V4:]] = cir.const #cir.int<12> : !u64i
// CHECK: cir.libc.memcpy %[[#V4]] bytes from %[[#V2]] to %[[#V3]] : !u64i, !cir.ptr<!void> -> !cir.ptr<!void>
// CHECK: %[[#V5:]] = cir.load %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: %[[#V5:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: cir.return %[[#V5]] : !cir.array<!u64i x 2>

// LLVM: [2 x i64] @retS()
Expand Down Expand Up @@ -145,7 +145,7 @@ void pass_eq_128(EQ_128 s) {}
// CHECK: cir.func @pass_gt_128(%arg0: !cir.ptr<!rec_GT_128>
// CHECK: %[[#V0:]] = cir.alloca !cir.ptr<!rec_GT_128>, !cir.ptr<!cir.ptr<!rec_GT_128>>, [""] {alignment = 8 : i64}
// CHECK: cir.store{{.*}} %arg0, %[[#V0]] : !cir.ptr<!rec_GT_128>, !cir.ptr<!cir.ptr<!rec_GT_128>>
// CHECK: %[[#V1:]] = cir.load %[[#V0]] : !cir.ptr<!cir.ptr<!rec_GT_128>>, !cir.ptr<!rec_GT_128>
// CHECK: %[[#V1:]] = cir.load{{.*}} %[[#V0]] : !cir.ptr<!cir.ptr<!rec_GT_128>>, !cir.ptr<!rec_GT_128>

// LLVM: void @pass_gt_128(ptr %0)
// LLVM: %[[#V1:]] = alloca ptr, i64 1, align 8
Expand All @@ -156,7 +156,7 @@ void pass_gt_128(GT_128 s) {}
// CHECK: cir.func @get_gt_128(%arg0: !cir.ptr<!rec_GT_128> {{.*}}, %arg1: !cir.ptr<!rec_GT_128>
// CHECK: %[[#V0:]] = cir.alloca !cir.ptr<!rec_GT_128>, !cir.ptr<!cir.ptr<!rec_GT_128>>, [""] {alignment = 8 : i64}
// CHECK: cir.store{{.*}} %arg1, %[[#V0]] : !cir.ptr<!rec_GT_128>, !cir.ptr<!cir.ptr<!rec_GT_128>>
// CHECK: %[[#V1:]] = cir.load %[[#V0]] : !cir.ptr<!cir.ptr<!rec_GT_128>>, !cir.ptr<!rec_GT_128>
// CHECK: %[[#V1:]] = cir.load{{.*}} %[[#V0]] : !cir.ptr<!cir.ptr<!rec_GT_128>>, !cir.ptr<!rec_GT_128>
// CHECK: cir.copy %[[#V1]] to %arg0 : !cir.ptr<!rec_GT_128>
// CHECK: cir.return

Expand All @@ -172,7 +172,7 @@ GT_128 get_gt_128(GT_128 s) {

// CHECK: cir.func no_proto @call_and_get_gt_128(%arg0: !cir.ptr<!rec_GT_128>
// CHECK: %[[#V0:]] = cir.alloca !rec_GT_128, !cir.ptr<!rec_GT_128>, ["tmp"] {alignment = 8 : i64}
// CHECK: %[[#V1:]] = cir.load %arg0 : !cir.ptr<!rec_GT_128>, !rec_GT_128
// CHECK: %[[#V1:]] = cir.load{{.*}} %arg0 : !cir.ptr<!rec_GT_128>, !rec_GT_128
// CHECK: %[[#V2:]] = cir.alloca !rec_GT_128, !cir.ptr<!rec_GT_128>, [""] {alignment = 8 : i64}
// CHECK: %[[#V3:]] = cir.alloca !rec_GT_128, !cir.ptr<!rec_GT_128>, ["tmp"] {alignment = 8 : i64}
// CHECK: %[[#V4:]] = cir.cast(bitcast, %arg0 : !cir.ptr<!rec_GT_128>), !cir.ptr<!void>
Expand Down Expand Up @@ -213,12 +213,12 @@ void passS(S s) {}
// CHECK: @callS()
// CHECK: %[[#V0:]] = cir.alloca !rec_S, !cir.ptr<!rec_S>, ["s"] {alignment = 4 : i64}
// CHECK: %[[#V1:]] = cir.alloca !cir.array<!u64i x 2>, !cir.ptr<!cir.array<!u64i x 2>>, ["tmp"] {alignment = 8 : i64}
// CHECK: %[[#V2:]] = cir.load %[[#V0]] : !cir.ptr<!rec_S>, !rec_S
// CHECK: %[[#V2:]] = cir.load{{.*}} %[[#V0]] : !cir.ptr<!rec_S>, !rec_S
// CHECK: %[[#V3:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_S>), !cir.ptr<!void>
// CHECK: %[[#V4:]] = cir.cast(bitcast, %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>), !cir.ptr<!void>
// CHECK: %[[#V5:]] = cir.const #cir.int<12> : !u64i
// CHECK: cir.libc.memcpy %[[#V5]] bytes from %[[#V3]] to %[[#V4]] : !u64i, !cir.ptr<!void> -> !cir.ptr<!void>
// CHECK: %[[#V6:]] = cir.load %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: %[[#V6:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!cir.array<!u64i x 2>>, !cir.array<!u64i x 2>
// CHECK: cir.call @passS(%[[#V6]]) : (!cir.array<!u64i x 2>) -> ()
// CHECK: cir.return

Expand All @@ -243,13 +243,13 @@ typedef struct {

// CHECK: cir.func {{.*@ret_s_pad}}() -> !u48i
// CHECK: %[[#V0:]] = cir.alloca !rec_S_PAD, !cir.ptr<!rec_S_PAD>, ["__retval"] {alignment = 2 : i64}
// CHECK: %[[#V1:]] = cir.load %[[#V0]] : !cir.ptr<!rec_S_PAD>, !rec_S_PAD
// CHECK: %[[#V1:]] = cir.load{{.*}} %[[#V0]] : !cir.ptr<!rec_S_PAD>, !rec_S_PAD
// CHECK: %[[#V2:]] = cir.alloca !u48i, !cir.ptr<!u48i>, [""] {alignment = 2 : i64}
// CHECK: %[[#V3:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_S_PAD>)
// CHECK: %[[#V4:]] = cir.cast(bitcast, %[[#V2:]] : !cir.ptr<!u48i>), !cir.ptr<!void>
// CHECK: %[[#V5:]] = cir.const #cir.int<6> : !u64i
// CHECK: cir.libc.memcpy %[[#V5]] bytes from %[[#V3]] to %[[#V4]] : !u64i, !cir.ptr<!void>
// CHECK: %[[#V6:]] = cir.load %[[#V2]] : !cir.ptr<!u48i>
// CHECK: %[[#V6:]] = cir.load{{.*}} %[[#V2]] : !cir.ptr<!u48i>
// CHECK: cir.return %[[#V6]]

// LLVM: i48 @ret_s_pad()
Expand All @@ -271,7 +271,7 @@ typedef struct {
// CHECK: cir.func @pass_cat(%arg0: !cir.ptr<!rec_CAT>
// CHECK: %[[#V0:]] = cir.alloca !cir.ptr<!rec_CAT>, !cir.ptr<!cir.ptr<!rec_CAT>>, [""] {alignment = 8 : i64}
// CHECK: cir.store{{.*}} %arg0, %[[#V0]] : !cir.ptr<!rec_CAT>, !cir.ptr<!cir.ptr<!rec_CAT>>
// CHECK: %[[#V1:]] = cir.load %[[#V0]] : !cir.ptr<!cir.ptr<!rec_CAT>>, !cir.ptr<!rec_CAT>
// CHECK: %[[#V1:]] = cir.load{{.*}} %[[#V0]] : !cir.ptr<!cir.ptr<!rec_CAT>>, !cir.ptr<!rec_CAT>
// CHECK: cir.return

// LLVM: void @pass_cat(ptr %[[#V0:]])
Expand Down Expand Up @@ -307,16 +307,16 @@ void pass_nested_u(NESTED_U a) {}
// CHECK: cir.func no_proto @call_nested_u()
// CHECK: %[[#V0:]] = cir.alloca !rec_NESTED_U, !cir.ptr<!rec_NESTED_U>
// CHECK: %[[#V1:]] = cir.alloca !u64i, !cir.ptr<!u64i>, ["tmp"]
// CHECK: %[[#V2:]] = cir.load %[[#V0]] : !cir.ptr<!rec_NESTED_U>, !rec_NESTED_U
// CHECK: %[[#V2:]] = cir.load{{.*}} %[[#V0]] : !cir.ptr<!rec_NESTED_U>, !rec_NESTED_U
// CHECK: %[[#V3:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_NESTED_U>), !cir.ptr<!rec_anon2E0>
// CHECK: %[[#V4:]] = cir.load %[[#V3]] : !cir.ptr<!rec_anon2E0>, !rec_anon2E0
// CHECK: %[[#V4:]] = cir.load{{.*}} %[[#V3]] : !cir.ptr<!rec_anon2E0>, !rec_anon2E0
// CHECK: %[[#V5:]] = cir.cast(bitcast, %[[#V3]] : !cir.ptr<!rec_anon2E0>), !cir.ptr<!rec_anon2E1>
// CHECK: %[[#V6:]] = cir.load %[[#V5]] : !cir.ptr<!rec_anon2E1>, !rec_anon2E1
// CHECK: %[[#V6:]] = cir.load{{.*}} %[[#V5]] : !cir.ptr<!rec_anon2E1>, !rec_anon2E1
// CHECK: %[[#V7:]] = cir.cast(bitcast, %[[#V5]] : !cir.ptr<!rec_anon2E1>), !cir.ptr<!void>
// CHECK: %[[#V8:]] = cir.cast(bitcast, %[[#V1]] : !cir.ptr<!u64i>), !cir.ptr<!void>
// CHECK: %[[#V9:]] = cir.const #cir.int<2> : !u64i
// CHECK: cir.libc.memcpy %[[#V9]] bytes from %[[#V7]] to %[[#V8]] : !u64i, !cir.ptr<!void> -> !cir.ptr<!void>
// CHECK: %[[#V10:]] = cir.load %[[#V1]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#V10:]] = cir.load{{.*}} %[[#V1]] : !cir.ptr<!u64i>, !u64i
// CHECK: cir.call @pass_nested_u(%[[#V10]]) : (!u64i) -> ()

// LLVM: void @call_nested_u()
Expand Down Expand Up @@ -402,7 +402,7 @@ void qux(void) {
// CHECK: %[[#V4:]] = cir.cast(array_to_ptrdecay, %[[#V2]] : !cir.ptr<!cir.array<!rec_PackedS2 x 3>>), !cir.ptr<!rec_PackedS2>
// CHECK: %[[#V5:]] = cir.ptr_stride(%[[#V4]] : !cir.ptr<!rec_PackedS2>, %[[#V3]] : !s32i), !cir.ptr<!rec_PackedS2>
// CHECK: cir.store{{.*}} %[[#V5]], %[[#V0]] : !cir.ptr<!rec_PackedS2>, !cir.ptr<!cir.ptr<!rec_PackedS2>>
// CHECK: %[[#V6:]] = cir.load deref %[[#V0]] : !cir.ptr<!cir.ptr<!rec_PackedS2>>, !cir.ptr<!rec_PackedS2>
// CHECK: %[[#V6:]] = cir.load deref{{.*}} %[[#V0]] : !cir.ptr<!cir.ptr<!rec_PackedS2>>, !cir.ptr<!rec_PackedS2>
// CHECK: %[[#V7:]] = cir.cast(bitcast, %[[#V6]] : !cir.ptr<!rec_PackedS2>), !cir.ptr<!void>
// CHECK: %[[#V8:]] = cir.const #cir.int<6> : !u64i
// CHECK: cir.libc.memcpy %[[#V8]] bytes from %[[#V7]]
Expand Down
12 changes: 6 additions & 6 deletions clang/test/CIR/CallConvLowering/x86_64/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ S1 s1(S1 arg) {

/// Cast argument and result of the function call to the expected types.
// CHECK: %[[#V9:]] = cir.cast(bitcast, %[[#V3]] : !cir.ptr<!rec_S1>), !cir.ptr<!u64i>
// CHECK: %[[#V10:]] = cir.load %[[#V9]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#V10:]] = cir.load{{.*}} %[[#V9]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#V11:]] = cir.call @_Z2s12S1(%[[#V10]]) : (!u64i) -> !u64i
// CHECK: %[[#V12:]] = cir.cast(bitcast, %[[#V4]] : !cir.ptr<!rec_S1>), !cir.ptr<!u64i>
// CHECK: cir.store{{.*}} %[[#V11]], %[[#V12]] : !u64i, !cir.ptr<!u64i>
Expand All @@ -122,7 +122,7 @@ S1 s1(S1 arg) {
// CHECK: %[[#V16:]] = cir.const #cir.int<2> : !s32i
// CHECK: cir.store{{.*}} %[[#V16]], %[[#V15]] : !s32i, !cir.ptr<!s32i>
// CHECK: %[[#V17:]] = cir.cast(bitcast, %[[#V2]] : !cir.ptr<!rec_S1>), !cir.ptr<!u64i>
// CHECK: %[[#V18:]] = cir.load %[[#V17]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#V18:]] = cir.load{{.*}} %[[#V17]] : !cir.ptr<!u64i>, !u64i
// CHECK: cir.return %[[#V18]] : !u64i
return {1, 2};
}
Expand Down Expand Up @@ -170,7 +170,7 @@ S2 s2(S2 arg) {
// COM: Flattening of the struct.
// COM: { i32, i32, i32 } -> { i64, i32 }.

// CHECK: %[[#F20:]] = cir.load %[[#F8]] : !cir.ptr<!rec_S2>, !rec_S2
// CHECK: %[[#F20:]] = cir.load{{.*}} %[[#F8]] : !cir.ptr<!rec_S2>, !rec_S2
// CHECK: cir.store{{.*}} %[[#F20]], %[[#F11]] : !rec_S2, !cir.ptr<!rec_S2>
// CHECK: %[[#F21:]] = cir.cast(bitcast, %[[#F11]] : !cir.ptr<!rec_S2>), !cir.ptr<!void>
// CHECK: %[[#F22:]] = cir.cast(bitcast, %[[#F10]] : !cir.ptr<!rec_anon_struct>), !cir.ptr<!void>
Expand All @@ -181,9 +181,9 @@ S2 s2(S2 arg) {
// COM: Retrieve the two values in { i64, i32 }.

// CHECK: %[[#F24:]] = cir.get_member %[[#F10]][0] {name = ""} : !cir.ptr<!rec_anon_struct> -> !cir.ptr<!u64i>
// CHECK: %[[#F25:]] = cir.load %[[#F24]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#F25:]] = cir.load{{.*}} %[[#F24]] : !cir.ptr<!u64i>, !u64i
// CHECK: %[[#F26:]] = cir.get_member %[[#F10]][1] {name = ""} : !cir.ptr<!rec_anon_struct> -> !cir.ptr<!s32i>
// CHECK: %[[#F27:]] = cir.load %[[#F26]] : !cir.ptr<!s32i>, !s32i
// CHECK: %[[#F27:]] = cir.load{{.*}} %[[#F26]] : !cir.ptr<!s32i>, !s32i
// CHECK: %[[#F28:]] = cir.call @_Z2s22S2(%[[#F25]], %[[#F27]]) : (!u64i, !s32i) -> !rec_anon_struct
// CHECK: cir.store{{.*}} %[[#F28]], %[[#F12]] : !rec_anon_struct, !cir.ptr<!rec_anon_struct>

Expand All @@ -201,7 +201,7 @@ S2 s2(S2 arg) {
// CHECK: %[[#F40:]] = cir.cast(bitcast, %[[#F13]] : !cir.ptr<!rec_anon_struct>), !cir.ptr<!void>
// CHECK: %[[#F41:]] = cir.const #cir.int<12> : !u64i
// cir.libc.memcpy %[[#F41]] bytes from %[[#F39]] to %[[#F40]]
// CHECK: %[[#F42:]] = cir.load %[[#F13]] : !cir.ptr<!rec_anon_struct>, !rec_anon_struct
// CHECK: %[[#F42:]] = cir.load{{.*}} %[[#F13]] : !cir.ptr<!rec_anon_struct>, !rec_anon_struct
// cir.return %[[#F42]] : !rec_anon_struct
s2({ 1, 2, 3 });
return { 1, 2, 3 };
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CIR/CallConvLowering/x86_64/fptrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ void bar() {
// CHECK: %[[#V3:]] = cir.get_global @foo : !cir.ptr<!cir.func<(!s32i) -> !s32i>>
// CHECK: %[[#V4:]] = cir.cast(bitcast, %[[#V3]] : !cir.ptr<!cir.func<(!s32i) -> !s32i>>), !cir.ptr<!cir.func<(!rec_S) -> !s32i>>
// CHECK: cir.store{{.*}} %[[#V4]], %[[#V2]] : !cir.ptr<!cir.func<(!rec_S) -> !s32i>>, !cir.ptr<!cir.ptr<!cir.func<(!rec_S) -> !s32i>>>
// CHECK: %[[#V5:]] = cir.load %[[#V2]] : !cir.ptr<!cir.ptr<!cir.func<(!rec_S) -> !s32i>>>, !cir.ptr<!cir.func<(!rec_S) -> !s32i>>
// CHECK: %[[#V5:]] = cir.load{{.*}} %[[#V2]] : !cir.ptr<!cir.ptr<!cir.func<(!rec_S) -> !s32i>>>, !cir.ptr<!cir.func<(!rec_S) -> !s32i>>
// CHECK: %[[#V6:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!rec_S>), !cir.ptr<!s32i>
// CHECK: %[[#V7:]] = cir.load %[[#V6]] : !cir.ptr<!s32i>, !s32i
// CHECK: %[[#V7:]] = cir.load{{.*}} %[[#V6]] : !cir.ptr<!s32i>, !s32i
// CHECK: %[[#V8:]] = cir.cast(bitcast, %[[#V5]] : !cir.ptr<!cir.func<(!rec_S) -> !s32i>>), !cir.ptr<!cir.func<(!s32i) -> !s32i>>
// CHECK: %[[#V9:]] = cir.call %[[#V8]](%[[#V7]]) : (!cir.ptr<!cir.func<(!s32i) -> !s32i>>, !s32i) -> !s32i

Expand Down
6 changes: 3 additions & 3 deletions clang/test/CIR/CallConvLowering/x86_64/int128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ __int128 test1(__int128 a, __int128 b) {
// LLVM-NEXT: %[[#RET_SLOT:]] = alloca i128, i64 1, align 16

return a + b;
// CHECK: %[[#A:]] = cir.load %[[#SLOT_A]] : !cir.ptr<!s128i>, !s128i
// CHECK-NEXT: %[[#B:]] = cir.load %[[#SLOT_B]] : !cir.ptr<!s128i>, !s128i
// CHECK: %[[#A:]] = cir.load{{.*}} %[[#SLOT_A]] : !cir.ptr<!s128i>, !s128i
// CHECK-NEXT: %[[#B:]] = cir.load{{.*}} %[[#SLOT_B]] : !cir.ptr<!s128i>, !s128i
// CHECK-NEXT: %[[#SUM:]] = cir.binop(add, %[[#A]], %[[#B]]) nsw : !s128i
// CHECK-NEXT: cir.store %[[#SUM]], %[[#SLOT_RET]] : !s128i, !cir.ptr<!s128i>

Expand All @@ -46,7 +46,7 @@ __int128 test1(__int128 a, __int128 b) {
// LLVM-NEXT: store i128 %[[#SUM]], ptr %[[#RET_SLOT]], align 16

// CHECK: %[[#SLOT_RET2:]] = cir.cast(bitcast, %[[#SLOT_RET]] : !cir.ptr<!s128i>), !cir.ptr<![[I128_STRUCT]]>
// CHECK-NEXT: %[[#RET:]] = cir.load %[[#SLOT_RET2]] : !cir.ptr<![[I128_STRUCT]]>, ![[I128_STRUCT]]
// CHECK-NEXT: %[[#RET:]] = cir.load{{.*}} %[[#SLOT_RET2]] : !cir.ptr<![[I128_STRUCT]]>, ![[I128_STRUCT]]
// CHECK-NEXT: cir.return %[[#RET]] : ![[I128_STRUCT]]

// LLVM: %[[#RET:]] = load { i64, i64 }, ptr %[[#RET_SLOT]], align 8
Expand Down
14 changes: 7 additions & 7 deletions clang/test/CIR/CodeGen/AArch64/neon-arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ float32_t test_vrndns_f32(float32_t a) {
}
// CIR: cir.func internal private @vrndns_f32(%arg0: !cir.float {{.*}}) -> !cir.float
// CIR: cir.store %arg0, [[ARG_SAVE:%.*]] : !cir.float, !cir.ptr<!cir.float>
// CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.float>, !cir.float
// CIR: [[INTRIN_ARG:%.*]] = cir.load{{.*}} [[ARG_SAVE]] : !cir.ptr<!cir.float>, !cir.float
// CIR: {{%.*}} = cir.roundeven [[INTRIN_ARG]] : !cir.float
// CIR: cir.return {{%.*}} : !cir.float

// CIR-LABEL: test_vrndns_f32
// CIR: cir.store %arg0, [[ARG_SAVE0:%.*]] : !cir.float, !cir.ptr<!cir.float>
// CIR: [[FUNC_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.float>, !cir.float
// CIR: [[FUNC_ARG:%.*]] = cir.load{{.*}} [[ARG_SAVE]] : !cir.ptr<!cir.float>, !cir.float
// CIR: [[FUNC_RES:%.*]] = cir.call @vrndns_f32([[FUNC_ARG]]) : (!cir.float) -> !cir.float
// CIR: cir.store [[FUNC_RES]], [[RET_P:%.*]] : !cir.float, !cir.ptr<!cir.float>
// CIR: [[RET_VAL:%.*]] = cir.load [[RET_P]] : !cir.ptr<!cir.float>, !cir.float
// CIR: [[RET_VAL:%.*]] = cir.load{{.*}} [[RET_P]] : !cir.ptr<!cir.float>, !cir.float
// CIR: cir.return [[RET_VAL]] : !cir.float loc

// LLVM: {{.*}}test_vrndns_f32(float{{.*}}[[ARG:%.*]])
Expand All @@ -44,18 +44,18 @@ float32x2_t test_vrnda_f32(float32x2_t a) {

// CIR: cir.func internal private @vrnda_f32(%arg0: !cir.vector<!cir.float x 2>
// CIR: cir.store %arg0, [[ARG_SAVE:%.*]] : !cir.vector<!cir.float x 2>, !cir.ptr<!cir.vector<!cir.float x 2>>
// CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
// CIR: [[INTRIN_ARG:%.*]] = cir.load{{.*}} [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
// CIR: [[INTRIN_ARG_CAST:%.*]] = cir.cast(bitcast, [[INTRIN_ARG]] : !cir.vector<!cir.float x 2>), !cir.vector<!s8i x 8>
// CIR: [[INTRIN_ARG_BACK:%.*]] = cir.cast(bitcast, [[INTRIN_ARG_CAST]] : !cir.vector<!s8i x 8>), !cir.vector<!cir.float x 2>
// CIR: {{%.*}} = cir.round [[INTRIN_ARG_BACK]] : !cir.vector<!cir.float x 2>
// CIR: cir.return {{%.*}} : !cir.vector<!cir.float x 2>

// CIR-LABEL: test_vrnda_f32
// CIR: cir.store %arg0, [[ARG_SAVE0:%.*]] : !cir.vector<!cir.float x 2>, !cir.ptr<!cir.vector<!cir.float x 2>>
// CIR: [[FUNC_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
// CIR: [[FUNC_ARG:%.*]] = cir.load{{.*}} [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
// CIR: [[FUNC_RES:%.*]] = cir.call @vrnda_f32([[FUNC_ARG]]) : (!cir.vector<!cir.float x 2>) -> !cir.vector<!cir.float x 2>
// CIR: cir.store [[FUNC_RES]], [[RET_P:%.*]] : !cir.vector<!cir.float x 2>, !cir.ptr<!cir.vector<!cir.float x 2>>
// CIR: [[RET_VAL:%.*]] = cir.load [[RET_P]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
// CIR: [[RET_VAL:%.*]] = cir.load{{.*}} [[RET_P]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
// CIR: cir.return [[RET_VAL]] : !cir.vector<!cir.float x 2>

// LLVM: {{.*}}test_vrnda_f32(<2 x float>{{.*}}[[ARG:%.*]])
Expand All @@ -68,7 +68,7 @@ float32x4_t test_vrndaq_f32(float32x4_t a) {

// CIR: cir.func internal private @vrndaq_f32(%arg0: !cir.vector<!cir.float x 4>
// CIR: cir.store %arg0, [[ARG_SAVE:%.*]] : !cir.vector<!cir.float x 4>, !cir.ptr<!cir.vector<!cir.float x 4>>
// CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 4>>, !cir.vector<!cir.float x 4>
// CIR: [[INTRIN_ARG:%.*]] = cir.load{{.*}} [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 4>>, !cir.vector<!cir.float x 4>
// CIR: [[INTRIN_ARG_CAST:%.*]] = cir.cast(bitcast, [[INTRIN_ARG]] : !cir.vector<!cir.float x 4>), !cir.vector<!s8i x 16>
// CIR: [[INTRIN_ARG_BACK:%.*]] = cir.cast(bitcast, [[INTRIN_ARG_CAST]] : !cir.vector<!s8i x 16>), !cir.vector<!cir.float x 4>
// CIR: {{%.*}} = cir.round [[INTRIN_ARG_BACK]] : !cir.vector<!cir.float x 4>
Expand Down
Loading
Loading