mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Implement xor.ll:test21: select (not C), A, B -> select C, B, A
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21495 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6edb7e8c20
commit
a1df33c0ee
@ -311,7 +311,7 @@ bool InstCombiner::SimplifyCommutative(BinaryOperator &I) {
|
|||||||
//
|
//
|
||||||
static inline Value *dyn_castNegVal(Value *V) {
|
static inline Value *dyn_castNegVal(Value *V) {
|
||||||
if (BinaryOperator::isNeg(V))
|
if (BinaryOperator::isNeg(V))
|
||||||
return BinaryOperator::getNegArgument(cast<BinaryOperator>(V));
|
return BinaryOperator::getNegArgument(V);
|
||||||
|
|
||||||
// Constants can be considered to be negated values if they can be folded.
|
// Constants can be considered to be negated values if they can be folded.
|
||||||
if (ConstantInt *C = dyn_cast<ConstantInt>(V))
|
if (ConstantInt *C = dyn_cast<ConstantInt>(V))
|
||||||
@ -321,7 +321,7 @@ static inline Value *dyn_castNegVal(Value *V) {
|
|||||||
|
|
||||||
static inline Value *dyn_castNotVal(Value *V) {
|
static inline Value *dyn_castNotVal(Value *V) {
|
||||||
if (BinaryOperator::isNot(V))
|
if (BinaryOperator::isNot(V))
|
||||||
return BinaryOperator::getNotArgument(cast<BinaryOperator>(V));
|
return BinaryOperator::getNotArgument(V);
|
||||||
|
|
||||||
// Constants can be considered to be not'ed values...
|
// Constants can be considered to be not'ed values...
|
||||||
if (ConstantIntegral *C = dyn_cast<ConstantIntegral>(V))
|
if (ConstantIntegral *C = dyn_cast<ConstantIntegral>(V))
|
||||||
@ -3885,6 +3885,14 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BinaryOperator::isNot(CondVal)) {
|
||||||
|
SI.setOperand(0, BinaryOperator::getNotArgument(CondVal));
|
||||||
|
SI.setOperand(1, FalseVal);
|
||||||
|
SI.setOperand(2, TrueVal);
|
||||||
|
return &SI;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user