aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106741.patch
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106741.patch')
-rw-r--r--toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106741.patch255
1 files changed, 255 insertions, 0 deletions
diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106741.patch b/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106741.patch
new file mode 100644
index 0000000000..6e76c21272
--- /dev/null
+++ b/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106741.patch
@@ -0,0 +1,255 @@
+2011-04-26 Andrew Stubbs <ams@codesourcery.com>
+
+ Backport from FSF:
+
+ 2011-04-15 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ gcc/
+ * combine.c (subst, combine_simlify_rtx): Add new argument, use it
+ to track processing of conditionals. Update all callers.
+ (try_combine, simplify_if_then_else): Update.
+
+ 2011-04-25 Maxim Kuvyrkov <maxim@codesourcery.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ gcc/
+ * combine.c (combine_simplify_rtx): Avoid mis-simplifying conditionals
+ for STORE_FLAG_VALUE==-1 case.
+
+=== modified file 'gcc/combine.c'
+Index: gcc-4_6-branch/gcc/combine.c
+===================================================================
+--- gcc-4_6-branch.orig/gcc/combine.c 2012-03-05 00:16:20.000000000 -0800
++++ gcc-4_6-branch/gcc/combine.c 2012-03-05 16:05:01.212928507 -0800
+@@ -391,8 +391,8 @@
+ static void undo_all (void);
+ static void undo_commit (void);
+ static rtx *find_split_point (rtx *, rtx, bool);
+-static rtx subst (rtx, rtx, rtx, int, int);
+-static rtx combine_simplify_rtx (rtx, enum machine_mode, int);
++static rtx subst (rtx, rtx, rtx, int, int, int);
++static rtx combine_simplify_rtx (rtx, enum machine_mode, int, int);
+ static rtx simplify_if_then_else (rtx);
+ static rtx simplify_set (rtx);
+ static rtx simplify_logical (rtx);
+@@ -3119,12 +3119,12 @@
+ if (i1)
+ {
+ subst_low_luid = DF_INSN_LUID (i1);
+- i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0);
++ i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0, 0);
+ }
+ else
+ {
+ subst_low_luid = DF_INSN_LUID (i2);
+- i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0);
++ i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0, 0);
+ }
+ }
+
+@@ -3136,7 +3136,7 @@
+ self-referential RTL when we will be substituting I1SRC for I1DEST
+ later. Likewise if I0 feeds into I2, either directly or indirectly
+ through I1, and I0DEST is in I0SRC. */
+- newpat = subst (PATTERN (i3), i2dest, i2src, 0,
++ newpat = subst (PATTERN (i3), i2dest, i2src, 0, 0,
+ (i1_feeds_i2_n && i1dest_in_i1src)
+ || ((i0_feeds_i2_n || (i0_feeds_i1_n && i1_feeds_i2_n))
+ && i0dest_in_i0src));
+@@ -3180,7 +3180,7 @@
+ copy of I1SRC each time we substitute it, in order to avoid creating
+ self-referential RTL when we will be substituting I0SRC for I0DEST
+ later. */
+- newpat = subst (newpat, i1dest, i1src, 0,
++ newpat = subst (newpat, i1dest, i1src, 0, 0,
+ i0_feeds_i1_n && i0dest_in_i0src);
+ substed_i1 = 1;
+
+@@ -3214,7 +3214,7 @@
+
+ n_occurrences = 0;
+ subst_low_luid = DF_INSN_LUID (i0);
+- newpat = subst (newpat, i0dest, i0src, 0, 0);
++ newpat = subst (newpat, i0dest, i0src, 0, 0, 0);
+ substed_i0 = 1;
+ }
+
+@@ -3276,7 +3276,7 @@
+ {
+ rtx t = i1pat;
+ if (i0_feeds_i1_n)
+- t = subst (t, i0dest, i0src_copy ? i0src_copy : i0src, 0, 0);
++ t = subst (t, i0dest, i0src_copy ? i0src_copy : i0src, 0, 0, 0);
+
+ XVECEXP (newpat, 0, --total_sets) = t;
+ }
+@@ -3284,10 +3284,10 @@
+ {
+ rtx t = i2pat;
+ if (i1_feeds_i2_n)
+- t = subst (t, i1dest, i1src_copy ? i1src_copy : i1src, 0,
++ t = subst (t, i1dest, i1src_copy ? i1src_copy : i1src, 0, 0,
+ i0_feeds_i1_n && i0dest_in_i0src);
+ if ((i0_feeds_i1_n && i1_feeds_i2_n) || i0_feeds_i2_n)
+- t = subst (t, i0dest, i0src_copy2 ? i0src_copy2 : i0src, 0, 0);
++ t = subst (t, i0dest, i0src_copy2 ? i0src_copy2 : i0src, 0, 0, 0);
+
+ XVECEXP (newpat, 0, --total_sets) = t;
+ }
+@@ -4959,11 +4959,13 @@
+
+ IN_DEST is nonzero if we are processing the SET_DEST of a SET.
+
++ IN_COND is nonzero if we are on top level of the condition.
++
+ UNIQUE_COPY is nonzero if each substitution must be unique. We do this
+ by copying if `n_occurrences' is nonzero. */
+
+ static rtx
+-subst (rtx x, rtx from, rtx to, int in_dest, int unique_copy)
++subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
+ {
+ enum rtx_code code = GET_CODE (x);
+ enum machine_mode op0_mode = VOIDmode;
+@@ -5024,7 +5026,7 @@
+ && GET_CODE (XVECEXP (x, 0, 0)) == SET
+ && GET_CODE (SET_SRC (XVECEXP (x, 0, 0))) == ASM_OPERANDS)
+ {
+- new_rtx = subst (XVECEXP (x, 0, 0), from, to, 0, unique_copy);
++ new_rtx = subst (XVECEXP (x, 0, 0), from, to, 0, 0, unique_copy);
+
+ /* If this substitution failed, this whole thing fails. */
+ if (GET_CODE (new_rtx) == CLOBBER
+@@ -5041,7 +5043,7 @@
+ && GET_CODE (dest) != CC0
+ && GET_CODE (dest) != PC)
+ {
+- new_rtx = subst (dest, from, to, 0, unique_copy);
++ new_rtx = subst (dest, from, to, 0, 0, unique_copy);
+
+ /* If this substitution failed, this whole thing fails. */
+ if (GET_CODE (new_rtx) == CLOBBER
+@@ -5087,8 +5089,8 @@
+ }
+ else
+ {
+- new_rtx = subst (XVECEXP (x, i, j), from, to, 0,
+- unique_copy);
++ new_rtx = subst (XVECEXP (x, i, j), from, to, 0, 0,
++ unique_copy);
+
+ /* If this substitution failed, this whole thing
+ fails. */
+@@ -5165,7 +5167,9 @@
+ && (code == SUBREG || code == STRICT_LOW_PART
+ || code == ZERO_EXTRACT))
+ || code == SET)
+- && i == 0), unique_copy);
++ && i == 0),
++ code == IF_THEN_ELSE && i == 0,
++ unique_copy);
+
+ /* If we found that we will have to reject this combination,
+ indicate that by returning the CLOBBER ourselves, rather than
+@@ -5222,7 +5226,7 @@
+ /* If X is sufficiently simple, don't bother trying to do anything
+ with it. */
+ if (code != CONST_INT && code != REG && code != CLOBBER)
+- x = combine_simplify_rtx (x, op0_mode, in_dest);
++ x = combine_simplify_rtx (x, op0_mode, in_dest, in_cond);
+
+ if (GET_CODE (x) == code)
+ break;
+@@ -5242,10 +5246,12 @@
+ expression.
+
+ OP0_MODE is the original mode of XEXP (x, 0). IN_DEST is nonzero
+- if we are inside a SET_DEST. */
++ if we are inside a SET_DEST. IN_COND is nonzero if we are on the top level
++ of a condition. */
+
+ static rtx
+-combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest)
++combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
++ int in_cond)
+ {
+ enum rtx_code code = GET_CODE (x);
+ enum machine_mode mode = GET_MODE (x);
+@@ -5300,8 +5306,8 @@
+ false arms to store-flag values. Be careful to use copy_rtx
+ here since true_rtx or false_rtx might share RTL with x as a
+ result of the if_then_else_cond call above. */
+- true_rtx = subst (copy_rtx (true_rtx), pc_rtx, pc_rtx, 0, 0);
+- false_rtx = subst (copy_rtx (false_rtx), pc_rtx, pc_rtx, 0, 0);
++ true_rtx = subst (copy_rtx (true_rtx), pc_rtx, pc_rtx, 0, 0, 0);
++ false_rtx = subst (copy_rtx (false_rtx), pc_rtx, pc_rtx, 0, 0, 0);
+
+ /* If true_rtx and false_rtx are not general_operands, an if_then_else
+ is unlikely to be simpler. */
+@@ -5645,7 +5651,7 @@
+ {
+ /* Try to simplify the expression further. */
+ rtx tor = simplify_gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1));
+- temp = combine_simplify_rtx (tor, VOIDmode, in_dest);
++ temp = combine_simplify_rtx (tor, VOIDmode, in_dest, 0);
+
+ /* If we could, great. If not, do not go ahead with the IOR
+ replacement, since PLUS appears in many special purpose
+@@ -5738,7 +5744,16 @@
+ ZERO_EXTRACT is indeed appropriate, it will be placed back by
+ the call to make_compound_operation in the SET case. */
+
+- if (STORE_FLAG_VALUE == 1
++ if (in_cond)
++ /* Don't apply below optimizations if the caller would
++ prefer a comparison rather than a value.
++ E.g., for the condition in an IF_THEN_ELSE most targets need
++ an explicit comparison. */
++ {
++ ;
++ }
++
++ else if (STORE_FLAG_VALUE == 1
+ && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
+ && op1 == const0_rtx
+ && mode == GET_MODE (op0)
+@@ -5784,7 +5799,10 @@
+
+ /* If STORE_FLAG_VALUE is -1, we have cases similar to
+ those above. */
+- if (STORE_FLAG_VALUE == -1
++ if (in_cond)
++ ;
++
++ else if (STORE_FLAG_VALUE == -1
+ && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
+ && op1 == const0_rtx
+ && (num_sign_bit_copies (op0, mode)
+@@ -5982,11 +6000,11 @@
+ if (reg_mentioned_p (from, true_rtx))
+ true_rtx = subst (known_cond (copy_rtx (true_rtx), true_code,
+ from, true_val),
+- pc_rtx, pc_rtx, 0, 0);
++ pc_rtx, pc_rtx, 0, 0, 0);
+ if (reg_mentioned_p (from, false_rtx))
+ false_rtx = subst (known_cond (copy_rtx (false_rtx), false_code,
+ from, false_val),
+- pc_rtx, pc_rtx, 0, 0);
++ pc_rtx, pc_rtx, 0, 0, 0);
+
+ SUBST (XEXP (x, 1), swapped ? false_rtx : true_rtx);
+ SUBST (XEXP (x, 2), swapped ? true_rtx : false_rtx);
+@@ -6203,11 +6221,11 @@
+ {
+ temp = subst (simplify_gen_relational (true_code, m, VOIDmode,
+ cond_op0, cond_op1),
+- pc_rtx, pc_rtx, 0, 0);
++ pc_rtx, pc_rtx, 0, 0, 0);
+ temp = simplify_gen_binary (MULT, m, temp,
+ simplify_gen_binary (MULT, m, c1,
+ const_true_rtx));
+- temp = subst (temp, pc_rtx, pc_rtx, 0, 0);
++ temp = subst (temp, pc_rtx, pc_rtx, 0, 0, 0);
+ temp = simplify_gen_binary (op, m, gen_lowpart (m, z), temp);
+
+ if (extend_op != UNKNOWN)