From patchwork Mon Sep 4 11:31:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 111543 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp4109750ybm; Mon, 4 Sep 2017 04:32:22 -0700 (PDT) X-Received: by 10.98.34.219 with SMTP id p88mr100823pfj.121.1504524742296; Mon, 04 Sep 2017 04:32:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504524742; cv=none; d=google.com; s=arc-20160816; b=GGAV/qL0RwxzEpJmskjqh28eSjJUM01ktoM7HGi+BIlZKydB/h4JRyvO0TrI6hkWNI T9rwr4NtRS8BQqIW0QXlJ3kShTk42a0YHrPsgGvesDpDVpoYb+dIP+7qXQGvdpq0UbWp tD6kepy3YKRIvfNhDkxoAD0E1pNF+NDAZ+hQ/LkhB2TVpkLSZJxfImDGc0TLy8vxnV6S HO3NVcDthHOw9iWs1J0bm7dbly7i0gByvUFG2InRJhvBby2DUkAe1tJscOygxyGFf6TR xdGhBR/NyI+phJML/L4KZ7CX8suZzoTm45hHjU+p7e+J7RZm/t+gCD3hJPqhhAJRWWd4 N0EQ== 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=S8K2QRBiekchcY6CnRfLy/DOaUOdYxipnMYS6JfNhYM=; b=dRz5WBKYIeUevmj3e+spgkTidXGvsugNliJjHtrHRUAFcQs14XdGe0qJf4RgAz0WU3 t1TbcxyCHFVdYDnLGgzLXVUnOJ2rQ8n1/bcjK8Y3JcPwAXCisWaR6qxhBheKzPKyIfo7 Lj8YkYYNdmMOJltSwfc9bE5Ysc0EA5DrJjpPbZLxwSwRHp9el2gwwAPtMfB/tl4MOBNQ y+EVpmRZ2gJgAu7cun28PMW9Fpds7fNH6aUCpZ4fVoxMu9yG/rDmxXY8YhlERGyCUeB6 YfxNKXFJc0nOFWDVzHcXs9mMgp0rmFImcyxa8tBW7QLaf623rJETe0Cg0looP+4oZoKD IPIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Fg0ICX0a; spf=pass (google.com: domain of gcc-patches-return-461405-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461405-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 t5si5508565plm.198.2017.09.04.04.32.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 04:32:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-461405-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=Fg0ICX0a; spf=pass (google.com: domain of gcc-patches-return-461405-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461405-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=tyBYJLDldXtBKZ27RC5qKER5TGk3B XHBmYy8Q1EgL9gv3DbG1Cvj9U+x5g4VR0MuPzwe89ukdEF688UiZjC0P2IN/6xLf NkSWTw7zGq+hEw5q0sRZ1qJ2w6PebHHk+ohwZl5xlNS2MOVAwDpQ6f9o0mgf9PIK xmG8IaBSxwWgww= 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=fffNn4QALa1Ruq9bF+WvObbJzaE=; b=Fg0 ICX0aAV+VI9pTXVr7XtJk6X1W7ls5zdXB22SR8Z4qUstJXBPxwX6ASlOqLucXwEr 8Tu2u4Brrr5B7bbqWCAQRitKGzILI2pCgStlprlOIXKNziK8byRIE7pDcYMbNxa3 a71vvzXaBnQBcSGQgkQmqPNw0mNHfIUaTVYw7hWA= Received: (qmail 89587 invoked by alias); 4 Sep 2017 11:32:09 -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 89577 invoked by uid 89); 4 Sep 2017 11:32:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 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; Mon, 04 Sep 2017 11:32:04 +0000 Received: by mail-wm0-f53.google.com with SMTP id i145so3162957wmf.1 for ; Mon, 04 Sep 2017 04:32:03 -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=S8K2QRBiekchcY6CnRfLy/DOaUOdYxipnMYS6JfNhYM=; b=Io+YdVuKDvSqwI6FX/hP37h/5/rV7Nyg1Gypv0Bsq8wo6RdCLIpvVVo/p3/K8qeT1/ OdtM0l0CGChEe+TMa0qwGc9TlH1oyc7UnhW8DY8Z8JXEZkXY/2edtOWu585nmcryoIYu zhJbhfdi9a8RoAQIpaoa0G/1UtreqxQUTWxkQRNc+lblsgr5cwr9tyQzUfS/HSmUFFSL Pw4OU0HBwJSGOipgXrnesyXIuFfjzZ27HGFkSotW/APRutiMzQN0UNwIcRzQwRZR+N/F z2mQ7ckHFu3uWx51ycM3kE9fOOhlZqDhsclWx02aN+ovK/xKxAxFPj54Sz7hj0jA521o yBxg== X-Gm-Message-State: AHPjjUjHrRpRPqDE1/owvm4QSuhXqQnCeE2BrgxDf6Ij3kD6rg6RHayL T9jGvKL4adfbQLDLX5dPTA== X-Google-Smtp-Source: ADKCNb41yWIKzt+EnYP7IwmF5yek+RXl1Q0ucoy2V7DjKL4BQRKbTApNK8PJ8VduWvu17Si5EnlatQ== X-Received: by 10.28.97.135 with SMTP id v129mr136444wmb.98.1504524721900; Mon, 04 Sep 2017 04:32:01 -0700 (PDT) Received: from localhost (94.197.120.41.threembb.co.uk. [94.197.120.41]) by smtp.gmail.com with ESMTPSA id 73sm2495340wrl.56.2017.09.04.04.32.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Sep 2017 04:32:01 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [3/9] (decimal_)float_mode_for_size in real.h References: <87tw0iiu51.fsf@linaro.org> Date: Mon, 04 Sep 2017 12:31:59 +0100 In-Reply-To: <87tw0iiu51.fsf@linaro.org> (Richard Sandiford's message of "Mon, 04 Sep 2017 12:24:26 +0100") Message-ID: <87h8wiitsg.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes the binary float macros in real.h use float_mode_for_size and adds a corresponding decimal_float_mode_for_size for the decimal macros. 2017-09-04 Richard Sandiford gcc/ * machmode.h (decimal_float_mode_for_size): New function. * real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use float_mode_for_size. (REAL_VALUE_TO_TARGET_DOUBLE): Likewise. (REAL_VALUE_TO_TARGET_SINGLE): Likewise. (REAL_VALUE_TO_TARGET_DECIMAL128): Use decimal_float_mode_for_size. (REAL_VALUE_TO_TARGET_DECIMAL64): Likewise. (REAL_VALUE_TO_TARGET_DECIMAL32): Likewise. Index: gcc/machmode.h =================================================================== --- gcc/machmode.h 2017-08-30 12:20:57.010045759 +0100 +++ gcc/machmode.h 2017-09-04 12:18:47.820398622 +0100 @@ -652,6 +652,15 @@ float_mode_for_size (unsigned int size) return dyn_cast (mode_for_size (size, MODE_FLOAT, 0)); } +/* Likewise for MODE_DECIMAL_FLOAT. */ + +inline opt_scalar_float_mode +decimal_float_mode_for_size (unsigned int size) +{ + return dyn_cast + (mode_for_size (size, MODE_DECIMAL_FLOAT, 0)); +} + /* Similar to mode_for_size, but find the smallest mode for a given width. */ extern machine_mode smallest_mode_for_size (unsigned int, enum mode_class); Index: gcc/real.h =================================================================== --- gcc/real.h 2017-08-30 12:09:02.416468293 +0100 +++ gcc/real.h 2017-09-04 12:18:47.820398622 +0100 @@ -383,27 +383,28 @@ #define REAL_VALUE_MINUS_ZERO(x) real_is /* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */ #define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) \ real_to_target (OUT, &(IN), \ - mode_for_size (LONG_DOUBLE_TYPE_SIZE, MODE_FLOAT, 0)) + float_mode_for_size (LONG_DOUBLE_TYPE_SIZE).require ()) #define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \ - real_to_target (OUT, &(IN), mode_for_size (64, MODE_FLOAT, 0)) + real_to_target (OUT, &(IN), float_mode_for_size (64).require ()) /* IN is a REAL_VALUE_TYPE. OUT is a long. */ #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \ - ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_FLOAT, 0))) + ((OUT) = real_to_target (NULL, &(IN), float_mode_for_size (32).require ())) /* Real values to IEEE 754 decimal floats. */ /* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */ #define REAL_VALUE_TO_TARGET_DECIMAL128(IN, OUT) \ - real_to_target (OUT, &(IN), mode_for_size (128, MODE_DECIMAL_FLOAT, 0)) + real_to_target (OUT, &(IN), decimal_float_mode_for_size (128).require ()) #define REAL_VALUE_TO_TARGET_DECIMAL64(IN, OUT) \ - real_to_target (OUT, &(IN), mode_for_size (64, MODE_DECIMAL_FLOAT, 0)) + real_to_target (OUT, &(IN), decimal_float_mode_for_size (64).require ()) /* IN is a REAL_VALUE_TYPE. OUT is a long. */ #define REAL_VALUE_TO_TARGET_DECIMAL32(IN, OUT) \ - ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_DECIMAL_FLOAT, 0))) + ((OUT) = real_to_target (NULL, &(IN), \ + decimal_float_mode_for_size (32).require ())) extern REAL_VALUE_TYPE real_value_truncate (format_helper, REAL_VALUE_TYPE);