[RISCV] SMUL_LOHI/UMUL_LOHI should expand for RVV.
authorCraig Topper <craig.topper@sifive.com>
Mon, 8 Nov 2021 17:25:10 +0000 (09:25 -0800)
committerCraig Topper <craig.topper@sifive.com>
Mon, 8 Nov 2021 17:38:36 +0000 (09:38 -0800)
These and MULHS/MULHU both default to Legal. Targets need to set
the ones they don't support to Expand.

I think MULHS/MULHU likely has priority in most places so this
change probably isn't directly testable. I found it while looking
at disabling MULHS/MULHU for nxvXi64 as required for Zve64x.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D113325

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

index 372685d..9d8d11e 100644 (file)
@@ -533,6 +533,10 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
       setOperationAction(ISD::SPLAT_VECTOR, VT, Legal);
       setOperationAction(ISD::SPLAT_VECTOR_PARTS, VT, Custom);
 
+      // Vectors implement MULHS/MULHU.
+      setOperationAction(ISD::SMUL_LOHI, VT, Expand);
+      setOperationAction(ISD::UMUL_LOHI, VT, Expand);
+
       setOperationAction(ISD::SMIN, VT, Legal);
       setOperationAction(ISD::SMAX, VT, Legal);
       setOperationAction(ISD::UMIN, VT, Legal);