From patchwork Tue Oct 30 19:20:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 195607 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 581112C0095 for ; Wed, 31 Oct 2012 06:20:20 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352229620; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=6AbwcyrJnj8AgO5Qgnf4 4LpO9tY=; b=IaXdSc3R6VPwIF/EDtdsGc/D1sK6+GclJlsCOAKFxo4RfRIKjL5b VeBZBSy8OICTT/Mow7F4yEosOD4/9JXxjmMHGvtuYcBdBNfKHWDPvBEdmjFNo76X QyDXpSVPNag5bAYUZ8wzmqckneMym37rETEdq6irWT7ELvOohOTQNXA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Mail-Followup-To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=fzzEvG4XNasmeK7CfwxKwC+S2IHNx57f1NZQVVzmDdd5nBL8GZRxG5I0QBVLol 7pjmaQSmJB8eSPmaXg8+w1cvEEfPq+SseI1bOCD+ZBxj/dPWx9ReDqfy4xs23SJn lIpK1NO7dGGmuV+LsnM0a6JYlu0uryiusiyf6o3XdiTMI=; Received: (qmail 27791 invoked by alias); 30 Oct 2012 19:20:10 -0000 Received: (qmail 27764 invoked by uid 22791); 30 Oct 2012 19:20:09 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL, BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, KHOP_RCVD_TRUST, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Oct 2012 19:20:02 +0000 Received: by mail-we0-f175.google.com with SMTP id t44so300672wey.20 for ; Tue, 30 Oct 2012 12:20:01 -0700 (PDT) Received: by 10.180.87.74 with SMTP id v10mr4625388wiz.21.1351624801633; Tue, 30 Oct 2012 12:20:01 -0700 (PDT) Received: from localhost ([2.26.192.222]) by mx.google.com with ESMTPS id a10sm2545859wiz.4.2012.10.30.12.20.00 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 12:20:00 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [2/8] Remove redundant MAX_MACHINE_MODE tests References: <87ip9rixdi.fsf@talisman.home> Date: Tue, 30 Oct 2012 19:20:04 +0000 In-Reply-To: <87ip9rixdi.fsf@talisman.home> (Richard Sandiford's message of "Tue, 30 Oct 2012 19:16:25 +0000") Message-ID: <87a9v3ix7f.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 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 extract_bit_field_1 has a block beginning: /* If OP0 is a memory, try copying it to a register and seeing if a cheap register alternative is available. */ if (ext_mode != MAX_MACHINE_MODE && MEM_P (op0)) { and within it there are tests for whether ext_mode != MAX_MACHINE_MODE. This patch removes them. store_bit_field_1 has a similar block, but it uses: /* If OP0 is a memory, try copying it to a register and seeing if a cheap register alternative is available. */ if (HAVE_insv && MEM_P (op0)) { However, by definition, HAVE_insv is equivalent to op_mode != MAX_MACHINE_MODE, so this patch changes it to that form for consistency. It's then obvious that the corresponding op_mode != MAX_MACHINE_MODE tests are redundant too. Tested as described in the covering note. OK to install? Richard gcc/ * expmed.c (store_bit_field_1): Use OP_MODE to check whether an insv pattern is available. Remove redundant checks for OP_MODE being MAX_MACHINE_MODE. (extract_bit_field_1): Remove redundant checks for EXT_MODE being MAX_MACHINE_MODE. Index: gcc/expmed.c =================================================================== --- gcc/expmed.c 2012-10-28 10:54:24.000000000 +0000 +++ gcc/expmed.c 2012-10-28 10:54:53.715350457 +0000 @@ -669,7 +669,7 @@ store_bit_field_1 (rtx str_rtx, unsigned in a word. */ enum machine_mode op_mode = mode_for_extraction (EP_insv, 3); - if (HAVE_insv + if (op_mode != MAX_MACHINE_MODE && bitsize > 0 && GET_MODE_BITSIZE (op_mode) >= bitsize /* Do not use insv for volatile bitfields when @@ -788,7 +788,7 @@ store_bit_field_1 (rtx str_rtx, unsigned /* If OP0 is a memory, try copying it to a register and seeing if a cheap register alternative is available. */ - if (HAVE_insv && MEM_P (op0)) + if (op_mode != MAX_MACHINE_MODE && MEM_P (op0)) { enum machine_mode bestmode; unsigned HOST_WIDE_INT maxbits = MAX_FIXED_MODE_SIZE; @@ -803,13 +803,10 @@ store_bit_field_1 (rtx str_rtx, unsigned if (GET_MODE (op0) == BLKmode || GET_MODE_BITSIZE (GET_MODE (op0)) > maxbits - || (op_mode != MAX_MACHINE_MODE - && GET_MODE_SIZE (GET_MODE (op0)) > GET_MODE_SIZE (op_mode))) + || GET_MODE_SIZE (GET_MODE (op0)) > GET_MODE_SIZE (op_mode)) bestmode = get_best_mode (bitsize, bitnum, bitregion_start, bitregion_end, - MEM_ALIGN (op0), - (op_mode == MAX_MACHINE_MODE - ? VOIDmode : op_mode), + MEM_ALIGN (op0), op_mode, MEM_VOLATILE_P (op0)); else bestmode = GET_MODE (op0); @@ -1597,12 +1594,9 @@ extract_bit_field_1 (rtx str_rtx, unsign smallest mode containing the field. */ if (GET_MODE (op0) == BLKmode - || (ext_mode != MAX_MACHINE_MODE - && GET_MODE_SIZE (GET_MODE (op0)) > GET_MODE_SIZE (ext_mode))) + || GET_MODE_SIZE (GET_MODE (op0)) > GET_MODE_SIZE (ext_mode)) bestmode = get_best_mode (bitsize, bitnum, 0, 0, MEM_ALIGN (op0), - (ext_mode == MAX_MACHINE_MODE - ? VOIDmode : ext_mode), - MEM_VOLATILE_P (op0)); + ext_mode, MEM_VOLATILE_P (op0)); else bestmode = GET_MODE (op0);