[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
; RUN: llc -march=mips64el -mcpu=mips4 < %s | FileCheck %s -check-prefix=ALL -check-prefix=ACC
|
|
|
|
; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s -check-prefix=ALL -check-prefix=ACC
|
|
|
|
; RUN: llc -march=mips64el -mcpu=mips64r2 < %s | FileCheck %s -check-prefix=ALL -check-prefix=ACC
|
|
|
|
; RUN: llc -march=mips64el -mcpu=mips64r6 < %s | FileCheck %s -check-prefix=ALL -check-prefix=GPR
|
|
|
|
|
|
|
|
; FileCheck prefixes:
|
|
|
|
; ALL - All targets
|
|
|
|
; ACC - Targets with accumulator based mul/div (i.e. pre-MIPS32r6)
|
|
|
|
; GPR - Targets with register based mul/div (i.e. MIPS32r6)
|
2011-12-02 22:31:36 +00:00
|
|
|
|
|
|
|
define i64 @m0(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL-LABEL: m0:
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
; ACC: dmult ${{[45]}}, ${{[45]}}
|
|
|
|
; ACC: mflo $2
|
|
|
|
; GPR: dmul $2, ${{[45]}}, ${{[45]}}
|
2011-12-02 22:31:36 +00:00
|
|
|
%mul = mul i64 %a1, %a0
|
|
|
|
ret i64 %mul
|
|
|
|
}
|
|
|
|
|
2011-12-20 23:10:57 +00:00
|
|
|
define i64 @m1(i64 %a) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL-LABEL: m1:
|
|
|
|
; ALL: lui $[[T0:[0-9]+]], 21845
|
|
|
|
; ALL: addiu $[[T0]], $[[T0]], 21845
|
|
|
|
; ALL: dsll $[[T0]], $[[T0]], 16
|
|
|
|
; ALL: addiu $[[T0]], $[[T0]], 21845
|
|
|
|
; ALL: dsll $[[T0]], $[[T0]], 16
|
|
|
|
; ALL: addiu $[[T0]], $[[T0]], 21846
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
|
|
|
|
; ACC: dmult $4, $[[T0]]
|
|
|
|
; ACC: mfhi $[[T1:[0-9]+]]
|
|
|
|
; GPR: dmuh $[[T1:[0-9]+]], $4, $[[T0]]
|
|
|
|
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL: dsrl $2, $[[T1]], 63
|
|
|
|
; ALL: daddu $2, $[[T1]], $2
|
2011-12-20 23:10:57 +00:00
|
|
|
%div = sdiv i64 %a, 3
|
|
|
|
ret i64 %div
|
|
|
|
}
|
|
|
|
|
2011-12-02 22:31:36 +00:00
|
|
|
define i64 @d0(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL-LABEL: d0:
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
; ACC: ddivu $zero, $4, $5
|
|
|
|
; ACC: mflo $2
|
|
|
|
; GPR: ddivu $2, $4, $5
|
2011-12-02 22:31:36 +00:00
|
|
|
%div = udiv i64 %a0, %a1
|
|
|
|
ret i64 %div
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @d1(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL-LABEL: d1:
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
; ACC: ddiv $zero, $4, $5
|
|
|
|
; ACC: mflo $2
|
|
|
|
; GPR: ddiv $2, $4, $5
|
2011-12-02 22:31:36 +00:00
|
|
|
%div = sdiv i64 %a0, %a1
|
|
|
|
ret i64 %div
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @d2(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL-LABEL: d2:
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
; ACC: ddivu $zero, $4, $5
|
|
|
|
; ACC: mfhi $2
|
|
|
|
; GPR: dmodu $2, $4, $5
|
2011-12-02 22:31:36 +00:00
|
|
|
%rem = urem i64 %a0, %a1
|
|
|
|
ret i64 %rem
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @d3(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 15:48:00 +00:00
|
|
|
; ALL-LABEL: d3:
|
[mips][mips64r6] Replace m[tf]hi, m[tf]lo, mult, multu, dmult, dmultu, div, ddiv, divu, ddivu for MIPS32r6/MIPS64.
Summary:
The accumulator-based (HI/LO) multiplies and divides from earlier ISA's have
been removed and replaced with GPR-based equivalents. For example:
div $1, $2
mflo $3
is now:
div $3, $1, $2
This patch disables the accumulator-based multiplies and divides for
MIPS32r6/MIPS64r6 and uses the GPR-based equivalents instead.
Renamed expandPseudoDiv to insertDivByZeroTrap to better describe the
behaviour of the function.
MipsDelaySlotFiller now invalidates the liveness information when moving
instructions to the delay slot. Without this, divrem.ll will abort since
%GP ends up used before it is defined.
Reviewers: vmedic, zoran.jovanovic, jkolek
Reviewed By: jkolek
Differential Revision: http://reviews.llvm.org/D3896
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:44:10 +00:00
|
|
|
; ACC: ddiv $zero, $4, $5
|
|
|
|
; ACC: mfhi $2
|
|
|
|
; GPR: dmod $2, $4, $5
|
2011-12-02 22:31:36 +00:00
|
|
|
%rem = srem i64 %a0, %a1
|
|
|
|
ret i64 %rem
|
|
|
|
}
|