[PATCH] D43338: [SelectionDAG] ComputeNumSignBits - add support for SMIN+SMAX clamp patterns

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 09:00:22 PST 2018


RKSimon created this revision.
RKSimon added reviewers: efriedma, majnemer, zvi, craig.topper, spatel.

If we have a clamp pattern, SMIN(SMAX(X, LO),HI) or SMAX(SMIN(X, HI),LO) then we can deduce that the number of signbits will be at least the minimum of the LO and HI constants.

I haven't bothered with the UMIN/UMAX equivalent as (1) we don't have any current use cases and (2) I wonder if we'd be better off immediately falling back for ComputeKnownBits for UMIN/UMAX which already has optimization patterns useful for unsigned cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D43338

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  test/CodeGen/X86/i64-to-float.ll
  test/CodeGen/X86/vector-trunc-packus.ll
  test/CodeGen/X86/vector-trunc-ssat.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43338.134441.patch
Type: text/x-patch
Size: 166195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180215/1d1b9711/attachment-0001.bin>


More information about the llvm-commits mailing list