On Mon, May 26, 2014 at 7:48 PM, Uros Bizjak <[email protected]> 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 <[email protected]>
PR target/61271
* config/i386/i386.c (ix86_rtx_costs)
<case CONST_INT, case CONST, case LABEL_REF, case SYMBOL_REF>:
Fix condition.
Uros.
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;