https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102254

--- Comment #7 from Hongtao.liu <crazylht at gmail dot com> ---
And here is invalid subreg from general_operand

#ifdef INSN_SCHEDULING
      /* On machines that have insn scheduling, we want all memory
         reference to be explicit, so outlaw paradoxical SUBREGs.
         However, we must allow them after reload so that they can
         get cleaned up by cleanup_subreg_operands.  */
      if (!reload_completed && MEM_P (sub)
          && paradoxical_subreg_p (op))
        return false;
#endif
      /* Avoid memories with nonzero SUBREG_BYTE, as offsetting the memory
         may result in incorrect reference.  We should simplify all valid
         subregs of MEM anyway.  But allow this after reload because we
         might be called from cleanup_subreg_operands.

         ??? This is a kludge.  */
      if (!reload_completed
          && maybe_ne (SUBREG_BYTE (op), 0)
          && MEM_P (sub))
        return false;

      if (REG_P (sub)
          && REGNO (sub) < FIRST_PSEUDO_REGISTER
          && !REG_CAN_CHANGE_MODE_P (REGNO (sub), GET_MODE (sub), mode)
          && GET_MODE_CLASS (GET_MODE (sub)) != MODE_COMPLEX_INT
          && GET_MODE_CLASS (GET_MODE (sub)) != MODE_COMPLEX_FLOAT
          /* LRA can generate some invalid SUBREGS just for matched
             operand reload presentation.  LRA needs to treat them as
             valid.  */
          && ! LRA_SUBREG_P (op))
        return false;

      /* FLOAT_MODE subregs can't be paradoxical.  Combine will occasionally
         create such rtl, and we must reject it.  */
      if (SCALAR_FLOAT_MODE_P (GET_MODE (op))
          /* LRA can use subreg to store a floating point value in an
             integer mode.  Although the floating point and the
             integer modes need the same number of hard registers, the
             size of floating point mode can be less than the integer
             mode.  */
          && ! lra_in_progress 
          && paradoxical_subreg_p (op))
        return false;

Reply via email to