diff --git a/gcc/init-regs.c b/gcc/init-regs.c index 903c6541f10..72e898f3e33 100644 --- a/gcc/init-regs.c +++ b/gcc/init-regs.c @@ -105,7 +105,10 @@ initialize_uninitialized_regs (void) start_sequence (); emit_clobber (reg); - emit_move_insn (reg, CONST0_RTX (GET_MODE (reg))); + /* PR98872: Only emit an initialization if MODE has a + CONST0_RTX defined. */ + if (CONST0_RTX (GET_MODE (reg))) + emit_move_insn (reg, CONST0_RTX (GET_MODE (reg))); move_insn = get_insns (); end_sequence (); emit_insn_before (move_insn, insn); diff --git a/gcc/testsuite/gcc.target/powerpc/pr98872.c b/gcc/testsuite/gcc.target/powerpc/pr98872.c new file mode 100644 index 00000000000..f33ad9b48b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr98872.c @@ -0,0 +1,19 @@ +/* PR target/98872 */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Verify we do not ICE on the following tests. */ + +void +foo (__vector_quad *dst) +{ + __vector_quad acc; + *dst = acc; +} + +void +bar (__vector_pair *dst) +{ + __vector_pair pair; + *dst = pair; +}