aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/Mips/divrem.ll
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2011-03-04 21:03:24 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2011-03-04 21:03:24 +0000
commit38b5e86b9c67f601f354f8bcc11f5a515e200315 (patch)
treedd02a37c8d68ffdfcbb2837ebc9ea0095d37c9c9 /test/CodeGen/Mips/divrem.ll
parent650af5d0f8740682d4a5bd6aa04b8379e378e0f4 (diff)
downloadexternal_llvm-38b5e86b9c67f601f354f8bcc11f5a515e200315.zip
external_llvm-38b5e86b9c67f601f354f8bcc11f5a515e200315.tar.gz
external_llvm-38b5e86b9c67f601f354f8bcc11f5a515e200315.tar.bz2
Improve div/rem node handling on mips. Patch by Akira Hatanaka
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Mips/divrem.ll')
-rw-r--r--test/CodeGen/Mips/divrem.ll51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/divrem.ll b/test/CodeGen/Mips/divrem.ll
new file mode 100644
index 0000000..398d1b7
--- /dev/null
+++ b/test/CodeGen/Mips/divrem.ll
@@ -0,0 +1,51 @@
+; RUN: llc -march=mips < %s | FileCheck %s
+
+; CHECK: div $zero,
+define i32 @sdiv1(i32 %a0, i32 %a1) nounwind readnone {
+entry:
+ %div = sdiv i32 %a0, %a1
+ ret i32 %div
+}
+
+; CHECK: div $zero,
+define i32 @srem1(i32 %a0, i32 %a1) nounwind readnone {
+entry:
+ %rem = srem i32 %a0, %a1
+ ret i32 %rem
+}
+
+; CHECK: divu $zero,
+define i32 @udiv1(i32 %a0, i32 %a1) nounwind readnone {
+entry:
+ %div = udiv i32 %a0, %a1
+ ret i32 %div
+}
+
+; CHECK: divu $zero,
+define i32 @urem1(i32 %a0, i32 %a1) nounwind readnone {
+entry:
+ %rem = urem i32 %a0, %a1
+ ret i32 %rem
+}
+
+; CHECK: div $zero,
+define i32 @sdivrem1(i32 %a0, i32 %a1, i32* nocapture %r) nounwind {
+entry:
+ %rem = srem i32 %a0, %a1
+ store i32 %rem, i32* %r, align 4, !tbaa !0
+ %div = sdiv i32 %a0, %a1
+ ret i32 %div
+}
+
+; CHECK: divu $zero,
+define i32 @udivrem1(i32 %a0, i32 %a1, i32* nocapture %r) nounwind {
+entry:
+ %rem = urem i32 %a0, %a1
+ store i32 %rem, i32* %r, align 4, !tbaa !0
+ %div = udiv i32 %a0, %a1
+ ret i32 %div
+}
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}