@@ -1975,6 +1975,14 @@ extract_integral_bit_field (rtx op0, opt_scalar_int_mode op0_mode,
unsignedp, reverse);
return convert_extracted_bit_field (target, mode, tmode, unsignedp);
}
+ /* If OP0 is a hard register, copy it to a pseudo before calling
+ simplify_gen_subreg. */
+ if (REG_P (op0) && HARD_REGISTER_P (op0))
+ {
+ rtx tmp = gen_reg_rtx (GET_MODE (op0));
+ emit_move_insn (tmp, op0);
+ op0 = tmp;
+ }
op0 = simplify_gen_subreg (word_mode, op0, op0_mode.require (),
bitnum / BITS_PER_WORD * UNITS_PER_WORD);
op0_mode = word_mode;
new file mode 100644
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse" } */
+
+typedef int v8 __attribute__((vector_size(8)));
+struct S1 {
+ v8 s1f;
+};
+struct S2 {
+ struct S1 s2f1;
+ v8 s2f2;
+};
+
+extern void foo(int);
+
+void bar() {
+ int tmp, i = 3;
+ register struct S2 b asm("xmm0");
+ tmp = b.s2f1.s1f[i];
+ foo(tmp);
+}
+