1 ; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown \
2 ; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s
4 @A = common global fp128 0xL00000000000000000000000000000000, align 16
5 @B = common global fp128 0xL00000000000000000000000000000000, align 16
6 @C = common global fp128 0xL00000000000000000000000000000000, align 16
7 @D = common global fp128 0xL00000000000000000000000000000000, align 16
9 define fp128 @testSqrtOdd(fp128 %a) {
11 %0 = call fp128 @llvm.ppc.sqrtf128.round.to.odd(fp128 %a)
13 ; CHECK-LABEL: testSqrtOdd
14 ; CHECK: xssqrtqpo v2, v2
18 declare fp128 @llvm.ppc.sqrtf128.round.to.odd(fp128)
20 define void @testFMAOdd(fp128 %a, fp128 %b, fp128 %c) {
22 %0 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %c)
23 store fp128 %0, ptr @A, align 16
24 %sub = fsub fp128 0xL00000000000000008000000000000000, %c
25 %1 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %sub)
26 store fp128 %1, ptr @B, align 16
27 %2 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %c)
28 %sub1 = fsub fp128 0xL00000000000000008000000000000000, %2
29 store fp128 %sub1, ptr @C, align 16
30 %sub2 = fsub fp128 0xL00000000000000008000000000000000, %c
31 %3 = call fp128 @llvm.ppc.fmaf128.round.to.odd(fp128 %a, fp128 %b, fp128 %sub2)
32 %sub3 = fsub fp128 0xL00000000000000008000000000000000, %3
33 store fp128 %sub3, ptr @D, align 16
35 ; CHECK-LABEL: testFMAOdd
36 ; CHECK-DAG: xsmaddqpo v{{[0-9]+}}, v2, v3
37 ; CHECK-DAG: xsmsubqpo v{{[0-9]+}}, v2, v3
38 ; CHECK-DAG: xsnmaddqpo v{{[0-9]+}}, v2, v3
39 ; CHECK-DAG: xsnmsubqpo v{{[0-9]+}}, v2, v3
43 declare fp128 @llvm.ppc.fmaf128.round.to.odd(fp128, fp128, fp128)
45 define fp128 @testAddOdd(fp128 %a, fp128 %b) {
47 %0 = call fp128 @llvm.ppc.addf128.round.to.odd(fp128 %a, fp128 %b)
49 ; CHECK-LABEL: testAddOdd
50 ; CHECK: xsaddqpo v2, v2, v3
54 declare fp128 @llvm.ppc.addf128.round.to.odd(fp128, fp128)
56 define fp128 @testSubOdd(fp128 %a, fp128 %b) {
58 %0 = call fp128 @llvm.ppc.subf128.round.to.odd(fp128 %a, fp128 %b)
60 ; CHECK-LABEL: testSubOdd
61 ; CHECK: xssubqpo v2, v2, v3
65 ; Function Attrs: nounwind readnone
66 declare fp128 @llvm.ppc.subf128.round.to.odd(fp128, fp128)
68 ; Function Attrs: noinline nounwind optnone
69 define fp128 @testMulOdd(fp128 %a, fp128 %b) {
71 %0 = call fp128 @llvm.ppc.mulf128.round.to.odd(fp128 %a, fp128 %b)
73 ; CHECK-LABEL: testMulOdd
74 ; CHECK: xsmulqpo v2, v2, v3
78 ; Function Attrs: nounwind readnone
79 declare fp128 @llvm.ppc.mulf128.round.to.odd(fp128, fp128)
81 define fp128 @testDivOdd(fp128 %a, fp128 %b) {
83 %0 = call fp128 @llvm.ppc.divf128.round.to.odd(fp128 %a, fp128 %b)
85 ; CHECK-LABEL: testDivOdd
86 ; CHECK: xsdivqpo v2, v2, v3
90 declare fp128 @llvm.ppc.divf128.round.to.odd(fp128, fp128)
92 define double @testTruncOdd(fp128 %a) {
94 %0 = call double @llvm.ppc.truncf128.round.to.odd(fp128 %a)
96 ; CHECK-LABEL: testTruncOdd
97 ; CHECK: xscvqpdpo v2, v2
98 ; CHECK: xscpsgndp f1, v2, v2
102 declare double @llvm.ppc.truncf128.round.to.odd(fp128)
104 ; Function Attrs: noinline nounwind optnone
105 define fp128 @insert_exp_qp(i64 %b) {
107 %b.addr = alloca i64, align 8
108 store i64 %b, ptr %b.addr, align 8
109 %0 = load fp128, ptr @A, align 16
110 %1 = load i64, ptr %b.addr, align 8
111 %2 = call fp128 @llvm.ppc.scalar.insert.exp.qp(fp128 %0, i64 %1)
113 ; CHECK-LABEL: insert_exp_qp
114 ; CHECK-DAG: mtfprd [[FPREG:f[0-9]+]], r3
115 ; CHECK-DAG: lxv [[VECREG:v[0-9]+]]
116 ; CHECK: xsiexpqp v2, [[VECREG]], [[FPREG]]
120 ; Function Attrs: nounwind readnone
121 declare fp128 @llvm.ppc.scalar.insert.exp.qp(fp128, i64)
123 ; Function Attrs: noinline nounwind optnone
124 define i64 @extract_exp() {
126 %0 = load fp128, ptr @A, align 16
127 %1 = call i64 @llvm.ppc.scalar.extract.expq(fp128 %0)
129 ; CHECK-LABEL: extract_exp
130 ; CHECK: lxv [[VECIN:v[0-9]+]]
131 ; CHECK: xsxexpqp [[VECOUT:v[0-9]+]], [[VECIN]]
132 ; CHECK: mfvsrd r3, [[VECOUT]]
136 ; Function Attrs: nounwind readnone
137 declare i64 @llvm.ppc.scalar.extract.expq(fp128)
139 define i32 @test_data_class_f128(fp128 %d) {
141 %test_data_class = tail call i32 @llvm.ppc.test.data.class.f128(fp128 %d, i32 0)
142 ret i32 %test_data_class
143 ; CHECK-LABEL: test_data_class_f128:
144 ; CHECK: xststdcqp cr0, v2, 0
145 ; CHECK-NEXT: li r3, 0
146 ; CHECK-NEXT: li r4, 1
147 ; CHECK-NEXT: iseleq r3, r4, r3
151 declare i32 @llvm.ppc.test.data.class.f128(fp128, i32 immarg)