From patchwork Mon Sep 9 10:31:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 273549 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 3C45E2C00F2 for ; Mon, 9 Sep 2013 20:31:53 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=XXCFdnlQNSfp7yG6TaTLh1tdapZdWcL4qgsfJRimefn/sP/IeMvx+ rsM/Bs+UyDxWJNwZU7JlJwfvq1EqoPg8LYWjec3gW+H5Rs+gZrmHcW0pM/DqPVe+ ss5oH9e8GLzK0fAlRUCIoJvrptcuCsgIVvSkXAGIEW5wyu6iSjYj6c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=DukgUEhfIIdTWx+mpI4sPtvDr38=; b=YavSvUo5WXqAZSsUHIyL hyhpD6sYYr14jxRe23AGv01d9sKCODVQ1SNK2cA6pwr6+mXkTOdG/OESBsA+sahQ 1rr90Wa8PKik2j1vUSY0IahxfVfagtMc8ARznrkAq+EU0Yhk5w73u19fmuZPoVUQ UD9hfbwMzn5qmQWECy9rENM= Received: (qmail 28439 invoked by alias); 9 Sep 2013 10:31:46 -0000 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 Received: (qmail 28427 invoked by uid 89); 9 Sep 2013 10:31:46 -0000 Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 09 Sep 2013 10:31:46 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00, FREEMAIL_FROM autolearn=ham version=3.3.2 X-HELO: mail-wi0-f169.google.com Received: by mail-wi0-f169.google.com with SMTP id hj3so3127307wib.4 for ; Mon, 09 Sep 2013 03:31:42 -0700 (PDT) X-Received: by 10.180.211.19 with SMTP id my19mr7995062wic.19.1378722702583; Mon, 09 Sep 2013 03:31:42 -0700 (PDT) Received: from localhost ([2.26.203.233]) by mx.google.com with ESMTPSA id pn7sm9598702wic.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 09 Sep 2013 03:31:42 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: Simplify expmed.c:lshift_value Date: Mon, 09 Sep 2013 11:31:41 +0100 Message-ID: <8761uagub6.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 expmed.c:lshift_value has: val = double_int::from_uhwi (INTVAL (value)).zext (bitsize); val = val.llshift (bitpos, HOST_BITS_PER_DOUBLE_INT); but its only caller has already zero-extended INTVAL (value) from BITSIZE, so we might as well pass that instead of the (value, bitsize) pair. This isn't really much of a win on its own, but it makes the associated wide-int change more obvious. Tested on x86_64-linux-gnu. OK to install? Thanks, Richard gcc/ * expmed.c (lshift_value): Take an unsigned HOST_WIDE_INT instead of an rtx/bitpos pair. (store_fixed_bit_field): Update accordingly. Index: gcc/expmed.c =================================================================== --- gcc/expmed.c 2013-09-08 11:52:28.995962127 +0100 +++ gcc/expmed.c 2013-09-08 14:21:49.710092468 +0100 @@ -56,7 +56,7 @@ static rtx extract_fixed_bit_field (enum unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, rtx, int, bool); static rtx mask_rtx (enum machine_mode, int, int, int); -static rtx lshift_value (enum machine_mode, rtx, int, int); +static rtx lshift_value (enum machine_mode, unsigned HOST_WIDE_INT, int); static rtx extract_split_bit_field (rtx, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, int); static void do_cmp_and_jump (rtx, rtx, enum rtx_code, enum machine_mode, rtx); @@ -991,7 +991,7 @@ store_fixed_bit_field (rtx op0, unsigned || (bitsize == HOST_BITS_PER_WIDE_INT && v == -1)) all_one = 1; - value = lshift_value (mode, value, bitnum, bitsize); + value = lshift_value (mode, v, bitnum); } else { @@ -1862,14 +1862,15 @@ mask_rtx (enum machine_mode mode, int bi } /* Return a constant integer (CONST_INT or CONST_DOUBLE) rtx with the value - VALUE truncated to BITSIZE bits and then shifted left BITPOS bits. */ + VALUE << BITPOS. */ static rtx -lshift_value (enum machine_mode mode, rtx value, int bitpos, int bitsize) +lshift_value (enum machine_mode mode, unsigned HOST_WIDE_INT value, + int bitpos) { double_int val; - val = double_int::from_uhwi (INTVAL (value)).zext (bitsize); + val = double_int::from_uhwi (value); val = val.llshift (bitpos, HOST_BITS_PER_DOUBLE_INT); return immed_double_int_const (val, mode);