(define_expand "movoo"
[(set (match_operand:OO 0 "nonimmediate_operand")
(match_operand:OO 1 "input_operand"))]
- "TARGET_MMA"
+ ""
{
- rs6000_emit_move (operands[0], operands[1], OOmode);
- DONE;
+ if (TARGET_MMA)
+ {
+ rs6000_emit_move (operands[0], operands[1], OOmode);
+ DONE;
+ }
+ else if (currently_expanding_to_rtl && seen_error ())
+ {
+ /* PR103353 shows we may want to continue to expand the __builtin_vsx_lxvp
+ built-in function, even if we have already emitted error messages about
+ some missing required conditions. As shown in that PR, without one
+ explicit mov optab on OOmode provided, it would call emit_move_insn
+ recursively. So we allow this pattern to be generated when we are
+ expanding to RTL and have seen errors. It would not cause further ICEs
+ as the compilation would stop soon after expanding. */
+ }
+ else
+ gcc_unreachable ();
})
(define_insn_and_split "*movoo"
(define_expand "movxo"
[(set (match_operand:XO 0 "nonimmediate_operand")
(match_operand:XO 1 "input_operand"))]
- "TARGET_MMA"
+ ""
{
- rs6000_emit_move (operands[0], operands[1], XOmode);
- DONE;
+ if (TARGET_MMA)
+ {
+ rs6000_emit_move (operands[0], operands[1], XOmode);
+ DONE;
+ }
+ else if (currently_expanding_to_rtl && seen_error ())
+ {
+ /* PR103353 shows we may want to continue to expand the __builtin_vsx_lxvp
+ built-in function, even if we have already emitted error messages about
+ some missing required conditions. So do the same handlings for XOmode
+ as OOmode here. */
+ }
+ else
+ gcc_unreachable ();
})
(define_insn_and_split "*movxo"
--- /dev/null
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* If the default cpu type is power10 or later, MMA is enabled by default.
+ To keep the test point available all the time, this case specifies
+ -mdejagnu-cpu=power6 to make it be tested without MMA. */
+/* { dg-options "-maltivec -mdejagnu-cpu=power6" } */
+
+/* Verify there is no ICE and don't check the error messages on MMA
+ requirement since they could be fragile and are not test points
+ of this case. */
+/* { dg-excess-errors "pr103353" } */
+
+void
+foo (__vector_pair *dst, double *x)
+{
+ dst[0] = __builtin_vsx_lxvp (0, (__vector_pair *)(void *)x);
+}
+
+void
+bar (__vector_pair *src, double *x)
+{
+ __builtin_vsx_stxvp (src[0], 0, (__vector_pair *)(void *)x);
+}