blob: ca9c40dfd65bf297d89fb22de60b1c2d654b4a2d [file] [log] [blame]
Venkatraman Govindaraju17999212013-06-08 15:32:59 +00001; 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
Stephen Linb4dc0232013-07-13 20:38:47 +00006; V8-LABEL: test_neg:
Venkatraman Govindaraju17999212013-06-08 15:32:59 +00007; V8: call get_double
8; V8: fnegs %f0, %f0
9
Stephen Lin8b2b8a12013-07-14 06:24:09 +000010; V8-UNOPT-LABEL: test_neg:
Venkatraman Govindaraju17999212013-06-08 15:32:59 +000011; V8-UNOPT: fnegs
12; V8-UNOPT: ! implicit-def
13; V8-UNOPT: fmovs {{.+}}, %f0
14; V8-UNOPT: fmovs {{.+}}, %f1
15
Stephen Linb4dc0232013-07-13 20:38:47 +000016; V9-LABEL: test_neg:
Venkatraman Govindaraju17999212013-06-08 15:32:59 +000017; 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
Stephen Linb4dc0232013-07-13 20:38:47 +000026; V8-LABEL: test_abs:
Venkatraman Govindaraju17999212013-06-08 15:32:59 +000027; V8: fabss %f0, %f0
28
Stephen Lin8b2b8a12013-07-14 06:24:09 +000029; V8-UNOPT-LABEL: test_abs:
Venkatraman Govindaraju17999212013-06-08 15:32:59 +000030; V8-UNOPT: fabss
31; V8-UNOPT: ! implicit-def
32; V8-UNOPT: fmovs {{.+}}, %f0
33; V8-UNOPT: fmovs {{.+}}, %f1
34
Stephen Linb4dc0232013-07-13 20:38:47 +000035; V9-LABEL: test_abs:
Venkatraman Govindaraju17999212013-06-08 15:32:59 +000036; 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
Venkatraman Govindaraju5ec8afa2013-08-25 17:03:02 +000048; 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
60define double @test_v9_floatreg() {
61entry:
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