1 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown \
2 ; RUN: -enable-ppc-quad-precision -verify-machineinstrs \
3 ; RUN: -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | FileCheck %s
5 ; Function Attrs: norecurse nounwind
6 define void @qpAdd(fp128* nocapture readonly %a, fp128* nocapture %res) {
8 %0 = load fp128, fp128* %a, align 16
9 %add = fadd fp128 %0, %0
10 store fp128 %add, fp128* %res, align 16
13 ; CHECK-NOT: bl __addtf3
19 ; Function Attrs: norecurse nounwind
20 define void @qpSub(fp128* nocapture readonly %a, fp128* nocapture %res) {
22 %0 = load fp128, fp128* %a, align 16
23 %sub = fsub fp128 %0, %0
24 store fp128 %sub, fp128* %res, align 16
27 ; CHECK-NOT: bl __subtf3
33 ; Function Attrs: norecurse nounwind
34 define void @qpMul(fp128* nocapture readonly %a, fp128* nocapture %res) {
36 %0 = load fp128, fp128* %a, align 16
37 %mul = fmul fp128 %0, %0
38 store fp128 %mul, fp128* %res, align 16
41 ; CHECK-NOT: bl __multf3
47 ; Function Attrs: norecurse nounwind
48 define void @qpDiv(fp128* nocapture readonly %a, fp128* nocapture %res) {
50 %0 = load fp128, fp128* %a, align 16
51 %div = fdiv fp128 %0, %0
52 store fp128 %div, fp128* %res, align 16
55 ; CHECK-NOT: bl __divtf3
61 define void @testLdNSt(i8* nocapture readonly %PtrC, fp128* nocapture %PtrF) {
63 %add.ptr = getelementptr inbounds i8, i8* %PtrC, i64 4
64 %0 = bitcast i8* %add.ptr to fp128*
65 %1 = load fp128, fp128* %0, align 16
66 %2 = bitcast fp128* %PtrF to i8*
67 %add.ptr1 = getelementptr inbounds i8, i8* %2, i64 8
68 %3 = bitcast i8* %add.ptr1 to fp128*
69 store fp128 %1, fp128* %3, align 16
71 ; CHECK-LABEL: testLdNSt
77 define void @qpSqrt(fp128* nocapture readonly %a, fp128* nocapture %res) {
79 %0 = load fp128, fp128* %a, align 16
80 %1 = tail call fp128 @llvm.sqrt.f128(fp128 %0)
81 store fp128 %1, fp128* %res, align 16
90 declare fp128 @llvm.sqrt.f128(fp128 %Val)
92 define void @qpCpsgn(fp128* nocapture readonly %a, fp128* nocapture readonly %b,
93 fp128* nocapture %res) {
95 %0 = load fp128, fp128* %a, align 16
96 %1 = load fp128, fp128* %b, align 16
97 %2 = tail call fp128 @llvm.copysign.f128(fp128 %0, fp128 %1)
98 store fp128 %2, fp128* %res, align 16
101 ; CHECK-LABEL: qpCpsgn
107 declare fp128 @llvm.copysign.f128(fp128 %Mag, fp128 %Sgn)
109 define void @qpAbs(fp128* nocapture readonly %a, fp128* nocapture %res) {
111 %0 = load fp128, fp128* %a, align 16
112 %1 = tail call fp128 @llvm.fabs.f128(fp128 %0)
113 store fp128 %1, fp128* %res, align 16
122 declare fp128 @llvm.fabs.f128(fp128 %Val)
124 define void @qpNAbs(fp128* nocapture readonly %a, fp128* nocapture %res) {
126 %0 = load fp128, fp128* %a, align 16
127 %1 = tail call fp128 @llvm.fabs.f128(fp128 %0)
128 %neg = fsub fp128 0xL00000000000000008000000000000000, %1
129 store fp128 %neg, fp128* %res, align 16
132 ; CHECK-LABEL: qpNAbs
133 ; CHECK-NOT: bl __subtf3
139 define void @qpNeg(fp128* nocapture readonly %a, fp128* nocapture %res) {
141 %0 = load fp128, fp128* %a, align 16
142 %sub = fsub fp128 0xL00000000000000008000000000000000, %0
143 store fp128 %sub, fp128* %res, align 16
147 ; CHECK-NOT: bl __subtf3
153 define fp128 @qp_sin(fp128* nocapture readonly %a) {
154 ; CHECK-LABEL: qp_sin:
155 ; CHECK: lxv v2, 0(r3)
159 %0 = load fp128, fp128* %a, align 16
160 %1 = tail call fp128 @llvm.sin.f128(fp128 %0)
163 declare fp128 @llvm.sin.f128(fp128 %Val)
165 define fp128 @qp_cos(fp128* nocapture readonly %a) {
166 ; CHECK-LABEL: qp_cos:
167 ; CHECK: lxv v2, 0(r3)
171 %0 = load fp128, fp128* %a, align 16
172 %1 = tail call fp128 @llvm.cos.f128(fp128 %0)
175 declare fp128 @llvm.cos.f128(fp128 %Val)
177 define fp128 @qp_log(fp128* nocapture readonly %a) {
178 ; CHECK-LABEL: qp_log:
179 ; CHECK: lxv v2, 0(r3)
183 %0 = load fp128, fp128* %a, align 16
184 %1 = tail call fp128 @llvm.log.f128(fp128 %0)
187 declare fp128 @llvm.log.f128(fp128 %Val)
189 define fp128 @qp_log10(fp128* nocapture readonly %a) {
190 ; CHECK-LABEL: qp_log10:
191 ; CHECK: lxv v2, 0(r3)
192 ; CHECK: bl log10f128
195 %0 = load fp128, fp128* %a, align 16
196 %1 = tail call fp128 @llvm.log10.f128(fp128 %0)
199 declare fp128 @llvm.log10.f128(fp128 %Val)
201 define fp128 @qp_log2(fp128* nocapture readonly %a) {
202 ; CHECK-LABEL: qp_log2:
203 ; CHECK: lxv v2, 0(r3)
207 %0 = load fp128, fp128* %a, align 16
208 %1 = tail call fp128 @llvm.log2.f128(fp128 %0)
211 declare fp128 @llvm.log2.f128(fp128 %Val)
213 define fp128 @qp_minnum(fp128* nocapture readonly %a,
214 fp128* nocapture readonly %b) {
215 ; CHECK-LABEL: qp_minnum:
216 ; CHECK: lxv v2, 0(r3)
217 ; CHECK: lxv v3, 0(r4)
221 %0 = load fp128, fp128* %a, align 16
222 %1 = load fp128, fp128* %b, align 16
223 %2 = tail call fp128 @llvm.minnum.f128(fp128 %0, fp128 %1)
226 declare fp128 @llvm.minnum.f128(fp128 %Val0, fp128 %Val1)
228 define fp128 @qp_maxnum(fp128* nocapture readonly %a,
229 fp128* nocapture readonly %b) {
230 ; CHECK-LABEL: qp_maxnum:
231 ; CHECK: lxv v2, 0(r3)
232 ; CHECK: lxv v3, 0(r4)
236 %0 = load fp128, fp128* %a, align 16
237 %1 = load fp128, fp128* %b, align 16
238 %2 = tail call fp128 @llvm.maxnum.f128(fp128 %0, fp128 %1)
241 declare fp128 @llvm.maxnum.f128(fp128 %Val0, fp128 %Val1)
243 define fp128 @qp_pow(fp128* nocapture readonly %a,
244 fp128* nocapture readonly %b) {
245 ; CHECK-LABEL: qp_pow:
246 ; CHECK: lxv v2, 0(r3)
247 ; CHECK: lxv v3, 0(r4)
251 %0 = load fp128, fp128* %a, align 16
252 %1 = load fp128, fp128* %b, align 16
253 %2 = tail call fp128 @llvm.pow.f128(fp128 %0, fp128 %1)
256 declare fp128 @llvm.pow.f128(fp128 %Val, fp128 %Power)
258 define fp128 @qp_exp(fp128* nocapture readonly %a) {
259 ; CHECK-LABEL: qp_exp:
260 ; CHECK: lxv v2, 0(r3)
264 %0 = load fp128, fp128* %a, align 16
265 %1 = tail call fp128 @llvm.exp.f128(fp128 %0)
268 declare fp128 @llvm.exp.f128(fp128 %Val)
270 define fp128 @qp_exp2(fp128* nocapture readonly %a) {
271 ; CHECK-LABEL: qp_exp2:
272 ; CHECK: lxv v2, 0(r3)
276 %0 = load fp128, fp128* %a, align 16
277 %1 = tail call fp128 @llvm.exp2.f128(fp128 %0)
280 declare fp128 @llvm.exp2.f128(fp128 %Val)
282 define void @qp_powi(fp128* nocapture readonly %a, i32* nocapture readonly %b,
283 fp128* nocapture %res) {
284 ; CHECK-LABEL: qp_powi:
285 ; CHECK: lxv v2, 0(r3)
286 ; CHECK: lwz r5, 0(r4)
287 ; CHECK: bl __powikf2
290 %0 = load fp128, fp128* %a, align 16
291 %1 = load i32, i32* %b, align 8
292 %2 = tail call fp128 @llvm.powi.f128(fp128 %0, i32 %1)
293 store fp128 %2, fp128* %res, align 16
296 declare fp128 @llvm.powi.f128(fp128 %Val, i32 %power)
298 @a = common global fp128 0xL00000000000000000000000000000000, align 16
299 @b = common global fp128 0xL00000000000000000000000000000000, align 16
301 define fp128 @qp_frem() #0 {
303 %0 = load fp128, fp128* @a, align 16
304 %1 = load fp128, fp128* @b, align 16
305 %rem = frem fp128 %0, %1
307 ; CHECK-LABEL: qp_frem