[DAGCombiner] fold 'not' with signbit math
authorSanjay Patel <spatel@rotateright.com>
Fri, 27 Jul 2018 16:42:55 +0000 (16:42 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 27 Jul 2018 16:42:55 +0000 (16:42 +0000)
commitc7abb416dcc8b58fe9a4233f2af0e31b0c342ca6
treeb9894c248265286ef3b73acbaebb9345111caa99
parent1812d33e22beb15da22aadfffc57567989a19110
[DAGCombiner] fold 'not' with signbit math

This is a follow-up suggested in D48970.

Alive proofs:
https://rise4fun.com/Alive/sII

We can eliminate an instruction in the usual select-of-constants
to bit hack transform by adjusting the add/sub with constant.
This is always a win.

There are more transforms that are likely wins, but they may need
target hooks in case some targets do not benefit.

This is another step towards making up for canonicalizing to
select-of-constants in rL331486.

llvm-svn: 338132
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/signbit-shift.ll
llvm/test/CodeGen/PowerPC/signbit-shift.ll
llvm/test/CodeGen/X86/signbit-shift.ll