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
19define double @test_neg() {
20entry:
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
38define double @test_abs() {
39entry:
40  %0 = tail call double @get_double()
41  %1 = tail call double @llvm.fabs.f64(double %0)
42  ret double %1
43}
44
45declare double @get_double()
46declare double @llvm.fabs.f64(double) nounwind readonly
47
48