summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/SPARC/multiple-div.ll
diff options
context:
space:
mode:
authorsvnmir <svnmir@FreeBSD.org>2015-08-07 23:01:46 +0000
committersvnmir <svnmir@FreeBSD.org>2015-08-07 23:01:46 +0000
commitc5dd590220d0afe971d065bfe9324f549dd00968 (patch)
tree52d1861acda1205241ee35a94aa63129c604d469 /test/CodeGen/SPARC/multiple-div.ll
parentd2fc7c7001ed3babcd0106d15dd70224abfb6f29 (diff)
downloadFreeBSD-src-c5dd590220d0afe971d065bfe9324f549dd00968.zip
FreeBSD-src-c5dd590220d0afe971d065bfe9324f549dd00968.tar.gz
Vendor import of llvm trunk r242221:
https://llvm.org/svn/llvm-project/llvm/trunk@242221
Diffstat (limited to 'test/CodeGen/SPARC/multiple-div.ll')
-rw-r--r--test/CodeGen/SPARC/multiple-div.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/SPARC/multiple-div.ll b/test/CodeGen/SPARC/multiple-div.ll
new file mode 100644
index 0000000..6934f69
--- /dev/null
+++ b/test/CodeGen/SPARC/multiple-div.ll
@@ -0,0 +1,21 @@
+; RUN: llc < %s -march=sparc | FileCheck %s
+; RUN: llc -O0 < %s -march=sparc | FileCheck %s
+
+;; llc -O0 used to try to spill Y to the stack, which isn't possible,
+;; and then crashed. Additionally, in -O1, it would omit the second
+;; apparently-redundant wr to %y, which is not actually redundant
+;; because the spec says to treat %y as potentially-written by udiv.
+
+; CHECK-LABEL: two_divides:
+; CHECK: wr %g0, %g0, %y
+; CHECK: udiv
+; CHECK: wr %g0, %g0, %y
+; CHECK: udiv
+; CHECK: add
+
+define i32 @two_divides(i32 %a, i32 %b) {
+ %r = udiv i32 %a, %b
+ %r2 = udiv i32 %b, %a
+ %r3 = add i32 %r, %r2
+ ret i32 %r3
+}
OpenPOWER on IntegriCloud