diff options
author | Dan Gohman <gohman@apple.com> | 2007-09-17 17:31:57 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2007-09-17 17:31:57 +0000 |
commit | 5d066ff7f0845abd224a4b60cd9bf9f7516b04a6 (patch) | |
tree | 532b1fb10d73efd4bccdcdbe5bbe0cfc9060da4f /test | |
parent | baa2fa5823fe4598d158794711d88af21976c182 (diff) | |
download | external_llvm-5d066ff7f0845abd224a4b60cd9bf9f7516b04a6.zip external_llvm-5d066ff7f0845abd224a4b60cd9bf9f7516b04a6.tar.gz external_llvm-5d066ff7f0845abd224a4b60cd9bf9f7516b04a6.tar.bz2 |
Instcombine x-((x/y)*y) into a remainder operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/srem.ll | 8 | ||||
-rw-r--r-- | test/Transforms/InstCombine/urem.ll | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/srem.ll b/test/Transforms/InstCombine/srem.ll new file mode 100644 index 0000000..864775a --- /dev/null +++ b/test/Transforms/InstCombine/srem.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem + +define i64 @foo(i64 %x1, i64 %y2) { + %r = sdiv i64 %x1, %y2 + %r7 = mul i64 %r, %y2 + %r8 = sub i64 %x1, %r7 + ret i64 %r8 +} diff --git a/test/Transforms/InstCombine/urem.ll b/test/Transforms/InstCombine/urem.ll new file mode 100644 index 0000000..24e7463 --- /dev/null +++ b/test/Transforms/InstCombine/urem.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep urem + +define i64 @rem_unsigned(i64 %x1, i64 %y2) { + %r = udiv i64 %x1, %y2 + %r7 = mul i64 %r, %y2 + %r8 = sub i64 %x1, %r7 + ret i64 %r8 +} |