From 34c1d6673e2f3f3a4622df94388636ef2e41a0e1 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Wed, 3 Dec 2014 17:49:26 +0000 Subject: [PATCH] AArch64: fix wrong-endian parameter passing. The blocked arguments code didn't take account of the hacks needed to support it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223247 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AArch64/AArch64ISelLowering.cpp | 6 ++++-- test/CodeGen/AArch64/arm64-aapcs-be.ll | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/Target/AArch64/AArch64ISelLowering.cpp b/lib/Target/AArch64/AArch64ISelLowering.cpp index 622b0e1d73d..ee31dbff28e 100644 --- a/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -2107,7 +2107,8 @@ SDValue AArch64TargetLowering::LowerFormalArguments( unsigned ArgSize = VA.getValVT().getSizeInBits() / 8; uint32_t BEAlign = 0; - if (ArgSize < 8 && !Subtarget->isLittleEndian()) + if (!Subtarget->isLittleEndian() && ArgSize < 8 && + !Ins[i].Flags.isInConsecutiveRegs()) BEAlign = 8 - ArgSize; int FI = MFI->CreateFixedObject(ArgSize, ArgOffset + BEAlign, true); @@ -2661,7 +2662,8 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, unsigned OpSize = Flags.isByVal() ? Flags.getByValSize() * 8 : VA.getValVT().getSizeInBits(); OpSize = (OpSize + 7) / 8; - if (!Subtarget->isLittleEndian() && !Flags.isByVal()) { + if (!Subtarget->isLittleEndian() && !Flags.isByVal() && + !Flags.isInConsecutiveRegs()) { if (OpSize < 8) BEAlign = 8 - OpSize; } diff --git a/test/CodeGen/AArch64/arm64-aapcs-be.ll b/test/CodeGen/AArch64/arm64-aapcs-be.ll index 77e2b0f717b..f27570acc82 100644 --- a/test/CodeGen/AArch64/arm64-aapcs-be.ll +++ b/test/CodeGen/AArch64/arm64-aapcs-be.ll @@ -21,4 +21,20 @@ entry: ; CHECK-DAG: strh w{{[0-9]}}, [sp, #14] ; CHECK-DAG: strb w{{[0-9]}}, [sp, #7] ret i32 %call -} \ No newline at end of file +} + +define float @test_block_addr([8 x float], [1 x float] %in) { +; CHECK-LABEL: test_block_addr: +; CHECK: ldr s0, [sp] + %val = extractvalue [1 x float] %in, 0 + ret float %val +} + +define void @test_block_addr_callee() { +; CHECK-LABEL: test_block_addr_callee: +; CHECK: str {{[a-z0-9]+}}, [sp] +; CHECK: bl test_block_addr + %val = insertvalue [1 x float] undef, float 0.0, 0 + call float @test_block_addr([8 x float] undef, [1 x float] %val) + ret void +}