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. Uros.
Index: i386.c =================================================================== --- i386.c (revision 210937) +++ i386.c (working copy) @@ -37903,10 +37903,10 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_ 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;