From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1206 invoked by alias); 5 Sep 2017 11:24:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 1110 invoked by uid 89); 5 Sep 2017 11:24:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,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-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Sep 2017 11:24:15 +0000 Received: by mail-wm0-f45.google.com with SMTP id h144so3873336wme.0 for ; Tue, 05 Sep 2017 04:24: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:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=5NizQaEXu1tmb4oeogBRaOWZ1NfScUjAhNYWyFF+aZY=; b=Xp83bklMZc8m5XPKCKATyUUj9LKygB+R4dvjVCjE0OJFas8WEeBv/jYgrKy6LzKWS2 Bj+gZ5j/qphIfQSkR/q9E4WXdgscskLJ9Ff1XRlwBb404/74/ixqG1c/FQdyINbkr3yn QtD2oq1iV1ywJ+E5m9JWJy90mTsM3mSlpaP9iZ/Gy5+zVkbh98uIIo1La44DdJvKRMgR EOuqs8+DgIPrTOUB3sV+6GvBuZijss7iqvkHwvrD7C4LJrDw5G2RjyazXyE/H91XyKer tbgJSkCR+E6Yq53LEPBh3sbhdz7UVuGsQSO7SeFwNCKGi9SdWjrfxxZxSfz31kyr1E2D AA+A== X-Gm-Message-State: AHPjjUhu8+eo9WrC5Wot222TlGpFt/jgyDA+giOcUoKad+sLaEGwTkRT T23RqKYJuOzE2AiyjrBs/p0Vm4v0Uo6I X-Google-Smtp-Source: ADKCNb61CfUj8G9t09N4VBEjlI1ZMnz0sC7sILW7JPxeo/R4ELp1rhSboRikIbA6LIlk7PCe5GAIVFZoU4zpSuVDGD0= X-Received: by 10.80.146.9 with SMTP id i9mr3176041eda.148.1504610642761; Tue, 05 Sep 2017 04:24:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.180.205 with HTTP; Tue, 5 Sep 2017 04:24:02 -0700 (PDT) In-Reply-To: <87h8wiitsg.fsf@linaro.org> References: <87tw0iiu51.fsf@linaro.org> <87h8wiitsg.fsf@linaro.org> From: Richard Biener Date: Tue, 05 Sep 2017 11:24:00 -0000 Message-ID: Subject: Re: [3/9] (decimal_)float_mode_for_size in real.h To: GCC Patches , Richard Sandiford Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00252.txt.bz2 On Mon, Sep 4, 2017 at 1:31 PM, Richard Sandiford wrote: > 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. Ok. Richard. > 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); >