From patchwork Tue Jul 26 16:08:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 106889 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 A5438B6F77 for ; Wed, 27 Jul 2011 02:09:20 +1000 (EST) Received: (qmail 16023 invoked by alias); 26 Jul 2011 16:09:15 -0000 Received: (qmail 16006 invoked by uid 22791); 26 Jul 2011 16:09:12 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jul 2011 16:08:57 +0000 Received: by gyd12 with SMTP id 12so401399gyd.20 for ; Tue, 26 Jul 2011 09:08:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.61.20 with SMTP id j20mr3944838wfa.242.1311696536509; Tue, 26 Jul 2011 09:08:56 -0700 (PDT) Received: by 10.143.34.2 with HTTP; Tue, 26 Jul 2011 09:08:56 -0700 (PDT) Date: Tue, 26 Jul 2011 18:08:56 +0200 Message-ID: Subject: [PATCH, i386]: Fix inconsistency in LEA splitters 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! Using mode iterator, we can use x86_64_nonmemory_operand where appropriate and remove extra pattern (and ??? comment) on the way. 2011-07-26 Uros Bizjak * config/i386/i386.md (add->lea splitter): Implement using SWI mode iterator. Change operand 2 predicate to . (add->lea zext splitter): Change operand 2 predicate to x86_64_nonmemory_operand. Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {, -m32}. Committed to mainline SVN. Uros. Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 176790) +++ config/i386/i386.md (working copy) @@ -5805,17 +5805,14 @@ ;; Convert add to the lea pattern to avoid flags dependency. (define_split - [(set (match_operand 0 "register_operand" "") - (plus (match_operand 1 "register_operand" "") - (match_operand 2 "nonmemory_operand" ""))) + [(set (match_operand:SWI 0 "register_operand" "") + (plus (match_operand:SWI 1 "register_operand" "") + (match_operand:SWI 2 "" ""))) (clobber (reg:CC FLAGS_REG))] - "GET_MODE (operands[0]) == GET_MODE (operands[1]) - && (GET_MODE (operands[0]) == GET_MODE (operands[2]) - || GET_MODE (operands[2]) == VOIDmode) - && reload_completed && ix86_lea_for_add_ok (insn, operands)" + "reload_completed && ix86_lea_for_add_ok (insn, operands)" [(const_int 0)] { - enum machine_mode mode = GET_MODE (operands[0]); + enum machine_mode mode = mode; rtx pat; if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (SImode)) @@ -5833,27 +5830,13 @@ }) ;; Convert add to the lea pattern to avoid flags dependency. -;; ??? This pattern handles immediate operands that do not satisfy immediate -;; operand predicate (TARGET_LEGITIMATE_CONSTANT_P) in the previous pattern. (define_split [(set (match_operand:DI 0 "register_operand" "") - (plus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "x86_64_immediate_operand" ""))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed - && true_regnum (operands[0]) != true_regnum (operands[1])" - [(set (match_dup 0) - (plus:DI (match_dup 1) (match_dup 2)))]) - -;; Convert add to the lea pattern to avoid flags dependency. -(define_split - [(set (match_operand:DI 0 "register_operand" "") (zero_extend:DI (plus:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "nonmemory_operand" "")))) + (match_operand:SI 2 "x86_64_nonmemory_operand" "")))) (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed - && ix86_lea_for_add_ok (insn, operands)" + "TARGET_64BIT && reload_completed && ix86_lea_for_add_ok (insn, operands)" [(set (match_dup 0) (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))])