This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/39386] [avr] different computation results for O1 and O0 executables


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39386

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gjl at gcc dot gnu.org
      Known to fail|                            |

--- Comment #10 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-23 10:08:33 UTC ---
The problem arises from the following insns:

*ashlqi3
ashlhi3
ashlsi3

ashrqi3
ashrhi3
ashrsi3

*lshrqi3
lshrhi3
lshrsi3

For variable shifts the first constraint alternative is "=r,0,r"

avr.c:out_shift_with_cnt() reads 

  else if (register_operand (operands[2], QImode))
    {
      if (reg_unused_after (insn, operands[2]))
    op[3] = op[2];
      else
    {
      op[3] = tmp_reg_rtx;
      if (!len)
        strcat (str, (AS2 (mov,%3,%2) CR_TAB));
    }
    }

so that in the very rare, pathological case of op0 = op1 = op2 and op2 is
unused after the insn, wrong code gets generated. Fix is:

      if (reg_unused_after (insn, operands[2])
          && !reg_overlap_mentioned_p (operands[0], operands[2]))

or something like that.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]