1 ; RUN: llc -march=sparc < %s | FileCheck %s -check-prefix=V8
2 ; RUN: llc -march=sparc -O0 < %s | FileCheck %s -check-prefix=V8-UNOPT
3 ; RUN: llc -march=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V9
4 ; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck %s -check-prefix=SPARC64
10 ; V8-UNOPT-LABEL: test_neg:
12 ; V8-UNOPT: ! implicit-def
13 ; V8-UNOPT: fmovs {{.+}}, %f0
14 ; V8-UNOPT: fmovs {{.+}}, %f1
19 ; SPARC64-LABEL: test_neg:
20 ; SPARC64: fnegd %f0, %f0
22 define double @test_neg() {
24 %0 = tail call double @get_double()
25 %1 = fsub double -0.000000e+00, %0
32 ; V8-UNOPT-LABEL: test_abs:
34 ; V8-UNOPT: ! implicit-def
35 ; V8-UNOPT: fmovs {{.+}}, %f0
36 ; V8-UNOPT: fmovs {{.+}}, %f1
42 ; SPARC64-LABEL: test_abs:
43 ; SPARC64: fabsd %f0, %f0
45 define double @test_abs() {
47 %0 = tail call double @get_double()
48 %1 = tail call double @llvm.fabs.f64(double %0)
52 declare double @get_double()
53 declare double @llvm.fabs.f64(double) nounwind readonly
55 ; V8-LABEL: test_v9_floatreg:
56 ; V8: fsubd {{.+}}, {{.+}}, {{.+}}
57 ; V8: faddd {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]]
58 ; V8: std [[R]], [%{{.+}}]
59 ; V8: ldd [%{{.+}}], %f0
61 ; V9-LABEL: test_v9_floatreg:
62 ; V9: fsubd {{.+}}, {{.+}}, {{.+}}
63 ; V9: faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
64 ; V9: fmovd [[R]], %f0
66 ; SPARC64-LABEL: test_v9_floatreg:
67 ; SPARC64: fsubd {{.+}}, {{.+}}, {{.+}}
68 ; SPARC64: faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
69 ; SPARC64: fmovd [[R]], %f0
71 define double @test_v9_floatreg() {
73 %0 = tail call double @get_double()
74 %1 = tail call double @get_double()
75 %2 = fsub double %0, %1
76 tail call void asm sideeffect "", "~{f0},~{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}"()
77 %3 = fadd double %2, %2
81 ; V8-LABEL: test_xtos_stox
82 ; V8: call __floatdisf
85 ; V9-LABEL: test_xtos_stox
86 ; V9: call __floatdisf
89 ; SPARC64-LABEL: test_xtos_stox
93 define void @test_xtos_stox(i64 %a, i64* %ptr0, float* %ptr1) {
95 %0 = sitofp i64 %a to float
96 store float %0, float* %ptr1, align 8
97 %1 = fptosi float %0 to i64
98 store i64 %1, i64* %ptr0, align 8
102 ; V8-LABEL: test_itos_stoi
106 ; V9-LABEL: test_itos_stoi
110 ; SPARC64-LABEL: test_itos_stoi
114 define void @test_itos_stoi(i32 %a, i32* %ptr0, float* %ptr1) {
116 %0 = sitofp i32 %a to float
117 store float %0, float* %ptr1, align 8
118 %1 = fptosi float %0 to i32
119 store i32 %1, i32* %ptr0, align 8
124 ; V8-LABEL: test_xtod_dtox
125 ; V8: call __floatdidf
128 ; V9-LABEL: test_xtod_dtox
129 ; V9: call __floatdidf
132 ; SPARC64-LABEL: test_xtod_dtox
136 define void @test_xtod_dtox(i64 %a, i64* %ptr0, double* %ptr1) {
138 %0 = sitofp i64 %a to double
139 store double %0, double* %ptr1, align 8
140 %1 = fptosi double %0 to i64
141 store i64 %1, i64* %ptr0, align 8
145 ; V8-LABEL: test_itod_dtoi
149 ; V9-LABEL: test_itod_dtoi
153 ; SPARC64-LABEL: test_itod_dtoi
157 define void @test_itod_dtoi(i32 %a, i32* %ptr0, double* %ptr1) {
159 %0 = sitofp i32 %a to double
160 store double %0, double* %ptr1, align 8
161 %1 = fptosi double %0 to i32
162 store i32 %1, i32* %ptr0, align 8
166 ; V8-LABEL: test_uxtos_stoux
167 ; V8: call __floatundisf
168 ; V8: call __fixunssfdi
170 ; V9-LABEL: test_uxtos_stoux
171 ; V9: call __floatundisf
172 ; V9: call __fixunssfdi
174 ; SPARC64-LABEL: test_uxtos_stoux
175 ; SPARC64-NOT: call __floatundisf
176 ; SPARC64-NOT: call __fixunssfdi
178 define void @test_uxtos_stoux(i64 %a, i64* %ptr0, float* %ptr1) {
180 %0 = uitofp i64 %a to float
181 store float %0, float* %ptr1, align 8
182 %1 = fptoui float %0 to i64
183 store i64 %1, i64* %ptr0, align 8
187 ; V8-LABEL: test_utos_stou
191 ; V9-LABEL: test_utos_stou
195 ; SPARC64-LABEL: test_utos_stou
199 define void @test_utos_stou(i32 %a, i32* %ptr0, float* %ptr1) {
201 %0 = uitofp i32 %a to float
202 store float %0, float* %ptr1, align 8
203 %1 = fptoui float %0 to i32
204 store i32 %1, i32* %ptr0, align 8
209 ; V8-LABEL: test_uxtod_dtoux
210 ; V8: call __floatundidf
211 ; V8: call __fixunsdfdi
213 ; V9-LABEL: test_uxtod_dtoux
214 ; V9: call __floatundidf
215 ; V9: call __fixunsdfdi
217 ; SPARC64-LABEL: test_uxtod_dtoux
218 ; SPARC64-NOT: call __floatundidf
219 ; SPARC64-NOT: call __floatunsdfdi
221 define void @test_uxtod_dtoux(i64 %a, i64* %ptr0, double* %ptr1) {
223 %0 = uitofp i64 %a to double
224 store double %0, double* %ptr1, align 8
225 %1 = fptoui double %0 to i64
226 store i64 %1, i64* %ptr0, align 8
230 ; V8-LABEL: test_utod_dtou
234 ; V9-LABEL: test_utod_dtou
238 ; SPARC64-LABEL: test_utod_dtou
242 define void @test_utod_dtou(i32 %a, double %b, i32* %ptr0, double* %ptr1) {
244 %0 = uitofp i32 %a to double
245 store double %0, double* %ptr1, align 8
246 %1 = fptoui double %b to i32
247 store i32 %1, i32* %ptr0, align 8