[Hexagon] Improve handling of 32-bit mulh/mul_lohi on HVX
authorKrzysztof Parzyszek <kparzysz@quicinc.com>
Wed, 12 Oct 2022 15:09:25 +0000 (08:09 -0700)
committerKrzysztof Parzyszek <kparzysz@quicinc.com>
Sat, 22 Oct 2022 22:08:27 +0000 (15:08 -0700)
commit2ec380b23f2e7058a1732582f890f9b41fd94175
tree40a6a817fc9a7e0ba7e9edfda21a69f4ef0e0030
parentdeb197ffa3416176fa8f55118287e9eeea3babe0
[Hexagon] Improve handling of 32-bit mulh/mul_lohi on HVX

Handle MULH[US] by normalizing them into newly invented nodes
HexagonISD::(S|U|US)MUL_LOHI. On HVX v60, if only the high part of
SMUL_LOHI is used, use the original MULHS expansion. In all other
cases, expand the full product.
On HVX v62, always expand the full product.

Introduce Hexagon-specific LLVM IR intrinsics for 32x32 multiplication
returning low/high parts.
llvm/include/llvm/IR/IntrinsicsHexagon.td
llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
llvm/lib/Target/Hexagon/HexagonISelLowering.h
llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
llvm/lib/Target/Hexagon/HexagonPatterns.td
llvm/lib/Target/Hexagon/HexagonPatternsHVX.td
llvm/test/CodeGen/Hexagon/autohvx/mulh.ll
llvm/test/CodeGen/Hexagon/autohvx/vmpy-parts.ll [new file with mode: 0644]