{"id":809609,"url":"http://patchwork.ozlabs.org/api/1.0/patches/809609/?format=json","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.0/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<87h8wiitsg.fsf@linaro.org>","date":"2017-09-04T11:31:59","name":"[3/9] (decimal_)float_mode_for_size in real.h","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bf05f7cfce0050a5c4eb34d5fe08bebfd22c5f14","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/1.0/people/5450/?format=json","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/87h8wiitsg.fsf@linaro.org/mbox/","series":[{"id":1357,"url":"http://patchwork.ozlabs.org/api/1.0/series/1357/?format=json","date":"2017-09-04T11:24:26","name":"Make more use of opt_mode","version":1,"mbox":"http://patchwork.ozlabs.org/series/1357/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809609/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-return-461405-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461405-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"tjGC3zsG\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xm7402wH7z9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 21:32:16 +1000 (AEST)","(qmail 89587 invoked by alias); 4 Sep 2017 11:32:09 -0000","(qmail 89577 invoked by uid 89); 4 Sep 2017 11:32:09 -0000","from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com)\n\t(74.125.82.53) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 04 Sep 2017 11:32:04 +0000","by mail-wm0-f53.google.com with SMTP id i145so3162957wmf.1 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 04 Sep 2017 04:32:03 -0700 (PDT)","from localhost (94.197.120.41.threembb.co.uk. [94.197.120.41]) by\n\tsmtp.gmail.com with ESMTPSA id\n\t73sm2495340wrl.56.2017.09.04.04.32.00 for\n\t<gcc-patches@gcc.gnu.org> (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 04 Sep 2017 04:32:01 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:references:date:in-reply-to:message-id:mime-version\n\t:content-type; q=dns; s=default; b=JxQHBMVk5TXHT1/3YQe881AFGukWp\n\tKfy3B5Kk3ZKbEuOMc96Bdyxyd7cF9hCmT0bCK3PUf8OcWSWrXhiCf+K0IyF6gPkG\n\typVyWogCj5OkZaZbFphWGG+uOxb2TLaRWXEb7xqMHgtwNYzZ5bL44OPYItINrjUF\n\tIDWV+6Ycz3AGYA=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:references:date:in-reply-to:message-id:mime-version\n\t:content-type; s=default; bh=fffNn4QALa1Ruq9bF+WvObbJzaE=; b=tjG\n\tC3zsGzp0dWAZhlASIDysyFkKn30kic7nWTvJsXRcnr4t/eDyqE+MrqPjNyTONr3n\n\t0Mjy7qPy2kTdsWJyOehm+qvNiDX6gb/bKXcW/VFZ1m8tE6J/GxG2ETrUB0GLY57E\n\tjNR8WPMPj9M7pQ2VF8VWwB3EvRepLex0oaRT+hMg=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.0 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f53.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:from:to:mail-followup-to:subject:references:date\n\t:in-reply-to:message-id:user-agent:mime-version;\n\tbh=S8K2QRBiekchcY6CnRfLy/DOaUOdYxipnMYS6JfNhYM=;\n\tb=Io+YdVuKDvSqwI6FX/hP37h/5/rV7Nyg1Gypv0Bsq8wo6RdCLIpvVVo/p3/K8qeT1/\n\tOdtM0l0CGChEe+TMa0qwGc9TlH1oyc7UnhW8DY8Z8JXEZkXY/2edtOWu585nmcryoIYu\n\tzhJbhfdi9a8RoAQIpaoa0G/1UtreqxQUTWxkQRNc+lblsgr5cwr9tyQzUfS/HSmUFFSL\n\tPw4OU0HBwJSGOipgXrnesyXIuFfjzZ27HGFkSotW/APRutiMzQN0UNwIcRzQwRZR+N/F\n\tz2mQ7ckHFu3uWx51ycM3kE9fOOhlZqDhsclWx02aN+ovK/xKxAxFPj54Sz7hj0jA521o\n\tyBxg==","X-Gm-Message-State":"AHPjjUjHrRpRPqDE1/owvm4QSuhXqQnCeE2BrgxDf6Ij3kD6rg6RHayL\tT9jGvKL4adfbQLDLX5dPTA==","X-Google-Smtp-Source":"ADKCNb41yWIKzt+EnYP7IwmF5yek+RXl1Q0ucoy2V7DjKL4BQRKbTApNK8PJ8VduWvu17Si5EnlatQ==","X-Received":"by 10.28.97.135 with SMTP id v129mr136444wmb.98.1504524721900;\n\tMon, 04 Sep 2017 04:32:01 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","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\n\t\"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","Content-Type":"text/plain"},"content":"This patch makes the binary float macros in real.h use\nfloat_mode_for_size and adds a corresponding decimal_float_mode_for_size\nfor the decimal macros.\n\n2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>\n\ngcc/\n\t* machmode.h (decimal_float_mode_for_size): New function.\n\t* real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use float_mode_for_size.\n\t(REAL_VALUE_TO_TARGET_DOUBLE): Likewise.\n\t(REAL_VALUE_TO_TARGET_SINGLE): Likewise.\n\t(REAL_VALUE_TO_TARGET_DECIMAL128): Use decimal_float_mode_for_size.\n\t(REAL_VALUE_TO_TARGET_DECIMAL64): Likewise.\n\t(REAL_VALUE_TO_TARGET_DECIMAL32): Likewise.","diff":"Index: gcc/machmode.h\n===================================================================\n--- gcc/machmode.h\t2017-08-30 12:20:57.010045759 +0100\n+++ gcc/machmode.h\t2017-09-04 12:18:47.820398622 +0100\n@@ -652,6 +652,15 @@ float_mode_for_size (unsigned int size)\n   return dyn_cast <scalar_float_mode> (mode_for_size (size, MODE_FLOAT, 0));\n }\n \n+/* Likewise for MODE_DECIMAL_FLOAT.  */\n+\n+inline opt_scalar_float_mode\n+decimal_float_mode_for_size (unsigned int size)\n+{\n+  return dyn_cast <scalar_float_mode>\n+    (mode_for_size (size, MODE_DECIMAL_FLOAT, 0));\n+}\n+\n /* Similar to mode_for_size, but find the smallest mode for a given width.  */\n \n extern machine_mode smallest_mode_for_size (unsigned int, enum mode_class);\nIndex: gcc/real.h\n===================================================================\n--- gcc/real.h\t2017-08-30 12:09:02.416468293 +0100\n+++ gcc/real.h\t2017-09-04 12:18:47.820398622 +0100\n@@ -383,27 +383,28 @@ #define REAL_VALUE_MINUS_ZERO(x)\treal_is\n /* IN is a REAL_VALUE_TYPE.  OUT is an array of longs.  */\n #define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT)\t\t\t\\\n   real_to_target (OUT, &(IN),\t\t\t\t\t\t\\\n-\t\t  mode_for_size (LONG_DOUBLE_TYPE_SIZE, MODE_FLOAT, 0))\n+\t\t  float_mode_for_size (LONG_DOUBLE_TYPE_SIZE).require ())\n \n #define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \\\n-  real_to_target (OUT, &(IN), mode_for_size (64, MODE_FLOAT, 0))\n+  real_to_target (OUT, &(IN), float_mode_for_size (64).require ())\n \n /* IN is a REAL_VALUE_TYPE.  OUT is a long.  */\n #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \\\n-  ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_FLOAT, 0)))\n+  ((OUT) = real_to_target (NULL, &(IN), float_mode_for_size (32).require ()))\n \n /* Real values to IEEE 754 decimal floats.  */\n \n /* IN is a REAL_VALUE_TYPE.  OUT is an array of longs.  */\n #define REAL_VALUE_TO_TARGET_DECIMAL128(IN, OUT) \\\n-  real_to_target (OUT, &(IN), mode_for_size (128, MODE_DECIMAL_FLOAT, 0))\n+  real_to_target (OUT, &(IN), decimal_float_mode_for_size (128).require ())\n \n #define REAL_VALUE_TO_TARGET_DECIMAL64(IN, OUT) \\\n-  real_to_target (OUT, &(IN), mode_for_size (64, MODE_DECIMAL_FLOAT, 0))\n+  real_to_target (OUT, &(IN), decimal_float_mode_for_size (64).require ())\n \n /* IN is a REAL_VALUE_TYPE.  OUT is a long.  */\n #define REAL_VALUE_TO_TARGET_DECIMAL32(IN, OUT) \\\n-  ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_DECIMAL_FLOAT, 0)))\n+  ((OUT) = real_to_target (NULL, &(IN), \\\n+\t\t\t   decimal_float_mode_for_size (32).require ()))\n \n extern REAL_VALUE_TYPE real_value_truncate (format_helper, REAL_VALUE_TYPE);\n \n","prefixes":["3/9"]}