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_compare:
61 define i32 @f128_compare(fp128* byval %f0, fp128* byval %f1, i32 %a, i32 %b) {
63 %0 = load fp128, fp128* %f0, align 8
64 %1 = load fp128, fp128* %f1, align 8
65 %cond = fcmp ult fp128 %0, %1
66 %ret = select i1 %cond, i32 %a, i32 %b
70 ; CHECK-LABEL: f128_compare2:
76 define i32 @f128_compare2() {
78 %0 = fcmp ogt fp128 undef, 0xL00000000000000000000000000000000
79 br i1 %0, label %"5", label %"7"
89 ; CHECK-LABEL: f128_abs:
90 ; CHECK: ldd [%o0], %f0
91 ; CHECK: ldd [%o0+8], %f2
95 define void @f128_abs(fp128* noalias sret %scalar.result, fp128* byval %a) {
97 %0 = load fp128, fp128* %a, align 8
98 %1 = tail call fp128 @llvm.fabs.f128(fp128 %0)
99 store fp128 %1, fp128* %scalar.result, align 8
103 declare fp128 @llvm.fabs.f128(fp128) nounwind readonly
105 ; CHECK-LABEL: int_to_f128:
110 define void @int_to_f128(fp128* noalias sret %scalar.result, i32 %i) {
112 %0 = sitofp i32 %i to fp128
113 store fp128 %0, fp128* %scalar.result, align 8
117 ; CHECK-LABEL: fp128_unaligned:
125 define void @fp128_unaligned(fp128* %a, fp128* %b, fp128* %c) {
127 %0 = load fp128, fp128* %a, align 1
128 %1 = load fp128, fp128* %b, align 1
129 %2 = fadd fp128 %0, %1
130 store fp128 %2, fp128* %c, align 1
134 ; CHECK-LABEL: uint_to_f128:
139 define void @uint_to_f128(fp128* noalias sret %scalar.result, i32 %i) {
141 %0 = uitofp i32 %i to fp128
142 store fp128 %0, fp128* %scalar.result, align 8
146 ; CHECK-LABEL: f128_to_i32:
153 define i32 @f128_to_i32(fp128* %a, fp128* %b) {
155 %0 = load fp128, fp128* %a, align 8
156 %1 = load fp128, fp128* %b, align 8
157 %2 = fptoui fp128 %0 to i32
158 %3 = fptosi fp128 %1 to i32
163 ; CHECK-LABEL: test_itoq_qtoi
164 ; HARD-DAG: call _Q_lltoq
165 ; HARD-DAG: call _Q_qtoll
168 ; SOFT-DAG: call _Q_lltoq
170 ; SOFT-DAG: call _Q_qtoll
171 ; SOFT-DAG: call _Q_itoq
173 ; SOFT-DAG: call _Q_qtoi
175 define void @test_itoq_qtoi(i64 %a, i32 %b, fp128* %c, fp128* %d, i64* %ptr0, fp128* %ptr1) {
177 %0 = sitofp i64 %a to fp128
178 store fp128 %0, fp128* %ptr1, align 8
179 %cval = load fp128, fp128* %c, align 8
180 %1 = fptosi fp128 %cval to i64
181 store i64 %1, i64* %ptr0, align 8
182 %2 = sitofp i32 %b to fp128
183 store fp128 %2, fp128* %ptr1, align 8
184 %dval = load fp128, fp128* %d, align 8
185 %3 = fptosi fp128 %dval to i32
186 %4 = bitcast i64* %ptr0 to i32*
187 store i32 %3, i32* %4, align 8
191 ; CHECK-LABEL: test_utoq_qtou:
192 ; CHECK-DAG: call _Q_ulltoq
193 ; CHECK-DAG: call _Q_qtoull
196 ; SOFT-DAG: call _Q_utoq
198 ; SOFT-DAG: call _Q_qtou
200 define void @test_utoq_qtou(i64 %a, i32 %b, fp128* %c, fp128* %d, i64* %ptr0, fp128* %ptr1) {
202 %0 = uitofp i64 %a to fp128
203 store fp128 %0, fp128* %ptr1, align 8
204 %cval = load fp128, fp128* %c, align 8
205 %1 = fptoui fp128 %cval to i64
206 store i64 %1, i64* %ptr0, align 8
207 %2 = uitofp i32 %b to fp128
208 store fp128 %2, fp128* %ptr1, align 8
209 %dval = load fp128, fp128* %d, align 8
210 %3 = fptoui fp128 %dval to i32
211 %4 = bitcast i64* %ptr0 to i32*
212 store i32 %3, i32* %4, align 8
216 ; CHECK-LABEL: f128_neg:
217 ; CHECK: ldd [%o0], %f0
218 ; CHECK: ldd [%o0+8], %f2
222 define void @f128_neg(fp128* noalias sret %scalar.result, fp128* byval %a) {
224 %0 = load fp128, fp128* %a, align 8
225 %1 = fsub fp128 0xL00000000000000008000000000000000, %0
226 store fp128 %1, fp128* %scalar.result, align 8