PR middle-end/32897
* reload.c (find_reloads): Check that the memory returned by
find_reloads_toplev was not the result of forcing a constant
to memory.
(find_reloads_toplev): Always use simplify_gen_subreg to get
the subreg of a constant. If the result is also a constant,
but not a legitimate one, force it into the constant pool
and reload its address.
gcc/testsuite/
* gcc.dg/torture/pr32897.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127536
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-08-16 Richard Sandiford <richard@codesourcery.com>
+
+ PR middle-end/32897
+ * reload.c (find_reloads): Check that the memory returned by
+ find_reloads_toplev was not the result of forcing a constant
+ to memory.
+ (find_reloads_toplev): Always use simplify_gen_subreg to get
+ the subreg of a constant. If the result is also a constant,
+ but not a legitimate one, force it into the constant pool
+ and reload its address.
+
2007-08-15 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_rtx_costs): Add CLZ, CTZ, and
&& MEM_P (op)
&& REG_P (reg)
&& (GET_MODE_SIZE (GET_MODE (reg))
- >= GET_MODE_SIZE (GET_MODE (op))))
+ >= GET_MODE_SIZE (GET_MODE (op)))
+ && reg_equiv_constant[REGNO (reg)] == 0)
set_unique_reg_note (emit_insn_before (gen_rtx_USE (VOIDmode, reg),
insn),
REG_EQUAL, reg_equiv_memory_loc[REGNO (reg)]);
int regno = REGNO (SUBREG_REG (x));
rtx tem;
- if (subreg_lowpart_p (x)
- && regno >= FIRST_PSEUDO_REGISTER
- && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0
- && (tem = gen_lowpart_common (GET_MODE (x),
- reg_equiv_constant[regno])) != 0)
- return tem;
-
if (regno >= FIRST_PSEUDO_REGISTER
&& reg_renumber[regno] < 0
&& reg_equiv_constant[regno] != 0)
simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno],
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
gcc_assert (tem);
+ if (CONSTANT_P (tem) && !LEGITIMATE_CONSTANT_P (tem))
+ {
+ tem = force_const_mem (GET_MODE (x), tem);
+ i = find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
+ &XEXP (tem, 0), opnum, type,
+ ind_levels, insn);
+ if (address_reloaded)
+ *address_reloaded = i;
+ }
return tem;
}
+2007-08-16 Richard Sandiford <richard@codesourcery.com>
+
+ * gcc.dg/torture/pr32897.c: New test.
+
2007-08-16 Paolo Carlini <pcarlini@suse.de>
PR c++/31132
--- /dev/null
+/* { dg-options "-G0" { target mips*-*-* } } */
+
+volatile int g[32];
+long long gll;
+double gd;
+
+#define MULTI(X) \
+ X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), X(10), \
+ X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19), X(20), \
+ X(21), X(22), X(23), X(24), X(25), X(26), X(27), X(28), X(29), X(30)
+
+#define DECLARE(INDEX) x##INDEX
+#define COPY_IN(INDEX) x##INDEX = g[INDEX]
+#define COPY_OUT(INDEX) g[INDEX] = x##INDEX
+
+void
+test (int n)
+{
+ union { long long l; double d; } u = { 0x12345678 };
+ gll = u.l;
+ int MULTI (DECLARE);
+ MULTI (COPY_IN);
+ MULTI (COPY_OUT);
+ MULTI (COPY_OUT);
+ MULTI (COPY_OUT);
+ gd = u.d;
+}