2012-04-27 07:29:14 +08:00
|
|
|
; 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
|
2013-07-14 09:42:54 +08:00
|
|
|
; CHECK-LABEL: @or(
|
2012-04-27 07:29:14 +08:00
|
|
|
; 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
|
2013-07-14 09:42:54 +08:00
|
|
|
; CHECK-LABEL: @or2(
|
2012-04-27 07:29:14 +08:00
|
|
|
; CHECK: or i64
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
}
|