This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix up noce_try_abs again (PR rtl-optimization/68670)
- From: Bernd Schmidt <bschmidt at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Dec 2015 14:20:04 +0100
- Subject: Re: [PATCH] Fix up noce_try_abs again (PR rtl-optimization/68670)
- Authentication-results: sourceware.org; auth=none
- References: <20151209223703 dot GW5675 at tucnak dot redhat dot com>
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