David Edelsohn wrote: > On Fri, Feb 28, 2014 at 7:11 PM, Bill Schmidt > <wschm...@linux.vnet.ibm.com> wrote: > > * config/rs6000/rs6000.c (rs6000_preferred_reload_class): Disallow > > PLUS rtx's from reloading into a superset of FLOAT_REGS; relax > > constraint on constants to only prevent them from being reloaded > > into a superset of FLOAT_REGS. > > This is okay with me. Uli is the best one to comment if this is the right > test.
- if (CONSTANT_P (x) && reg_classes_intersect_p (rclass, FLOAT_REGS)) + if ((CONSTANT_P (x) || GET_CODE (x) == PLUS) + && reg_class_subset_p (FLOAT_REGS, rclass)) return NO_REGS; So the reg_class test change is really a no-op: given the set of classes defined for rs6000, rclass intersects FLOAT_REGS if and only if FLOAT_REGS is a subset of rclass ... This test (in either form) is probably safe, but not the best we can do when dealing with mixed superset classes like ALL_REGS, since we'll completely reject loading a constant into ALL_REGS, even though it could be loaded fine into a GPR. The best way seems to be to *restrict* the preferred reload class, but not all the way down to NO_REGS, but to the largest subclass of the original rclass that can actually handle constants (which might be GENERAL_REGS or BASE_REGS). This could be implemented by something along the lines of: if (CONSTANT_P (x) || GET_CODE (x) == PLUS) { if (reg_class_subset_p (GENERAL_REGS, rclass)) return GENERAL_REGS; else if (reg_class_subset_p (BASE_REGS, rclass)) return BASE_REGS; else return NO_REGS; } (which is similar to how we did it for s390). Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain ulrich.weig...@de.ibm.com