Andrew Stubbs <a...@codesourcery.com> writes:
> I finally got back to investigating this ....
>
> On 21/11/2018 01:00, Jeff Law wrote:
>>> --- a/gcc/testsuite/gcc.dg/gimplefe-28.c
>>> +++ b/gcc/testsuite/gcc.dg/gimplefe-28.c
>>> @@ -1,5 +1,5 @@
>>>   /* { dg-do compile { target sqrt_insn } } */
>>> -/* { dg-options "-fgimple -O2" } */
>>> +/* { dg-options "-fgimple -O2 -ffast-math" } */
>> So why does the GCN need fast-math here?  I'm not aware of any other
>> target  that needs that kind of handling to make this test work.
>
> It needs it because the sqrt instruction is only enabled when 
> flag_unsafe_math_optimizations is set. This seems appropriate given the 
> approximate nature of the machine instruction.
>
> This test uses gimple directly and so bypasses the usual optab checks 
> that would normally select a library function instead, which results in 
> an ICE.
>
> It seems like a safe change to make, since most targets will have more 
> patterns enabled, not fewer, in this mode.
>
> The test will continue to fail on any target that does not have a sqrt 
> instruction at all.

But then I think we'll end up doing this for other (future) tests gated
on sqrt_insn, which would reduce the sqrt coverage for targets that don't
need -ffast-math.

I think it'd be better to define add_options_for_sqrt_insn, returning
"-ffast-math" for GCN and "" for everything else.  Then the test can use:

/* { dg-add-options sqrt_insn } */

after the dg-options line.

Thanks,
Richard

Reply via email to