@@ -1,5 +1,11 @@
2011-01-19 H.J. Lu <hongjiu.lu@intel.com>
+ PR target/47364
+ * config/i386/i386.c (ix86_legitimize_address): Convert to
+ Pmode if needed.
+
+2011-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
* config/i386/i386.md (*addsi_1_zext): Replace general_operand
with x32_general_operand. Replace "i"/"g" with "Ye"/"rmYe".
(*addsi_2_zext): Likewise.
@@ -12949,7 +12949,11 @@ ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
rtx temp = gen_reg_rtx (Pmode);
rtx val = force_operand (XEXP (x, 1), temp);
if (val != temp)
- emit_move_insn (temp, val);
+ {
+ if (GET_MODE (val) != Pmode)
+ val = convert_to_mode (Pmode, val, 1);
+ emit_move_insn (temp, val);
+ }
XEXP (x, 1) = temp;
return x;
@@ -12960,7 +12964,11 @@ ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
rtx temp = gen_reg_rtx (Pmode);
rtx val = force_operand (XEXP (x, 0), temp);
if (val != temp)
- emit_move_insn (temp, val);
+ {
+ if (GET_MODE (val) != Pmode)
+ val = convert_to_mode (Pmode, val, 1);
+ emit_move_insn (temp, val);
+ }
XEXP (x, 0) = temp;
return x;
new file mode 100644
@@ -0,0 +1,4 @@
+2011-01-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/47364
+ * gcc.target/i386/pr47364.c: New.
new file mode 100644
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+static unsigned char foo[256];
+
+arc4_init(void)
+{
+ int n;
+
+ for (n = 0; n < 256; n++)
+ foo[n] = n;
+}