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 {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]]
57 ; V8: std [[R]], [%{{.+}}]
58 ; V8: ldd [%{{.+}}], %f0
59 ; V8: faddd {{.+}}, {{.+}}, {{.+}}
61 ; V9-LABEL: test_v9_floatreg:
62 ; V9: fsubd {{.+}}, {{.+}}, {{.+}}
63 ; V9: faddd {{.+}}, {{.+}}, %f0
65 ; SPARC64-LABEL: test_v9_floatreg:
66 ; SPARC64: fsubd {{.+}}, {{.+}}, {{.+}}
67 ; SPARC64: faddd {{.+}}, {{.+}}, %f0
69 define double @test_v9_floatreg() {
71 %0 = tail call double @get_double()
72 %1 = tail call double @get_double()
73 %2 = fsub double %0, %1
74 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}"()
75 %3 = fadd double %2, %2
79 ; V8-LABEL: test_xtos_stox
80 ; V8: call __floatdisf
83 ; V9-LABEL: test_xtos_stox
84 ; V9: call __floatdisf
87 ; SPARC64-LABEL: test_xtos_stox
91 define void @test_xtos_stox(i64 %a, i64* %ptr0, float* %ptr1) {
93 %0 = sitofp i64 %a to float
94 store float %0, float* %ptr1, align 8
95 %1 = fptosi float %0 to i64
96 store i64 %1, i64* %ptr0, align 8
100 ; V8-LABEL: test_itos_stoi
104 ; V9-LABEL: test_itos_stoi
108 ; SPARC64-LABEL: test_itos_stoi
112 define void @test_itos_stoi(i32 %a, i32* %ptr0, float* %ptr1) {
114 %0 = sitofp i32 %a to float
115 store float %0, float* %ptr1, align 8
116 %1 = fptosi float %0 to i32
117 store i32 %1, i32* %ptr0, align 8
122 ; V8-LABEL: test_xtod_dtox
123 ; V8: call __floatdidf
126 ; V9-LABEL: test_xtod_dtox
127 ; V9: call __floatdidf
130 ; SPARC64-LABEL: test_xtod_dtox
134 define void @test_xtod_dtox(i64 %a, i64* %ptr0, double* %ptr1) {
136 %0 = sitofp i64 %a to double
137 store double %0, double* %ptr1, align 8
138 %1 = fptosi double %0 to i64
139 store i64 %1, i64* %ptr0, align 8
143 ; V8-LABEL: test_itod_dtoi
147 ; V9-LABEL: test_itod_dtoi
151 ; SPARC64-LABEL: test_itod_dtoi
155 define void @test_itod_dtoi(i32 %a, double %b, i32* %ptr0, double* %ptr1) {
157 %0 = sitofp i32 %a to double
158 store double %0, double* %ptr1, align 8
159 %1 = fptosi double %b to i32
160 store i32 %1, i32* %ptr0, align 8
164 ; V8-LABEL: test_uxtos_stoux
165 ; V8: call __floatundisf
166 ; V8: call __fixunssfdi
168 ; V9-LABEL: test_uxtos_stoux
169 ; V9: call __floatundisf
170 ; V9: call __fixunssfdi
172 ; SPARC64-LABEL: test_uxtos_stoux
173 ; SPARC64-NOT: call __floatundisf
174 ; SPARC64-NOT: call __fixunssfdi
176 define void @test_uxtos_stoux(i64 %a, i64* %ptr0, float* %ptr1) {
178 %0 = uitofp i64 %a to float
179 store float %0, float* %ptr1, align 8
180 %1 = fptoui float %0 to i64
181 store i64 %1, i64* %ptr0, align 8
185 ; V8-LABEL: test_utos_stou
189 ; V9-LABEL: test_utos_stou
193 ; SPARC64-LABEL: test_utos_stou
197 define void @test_utos_stou(i32 %a, i32* %ptr0, float* %ptr1) {
199 %0 = uitofp i32 %a to float
200 store float %0, float* %ptr1, align 8
201 %1 = fptoui float %0 to i32
202 store i32 %1, i32* %ptr0, align 8
207 ; V8-LABEL: test_uxtod_dtoux
208 ; V8: call __floatundidf
209 ; V8: call __fixunsdfdi
211 ; V9-LABEL: test_uxtod_dtoux
212 ; V9: call __floatundidf
213 ; V9: call __fixunsdfdi
215 ; SPARC64-LABEL: test_uxtod_dtoux
216 ; SPARC64-NOT: call __floatundidf
217 ; SPARC64-NOT: call __floatunsdfdi
219 define void @test_uxtod_dtoux(i64 %a, i64* %ptr0, double* %ptr1) {
221 %0 = uitofp i64 %a to double
222 store double %0, double* %ptr1, align 8
223 %1 = fptoui double %0 to i64
224 store i64 %1, i64* %ptr0, align 8
228 ; V8-LABEL: test_utod_dtou
232 ; V9-LABEL: test_utod_dtou
236 ; SPARC64-LABEL: test_utod_dtou
240 define void @test_utod_dtou(i32 %a, double %b, i32* %ptr0, double* %ptr1) {
242 %0 = uitofp i32 %a to double
243 store double %0, double* %ptr1, align 8
244 %1 = fptoui double %b to i32
245 store i32 %1, i32* %ptr0, align 8