87 lines · plain
1; For ELFv2 ABI, we can avoid allocating the parameter area in the stack frame of the caller function2; if all the arguments can be passed to the callee in registers.3; For ELFv1 ABI, we always need to allocate the parameter area.4 5; Tests for ELFv2 ABI6; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=PPC64-ELFV27; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=PPC64-ELFV28 9; Tests for ELFv1 ABI10; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=PPC64-ELFV111; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=PPC64-ELFV112 13; If the callee has at most eight integer args, parameter area can be ommited for ELFv2 ABI.14 15; PPC64-ELFV2-LABEL: WithoutParamArea1:16; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)17; PPC64-ELFV2: stdu 1, -32(1)18; PPC64-ELFV2: addi 1, 1, 3219; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)20; PPC64-ELFV1-LABEL: WithoutParamArea1:21; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)22; PPC64-ELFV1: stdu 1, -112(1)23; PPC64-ELFV1: addi 1, 1, 11224; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)25define signext i32 @WithoutParamArea1(i32 signext %a) local_unnamed_addr #0 {26entry:27 %call = tail call signext i32 @onearg(i32 signext %a) #228 ret i32 %call29}30 31; PPC64-ELFV2-LABEL: WithoutParamArea2:32; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)33; PPC64-ELFV2: stdu 1, -32(1)34; PPC64-ELFV2: addi 1, 1, 3235; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)36; PPC64-ELFV1-LABEL: WithoutParamArea2:37; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)38; PPC64-ELFV1: stdu 1, -112(1)39; PPC64-ELFV1: addi 1, 1, 11240; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)41define signext i32 @WithoutParamArea2(i32 signext %a) local_unnamed_addr #0 {42entry:43 %call = tail call signext i32 @eightargs(i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a) #244 ret i32 %call45}46 47; If the callee has more than eight integer args or variable number of args, 48; parameter area cannot be ommited even for ELFv2 ABI49 50; PPC64-ELFV2-LABEL: WithParamArea1:51; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)52; PPC64-ELFV2: stdu 1, -96(1)53; PPC64-ELFV2: addi 1, 1, 9654; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)55; PPC64-ELFV1-LABEL: WithParamArea1:56; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)57; PPC64-ELFV1: stdu 1, -112(1)58; PPC64-ELFV1: addi 1, 1, 11259; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)60define signext i32 @WithParamArea1(i32 signext %a) local_unnamed_addr #0 {61entry:62 %call = tail call signext i32 (i32, ...) @varargs(i32 signext %a, i32 signext %a) #263 ret i32 %call64}65 66; PPC64-ELFV2-LABEL: WithParamArea2:67; PPC64-ELFV2-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)68; PPC64-ELFV2: stdu 1, -112(1)69; PPC64-ELFV2: addi 1, 1, 11270; PPC64-ELFV2-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)71; PPC64-ELFV1-LABEL: WithParamArea2:72; PPC64-ELFV1-NOT: stw {{[0-9]+}}, -{{[0-9]+}}(1)73; PPC64-ELFV1: stdu 1, -128(1)74; PPC64-ELFV1: addi 1, 1, 12875; PPC64-ELFV1-NOT: lwz {{[0-9]+}}, -{{[0-9]+}}(1)76define signext i32 @WithParamArea2(i32 signext %a) local_unnamed_addr #0 {77entry:78 %call = tail call signext i32 @nineargs(i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a, i32 signext %a) #279 ret i32 %call80}81 82declare signext i32 @onearg(i32 signext) local_unnamed_addr #183declare signext i32 @eightargs(i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext) local_unnamed_addr #184declare signext i32 @nineargs(i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext, i32 signext) local_unnamed_addr #185declare signext i32 @varargs(i32 signext, ...) local_unnamed_addr #186 87