blob: 226125335c38dfc3fd4c5432f16a5e402c459e89 [file] [log] [blame]
Matt Arsenault36b4b0b2017-08-07 18:30:35 +00001; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tahiti < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=bonaire < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
3; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
Matt Arsenault6cda8872014-10-03 23:54:27 +00004
5declare double @llvm.trunc.f64(double) nounwind readnone
6declare <2 x double> @llvm.trunc.v2f64(<2 x double>) nounwind readnone
7declare <3 x double> @llvm.trunc.v3f64(<3 x double>) nounwind readnone
8declare <4 x double> @llvm.trunc.v4f64(<4 x double>) nounwind readnone
9declare <8 x double> @llvm.trunc.v8f64(<8 x double>) nounwind readnone
10declare <16 x double> @llvm.trunc.v16f64(<16 x double>) nounwind readnone
11
12; FUNC-LABEL: {{^}}v_ftrunc_f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +000013; CI: v_trunc_f64
14; SI: v_bfe_u32 {{v[0-9]+}}, {{v[0-9]+}}, 20, 11
15; SI: s_endpgm
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000016define amdgpu_kernel void @v_ftrunc_f64(double addrspace(1)* %out, double addrspace(1)* %in) {
David Blaikiea79ac142015-02-27 21:17:42 +000017 %x = load double, double addrspace(1)* %in, align 8
Matt Arsenault6cda8872014-10-03 23:54:27 +000018 %y = call double @llvm.trunc.f64(double %x) nounwind readnone
19 store double %y, double addrspace(1)* %out, align 8
20 ret void
21}
22
23; FUNC-LABEL: {{^}}ftrunc_f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +000024; CI: v_trunc_f64_e32
Matt Arsenault6cda8872014-10-03 23:54:27 +000025
Tom Stellard326d6ec2014-11-05 14:50:53 +000026; SI: s_bfe_u32 [[SEXP:s[0-9]+]], {{s[0-9]+}}, 0xb0014
Tom Stellard1d5e6d42016-03-30 16:35:13 +000027; SI-DAG: s_and_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
Matthias Braun1e374a72016-06-24 23:52:11 +000028; SI-DAG: s_add_i32 [[SEXP1:s[0-9]+]], [[SEXP]], 0xfffffc01
29; SI-DAG: s_lshr_b64 s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}], [[SEXP1]]
Graham Sellers04f7a4d2018-11-29 16:05:38 +000030; SI-DAG: s_andn2_b64
Matt Arsenault61dc2352015-10-12 23:59:50 +000031; SI-DAG: cmp_gt_i32
32; SI-DAG: cndmask_b32
33; SI-DAG: cndmask_b32
34; SI-DAG: cmp_lt_i32
35; SI-DAG: cndmask_b32
36; SI-DAG: cndmask_b32
Tom Stellard326d6ec2014-11-05 14:50:53 +000037; SI: s_endpgm
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000038define amdgpu_kernel void @ftrunc_f64(double addrspace(1)* %out, double %x) {
Matt Arsenault6cda8872014-10-03 23:54:27 +000039 %y = call double @llvm.trunc.f64(double %x) nounwind readnone
40 store double %y, double addrspace(1)* %out
41 ret void
42}
43
44; FUNC-LABEL: {{^}}ftrunc_v2f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +000045; CI: v_trunc_f64_e32
46; CI: v_trunc_f64_e32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000047define amdgpu_kernel void @ftrunc_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %x) {
Matt Arsenault6cda8872014-10-03 23:54:27 +000048 %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
53; FIXME-FUNC-LABEL: {{^}}ftrunc_v3f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +000054; FIXME-CI: v_trunc_f64_e32
55; FIXME-CI: v_trunc_f64_e32
56; FIXME-CI: v_trunc_f64_e32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000057; define amdgpu_kernel void @ftrunc_v3f64(<3 x double> addrspace(1)* %out, <3 x double> %x) {
Matt Arsenault6cda8872014-10-03 23:54:27 +000058; %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
63; FUNC-LABEL: {{^}}ftrunc_v4f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +000064; CI: v_trunc_f64_e32
65; CI: v_trunc_f64_e32
66; CI: v_trunc_f64_e32
67; CI: v_trunc_f64_e32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000068define amdgpu_kernel void @ftrunc_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %x) {
Matt Arsenault6cda8872014-10-03 23:54:27 +000069 %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
74; FUNC-LABEL: {{^}}ftrunc_v8f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +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
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000083define amdgpu_kernel void @ftrunc_v8f64(<8 x double> addrspace(1)* %out, <8 x double> %x) {
Matt Arsenault6cda8872014-10-03 23:54:27 +000084 %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
89; FUNC-LABEL: {{^}}ftrunc_v16f64:
Tom Stellard326d6ec2014-11-05 14:50:53 +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
Matt Arsenault3dbeefa2017-03-21 21:39:51 +0000106define amdgpu_kernel void @ftrunc_v16f64(<16 x double> addrspace(1)* %out, <16 x double> %x) {
Matt Arsenault6cda8872014-10-03 23:54:27 +0000107 %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}