summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/ConstProp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2018-12-20 19:46:46 +0000
committerNikita Popov <nikita.ppv@gmail.com>2018-12-20 19:46:46 +0000
commit6d79e43208a5afd4e4dc100249f5f0cbf43e8571 (patch)
tree58a9206815cfa0762c220e03d97a3c76c3741d43 /llvm/test/Transforms/ConstProp
parentda1beca0ace2eff35e35c4dcb7bcbe5abad1cadb (diff)
downloadbcm5719-llvm-6d79e43208a5afd4e4dc100249f5f0cbf43e8571.tar.gz
bcm5719-llvm-6d79e43208a5afd4e4dc100249f5f0cbf43e8571.zip
[ConstantFolding] Add undef tests for overflow intrinsics; NFC
llvm-svn: 349805
Diffstat (limited to 'llvm/test/Transforms/ConstProp')
-rw-r--r--llvm/test/Transforms/ConstProp/overflow-ops.ll71
1 files changed, 71 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ConstProp/overflow-ops.ll b/llvm/test/Transforms/ConstProp/overflow-ops.ll
index b0abd9df405..087a806a340 100644
--- a/llvm/test/Transforms/ConstProp/overflow-ops.ll
+++ b/llvm/test/Transforms/ConstProp/overflow-ops.ll
@@ -29,6 +29,15 @@ define {i8, i1} @uadd_2() nounwind {
ret {i8, i1} %t
}
+define {i8, i1} @uadd_undef() nounwind {
+; CHECK-LABEL: @uadd_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 -114, i8 undef)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 142, i8 undef)
+ ret {i8, i1} %t
+}
+
;;-----------------------------
;; usub
;;-----------------------------
@@ -49,6 +58,15 @@ define {i8, i1} @usub_2() nounwind {
ret {i8, i1} %t
}
+define {i8, i1} @usub_undef() nounwind {
+; CHECK-LABEL: @usub_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.usub.with.overflow.i8(i8 4, i8 undef)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 undef)
+ ret {i8, i1} %t
+}
+
;;-----------------------------
;; umul
;;-----------------------------
@@ -69,6 +87,24 @@ define {i8, i1} @umul_2() nounwind {
ret {i8, i1} %t
}
+define {i8, i1} @umul_undef() nounwind {
+; CHECK-LABEL: @umul_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.umul.with.overflow.i8(i8 undef, i8 2)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 undef, i8 2)
+ ret {i8, i1} %t
+}
+
+define {i8, i1} @umul_both_undef() nounwind {
+; CHECK-LABEL: @umul_both_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.umul.with.overflow.i8(i8 undef, i8 undef)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 undef, i8 undef)
+ ret {i8, i1} %t
+}
+
;;-----------------------------
;; sadd
;;-----------------------------
@@ -113,6 +149,14 @@ define {i8, i1} @sadd_5() nounwind {
ret {i8, i1} %t
}
+define {i8, i1} @sadd_undef() nounwind {
+; CHECK-LABEL: @sadd_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.sadd.with.overflow.i8(i8 undef, i8 -10)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 undef, i8 -10)
+ ret {i8, i1} %t
+}
;;-----------------------------
;; ssub
@@ -174,6 +218,15 @@ define {i8, i1} @ssub_5() nounwind {
ret {i8, i1} %t
}
+define {i8, i1} @ssub_undef() nounwind {
+; CHECK-LABEL: @ssub_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.ssub.with.overflow.i8(i8 undef, i8 -10)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 undef, i8 -10)
+ ret {i8, i1} %t
+}
+
;;-----------------------------
;; smul
;;-----------------------------
@@ -185,3 +238,21 @@ define {i8, i1} @smul_1() nounwind {
%t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 -10)
ret {i8, i1} %t
}
+
+define {i8, i1} @smul_undef() nounwind {
+; CHECK-LABEL: @smul_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.smul.with.overflow.i8(i8 -20, i8 undef)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 undef)
+ ret {i8, i1} %t
+}
+
+define {i8, i1} @smul_both_undef() nounwind {
+; CHECK-LABEL: @smul_both_undef(
+; CHECK-NEXT: [[T:%.*]] = call { i8, i1 } @llvm.smul.with.overflow.i8(i8 undef, i8 undef)
+; CHECK-NEXT: ret { i8, i1 } [[T]]
+;
+ %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 undef, i8 undef)
+ ret {i8, i1} %t
+}
OpenPOWER on IntegriCloud