2016-06-24 20:23:17 +08:00
|
|
|
; RUN: llc -march=mips64el -mcpu=mips4 < %s | FileCheck %s -check-prefixes=ALL,ACC
|
|
|
|
; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s -check-prefixes=ALL,ACC
|
|
|
|
; RUN: llc -march=mips64el -mcpu=mips64r2 < %s | FileCheck %s -check-prefixes=ALL,ACC
|
|
|
|
; RUN: llc -march=mips64el -mcpu=mips64r6 < %s | FileCheck %s -check-prefixes=ALL,GPR
|
[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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
|
2020-05-22 19:36:15 +08:00
|
|
|
; 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-03 06:31:36 +08:00
|
|
|
|
|
|
|
define i64 @m0(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 23:48:00 +08: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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
; ACC: dmult ${{[45]}}, ${{[45]}}
|
|
|
|
; ACC: mflo $2
|
|
|
|
; GPR: dmul $2, ${{[45]}}, ${{[45]}}
|
2011-12-03 06:31:36 +08:00
|
|
|
%mul = mul i64 %a1, %a0
|
|
|
|
ret i64 %mul
|
|
|
|
}
|
|
|
|
|
2011-12-21 07:10:57 +08:00
|
|
|
define i64 @m1(i64 %a) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 23:48:00 +08: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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
|
|
|
|
; ACC: dmult $4, $[[T0]]
|
|
|
|
; ACC: mfhi $[[T1:[0-9]+]]
|
|
|
|
; GPR: dmuh $[[T1:[0-9]+]], $4, $[[T0]]
|
|
|
|
|
2014-06-11 23:48:00 +08:00
|
|
|
; ALL: dsrl $2, $[[T1]], 63
|
|
|
|
; ALL: daddu $2, $[[T1]], $2
|
2011-12-21 07:10:57 +08:00
|
|
|
%div = sdiv i64 %a, 3
|
|
|
|
ret i64 %div
|
|
|
|
}
|
|
|
|
|
2011-12-03 06:31:36 +08:00
|
|
|
define i64 @d0(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 23:48:00 +08: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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
; ACC: ddivu $zero, $4, $5
|
|
|
|
; ACC: mflo $2
|
|
|
|
; GPR: ddivu $2, $4, $5
|
2011-12-03 06:31:36 +08:00
|
|
|
%div = udiv i64 %a0, %a1
|
|
|
|
ret i64 %div
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @d1(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 23:48:00 +08: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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
; ACC: ddiv $zero, $4, $5
|
|
|
|
; ACC: mflo $2
|
|
|
|
; GPR: ddiv $2, $4, $5
|
2011-12-03 06:31:36 +08:00
|
|
|
%div = sdiv i64 %a0, %a1
|
|
|
|
ret i64 %div
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @d2(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 23:48:00 +08: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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
; ACC: ddivu $zero, $4, $5
|
|
|
|
; ACC: mfhi $2
|
|
|
|
; GPR: dmodu $2, $4, $5
|
2011-12-03 06:31:36 +08:00
|
|
|
%rem = urem i64 %a0, %a1
|
|
|
|
ret i64 %rem
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @d3(i64 %a0, i64 %a1) nounwind readnone {
|
|
|
|
entry:
|
2014-06-11 23:48:00 +08: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
llvm-svn: 210760
2014-06-12 18:44:10 +08:00
|
|
|
; ACC: ddiv $zero, $4, $5
|
|
|
|
; ACC: mfhi $2
|
|
|
|
; GPR: dmod $2, $4, $5
|
2011-12-03 06:31:36 +08:00
|
|
|
%rem = srem i64 %a0, %a1
|
|
|
|
ret i64 %rem
|
|
|
|
}
|