This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] pdp11: fix wrong code
- From: Paul Koning <paul_koning at dell dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 9 Nov 2010 10:18:52 -0500
- Subject: Re: [PATCH] pdp11: fix wrong code
- References: <086E06BA-0C4E-433C-A172-C9AA17BA466D@dell.com>
On Nov 8, 2010, at 8:15 PM, Paul Koning wrote:
> This is another wrong-code fix, in logical right shift. The original code tried to optimize the case for shift by 1, but ended up unconditionally shifting by 1 even if the request was for a different shift.
>
> Tested by build and inspection of the output. Committed.
>
> paul
Here is a correction to that patch, needed because subtract constant should be encoded as an add.
Tested by build, make check. Committed.
paul
ChangeLog:
2010-11-09 Paul Koning <ni1d@arrl.net>
* config/pdp11/pdp11.md (lshrsi3, lshrhi3): Use add for
decrement.
Index: config/pdp11/pdp11.md
===================================================================
--- config/pdp11/pdp11.md (revision 166480)
+++ config/pdp11/pdp11.md (working copy)
@@ -897,7 +897,7 @@
if (GET_CODE (operands[2]) != CONST_INT)
{
r = gen_reg_rtx (HImode);
- emit_insn (gen_subhi3 (r, operands [2], GEN_INT (1)));
+ emit_insn (gen_addhi3 (r, operands [2], GEN_INT (-1)));
emit_insn (gen_ashrsi3 (operands[0], operands[0], r));
}
else if ((unsigned) INTVAL (operands[2]) != 1)
@@ -1043,7 +1043,7 @@
if (GET_CODE (operands[2]) != CONST_INT)
{
r = gen_reg_rtx (HImode);
- emit_insn (gen_subhi3 (r, operands [2], GEN_INT (1)));
+ emit_insn (gen_addhi3 (r, operands [2], GEN_INT (-1)));
emit_insn (gen_ashrhi3 (operands[0], operands[0], r));
}
else if ((unsigned) INTVAL (operands[2]) != 1)
aaa-5v57ooxfyrm:gcc pkoning$ svn update ChangeLog