From patchwork Wed Aug 23 10:56:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 110735 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp3945641qge; Wed, 23 Aug 2017 03:56:20 -0700 (PDT) X-Received: by 10.99.186.67 with SMTP id l3mr2366326pgu.272.1503485780068; Wed, 23 Aug 2017 03:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503485780; cv=none; d=google.com; s=arc-20160816; b=N6wLkFXpYo0XIGph7od40r+C+7YalFsOYX/w7y9LbhPmuD/Su1OK3bshTgdehW9SW/ dogKnqWbVYbWPbRCaGnXOHjawci6NoPZ74jXu9dCU/N/zc7Jvz0QCoZ3FybdzlocSlCG UwtzLEEymhOsln25xFyYgfPZUKhPeodCcZhl0oodQPpxpQYgHRvxpYry29qkk6KPbKdH o+8EaSElzjwX0Tpizqgh8xuOrxD2xggOvtoFDNIpMhojZ7MhidWC3fVl4poM5a5UITtJ uMkhjISAGo11nsa0WCdMHY8E3eCAOEXdcGM0zt0sYHOvVOD/klKMAnzY7WRLLgXVDfE1 E02Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=ibQqfnF1VPShadzdR1t5IZYPMSdYosxXSLp8t08VTiY=; b=yNVt5Kp9gW/nWiZl+XSd7zhublXLQY4zWAm9eUHHXJYLJD05jyajKA58sfNYJxdr6v bJHUVeDvP/IakcHq+Bc8gzxGxxbqN87PhcW/762IeZxrzXJzmINiy8fLxcanBo7a5TXb QKupI4q21tAoj3iYxhBiL+pRvwrl2xqEQyoQTIpJ/QkeNb0dIFPv+PN948KOHV0SmSHl oubfxgvOvs/0B53/Sik7xLQPKFSyu+Zy5qLUi9PB+i+2PP31ITQnpINPT+aHclXArRs7 8lgKFTl1vouSePs40P3wteO9Una5fX1jLHmqtQNmNsOzAh3cghZlaZpsykiP3pulswIj F7Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ttciBSou; spf=pass (google.com: domain of gcc-patches-return-460788-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460788-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k3si479596pgn.707.2017.08.23.03.56.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 03:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-460788-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ttciBSou; spf=pass (google.com: domain of gcc-patches-return-460788-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460788-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=PPCzFQoOeMqyf1+PnE3PBEbX1GN6y1CkkDLlCOZr72sdNWpQJKFs2 ELrqJT7FM912v5qAD6QX5Vo7r1TTJy8exEKbl6mnYuldCOCw2UntHPoq+PEFZwU2 HWRKdMeHiV5pv115uwvTwBOT9n2QLLCYKUYfGzmqBHAwRiHr2NNtdE= 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=oocN7HlO54j0DHdQ36WKRgbb/ew=; b=ttciBSouobirYYb1Wf2I UH7EA+cP8VM3yHjAFV8SgS1fHc5hMy0yh6lkFxKAtNvvsed+eYQ4CaSfPYdCCLQP C2+aS2RoAgvqHmG+/1T5guGW82jZnL7B+JWHwfQc8Zuk0x3TPeFQBF7w/po7woNq WU9q1/Mf3jgWbb+rSkNt+cc= Received: (qmail 39549 invoked by alias); 23 Aug 2017 10:56:07 -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 37073 invoked by uid 89); 23 Aug 2017 10:56:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=subst X-HELO: mail-wr0-f178.google.com Received: from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com) (209.85.128.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Aug 2017 10:56:05 +0000 Received: by mail-wr0-f178.google.com with SMTP id p8so4339489wrf.5 for ; Wed, 23 Aug 2017 03:56:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=ibQqfnF1VPShadzdR1t5IZYPMSdYosxXSLp8t08VTiY=; b=T/nSPf+MrLBtCGHnSMiImhFM4PbW/P+S4BILw5mh8uj9RhAFC+Z1GXmyEHHjFDbmq1 T0JGbM08BC2c4m0PRS1+I/AlE3udxpToncOGwZSZVyZsy9il7DEnrvHV08ItqoG9vEhX A/CQcUl+KTEpQfZioZFLebTd183oXqH72QbI9uCXr+ILWmWBl9MUbfplSH5QQ1mfgwQA BVWmLrfxwerWb7cQ0f6birGVeCYnkBH9P4bm5iK/aqLlvPvgoW/iS8sDOOVqlPstqgJx 5cuoSTB5dYpc71NqcvqF23ZtSrqUMRRT5cOCXlOfaxiUQoLQLzVlNzfhgl6tm3Wge1NI aKZw== X-Gm-Message-State: AHYfb5hlYn/VOBeyXdjNVxm7AOowp19ZAWTJvh+XfdvQynmd/dvsBE9m em94vrbSVhskLYHf/1otbQ== X-Received: by 10.223.177.25 with SMTP id l25mr1240090wra.14.1503485762901; Wed, 23 Aug 2017 03:56:02 -0700 (PDT) Received: from localhost (92.40.249.210.threembb.co.uk. [92.40.249.210]) by smtp.gmail.com with ESMTPSA id c19sm791255wre.43.2017.08.23.03.56.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2017 03:56:02 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Make more use of GET_MODE_UNIT_BITSIZE Date: Wed, 23 Aug 2017 11:56:00 +0100 Message-ID: <87k21utuwv.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch is like the previous GET_MODE_UNIT_SIZE one, but for bit rather than byte sizes. Tested on aarch64-linux-gnu and x86_64-linux-gnu, and by making sure that there were no differences in testsuite assembly output for one target per CPU. OK to install? Richard 2017-08-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * cfgexpand.c (expand_debug_expr): Use GET_MODE_UNIT_BITSIZE. (expand_debug_source_expr): Likewise. * combine.c (combine_simplify_rtx): Likewise. * cse.c (fold_rtx): Likewise. * fwprop.c (canonicalize_address): Likewise. * targhooks.c (default_shift_truncation_mask): Likewise. Index: gcc/cfgexpand.c =================================================================== --- gcc/cfgexpand.c 2017-08-21 12:14:39.685583530 +0100 +++ gcc/cfgexpand.c 2017-08-23 10:48:32.452867722 +0100 @@ -4331,9 +4331,11 @@ expand_debug_expr (tree exp) if (FLOAT_MODE_P (mode) && FLOAT_MODE_P (inner_mode)) { - if (GET_MODE_BITSIZE (mode) == GET_MODE_BITSIZE (inner_mode)) + if (GET_MODE_UNIT_BITSIZE (mode) + == GET_MODE_UNIT_BITSIZE (inner_mode)) op0 = simplify_gen_subreg (mode, op0, inner_mode, 0); - else if (GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (inner_mode)) + else if (GET_MODE_UNIT_BITSIZE (mode) + < GET_MODE_UNIT_BITSIZE (inner_mode)) op0 = simplify_gen_unary (FLOAT_TRUNCATE, mode, op0, inner_mode); else op0 = simplify_gen_unary (FLOAT_EXTEND, mode, op0, inner_mode); @@ -5194,9 +5196,11 @@ expand_debug_source_expr (tree exp) if (FLOAT_MODE_P (mode) && FLOAT_MODE_P (inner_mode)) { - if (GET_MODE_BITSIZE (mode) == GET_MODE_BITSIZE (inner_mode)) + if (GET_MODE_UNIT_BITSIZE (mode) + == GET_MODE_UNIT_BITSIZE (inner_mode)) op0 = simplify_gen_subreg (mode, op0, inner_mode, 0); - else if (GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (inner_mode)) + else if (GET_MODE_UNIT_BITSIZE (mode) + < GET_MODE_UNIT_BITSIZE (inner_mode)) op0 = simplify_gen_unary (FLOAT_TRUNCATE, mode, op0, inner_mode); else op0 = simplify_gen_unary (FLOAT_EXTEND, mode, op0, inner_mode); Index: gcc/combine.c =================================================================== --- gcc/combine.c 2017-08-23 10:47:17.537756580 +0100 +++ gcc/combine.c 2017-08-23 10:48:32.453862693 +0100 @@ -6233,7 +6233,8 @@ combine_simplify_rtx (rtx x, machine_mod SUBST (XEXP (x, 1), force_to_mode (XEXP (x, 1), GET_MODE (XEXP (x, 1)), (HOST_WIDE_INT_1U - << exact_log2 (GET_MODE_BITSIZE (GET_MODE (x)))) + << exact_log2 (GET_MODE_UNIT_BITSIZE + (GET_MODE (x)))) - 1, 0)); break; Index: gcc/cse.c =================================================================== --- gcc/cse.c 2017-08-23 10:46:06.552151584 +0100 +++ gcc/cse.c 2017-08-23 10:48:32.454857664 +0100 @@ -3611,7 +3611,7 @@ fold_rtx (rtx x, rtx_insn *insn) { if (SHIFT_COUNT_TRUNCATED) canon_const_arg1 = GEN_INT (INTVAL (const_arg1) - & (GET_MODE_BITSIZE (mode) + & (GET_MODE_UNIT_BITSIZE (mode) - 1)); else break; @@ -3660,7 +3660,8 @@ fold_rtx (rtx x, rtx_insn *insn) { if (SHIFT_COUNT_TRUNCATED) inner_const = GEN_INT (INTVAL (inner_const) - & (GET_MODE_BITSIZE (mode) - 1)); + & (GET_MODE_UNIT_BITSIZE (mode) + - 1)); else break; } @@ -3690,7 +3691,7 @@ fold_rtx (rtx x, rtx_insn *insn) /* As an exception, we can turn an ASHIFTRT of this form into a shift of the number of bits - 1. */ if (code == ASHIFTRT) - new_const = GEN_INT (GET_MODE_BITSIZE (mode) - 1); + new_const = GEN_INT (GET_MODE_UNIT_BITSIZE (mode) - 1); else if (!side_effects_p (XEXP (y, 0))) return CONST0_RTX (mode); else Index: gcc/fwprop.c =================================================================== --- gcc/fwprop.c 2017-08-22 17:14:30.336881519 +0100 +++ gcc/fwprop.c 2017-08-23 10:48:32.454857664 +0100 @@ -357,8 +357,8 @@ canonicalize_address (rtx x) { case ASHIFT: if (CONST_INT_P (XEXP (x, 1)) - && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (GET_MODE (x)) - && INTVAL (XEXP (x, 1)) >= 0) + && INTVAL (XEXP (x, 1)) < GET_MODE_UNIT_BITSIZE (GET_MODE (x)) + && INTVAL (XEXP (x, 1)) >= 0) { HOST_WIDE_INT shift = INTVAL (XEXP (x, 1)); PUT_CODE (x, MULT); Index: gcc/targhooks.c =================================================================== --- gcc/targhooks.c 2017-07-27 10:37:54.553030575 +0100 +++ gcc/targhooks.c 2017-08-23 10:48:32.455852635 +0100 @@ -245,7 +245,7 @@ default_unwind_word_mode (void) unsigned HOST_WIDE_INT default_shift_truncation_mask (machine_mode mode) { - return SHIFT_COUNT_TRUNCATED ? GET_MODE_BITSIZE (mode) - 1 : 0; + return SHIFT_COUNT_TRUNCATED ? GET_MODE_UNIT_BITSIZE (mode) - 1 : 0; } /* The default implementation of TARGET_MIN_DIVISIONS_FOR_RECIP_MUL. */