mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Tidy up code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135656 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c205a094bd
commit
67727cac2f
@ -85,14 +85,10 @@ static SDValue Extract128BitVector(SDValue Vec,
|
|||||||
DebugLoc dl) {
|
DebugLoc dl) {
|
||||||
EVT VT = Vec.getValueType();
|
EVT VT = Vec.getValueType();
|
||||||
assert(VT.getSizeInBits() == 256 && "Unexpected vector size!");
|
assert(VT.getSizeInBits() == 256 && "Unexpected vector size!");
|
||||||
|
|
||||||
EVT ElVT = VT.getVectorElementType();
|
EVT ElVT = VT.getVectorElementType();
|
||||||
|
int Factor = VT.getSizeInBits()/128;
|
||||||
int Factor = VT.getSizeInBits() / 128;
|
EVT ResultVT = EVT::getVectorVT(*DAG.getContext(), ElVT,
|
||||||
|
VT.getVectorNumElements()/Factor);
|
||||||
EVT ResultVT = EVT::getVectorVT(*DAG.getContext(),
|
|
||||||
ElVT,
|
|
||||||
VT.getVectorNumElements() / Factor);
|
|
||||||
|
|
||||||
// Extract from UNDEF is UNDEF.
|
// Extract from UNDEF is UNDEF.
|
||||||
if (Vec.getOpcode() == ISD::UNDEF)
|
if (Vec.getOpcode() == ISD::UNDEF)
|
||||||
@ -111,7 +107,6 @@ static SDValue Extract128BitVector(SDValue Vec,
|
|||||||
* ElemsPerChunk);
|
* ElemsPerChunk);
|
||||||
|
|
||||||
SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32);
|
SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32);
|
||||||
|
|
||||||
SDValue Result = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResultVT, Vec,
|
SDValue Result = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResultVT, Vec,
|
||||||
VecIdx);
|
VecIdx);
|
||||||
|
|
||||||
@ -136,21 +131,18 @@ static SDValue Insert128BitVector(SDValue Result,
|
|||||||
assert(VT.getSizeInBits() == 128 && "Unexpected vector size!");
|
assert(VT.getSizeInBits() == 128 && "Unexpected vector size!");
|
||||||
|
|
||||||
EVT ElVT = VT.getVectorElementType();
|
EVT ElVT = VT.getVectorElementType();
|
||||||
|
|
||||||
unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
|
unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
|
||||||
|
|
||||||
EVT ResultVT = Result.getValueType();
|
EVT ResultVT = Result.getValueType();
|
||||||
|
|
||||||
// Insert the relevant 128 bits.
|
// Insert the relevant 128 bits.
|
||||||
unsigned ElemsPerChunk = 128 / ElVT.getSizeInBits();
|
unsigned ElemsPerChunk = 128/ElVT.getSizeInBits();
|
||||||
|
|
||||||
// This is the index of the first element of the 128-bit chunk
|
// This is the index of the first element of the 128-bit chunk
|
||||||
// we want.
|
// we want.
|
||||||
unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits()) / 128)
|
unsigned NormalizedIdxVal = (((IdxVal * ElVT.getSizeInBits())/128)
|
||||||
* ElemsPerChunk);
|
* ElemsPerChunk);
|
||||||
|
|
||||||
SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32);
|
SDValue VecIdx = DAG.getConstant(NormalizedIdxVal, MVT::i32);
|
||||||
|
|
||||||
Result = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, ResultVT, Result, Vec,
|
Result = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, ResultVT, Result, Vec,
|
||||||
VecIdx);
|
VecIdx);
|
||||||
return Result;
|
return Result;
|
||||||
@ -3641,7 +3633,6 @@ unsigned X86::getExtractVEXTRACTF128Immediate(SDNode *N) {
|
|||||||
EVT ElVT = VecVT.getVectorElementType();
|
EVT ElVT = VecVT.getVectorElementType();
|
||||||
|
|
||||||
unsigned NumElemsPerChunk = 128 / ElVT.getSizeInBits();
|
unsigned NumElemsPerChunk = 128 / ElVT.getSizeInBits();
|
||||||
|
|
||||||
return Index / NumElemsPerChunk;
|
return Index / NumElemsPerChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3659,7 +3650,6 @@ unsigned X86::getInsertVINSERTF128Immediate(SDNode *N) {
|
|||||||
EVT ElVT = VecVT.getVectorElementType();
|
EVT ElVT = VecVT.getVectorElementType();
|
||||||
|
|
||||||
unsigned NumElemsPerChunk = 128 / ElVT.getSizeInBits();
|
unsigned NumElemsPerChunk = 128 / ElVT.getSizeInBits();
|
||||||
|
|
||||||
return Index / NumElemsPerChunk;
|
return Index / NumElemsPerChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user