[llvm] dee938e - [Tests] Precommit tests for D85593

Dávid Bolvanský via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 07:07:50 PDT 2020


Author: Dávid Bolvanský
Date: 2020-08-09T16:07:36+02:00
New Revision: dee938e5ccdb5b3afe4e5b6e91b41db9c7fe61bd

URL: https://github.com/llvm/llvm-project/commit/dee938e5ccdb5b3afe4e5b6e91b41db9c7fe61bd
DIFF: https://github.com/llvm/llvm-project/commit/dee938e5ccdb5b3afe4e5b6e91b41db9c7fe61bd.diff

LOG: [Tests] Precommit tests for D85593

Added: 
    llvm/test/Transforms/InstCombine/not-add.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/not-add.ll b/llvm/test/Transforms/InstCombine/not-add.ll
new file mode 100644
index 000000000000..1bd6dbe4e933
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/not-add.ll
@@ -0,0 +1,157 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+declare void @use(i8)
+declare i8 @get()
+
+define i8 @basic(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    [[A:%.*]] = add i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  %a = add i8 %notx, %y
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_com_add(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_com_add(
+; CHECK-NEXT:    [[NOTY:%.*]] = xor i8 [[Y:%.*]], -1
+; CHECK-NEXT:    [[A:%.*]] = add i8 [[NOTY]], [[X:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %noty = xor i8 %y, -1
+  %a = add i8 %x, %noty
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_use_xor(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_use_xor(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    call void @use(i8 [[NOTX]])
+; CHECK-NEXT:    [[A:%.*]] = add i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  call void @use(i8 %notx)
+  %a = add i8 %notx, %y
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_use_add(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_use_add(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    [[A:%.*]] = add i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    call void @use(i8 [[A]])
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  %a = add i8 %notx, %y
+  call void @use(i8 %a)
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_use_both(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_use_both(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    call void @use(i8 [[NOTX]])
+; CHECK-NEXT:    [[A:%.*]] = add i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    call void @use(i8 [[A]])
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  call void @use(i8 %notx)
+  %a = add i8 %notx, %y
+  call void @use(i8 %a)
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_preserve_nsw(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_preserve_nsw(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    [[A:%.*]] = add nsw i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  %a = add nsw i8 %notx, %y
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_preserve_nuw(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_preserve_nuw(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    [[A:%.*]] = add nuw i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  %a = add nuw i8 %notx, %y
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define i8 @basic_preserve_nuw_nsw(i8 %x, i8 %y) {
+; CHECK-LABEL: @basic_preserve_nuw_nsw(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor i8 [[X:%.*]], -1
+; CHECK-NEXT:    [[A:%.*]] = add nuw nsw i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
+; CHECK-NEXT:    ret i8 [[NOTA]]
+;
+  %notx = xor i8 %x, -1
+  %a = add nuw nsw i8 %notx, %y
+  %nota = xor i8 %a, -1
+  ret i8 %nota
+}
+
+define <4 x i32> @vector_test(<4 x i32> %x, <4 x i32> %y) {
+; CHECK-LABEL: @vector_test(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor <4 x i32> [[X:%.*]], <i32 -1, i32 -1, i32 -1, i32 -1>
+; CHECK-NEXT:    [[A:%.*]] = add <4 x i32> [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor <4 x i32> [[A]], <i32 -1, i32 -1, i32 -1, i32 -1>
+; CHECK-NEXT:    ret <4 x i32> [[NOTA]]
+;
+  %notx = xor <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1>
+  %a = add <4 x i32> %notx, %y
+  %nota = xor <4 x i32> %a, <i32 -1, i32 -1, i32 -1, i32 -1>
+  ret <4 x i32> %nota
+}
+
+define <4 x i32> @vector_test_undef(<4 x i32> %x, <4 x i32> %y) {
+; CHECK-LABEL: @vector_test_undef(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor <4 x i32> [[X:%.*]], <i32 -1, i32 undef, i32 undef, i32 -1>
+; CHECK-NEXT:    [[A:%.*]] = add <4 x i32> [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor <4 x i32> [[A]], <i32 -1, i32 -1, i32 undef, i32 undef>
+; CHECK-NEXT:    ret <4 x i32> [[NOTA]]
+;
+  %notx = xor <4 x i32> %x, <i32 -1, i32 undef, i32 undef, i32 -1>
+  %a = add <4 x i32> %notx, %y
+  %nota = xor <4 x i32> %a, <i32 -1, i32 -1, i32 undef, i32 undef>
+  ret <4 x i32> %nota
+}
+
+
+define <4 x i32> @vector_test_undef_nsw_nuw(<4 x i32> %x, <4 x i32> %y) {
+; CHECK-LABEL: @vector_test_undef_nsw_nuw(
+; CHECK-NEXT:    [[NOTX:%.*]] = xor <4 x i32> [[X:%.*]], <i32 -1, i32 undef, i32 undef, i32 -1>
+; CHECK-NEXT:    [[A:%.*]] = add nuw nsw <4 x i32> [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    [[NOTA:%.*]] = xor <4 x i32> [[A]], <i32 -1, i32 -1, i32 undef, i32 undef>
+; CHECK-NEXT:    ret <4 x i32> [[NOTA]]
+;
+  %notx = xor <4 x i32> %x, <i32 -1, i32 undef, i32 undef, i32 -1>
+  %a = add nsw nuw <4 x i32> %notx, %y
+  %nota = xor <4 x i32> %a, <i32 -1, i32 -1, i32 undef, i32 undef>
+  ret <4 x i32> %nota
+}


        


More information about the llvm-commits mailing list