1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
3 ; Paramater Save Area is not needed if number of parameter does not exceed
5 ; ------------------------------------------------------------------------------
7 ; Max number of GPR is 8
8 define linkonce_odr void
9 @WithoutParamArea(i8* %a, i32 signext %b) align 2 {
11 call fastcc void @fastccFunc(i32 signext 1)
14 ; CHECK-LABEL: WithoutParamArea
15 ; CHECK: stdu 1, -32(1)
18 declare fastcc void @fastccFunc(i32 signext %level) unnamed_addr
20 ; No need for Parameter Save Area if only 8 GPRs is needed.
21 define linkonce_odr void @WithoutParamArea2(i8* %a, i32 signext %b) align 2 {
23 call fastcc void @eightArgs(i32 signext 1, i32 signext 2, i32 signext 3,
24 i32 signext 4, i32 signext 5, i32 signext 6,
25 i32 signext 7, i32 signext 8)
28 ; CHECK-LABEL: WithoutParamArea2
29 ; CHECK: stdu 1, -32(1)
34 @eightArgs(i32 signext %level, i32 signext %level2, i32 signext %level3,
35 i32 signext %level4, i32 signext %level5, i32 signext %level6,
36 i32 signext %level7, i32 signext %level8) unnamed_addr
38 ; No need for Parameter Save Area for calls that utiliizes 8 GPR and 2 FPR.
39 define linkonce_odr void @WithoutParamArea3(i8* %a, i32 signext %b) align 2 {
42 @mixedArgs(i32 signext 1, float 1.0, i32 signext 2, float 2.0,
43 i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6,
44 i32 signext 7, i32 signext 8) ret void
47 ; CHECK-LABEL : WithoutParamArea3
48 ; CHECK: stdu 1, -32(1)
53 @mixedArgs(i32 signext %level, float %levelf1, i32 signext %level2,
54 float %levelf2, i32 signext %level3, i32 signext %level4,
55 i32 signext %level5, i32 signext %level6, i32 signext %level7,
56 i32 signext %level8) unnamed_addr
58 ; Pass by value usage requiring less GPR then available
59 %"myClass::Mem" = type { i8, i8, i16, i32, i32, i32, i64 }
61 define internal fastcc void @CallPassByValue(%"myClass::Mem"* %E) align 2 {
63 call fastcc void @PassByValue(%"myClass::Mem"* byval nonnull align 8 undef);
66 ; CHECK-LABEL : PassByValue
67 ; CHECK: stdu 1, -32(1)
71 declare dso_local fastcc void
72 @PassByValue(%"myClass::Mem"* byval nocapture readonly align 8) align 2
74 ; Verify Paramater Save Area is allocated if parameter exceed the number that
75 ; can be passed via registers
76 ; ------------------------------------------------------------------------------
78 ; Max number of GPR is 8
79 define linkonce_odr void @WithParamArea(i8 * %a, i32 signext %b) align 2 {
81 call fastcc void @nineArgs(i32 signext 1, i32 signext 2, i32 signext 3,
82 i32 signext 4, i32 signext 5, i32 signext 6,
83 i32 signext 7, i32 signext 8, i32 signext 9)
86 ; CHECK-LABEL: WithParamArea
87 ; CHECK: stdu 1, -96(1)
91 declare fastcc void @nineArgs(i32 signext %level, i32 signext %level2,
92 i32 signext %level3, i32 signext %level4, i32 signext %level5,
93 i32 signext %level6, i32 signext %level7, i32 signext %level8,
94 i32 signext %level9) unnamed_addr
96 ; Max number of FPR for parameter passing is 13
97 define linkonce_odr void @WithParamArea2(i8* %a, i32 signext %b) align 2 {
99 call fastcc void @funcW14FloatArgs(float 1.0, float 2.0, float 3.0,
100 float 4.0, float 5.0, float 6.0, float 7.0, float 8.0, float 1.0,
101 float 2.0, float 3.0, float 4.0, float 5.0, float 14.0)
104 ; CHECK-LABEL: WithParamArea2
105 ; CHECK: stdu 1, -96(1)
110 @funcW14FloatArgs(float %level, float %level2, float %level3,
111 float %level4, float %level5, float %level6,
112 float %level7, float %level8, float %level9,
113 float %level10, float %level11, float %level12,
114 float %level13, float %level14);
117 ; Pass by value usage requires more GPR then available
118 %"myClass::MemA" = type { i8, i8, i16, i32, i32, i32, i64 }
119 %"myClass::MemB" = type { i32*, i32, i32, %"myClass::MemB"** }
120 %"myClass::MemC" = type { %"myClass::MemD"*, %"myClass::MemC"*, i64 }
121 %"myClass::MemD" = type { %"myClass::MemB"*, %"myClass::MemC"*, i8, i8, i16,
123 %"myStruct::MemF" = type { i32, %"myClass::MemA"*, %"myClass::MemA"*, i64, i64 }
124 %"myClass::MemK" = type { i32, %"myClass::MemD"*, %"myClass::MemD"*, i64, i32,
125 i64, i8, i32, %"myStruct::MemF",
126 i8, %"myClass::MemA"* }
128 define internal fastcc void @AggMemExprEmitter(%"myClass::MemK"* %E) align 2 {
130 call fastcc void @MemExprEmitterInitialization(%"myClass::MemK" *
131 byval nonnull align 8 undef);
134 ; CHECK-LABEL : AggMemExprEmitter
135 ; CHECK: stdu 1, -144(1)
139 declare dso_local fastcc void
140 @MemExprEmitterInitialization(%"myClass::MemK" *
141 byval nocapture readonly align 8) align 2