diff options
author | Frits van Bommel <fvbommel@gmail.com> | 2011-03-27 14:26:13 +0000 |
---|---|---|
committer | Frits van Bommel <fvbommel@gmail.com> | 2011-03-27 14:26:13 +0000 |
commit | 6208610fd602ebdb18bb793152899573d0b2b7ab (patch) | |
tree | 04cc9a6f57e3c0b146c2067bd287912b13e4b3e4 /test/Transforms/ConstProp | |
parent | f0bf9dfc1f7755a6233e41fd6f259c4ee08a40dc (diff) | |
download | external_llvm-6208610fd602ebdb18bb793152899573d0b2b7ab.zip external_llvm-6208610fd602ebdb18bb793152899573d0b2b7ab.tar.gz external_llvm-6208610fd602ebdb18bb793152899573d0b2b7ab.tar.bz2 |
Constant folding support for calls to umul.with.overflow(), basically identical to the smul.with.overflow() code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ConstProp')
-rw-r--r-- | test/Transforms/ConstProp/overflow-ops.ll | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/test/Transforms/ConstProp/overflow-ops.ll b/test/Transforms/ConstProp/overflow-ops.ll index 5587e9b..d1cc2eb 100644 --- a/test/Transforms/ConstProp/overflow-ops.ll +++ b/test/Transforms/ConstProp/overflow-ops.ll @@ -2,6 +2,14 @@ %i8i1 = type {i8, i1} +declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8) +declare {i8, i1} @llvm.usub.with.overflow.i8(i8, i8) +declare {i8, i1} @llvm.umul.with.overflow.i8(i8, i8) + +declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8) +declare {i8, i1} @llvm.ssub.with.overflow.i8(i8, i8) +declare {i8, i1} @llvm.smul.with.overflow.i8(i8, i8) + ;;----------------------------- ;; uadd ;;----------------------------- @@ -47,6 +55,28 @@ entry: } ;;----------------------------- +;; umul +;;----------------------------- + +define {i8, i1} @umul_1() nounwind { +entry: + %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 100, i8 3) + ret {i8, i1} %t + +; CHECK: @umul_1 +; CHECK: ret %i8i1 { i8 44, i1 true } +} + +define {i8, i1} @umul_2() nounwind { +entry: + %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 100, i8 2) + ret {i8, i1} %t + +; CHECK: @umul_2 +; CHECK: ret %i8i1 { i8 -56, i1 false } +} + +;;----------------------------- ;; sadd ;;----------------------------- @@ -163,14 +193,9 @@ entry: ; CHECK: ret %i8i1 { i8 -10, i1 false } } - - -declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.usub.with.overflow.i8(i8, i8) - -declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.ssub.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.smul.with.overflow.i8(i8, i8) +;;----------------------------- +;; smul +;;----------------------------- ; rdar://8501501 define {i8, i1} @smul_1() nounwind { |