summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
diff options
context:
space:
mode:
authorPetar Avramovic <Petar.Avramovic@rt-rk.com>2018-12-18 15:59:51 +0000
committerPetar Avramovic <Petar.Avramovic@rt-rk.com>2018-12-18 15:59:51 +0000
commit0a5e4eb77669253af615d4b32567897bba23642f (patch)
treea09ddb72455276b9bdb78cb36cda0fb29809e456 /llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
parent0d38e4fd2c0ed5d9a579cf40e2ab8634f9a779f6 (diff)
downloadbcm5719-llvm-0a5e4eb77669253af615d4b32567897bba23642f.tar.gz
bcm5719-llvm-0a5e4eb77669253af615d4b32567897bba23642f.zip
[MIPS GlobalISel] Select G_SDIV, G_UDIV, G_SREM and G_UREM
Add support for s64 libcalls for G_SDIV, G_UDIV, G_SREM and G_UREM and use integer type of correct size when creating arguments for CLI.lowerCall. Select G_SDIV, G_UDIV, G_SREM and G_UREM for types s8, s16, s32 and s64 on MIPS32. Differential Revision: https://reviews.llvm.org/D55651 llvm-svn: 349499
Diffstat (limited to 'llvm/lib/Target/Mips/MipsLegalizerInfo.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsLegalizerInfo.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp b/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
index 9178ac874c5..0d80bd479d5 100644
--- a/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
+++ b/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
@@ -22,6 +22,7 @@ MipsLegalizerInfo::MipsLegalizerInfo(const MipsSubtarget &ST) {
const LLT s1 = LLT::scalar(1);
const LLT s32 = LLT::scalar(32);
+ const LLT s64 = LLT::scalar(64);
const LLT p0 = LLT::pointer(0, 32);
getActionDefinitionsBuilder(G_ADD)
@@ -41,6 +42,11 @@ MipsLegalizerInfo::MipsLegalizerInfo(const MipsSubtarget &ST) {
getActionDefinitionsBuilder({G_SHL, G_ASHR, G_LSHR})
.legalFor({s32});
+ getActionDefinitionsBuilder({G_SDIV, G_SREM, G_UREM, G_UDIV})
+ .legalFor({s32})
+ .minScalar(0, s32)
+ .libcallFor({s64});
+
getActionDefinitionsBuilder(G_ICMP)
.legalFor({{s32, s32}})
.minScalar(0, s32);
OpenPOWER on IntegriCloud