[all-commits] [llvm/llvm-project] c98e41: [LegalizeVectorTypes] Always widen fabs (#111298)

Luke Lau via All-commits all-commits at lists.llvm.org
Mon Oct 7 02:40:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c98e41f8586bc43033d29ef3ec0f9a2f79b3ec32
      https://github.com/llvm/llvm-project/commit/c98e41f8586bc43033d29ef3ec0f9a2f79b3ec32
  Author: Luke Lau <luke at igalia.com>
  Date:   2024-10-07 (Mon, 07 Oct 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp.ll

  Log Message:
  -----------
  [LegalizeVectorTypes] Always widen fabs (#111298)

fabs and fneg are similar nodes in that they can always be expanded to
integer ops, but currently they diverge when widened.

If the widened vector fabs is marked as expand (and the corresponding
scalar type is too), LegalizeVectorTypes thinks that it may be turned
into a libcall and so will unroll it to avoid the overhead on the undef
elements.

However unlike the other ops in that list like fsin, fround, flog etc.,
an fabs marked as expand will never be legalized into a libcall. Like
fneg, it can always be expanded into an integer op.

This moves it below unrollExpandedOp to bring it in line with fneg,
which fixes an issue on RISC-V with f16 fabs being unexpectedly
scalarized when there's no zfhmin.



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