mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Fix PR17546
- Type of index used in extract_vector_elt or insert_vector_elt supposes to be TLI.getVectorIdxTy() which is pointer type on most targets. It'd better to truncate (or zero-extend in case it's changed later) it to mask element type to guarantee they are matching instead of asserting that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192722 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dc8c044a9a
commit
bfa7b1e695
@ -7627,12 +7627,7 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
|
||||
MVT MaskVT = MVT::getVectorVT(MaskEltVT, VecVT.getSizeInBits() /
|
||||
MaskEltVT.getSizeInBits());
|
||||
|
||||
if (Idx.getSimpleValueType() != MaskEltVT)
|
||||
if (Idx.getOpcode() == ISD::ZERO_EXTEND ||
|
||||
Idx.getOpcode() == ISD::SIGN_EXTEND)
|
||||
Idx = Idx.getOperand(0);
|
||||
assert(Idx.getSimpleValueType() == MaskEltVT &&
|
||||
"Unexpected index in insertelement");
|
||||
Idx = DAG.getZExtOrTrunc(Idx, dl, MaskEltVT);
|
||||
SDValue Mask = DAG.getNode(X86ISD::VINSERT, dl, MaskVT,
|
||||
getZeroVector(MaskVT, Subtarget, DAG, dl),
|
||||
Idx, DAG.getConstant(0, getPointerTy()));
|
||||
|
10
test/CodeGen/X86/pr17546.ll
Normal file
10
test/CodeGen/X86/pr17546.ll
Normal file
@ -0,0 +1,10 @@
|
||||
; RUN: llc < %s -mtriple=x86_64-linux-gnu -mcpu=core-avx2 | FileCheck %s
|
||||
|
||||
define i32 @f_f___un_3C_unf_3E_un_3C_unf_3E_(<8 x i32> %__mask, i64 %BBBB) {
|
||||
%QQQ = trunc i64 %BBBB to i32
|
||||
%1 = extractelement <8 x i32> %__mask, i32 %QQQ
|
||||
ret i32 %1
|
||||
}
|
||||
|
||||
; CHECK: f_f___un_3C_unf_3E_un_3C_unf_3E_
|
||||
; CHECK: ret
|
Loading…
Reference in New Issue
Block a user