From patchwork Thu Jul 13 09:02:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107653 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1944643qge; Thu, 13 Jul 2017 02:04:34 -0700 (PDT) X-Received: by 10.99.167.79 with SMTP id w15mr8098160pgo.22.1499936674029; Thu, 13 Jul 2017 02:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936674; cv=none; d=google.com; s=arc-20160816; b=utQBy0wB3NL3lD+jZ/tBoFzuEmXQHraXwP6RLcpdEzbkdk/yUWGEl9UEkNOnrFBVQO 8p2W0OR9Fd9Rk02MhU4bl87mUFhjXAQz96J/C2umGMmwYJhuVpuLOXUTOgcXV3HnERzz yvK9q8cs2tnAgyhycNfGw9o+7CDJHV9dUDkSxh/GOXr5Epdo4I+qg4j+uoN3vSHKnWIS gJhcRLlPGbiIsSNyaog1Lpgp98/FO1HAf5gtnIgbIdW1eS0IH0uU+cqnsyhCZuFZal+Y yUf0jHGcSPWK0/fKk4lLeBJ4+JWZl8ZPtMyXwJRK/uFhlJiNLUExkg+QtyVTiHfvbSif kSEA== 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=MLUAY/ph4IPoK6CwtmU0NQHmFlhoIKe5LyWxD0vq2gw=; b=wxbI5vmfrF5YP4RBfyPC2kNb41ZWOrnUQtOoqH8gF2lvhwISffMmrEygvWrC3N9oFV LOqbb6lwlPNxEOpmC8ubU6im+LpNidLpCM2KA3ib8KOkOT/vC4lL0mCi4vTp0xtjiCPd BYJlGbrn0LyDit9HpUuWATUs9rTHqDDRWxyZ39edI8Ix1FLvPMaueUEldpIql7I5eAIf 76G688ZMhe+Y3FlAkKGVqIGGwvjV8SKJQ8oBY/BeDyGdTGHJAHhc6UzVhKEh6ApfIh+X zCwDFzBe0nhQJaf//Ikfhjl1CyHrlfrvwzs8KdodecZNMD/m/7AGQ/dn2U4yVmQsNPX+ I2eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=NMoLVgI/; spf=pass (google.com: domain of gcc-patches-return-458058-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458058-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 b34si4168237pld.182.2017.07.13.02.04.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 02:04:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458058-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.b=NMoLVgI/; spf=pass (google.com: domain of gcc-patches-return-458058-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458058-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=D7+F2Oq+rhTcOjVBZBRN+k5UapSUM wNOwPDbfWhN6q6AItnPyLsZpc/djg8787XiRvkSwLjTZgfbNWaN7x75YGoz0G1GC 8Q2BfJRMmC+LxRkqw0mH3saXm2BZWw1jY6WH7hUgURFSHqD+iN5+cYyAPjWxGU54 IuFKMSPrKxlM6A= 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=1AVsjG9Ot02U+7GtrhNYlpM0LkM=; b=NMo LVgI/jFy/ebfDDQNPc6JSySaF+4eILJ3aJ5A973qXik0hb3iRKGAvDSz5c7XtKFx 3lh3h6En2xnKJZe21HiBsBGUBD2I8uP8Q6qQEDBNK7FvtWZ2JvdDf42N5gaBFNeO 8nU38rc4MxHiek4zUqKWI4PQsLXy4UyjlVJjJTDA= Received: (qmail 114794 invoked by alias); 13 Jul 2017 09:02:34 -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 113449 invoked by uid 89); 13 Jul 2017 09:02:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 09:02:28 +0000 Received: by mail-wm0-f53.google.com with SMTP id i127so18563960wma.0 for ; Thu, 13 Jul 2017 02:02:27 -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=MLUAY/ph4IPoK6CwtmU0NQHmFlhoIKe5LyWxD0vq2gw=; b=oN7Dfr6300mbmuTHx/uKlYHcxoSEg13OeMdd8+g7X5gZVa2Fy6FdV3iO8AAggM442+ +Ci0uixduwcIkrI2xYfeU7f+7MhnJWCCPSh45fS00KPL0W+U40NAakheDx81sJTZ/rkh f/uDKt99FQvcVyvHkUv+ow4RpV9Nzxl6ua+KMyjZe09oulL8otmJxzWL0X71NRT2R+tu o1TwhF7x81n3USUbleJsJdZdeQWq7dPe4oUORDm6JbIif+6ArzVNCDnwl4WspKxAC+Pl cwznjStXMFyDmH7q557/tVYhwTozYoVNVxtMTpKvE6qyXIhAcNcJAxOixI1aYdRJTZfV rk8w== X-Gm-Message-State: AIVw111EAUcFOScyrcWRIVOQbLYRkg0+jxEbNvtRIrtzcNX+udlOKSjr ELjZQL3TPalYIonXhvEGig== X-Received: by 10.28.169.207 with SMTP id s198mr1276335wme.8.1499936545983; Thu, 13 Jul 2017 02:02:25 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id y12sm4980504wrb.39.2017.07.13.02.02.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 02:02:25 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [67/77] Use scalar_mode in fixed-value.* References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 10:02:23 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <874lugd80w.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes the fixed-value.* routines use scalar_mode. It would be possible to define special classes for these modes, as for scalar_int_mode and scalar_float_mode, but at the moment nothing would benefit from them. In particular, there's no use case that would help select between one class for all fixed-point modes versus one class for fractional modes and one class for accumulator modes. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * fixed-value.h (fixed_from_double_int): Take a scalar_mode rather than a machine_mode. (fixed_from_string): Likewise. (fixed_convert): Likewise. (fixed_convert_from_int): Likewise. (fixed_convert_from_real): Likewise. (real_convert_from_fixed): Likewise. * fixed-value.c (fixed_from_double_int): Likewise. (fixed_from_string): Likewise. (fixed_convert): Likewise. (fixed_convert_from_int): Likewise. (fixed_convert_from_real): Likewise. (real_convert_from_fixed): Likewise. * config/avr/avr.c (avr_out_round): Use as_a . Index: gcc/fixed-value.h =================================================================== --- gcc/fixed-value.h 2017-02-23 19:54:20.000000000 +0000 +++ gcc/fixed-value.h 2017-07-13 09:18:55.158511776 +0100 @@ -47,14 +47,13 @@ extern rtx const_fixed_from_fixed_value /* Construct a FIXED_VALUE from a bit payload and machine mode MODE. The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */ -extern FIXED_VALUE_TYPE fixed_from_double_int (double_int, - machine_mode); +extern FIXED_VALUE_TYPE fixed_from_double_int (double_int, scalar_mode); /* Return a CONST_FIXED from a bit payload and machine mode MODE. The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */ static inline rtx const_fixed_from_double_int (double_int payload, - machine_mode mode) + scalar_mode mode) { return const_fixed_from_fixed_value (fixed_from_double_int (payload, mode), @@ -63,25 +62,25 @@ const_fixed_from_double_int (double_int /* Initialize from a decimal or hexadecimal string. */ extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *, - machine_mode); + scalar_mode); /* In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node. */ extern tree build_fixed (tree, FIXED_VALUE_TYPE); /* Extend or truncate to a new mode. */ -extern bool fixed_convert (FIXED_VALUE_TYPE *, machine_mode, +extern bool fixed_convert (FIXED_VALUE_TYPE *, scalar_mode, const FIXED_VALUE_TYPE *, bool); /* Convert to a fixed-point mode from an integer. */ -extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, machine_mode, +extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, scalar_mode, double_int, bool, bool); /* Convert to a fixed-point mode from a real. */ -extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, machine_mode, +extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, scalar_mode, const REAL_VALUE_TYPE *, bool); /* Convert to a real mode from a fixed-point. */ -extern void real_convert_from_fixed (REAL_VALUE_TYPE *, machine_mode, +extern void real_convert_from_fixed (REAL_VALUE_TYPE *, scalar_mode, const FIXED_VALUE_TYPE *); /* Compare two fixed-point objects for bitwise identity. */ Index: gcc/fixed-value.c =================================================================== --- gcc/fixed-value.c 2017-03-28 16:19:28.000000000 +0100 +++ gcc/fixed-value.c 2017-07-13 09:18:55.158511776 +0100 @@ -86,7 +86,7 @@ check_real_for_fixed_mode (REAL_VALUE_TY The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */ FIXED_VALUE_TYPE -fixed_from_double_int (double_int payload, machine_mode mode) +fixed_from_double_int (double_int payload, scalar_mode mode) { FIXED_VALUE_TYPE value; @@ -108,7 +108,7 @@ fixed_from_double_int (double_int payloa /* Initialize from a decimal or hexadecimal string. */ void -fixed_from_string (FIXED_VALUE_TYPE *f, const char *str, machine_mode mode) +fixed_from_string (FIXED_VALUE_TYPE *f, const char *str, scalar_mode mode) { REAL_VALUE_TYPE real_value, fixed_value, base_value; unsigned int fbit; @@ -803,7 +803,7 @@ fixed_compare (int icode, const FIXED_VA Return true, if !SAT_P and overflow. */ bool -fixed_convert (FIXED_VALUE_TYPE *f, machine_mode mode, +fixed_convert (FIXED_VALUE_TYPE *f, scalar_mode mode, const FIXED_VALUE_TYPE *a, bool sat_p) { bool overflow_p = false; @@ -947,7 +947,7 @@ fixed_convert (FIXED_VALUE_TYPE *f, mach Return true, if !SAT_P and overflow. */ bool -fixed_convert_from_int (FIXED_VALUE_TYPE *f, machine_mode mode, +fixed_convert_from_int (FIXED_VALUE_TYPE *f, scalar_mode mode, double_int a, bool unsigned_p, bool sat_p) { bool overflow_p = false; @@ -1031,7 +1031,7 @@ fixed_convert_from_int (FIXED_VALUE_TYPE Return true, if !SAT_P and overflow. */ bool -fixed_convert_from_real (FIXED_VALUE_TYPE *f, machine_mode mode, +fixed_convert_from_real (FIXED_VALUE_TYPE *f, scalar_mode mode, const REAL_VALUE_TYPE *a, bool sat_p) { bool overflow_p = false; @@ -1090,7 +1090,7 @@ fixed_convert_from_real (FIXED_VALUE_TYP /* Convert to a new real mode from a fixed-point. */ void -real_convert_from_fixed (REAL_VALUE_TYPE *r, machine_mode mode, +real_convert_from_fixed (REAL_VALUE_TYPE *r, scalar_mode mode, const FIXED_VALUE_TYPE *f) { REAL_VALUE_TYPE base_value, fixed_value, real_value; Index: gcc/config/avr/avr.c =================================================================== --- gcc/config/avr/avr.c 2017-07-13 09:18:51.589776273 +0100 +++ gcc/config/avr/avr.c 2017-07-13 09:18:55.158511776 +0100 @@ -9174,7 +9174,7 @@ #define MAY_CLOBBER(RR) const char* avr_out_round (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *xop, int *plen) { - machine_mode mode = GET_MODE (xop[0]); + scalar_mode mode = as_a (GET_MODE (xop[0])); scalar_int_mode imode = *int_mode_for_mode (mode); // The smallest fractional bit not cleared by the rounding is 2^(-RP). int fbit = (int) GET_MODE_FBIT (mode);