In the middle-end, (A & (signbit l>> K)) ==/!= 0 can be folded into
(A l<< K) s>=/s< 0.
When folding 'And' or 'Or' of ICmps, need to extend the iszero() check
of (A & (signbit l>> K)) to its equivalent form of (A l<< K) s>=/s< 0.
huihuiz on Jul 5 2019, 8:52 PM.Authored by
Thanks for working on this!
Thank you for catching this!
For (A & K) ==/!= 0, need to restrict one use for 'and' and 'cmp' , there is no need to check K ('shift') for more than one use.
Test cases added, please expand to see (as there is no diff)
I think this looks ok, but i'd like to see more test coverage :)
test case foo1_and_signbit_lshr_without_shifting_signbit_not_pwr2() aim to check that we are not creating additional shift instruction when fold fails.
delete the signbit shift instruction might not break the cycle of infinite "create and delete".