From patchwork Thu Sep 9 11:07:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 64286 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 6561EB6F0E for ; Thu, 9 Sep 2010 21:07:52 +1000 (EST) Received: (qmail 15820 invoked by alias); 9 Sep 2010 11:07:49 -0000 Received: (qmail 15809 invoked by uid 22791); 9 Sep 2010 11:07:47 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_VP, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Sep 2010 11:07:10 +0000 Received: by qwa26 with SMTP id 26so28664qwa.20 for ; Thu, 09 Sep 2010 04:07:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.237.199 with SMTP id kp7mr1083900qcb.8.1284030428030; Thu, 09 Sep 2010 04:07:08 -0700 (PDT) Received: by 10.229.182.15 with HTTP; Thu, 9 Sep 2010 04:07:07 -0700 (PDT) In-Reply-To: References: <20100909063858.GS1269@tyan-ft48-01.lab.bos.redhat.com> Date: Thu, 9 Sep 2010 13:07:07 +0200 Message-ID: Subject: Re: [PATCH, i386]: Clenup: use bool, true and false in predicate functions From: Uros Bizjak To: Jakub Jelinek Cc: 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 On Thu, Sep 9, 2010 at 9:45 AM, Uros Bizjak wrote: >>>  (define_predicate "flags_reg_operand" >>> @@ -98,16 +98,14 @@ >>>  ;; Return true if op is not xmm0 register. >>>  (define_predicate "reg_not_xmm0_operand" >>>     (and (match_operand 0 "register_operand") >>> -     (match_test "!REG_P (op) >>> -                  || REGNO (op) != FIRST_SSE_REG"))) >>> +     (match_test "REGNO (op) != FIRST_SSE_REG"))) >> >> This change broke lots of tests with --enable-checking=yes,rtl. >> op e.g. in vperm-v4si-2-sse4.c isn't a REG, but SUBREG of REG >> (and, in theory, register_operand can be true also for SUBREG of MEM >> before reload). >> So I think this test should be >> if (GET_CODE (op)) == SUBREG) >>  op = SUBREG_REG (op); >> !REG_P (op) || REGNO (op) != FIRST_SSE_REG > > > Whoops, I didn't intend to commit this (untested!) change! Fixed by attached patch. 2010-09-09 Uros Bizjak * config/i386/predicates.md (ext_register_operand): Check that SUBREG_REG is really a register before looking for REGNO. (reg_not_xmm0_operand): Handle SUBREGs correctly. (nonimm_not_xmm0_operand): Call reg_not_xmm0_operand. Tested on x86_64-pc-linux-gnu {,-m32} with --enable-checking=all,rtl. Committed to mainline SVN. Uros. Index: config/i386/predicates.md =================================================================== --- config/i386/predicates.md (revision 164047) +++ config/i386/predicates.md (working copy) @@ -68,7 +68,8 @@ op = SUBREG_REG (op); /* Be careful to accept only registers having upper parts. */ - return REGNO (op) > LAST_VIRTUAL_REGISTER || REGNO (op) <= BX_REG; + return (REG_P (op) + && (REGNO (op) > LAST_VIRTUAL_REGISTER || REGNO (op) <= BX_REG)); }) ;; Return true if op is the AX register. @@ -97,13 +98,18 @@ ;; Return true if op is not xmm0 register. (define_predicate "reg_not_xmm0_operand" - (and (match_operand 0 "register_operand") - (match_test "REGNO (op) != FIRST_SSE_REG"))) + (match_operand 0 "register_operand") +{ + if (GET_CODE (op) == SUBREG) + op = SUBREG_REG (op); + return !REG_P (op) || REGNO (op) != FIRST_SSE_REG; +}) + ;; As above, but allow nonimmediate operands. (define_predicate "nonimm_not_xmm0_operand" - (ior (match_operand 0 "memory_operand") - (match_operand 0 "reg_not_xmm0_operand"))) + (ior (match_operand 0 "memory_operand") + (match_operand 0 "reg_not_xmm0_operand"))) ;; Return true if VALUE can be stored in a sign extended immediate field. (define_predicate "x86_64_immediate_operand"