xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/fptrunc.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}fptrunc_f64_to_f32:
5*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32 {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}
6*9880d681SAndroid Build Coastguard Workerdefine void @fptrunc_f64_to_f32(float addrspace(1)* %out, double %in) {
7*9880d681SAndroid Build Coastguard Worker  %result = fptrunc double %in to float
8*9880d681SAndroid Build Coastguard Worker  store float %result, float addrspace(1)* %out
9*9880d681SAndroid Build Coastguard Worker  ret void
10*9880d681SAndroid Build Coastguard Worker}
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}fptrunc_v2f64_to_v2f32:
13*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
14*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
15*9880d681SAndroid Build Coastguard Workerdefine void @fptrunc_v2f64_to_v2f32(<2 x float> addrspace(1)* %out, <2 x double> %in) {
16*9880d681SAndroid Build Coastguard Worker  %result = fptrunc <2 x double> %in to <2 x float>
17*9880d681SAndroid Build Coastguard Worker  store <2 x float> %result, <2 x float> addrspace(1)* %out
18*9880d681SAndroid Build Coastguard Worker  ret void
19*9880d681SAndroid Build Coastguard Worker}
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}fptrunc_v4f64_to_v4f32:
22*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
23*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
24*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
25*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
26*9880d681SAndroid Build Coastguard Workerdefine void @fptrunc_v4f64_to_v4f32(<4 x float> addrspace(1)* %out, <4 x double> %in) {
27*9880d681SAndroid Build Coastguard Worker  %result = fptrunc <4 x double> %in to <4 x float>
28*9880d681SAndroid Build Coastguard Worker  store <4 x float> %result, <4 x float> addrspace(1)* %out
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}fptrunc_v8f64_to_v8f32:
33*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
34*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
35*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
36*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
37*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
38*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
39*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
40*9880d681SAndroid Build Coastguard Worker; SI: v_cvt_f32_f64_e32
41*9880d681SAndroid Build Coastguard Workerdefine void @fptrunc_v8f64_to_v8f32(<8 x float> addrspace(1)* %out, <8 x double> %in) {
42*9880d681SAndroid Build Coastguard Worker  %result = fptrunc <8 x double> %in to <8 x float>
43*9880d681SAndroid Build Coastguard Worker  store <8 x float> %result, <8 x float> addrspace(1)* %out
44*9880d681SAndroid Build Coastguard Worker  ret void
45*9880d681SAndroid Build Coastguard Worker}
46