R600/SI: Fix ftrunc f64 conformance failures.
[oota-llvm.git] / test / CodeGen / R600 / ffloor.ll
1 ; RUN: llc -march=r600 -mcpu=bonaire < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3
4 declare double @llvm.floor.f64(double) nounwind readnone
5 declare <2 x double> @llvm.floor.v2f64(<2 x double>) nounwind readnone
6 declare <3 x double> @llvm.floor.v3f64(<3 x double>) nounwind readnone
7 declare <4 x double> @llvm.floor.v4f64(<4 x double>) nounwind readnone
8 declare <8 x double> @llvm.floor.v8f64(<8 x double>) nounwind readnone
9 declare <16 x double> @llvm.floor.v16f64(<16 x double>) nounwind readnone
10
11 ; FUNC-LABEL: {{^}}ffloor_f64:
12 ; CI: V_FLOOR_F64_e32
13
14 ; SI: S_BFE_U32 [[SEXP:s[0-9]+]], {{s[0-9]+}}, 0xb0014
15 ; SI: S_ADD_I32 s{{[0-9]+}}, [[SEXP]], 0xfffffc01
16 ; SI: S_LSHR_B64
17 ; SI: S_NOT_B64
18 ; SI: S_AND_B64
19 ; SI-DAG: S_AND_B32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
20 ; SI-DAG: CMP_LT_I32
21 ; SI: CNDMASK_B32
22 ; SI: CNDMASK_B32
23 ; SI: CMP_GT_I32
24 ; SI: CNDMASK_B32
25 ; SI: CNDMASK_B32
26 ; SI: CMP_LT_F64
27 ; SI: CNDMASK_B32
28 ; SI: CMP_NE_I32
29 ; SI: CNDMASK_B32
30 ; SI: CNDMASK_B32
31 ; SI: V_ADD_F64
32 define void @ffloor_f64(double addrspace(1)* %out, double %x) {
33   %y = call double @llvm.floor.f64(double %x) nounwind readnone
34   store double %y, double addrspace(1)* %out
35   ret void
36 }
37
38 ; FUNC-LABEL: {{^}}ffloor_v2f64:
39 ; CI: V_FLOOR_F64_e32
40 ; CI: V_FLOOR_F64_e32
41 define void @ffloor_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %x) {
42   %y = call <2 x double> @llvm.floor.v2f64(<2 x double> %x) nounwind readnone
43   store <2 x double> %y, <2 x double> addrspace(1)* %out
44   ret void
45 }
46
47 ; FIXME-FUNC-LABEL: {{^}}ffloor_v3f64:
48 ; FIXME-CI: V_FLOOR_F64_e32
49 ; FIXME-CI: V_FLOOR_F64_e32
50 ; FIXME-CI: V_FLOOR_F64_e32
51 ; define void @ffloor_v3f64(<3 x double> addrspace(1)* %out, <3 x double> %x) {
52 ;   %y = call <3 x double> @llvm.floor.v3f64(<3 x double> %x) nounwind readnone
53 ;   store <3 x double> %y, <3 x double> addrspace(1)* %out
54 ;   ret void
55 ; }
56
57 ; FUNC-LABEL: {{^}}ffloor_v4f64:
58 ; CI: V_FLOOR_F64_e32
59 ; CI: V_FLOOR_F64_e32
60 ; CI: V_FLOOR_F64_e32
61 ; CI: V_FLOOR_F64_e32
62 define void @ffloor_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %x) {
63   %y = call <4 x double> @llvm.floor.v4f64(<4 x double> %x) nounwind readnone
64   store <4 x double> %y, <4 x double> addrspace(1)* %out
65   ret void
66 }
67
68 ; FUNC-LABEL: {{^}}ffloor_v8f64:
69 ; CI: V_FLOOR_F64_e32
70 ; CI: V_FLOOR_F64_e32
71 ; CI: V_FLOOR_F64_e32
72 ; CI: V_FLOOR_F64_e32
73 ; CI: V_FLOOR_F64_e32
74 ; CI: V_FLOOR_F64_e32
75 ; CI: V_FLOOR_F64_e32
76 ; CI: V_FLOOR_F64_e32
77 define void @ffloor_v8f64(<8 x double> addrspace(1)* %out, <8 x double> %x) {
78   %y = call <8 x double> @llvm.floor.v8f64(<8 x double> %x) nounwind readnone
79   store <8 x double> %y, <8 x double> addrspace(1)* %out
80   ret void
81 }
82
83 ; FUNC-LABEL: {{^}}ffloor_v16f64:
84 ; CI: V_FLOOR_F64_e32
85 ; CI: V_FLOOR_F64_e32
86 ; CI: V_FLOOR_F64_e32
87 ; CI: V_FLOOR_F64_e32
88 ; CI: V_FLOOR_F64_e32
89 ; CI: V_FLOOR_F64_e32
90 ; CI: V_FLOOR_F64_e32
91 ; CI: V_FLOOR_F64_e32
92 ; CI: V_FLOOR_F64_e32
93 ; CI: V_FLOOR_F64_e32
94 ; CI: V_FLOOR_F64_e32
95 ; CI: V_FLOOR_F64_e32
96 ; CI: V_FLOOR_F64_e32
97 ; CI: V_FLOOR_F64_e32
98 ; CI: V_FLOOR_F64_e32
99 ; CI: V_FLOOR_F64_e32
100 define void @ffloor_v16f64(<16 x double> addrspace(1)* %out, <16 x double> %x) {
101   %y = call <16 x double> @llvm.floor.v16f64(<16 x double> %x) nounwind readnone
102   store <16 x double> %y, <16 x double> addrspace(1)* %out
103   ret void
104 }