This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR target/69225: Set FLT_EVAL_METHOD to 2 only if 387 FPU is used
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 12 Jan 2016 13:43:21 +0100
- Subject: Re: [PATCH] PR target/69225: Set FLT_EVAL_METHOD to 2 only if 387 FPU is used
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOp=Tq=mCWWAEi82VGJEp_sbF1e4GYMcjQBpK7LFYeUsJg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1601120014510 dot 15518 at digraph dot polyomino dot org dot uk> <CAFULd4YYp+zKXDh+p45+H+OG30wyi+=ZOgS2tyLk9tXOyjP0jQ at mail dot gmail dot com> <20160112111850 dot GD3017 at tucnak dot redhat dot com> <CAFULd4ZRmtooD2A+G6iWaSpAQvY8Jt1tS582G7bpj7HpjtUxSA at mail dot gmail dot com> <CAFULd4YYwPS_csawghBEpcK=v1bP7sTZ5rZ=TXFRnzgX+f9bgw at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jan 12, 2016 at 01:32:05PM +0100, Uros Bizjak wrote:
> Using this patch, SSE math won't be emitted for a simple testcase
> using " -O2 -msse -m32 -std=c99 -mfpmath=sse" compile flags:
>
> float test (float a, float b)
> {
> return a + b;
> }
>
> since we start with:
>
> test (float a, float b)
> {
> long double _2;
> long double _4;
> long double _5;
> float _6;
>
> <bb 2>:
> _2 = (long double) a_1(D);
> _4 = (long double) b_3(D);
> _5 = _2 + _4;
> _6 = (float) _5;
> return _6;
> }
>
> This is counter-intuitive, so I'd say we leave things as they are. The
> situation where only floats are evaluated as floats and doubles are
> evaluated as long doubles is not covered in the FLT_EVAL_METHOD spec.
Well, for the -fexcess-precision=standard case (== -std=c99) FLT_EVAL_METHOD
2 doesn't hurt, that forces in the FE long double computation. While if it
is 0 with -msse -mfpmath=sse, it means that the FE leaves computations as is
and they are computed in float precision for floats and in long double
precision for doubles. For -fexcess-precision=fast it is different, because
the FE doesn't do anything, so in the end it is mixed in that case.
So, for -msse -mfpmath=sse, I think either we need FLT_EVAL_METHOD 2 or -1
or 2 for -fexcess-precision=standard and -1 for -fexcess-precision=fast.
Jakub