[PATCH] D72643: [InstCombine] form copysign from select of FP constants (PR44153)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 13:43:19 PST 2020


spatel created this revision.
spatel added reviewers: lebedev.ri, xbolva00, kaniandr.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.
spatel edited reviewers, added: nick; removed: kaniandr.

This should be the last step needed to solve the problem in the description of PR44153:
https://bugs.llvm.org/show_bug.cgi?id=44153

If we're casting an FP value to int, testing its signbit, and then choosing between a value and its negated value, that's a complicated way of saying "copysign":

  (bitcast X) <  0 ? -TC :  TC --> copysign(TC,  X)


https://reviews.llvm.org/D72643

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72643.237765.patch
Type: text/x-patch
Size: 5630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200113/77533565/attachment.bin>


More information about the llvm-commits mailing list