On Thu, Nov 24, 2016 at 5:00 PM, James Greenhalgh <james.greenha...@arm.com> wrote: > > Hi, > > PR78509 occurs because a target should never return > FLT_EVAL_METHOD_UNPREDICTABLE from TARGET_C_EXCESS_PRECISION when the > TYPE argument to that hook is EXCESS_PRECISION_TYPE_STANDARD or > EXCESS_PRECISION_TYPE_FAST. > > When TYPE is one of these two modes, the target is being asked which > explicit excess precision should be applied by tree.c. It doesn't make > sense for this to be "unpredictable". tree.c can only apply predictable > explicit excess precision. > > Contrast that with EXCESS_PRECISION_TYPE_IMPLICIT, which can be > unpredictable. > > The logic in config/i386/i386.c:i386_excess_precision should be correct > for EXCESS_PRECISION_TYPE_IMPLICIT, but we should not return > FLT_EVAL_METHOD_UNPREDICTABLE for the EXCESS_PRECISION_TYPE_STANDARD case, > for the reasons above. Rather, we want to impose no explicit excess > precision promotions if we are going to be unpredictable anyway - so return > FLT_EVAL_METGHOD_PROMOTE_TO_FLOAT. > > By rearranging the logic of the cascade of else if stataments above, we > can make that the default case without duplicating logic. > > I've bootstrapped and tested this on x86-64 without any issues, confirmed > that it fixes the previous ICE, and tested the output before my patch set, > and after this patch, with the options suggested by Jakub in the PR: > > -fdump-tree-gimple -m32 -msse2 -mno-80387 -fexcess-precision=standard > -fdump-tree-gimple -m32 -msse2 -mfpmath=387+sse -fexcess-precision=standard > -fdump-tree-gimple -m32 -msse2 -mfpmath=387 -fexcess-precision=standard > -fdump-tree-gimple -m32 -msse2 -mfpmath=sse -fexcess-precision=standard > -fdump-tree-gimple -m32 -msse -mno-sse2 -mfpmath=sse > -fexcess-precision=standard > > With no differences. > > I've also updated the documentation to make it clear that returning > FLT_EVAL_METHOD_UNPREDICTABLE is not supported. > > OK? > > Thanks, > James > > --- > 2016-11-24 James Greenahlgh <james.greenha...@arm.com> > > PR target/78509 > * config/i386/i386.c (i386_excess_precision): Do not return > FLT_EVAL_METHOD_UNPREDICTABLE when "type" is > EXCESS_PRECISION_TYPE_STANDARD. > * target.def (excess_precision): Document that targets should > not return FLT_EVAL_METHOD_UNPREDICTABLE when "type" is > EXCESS_PRECISION_TYPE_STANDARD or EXCESS_PRECISION_TYPE_FAST. > Fix typo in first sentence. > * doc/tm.texi: Regenerate.
x86 part is OK. Thanks, Uros.