@@ -394,6 +394,18 @@
return 0;
}
+ if ((mode == QImode || mode == HImode)
+ && (MEM_P (op)
+ || (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op)))))
+ {
+ rtx x = XEXP ((MEM_P (op) ? op : SUBREG_REG (op)), 0);
+
+ if (GET_CODE (x) == PLUS
+ && REG_P (XEXP (x, 0))
+ && CONST_INT_P (XEXP (x, 1)))
+ return sh_legitimate_index_p (mode, XEXP (x, 1));
+ }
+
if (TARGET_SHMEDIA
&& (GET_CODE (op) == PARALLEL || GET_CODE (op) == CONST_VECTOR)
&& sh_rep_vec (op, mode))
@@ -419,6 +431,18 @@
&& ! (high_life_started || reload_completed))
return 0;
+ if ((mode == QImode || mode == HImode)
+ && (MEM_P (op)
+ || (GET_CODE (op) == SUBREG && MEM_P (SUBREG_REG (op)))))
+ {
+ rtx x = XEXP ((MEM_P (op) ? op : SUBREG_REG (op)), 0);
+
+ if (GET_CODE (x) == PLUS
+ && REG_P (XEXP (x, 0))
+ && CONST_INT_P (XEXP (x, 1)))
+ return sh_legitimate_index_p (mode, XEXP (x, 1));
+ }
+
return general_operand (op, mode);
})
@@ -0,0 +1,35 @@
+/* PR target/49163 */
+struct S1
+{
+ unsigned f0:18;
+ int f1;
+} __attribute__ ((packed));
+
+struct S2
+{
+ volatile long long f0;
+ int f1;
+};
+
+struct S1 s1;
+struct S2 s2;
+const struct S2 s2array[2][1] = { };
+
+struct S2 **sptr;
+
+extern int bar (char a, long long b, int * c, long long d, long long e);
+extern int baz (void);
+
+int i;
+int *ptr;
+
+void
+foo (int *arg)
+{
+ for (i = 0; i < 1; i = baz())
+ {
+ *arg = *(int *)sptr;
+ *ptr = bar (*arg, s2.f1, ptr,
+ bar (s2array[1][0].f0, *arg, ptr, s1.f1, *ptr), *arg);
+ }
+}