[PATCH] D82660: [RISCV] Optimize multiplication by specific immediates

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 09:10:19 PDT 2020


benshi001 marked an inline comment as done.
benshi001 added a comment.

In D82660#2127626 <https://reviews.llvm.org/D82660#2127626>, @lenary wrote:

> I'm happy with this optimisation where this patch removes multiply libcalls.
>
> Where the target has a the m extension, and especially for 64-bit multiplies on rv32im, I'm not sure this is an optimisation.
>
> I think that, for the moment, we should add a guard to the hook to avoid this transformation where we do have mul instructions:
>
>   if (Subtarget.hasStdExtM())
>     return false;
>
>
> What do you think?


Shall we loose the guard condition to that ? 
if (!Subtarget.is64Bit && Subtarget.hasStdExtM())

  return false;

This will prevent the optimization for RV32IM, but still work for RV64IM。

I think a mul-instruction's latency is sure to be >=2, so most test cases will not have regresion.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82660/new/

https://reviews.llvm.org/D82660





More information about the llvm-commits mailing list