summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ/int-div-03.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/SystemZ/int-div-03.ll')
-rw-r--r--llvm/test/CodeGen/SystemZ/int-div-03.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/int-div-03.ll b/llvm/test/CodeGen/SystemZ/int-div-03.ll
index b950f2b0203..652fddc1be3 100644
--- a/llvm/test/CodeGen/SystemZ/int-div-03.ll
+++ b/llvm/test/CodeGen/SystemZ/int-div-03.ll
@@ -3,6 +3,8 @@
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+declare i64 @foo()
+
; Test register division. The result is in the second of the two registers.
define void @f1(i64 %dummy, i64 %a, i32 %b, i64 *%dest) {
; CHECK: f1:
@@ -187,3 +189,20 @@ define i64 @f14(i64 %dummy, i64 %a, i64 %src, i64 %index) {
%rem = srem i64 %a, %bext
ret i64 %rem
}
+
+; Make sure that we still use DSGFR rather than DSGR in cases where
+; a load and division cannot be combined.
+define void @f15(i64 *%dest, i32 *%src) {
+; CHECK: f15:
+; CHECK: l [[B:%r[0-9]+]], 0(%r3)
+; CHECK: brasl %r14, foo@PLT
+; CHECK: lgr %r1, %r2
+; CHECK: dsgfr %r0, [[B]]
+; CHECK: br %r14
+ %b = load i32 *%src
+ %a = call i64 @foo()
+ %ext = sext i32 %b to i64
+ %div = sdiv i64 %a, %ext
+ store i64 %div, i64 *%dest
+ ret void
+}
OpenPOWER on IntegriCloud