[PATCH] Fix up noce_try_abs again (PR rtl-optimization/68670)
Bernd Schmidt
bschmidt@redhat.com
Thu Dec 10 13:20:00 GMT 2015
On 12/09/2015 11:37 PM, Jakub Jelinek wrote:
> Not sure what I've been thinking when writing the previous noce_try_abs fix.
> I thought that the optimization can be applied for all the conditions,
> and whether it can be applied depends on if it is cond ? ~x : x or
> cond ? x : ~x. But that is not the case, the optimization can be only
> applied to a subset of conditions, and when it can be applied, it can be
> applied to both the cond ? ~x : x and cond ? x : ~x cases (depending on
> the condition one is one_cmpl_abs (x) and the other ~one_cmpl_abs (x)).
Odd, I thought you made a good argument last time :-( Sorry for not
catching the problem.
> switch (GET_CODE (cond))
> {
> - case GT:
> - if (!negate)
> - return FALSE;
> - break;
> case GE:
> - /* >= 0 is the same case as above > -1. */
> - if (negate)
> - return FALSE;
> - break;
> case LT:
> - if (negate)
> - return FALSE;
> - break;
> - case LE:
> - /* <= 0 is the same case as above < 1. */
> - if (!negate)
> - return FALSE;
> break;
> default:
> return FALSE;
This turns into a much simpler if statement, doesn't it? Ok with that
change.
> +/* PR rtl-optimization/68670 */
> +/* { dg-do run } */
> +/* { dg-options "-O2 -ftracer" } */
Curious what effect -ftracer has here?
Bernd
More information about the Gcc-patches
mailing list