This is the mail archive of the gcc-patches@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]

Re: [PATCH] pdp11: fix wrong code


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


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