[PATCH] D84287: [SelectionDAG] Make LegalizeDAG lower FNEG using integer ops.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 18:22:26 PDT 2020


efriedma created this revision.
efriedma added reviewers: MatzeB, arsenm, hfinkel, craig.topper, RKSimon, dmgreen.
Herald added subscribers: hiraditya, kristof.beyls, wdng.
Herald added a project: LLVM.

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 is pretty simple because we can reuse the infrastructure from FCOPYSIGN.

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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84287

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  llvm/test/CodeGen/AArch64/arm64-fp128.ll
  llvm/test/CodeGen/Thumb2/mve-fp-negabs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84287.279688.patch
Type: text/x-patch
Size: 4215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/15bf77d9/attachment.bin>


More information about the llvm-commits mailing list