Skip to content

Commit 1daa7fd

Browse files
committed
[AArch64][SME] Remove Darwin compile error for ABI support routine calls.
These are allowed for Darwin and use the same ABI.
1 parent 8530b1c commit 1daa7fd

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,9 @@ AArch64RegisterInfo::getDarwinCallPreservedMask(const MachineFunction &MF,
233233
report_fatal_error(
234234
"Calling convention SVE_VectorCall is unsupported on Darwin.");
235235
if (CC == CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0)
236-
report_fatal_error(
237-
"Calling convention AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0 is "
238-
"unsupported on Darwin.");
236+
return CSR_AArch64_SME_ABI_Support_Routines_PreserveMost_From_X0_RegMask;
239237
if (CC == CallingConv::AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2)
240-
report_fatal_error(
241-
"Calling convention AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2 is "
242-
"unsupported on Darwin.");
238+
return CSR_AArch64_SME_ABI_Support_Routines_PreserveMost_From_X2_RegMask;
243239
if (CC == CallingConv::CFGuard_Check)
244240
report_fatal_error(
245241
"Calling convention CFGuard_Check is unsupported on Darwin.");

llvm/test/CodeGen/AArch64/sme-support-routines-calling-convention.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme -verify-machineinstrs < %s | FileCheck %s
2+
; RUN: llc -mtriple=aarch64-apple-darwin -mattr=+sme -verify-machineinstrs < %s | FileCheck %s --check-prefix=DARWIN
23
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme -verify-machineinstrs -stop-after=finalize-isel < %s | FileCheck %s --check-prefix=CHECK-CSRMASK
4+
; RUN: llc -mtriple=aarch64-apple-darwin -mattr=+sme -verify-machineinstrs -stop-after=finalize-isel < %s | FileCheck %s --check-prefix=CHECK-CSRMASK
35

46
; Test that the PCS attribute is accepted and uses the correct register mask.
57
;
@@ -11,6 +13,11 @@ define void @test_sme_calling_convention_x0() nounwind {
1113
; CHECK-NEXT: bl __arm_tpidr2_save
1214
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
1315
; CHECK-NEXT: ret
16+
; DARWIN-LABEL: test_sme_calling_convention_x0:
17+
; DARWIN: stp x29, x30, [sp, #-16]!
18+
; DARWIN: bl ___arm_tpidr2_save
19+
; DARWIN: ldp x29, x30, [sp], #16
20+
; DARWIN: ret
1421
;
1522
; CHECK-CSRMASK-LABEL: name: test_sme_calling_convention_x0
1623
; CHECK-CSRMASK: BL @__arm_tpidr2_save, csr_aarch64_sme_abi_support_routines_preservemost_from_x0
@@ -25,6 +32,11 @@ define i64 @test_sme_calling_convention_x2() nounwind {
2532
; CHECK-NEXT: bl __arm_sme_state
2633
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2734
; CHECK-NEXT: ret
35+
; DARWIN-LABEL: test_sme_calling_convention_x2:
36+
; DARWIN: stp x29, x30, [sp, #-16]!
37+
; DARWIN: bl ___arm_sme_state
38+
; DARWIN: ldp x29, x30, [sp], #16
39+
; DARWIN: ret
2840
;
2941
; CHECK-CSRMASK-LABEL: name: test_sme_calling_convention_x2
3042
; CHECK-CSRMASK: BL @__arm_sme_state, csr_aarch64_sme_abi_support_routines_preservemost_from_x2

0 commit comments

Comments
 (0)