Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][ABI][AArch64] convers aarch64_be return struct case #1049

Merged
merged 2 commits into from
Nov 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(Type RetTy,
mlir::cir::ArrayType::get(LT.getMLIRContext(), baseTy, Size / 64));
}

cir_cconv_unreachable("NYI");
return ABIArgInfo::getDirect(
IntType::get(LT.getMLIRContext(), Size, false));
}

return getNaturalAlignIndirect(RetTy);
Expand Down
17 changes: 17 additions & 0 deletions clang/test/CIR/CallConvLowering/AArch64/aarch64_be-cc-structs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %clang_cc1 -triple aarch64_be-unknown-linux-gnu -fclangir -fclangir-call-conv-lowering -emit-cir-flat -mmlir --mlir-print-ir-after=cir-call-conv-lowering %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s

typedef struct {
int a;
int b;
} __attribute__((alligned (4))) S;

// CHECK: cir.func {{.*@init}}() -> !u64i
// CHECK: %[[#V0:]] = cir.alloca !ty_S, !cir.ptr<!ty_S>, ["__retval"] {alignment = 4 : i64}
// CHECK: %[[#V1:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!ty_S>), !cir.ptr<!u64i>
// CHECK: %[[#V2:]] = cir.load %[[#V1]] : !cir.ptr<!u64i>, !u64i
// CHECK: cir.return %[[#V2]] : !u64i
S init() {
S s;
return s;
}