public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marius Hillenbrand <mhillen@linux.ibm.com>
To: Andreas Krebbel <krebbel@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org, Marius Hillenbrand <mhillen@linux.ibm.com>
Subject: [PATCH 2/2] gcc/testsuite/s390: Add test cases for float_t
Date: Wed, 25 Nov 2020 18:06:25 +0100	[thread overview]
Message-ID: <20201125170622.5032-3-mhillen@linux.ibm.com> (raw)
In-Reply-To: <20201125170622.5032-1-mhillen@linux.ibm.com>

Add two test cases that check for acceptable combinations of float_t and
FLT_EVAL_METHOD on s390x.

Tested against an as-is glibc and one modified so that it derives
float_t from FLT_EVAL_METHOD.

gcc/testsuite/ChangeLog:

2020-11-25  Marius Hillenbrand  <mhillen@linux.ibm.com>

	* gcc.target/s390/float_t-1.c: New test.
	* gcc.target/s390/float_t-2.c: New test.
---
 gcc/testsuite/gcc.target/s390/float_t-1.c | 15 +++++++++++++++
 gcc/testsuite/gcc.target/s390/float_t-2.c | 13 +++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/s390/float_t-1.c
 create mode 100644 gcc/testsuite/gcc.target/s390/float_t-2.c

diff --git a/gcc/testsuite/gcc.target/s390/float_t-1.c b/gcc/testsuite/gcc.target/s390/float_t-1.c
new file mode 100644
index 00000000000..3455694250f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/float_t-1.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-std=c99" } */
+#include <math.h>
+#include <stdlib.h>
+
+int main()
+{
+  /* In standard-compliant mode, the size of float_t and FLT_EVAL_METHOD must
+     match. */
+  if (sizeof(float_t) == sizeof(double) && __FLT_EVAL_METHOD__ != 1)
+    abort();
+  if (sizeof(float_t) == sizeof(float) && __FLT_EVAL_METHOD__ != 0)
+    abort();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/s390/float_t-2.c b/gcc/testsuite/gcc.target/s390/float_t-2.c
new file mode 100644
index 00000000000..ebeda28b6d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/float_t-2.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include <math.h>
+#include <stdlib.h>
+
+int main()
+{
+  /* In gnuXY mode, the size of float_t and FLT_EVAL_METHOD must
+     match, with the historic exception of permitting double and 0. */
+  if (sizeof(float_t) == sizeof(float) && __FLT_EVAL_METHOD__ == 1)
+    abort();
+  return 0;
+}
-- 
2.26.2


  parent reply	other threads:[~2020-11-25 17:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 17:06 [PATCH 0/2] IBM Z: Prepare cleanup of float express precision Marius Hillenbrand
2020-11-25 17:06 ` [PATCH 1/2] IBM Z: Configure excess precision for float at compile-time Marius Hillenbrand
2020-12-01 10:30   ` Andreas Krebbel
2020-11-25 17:06 ` Marius Hillenbrand [this message]
2020-12-01 10:30   ` [PATCH 2/2] gcc/testsuite/s390: Add test cases for float_t Andreas Krebbel

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=20201125170622.5032-3-mhillen@linux.ibm.com \
    --to=mhillen@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.ibm.com \
    /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).