diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/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,