[PATCH, i386]: Fix logical 'not' error in x86_rtx_costs (PR 61271)
Uros Bizjak
ubizjak@gmail.com
Mon May 26 17:48:00 GMT 2014
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.
-------------- next part --------------
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;
More information about the Gcc-patches
mailing list