R600: Fix a crash in the AMDILCFGStructurizer
[oota-llvm.git] / test / CodeGen / SPARC / float.ll
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
5
6 ; V8-LABEL:     test_neg:
7 ; V8:     call get_double
8 ; V8:     fnegs %f0, %f0
9
10 ; V8-UNOPT-LABEL:     test_neg:
11 ; V8-UNOPT:     fnegs
12 ; V8-UNOPT:     ! implicit-def
13 ; V8-UNOPT:     fmovs {{.+}}, %f0
14 ; V8-UNOPT:     fmovs {{.+}}, %f1
15
16 ; V9-LABEL:     test_neg:
17 ; V9:     fnegd %f0, %f0
18
19 define double @test_neg() {
20 entry:
21   %0 = tail call double @get_double()
22   %1 = fsub double -0.000000e+00, %0
23   ret double %1
24 }
25
26 ; V8-LABEL:     test_abs:
27 ; V8:     fabss %f0, %f0
28
29 ; V8-UNOPT-LABEL:     test_abs:
30 ; V8-UNOPT:     fabss
31 ; V8-UNOPT:     ! implicit-def
32 ; V8-UNOPT:     fmovs {{.+}}, %f0
33 ; V8-UNOPT:     fmovs {{.+}}, %f1
34
35 ; V9-LABEL:     test_abs:
36 ; V9:     fabsd %f0, %f0
37
38 define double @test_abs() {
39 entry:
40   %0 = tail call double @get_double()
41   %1 = tail call double @llvm.fabs.f64(double %0)
42   ret double %1
43 }
44
45 declare double @get_double()
46 declare double @llvm.fabs.f64(double) nounwind readonly
47
48 ; V8-LABEL:    test_v9_floatreg:
49 ; V8:          fsubd {{.+}}, {{.+}}, {{.+}}
50 ; V8:          faddd {{.+}}, {{.+}}, [[R:%f(((1|2)?(0|2|4|6|8))|30)]]
51 ; V8:          std [[R]], [%{{.+}}]
52 ; V8:          ldd [%{{.+}}], %f0
53
54 ; V9-LABEL:    test_v9_floatreg:
55 ; V9:          fsubd {{.+}}, {{.+}}, {{.+}}
56 ; V9:          faddd {{.+}}, {{.+}}, [[R:%f((3(2|4|6|8))|((4|5)(0|2|4|6|8))|(60|62))]]
57 ; V9:          fmovd [[R]], %f0
58
59
60 define double @test_v9_floatreg() {
61 entry:
62   %0 = tail call double @get_double()
63   %1 = tail call double @get_double()
64   %2 = fsub double %0, %1
65   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}"()
66   %3 = fadd double %2, %2
67   ret double %3
68 }
69
70