https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64946

--- Comment #17 from Shiva Chen <shiva0217 at gmail dot com> ---
Hi, Richard

Thanks for the explanation :)

So the transformation (short)abs((int)short_var) -> abs (short_var)

should guard by TYPE_OVERFLOW_WRAPS 

because when TYPE_OVERFLOW_WRAPS is true, signed operation could wrap
around.(ABS_EXPR in gimple could wrap around and rtl abs already modulo)

Therefore, the transformation is valid when TYPE_OVERFLOW_WRAPS is true.

It seems the last update of Matthew's patch in
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00433.html
still make sense.

Why would it be dropped, or there're still something we should consider ?


If we implement ABSU_EXPR, when should transfer 
ABS_EXPR (x) -> (type of x) ABSU_EXPR (x) ?

Could we define like if (!TYPE_OVERFLOW_WRAPS) then transfer ABS_EXPR (x) ->
(type of x) ABSU_EXPR (x) in match.pd ?

How to expand (type of x) ABSU_EXPR (x) to rtl ?

Do we have to add a new naming pattern absu ?

Reply via email to