aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 2ade695b980..ab4e6d5887b 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -967,9 +967,11 @@ simplify_unary_operation (enum rtx_code code, enum machine_mode mode,
if (GET_CODE (op) == NEG)
return XEXP (op, 0);
+ /* APPLE LOCAL disallow generating NOT (sym) */
/* (neg (plus X 1)) can become (not X). */
if (GET_CODE (op) == PLUS
- && XEXP (op, 1) == const1_rtx)
+ && XEXP (op, 1) == const1_rtx
+ && GET_CODE (XEXP (op, 0)) != SYMBOL_REF)
return simplify_gen_unary (NOT, mode, XEXP (op, 0), mode);
/* Similarly, (neg (not X)) is (plus X 1). */
@@ -987,9 +989,11 @@ simplify_unary_operation (enum rtx_code code, enum machine_mode mode,
return simplify_gen_binary (MINUS, mode, XEXP (op, 1),
XEXP (op, 0));
+ /* APPLE LOCAL don't allow subtraction of symbol address */
if (GET_CODE (op) == PLUS
&& !HONOR_SIGNED_ZEROS (mode)
- && !HONOR_SIGN_DEPENDENT_ROUNDING (mode))
+ && !HONOR_SIGN_DEPENDENT_ROUNDING (mode)
+ && GET_CODE (XEXP (op, 0)) != SYMBOL_REF)
{
/* (neg (plus A C)) is simplified to (minus -C A). */
if (GET_CODE (XEXP (op, 1)) == CONST_INT
@@ -1572,7 +1576,11 @@ simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
return simplify_gen_unary (NEG, mode, op1, mode);
/* (-1 - a) is ~a. */
- if (trueop0 == constm1_rtx)
+ /* APPLE LOCAL disallow (not (SYM))
+ But not when a is relocatable (this arises temporarily when
+ pulling 386 global addresses out of a loop). */
+ if (trueop0 == constm1_rtx
+ && GET_CODE (op1) != SYMBOL_REF )
return simplify_gen_unary (NOT, mode, op1, mode);
/* Subtracting 0 has no effect unless the mode has signed zeros