From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 6DA5A3858D28; Fri, 12 Aug 2022 21:17:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DA5A3858D28 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Michael Meissner To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work097)] Add 'w' suffix for __ibm128 constants. X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/users/meissner/heads/work097 X-Git-Oldrev: b417cfa7a0453b60e7188c74f8b22441db0d470e X-Git-Newrev: 7b79b3448dd59ab4e47a56c7c3198dcdb670ee53 Message-Id: <20220812211740.6DA5A3858D28@sourceware.org> Date: Fri, 12 Aug 2022 21:17:40 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2022 21:17:40 -0000 https://gcc.gnu.org/g:7b79b3448dd59ab4e47a56c7c3198dcdb670ee53 commit 7b79b3448dd59ab4e47a56c7c3198dcdb670ee53 Author: Michael Meissner Date: Fri Aug 12 17:17:25 2022 -0400 Add 'w' suffix for __ibm128 constants. In the documentation, we mention that 'w' or 'W' can be used as a suffix for __ibm128 constants. We never implemented this. This patch fixes that. 2022-08-12 Michael Meissner gcc/ * config/rs6000/rs6000.cc (rs6000_c_mode_for_suffix): Allow 'w' or 'W' for __ibm128 constants. gcc/testsuite/ * gcc.target/powerpc/ibm128-suffix.c: New test. Diff: --- gcc/config/rs6000/rs6000.cc | 8 ++------ gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 30dafbce83f..3bedea4f9e6 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -23801,12 +23801,8 @@ rs6000_c_mode_for_suffix (char suffix) if (TARGET_FLOAT128_TYPE && (suffix == 'q' || suffix == 'Q')) return KFmode; - /* At the moment, we are not defining a suffix for IBM extended double. - If/when the default for -mabi=ieeelongdouble is changed, and we want to - support __ibm128 constants in legacy library code, we may need to - re-evalaute this decision. Currently, c-lex.cc only supports 'w' and 'q' - as machine dependent suffixes. The x86_64 port uses 'w' for __float80 - constants. */ + if (TARGET_IBM128 && (suffix == 'w' || suffix == 'W')) + return TYPE_MODE (ibm128_float_type_node); return VOIDmode; } diff --git a/gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c b/gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c new file mode 100644 index 00000000000..ff619860409 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ibm128-suffix.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target longdouble128 } */ +/* { dg-options "-O2" } */ + +/* See if the 'w' suffix is accepted for __ibm128. */ +#ifndef NUMBER +#define NUMBER 123456789012345678901234567890123456789E-10 +#endif + +#define GLUE2(X,Y) X ## Y +#define GLUE(X,Y) GLUE2(X,Y) + +__ibm128 x = GLUE (NUMBER, w);