mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add instcombine patterns for the following transformations:
(x & y) | (x ^ y) -> x | y (x & y) + (x ^ y) -> x | y Patch by Manman Ren. rdar://10770603 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
24
test/Transforms/InstCombine/and-xor-or.ll
Normal file
24
test/Transforms/InstCombine/and-xor-or.ll
Normal file
@@ -0,0 +1,24 @@
|
||||
; RUN: opt < %s -instcombine -S | FileCheck %s
|
||||
|
||||
; rdar://10770603
|
||||
; (x & y) | (x ^ y) -> x | y
|
||||
define i64 @or(i64 %x, i64 %y) nounwind uwtable readnone ssp {
|
||||
%1 = and i64 %y, %x
|
||||
%2 = xor i64 %y, %x
|
||||
%3 = add i64 %1, %2
|
||||
ret i64 %3
|
||||
; CHECK: @or
|
||||
; CHECK: or i64
|
||||
; CHECK-NEXT: ret
|
||||
}
|
||||
|
||||
; (x & y) + (x ^ y) -> x | y
|
||||
define i64 @or2(i64 %x, i64 %y) nounwind uwtable readnone ssp {
|
||||
%1 = and i64 %y, %x
|
||||
%2 = xor i64 %y, %x
|
||||
%3 = or i64 %1, %2
|
||||
ret i64 %3
|
||||
; CHECK: @or2
|
||||
; CHECK: or i64
|
||||
; CHECK-NEXT: ret
|
||||
}
|
Reference in New Issue
Block a user