[PATCH] D67557: [DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 08:39:44 PDT 2019


RKSimon created this revision.
RKSimon added reviewers: spatel, efriedma, arsenm, craig.topper.
Herald added subscribers: tpr, wdng.
Herald added a project: LLVM.

This patch converts the DAGCombine isNegatibleForFree/GetNegatedExpression into overridable TLI hooks and includes a demonstration X86 implementation.

The intention is to let us extend existing FNEG combines to work more generally with negatible float ops, allowing it work with target specific combines and opcodes (e.g. X86's FMA variants).

Unlike the SimplifyDemandedBits, we can't just handle target nodes through a Target callback, we need to do this as an override to allow targets to handle generic opcodes as well. This does mean that the target implementations has to duplicate some checks (recursion depth etc.).

I've only begun to replace X86's FNEG handling here, handling FMADDSUB/FMSUBADD negation and some low impact codegen changes (some FMA negatation propagation). We can build on this in future patches.

@arsenm I haven't touched AMDGPUTargetLowering::performFNegCombine but the idea would be that this is refactored as well. I don't think I've missed anything you'd need, but if you wish I can attempt an initial implementation.


Repository:
  rL LLVM

https://reviews.llvm.org/D67557

Files:
  include/llvm/CodeGen/TargetLowering.h
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  test/CodeGen/X86/recip-fastmath.ll
  test/CodeGen/X86/recip-fastmath2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67557.220112.patch
Type: text/x-patch
Size: 56730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190913/3d160472/attachment.bin>


More information about the llvm-commits mailing list