1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown \
3 ; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s
5 define float @ldexp_f32(i8 zeroext %x) {
6 ; CHECK-LABEL: ldexp_f32:
9 ; CHECK-NEXT: stdu r1, -32(r1)
10 ; CHECK-NEXT: std r0, 48(r1)
11 ; CHECK-NEXT: .cfi_def_cfa_offset 32
12 ; CHECK-NEXT: .cfi_offset lr, 16
13 ; CHECK-NEXT: vspltisw v2, 1
14 ; CHECK-NEXT: mr r4, r3
15 ; CHECK-NEXT: xvcvsxwdp vs1, v2
16 ; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1
17 ; CHECK-NEXT: bl ldexpf
19 ; CHECK-NEXT: addi r1, r1, 32
20 ; CHECK-NEXT: ld r0, 16(r1)
23 %zext = zext i8 %x to i32
24 %ldexp = call float @llvm.ldexp.f32.i32(float 1.000000e+00, i32 %zext)
28 define double @ldexp_f64(i8 zeroext %x) {
29 ; CHECK-LABEL: ldexp_f64:
32 ; CHECK-NEXT: stdu r1, -32(r1)
33 ; CHECK-NEXT: std r0, 48(r1)
34 ; CHECK-NEXT: .cfi_def_cfa_offset 32
35 ; CHECK-NEXT: .cfi_offset lr, 16
36 ; CHECK-NEXT: vspltisw v2, 1
37 ; CHECK-NEXT: mr r4, r3
38 ; CHECK-NEXT: xvcvsxwdp vs1, v2
39 ; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1
40 ; CHECK-NEXT: bl ldexp
42 ; CHECK-NEXT: addi r1, r1, 32
43 ; CHECK-NEXT: ld r0, 16(r1)
46 %zext = zext i8 %x to i32
47 %ldexp = call double @llvm.ldexp.f64.i32(double 1.000000e+00, i32 %zext)
51 define <2 x float> @ldexp_v2f32(<2 x float> %val, <2 x i32> %exp) {
52 ; CHECK-LABEL: ldexp_v2f32:
55 ; CHECK-NEXT: stdu r1, -80(r1)
56 ; CHECK-NEXT: std r0, 96(r1)
57 ; CHECK-NEXT: .cfi_def_cfa_offset 80
58 ; CHECK-NEXT: .cfi_offset lr, 16
59 ; CHECK-NEXT: .cfi_offset v29, -48
60 ; CHECK-NEXT: .cfi_offset v30, -32
61 ; CHECK-NEXT: .cfi_offset v31, -16
62 ; CHECK-NEXT: xxsldwi vs0, v2, v2, 3
63 ; CHECK-NEXT: li r3, 0
64 ; CHECK-NEXT: stxv v29, 32(r1) # 16-byte Folded Spill
65 ; CHECK-NEXT: xscvspdpn f1, vs0
66 ; CHECK-NEXT: vextuwrx r4, r3, v3
67 ; CHECK-NEXT: stxv v30, 48(r1) # 16-byte Folded Spill
68 ; CHECK-NEXT: stxv v31, 64(r1) # 16-byte Folded Spill
69 ; CHECK-NEXT: vmr v31, v3
70 ; CHECK-NEXT: vmr v30, v2
71 ; CHECK-NEXT: bl ldexpf
73 ; CHECK-NEXT: xxswapd vs0, v30
74 ; CHECK-NEXT: li r3, 4
75 ; CHECK-NEXT: xscvdpspn v29, f1
76 ; CHECK-NEXT: xscvspdpn f1, vs0
77 ; CHECK-NEXT: vextuwrx r4, r3, v31
78 ; CHECK-NEXT: bl ldexpf
80 ; CHECK-NEXT: xscvdpspn vs0, f1
81 ; CHECK-NEXT: lxv v31, 64(r1) # 16-byte Folded Reload
82 ; CHECK-NEXT: lxv v30, 48(r1) # 16-byte Folded Reload
83 ; CHECK-NEXT: xxmrghw v2, vs0, v29
84 ; CHECK-NEXT: lxv v29, 32(r1) # 16-byte Folded Reload
85 ; CHECK-NEXT: addi r1, r1, 80
86 ; CHECK-NEXT: ld r0, 16(r1)
89 %1 = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> %val, <2 x i32> %exp)
93 define <4 x float> @ldexp_v4f32(<4 x float> %val, <4 x i32> %exp) {
94 ; CHECK-LABEL: ldexp_v4f32:
97 ; CHECK-NEXT: stdu r1, -96(r1)
98 ; CHECK-NEXT: std r0, 112(r1)
99 ; CHECK-NEXT: .cfi_def_cfa_offset 96
100 ; CHECK-NEXT: .cfi_offset lr, 16
101 ; CHECK-NEXT: .cfi_offset v28, -64
102 ; CHECK-NEXT: .cfi_offset v29, -48
103 ; CHECK-NEXT: .cfi_offset v30, -32
104 ; CHECK-NEXT: .cfi_offset v31, -16
105 ; CHECK-NEXT: li r3, 12
106 ; CHECK-NEXT: xscvspdpn f1, v2
107 ; CHECK-NEXT: stxv v28, 32(r1) # 16-byte Folded Spill
108 ; CHECK-NEXT: stxv v29, 48(r1) # 16-byte Folded Spill
109 ; CHECK-NEXT: stxv v30, 64(r1) # 16-byte Folded Spill
110 ; CHECK-NEXT: stxv v31, 80(r1) # 16-byte Folded Spill
111 ; CHECK-NEXT: vmr v31, v3
112 ; CHECK-NEXT: vmr v30, v2
113 ; CHECK-NEXT: vextuwrx r4, r3, v3
114 ; CHECK-NEXT: bl ldexpf
116 ; CHECK-NEXT: xxswapd vs0, v30
117 ; CHECK-NEXT: li r3, 4
118 ; CHECK-NEXT: xscpsgndp v29, f1, f1
119 ; CHECK-NEXT: xscvspdpn f1, vs0
120 ; CHECK-NEXT: vextuwrx r4, r3, v31
121 ; CHECK-NEXT: bl ldexpf
123 ; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1
124 ; CHECK-NEXT: xxmrghd vs0, v29, vs1
125 ; CHECK-NEXT: li r3, 0
126 ; CHECK-NEXT: vextuwrx r4, r3, v31
127 ; CHECK-NEXT: xvcvdpsp v28, vs0
128 ; CHECK-NEXT: xxsldwi vs0, v30, v30, 3
129 ; CHECK-NEXT: xscvspdpn f1, vs0
130 ; CHECK-NEXT: bl ldexpf
132 ; CHECK-NEXT: xxsldwi vs0, v30, v30, 1
133 ; CHECK-NEXT: xscpsgndp v29, f1, f1
134 ; CHECK-NEXT: mfvsrwz r4, v31
135 ; CHECK-NEXT: xscvspdpn f1, vs0
136 ; CHECK-NEXT: bl ldexpf
138 ; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1
139 ; CHECK-NEXT: xxmrghd vs0, vs1, v29
140 ; CHECK-NEXT: lxv v31, 80(r1) # 16-byte Folded Reload
141 ; CHECK-NEXT: lxv v30, 64(r1) # 16-byte Folded Reload
142 ; CHECK-NEXT: lxv v29, 48(r1) # 16-byte Folded Reload
143 ; CHECK-NEXT: xvcvdpsp v2, vs0
144 ; CHECK-NEXT: vmrgew v2, v28, v2
145 ; CHECK-NEXT: lxv v28, 32(r1) # 16-byte Folded Reload
146 ; CHECK-NEXT: addi r1, r1, 96
147 ; CHECK-NEXT: ld r0, 16(r1)
148 ; CHECK-NEXT: mtlr r0
150 %1 = call <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float> %val, <4 x i32> %exp)
154 define half @ldexp_f16(half %arg0, i32 %arg1) {
155 ; CHECK-LABEL: ldexp_f16:
157 ; CHECK-NEXT: mflr r0
158 ; CHECK-NEXT: stdu r1, -32(r1)
159 ; CHECK-NEXT: std r0, 48(r1)
160 ; CHECK-NEXT: .cfi_def_cfa_offset 32
161 ; CHECK-NEXT: .cfi_offset lr, 16
162 ; CHECK-NEXT: xscvdphp f0, f1
163 ; CHECK-NEXT: clrldi r4, r4, 32
164 ; CHECK-NEXT: mffprwz r3, f0
165 ; CHECK-NEXT: clrlwi r3, r3, 16
166 ; CHECK-NEXT: mtfprwz f0, r3
167 ; CHECK-NEXT: xscvhpdp f1, f0
168 ; CHECK-NEXT: bl ldexpf
170 ; CHECK-NEXT: addi r1, r1, 32
171 ; CHECK-NEXT: ld r0, 16(r1)
172 ; CHECK-NEXT: mtlr r0
174 %ldexp = call half @llvm.ldexp.f16.i32(half %arg0, i32 %arg1)
178 define ppc_fp128 @ldexp_fp128(ppc_fp128 %arg0, i32 %arg1) {
179 ; CHECK-LABEL: ldexp_fp128:
181 ; CHECK-NEXT: mflr r0
182 ; CHECK-NEXT: stdu r1, -32(r1)
183 ; CHECK-NEXT: std r0, 48(r1)
184 ; CHECK-NEXT: .cfi_def_cfa_offset 32
185 ; CHECK-NEXT: .cfi_offset lr, 16
186 ; CHECK-NEXT: clrldi r5, r5, 32
187 ; CHECK-NEXT: bl ldexpl
189 ; CHECK-NEXT: addi r1, r1, 32
190 ; CHECK-NEXT: ld r0, 16(r1)
191 ; CHECK-NEXT: mtlr r0
193 %ldexp = call ppc_fp128 @llvm.ldexp.ppcf128.i32(ppc_fp128 %arg0, i32 %arg1)
197 declare double @llvm.ldexp.f64.i32(double, i32) #0
198 declare float @llvm.ldexp.f32.i32(float, i32) #0
199 declare <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float>, <2 x i32>) #0
200 declare <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float>, <4 x i32>) #0
201 declare half @llvm.ldexp.f16.i32(half, i32) #0
202 declare ppc_fp128 @llvm.ldexp.ppcf128.i32(ppc_fp128, i32) #0
204 attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }