[RISC-V] Missed Opportunity for MULHR variants
Open
backend:RISC-V
missed-optimization
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
There is a typical C code pattern, that can be implemented as a MULHR instruction.
https://godbolt.org/z/nhEje8qdc
Currently, the P extension is used for this, but only by using the widening multiplication.
The whole thing should be equivalent to a rounding MULH.
This is a common code sequence in NNs.
CMSIS-NN calls this function nn_doubling_high_mult_no_sat.
Contributor guide
Assessment
This issue has not been assessed yet.