From patchwork Tue Nov 9 15:18:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Koning X-Patchwork-Id: 70551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 27079B6EF0 for ; Wed, 10 Nov 2010 02:19:10 +1100 (EST) Received: (qmail 17131 invoked by alias); 9 Nov 2010 15:19:04 -0000 Received: (qmail 17120 invoked by uid 22791); 9 Nov 2010 15:19:02 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, TW_SV, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausc60pc101.us.dell.com (HELO ausc60pc101.us.dell.com) (143.166.85.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Nov 2010 15:18:56 +0000 X-Loopcount0: from 10.152.240.141 Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: [PATCH] pdp11: fix wrong code From: Paul Koning In-Reply-To: <086E06BA-0C4E-433C-A172-C9AA17BA466D@dell.com> Date: Tue, 9 Nov 2010 10:18:52 -0500 Message-Id: References: <086E06BA-0C4E-433C-A172-C9AA17BA466D@dell.com> To: gcc-patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * config/pdp11/pdp11.md (lshrsi3, lshrhi3): Use add for decrement. aaa-5v57ooxfyrm:gcc pkoning$ svn update ChangeLog 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)