mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[X86] getTargetVShiftByConstNode - reduce variable scope. NFCI.
Fixes cppcheck warning. llvm-svn: 364561
This commit is contained in:
parent
d49d428271
commit
b556280f2a
@ -21985,42 +21985,41 @@ static SDValue getTargetVShiftByConstNode(unsigned Opc, const SDLoc &dl, MVT VT,
|
||||
if (ISD::isBuildVectorOfConstantSDNodes(SrcOp.getNode())) {
|
||||
SmallVector<SDValue, 8> Elts;
|
||||
unsigned NumElts = SrcOp->getNumOperands();
|
||||
ConstantSDNode *ND;
|
||||
|
||||
switch(Opc) {
|
||||
switch (Opc) {
|
||||
default: llvm_unreachable("Unknown opcode!");
|
||||
case X86ISD::VSHLI:
|
||||
for (unsigned i=0; i!=NumElts; ++i) {
|
||||
for (unsigned i = 0; i != NumElts; ++i) {
|
||||
SDValue CurrentOp = SrcOp->getOperand(i);
|
||||
if (CurrentOp->isUndef()) {
|
||||
Elts.push_back(CurrentOp);
|
||||
continue;
|
||||
}
|
||||
ND = cast<ConstantSDNode>(CurrentOp);
|
||||
auto *ND = cast<ConstantSDNode>(CurrentOp);
|
||||
const APInt &C = ND->getAPIntValue();
|
||||
Elts.push_back(DAG.getConstant(C.shl(ShiftAmt), dl, ElementType));
|
||||
}
|
||||
break;
|
||||
case X86ISD::VSRLI:
|
||||
for (unsigned i=0; i!=NumElts; ++i) {
|
||||
for (unsigned i = 0; i != NumElts; ++i) {
|
||||
SDValue CurrentOp = SrcOp->getOperand(i);
|
||||
if (CurrentOp->isUndef()) {
|
||||
Elts.push_back(CurrentOp);
|
||||
continue;
|
||||
}
|
||||
ND = cast<ConstantSDNode>(CurrentOp);
|
||||
auto *ND = cast<ConstantSDNode>(CurrentOp);
|
||||
const APInt &C = ND->getAPIntValue();
|
||||
Elts.push_back(DAG.getConstant(C.lshr(ShiftAmt), dl, ElementType));
|
||||
}
|
||||
break;
|
||||
case X86ISD::VSRAI:
|
||||
for (unsigned i=0; i!=NumElts; ++i) {
|
||||
for (unsigned i = 0; i != NumElts; ++i) {
|
||||
SDValue CurrentOp = SrcOp->getOperand(i);
|
||||
if (CurrentOp->isUndef()) {
|
||||
Elts.push_back(CurrentOp);
|
||||
continue;
|
||||
}
|
||||
ND = cast<ConstantSDNode>(CurrentOp);
|
||||
auto *ND = cast<ConstantSDNode>(CurrentOp);
|
||||
const APInt &C = ND->getAPIntValue();
|
||||
Elts.push_back(DAG.getConstant(C.ashr(ShiftAmt), dl, ElementType));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user