[llvm] a7f7cf1 - [NFC][InstSimplify] add test cases with base results for or-xor fold
Muhammad Asif Manzoor via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 07:05:25 PST 2021
Author: Mehrnoosh Heidarpour
Date: 2021-11-15T10:08:31-05:00
New Revision: a7f7cf115bbb8a3fc72ed4da4f6128ce04db050c
URL: https://github.com/llvm/llvm-project/commit/a7f7cf115bbb8a3fc72ed4da4f6128ce04db050c
DIFF: https://github.com/llvm/llvm-project/commit/a7f7cf115bbb8a3fc72ed4da4f6128ce04db050c.diff
LOG: [NFC][InstSimplify] add test cases with base results for or-xor fold
This patch adds tests with baseline results as a pre-commit for D113861
Differential Revision: https://reviews.llvm.org/D113860
Added:
Modified:
llvm/test/Transforms/InstSimplify/or.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/or.ll b/llvm/test/Transforms/InstSimplify/or.ll
index 6938b66989c3..038112a11efd 100644
--- a/llvm/test/Transforms/InstSimplify/or.ll
+++ b/llvm/test/Transforms/InstSimplify/or.ll
@@ -446,6 +446,34 @@ define i32 @and_or_not_or8(i32 %A, i32 %B) {
ret i32 %i5
}
+; (A | B) | (A ^ B) --> A | B
+
+define i69 @or_or_xor(i69 %A, i69 %B) {
+; CHECK-LABEL: @or_or_xor(
+; CHECK-NEXT: [[I1:%.*]] = or i69 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[I2:%.*]] = xor i69 [[A]], [[B]]
+; CHECK-NEXT: [[I3:%.*]] = or i69 [[I1]], [[I2]]
+; CHECK-NEXT: ret i69 [[I3]]
+;
+ %i1 = or i69 %A, %B
+ %i2 = xor i69 %A, %B
+ %i3 = or i69 %i1, %i2
+ ret i69 %i3
+}
+
+define <4 x i4> @or_or_xor_commuted(<4 x i4> %A, <4 x i4> %B) {
+; CHECK-LABEL: @or_or_xor_commuted(
+; CHECK-NEXT: [[I1:%.*]] = or <4 x i4> [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[I2:%.*]] = xor <4 x i4> [[A]], [[B]]
+; CHECK-NEXT: [[I3:%.*]] = or <4 x i4> [[I2]], [[I1]]
+; CHECK-NEXT: ret <4 x i4> [[I3]]
+;
+ %i1 = or <4 x i4> %A, %B
+ %i2 = xor <4 x i4> %A, %B
+ %i3 = or <4 x i4> %i2, %i1
+ ret <4 x i4> %i3
+}
+
define i32 @shifted_all_ones(i32 %shamt) {
; CHECK-LABEL: @shifted_all_ones(
; CHECK-NEXT: ret i32 -1
More information about the llvm-commits
mailing list