blob: 3cd1deb921fc0bbe70d69b88f1d2eff0edc77f7c [file] [log] [blame]
Matt Arsenault46010932014-06-18 17:05:30 +00001; 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
Matt Arsenault41e2f2b2014-02-24 21:01:28 +00003
4declare double @llvm.trunc.f64(double) nounwind readnone
5declare <2 x double> @llvm.trunc.v2f64(<2 x double>) nounwind readnone
6declare <3 x double> @llvm.trunc.v3f64(<3 x double>) nounwind readnone
7declare <4 x double> @llvm.trunc.v4f64(<4 x double>) nounwind readnone
8declare <8 x double> @llvm.trunc.v8f64(<8 x double>) nounwind readnone
9declare <16 x double> @llvm.trunc.v16f64(<16 x double>) nounwind readnone
10
Matt Arsenault46010932014-06-18 17:05:30 +000011; FUNC-LABEL: @v_ftrunc_f64:
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000012; CI: V_TRUNC_F64_e32
Matt Arsenault46010932014-06-18 17:05:30 +000013; SI: V_BFE_I32 {{v[0-9]+}}, {{v[0-9]+}}, 20, 11
14; SI: S_ENDPGM
15define void @v_ftrunc_f64(double addrspace(1)* %out, double addrspace(1)* %in) {
16 %x = load double addrspace(1)* %in, align 8
17 %y = call double @llvm.trunc.f64(double %x) nounwind readnone
18 store double %y, double addrspace(1)* %out, align 8
19 ret void
20}
21
22; FUNC-LABEL: @ftrunc_f64:
23; CI: V_TRUNC_F64_e32
24
25; SI: S_BFE_I32 [[SEXP:s[0-9]+]], {{s[0-9]+}}, 0xb0014
26; SI: S_ADD_I32 s{{[0-9]+}}, [[SEXP]], 0xfffffc01
27; SI: S_LSHR_B64
28; SI: S_NOT_B64
29; SI: S_AND_B64
30; SI: S_AND_B32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
31; SI: CMP_LT_I32
32; SI: CNDMASK_B32
33; SI: CNDMASK_B32
34; SI: CMP_GT_I32
35; SI: CNDMASK_B32
36; SI: CNDMASK_B32
37; SI: S_ENDPGM
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000038define void @ftrunc_f64(double addrspace(1)* %out, double %x) {
39 %y = call double @llvm.trunc.f64(double %x) nounwind readnone
40 store double %y, double addrspace(1)* %out
41 ret void
42}
43
Matt Arsenault46010932014-06-18 17:05:30 +000044; FUNC-LABEL: @ftrunc_v2f64:
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000045; CI: V_TRUNC_F64_e32
46; CI: V_TRUNC_F64_e32
47define void @ftrunc_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %x) {
48 %y = call <2 x double> @llvm.trunc.v2f64(<2 x double> %x) nounwind readnone
49 store <2 x double> %y, <2 x double> addrspace(1)* %out
50 ret void
51}
52
Matt Arsenault46010932014-06-18 17:05:30 +000053; FIXME-FUNC-LABEL: @ftrunc_v3f64:
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000054; FIXME-CI: V_TRUNC_F64_e32
55; FIXME-CI: V_TRUNC_F64_e32
56; FIXME-CI: V_TRUNC_F64_e32
57; define void @ftrunc_v3f64(<3 x double> addrspace(1)* %out, <3 x double> %x) {
58; %y = call <3 x double> @llvm.trunc.v3f64(<3 x double> %x) nounwind readnone
59; store <3 x double> %y, <3 x double> addrspace(1)* %out
60; ret void
61; }
62
Matt Arsenault46010932014-06-18 17:05:30 +000063; FUNC-LABEL: @ftrunc_v4f64:
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000064; CI: V_TRUNC_F64_e32
65; CI: V_TRUNC_F64_e32
66; CI: V_TRUNC_F64_e32
67; CI: V_TRUNC_F64_e32
68define void @ftrunc_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %x) {
69 %y = call <4 x double> @llvm.trunc.v4f64(<4 x double> %x) nounwind readnone
70 store <4 x double> %y, <4 x double> addrspace(1)* %out
71 ret void
72}
73
Matt Arsenault46010932014-06-18 17:05:30 +000074; FUNC-LABEL: @ftrunc_v8f64:
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000075; CI: V_TRUNC_F64_e32
76; CI: V_TRUNC_F64_e32
77; CI: V_TRUNC_F64_e32
78; CI: V_TRUNC_F64_e32
79; CI: V_TRUNC_F64_e32
80; CI: V_TRUNC_F64_e32
81; CI: V_TRUNC_F64_e32
82; CI: V_TRUNC_F64_e32
83define void @ftrunc_v8f64(<8 x double> addrspace(1)* %out, <8 x double> %x) {
84 %y = call <8 x double> @llvm.trunc.v8f64(<8 x double> %x) nounwind readnone
85 store <8 x double> %y, <8 x double> addrspace(1)* %out
86 ret void
87}
88
Matt Arsenault46010932014-06-18 17:05:30 +000089; FUNC-LABEL: @ftrunc_v16f64:
Matt Arsenault41e2f2b2014-02-24 21:01:28 +000090; CI: V_TRUNC_F64_e32
91; CI: V_TRUNC_F64_e32
92; CI: V_TRUNC_F64_e32
93; CI: V_TRUNC_F64_e32
94; CI: V_TRUNC_F64_e32
95; CI: V_TRUNC_F64_e32
96; CI: V_TRUNC_F64_e32
97; CI: V_TRUNC_F64_e32
98; CI: V_TRUNC_F64_e32
99; CI: V_TRUNC_F64_e32
100; CI: V_TRUNC_F64_e32
101; CI: V_TRUNC_F64_e32
102; CI: V_TRUNC_F64_e32
103; CI: V_TRUNC_F64_e32
104; CI: V_TRUNC_F64_e32
105; CI: V_TRUNC_F64_e32
106define void @ftrunc_v16f64(<16 x double> addrspace(1)* %out, <16 x double> %x) {
107 %y = call <16 x double> @llvm.trunc.v16f64(<16 x double> %x) nounwind readnone
108 store <16 x double> %y, <16 x double> addrspace(1)* %out
109 ret void
110}