[all-commits] [llvm/llvm-project] 8b5d9c: [x86][DAG] Unroll vectorized FREMs that will becom...

Nabeel Omer via All-commits all-commits at lists.llvm.org
Tue May 24 05:35:38 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b5d9cbbfedc7a91e3b462030e534c5982de674d
      https://github.com/llvm/llvm-project/commit/8b5d9cbbfedc7a91e3b462030e534c5982de674d
  Author: Nabeel Omer <Nabeel.Omer at sony.com>
  Date:   2022-05-24 (Tue, 24 May 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
    M llvm/test/CodeGen/X86/frem-libcall.ll

  Log Message:
  -----------
  [x86][DAG] Unroll vectorized FREMs that will become libcalls

Currently, two element vectors produced as the result of a binary op are
widened to four element vectors on x86 by
DAGTypeLegalizer::WidenVecRes_BinaryCanTrap. If the op still isn't legal
after widening it is unrolled into 4 scalar ops in SelectionDAG before
being converted into a libcall. This way we end up with 4 libcalls (two of
them on known undef elements) instead of the original two libcalls.

This patch modifies DAGTypeLegalizer::WidenVectorResult to ensure that if
it is known that a binary op will be tunred into a libcall, it is unrolled
instead of being widened. This prevents the creation of the extra scalar
instructions on known undef elements and (eventually) libacalls with known
undef parameters which would otherwise be created when the op gets expanded
post widening.

Differential Revision: https://reviews.llvm.org/D125988




More information about the All-commits mailing list