diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-07-02 15:40:22 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-07-02 15:40:22 +0000 |
commit | 35b7bebe1162326c38217ff80d4a49fbbffcc365 (patch) | |
tree | ca40f2316e4ea9df6282c869b4559ca7763dee87 /test | |
parent | 1ce4894a3f1ce6e63c1b109c24235d81dea2908f (diff) | |
download | llvm-35b7bebe1162326c38217ff80d4a49fbbffcc365.tar.gz llvm-35b7bebe1162326c38217ff80d4a49fbbffcc365.tar.bz2 llvm-35b7bebe1162326c38217ff80d4a49fbbffcc365.tar.xz |
[SystemZ] Use DSGFR over DSGR in more cases
Fixes some cases where we were using full 64-bit division for (sdiv i32, i32)
and (sdiv i64, i32).
The "32" in "SDIVREM32" just refers to the second operand. The first operand
of all *DIVREM*s is a GR128.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185435 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/SystemZ/int-div-01.ll | 18 | ||||
-rw-r--r-- | test/CodeGen/SystemZ/int-div-03.ll | 19 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/int-div-01.ll b/test/CodeGen/SystemZ/int-div-01.ll index 492ece9149..9a0066f0d0 100644 --- a/test/CodeGen/SystemZ/int-div-01.ll +++ b/test/CodeGen/SystemZ/int-div-01.ll @@ -2,6 +2,8 @@ ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s +declare i32 @foo() + ; Test register division. The result is in the second of the two registers. define void @f1(i32 *%dest, i32 %a, i32 %b) { ; CHECK: f1: @@ -188,3 +190,19 @@ define i32 @f14(i32 %dummy, i32 %a, i64 %src, i64 %index) { %rem = srem i32 %a, %b ret i32 %rem } + +; Make sure that we still use DSGFR rather than DSGR in cases where +; a load and division cannot be combined. +define void @f15(i32 *%dest, i32 *%src) { +; CHECK: f15: +; CHECK: l [[B:%r[0-9]+]], 0(%r3) +; CHECK: brasl %r14, foo@PLT +; CHECK: lgfr %r1, %r2 +; CHECK: dsgfr %r0, [[B]] +; CHECK: br %r14 + %b = load i32 *%src + %a = call i32 @foo() + %div = sdiv i32 %a, %b + store i32 %div, i32 *%dest + ret void +} diff --git a/test/CodeGen/SystemZ/int-div-03.ll b/test/CodeGen/SystemZ/int-div-03.ll index b950f2b020..652fddc1be 100644 --- a/test/CodeGen/SystemZ/int-div-03.ll +++ b/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 +} |