summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/and-xor-or.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine/and-xor-or.ll')
-rw-r--r--test/Transforms/InstCombine/and-xor-or.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/and-xor-or.ll b/test/Transforms/InstCombine/and-xor-or.ll
new file mode 100644
index 00000000000..7ff810b6eee
--- /dev/null
+++ b/test/Transforms/InstCombine/and-xor-or.ll
@@ -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
+}