[PATCH] D151178: [RISCV][NFC] Simplify code.
Jianjian Guan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 22 20:46:56 PDT 2023
jacquesguan created this revision.
jacquesguan added reviewers: craig.topper, asb, luismarques, frasercrmck, benshi001.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
jacquesguan requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
Reduce scope of if-else statements.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151178
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -264,25 +264,19 @@
setLibcallName(RTLIB::MULO_I64, nullptr);
}
- if (!Subtarget.hasStdExtM() && !Subtarget.hasStdExtZmmul()) {
+ if (!Subtarget.hasStdExtM() && !Subtarget.hasStdExtZmmul())
setOperationAction({ISD::MUL, ISD::MULHS, ISD::MULHU}, XLenVT, Expand);
- } else {
- if (Subtarget.is64Bit()) {
- setOperationAction(ISD::MUL, {MVT::i32, MVT::i128}, Custom);
- } else {
- setOperationAction(ISD::MUL, MVT::i64, Custom);
- }
- }
+ else if (Subtarget.is64Bit())
+ setOperationAction(ISD::MUL, {MVT::i32, MVT::i128}, Custom);
+ else
+ setOperationAction(ISD::MUL, MVT::i64, Custom);
- if (!Subtarget.hasStdExtM()) {
+ if (!Subtarget.hasStdExtM())
setOperationAction({ISD::SDIV, ISD::UDIV, ISD::SREM, ISD::UREM},
XLenVT, Expand);
- } else {
- if (Subtarget.is64Bit()) {
- setOperationAction({ISD::SDIV, ISD::UDIV, ISD::UREM},
- {MVT::i8, MVT::i16, MVT::i32}, Custom);
- }
- }
+ else if (Subtarget.is64Bit())
+ setOperationAction({ISD::SDIV, ISD::UDIV, ISD::UREM},
+ {MVT::i8, MVT::i16, MVT::i32}, Custom);
setOperationAction(
{ISD::SDIVREM, ISD::UDIVREM, ISD::SMUL_LOHI, ISD::UMUL_LOHI}, XLenVT,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151178.524560.patch
Type: text/x-patch
Size: 1470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230523/55da9909/attachment.bin>
More information about the llvm-commits
mailing list