From patchwork Tue Oct 30 19:23:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 195609 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 17D212C0095 for ; Wed, 31 Oct 2012 06:24:17 +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=1352229858; 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=a/N5rFEHzgpSfdvWaDRB znEd5bg=; b=NKHWQ6yEXOzxO7XTyf+BEoaW1B2J1FeZvacEAeLcsmjFmU2xgeQ5 Vr6Y3roLZXUCSruU0gEvzT9FBjzRMtACCA9EJWZiI++Br+YsvkWnThvP/Oktnz4O WC6Ah1WQvubDKuFTLsiIXh1tcYGK/rlp8Fwig045Oo3mPJLr2viNzZo= 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=QrlkA7bZdNCNKsbhmTC/GXrcLGfbCNzZNX0YvaXu7ZD0SA3Ib7ZR5Dad9qYwPa 8Aof7LTMm+J3g2pb4XkPqdyBpjDsk+xGBesCeZEVIll7Eyp+YXUqymQ9E6D8zgfO diwDIjaXzsVhXv6bdRNxaQOBg1gFTofi2GwHwbdtGe0I4=; Received: (qmail 30705 invoked by alias); 30 Oct 2012 19:24:06 -0000 Received: (qmail 30693 invoked by uid 22791); 30 Oct 2012 19:24:03 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_50, 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, TW_XT 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:23:57 +0000 Received: by mail-we0-f175.google.com with SMTP id t44so302526wey.20 for ; Tue, 30 Oct 2012 12:23:55 -0700 (PDT) Received: by 10.180.8.41 with SMTP id o9mr4688007wia.3.1351625035855; Tue, 30 Oct 2012 12:23:55 -0700 (PDT) Received: from localhost ([2.26.192.222]) by mx.google.com with ESMTPS id v9sm3900889wif.10.2012.10.30.12.23.54 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 12:23:55 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [4/8] Separate reg and mem uses of insv and ext(z)v References: <87ip9rixdi.fsf@talisman.home> Date: Tue, 30 Oct 2012 19:23:58 +0000 In-Reply-To: <87ip9rixdi.fsf@talisman.home> (Richard Sandiford's message of "Tue, 30 Oct 2012 19:16:25 +0000") Message-ID: <871ugfix0x.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 This patch simply separates out the MEM and non-MEM insv and ext(z)v cases. On it's own, it's probably a wash whether this is an improvement or not, but it makes the optabs patches much easier. Tested as described in the covering note. OK to install? Richard gcc/ * expmed.c (store_bit_field_1): Move generation of MEM insvs to the MEM_P block. (extract_bit_field_1): Likewise extvs and extzvs. Index: gcc/expmed.c =================================================================== --- gcc/expmed.c 2012-10-28 10:55:22.754350385 +0000 +++ gcc/expmed.c 2012-10-28 10:55:29.249350370 +0000 @@ -784,16 +784,7 @@ store_bit_field_1 (rtx str_rtx, unsigned enum machine_mode op_mode = mode_for_extraction (EP_insv, 3); if (op_mode != MAX_MACHINE_MODE - /* Do not use insv for volatile bitfields when - -fstrict-volatile-bitfields is in effect. */ - && !(MEM_P (op0) && MEM_VOLATILE_P (op0) - && flag_strict_volatile_bitfields > 0) - /* Do not use insv if the bit region is restricted and - op_mode integer at offset doesn't fit into the - restricted region. */ - && !(MEM_P (op0) && bitregion_end - && bitnum - (bitnum % BITS_PER_UNIT) + GET_MODE_BITSIZE (op_mode) - > bitregion_end + 1) + && !MEM_P (op0) && store_bit_field_using_insv (op0, bitsize, bitnum, value, op_mode)) return true; @@ -804,6 +795,18 @@ store_bit_field_1 (rtx str_rtx, unsigned enum machine_mode bestmode; unsigned HOST_WIDE_INT maxbits = MAX_FIXED_MODE_SIZE; + /* Do not use insv for volatile bitfields when + -fstrict-volatile-bitfields is in effect. */ + if (!(MEM_VOLATILE_P (op0) && flag_strict_volatile_bitfields > 0) + /* Do not use insv if the bit region is restricted and + an op_mode integer doesn't fit into the restricted region. */ + && !(bitregion_end + && (bitnum - (bitnum % BITS_PER_UNIT) + + GET_MODE_BITSIZE (op_mode) + > bitregion_end + 1)) + && store_bit_field_using_insv (op0, bitsize, bitnum, value, op_mode)) + return true; + if (bitregion_end) maxbits = bitregion_end - bitregion_start + 1; @@ -1594,11 +1597,7 @@ extract_bit_field_1 (rtx str_rtx, unsign If OP0 is a register, it too fits within a word. */ ext_mode = mode_for_extraction (unsignedp ? EP_extzv : EP_extv, 0); - if (ext_mode != MAX_MACHINE_MODE - /* Do not use extv/extzv for volatile bitfields when - -fstrict-volatile-bitfields is in effect. */ - && !(MEM_P (op0) && MEM_VOLATILE_P (op0) - && flag_strict_volatile_bitfields > 0)) + if (ext_mode != MAX_MACHINE_MODE && !MEM_P (op0)) { rtx result = extract_bit_field_using_extv (op0, bitsize, bitnum, unsignedp, target, mode, @@ -1613,6 +1612,17 @@ extract_bit_field_1 (rtx str_rtx, unsign { enum machine_mode bestmode; + /* Do not use extv/extzv for volatile bitfields when + -fstrict-volatile-bitfields is in effect. */ + if (!(MEM_VOLATILE_P (op0) && flag_strict_volatile_bitfields > 0)) + { + rtx result = extract_bit_field_using_extv (op0, bitsize, bitnum, + unsignedp, target, mode, + tmode, ext_mode); + if (result) + return result; + } + /* Get the mode to use for inserting into this field. If OP0 is BLKmode, get the smallest mode consistent with the alignment. If OP0 is a non-BLKmode object that is no