http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57439
--- Comment #13 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- (In reply to Jorn Wolfgang Rennecke from comment #10) > Created attachment 30212 [details] > experimental patch for execute/pr42721.c failure The patch is OK but let's beef up the comment a little bit: + if (mode != reg_mode[regno]) + { + if (!MODES_OK_FOR_MOVE2ADD (mode, reg_mode[regno])) + return false; + /* For big endian, the starting regno for the subreg might be + different. */ /* The value loaded into regno in reg_mode[regno] is also valid in mode after truncation only if (REG:mode regno) is the lowpart of (REG:reg_mode[regno] regno). Now, for big endian, the starting regno of the lowpart might be different. */ + int s_off = subreg_lowpart_offset (mode, reg_mode[regno]); + s_off = subreg_regno_offset (regno, reg_mode[regno], s_off, mode); + if (s_off != 0) + /* We could in principle adjust regno, check reg_mode[regno] to be + BLKmode, and return s_off to the caller (vs. -1 for failure), + but we currently have no callers that could make use of this + information. */ + return false; + }