[RISCVISelLowering] avoid emitting libcalls to __mulodi4() and __multi3()
authorNick Desaulniers <ndesaulniers@google.com>
Tue, 31 Aug 2021 18:11:40 +0000 (11:11 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Tue, 31 Aug 2021 18:23:56 +0000 (11:23 -0700)
commite9b3f2573090a2fb9494975e4615f77b898e36a3
tree00e2bbf955c298faff5da310d92ccc28a5361bba
parentbf8b69bb3ad3e62e936f4a02c7115538a0879bf6
[RISCVISelLowering] avoid emitting libcalls to __mulodi4() and __multi3()

Similar to D108842, D108844, D108926, D108928, and D108936.

__has_builtin(builtin_mul_overflow) returns true for 32b RISCV targets,
but Clang is deferring to compiler RT when encountering long long types.

If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.

Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D108939
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/mul.ll
llvm/test/CodeGen/RISCV/overflow-intrinsic-optimizations.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/umulo-128-legalisation-lowering.ll
llvm/test/CodeGen/RISCV/xaluo.ll