On Fri, Aug 6, 2021 at 2:06 PM Hongtao Liu <crazy...@gmail.com> wrote: > > On Tue, Aug 3, 2021 at 10:44 AM Hongtao Liu <crazy...@gmail.com> wrote: > > > > On Tue, Aug 3, 2021 at 3:34 AM Joseph Myers <jos...@codesourcery.com> wrote: > > > > > > On Mon, 2 Aug 2021, liuhongt via Gcc-patches wrote: > > > > > > > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c > > > > index 7979e240426..dc673c89bc8 100644 > > > > --- a/gcc/config/i386/i386.c > > > > +++ b/gcc/config/i386/i386.c > > > > @@ -23352,6 +23352,8 @@ ix86_get_excess_precision (enum > > > > excess_precision_type type) > > > > return (type == EXCESS_PRECISION_TYPE_STANDARD > > > > ? FLT_EVAL_METHOD_PROMOTE_TO_FLOAT > > > > : FLT_EVAL_METHOD_UNPREDICTABLE); > > > > + case EXCESS_PRECISION_TYPE_FLOAT16: > > > > + return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16; > > > > default: > > > > gcc_unreachable (); > > > > } > > > > > > I'd expect an error for -fexcess-precision=16 with -mfpmath=387 (since x87 > > > doesn't do float or double arithmetic, but -fexcess-precision=16 implies > > > that all of _Float16, float and double are represented to the range and > > > precision of their type withou any excess precision). > > > > > Yes, additional changes like this. > > > > modified gcc/config/i386/i386.c > > @@ -23443,6 +23443,9 @@ ix86_get_excess_precision (enum > > excess_precision_type type) > > ? FLT_EVAL_METHOD_PROMOTE_TO_FLOAT > > : FLT_EVAL_METHOD_UNPREDICTABLE); > > case EXCESS_PRECISION_TYPE_FLOAT16: > > + if (TARGET_80387 > > + && !(TARGET_SSE_MATH && TARGET_SSE)) > > + error ("%<-fexcess-precision=16%> is not compatible with > > %<-mfpmath=387%>"); > > return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16; > > default: > > gcc_unreachable (); > > new file gcc/testsuite/gcc.target/i386/float16-7.c > > @@ -0,0 +1,9 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-O2 -mfpmath=387 -fexcess-precision=16" } */ > > +/* { dg-excess-errors "'-fexcess-precision=16' is not compatible with > > '-mfpmath=387'" } */ > > +_Float16 > > +foo (_Float16 a, _Float16 b) > > +{ > > + return a + b;/* { dg-error "'-fexcess-precision=16' is not > > compatible with '-mfpmath=387'" } */ > > +} > > + > > > > > -- > > > Joseph S. Myers > > > jos...@codesourcery.com > > > > > > > > -- > > BR, > > Hongtao > > > Updated patch and ping for it. > > Also for backend changes. > 1. For backend m68k/s390 which totally don't support _Float16, backend > will issue an error for -fexcess-precision=16, I think it should be > fine. > 2. For backend like arm/aarch64 which supports _Float16 , backend will > set FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 for -fexcess-precision=16 even > hardware instruction for fp16 is not supported. Would that be ok for > arm?
Ping for this patch. > -- > BR, > Hongtao -- BR, Hongtao