@@ -50,9 +50,9 @@ define { ppc_fp128, ppc_fp128 } @test_sincospi_ppcf128(ppc_fp128 %a) {
5050 ret { ppc_fp128 , ppc_fp128 } %result
5151}
5252
53- ; FIXME: Recognise this as a tail call and omit the stack frame:
54- define void @test_sincos_ppcf128_tail_call (ppc_fp128 %a , ptr noalias %out_sin , ptr noalias %out_cos ) {
55- ; CHECK-LABEL: test_sincos_ppcf128_tail_call :
53+ ; FIXME: This could be made a tail call with the default expansion of llvm.sincos.
54+ define void @test_sincos_ppcf128_void_tail_call (ppc_fp128 %a , ptr noalias %out_sin , ptr noalias %out_cos ) {
55+ ; CHECK-LABEL: test_sincos_ppcf128_void_tail_call :
5656; CHECK: # %bb.0:
5757; CHECK-NEXT: mflr r0
5858; CHECK-NEXT: stdu r1, -32(r1)
@@ -73,9 +73,9 @@ define void @test_sincos_ppcf128_tail_call(ppc_fp128 %a, ptr noalias %out_sin, p
7373 ret void
7474}
7575
76- ; FIXME: Recognise this as a tail call and omit the stack frame:
77- define void @test_sincospi_ppcf128_tail_call (ppc_fp128 %a , ptr noalias %out_sin , ptr noalias %out_cos ) {
78- ; CHECK-LABEL: test_sincospi_ppcf128_tail_call :
76+ ; FIXME: This could be made a tail call with the default expansion of llvm.sincospi.
77+ define void @test_sincospi_ppcf128_void_tail_call (ppc_fp128 %a , ptr noalias %out_sin , ptr noalias %out_cos ) {
78+ ; CHECK-LABEL: test_sincospi_ppcf128_void_tail_call :
7979; CHECK: # %bb.0:
8080; CHECK-NEXT: mflr r0
8181; CHECK-NEXT: stdu r1, -32(r1)
@@ -95,3 +95,53 @@ define void @test_sincospi_ppcf128_tail_call(ppc_fp128 %a, ptr noalias %out_sin,
9595 store ppc_fp128 %result.1 , ptr %out_cos , align 16
9696 ret void
9797}
98+
99+ ; NOTE: This would need a struct-return library call for llvm.sincos to become a tail call.
100+ define { ppc_fp128 , ppc_fp128 } @test_sincos_ppcf128_tail_call (ppc_fp128 %a ) {
101+ ; CHECK-LABEL: test_sincos_ppcf128_tail_call:
102+ ; CHECK: # %bb.0:
103+ ; CHECK-NEXT: mflr r0
104+ ; CHECK-NEXT: stdu r1, -64(r1)
105+ ; CHECK-NEXT: std r0, 80(r1)
106+ ; CHECK-NEXT: .cfi_def_cfa_offset 64
107+ ; CHECK-NEXT: .cfi_offset lr, 16
108+ ; CHECK-NEXT: addi r5, r1, 48
109+ ; CHECK-NEXT: addi r6, r1, 32
110+ ; CHECK-NEXT: bl sincosl
111+ ; CHECK-NEXT: nop
112+ ; CHECK-NEXT: lfd f1, 48(r1)
113+ ; CHECK-NEXT: lfd f2, 56(r1)
114+ ; CHECK-NEXT: lfd f3, 32(r1)
115+ ; CHECK-NEXT: lfd f4, 40(r1)
116+ ; CHECK-NEXT: addi r1, r1, 64
117+ ; CHECK-NEXT: ld r0, 16(r1)
118+ ; CHECK-NEXT: mtlr r0
119+ ; CHECK-NEXT: blr
120+ %result = tail call { ppc_fp128 , ppc_fp128 } @llvm.sincos.ppcf128 (ppc_fp128 %a )
121+ ret { ppc_fp128 , ppc_fp128 } %result
122+ }
123+
124+ ; NOTE: This would need a struct-return library call for llvm.sincospi to become a tail call.
125+ define { ppc_fp128 , ppc_fp128 } @test_sincospi_ppcf128_tail_call (ppc_fp128 %a ) {
126+ ; CHECK-LABEL: test_sincospi_ppcf128_tail_call:
127+ ; CHECK: # %bb.0:
128+ ; CHECK-NEXT: mflr r0
129+ ; CHECK-NEXT: stdu r1, -64(r1)
130+ ; CHECK-NEXT: std r0, 80(r1)
131+ ; CHECK-NEXT: .cfi_def_cfa_offset 64
132+ ; CHECK-NEXT: .cfi_offset lr, 16
133+ ; CHECK-NEXT: addi r5, r1, 48
134+ ; CHECK-NEXT: addi r6, r1, 32
135+ ; CHECK-NEXT: bl sincospil
136+ ; CHECK-NEXT: nop
137+ ; CHECK-NEXT: lfd f1, 48(r1)
138+ ; CHECK-NEXT: lfd f2, 56(r1)
139+ ; CHECK-NEXT: lfd f3, 32(r1)
140+ ; CHECK-NEXT: lfd f4, 40(r1)
141+ ; CHECK-NEXT: addi r1, r1, 64
142+ ; CHECK-NEXT: ld r0, 16(r1)
143+ ; CHECK-NEXT: mtlr r0
144+ ; CHECK-NEXT: blr
145+ %result = tail call { ppc_fp128 , ppc_fp128 } @llvm.sincospi.ppcf128 (ppc_fp128 %a )
146+ ret { ppc_fp128 , ppc_fp128 } %result
147+ }
0 commit comments