[SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 19 Jan 2017 22:41:22 +0000 (22:41 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 19 Jan 2017 22:41:22 +0000 (22:41 +0000)
commitfb32eea1b4b0f7bf2261d23250f6d0667a5b21a7
tree5a103e326f720b5c5b1e7ec75f949787e94acefb
parentda556345dcfd269af0f6a50acb661dc33d99e92d
[SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)

This patch improves the knownbits logic for unsigned integer min/max opcodes.

For UMIN we know that the result will have the maximum of the inputs' known leading zero bits in the result, similarly for UMAX the maximum of the inputs' leading one bits.

This is particularly useful for simplifying clamping patterns,. e.g. as SSE doesn't have a uitofp instruction we want to use sitofp instead where possible and for that we need to confirm that the top bit is not set.

Differential Revision: https://reviews.llvm.org/D28853

llvm-svn: 292528
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/known-bits-vector.ll