1 ; 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
5 declare double @llvm.trunc.f64(double) nounwind readnone
6 declare <2 x double> @llvm.trunc.v2f64(<2 x double>) nounwind readnone
7 declare <3 x double> @llvm.trunc.v3f64(<3 x double>) nounwind readnone
8 declare <4 x double> @llvm.trunc.v4f64(<4 x double>) nounwind readnone
9 declare <8 x double> @llvm.trunc.v8f64(<8 x double>) nounwind readnone
10 declare <16 x double> @llvm.trunc.v16f64(<16 x double>) nounwind readnone
12 ; FUNC-LABEL: {{^}}v_ftrunc_f64:
14 ; SI: v_bfe_u32 {{v[0-9]+}}, {{v[0-9]+}}, 20, 11
16 define amdgpu_kernel void @v_ftrunc_f64(double addrspace(1)* %out, double addrspace(1)* %in) {
17 %x = load double, double addrspace(1)* %in, align 8
18 %y = call double @llvm.trunc.f64(double %x) nounwind readnone
19 store double %y, double addrspace(1)* %out, align 8
23 ; FUNC-LABEL: {{^}}ftrunc_f64:
26 ; SI: s_bfe_u32 [[SEXP:s[0-9]+]], {{s[0-9]+}}, 0xb0014
27 ; SI-DAG: s_and_b32 s{{[0-9]+}}, s{{[0-9]+}}, 0x80000000
28 ; 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]]
38 define amdgpu_kernel 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
44 ; FUNC-LABEL: {{^}}ftrunc_v2f64:
47 define amdgpu_kernel 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
53 ; FIXME-FUNC-LABEL: {{^}}ftrunc_v3f64:
54 ; FIXME-CI: v_trunc_f64_e32
55 ; FIXME-CI: v_trunc_f64_e32
56 ; FIXME-CI: v_trunc_f64_e32
57 ; define amdgpu_kernel 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
63 ; FUNC-LABEL: {{^}}ftrunc_v4f64:
68 define amdgpu_kernel 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
74 ; FUNC-LABEL: {{^}}ftrunc_v8f64:
83 define amdgpu_kernel 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
89 ; FUNC-LABEL: {{^}}ftrunc_v16f64:
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
106 define amdgpu_kernel 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