1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs \
3 ; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s
4 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs \
5 ; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s \
6 ; RUN: -check-prefix=CHECK-P8
8 define void @qp_trunc(fp128* nocapture readonly %a, fp128* nocapture %res) {
9 ; CHECK-LABEL: qp_trunc:
10 ; CHECK: # %bb.0: # %entry
11 ; CHECK-NEXT: lxv v2, 0(r3)
12 ; CHECK-NEXT: xsrqpi 1, v2, v2, 1
13 ; CHECK-NEXT: stxv v2, 0(r4)
16 ; CHECK-P8-LABEL: qp_trunc:
17 ; CHECK-P8: # %bb.0: # %entry
18 ; CHECK-P8-NEXT: mflr r0
19 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 48
20 ; CHECK-P8-NEXT: .cfi_offset lr, 16
21 ; CHECK-P8-NEXT: .cfi_offset r30, -16
22 ; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill
23 ; CHECK-P8-NEXT: std r0, 16(r1)
24 ; CHECK-P8-NEXT: stdu r1, -48(r1)
25 ; CHECK-P8-NEXT: lvx v2, 0, r3
26 ; CHECK-P8-NEXT: mr r30, r4
27 ; CHECK-P8-NEXT: bl truncf128
29 ; CHECK-P8-NEXT: stvx v2, 0, r30
30 ; CHECK-P8-NEXT: addi r1, r1, 48
31 ; CHECK-P8-NEXT: ld r0, 16(r1)
32 ; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
33 ; CHECK-P8-NEXT: mtlr r0
36 %0 = load fp128, fp128* %a, align 16
37 %1 = tail call fp128 @llvm.trunc.f128(fp128 %0)
38 store fp128 %1, fp128* %res, align 16
41 declare fp128 @llvm.trunc.f128(fp128 %Val)
43 define void @qp_rint(fp128* nocapture readonly %a, fp128* nocapture %res) {
44 ; CHECK-LABEL: qp_rint:
45 ; CHECK: # %bb.0: # %entry
46 ; CHECK-NEXT: lxv v2, 0(r3)
47 ; CHECK-NEXT: xsrqpix 0, v2, v2, 3
48 ; CHECK-NEXT: stxv v2, 0(r4)
51 ; CHECK-P8-LABEL: qp_rint:
52 ; CHECK-P8: # %bb.0: # %entry
53 ; CHECK-P8-NEXT: mflr r0
54 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 48
55 ; CHECK-P8-NEXT: .cfi_offset lr, 16
56 ; CHECK-P8-NEXT: .cfi_offset r30, -16
57 ; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill
58 ; CHECK-P8-NEXT: std r0, 16(r1)
59 ; CHECK-P8-NEXT: stdu r1, -48(r1)
60 ; CHECK-P8-NEXT: lvx v2, 0, r3
61 ; CHECK-P8-NEXT: mr r30, r4
62 ; CHECK-P8-NEXT: bl rintf128
64 ; CHECK-P8-NEXT: stvx v2, 0, r30
65 ; CHECK-P8-NEXT: addi r1, r1, 48
66 ; CHECK-P8-NEXT: ld r0, 16(r1)
67 ; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
68 ; CHECK-P8-NEXT: mtlr r0
71 %0 = load fp128, fp128* %a, align 16
72 %1 = tail call fp128 @llvm.rint.f128(fp128 %0)
73 store fp128 %1, fp128* %res, align 16
76 declare fp128 @llvm.rint.f128(fp128 %Val)
78 define void @qp_nearbyint(fp128* nocapture readonly %a, fp128* nocapture %res) {
79 ; CHECK-LABEL: qp_nearbyint:
80 ; CHECK: # %bb.0: # %entry
81 ; CHECK-NEXT: lxv v2, 0(r3)
82 ; CHECK-NEXT: xsrqpi 0, v2, v2, 3
83 ; CHECK-NEXT: stxv v2, 0(r4)
86 ; CHECK-P8-LABEL: qp_nearbyint:
87 ; CHECK-P8: # %bb.0: # %entry
88 ; CHECK-P8-NEXT: mflr r0
89 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 48
90 ; CHECK-P8-NEXT: .cfi_offset lr, 16
91 ; CHECK-P8-NEXT: .cfi_offset r30, -16
92 ; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill
93 ; CHECK-P8-NEXT: std r0, 16(r1)
94 ; CHECK-P8-NEXT: stdu r1, -48(r1)
95 ; CHECK-P8-NEXT: lvx v2, 0, r3
96 ; CHECK-P8-NEXT: mr r30, r4
97 ; CHECK-P8-NEXT: bl nearbyintf128
99 ; CHECK-P8-NEXT: stvx v2, 0, r30
100 ; CHECK-P8-NEXT: addi r1, r1, 48
101 ; CHECK-P8-NEXT: ld r0, 16(r1)
102 ; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
103 ; CHECK-P8-NEXT: mtlr r0
106 %0 = load fp128, fp128* %a, align 16
107 %1 = tail call fp128 @llvm.nearbyint.f128(fp128 %0)
108 store fp128 %1, fp128* %res, align 16
111 declare fp128 @llvm.nearbyint.f128(fp128 %Val)
113 define void @qp_round(fp128* nocapture readonly %a, fp128* nocapture %res) {
114 ; CHECK-LABEL: qp_round:
115 ; CHECK: # %bb.0: # %entry
116 ; CHECK-NEXT: lxv v2, 0(r3)
117 ; CHECK-NEXT: xsrqpi 0, v2, v2, 0
118 ; CHECK-NEXT: stxv v2, 0(r4)
121 ; CHECK-P8-LABEL: qp_round:
122 ; CHECK-P8: # %bb.0: # %entry
123 ; CHECK-P8-NEXT: mflr r0
124 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 48
125 ; CHECK-P8-NEXT: .cfi_offset lr, 16
126 ; CHECK-P8-NEXT: .cfi_offset r30, -16
127 ; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill
128 ; CHECK-P8-NEXT: std r0, 16(r1)
129 ; CHECK-P8-NEXT: stdu r1, -48(r1)
130 ; CHECK-P8-NEXT: lvx v2, 0, r3
131 ; CHECK-P8-NEXT: mr r30, r4
132 ; CHECK-P8-NEXT: bl roundf128
134 ; CHECK-P8-NEXT: stvx v2, 0, r30
135 ; CHECK-P8-NEXT: addi r1, r1, 48
136 ; CHECK-P8-NEXT: ld r0, 16(r1)
137 ; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
138 ; CHECK-P8-NEXT: mtlr r0
141 %0 = load fp128, fp128* %a, align 16
142 %1 = tail call fp128 @llvm.round.f128(fp128 %0)
143 store fp128 %1, fp128* %res, align 16
146 declare fp128 @llvm.round.f128(fp128 %Val)
148 define void @qp_floor(fp128* nocapture readonly %a, fp128* nocapture %res) {
149 ; CHECK-LABEL: qp_floor:
150 ; CHECK: # %bb.0: # %entry
151 ; CHECK-NEXT: lxv v2, 0(r3)
152 ; CHECK-NEXT: xsrqpi 1, v2, v2, 3
153 ; CHECK-NEXT: stxv v2, 0(r4)
156 ; CHECK-P8-LABEL: qp_floor:
157 ; CHECK-P8: # %bb.0: # %entry
158 ; CHECK-P8-NEXT: mflr r0
159 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 48
160 ; CHECK-P8-NEXT: .cfi_offset lr, 16
161 ; CHECK-P8-NEXT: .cfi_offset r30, -16
162 ; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill
163 ; CHECK-P8-NEXT: std r0, 16(r1)
164 ; CHECK-P8-NEXT: stdu r1, -48(r1)
165 ; CHECK-P8-NEXT: lvx v2, 0, r3
166 ; CHECK-P8-NEXT: mr r30, r4
167 ; CHECK-P8-NEXT: bl floorf128
169 ; CHECK-P8-NEXT: stvx v2, 0, r30
170 ; CHECK-P8-NEXT: addi r1, r1, 48
171 ; CHECK-P8-NEXT: ld r0, 16(r1)
172 ; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
173 ; CHECK-P8-NEXT: mtlr r0
176 %0 = load fp128, fp128* %a, align 16
177 %1 = tail call fp128 @llvm.floor.f128(fp128 %0)
178 store fp128 %1, fp128* %res, align 16
181 declare fp128 @llvm.floor.f128(fp128 %Val)
183 define void @qp_ceil(fp128* nocapture readonly %a, fp128* nocapture %res) {
184 ; CHECK-LABEL: qp_ceil:
185 ; CHECK: # %bb.0: # %entry
186 ; CHECK-NEXT: lxv v2, 0(r3)
187 ; CHECK-NEXT: xsrqpi 1, v2, v2, 2
188 ; CHECK-NEXT: stxv v2, 0(r4)
191 ; CHECK-P8-LABEL: qp_ceil:
192 ; CHECK-P8: # %bb.0: # %entry
193 ; CHECK-P8-NEXT: mflr r0
194 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 48
195 ; CHECK-P8-NEXT: .cfi_offset lr, 16
196 ; CHECK-P8-NEXT: .cfi_offset r30, -16
197 ; CHECK-P8-NEXT: std r30, -16(r1) # 8-byte Folded Spill
198 ; CHECK-P8-NEXT: std r0, 16(r1)
199 ; CHECK-P8-NEXT: stdu r1, -48(r1)
200 ; CHECK-P8-NEXT: lvx v2, 0, r3
201 ; CHECK-P8-NEXT: mr r30, r4
202 ; CHECK-P8-NEXT: bl ceilf128
204 ; CHECK-P8-NEXT: stvx v2, 0, r30
205 ; CHECK-P8-NEXT: addi r1, r1, 48
206 ; CHECK-P8-NEXT: ld r0, 16(r1)
207 ; CHECK-P8-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
208 ; CHECK-P8-NEXT: mtlr r0
211 %0 = load fp128, fp128* %a, align 16
212 %1 = tail call fp128 @llvm.ceil.f128(fp128 %0)
213 store fp128 %1, fp128* %res, align 16
216 declare fp128 @llvm.ceil.f128(fp128 %Val)