[llvm] [RISCV][GISel] Legalize G_SMULO/G_UMULO (PR #67635)
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 13 17:00:15 PDT 2023
================
@@ -145,13 +145,31 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
.legalFor({XLenLLT})
.lower();
// clang-format on
+
+ getActionDefinitionsBuilder({G_SMULO, G_UMULO})
+ .minScalar(0, XLenLLT)
+ .lower();
} else {
getActionDefinitionsBuilder(G_MUL)
.libcallFor({XLenLLT, DoubleXLenLLT})
.widenScalarToNextPow2(0)
.clampScalar(0, XLenLLT, DoubleXLenLLT);
getActionDefinitionsBuilder({G_SMULH, G_UMULH}).lowerFor({XLenLLT});
+
+ getActionDefinitionsBuilder({G_SMULO, G_UMULO})
+ .minScalar(0, XLenLLT)
+ // Widen XLenLLT to DoubleXLenLLT so we can use a single libcall to get
+ // the low bits for the mul result and high bits to do the overflow
+ // check.
+ .widenScalarIf(
+ [=, &ST](const LegalityQuery &Query) {
----------------
aemerson wrote:
No need for `ST`?
https://github.com/llvm/llvm-project/pull/67635
More information about the llvm-commits
mailing list