mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
InstCombine: ((A & ~B) ^ (~A & B)) to A ^ B
Proof using CVC3 follows: $ cat t.cvc A, B : BITVECTOR(32); QUERY BVXOR((A & ~B),(~A & B)) = BVXOR(A,B); $ cvc3 t.cvc Valid. Differential Revision: http://reviews.llvm.org/D4898 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2522,6 +2522,16 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
|
||||
match(Op1I, m_Or(m_Specific(A), m_Not(m_Specific(B))))) {
|
||||
return BinaryOperator::CreateXor(A, B);
|
||||
}
|
||||
// (A & ~B) ^ (~A & B) -> A ^ B
|
||||
if (match(Op0I, m_And(m_Value(A), m_Not(m_Value(B)))) &&
|
||||
match(Op1I, m_And(m_Not(m_Specific(A)), m_Specific(B)))) {
|
||||
return BinaryOperator::CreateXor(A, B);
|
||||
}
|
||||
// (~A & B) ^ (A & ~B) -> A ^ B
|
||||
if (match(Op0I, m_And(m_Not(m_Value(A)), m_Value(B))) &&
|
||||
match(Op1I, m_And(m_Specific(A), m_Not(m_Specific(B))))) {
|
||||
return BinaryOperator::CreateXor(A, B);
|
||||
}
|
||||
// (A ^ B)^(A | B) -> A & B
|
||||
if (match(Op0I, m_Xor(m_Value(A), m_Value(B))) &&
|
||||
match(Op1I, m_Or(m_Value(C), m_Value(D)))) {
|
||||
|
||||
Reference in New Issue
Block a user