[all-commits] [llvm/llvm-project] 19008d: [llvm] Support fixed point multiplication on AArch...

PiJoules via All-commits all-commits at lists.llvm.org
Tue May 14 11:24:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 19008d32182ebbe421aaa222ee8af5c3e134e550
      https://github.com/llvm/llvm-project/commit/19008d32182ebbe421aaa222ee8af5c3e134e550
  Author: PiJoules <6019989+PiJoules at users.noreply.github.com>
  Date:   2024-05-14 (Tue, 14 May 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    A llvm/test/CodeGen/AArch64/smul_fix.ll
    A llvm/test/CodeGen/AArch64/smul_fix_sat.ll
    A llvm/test/CodeGen/AArch64/umul_fix.ll
    A llvm/test/CodeGen/AArch64/umul_fix_sat.ll

  Log Message:
  -----------
  [llvm] Support fixed point multiplication on AArch64 (#84237)

Prior to this, fixed point multiplication would lead to this assertion
error on AArhc64, armv8, and armv7.

```
 _Accum f(_Accum x, _Accum y) { return x * y; }

// ./bin/clang++ -ffixed-point /tmp/test2.cc -c -S -o - -target aarch64 -O3
clang++: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:10245: void llvm::TargetLowering::forceExpandWideMUL(SelectionDAG &, const SDLoc &, bool, EVT, const SDValue, const SDValue, const SDValue, const SDValue, SDValue &, SDValue &) const: Assertion `Ret.getOpcode() == ISD::MERGE_VALUES && "Ret value is a collection of constituent nodes holding result."' failed.
```

This path into forceExpandWideMUL should only be taken if we don't
support [US]MUL_LOHI or MULH[US] for the operand size (32 in this case).
But we should also check if we can just leverage regular wide
multiplication. That is, extend the operands from 32 to 64, do a regular
64-bit mul, then trunc and shift. These ops are certainly available on
aarch64 but for wider types.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list