Re: [PATCH] Fix ctz issues (PR93231)

2020-01-15 Thread Jakub Jelinek
On Wed, Jan 15, 2020 at 03:50:01PM +, Wilco Dijkstra wrote: > The multiply can be signed or unsigned, and the immediate can be positive or > negative, but the shift must be unsigned indeed. I thought the match.pd > pattern only allows unsigned shifts, but the shift operator allows signed > shi

Re: [PATCH] Fix ctz issues (PR93231)

2020-01-15 Thread Wilco Dijkstra
Hi Jakub, >> (note the diff uses the old tree and includes Jakub's bootstrap fixes) > You should rebase it because you'll be committing it against trunk > which already has those changes. Sure, it was just the small matter of updating the many GCC checkouts I have... >> -  unsigned shiftval = tr

Re: [PATCH] Fix ctz issues (PR93231)

2020-01-13 Thread Jakub Jelinek
On Mon, Jan 13, 2020 at 05:30:23PM +, Wilco Dijkstra wrote: > Further improve the ctz recognition: Avoid ICEing on negative shift > counts or multiply constants. Check the type is 8 bits for the string > constant case to avoid accidentally matching a wide STRING_CST. > Add a tree_expr_nonzero_

[PATCH] Fix ctz issues (PR93231)

2020-01-13 Thread Wilco Dijkstra
Further improve the ctz recognition: Avoid ICEing on negative shift counts or multiply constants. Check the type is 8 bits for the string constant case to avoid accidentally matching a wide STRING_CST. Add a tree_expr_nonzero_p check to allow the optimization even if CTZ_DEFINED_VALUE_AT_ZERO retu