mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Use APInt operation instead of ConstantExpr::getXX.
llvm-svn: 35503
This commit is contained in:
parent
3352181fc8
commit
382723d8b4
@ -5658,9 +5658,9 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
|
|||||||
BinaryOperator::create(Op0BO->getOpcode(), YS, V1,
|
BinaryOperator::create(Op0BO->getOpcode(), YS, V1,
|
||||||
Op0BO->getOperand(1)->getName());
|
Op0BO->getOperand(1)->getName());
|
||||||
InsertNewInstBefore(X, I); // (X + (Y << C))
|
InsertNewInstBefore(X, I); // (X + (Y << C))
|
||||||
Constant *C2 = ConstantInt::getAllOnesValue(X->getType());
|
uint32_t Op1Val = Op1->getZExtValue();
|
||||||
C2 = ConstantExpr::getShl(C2, Op1);
|
return BinaryOperator::createAnd(X, ConstantInt::get(
|
||||||
return BinaryOperator::createAnd(X, C2);
|
APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn (Y + ((X >> C) & CC)) << C -> ((X & (CC << C)) + (Y << C))
|
// Turn (Y + ((X >> C) & CC)) << C -> ((X & (CC << C)) + (Y << C))
|
||||||
@ -5697,9 +5697,9 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
|
|||||||
BinaryOperator::create(Op0BO->getOpcode(), V1, YS,
|
BinaryOperator::create(Op0BO->getOpcode(), V1, YS,
|
||||||
Op0BO->getOperand(0)->getName());
|
Op0BO->getOperand(0)->getName());
|
||||||
InsertNewInstBefore(X, I); // (X + (Y << C))
|
InsertNewInstBefore(X, I); // (X + (Y << C))
|
||||||
Constant *C2 = ConstantInt::getAllOnesValue(X->getType());
|
uint32_t Op1Val = Op1->getZExtValue();
|
||||||
C2 = ConstantExpr::getShl(C2, Op1);
|
return BinaryOperator::createAnd(X, ConstantInt::get(
|
||||||
return BinaryOperator::createAnd(X, C2);
|
APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn (((X >> C)&CC) + Y) << C -> (X + (Y << C)) & (CC << C)
|
// Turn (((X >> C)&CC) + Y) << C -> (X + (Y << C)) & (CC << C)
|
||||||
|
Loading…
Reference in New Issue
Block a user