mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-11 13:46:13 +00:00
implement and.ll:test33
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21809 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2f2c3e4392
commit
6e4c6495eb
@ -1832,8 +1832,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
|
||||
ConstantInt *C1; Value *X;
|
||||
// (X & C1) | C2 --> (X | C2) & (C1|C2)
|
||||
if (match(Op0, m_And(m_Value(X), m_ConstantInt(C1))) && isOnlyUse(Op0)) {
|
||||
std::string Op0Name = Op0->getName(); Op0->setName("");
|
||||
Instruction *Or = BinaryOperator::createOr(X, RHS, Op0Name);
|
||||
Instruction *Or = BinaryOperator::createOr(X, RHS, Op0->getName());
|
||||
Op0->setName("");
|
||||
InsertNewInstBefore(Or, I);
|
||||
return BinaryOperator::createAnd(Or, ConstantExpr::getOr(RHS, C1));
|
||||
}
|
||||
@ -1865,6 +1865,22 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
|
||||
if (A == Op0 || B == Op0) // A | (A & ?) --> A
|
||||
return ReplaceInstUsesWith(I, Op0);
|
||||
|
||||
// (X^C)|Y -> (X|Y)^C iff Y&C == 0
|
||||
if (Op0->hasOneUse() && match(Op0, m_Xor(m_Value(A), m_ConstantInt(C1))) &&
|
||||
MaskedValueIsZero(Op1, C1)) {
|
||||
Instruction *NOr = BinaryOperator::createOr(A, Op1, Op0->getName());
|
||||
Op0->setName("");
|
||||
return BinaryOperator::createXor(InsertNewInstBefore(NOr, I), C1);
|
||||
}
|
||||
|
||||
// Y|(X^C) -> (X|Y)^C iff Y&C == 0
|
||||
if (Op1->hasOneUse() && match(Op1, m_Xor(m_Value(A), m_ConstantInt(C1))) &&
|
||||
MaskedValueIsZero(Op0, C1)) {
|
||||
Instruction *NOr = BinaryOperator::createOr(A, Op0, Op1->getName());
|
||||
Op0->setName("");
|
||||
return BinaryOperator::createXor(InsertNewInstBefore(NOr, I), C1);
|
||||
}
|
||||
|
||||
// (A & C1)|(A & C2) == A & (C1|C2)
|
||||
if (match(Op0, m_And(m_Value(A), m_ConstantInt(C1))) &&
|
||||
match(Op1, m_And(m_Value(B), m_ConstantInt(C2))) && A == B)
|
||||
|
Loading…
Reference in New Issue
Block a user