Message ID | 20190219134927.28814-1-hjl.tools@gmail.com |
---|---|
State | New |
Headers | show |
Series | 386: Set ix86_fpmath to FPMATH_387 without SSE | expand |
On Tue, Feb 19, 2019 at 2:49 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > ix86_fpmath should be set to combination of FPMATH_387 and FPMATH_SSE. > When SSE is disabled, it should be set to FPMATH_387 and 387 codegen is > also controlled by -msoft-float. > > gcc/ > > PR target/89397 > * config/i386/i386.c (ix86_option_override_internal): Set > opts->x_ix86_fpmath to FPMATH_387 when SSE is disabled. > > gcc/testsuite/ > > PR target/89397 > * gcc.target/i386/pr89397.c: New test. OK. Thanks, Uros. > --- > gcc/config/i386/i386.c | 7 +++---- > gcc/testsuite/gcc.target/i386/pr89397.c | 11 +++++++++++ > 2 files changed, 14 insertions(+), 4 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/i386/pr89397.c > > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c > index 591a7cdccdc..bed17330fa8 100644 > --- a/gcc/config/i386/i386.c > +++ b/gcc/config/i386/i386.c > @@ -4310,10 +4310,9 @@ ix86_option_override_internal (bool main_args_p, > if (!TARGET_SSE_P (opts->x_ix86_isa_flags)) > { > if (TARGET_80387_P (opts->x_target_flags)) > - { > - warning (0, "SSE instruction set disabled, using 387 arithmetics"); > - opts->x_ix86_fpmath = FPMATH_387; > - } > + warning (0, "SSE instruction set disabled, using 387 arithmetics"); > + /* NB: 387 codegen is guarded by TARGET_80387. */ > + opts->x_ix86_fpmath = FPMATH_387; > } > else if ((opts->x_ix86_fpmath & FPMATH_387) > && !TARGET_80387_P (opts->x_target_flags)) > diff --git a/gcc/testsuite/gcc.target/i386/pr89397.c b/gcc/testsuite/gcc.target/i386/pr89397.c > new file mode 100644 > index 00000000000..42afa6c5247 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/pr89397.c > @@ -0,0 +1,11 @@ > +/* { dg-do compile } */ > +/* { dg-options "-mfpmath=sse,387 -msoft-float -mno-sse" } */ > + > +_Atomic double a; > +int b; > + > +void > +foo (void) > +{ > + a += b; /* { dg-error "SSE register return with SSE disabled" "" { target { ! ia32 } } } */ > +} > -- > 2.20.1 >
On Tue, Feb 19, 2019 at 6:16 AM Uros Bizjak <ubizjak@gmail.com> wrote: > > On Tue, Feb 19, 2019 at 2:49 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > ix86_fpmath should be set to combination of FPMATH_387 and FPMATH_SSE. > > When SSE is disabled, it should be set to FPMATH_387 and 387 codegen is > > also controlled by -msoft-float. > > > > gcc/ > > > > PR target/89397 > > * config/i386/i386.c (ix86_option_override_internal): Set > > opts->x_ix86_fpmath to FPMATH_387 when SSE is disabled. > > > > gcc/testsuite/ > > > > PR target/89397 > > * gcc.target/i386/pr89397.c: New test. > > OK. > This patch is need to fix: FAIL: gcc.target/i386/pr67985-3.c scan-assembler movd[ \t]%xmm[0-7], %eax FAIL: gcc.target/i386/pr67985-3.c scan-assembler mulss OK for trunk? Thanks.
On Tue, Feb 19, 2019 at 9:14 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Tue, Feb 19, 2019 at 6:16 AM Uros Bizjak <ubizjak@gmail.com> wrote: > > > > On Tue, Feb 19, 2019 at 2:49 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > > > ix86_fpmath should be set to combination of FPMATH_387 and FPMATH_SSE. > > > When SSE is disabled, it should be set to FPMATH_387 and 387 codegen is > > > also controlled by -msoft-float. > > > > > > gcc/ > > > > > > PR target/89397 > > > * config/i386/i386.c (ix86_option_override_internal): Set > > > opts->x_ix86_fpmath to FPMATH_387 when SSE is disabled. > > > > > > gcc/testsuite/ > > > > > > PR target/89397 > > > * gcc.target/i386/pr89397.c: New test. > > > > OK. > > > > This patch is need to fix: > > FAIL: gcc.target/i386/pr67985-3.c scan-assembler movd[ \t]%xmm[0-7], %eax > FAIL: gcc.target/i386/pr67985-3.c scan-assembler mulss > > OK for trunk? PR 67985 says: --q-- Since -miamcu specifies how parameters are passed to functions, inside function, we can use any instructions -march= allows. -miamcu -march=haswell should allow x87 and AVX instructions --/q-- The command line specifies -mfpmath=sse and target attribute implies SSE. So, SSE instructions should be used here. Please investigate why this is not the case. Uros. Uros.
On Tue, Feb 19, 2019 at 9:14 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Tue, Feb 19, 2019 at 6:16 AM Uros Bizjak <ubizjak@gmail.com> wrote: > > > > On Tue, Feb 19, 2019 at 2:49 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > > > ix86_fpmath should be set to combination of FPMATH_387 and FPMATH_SSE. > > > When SSE is disabled, it should be set to FPMATH_387 and 387 codegen is > > > also controlled by -msoft-float. > > > > > > gcc/ > > > > > > PR target/89397 > > > * config/i386/i386.c (ix86_option_override_internal): Set > > > opts->x_ix86_fpmath to FPMATH_387 when SSE is disabled. > > > > > > gcc/testsuite/ > > > > > > PR target/89397 > > > * gcc.target/i386/pr89397.c: New test. > > > > OK. > > > > This patch is need to fix: > > FAIL: gcc.target/i386/pr67985-3.c scan-assembler movd[ \t]%xmm[0-7], %eax > FAIL: gcc.target/i386/pr67985-3.c scan-assembler mulss > > OK for trunk? I have reverted the original patch. Please stop wasting my time with half-baked patches. Double so if they were not even regression tested properly. Uros.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 591a7cdccdc..bed17330fa8 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4310,10 +4310,9 @@ ix86_option_override_internal (bool main_args_p, if (!TARGET_SSE_P (opts->x_ix86_isa_flags)) { if (TARGET_80387_P (opts->x_target_flags)) - { - warning (0, "SSE instruction set disabled, using 387 arithmetics"); - opts->x_ix86_fpmath = FPMATH_387; - } + warning (0, "SSE instruction set disabled, using 387 arithmetics"); + /* NB: 387 codegen is guarded by TARGET_80387. */ + opts->x_ix86_fpmath = FPMATH_387; } else if ((opts->x_ix86_fpmath & FPMATH_387) && !TARGET_80387_P (opts->x_target_flags)) diff --git a/gcc/testsuite/gcc.target/i386/pr89397.c b/gcc/testsuite/gcc.target/i386/pr89397.c new file mode 100644 index 00000000000..42afa6c5247 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr89397.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-mfpmath=sse,387 -msoft-float -mno-sse" } */ + +_Atomic double a; +int b; + +void +foo (void) +{ + a += b; /* { dg-error "SSE register return with SSE disabled" "" { target { ! ia32 } } } */ +}