1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -relocation-model=pic -verify-machineinstrs -mcpu=pwr7 -mattr=+altivec -mattr=-vsx < %s | FileCheck %s
4 target datalayout = "e-m:e-i64:64-n32:64"
5 target triple = "powerpc64le-unknown-linux-gnu"
7 @g = common global ppc_fp128 0xM00000000000000000000000000000000, align 16
9 define void @callee(ppc_fp128 %x) {
10 ; CHECK-LABEL: callee:
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
13 ; CHECK-NEXT: stfd 2, -8(1)
14 ; CHECK-NEXT: stfd 1, -16(1)
15 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
16 ; CHECK-NEXT: stfd 2, 8(3)
17 ; CHECK-NEXT: stfd 1, 0(3)
20 %x.addr = alloca ppc_fp128, align 16
21 store ppc_fp128 %x, ptr %x.addr, align 16
22 %0 = load ppc_fp128, ptr %x.addr, align 16
23 store ppc_fp128 %0, ptr @g, align 16
27 define void @caller() {
28 ; CHECK-LABEL: caller:
29 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: stdu 1, -32(1)
32 ; CHECK-NEXT: std 0, 48(1)
33 ; CHECK-NEXT: .cfi_def_cfa_offset 32
34 ; CHECK-NEXT: .cfi_offset lr, 16
35 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
36 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
37 ; CHECK-NEXT: lfd 2, 8(3)
38 ; CHECK-NEXT: lfd 1, 0(3)
41 ; CHECK-NEXT: addi 1, 1, 32
42 ; CHECK-NEXT: ld 0, 16(1)
46 %0 = load ppc_fp128, ptr @g, align 16
47 call void @test(ppc_fp128 %0)
51 declare void @test(ppc_fp128)
53 define void @caller_const() {
54 ; CHECK-LABEL: caller_const:
55 ; CHECK: # %bb.0: # %entry
57 ; CHECK-NEXT: stdu 1, -32(1)
58 ; CHECK-NEXT: std 0, 48(1)
59 ; CHECK-NEXT: .cfi_def_cfa_offset 32
60 ; CHECK-NEXT: .cfi_offset lr, 16
61 ; CHECK-NEXT: addis 3, 2, .LCPI2_0@toc@ha
62 ; CHECK-NEXT: addis 4, 2, .LCPI2_1@toc@ha
63 ; CHECK-NEXT: lfs 1, .LCPI2_0@toc@l(3)
64 ; CHECK-NEXT: lfs 2, .LCPI2_1@toc@l(4)
67 ; CHECK-NEXT: addi 1, 1, 32
68 ; CHECK-NEXT: ld 0, 16(1)
72 call void @test(ppc_fp128 0xM3FF00000000000000000000000000000)
76 define ppc_fp128 @result() {
77 ; CHECK-LABEL: result:
78 ; CHECK: # %bb.0: # %entry
79 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
80 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
81 ; CHECK-NEXT: lfd 1, 0(3)
82 ; CHECK-NEXT: lfd 2, 8(3)
85 %0 = load ppc_fp128, ptr @g, align 16
89 define void @use_result() {
90 ; CHECK-LABEL: use_result:
91 ; CHECK: # %bb.0: # %entry
93 ; CHECK-NEXT: stdu 1, -32(1)
94 ; CHECK-NEXT: std 0, 48(1)
95 ; CHECK-NEXT: .cfi_def_cfa_offset 32
96 ; CHECK-NEXT: .cfi_offset lr, 16
97 ; CHECK-NEXT: bl test_result
99 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
100 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
101 ; CHECK-NEXT: stfd 2, 8(3)
102 ; CHECK-NEXT: stfd 1, 0(3)
103 ; CHECK-NEXT: addi 1, 1, 32
104 ; CHECK-NEXT: ld 0, 16(1)
108 %call = tail call ppc_fp128 @test_result() #3
109 store ppc_fp128 %call, ptr @g, align 16
113 declare ppc_fp128 @test_result()
115 define void @caller_result() {
116 ; CHECK-LABEL: caller_result:
117 ; CHECK: # %bb.0: # %entry
119 ; CHECK-NEXT: stdu 1, -32(1)
120 ; CHECK-NEXT: std 0, 48(1)
121 ; CHECK-NEXT: .cfi_def_cfa_offset 32
122 ; CHECK-NEXT: .cfi_offset lr, 16
123 ; CHECK-NEXT: bl test_result
125 ; CHECK-NEXT: bl test
127 ; CHECK-NEXT: addi 1, 1, 32
128 ; CHECK-NEXT: ld 0, 16(1)
132 %call = tail call ppc_fp128 @test_result()
133 tail call void @test(ppc_fp128 %call)
137 define i128 @convert_from(ppc_fp128 %x) {
138 ; CHECK-LABEL: convert_from:
139 ; CHECK: # %bb.0: # %entry
140 ; CHECK-NEXT: stfd 1, -16(1)
141 ; CHECK-NEXT: stfd 2, -8(1)
142 ; CHECK-NEXT: ld 3, -16(1)
143 ; CHECK-NEXT: ld 4, -8(1)
146 %0 = bitcast ppc_fp128 %x to i128
150 define ppc_fp128 @convert_to(i128 %x) {
151 ; CHECK-LABEL: convert_to:
152 ; CHECK: # %bb.0: # %entry
153 ; CHECK-NEXT: std 3, -16(1)
154 ; CHECK-NEXT: std 4, -8(1)
155 ; CHECK-NEXT: lfd 1, -16(1)
156 ; CHECK-NEXT: lfd 2, -8(1)
159 %0 = bitcast i128 %x to ppc_fp128
163 define ppc_fp128 @convert_to2(i128 %x) {
164 ; CHECK-LABEL: convert_to2:
165 ; CHECK: # %bb.0: # %entry
166 ; CHECK-NEXT: rotldi 5, 3, 1
167 ; CHECK-NEXT: sldi 3, 3, 1
168 ; CHECK-NEXT: rldimi 5, 4, 1, 0
169 ; CHECK-NEXT: std 3, -16(1)
170 ; CHECK-NEXT: std 5, -8(1)
171 ; CHECK-NEXT: lfd 1, -16(1)
172 ; CHECK-NEXT: lfd 2, -8(1)
175 %shl = shl i128 %x, 1
176 %0 = bitcast i128 %shl to ppc_fp128
181 define double @convert_vector(<4 x i32> %x) {
182 ; CHECK-LABEL: convert_vector:
183 ; CHECK: # %bb.0: # %entry
184 ; CHECK-NEXT: addi 3, 1, -16
185 ; CHECK-NEXT: stvx 2, 0, 3
186 ; CHECK-NEXT: lfd 1, -16(1)
189 %cast = bitcast <4 x i32> %x to ppc_fp128
190 %conv = fptrunc ppc_fp128 %cast to double
194 declare void @llvm.va_start(ptr)
196 define double @vararg(i32 %a, ...) {
197 ; CHECK-LABEL: vararg:
198 ; CHECK: # %bb.0: # %entry
199 ; CHECK-NEXT: addi 3, 1, 55
200 ; CHECK-NEXT: std 4, 40(1)
201 ; CHECK-NEXT: rldicr 3, 3, 0, 59
202 ; CHECK-NEXT: std 5, 48(1)
203 ; CHECK-NEXT: ori 4, 3, 8
204 ; CHECK-NEXT: std 6, 56(1)
205 ; CHECK-NEXT: std 7, 64(1)
206 ; CHECK-NEXT: std 8, 72(1)
207 ; CHECK-NEXT: std 9, 80(1)
208 ; CHECK-NEXT: std 10, 88(1)
209 ; CHECK-NEXT: std 4, -8(1)
210 ; CHECK-NEXT: lfd 1, 0(3)
211 ; CHECK-NEXT: addi 3, 3, 16
212 ; CHECK-NEXT: std 3, -8(1)
215 %va = alloca ptr, align 8
216 call void @llvm.va_start(ptr %va)
217 %arg = va_arg ptr %va, ppc_fp128
218 %conv = fptrunc ppc_fp128 %arg to double