Skip to content

Commit ea733a4

Browse files
authored
[CIR][ABI][AArch64] convers aarch64_be return struct case (#1049)
This PR adds a support return struct as a value for one missed case for AArch64 big endian arch
1 parent 4fbdd36 commit ea733a4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/AArch64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(Type RetTy,
134134
mlir::cir::ArrayType::get(LT.getMLIRContext(), baseTy, Size / 64));
135135
}
136136

137-
cir_cconv_unreachable("NYI");
137+
return ABIArgInfo::getDirect(
138+
IntType::get(LT.getMLIRContext(), Size, false));
138139
}
139140

140141
return getNaturalAlignIndirect(RetTy);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// 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
2+
// RUN: FileCheck --input-file=%t.cir %s
3+
4+
typedef struct {
5+
int a;
6+
int b;
7+
} __attribute__((alligned (4))) S;
8+
9+
// CHECK: cir.func {{.*@init}}() -> !u64i
10+
// CHECK: %[[#V0:]] = cir.alloca !ty_S, !cir.ptr<!ty_S>, ["__retval"] {alignment = 4 : i64}
11+
// CHECK: %[[#V1:]] = cir.cast(bitcast, %[[#V0]] : !cir.ptr<!ty_S>), !cir.ptr<!u64i>
12+
// CHECK: %[[#V2:]] = cir.load %[[#V1]] : !cir.ptr<!u64i>, !u64i
13+
// CHECK: cir.return %[[#V2]] : !u64i
14+
S init() {
15+
S s;
16+
return s;
17+
}

0 commit comments

Comments
 (0)