diff mbox

[i386] : Fix logical 'not' error in x86_rtx_costs (PR 61271)

Message ID CAFULd4YBSpK19OApf3u5DM2sJGmW4Sieka1V0M3o0o=D-x0V2Q@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak May 26, 2014, 5:51 p.m. UTC
On Mon, May 26, 2014 at 7:48 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> There is a stray ! in ix86_rtx_costs which results in an invalid
> bypass for LABEL_REFs. After some simplifications, the fixed condition
> should read:
>
>       else if (flag_pic && SYMBOLIC_CONST (x)
>            && !(TARGET_64BIT
>             && (GET_CODE (x) == LABEL_REF
>             || (GET_CODE (x) == SYMBOL_REF
>                 && SYMBOL_REF_LOCAL_P (x)))))
>     *total = 1;
>
> The patch fixes the condition, but I don't think that handling of
> LABEL_REFs and SYMBOL_REFs is correct in the cost function at all.
> E.g. in x86_64_immediate_operand predicate, LABEL_REFs (and non-TLS
> SYMBOL_REFs) are rejected for all PIC code models, so they get cost of
> 3 and don't even reach this part of the function.
>
> Honza, can you perhaps check if x86_64{,_zext}_immediate operand
> handles PIC code models in a correct way?
>
> The trivial patch is bootstrapped and regression tested on
> x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Eh, wrong patch was attached. And ChangeLog was missing, too.

2014-05-26  Uros Bizjak  <ubizjak@gmail.com>

    PR target/61271
    * config/i386/i386.c (ix86_rtx_costs)
    <case CONST_INT, case CONST, case LABEL_REF, case SYMBOL_REF>:
    Fix condition.

Uros.
diff mbox

Patch

Index: i386.c
===================================================================
--- i386.c	(revision 210889)
+++ i386.c	(working copy)
@@ -37903,10 +37903,10 @@ 
       else if (TARGET_64BIT && !x86_64_zext_immediate_operand (x, VOIDmode))
 	*total = 2;
       else if (flag_pic && SYMBOLIC_CONST (x)
-	       && (!TARGET_64BIT
-		   || (!GET_CODE (x) != LABEL_REF
-		       && (GET_CODE (x) != SYMBOL_REF
-		           || !SYMBOL_REF_LOCAL_P (x)))))
+	       && !(TARGET_64BIT
+		    && (GET_CODE (x) == LABEL_REF
+			|| (GET_CODE (x) == SYMBOL_REF
+			    && SYMBOL_REF_LOCAL_P (x)))))
 	*total = 1;
       else
 	*total = 0;