summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify/addsub.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/addsub.ll')
-rw-r--r--llvm/test/Transforms/InstSimplify/addsub.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/addsub.ll b/llvm/test/Transforms/InstSimplify/addsub.ll
new file mode 100644
index 00000000000..5ba13477b20
--- /dev/null
+++ b/llvm/test/Transforms/InstSimplify/addsub.ll
@@ -0,0 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+
+define i1 @test1(i1 %a) {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: ret i1 true
+;
+ %b = xor i1 %a, true
+ %res = sub i1 %a, %b
+ ret i1 %res
+}
+
+define <2 x i1> @test2(<2 x i1> %a) {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
+;
+ %b = xor <2 x i1> %a, <i1 true, i1 true>
+ %res = sub <2 x i1> %a, %b
+ ret <2 x i1> %res
+}
+
+define i1 @test5(i1 %a) {
+; CHECK-LABEL: @test5(
+; CHECK-NEXT: ret i1 false
+;
+ %res = add i1 %a, %a
+ ret i1 %res
+}
+
+define <2 x i1> @test6(<2 x i1> %a) {
+; CHECK-LABEL: @test6(
+; CHECK-NEXT: ret <2 x i1> zeroinitializer
+;
+ %res = add <2 x i1> %a, %a
+ ret <2 x i1> %res
+}
OpenPOWER on IntegriCloud