1 ; RUN: llc < %s -march=sparc -mattr=hard-quad-float | FileCheck %s --check-prefix=CHECK --check-prefix=HARD --check-prefix=BE
2 ; RUN: llc < %s -march=sparcel -mattr=hard-quad-float | FileCheck %s --check-prefix=CHECK --check-prefix=HARD --check-prefix=EL
3 ; RUN: llc < %s -march=sparc -mattr=-hard-quad-float | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT --check-prefix=BE
4 ; RUN: llc < %s -march=sparcel -mattr=-hard-quad-float | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT --check-prefix=EL
7 ; CHECK-LABEL: f128_ops:
12 ; HARD: faddq [[R0:.+]], [[R1:.+]], [[R2:.+]]
13 ; HARD: fsubq [[R2]], [[R3:.+]], [[R4:.+]]
14 ; HARD: fmulq [[R4]], [[R5:.+]], [[R6:.+]]
15 ; HARD: fdivq [[R6]], [[R2]]
27 define void @f128_ops(fp128* noalias sret %scalar.result, fp128* byval %a, fp128* byval %b, fp128* byval %c, fp128* byval %d) {
29 %0 = load fp128, fp128* %a, align 8
30 %1 = load fp128, fp128* %b, align 8
31 %2 = load fp128, fp128* %c, align 8
32 %3 = load fp128, fp128* %d, align 8
33 %4 = fadd fp128 %0, %1
34 %5 = fsub fp128 %4, %2
35 %6 = fmul fp128 %5, %3
36 %7 = fdiv fp128 %6, %4
37 store fp128 %7, fp128* %scalar.result, align 8
41 ; CHECK-LABEL: f128_spill:
42 ; CHECK: std %f{{.+}}, [%[[S0:.+]]]
43 ; CHECK: std %f{{.+}}, [%[[S1:.+]]]
44 ; CHECK-DAG: ldd [%[[S0]]], %f{{.+}}
45 ; CHECK-DAG: ldd [%[[S1]]], %f{{.+}}
46 ; CHECK: jmp {{%[oi]7}}+12
48 define void @f128_spill(fp128* noalias sret %scalar.result, fp128* byval %a) {
50 %0 = load fp128, fp128* %a, align 8
51 call void asm sideeffect "", "~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f18},~{f19},~{f20},~{f21},~{f22},~{f23},~{f24},~{f25},~{f26},~{f27},~{f28},~{f29},~{f30},~{f31}"()
52 store fp128 %0, fp128* %scalar.result, align 8
56 ; CHECK-LABEL: f128_spill_large:
59 ; CHECK-NEXT: add %g1, %sp, %g1
60 ; CHECK-NEXT: std %f{{.+}}, [%g1]
62 ; CHECK-NEXT: add %g1, %sp, %g1
63 ; CHECK-NEXT: std %f{{.+}}, [%g1+8]
65 ; CHECK-NEXT: add %g1, %sp, %g1
66 ; CHECK-NEXT: ldd [%g1], %f{{.+}}
68 ; CHECK-NEXT: add %g1, %sp, %g1
69 ; CHECK-NEXT: ldd [%g1+8], %f{{.+}}
71 define void @f128_spill_large(<251 x fp128>* noalias sret %scalar.result, <251 x fp128>* byval %a) {
73 %0 = load <251 x fp128>, <251 x fp128>* %a, align 8
74 call void asm sideeffect "", "~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f8},~{f9},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f18},~{f19},~{f20},~{f21},~{f22},~{f23},~{f24},~{f25},~{f26},~{f27},~{f28},~{f29},~{f30},~{f31}"()
75 store <251 x fp128> %0, <251 x fp128>* %scalar.result, align 8
79 ; CHECK-LABEL: f128_compare:
84 define i32 @f128_compare(fp128* byval %f0, fp128* byval %f1, i32 %a, i32 %b) {
86 %0 = load fp128, fp128* %f0, align 8
87 %1 = load fp128, fp128* %f1, align 8
88 %cond = fcmp ult fp128 %0, %1
89 %ret = select i1 %cond, i32 %a, i32 %b
93 ; CHECK-LABEL: f128_compare2:
99 define i32 @f128_compare2(fp128* byval %f0) {
101 %0 = load fp128, fp128* %f0, align 8
102 %1 = fcmp ogt fp128 %0, 0xL00000000000000000000000000000000
103 br i1 %1, label %"5", label %"7"
105 "5": ; preds = %entry
108 "7": ; preds = %entry
113 ; CHECK-LABEL: f128_abs:
114 ; CHECK: ldd [%o0], %f0
115 ; CHECK: ldd [%o0+8], %f2
119 define void @f128_abs(fp128* noalias sret %scalar.result, fp128* byval %a) {
121 %0 = load fp128, fp128* %a, align 8
122 %1 = tail call fp128 @llvm.fabs.f128(fp128 %0)
123 store fp128 %1, fp128* %scalar.result, align 8
127 declare fp128 @llvm.fabs.f128(fp128) nounwind readonly
129 ; CHECK-LABEL: int_to_f128:
134 define void @int_to_f128(fp128* noalias sret %scalar.result, i32 %i) {
136 %0 = sitofp i32 %i to fp128
137 store fp128 %0, fp128* %scalar.result, align 8
141 ; CHECK-LABEL: fp128_unaligned:
149 define void @fp128_unaligned(fp128* %a, fp128* %b, fp128* %c) {
151 %0 = load fp128, fp128* %a, align 1
152 %1 = load fp128, fp128* %b, align 1
153 %2 = fadd fp128 %0, %1
154 store fp128 %2, fp128* %c, align 1
158 ; CHECK-LABEL: uint_to_f128:
163 define void @uint_to_f128(fp128* noalias sret %scalar.result, i32 %i) {
165 %0 = uitofp i32 %i to fp128
166 store fp128 %0, fp128* %scalar.result, align 8
170 ; CHECK-LABEL: f128_to_i32:
177 define i32 @f128_to_i32(fp128* %a, fp128* %b) {
179 %0 = load fp128, fp128* %a, align 8
180 %1 = load fp128, fp128* %b, align 8
181 %2 = fptoui fp128 %0 to i32
182 %3 = fptosi fp128 %1 to i32
187 ; CHECK-LABEL: test_itoq_qtoi
188 ; HARD-DAG: call _Q_lltoq
189 ; HARD-DAG: call _Q_qtoll
192 ; SOFT-DAG: call _Q_lltoq
194 ; SOFT-DAG: call _Q_qtoll
195 ; SOFT-DAG: call _Q_itoq
197 ; SOFT-DAG: call _Q_qtoi
199 define void @test_itoq_qtoi(i64 %a, i32 %b, fp128* %c, fp128* %d, i64* %ptr0, fp128* %ptr1) {
201 %0 = sitofp i64 %a to fp128
202 store fp128 %0, fp128* %ptr1, align 8
203 %cval = load fp128, fp128* %c, align 8
204 %1 = fptosi fp128 %cval to i64
205 store i64 %1, i64* %ptr0, align 8
206 %2 = sitofp i32 %b to fp128
207 store fp128 %2, fp128* %ptr1, align 8
208 %dval = load fp128, fp128* %d, align 8
209 %3 = fptosi fp128 %dval to i32
210 %4 = bitcast i64* %ptr0 to i32*
211 store i32 %3, i32* %4, align 8
215 ; CHECK-LABEL: test_utoq_qtou:
216 ; CHECK-DAG: call _Q_ulltoq
217 ; CHECK-DAG: call _Q_qtoull
220 ; SOFT-DAG: call _Q_utoq
222 ; SOFT-DAG: call _Q_qtou
224 define void @test_utoq_qtou(i64 %a, i32 %b, fp128* %c, fp128* %d, i64* %ptr0, fp128* %ptr1) {
226 %0 = uitofp i64 %a to fp128
227 store fp128 %0, fp128* %ptr1, align 8
228 %cval = load fp128, fp128* %c, align 8
229 %1 = fptoui fp128 %cval to i64
230 store i64 %1, i64* %ptr0, align 8
231 %2 = uitofp i32 %b to fp128
232 store fp128 %2, fp128* %ptr1, align 8
233 %dval = load fp128, fp128* %d, align 8
234 %3 = fptoui fp128 %dval to i32
235 %4 = bitcast i64* %ptr0 to i32*
236 store i32 %3, i32* %4, align 8
240 ; CHECK-LABEL: f128_neg:
241 ; CHECK: ldd [%o0], %f0
242 ; CHECK: ldd [%o0+8], %f2
246 define void @f128_neg(fp128* noalias sret %scalar.result, fp128* byval %a) {
248 %0 = load fp128, fp128* %a, align 8
249 %1 = fsub fp128 0xL00000000000000008000000000000000, %0
250 store fp128 %1, fp128* %scalar.result, align 8