1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown | FileCheck %s -check-prefix=PWR9
3 ; RUN: llc < %s -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown | FileCheck %s -check-prefix=PWR8
5 @a = internal global fp128 0xL00000000000000000000000000000000, align 16
6 @x = internal global [4 x fp128] zeroinitializer, align 16
7 @y = internal global [4 x fp128] zeroinitializer, align 16
9 define void @fmul_ctrloop_fp128() nounwind {
10 ; PWR9-LABEL: fmul_ctrloop_fp128:
11 ; PWR9: # %bb.0: # %entry
12 ; PWR9-NEXT: addis 3, 2, .L_MergedGlobals@toc@ha
14 ; PWR9-NEXT: addi 3, 3, .L_MergedGlobals@toc@l
15 ; PWR9-NEXT: lxv 34, 0(3)
17 ; PWR9-NEXT: .p2align 5
18 ; PWR9-NEXT: .LBB0_1: # %for.body
20 ; PWR9-NEXT: lxv 35, 16(3)
21 ; PWR9-NEXT: xsmulqp 3, 2, 3
22 ; PWR9-NEXT: stxv 35, 80(3)
23 ; PWR9-NEXT: addi 3, 3, 16
24 ; PWR9-NEXT: bdnz .LBB0_1
25 ; PWR9-NEXT: # %bb.2: # %for.end
28 ; PWR8-LABEL: fmul_ctrloop_fp128:
29 ; PWR8: # %bb.0: # %entry
31 ; PWR8-NEXT: stdu 1, -112(1)
33 ; PWR8-NEXT: std 0, 128(1)
34 ; PWR8-NEXT: std 30, 96(1) # 8-byte Folded Spill
35 ; PWR8-NEXT: std 27, 72(1) # 8-byte Folded Spill
36 ; PWR8-NEXT: std 28, 80(1) # 8-byte Folded Spill
37 ; PWR8-NEXT: li 28, 16
38 ; PWR8-NEXT: li 27, 80
39 ; PWR8-NEXT: std 29, 88(1) # 8-byte Folded Spill
40 ; PWR8-NEXT: stxvd2x 63, 1, 3 # 16-byte Folded Spill
41 ; PWR8-NEXT: addis 3, 2, .L_MergedGlobals@toc@ha
43 ; PWR8-NEXT: addi 30, 3, .L_MergedGlobals@toc@l
44 ; PWR8-NEXT: std 26, 64(1) # 8-byte Folded Spill
45 ; PWR8-NEXT: lxvd2x 0, 0, 30
46 ; PWR8-NEXT: xxswapd 63, 0
47 ; PWR8-NEXT: .p2align 4
48 ; PWR8-NEXT: .LBB0_1: # %for.body
50 ; PWR8-NEXT: lxvd2x 0, 30, 28
51 ; PWR8-NEXT: vmr 2, 31
52 ; PWR8-NEXT: addi 26, 30, 16
53 ; PWR8-NEXT: xxswapd 35, 0
54 ; PWR8-NEXT: bl __mulkf3
56 ; PWR8-NEXT: addi 29, 29, -1
57 ; PWR8-NEXT: xxswapd 0, 34
58 ; PWR8-NEXT: cmpldi 29, 0
59 ; PWR8-NEXT: stxvd2x 0, 30, 27
60 ; PWR8-NEXT: mr 30, 26
61 ; PWR8-NEXT: bc 12, 1, .LBB0_1
62 ; PWR8-NEXT: # %bb.2: # %for.end
64 ; PWR8-NEXT: ld 30, 96(1) # 8-byte Folded Reload
65 ; PWR8-NEXT: ld 29, 88(1) # 8-byte Folded Reload
66 ; PWR8-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload
67 ; PWR8-NEXT: ld 28, 80(1) # 8-byte Folded Reload
68 ; PWR8-NEXT: ld 27, 72(1) # 8-byte Folded Reload
69 ; PWR8-NEXT: ld 26, 64(1) # 8-byte Folded Reload
70 ; PWR8-NEXT: addi 1, 1, 112
71 ; PWR8-NEXT: ld 0, 16(1)
75 %0 = load fp128, ptr @a, align 16
78 for.body: ; preds = %for.body, %entry
79 %i.06 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
80 %arrayidx = getelementptr inbounds [4 x fp128], ptr @x, i64 0, i64 %i.06
81 %1 = load fp128, ptr %arrayidx, align 16
82 %mul = fmul fp128 %0, %1
83 %arrayidx1 = getelementptr inbounds [4 x fp128], ptr @y, i64 0, i64 %i.06
84 store fp128 %mul, ptr %arrayidx1, align 16
85 %inc = add nuw nsw i64 %i.06, 1
86 %exitcond = icmp eq i64 %inc, 4
87 br i1 %exitcond, label %for.end, label %for.body
89 for.end: ; preds = %for.body
93 define void @fpext_ctrloop_fp128(ptr %a) nounwind {
94 ; PWR9-LABEL: fpext_ctrloop_fp128:
95 ; PWR9: # %bb.0: # %entry
97 ; PWR9-NEXT: addi 3, 3, -8
99 ; PWR9-NEXT: addis 4, 2, .L_MergedGlobals@toc@ha
100 ; PWR9-NEXT: addi 4, 4, .L_MergedGlobals@toc@l
101 ; PWR9-NEXT: addi 4, 4, 64
102 ; PWR9-NEXT: .p2align 5
103 ; PWR9-NEXT: .LBB1_1: # %for.body
105 ; PWR9-NEXT: lfdu 0, 8(3)
106 ; PWR9-NEXT: xscpsgndp 34, 0, 0
107 ; PWR9-NEXT: xscvdpqp 2, 2
108 ; PWR9-NEXT: stxv 34, 16(4)
109 ; PWR9-NEXT: addi 4, 4, 16
110 ; PWR9-NEXT: bdnz .LBB1_1
111 ; PWR9-NEXT: # %bb.2: # %for.end
114 ; PWR8-LABEL: fpext_ctrloop_fp128:
115 ; PWR8: # %bb.0: # %entry
117 ; PWR8-NEXT: std 28, -32(1) # 8-byte Folded Spill
118 ; PWR8-NEXT: std 29, -24(1) # 8-byte Folded Spill
119 ; PWR8-NEXT: std 30, -16(1) # 8-byte Folded Spill
120 ; PWR8-NEXT: stdu 1, -64(1)
121 ; PWR8-NEXT: addi 30, 3, -8
122 ; PWR8-NEXT: addis 3, 2, .L_MergedGlobals@toc@ha
123 ; PWR8-NEXT: li 29, 4
124 ; PWR8-NEXT: std 0, 80(1)
125 ; PWR8-NEXT: addi 3, 3, .L_MergedGlobals@toc@l
126 ; PWR8-NEXT: addi 28, 3, 64
127 ; PWR8-NEXT: .p2align 4
128 ; PWR8-NEXT: .LBB1_1: # %for.body
130 ; PWR8-NEXT: lfdu 1, 8(30)
131 ; PWR8-NEXT: addi 28, 28, 16
132 ; PWR8-NEXT: bl __extenddfkf2
134 ; PWR8-NEXT: addi 29, 29, -1
135 ; PWR8-NEXT: xxswapd 0, 34
136 ; PWR8-NEXT: cmpldi 29, 0
137 ; PWR8-NEXT: stxvd2x 0, 0, 28
138 ; PWR8-NEXT: bc 12, 1, .LBB1_1
139 ; PWR8-NEXT: # %bb.2: # %for.end
140 ; PWR8-NEXT: addi 1, 1, 64
141 ; PWR8-NEXT: ld 0, 16(1)
142 ; PWR8-NEXT: ld 30, -16(1) # 8-byte Folded Reload
143 ; PWR8-NEXT: ld 29, -24(1) # 8-byte Folded Reload
144 ; PWR8-NEXT: ld 28, -32(1) # 8-byte Folded Reload
151 %i.06 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
152 %arrayidx = getelementptr inbounds double, ptr %a, i64 %i.06
153 %0 = load double, ptr %arrayidx, align 8
154 %ext = fpext double %0 to fp128
155 %arrayidx1 = getelementptr inbounds [4 x fp128], ptr @y, i64 0, i64 %i.06
156 store fp128 %ext, ptr %arrayidx1, align 16
157 %inc = add nuw nsw i64 %i.06, 1
158 %exitcond = icmp eq i64 %inc, 4
159 br i1 %exitcond, label %for.end, label %for.body
165 define void @fptrunc_ctrloop_fp128(ptr %a) nounwind {
166 ; PWR9-LABEL: fptrunc_ctrloop_fp128:
167 ; PWR9: # %bb.0: # %entry
169 ; PWR9-NEXT: addi 3, 3, -8
171 ; PWR9-NEXT: addis 4, 2, .L_MergedGlobals@toc@ha
172 ; PWR9-NEXT: addi 4, 4, .L_MergedGlobals@toc@l
173 ; PWR9-NEXT: .p2align 5
174 ; PWR9-NEXT: .LBB2_1: # %for.body
176 ; PWR9-NEXT: lxv 34, 16(4)
177 ; PWR9-NEXT: addi 4, 4, 16
178 ; PWR9-NEXT: xscvqpdp 2, 2
179 ; PWR9-NEXT: xscpsgndp 0, 34, 34
180 ; PWR9-NEXT: stfdu 0, 8(3)
181 ; PWR9-NEXT: bdnz .LBB2_1
182 ; PWR9-NEXT: # %bb.2: # %for.end
185 ; PWR8-LABEL: fptrunc_ctrloop_fp128:
186 ; PWR8: # %bb.0: # %entry
188 ; PWR8-NEXT: std 28, -32(1) # 8-byte Folded Spill
189 ; PWR8-NEXT: std 29, -24(1) # 8-byte Folded Spill
190 ; PWR8-NEXT: std 30, -16(1) # 8-byte Folded Spill
191 ; PWR8-NEXT: stdu 1, -64(1)
192 ; PWR8-NEXT: addi 30, 3, -8
193 ; PWR8-NEXT: addis 3, 2, .L_MergedGlobals@toc@ha
194 ; PWR8-NEXT: li 29, 4
195 ; PWR8-NEXT: std 0, 80(1)
196 ; PWR8-NEXT: addi 28, 3, .L_MergedGlobals@toc@l
197 ; PWR8-NEXT: .p2align 4
198 ; PWR8-NEXT: .LBB2_1: # %for.body
200 ; PWR8-NEXT: addi 28, 28, 16
201 ; PWR8-NEXT: lxvd2x 0, 0, 28
202 ; PWR8-NEXT: xxswapd 34, 0
203 ; PWR8-NEXT: bl __trunckfdf2
205 ; PWR8-NEXT: addi 29, 29, -1
206 ; PWR8-NEXT: stfdu 1, 8(30)
207 ; PWR8-NEXT: cmpldi 29, 0
208 ; PWR8-NEXT: bc 12, 1, .LBB2_1
209 ; PWR8-NEXT: # %bb.2: # %for.end
210 ; PWR8-NEXT: addi 1, 1, 64
211 ; PWR8-NEXT: ld 0, 16(1)
212 ; PWR8-NEXT: ld 30, -16(1) # 8-byte Folded Reload
213 ; PWR8-NEXT: ld 29, -24(1) # 8-byte Folded Reload
214 ; PWR8-NEXT: ld 28, -32(1) # 8-byte Folded Reload
221 %i.06 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
222 %arrayidx = getelementptr inbounds [4 x fp128], ptr @x, i64 0, i64 %i.06
223 %0 = load fp128, ptr %arrayidx, align 16
224 %trunc = fptrunc fp128 %0 to double
225 %arrayidx1 = getelementptr inbounds double, ptr %a, i64 %i.06
226 store double %trunc, ptr %arrayidx1, align 16
227 %inc = add nuw nsw i64 %i.06, 1
228 %exitcond = icmp eq i64 %inc, 4
229 br i1 %exitcond, label %for.end, label %for.body
235 declare void @obfuscate(ptr, ...) local_unnamed_addr #2