mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
AMDGPU: Fix broken dynamic vector indexing for packed types
The intention of this was to multiply by 16, not shift by 16. llvm-svn: 331793
This commit is contained in:
parent
cf0d5feac7
commit
93d97de1e9
@ -4168,7 +4168,7 @@ SDValue SITargetLowering::lowerINSERT_VECTOR_ELT(SDValue Op,
|
||||
|
||||
// Convert vector index to bit-index.
|
||||
SDValue ScaledIdx = DAG.getNode(ISD::SHL, SL, MVT::i32, Idx,
|
||||
DAG.getConstant(16, SL, MVT::i32));
|
||||
DAG.getConstant(4, SL, MVT::i32));
|
||||
|
||||
SDValue BCVec = DAG.getNode(ISD::BITCAST, SL, MVT::i32, Vec);
|
||||
|
||||
@ -4216,10 +4216,10 @@ SDValue SITargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op,
|
||||
return DAG.getNode(ISD::BITCAST, SL, ResultVT, Result);
|
||||
}
|
||||
|
||||
SDValue Sixteen = DAG.getConstant(16, SL, MVT::i32);
|
||||
SDValue Four = DAG.getConstant(4, SL, MVT::i32);
|
||||
|
||||
// Convert vector index to bit-index.
|
||||
SDValue ScaledIdx = DAG.getNode(ISD::SHL, SL, MVT::i32, Idx, Sixteen);
|
||||
// Convert vector index to bit-index (* 16)
|
||||
SDValue ScaledIdx = DAG.getNode(ISD::SHL, SL, MVT::i32, Idx, Four);
|
||||
|
||||
SDValue BC = DAG.getNode(ISD::BITCAST, SL, MVT::i32, Vec);
|
||||
SDValue Elt = DAG.getNode(ISD::SRL, SL, MVT::i32, BC, ScaledIdx);
|
||||
|
@ -232,7 +232,7 @@ for.end:
|
||||
; SI-ALLOCA: buffer_load_sshort v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}}
|
||||
|
||||
; SI-PROMOTE-VECT: s_load_dword [[IDX:s[0-9]+]]
|
||||
; SI-PROMOTE-VECT: s_lshl_b32 [[SCALED_IDX:s[0-9]+]], [[IDX]], 16
|
||||
; SI-PROMOTE-VECT: s_lshl_b32 [[SCALED_IDX:s[0-9]+]], [[IDX]], 4
|
||||
; SI-PROMOTE-VECT: v_bfe_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[SCALED_IDX]], 16
|
||||
define amdgpu_kernel void @short_array(i32 addrspace(1)* %out, i32 %index) #0 {
|
||||
entry:
|
||||
|
@ -21,7 +21,7 @@ define amdgpu_kernel void @extract_vector_elt_v2f16(half addrspace(1)* %out, <2
|
||||
; GCN-LABEL: {{^}}extract_vector_elt_v2f16_dynamic_sgpr:
|
||||
; GCN: s_load_dword [[IDX:s[0-9]+]]
|
||||
; GCN: s_load_dword [[VEC:s[0-9]+]]
|
||||
; GCN: s_lshl_b32 [[IDX_SCALED:s[0-9]+]], [[IDX]], 16
|
||||
; GCN: s_lshl_b32 [[IDX_SCALED:s[0-9]+]], [[IDX]], 4
|
||||
; GCN: s_lshr_b32 [[ELT1:s[0-9]+]], [[VEC]], [[IDX_SCALED]]
|
||||
; GCN: v_mov_b32_e32 [[VELT1:v[0-9]+]], [[ELT1]]
|
||||
; GCN: buffer_store_short [[VELT1]]
|
||||
@ -36,7 +36,7 @@ define amdgpu_kernel void @extract_vector_elt_v2f16_dynamic_sgpr(half addrspace(
|
||||
; GCN-LABEL: {{^}}extract_vector_elt_v2f16_dynamic_vgpr:
|
||||
; GCN-DAG: s_load_dword [[VEC:s[0-9]+]]
|
||||
; GCN-DAG: {{flat|buffer}}_load_dword [[IDX:v[0-9]+]]
|
||||
; GCN: v_lshlrev_b32_e32 [[IDX_SCALED:v[0-9]+]], 16, [[IDX]]
|
||||
; GCN: v_lshlrev_b32_e32 [[IDX_SCALED:v[0-9]+]], 4, [[IDX]]
|
||||
|
||||
; SI: v_lshr_b32_e32 [[ELT:v[0-9]+]], [[VEC]], [[IDX_SCALED]]
|
||||
; VI: v_lshrrev_b32_e64 [[ELT:v[0-9]+]], [[IDX_SCALED]], [[VEC]]
|
||||
|
@ -22,7 +22,7 @@ define amdgpu_kernel void @extract_vector_elt_v2i16(i16 addrspace(1)* %out, <2 x
|
||||
; GCN-LABEL: {{^}}extract_vector_elt_v2i16_dynamic_sgpr:
|
||||
; GCN: s_load_dword [[IDX:s[0-9]+]]
|
||||
; GCN: s_load_dword [[VEC:s[0-9]+]]
|
||||
; GCN: s_lshl_b32 [[IDX_SCALED:s[0-9]+]], [[IDX]], 16
|
||||
; GCN: s_lshl_b32 [[IDX_SCALED:s[0-9]+]], [[IDX]], 4
|
||||
; GCN: s_lshr_b32 [[ELT1:s[0-9]+]], [[VEC]], [[IDX_SCALED]]
|
||||
; GCN: v_mov_b32_e32 [[VELT1:v[0-9]+]], [[ELT1]]
|
||||
; GCN: buffer_store_short [[VELT1]]
|
||||
@ -37,7 +37,7 @@ define amdgpu_kernel void @extract_vector_elt_v2i16_dynamic_sgpr(i16 addrspace(1
|
||||
; GCN-LABEL: {{^}}extract_vector_elt_v2i16_dynamic_vgpr:
|
||||
; GCN-DAG: s_load_dword [[VEC:s[0-9]+]]
|
||||
; GCN-DAG: {{flat|buffer|global}}_load_dword [[IDX:v[0-9]+]]
|
||||
; GCN: v_lshlrev_b32_e32 [[IDX_SCALED:v[0-9]+]], 16, [[IDX]]
|
||||
; GCN: v_lshlrev_b32_e32 [[IDX_SCALED:v[0-9]+]], 4, [[IDX]]
|
||||
|
||||
; SI: v_lshr_b32_e32 [[ELT:v[0-9]+]], [[VEC]], [[IDX_SCALED]]
|
||||
; VI: v_lshrrev_b32_e64 [[ELT:v[0-9]+]], [[IDX_SCALED]], [[VEC]]
|
||||
|
@ -395,7 +395,7 @@ define amdgpu_kernel void @v_insertelement_v2f16_1_inlineimm(<2 x half> addrspac
|
||||
; GCN: s_load_dword [[IDX:s[0-9]+]]
|
||||
; GCN: s_load_dword [[VEC:s[0-9]+]]
|
||||
; GCN-DAG: v_mov_b32_e32 [[VVEC:v[0-9]+]], [[VEC]]
|
||||
; GCN-DAG: s_lshl_b32 [[SCALED_IDX:s[0-9]+]], [[IDX]], 16
|
||||
; GCN-DAG: s_lshl_b32 [[SCALED_IDX:s[0-9]+]], [[IDX]], 4
|
||||
; GCN-DAG: s_lshl_b32 [[MASK:s[0-9]+]], 0xffff, [[SCALED_IDX]]
|
||||
; GCN: v_bfi_b32 [[RESULT:v[0-9]+]], [[MASK]], [[K]], [[VVEC]]
|
||||
; GCN: {{flat|global}}_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RESULT]]
|
||||
@ -411,7 +411,7 @@ define amdgpu_kernel void @s_insertelement_v2i16_dynamic(<2 x i16> addrspace(1)*
|
||||
; GCN-DAG: {{flat|global}}_load_dword [[VEC:v[0-9]+]]
|
||||
; GCN-DAG: s_load_dword [[IDX:s[0-9]+]]
|
||||
; GCN-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 0x3e7
|
||||
; GCN-DAG: s_lshl_b32 [[SCALED_IDX:s[0-9]+]], [[IDX]], 16
|
||||
; GCN-DAG: s_lshl_b32 [[SCALED_IDX:s[0-9]+]], [[IDX]], 4
|
||||
; GCN-DAG: s_lshl_b32 [[MASK:s[0-9]+]], 0xffff, [[SCALED_IDX]]
|
||||
; GCN: v_bfi_b32 [[RESULT:v[0-9]+]], [[MASK]], [[K]], [[VEC]]
|
||||
; GCN: {{flat|global}}_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RESULT]]
|
||||
@ -434,10 +434,10 @@ define amdgpu_kernel void @v_insertelement_v2i16_dynamic_sgpr(<2 x i16> addrspac
|
||||
; GCN: {{flat|global}}_load_dword [[VEC:v[0-9]+]]
|
||||
|
||||
; GFX89-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 0x3e7
|
||||
; GFX89-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 16, [[IDX]]
|
||||
; GFX89-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 4, [[IDX]]
|
||||
; GFX89-DAG: v_lshlrev_b32_e64 [[MASK:v[0-9]+]], [[SCALED_IDX]], [[MASKK]]
|
||||
|
||||
; CI-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 16, [[IDX]]
|
||||
; CI-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 4, [[IDX]]
|
||||
; CI-DAG: v_lshl_b32_e32 [[MASK:v[0-9]+]], 0xffff, [[SCALED_IDX]]
|
||||
|
||||
; GCN: v_bfi_b32 [[RESULT:v[0-9]+]], [[MASK]], [[K]], [[VEC]]
|
||||
@ -463,10 +463,10 @@ define amdgpu_kernel void @v_insertelement_v2i16_dynamic_vgpr(<2 x i16> addrspac
|
||||
; GCN: {{flat|global}}_load_dword [[VEC:v[0-9]+]]
|
||||
|
||||
; GFX89-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 0x1234
|
||||
; GFX89-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 16, [[IDX]]
|
||||
; GFX89-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 4, [[IDX]]
|
||||
; GFX89-DAG: v_lshlrev_b32_e64 [[MASK:v[0-9]+]], [[SCALED_IDX]], [[MASKK]]
|
||||
|
||||
; CI-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 16, [[IDX]]
|
||||
; CI-DAG: v_lshlrev_b32_e32 [[SCALED_IDX:v[0-9]+]], 4, [[IDX]]
|
||||
; CI-DAG: v_lshl_b32_e32 [[MASK:v[0-9]+]], 0xffff, [[SCALED_IDX]]
|
||||
|
||||
; GCN: v_bfi_b32 [[RESULT:v[0-9]+]], [[MASK]], [[K]], [[VEC]]
|
||||
|
Loading…
Reference in New Issue
Block a user