From: Uros Bizjak <ubizjak@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: [PATCH] PR target/69225: gcc uses double precision instead of single float with -m32 -std=c99 -msoft-float
Date: Mon, 11 Jan 2016 16:15:00 -0000 [thread overview]
Message-ID: <CAFULd4bEr8i=SSX67fLwyiYyS4qCDdC=6d-4BmsgU_OmE2A8NA@mail.gmail.com> (raw)
In-Reply-To: <20160111145237.GA7821@gmail.com>
On Mon, Jan 11, 2016 at 3:52 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> When FPU isn't used, there is no excess precision. We should set
> FLT_EVAL_METHOD to 0 if 387 is disabled.
>
> OK for trunk?
>
> Thanks.
>
> H.J.
> ---
> gcc/
>
> PR target/69225
> * config/i386/i386.h (TARGET_FLT_EVAL_METHOD): Set to 0 if
> TARGET_80387 is false.
>
> gcc/testsuite
>
> PR target/69225
> * gcc.target/i386/pr69225-1.c: New test.
> * gcc.target/i386/pr69225-2.c: Likewise.
> * gcc.target/i386/pr69225-3.c: Likewise.
> * gcc.target/i386/pr69225-4.c: Likewise.
> * gcc.target/i386/pr69225-5.c: Likewise.
> * gcc.target/i386/pr69225-6.c: Likewise.
> ---
> gcc/config/i386/i386.h | 4 ++--
> gcc/testsuite/gcc.target/i386/pr69225-1.c | 8 ++++++++
> gcc/testsuite/gcc.target/i386/pr69225-2.c | 8 ++++++++
> gcc/testsuite/gcc.target/i386/pr69225-3.c | 8 ++++++++
> gcc/testsuite/gcc.target/i386/pr69225-4.c | 8 ++++++++
> gcc/testsuite/gcc.target/i386/pr69225-5.c | 8 ++++++++
> gcc/testsuite/gcc.target/i386/pr69225-6.c | 8 ++++++++
> 7 files changed, 50 insertions(+), 2 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr69225-1.c
> create mode 100644 gcc/testsuite/gcc.target/i386/pr69225-2.c
> create mode 100644 gcc/testsuite/gcc.target/i386/pr69225-3.c
> create mode 100644 gcc/testsuite/gcc.target/i386/pr69225-4.c
> create mode 100644 gcc/testsuite/gcc.target/i386/pr69225-5.c
> create mode 100644 gcc/testsuite/gcc.target/i386/pr69225-6.c
>
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index dcaa011..5c97fd1 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -692,9 +692,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
> FPU, assume that the fpcw is set to extended precision; when using
> only SSE, rounding is correct; when using both SSE and the FPU,
> the rounding precision is indeterminate, since either may be chosen
> - apparently at random. */
> + apparently at random. Also set to 0 if FPU isn't used. */
> #define TARGET_FLT_EVAL_METHOD \
> - (TARGET_MIX_SSE_I387 ? -1 : TARGET_SSE_MATH ? 0 : 2)
> + (TARGET_MIX_SSE_I387 ? -1 : (TARGET_SSE_MATH || !TARGET_80387) ? 0 : 2)
IMO, it is more informative written as:
> + (TARGET_MIX_SSE_I387 ? -1 : (TARGET_80387 && !TARGET_SSE_MATH) ? 2 : 0)
So, you don't even need to adjust the comment.
If Joseph (CC'd) is OK with the patch, then the patch is OK for mainline.
Thanks,
Uros.
> /* Whether to allow x87 floating-point arithmetic on MODE (one of
> SFmode, DFmode and XFmode) in the current excess precision
> diff --git a/gcc/testsuite/gcc.target/i386/pr69225-1.c b/gcc/testsuite/gcc.target/i386/pr69225-1.c
> new file mode 100644
> index 0000000..cc5b782
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr69225-1.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile} */
> +/* { dg-options "-msse2 -mfpmath=sse" } */
> +
> +#include <float.h>
> +
> +#if FLT_EVAL_METHOD != 0
> +# error FLT_EVAL_METHOD != 0
> +#endif
> diff --git a/gcc/testsuite/gcc.target/i386/pr69225-2.c b/gcc/testsuite/gcc.target/i386/pr69225-2.c
> new file mode 100644
> index 0000000..cd0a626
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr69225-2.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile} */
> +/* { dg-options "-mno-sse -mno-80387" } */
> +
> +#include <float.h>
> +
> +#if FLT_EVAL_METHOD != 0
> +# error FLT_EVAL_METHOD != 0
> +#endif
> diff --git a/gcc/testsuite/gcc.target/i386/pr69225-3.c b/gcc/testsuite/gcc.target/i386/pr69225-3.c
> new file mode 100644
> index 0000000..1440b74
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr69225-3.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile} */
> +/* { dg-options "-m80387 -mfpmath=387" } */
> +
> +#include <float.h>
> +
> +#if FLT_EVAL_METHOD != 2
> +# error FLT_EVAL_METHOD != 2
> +#endif
> diff --git a/gcc/testsuite/gcc.target/i386/pr69225-4.c b/gcc/testsuite/gcc.target/i386/pr69225-4.c
> new file mode 100644
> index 0000000..b032a5f
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr69225-4.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile} */
> +/* { dg-options "-msse2 -mfancy-math-387 -mfpmath=sse" } */
> +
> +#include <float.h>
> +
> +#if FLT_EVAL_METHOD != 0
> +# error FLT_EVAL_METHOD != 0
> +#endif
> diff --git a/gcc/testsuite/gcc.target/i386/pr69225-5.c b/gcc/testsuite/gcc.target/i386/pr69225-5.c
> new file mode 100644
> index 0000000..4162f77
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr69225-5.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile} */
> +/* { dg-options "-msse2 -m80387 -mfpmath=sse,387" } */
> +
> +#include <float.h>
> +
> +#if FLT_EVAL_METHOD != -1
> +# error FLT_EVAL_METHOD != -1
> +#endif
> diff --git a/gcc/testsuite/gcc.target/i386/pr69225-6.c b/gcc/testsuite/gcc.target/i386/pr69225-6.c
> new file mode 100644
> index 0000000..cd5f419
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr69225-6.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile} */
> +/* { dg-options "-mno-80387" } */
> +
> +#include <float.h>
> +
> +#if FLT_EVAL_METHOD != 0
> +# error FLT_EVAL_METHOD != 0
> +#endif
> --
> 2.5.0
>
prev parent reply other threads:[~2016-01-11 16:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 14:52 H.J. Lu
2016-01-11 16:15 ` Uros Bizjak [this message]
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='CAFULd4bEr8i=SSX67fLwyiYyS4qCDdC=6d-4BmsgU_OmE2A8NA@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=joseph@codesourcery.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).