From patchwork Mon Oct 23 17:03:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116753 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4868628qgn; Mon, 23 Oct 2017 10:03:36 -0700 (PDT) X-Received: by 10.99.37.193 with SMTP id l184mr12778294pgl.14.1508778216717; Mon, 23 Oct 2017 10:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508778216; cv=none; d=google.com; s=arc-20160816; b=rkJgIWQwcuyn6tEdRUEAl2FzrCKl09hEf2lZAS8siEDraCgfY57E0XPNp6tG7f/H7Q HJFe5FtktJn2iemiTjfEWFDzGR9ZtWUjPPD84AJTrGHSOHgxWUIKou+8cVXqida2+Otj +Ao15sI6FIPDl3nbDUqgxyraxvEMOkt7xBHSbqcP5Fe7vqGu0ZcQWD0fZGoe+KOkXqMa g6HXkIbZgkZnJZSVfTgJCTYtJbLYd4hBEoXyfsWAQpZidOJWspocCvy+SGYougwkL/uv bH+5zKVz7FZlHfS+fgdnTdo28xABoRCdXw88ozre0J4A4O2BWSCKWUpaSTMOWH5xnpup 3FFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :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=Rh1NYsQbCrWJ2DpBOm9/e9RtqOd+/vy6ZgfJWLyHjH8=; b=0qJ9XM5tF6d2ghFqBcBABLaRu0ba8sfh8Jkt10hhjZhK6zhXH0Gm17ovzbQLgaBvky 96/Ev68aP1ZOVY5TALGewBJJKrwp278+eHj9jm9ned0CFKHlTuly9LP3Q8GrHTyhBuM+ Qb7oZR0WiuyZdfnLMRUm+2fGTylhMojjESjg7XJFhMH+tF5thfFYIcD6bW+tmIPig36r YttMvkis0PESCssDA1MwxRL5s3yJFhlqdH4NonNmL+oBspGTQOX+lwfgz48YE9U/SsAL QuF9s92BOk/PZWvnU/D2IorWjtV8WNC6RxmtH5AhN7F3WrWm2KAEFufOtVJc19IEET0g d8xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uaZTc0VR; spf=pass (google.com: domain of gcc-patches-return-464784-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464784-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 v187si5621680pfv.301.2017.10.23.10.03.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:03:36 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464784-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=uaZTc0VR; spf=pass (google.com: domain of gcc-patches-return-464784-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464784-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:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=RySqyWRUDJie09ytDxCwXYCwjGEfM EXfw3/ZeyCoAXxGlsaso3boUDLbhFQ3z9z7czIwYm0Adbp353oHei//xTAIlHPAp sS/Vqv+5J7F86Zw8tUa91Fj2ADm1VmCU68ToAiX4tDxPeNn1wcyJ3N1pbaXNtPsv +zcrbAjyan64TE= 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:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=v6imkTpi9YKs/ppVXp9TduXZNIM=; b=uaZ Tc0VRe21CpHkt77k+HROAwKrL9mpFUce1YeG3qWemr1lIkyzxd8NmXyPOOJmMGtc Sk/2+RdOhlJPGMAsYd4KgQu+gx9XFz1Y8lK6qWbP4D3ofhGhApDVhlN2+UX8dGYc tFolbbzLTh5i31sRnwr3bZVoFzh9j+8R6CGJjukA= Received: (qmail 107336 invoked by alias); 23 Oct 2017 17:03:23 -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 107321 invoked by uid 89); 23 Oct 2017 17:03:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.5 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= X-HELO: mail-wr0-f175.google.com Received: from mail-wr0-f175.google.com (HELO mail-wr0-f175.google.com) (209.85.128.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:03:21 +0000 Received: by mail-wr0-f175.google.com with SMTP id l1so18123107wrc.3 for ; Mon, 23 Oct 2017 10:03:21 -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:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Rh1NYsQbCrWJ2DpBOm9/e9RtqOd+/vy6ZgfJWLyHjH8=; b=ZizX90gUf4WloJ8TiApzgT45o9amFuBsLpEfaJobr4HCNBne3lg9C+r3yQgVHDv7X4 pJq+MVKwy6GXlsfXK5Bt8tJ9nUyrHhnBWkywBZJwQ2D8irclSfkyX4sOqYzaTG4CuiQf uacvwGHWBkQKt9AmH9j3BYd2d8h9Lo3xPB53ovel20uF+Fww44iL/Tkkey0J4QnY+Ika xv9uiVJukfuLfIbCsvRKUUS1A5icTX4VnorxHoxbqgvi1/xlRqs+kT+nQod523v2MIEO FD6XJ0NUybHX/UFWCKcO7Fh5hmLaVymqFyhuDrqJL7T8Pdd9KBmRkYMtzFViMVghdiY4 Ru7w== X-Gm-Message-State: AMCzsaWLLtL5BuMDVmH/LSn0qN+e1ZgNmMBkBpMDGCkMy0wcMTpjVL64 LP62iSw9utMJM7TSfDLVAXVudV0Rfks= X-Google-Smtp-Source: ABhQp+Qrtjck3HumTN9kbdzyOzpK7kBkyjVSieoeW0JOtQK9O1Du60peiqwrWg3CPZ/BvtGKaij+pQ== X-Received: by 10.223.143.54 with SMTP id p51mr3714638wrb.138.1508778199505; Mon, 23 Oct 2017 10:03:19 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id b81sm2970987wmb.6.2017.10.23.10.03.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:03:17 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [009/nnn] poly_int: TRULY_NOOP_TRUNCATION References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:03:16 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87tvypssob.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes TRULY_NOOP_TRUNCATION take the mode sizes as poly_uint64s instead of unsigned ints. The function bodies don't need to change. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * target.def (truly_noop_truncation): Take poly_uint64s instead of unsigned ints. Change default to hook_bool_puint64_puint64_true. * doc/tm.texi: Regenerate. * hooks.h (hook_bool_uint_uint_true): Delete. (hook_bool_puint64_puint64_true): Declare. * hooks.c (hook_bool_uint_uint_true): Delete. (hook_bool_puint64_puint64_true): New function. * config/mips/mips.c (mips_truly_noop_truncation): Take poly_uint64s instead of unsigned ints. * config/spu/spu.c (spu_truly_noop_truncation): Likewise. * config/tilegx/tilegx.c (tilegx_truly_noop_truncation): Likewise. Index: gcc/target.def =================================================================== --- gcc/target.def 2017-10-23 17:00:20.920834919 +0100 +++ gcc/target.def 2017-10-23 17:01:04.215112587 +0100 @@ -3155,8 +3155,8 @@ is correct for most machines.\n\ If @code{TARGET_MODES_TIEABLE_P} returns false for a pair of modes,\n\ suboptimal code can result if this hook returns true for the corresponding\n\ mode sizes. Making this hook return false in such cases may improve things.", - bool, (unsigned int outprec, unsigned int inprec), - hook_bool_uint_uint_true) + bool, (poly_uint64 outprec, poly_uint64 inprec), + hook_bool_puint64_puint64_true) /* If the representation of integral MODE is such that values are always sign-extended to a wider mode MODE_REP then return Index: gcc/doc/tm.texi =================================================================== --- gcc/doc/tm.texi 2017-10-23 17:00:20.917834257 +0100 +++ gcc/doc/tm.texi 2017-10-23 17:01:04.214113496 +0100 @@ -10823,7 +10823,7 @@ nevertheless truncate the shift count, y by overriding it. @end deftypefn -@deftypefn {Target Hook} bool TARGET_TRULY_NOOP_TRUNCATION (unsigned int @var{outprec}, unsigned int @var{inprec}) +@deftypefn {Target Hook} bool TARGET_TRULY_NOOP_TRUNCATION (poly_uint64 @var{outprec}, poly_uint64 @var{inprec}) This hook returns true if it is safe to ``convert'' a value of @var{inprec} bits to one of @var{outprec} bits (where @var{outprec} is smaller than @var{inprec}) by merely operating on it as if it had only Index: gcc/hooks.h =================================================================== --- gcc/hooks.h 2017-10-23 16:52:20.369642299 +0100 +++ gcc/hooks.h 2017-10-23 17:01:04.214113496 +0100 @@ -39,7 +39,7 @@ extern bool hook_bool_const_rtx_insn_con const rtx_insn *); extern bool hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT); -extern bool hook_bool_uint_uint_true (unsigned int, unsigned int); +extern bool hook_bool_puint64_puint64_true (poly_uint64, poly_uint64); extern bool hook_bool_uint_mode_false (unsigned int, machine_mode); extern bool hook_bool_uint_mode_true (unsigned int, machine_mode); extern bool hook_bool_tree_false (tree); Index: gcc/hooks.c =================================================================== --- gcc/hooks.c 2017-10-23 16:52:20.369642299 +0100 +++ gcc/hooks.c 2017-10-23 17:01:04.214113496 +0100 @@ -133,9 +133,9 @@ hook_bool_mode_uhwi_false (machine_mode, return false; } -/* Generic hook that takes (unsigned int, unsigned int) and returns true. */ +/* Generic hook that takes (poly_uint64, poly_uint64) and returns true. */ bool -hook_bool_uint_uint_true (unsigned int, unsigned int) +hook_bool_puint64_puint64_true (poly_uint64, poly_uint64) { return true; } Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2017-10-23 17:00:43.528930533 +0100 +++ gcc/config/mips/mips.c 2017-10-23 17:01:04.211116223 +0100 @@ -22322,7 +22322,7 @@ mips_promote_function_mode (const_tree t /* Implement TARGET_TRULY_NOOP_TRUNCATION. */ static bool -mips_truly_noop_truncation (unsigned int outprec, unsigned int inprec) +mips_truly_noop_truncation (poly_uint64 outprec, poly_uint64 inprec) { return !TARGET_64BIT || inprec <= 32 || outprec > 32; } Index: gcc/config/spu/spu.c =================================================================== --- gcc/config/spu/spu.c 2017-10-23 17:00:43.548912356 +0100 +++ gcc/config/spu/spu.c 2017-10-23 17:01:04.212115314 +0100 @@ -7182,7 +7182,7 @@ spu_can_change_mode_class (machine_mode /* Implement TARGET_TRULY_NOOP_TRUNCATION. */ static bool -spu_truly_noop_truncation (unsigned int outprec, unsigned int inprec) +spu_truly_noop_truncation (poly_uint64 outprec, poly_uint64 inprec) { return inprec <= 32 && outprec <= inprec; } Index: gcc/config/tilegx/tilegx.c =================================================================== --- gcc/config/tilegx/tilegx.c 2017-10-23 17:00:43.551909629 +0100 +++ gcc/config/tilegx/tilegx.c 2017-10-23 17:01:04.213114405 +0100 @@ -5566,7 +5566,7 @@ tilegx_file_end (void) as sign-extended DI values in registers. */ static bool -tilegx_truly_noop_truncation (unsigned int outprec, unsigned int inprec) +tilegx_truly_noop_truncation (poly_uint64 outprec, poly_uint64 inprec) { return inprec <= 32 || outprec > 32; }