diff mbox

pdp11: fix wrong code

Message ID CC5C764B-EFD8-4CBF-BB2E-B92B1CACD15A@dell.com
State New
Headers show

Commit Message

Paul Koning Nov. 9, 2010, 3:18 p.m. UTC
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. 

aaa-5v57ooxfyrm:gcc pkoning$ svn update ChangeLog
diff mbox

Patch

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)