My recent patch for PR118067 changes the secondary memory mode if
all regs of the pseudo reg class are prohibited in the secondary mode.
But the patch does not check a special case when the
corresponding target hook returns this mode although there are no hard
regs of pseudo class holding value of the mode at all. This results
in given PR and this patch fixes it.
gcc/ChangeLog:
PR target/118663
* lra-constraints.cc (invalid_mode_reg_p): Check empty
reg_class_contents.
gcc/testsuite/ChangeLog:
PR target/118663
* gcc.target/powerpc/pr118663.c: New.
if (! REG_P (x))
return false;
enum reg_class rclass = get_reg_class (REGNO (x));
- return hard_reg_set_subset_p (reg_class_contents[rclass],
- ira_prohibited_class_mode_regs[rclass][mode]);
+ return (!hard_reg_set_empty_p (reg_class_contents[rclass])
+ && hard_reg_set_subset_p
+ (reg_class_contents[rclass],
+ ira_prohibited_class_mode_regs[rclass][mode]));
}
/* Main entry point of the constraint code: search the body of the
--- /dev/null
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-options "-mcpu=601 -w -O2 -m64" } */
+
+extern void bar (void);
+void
+foo (_Decimal32 *dst, _Decimal32 src)
+{
+ bar ();
+ *dst = src;
+}