@@ -6627,11 +6627,16 @@ s390_expand_vec_init (rtx target, rtx vals)
return;
}
+ /* Use vector replicate instructions. vlrep/vrepi/vrep */
if (all_same)
{
- emit_insn (gen_rtx_SET (target,
- gen_rtx_VEC_DUPLICATE (mode,
- XVECEXP (vals, 0, 0))));
+ rtx elem = XVECEXP (vals, 0, 0);
+
+ /* vec_splats accepts general_operand as source. */
+ if (!general_operand (elem, GET_MODE (elem)))
+ elem = force_reg (inner_mode, elem);
+
+ emit_insn (gen_rtx_SET (target, gen_rtx_VEC_DUPLICATE (mode, elem)));
return;
}
new file mode 100644
@@ -0,0 +1,26 @@
+/* On S/390 this ends up calling the vec_init RTL expander with a
+ parallel of two symbol_refs. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -fPIC" } */
+
+
+struct test
+{
+ struct base
+ {
+ int key;
+ };
+ struct derived : public base
+ {
+ int key;
+ };
+
+ derived core;
+ derived &dRef;
+ base &bRef;
+
+ test() : dRef (core), bRef (core) {}
+};
+
+test test;