mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Properly expand extract-element for non-power-of-2 codegen
llvm-svn: 46486
This commit is contained in:
parent
f12104ce4b
commit
3eeac138f9
@ -4405,14 +4405,15 @@ SDOperand SelectionDAGLegalize::ExpandEXTRACT_VECTOR_ELT(SDOperand Op) {
|
||||
// This must be an access of the only element. Return it.
|
||||
Op = ScalarizeVectorOp(Vec);
|
||||
} else if (!TLI.isTypeLegal(TVT) && isa<ConstantSDNode>(Idx)) {
|
||||
unsigned NumLoElts = 1 << Log2_32(NumElems-1);
|
||||
ConstantSDNode *CIdx = cast<ConstantSDNode>(Idx);
|
||||
SDOperand Lo, Hi;
|
||||
SplitVectorOp(Vec, Lo, Hi);
|
||||
if (CIdx->getValue() < NumElems/2) {
|
||||
if (CIdx->getValue() < NumLoElts) {
|
||||
Vec = Lo;
|
||||
} else {
|
||||
Vec = Hi;
|
||||
Idx = DAG.getConstant(CIdx->getValue() - NumElems/2,
|
||||
Idx = DAG.getConstant(CIdx->getValue() - NumLoElts,
|
||||
Idx.getValueType());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user