1 ; RUN: llc -verify-machineinstrs -mcpu=pwr9 -enable-ppc-quad-precision \
2 ; RUN: -mtriple=powerpc64le-unknown-unknown -ppc-vsr-nums-as-vr \
3 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
5 @A = common global fp128 0xL00000000000000000000000000000000, align 16
6 @B = common global fp128 0xL00000000000000000000000000000000, align 16
7 @C = common global fp128 0xL00000000000000000000000000000000, align 16
8 @D = common global fp128 0xL00000000000000000000000000000000, align 16
10 define fp128 @testSqrtOdd(fp128 %a) {
12 %0 = call fp128 @llvm.ppc.sqrtf128.round.to.odd(fp128 %a)
14 ; CHECK-LABEL: testSqrtOdd
15 ; CHECK: xssqrtqpo v2, v2
19 declare fp128 @llvm.ppc.sqrtf128.round.to.odd(fp128)
21 define void @testFMAOdd(fp128 %a, fp128 %b, fp128 %c) {
23 %0 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %c)
24 store fp128 %0, fp128* @A, align 16
25 %sub = fsub fp128 0xL00000000000000008000000000000000, %c
26 %1 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %sub)
27 store fp128 %1, fp128* @B, align 16
28 %2 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %c)
29 %sub1 = fsub fp128 0xL00000000000000008000000000000000, %2
30 store fp128 %sub1, fp128* @C, align 16
31 %sub2 = fsub fp128 0xL00000000000000008000000000000000, %c
32 %3 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %sub2)
33 %sub3 = fsub fp128 0xL00000000000000008000000000000000, %3
34 store fp128 %sub3, fp128* @D, align 16
36 ; CHECK-LABEL: testFMAOdd
37 ; CHECK-DAG: xsmaddqpo v{{[0-9]+}}, v2, v3
38 ; CHECK-DAG: xsmsubqpo v{{[0-9]+}}, v2, v3
39 ; CHECK-DAG: xsnmaddqpo v{{[0-9]+}}, v2, v3
40 ; CHECK-DAG: xsnmsubqpo v{{[0-9]+}}, v2, v3
44 declare fp128 @llvm.ppc.fmaf128.round.to.odd(fp128, fp128, fp128)
46 define fp128 @testAddOdd(fp128 %a, fp128 %b) {
48 %0 = call fp128 @llvm.ppc.addf128.round.to.odd(fp128 %a, fp128 %b)
50 ; CHECK-LABEL: testAddOdd
51 ; CHECK: xsaddqpo v2, v2, v3
55 declare fp128 @llvm.ppc.addf128.round.to.odd(fp128, fp128)
57 define fp128 @testSubOdd(fp128 %a, fp128 %b) {
59 %0 = call fp128 @llvm.ppc.subf128.round.to.odd(fp128 %a, fp128 %b)
61 ; CHECK-LABEL: testSubOdd
62 ; CHECK: xssubqpo v2, v2, v3
66 ; Function Attrs: nounwind readnone
67 declare fp128 @llvm.ppc.subf128.round.to.odd(fp128, fp128)
69 ; Function Attrs: noinline nounwind optnone
70 define fp128 @testMulOdd(fp128 %a, fp128 %b) {
72 %0 = call fp128 @llvm.ppc.mulf128.round.to.odd(fp128 %a, fp128 %b)
74 ; CHECK-LABEL: testMulOdd
75 ; CHECK: xsmulqpo v2, v2, v3
79 ; Function Attrs: nounwind readnone
80 declare fp128 @llvm.ppc.mulf128.round.to.odd(fp128, fp128)
82 define fp128 @testDivOdd(fp128 %a, fp128 %b) {
84 %0 = call fp128 @llvm.ppc.divf128.round.to.odd(fp128 %a, fp128 %b)
86 ; CHECK-LABEL: testDivOdd
87 ; CHECK: xsdivqpo v2, v2, v3
91 declare fp128 @llvm.ppc.divf128.round.to.odd(fp128, fp128)
93 define double @testTruncOdd(fp128 %a) {
95 %0 = call double @llvm.ppc.truncf128.round.to.odd(fp128 %a)
97 ; CHECK-LABEL: testTruncOdd
98 ; CHECK: xscvqpdpo v2, v2
99 ; CHECK: xscpsgndp f1, v2, v2
103 declare double @llvm.ppc.truncf128.round.to.odd(fp128)
105 ; Function Attrs: noinline nounwind optnone
106 define fp128 @insert_exp_qp(i64 %b) {
108 %b.addr = alloca i64, align 8
109 store i64 %b, i64* %b.addr, align 8
110 %0 = load fp128, fp128* @A, align 16
111 %1 = load i64, i64* %b.addr, align 8
112 %2 = call fp128 @llvm.ppc.scalar.insert.exp.qp(fp128 %0, i64 %1)
114 ; CHECK-LABEL: insert_exp_qp
115 ; CHECK-DAG: mtfprd [[FPREG:f[0-9]+]], r3
116 ; CHECK-DAG: lxvx [[VECREG:v[0-9]+]]
117 ; CHECK: xsiexpqp v2, [[VECREG]], [[FPREG]]
121 ; Function Attrs: nounwind readnone
122 declare fp128 @llvm.ppc.scalar.insert.exp.qp(fp128, i64)
124 ; Function Attrs: noinline nounwind optnone
125 define i64 @extract_exp() {
127 %0 = load fp128, fp128* @A, align 16
128 %1 = call i64 @llvm.ppc.scalar.extract.expq(fp128 %0)
130 ; CHECK-LABEL: extract_exp
131 ; CHECK: lxvx [[VECIN:v[0-9]+]]
132 ; CHECK: xsxexpqp [[VECOUT:v[0-9]+]], [[VECIN]]
133 ; CHECK: mfvsrd r3, [[VECOUT]]
137 ; Function Attrs: nounwind readnone
138 declare i64 @llvm.ppc.scalar.extract.expq(fp128)