public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Michael Meissner <meissner@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/meissner/heads/work078)] Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__.
Date: Wed, 16 Feb 2022 20:25:27 +0000 (GMT)	[thread overview]
Message-ID: <20220216202527.DAF37385801C@sourceware.org> (raw)

https://gcc.gnu.org/g:dcfc76034e46e8be67f92f427c16293b04a0febe

commit dcfc76034e46e8be67f92f427c16293b04a0febe
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Wed Feb 16 15:25:09 2022 -0500

    Define __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__.
    
    Define the sizes of the PowerPC specific types __float128 and __ibm128 if those
    types are enabled.
    
    2022-02-16  Michael Meissner  <meissner@the-meissners.org>
    
    gcc/
            PR target/99708
            * config/rs6000/rs6000-c.cc (rs6000_cpu_cpp_builtins): Define
            __SIZEOF_IBM128__ if the IBM 128-bit long double type is created.
            Define __SIZEOF_FLOAT128__ if we have float128 support.
    
    gcc/testsuite/
            PR target/99708
            * gcc.target/powerpc/pr99708.c: New test.

Diff:
---
 gcc/config/rs6000/rs6000-c.cc              |  7 ++++++-
 gcc/testsuite/gcc.target/powerpc/pr99708.c | 21 +++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 15251efc209..ec4e5c3f53a 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -622,8 +622,13 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
     builtin_define ("__RSQRTE__");
   if (TARGET_FRSQRTES)
     builtin_define ("__RSQRTEF__");
+  if (ibm128_float_type_node)
+    builtin_define ("__SIZEOF_IBM128__=16");
   if (TARGET_FLOAT128_TYPE)
-    builtin_define ("__FLOAT128_TYPE__");
+    {
+      builtin_define ("__FLOAT128_TYPE__");
+      builtin_define ("__SIZEOF_FLOAT128__=16");
+    }
 #ifdef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB
   builtin_define ("__BUILTIN_CPU_SUPPORTS__");
 #endif
diff --git a/gcc/testsuite/gcc.target/powerpc/pr99708.c b/gcc/testsuite/gcc.target/powerpc/pr99708.c
new file mode 100644
index 00000000000..d478f7bc4c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr99708.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -mfloat128" } */
+
+/*
+ * PR target/99708
+ *
+ * Verify that __SIZEOF_FLOAT128__ and __SIZEOF_IBM128__ are properly defined.
+ */
+
+#include <stdlib.h>
+
+int main (void)
+{
+  if (__SIZEOF_FLOAT128__ != sizeof (__float128)
+      || __SIZEOF_IBM128__ != sizeof (__ibm128))
+    abort ();
+
+  return 0;
+}
+


             reply	other threads:[~2022-02-16 20:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 20:25 Michael Meissner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-17  0:37 Michael Meissner
2022-02-16 17:58 Michael Meissner
2022-02-15 16:59 Michael Meissner
2022-02-15  4:58 Michael Meissner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220216202527.DAF37385801C@sourceware.org \
    --to=meissner@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).