From patchwork Fri Jun 11 09:41:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 55305 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 1CD63B7D43 for ; Fri, 11 Jun 2010 19:42:27 +1000 (EST) Received: (qmail 30119 invoked by alias); 11 Jun 2010 09:42:24 -0000 Received: (qmail 30100 invoked by uid 22791); 11 Jun 2010 09:42:20 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ww0-f47.google.com (HELO mail-ww0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Jun 2010 09:42:00 +0000 Received: by wwb17 with SMTP id 17so633738wwb.20 for ; Fri, 11 Jun 2010 02:41:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.86.199 with SMTP id w49mr772935wee.84.1276249318105; Fri, 11 Jun 2010 02:41:58 -0700 (PDT) Received: by 10.216.89.10 with HTTP; Fri, 11 Jun 2010 02:41:58 -0700 (PDT) Date: Fri, 11 Jun 2010 11:41:58 +0200 Message-ID: Subject: [PATCH, i386]: Add some more x86_maybe_negate_const_int usages From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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 Hello! 2010-06-11 Uros Bizjak * config/i386/i386.md (pro_epilogue_adjust_stack_1) : Assert that operand 0 == operand 1. Use x86_maybe_negate_const_int to output insn mnemonic. (pro_epilogue_adjust_stack_rex64) : Ditto. Tested on x86_64-pc-linux-gnu, committed to mainline SVN. Uros. Index: i386.md =================================================================== --- i386.md (revision 160599) +++ i386.md (working copy) @@ -16539,22 +16539,15 @@ return "mov{l}\t{%1, %0|%0, %1}"; case TYPE_ALU: - if (CONST_INT_P (operands[2]) - && (INTVAL (operands[2]) == 128 - || (INTVAL (operands[2]) < 0 - && INTVAL (operands[2]) != -128))) - { - operands[2] = GEN_INT (-INTVAL (operands[2])); - return "sub{l}\t{%2, %0|%0, %2}"; - } + gcc_assert (rtx_equal_p (operands[0], operands[1])); + if (x86_maybe_negate_const_int (&operands[2], SImode)) + return "sub{l}\t{%2, %0|%0, %2}"; + return "add{l}\t{%2, %0|%0, %2}"; - case TYPE_LEA: + default: operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0)); return "lea{l}\t{%a2, %0|%0, %a2}"; - - default: - gcc_unreachable (); } } [(set (attr "type") @@ -16589,24 +16582,15 @@ return "mov{q}\t{%1, %0|%0, %1}"; case TYPE_ALU: - if (CONST_INT_P (operands[2]) - /* Avoid overflows. */ - && ((INTVAL (operands[2]) & ((((unsigned int) 1) << 31) - 1))) - && (INTVAL (operands[2]) == 128 - || (INTVAL (operands[2]) < 0 - && INTVAL (operands[2]) != -128))) - { - operands[2] = GEN_INT (-INTVAL (operands[2])); - return "sub{q}\t{%2, %0|%0, %2}"; - } + gcc_assert (rtx_equal_p (operands[0], operands[1])); + if (x86_maybe_negate_const_int (&operands[2], DImode)) + return "sub{q}\t{%2, %0|%0, %2}"; + return "add{q}\t{%2, %0|%0, %2}"; - case TYPE_LEA: + default: operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0)); return "lea{q}\t{%a2, %0|%0, %a2}"; - - default: - gcc_unreachable (); } } [(set (attr "type")