[PATCH] D19391: transform masking off of an FP sign bit into a fabs...but only if it's legal!

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 14:37:42 PDT 2016


spatel created this revision.
spatel added reviewers: escha, scanon, hfinkel, t.p.northover.
spatel added a subscriber: llvm-commits.
Herald added subscribers: mcrosier, aemerson.

This is effectively a revert of:
http://reviews.llvm.org/rL249702
and a reimplementation as a DAG combine for targets that have a legal FABS instruction.

This is intended to resolve the objections raised on the dev list:
http://lists.llvm.org/pipermail/llvm-dev/2016-April/098154.html
and:
https://llvm.org/bugs/show_bug.cgi?id=24886#c4

Presumably, if a target has declared FABS legal for the given type, then it is cheap and won't touch any bits that it's not supposed to.

Note that x86-64 does not have a dedicated FABS instruction in SSE; it has general-purpose FP bit manipulation instructions instead. So this transform doesn't fire for x86, but this pattern is matched more generally by the x86 backend. 

I opted for AArch64 and PPC tests since they both have instructions for this op. MIPS also benefits, but I figured two test targets provide enough coverage.

http://reviews.llvm.org/D19391

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/CodeGen/AArch64/fcvt-int.ll
  test/CodeGen/PowerPC/fabs.ll
  test/Transforms/InstCombine/and2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19391.54577.patch
Type: text/x-patch
Size: 4783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/ed04c119/attachment.bin>


More information about the llvm-commits mailing list