xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/dagcombiner-bug-illegal-vec4-int-to-fp.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; This test is for a bug in
4*9880d681SAndroid Build Coastguard Worker; DAGCombiner::reduceBuildVecConvertToConvertBuildVec() where
5*9880d681SAndroid Build Coastguard Worker; the wrong type was being passed to
6*9880d681SAndroid Build Coastguard Worker; TargetLowering::getOperationAction() when checking the legality of
7*9880d681SAndroid Build Coastguard Worker; ISD::UINT_TO_FP and ISD::SINT_TO_FP opcodes.
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; CHECK: {{^}}sint:
11*9880d681SAndroid Build Coastguard Worker; CHECK: INT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine void @sint(<4 x float> addrspace(1)* %out, i32 addrspace(1)* %in) {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  %ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
16*9880d681SAndroid Build Coastguard Worker  %sint = load i32, i32 addrspace(1) * %in
17*9880d681SAndroid Build Coastguard Worker  %conv = sitofp i32 %sint to float
18*9880d681SAndroid Build Coastguard Worker  %0 = insertelement <4 x float> undef, float %conv, i32 0
19*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <4 x float> %0, <4 x float> undef, <4 x i32> zeroinitializer
20*9880d681SAndroid Build Coastguard Worker  store <4 x float> %splat, <4 x float> addrspace(1)* %out
21*9880d681SAndroid Build Coastguard Worker  ret void
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker;CHECK: {{^}}uint:
25*9880d681SAndroid Build Coastguard Worker;CHECK: UINT_TO_FLT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdefine void @uint(<4 x float> addrspace(1)* %out, i32 addrspace(1)* %in) {
28*9880d681SAndroid Build Coastguard Workerentry:
29*9880d681SAndroid Build Coastguard Worker  %ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
30*9880d681SAndroid Build Coastguard Worker  %uint = load i32, i32 addrspace(1) * %in
31*9880d681SAndroid Build Coastguard Worker  %conv = uitofp i32 %uint to float
32*9880d681SAndroid Build Coastguard Worker  %0 = insertelement <4 x float> undef, float %conv, i32 0
33*9880d681SAndroid Build Coastguard Worker  %splat = shufflevector <4 x float> %0, <4 x float> undef, <4 x i32> zeroinitializer
34*9880d681SAndroid Build Coastguard Worker  store <4 x float> %splat, <4 x float> addrspace(1)* %out
35*9880d681SAndroid Build Coastguard Worker  ret void
36*9880d681SAndroid Build Coastguard Worker}
37