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: 787618 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x7VHr5PpCz9ryv for ; Thu, 13 Jul 2017 19:04:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="yIMZNy9C"; dkim-atps=neutral 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=TVawErAjdnGCAiKia3g3pfGr0Nxcj g9v9he2/ZkqCxHfGrh9owwv9J8xiu97V4gqX4BZKnkV2z4cocMMmkY6n/Tvk5wmq JeLy751m5peWcqdR8MdiHEjQZ177K/LTgqsb81NP1aXCUjJhOc9ViftyvGcMHR12 +xvKB5FP6H6thI= 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=yIM ZNy9CtPI7BnTswUZAtfs3UZz1WnJ0g5HmisBceXznHgn3yohtojtfpHnh0xsSE/W GghKpAJtSyiCTp7eZMYpS0t/KCWfjV8WKIe02dp1GE1CR6IfLMuN6Qs/47MkIwI2 1kcwYpsfrRNm8cALor8UvQQxMeFBSSYWlScmTRA8= 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);