[all-commits] [llvm/llvm-project] 3f739f: [SelectionDAG][GISel] Make LegalizeDAG lower FNEG ...

Eli Friedman via All-commits all-commits at lists.llvm.org
Wed Sep 23 14:11:26 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f739f736b8fed6f4d63569f56c985ef04b21cd1
      https://github.com/llvm/llvm-project/commit/3f739f736b8fed6f4d63569f56c985ef04b21cd1
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2020-09-23 (Wed, 23 Sep 2020)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
    M llvm/test/CodeGen/AArch64/arm64-fp128.ll
    M llvm/test/CodeGen/ARM/GlobalISel/arm-legalize-binops.mir
    M llvm/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir
    M llvm/test/CodeGen/Thumb2/mve-fp-negabs.ll
    M llvm/test/CodeGen/X86/GlobalISel/legalize-fneg.mir

  Log Message:
  -----------
  [SelectionDAG][GISel] Make LegalizeDAG lower FNEG using integer ops.

Previously, if a floating-point type was legal, but FNEG wasn't legal,
we would use FSUB.  Instead, we should use integer ops, to preserve the
semantics.  (Alternatively, there's a compiler-rt call we could use, but
there isn't much reason to use that.)

It turns out we actually are still using this obscure codepath in a few
cases: on some targets, we have "legal" floating-point types that don't
actually support any floating-point operations.  In particular, ARM and
AArch64 are using this path.

The implementation for SelectionDAG is pretty simple because we can
reuse the infrastructure from FCOPYSIGN.

See also 9a3dc3e, the corresponding change to type legalization.

Also includes a "bonus" change to STRICT_FSUB legalization, so we can
lower a STRICT_FSUB to a float libcall.

Includes the changes to both LegalizeDAG and GlobalISel so we don't have
inconsistent results in the future.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46792 .

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




More information about the All-commits mailing list