diff mbox

match.pd patch: min(-x, -y), min(~x, ~y)

Message ID 571E28D0.5010804@foss.arm.com
State New
Headers show

Commit Message

Kyrill Tkachov April 25, 2016, 2:25 p.m. UTC
On 22/04/16 12:20, Kyrill Tkachov wrote:
>
> On 22/04/16 11:34, Marc Glisse wrote:
>> On Fri, 22 Apr 2016, Kyrill Tkachov wrote:
>>
>>>
>>> On 22/04/16 10:43, Kyrill Tkachov wrote:
>>>>
>>>> On 22/04/16 10:42, Marc Glisse wrote:
>>>>> On Fri, 22 Apr 2016, Kyrill Tkachov wrote:
>>>>>
>>>>>>> 2016-04-21  Marc Glisse <marc.glisse@inria.fr>
>>>>>>>
>>>>>>> gcc/
>>>>>>>     * match.pd (min(-x, -y), max(-x, -y), min(~x, ~y), max(~x, ~y)):
>>>>>>>     New transformations.
>>>>>>>
>>>>>>> gcc/testsuite/
>>>>>>>     * gcc.dg/tree-ssa/minmax-2.c: New testcase.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> I see the new testcase failing on aarch64:
>>>>>> FAIL: gcc.dg/tree-ssa/minmax-2.c scan-tree-dump optimized "__builtin_fmin"
>>>>>
>>>>> Strange, it seems to work in https://gcc.gnu.org/ml/gcc-testresults/2016-04/msg02120.html
>>>>>
>>>>> Is that on some freestanding kind of setup where the builtin might be disabled?
>>>>>
>>>>
>>>> Ah, this is aarch64-none-elf which uses newlib as the C library.
>>>> Let me check on aarch64-none-linux-gnu and get back to you.
>>>>
>>>
>>> Yeah, I see it passing on aarch64-none-linux-gnu.
>>> Do we have an appropriate effective target check to gate this test on?
>>
>> I don't know, I have a hard time finding something related. I am not even convinced the test should be skipped. It looks like __builtin_fmax was recognized, otherwise you would get a warning and a conversion int-double. Maybe 
>> gimple_call_combined_fn rejects it? Ah, builtins.def declares it with DEF_C99_BUILTIN, which checks targetm.libc_has_function (function_c99_misc). I assume newlib fails that check? That would make c99_runtime a relevant target check.
>>
>
> Yeah, adding the below makes this test UNSUPPORTED on aarch64-none-elf.
> /* { dg-add-options c99_runtime } */
> /* { dg-require-effective-target c99_runtime } */
>
> I'll prepare a patch.
>

Sorry for the delay, here it is.
Ok to commit?

Thanks,
Kyrill

2016-04-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.dg/tree-ssa/minmax-2.c: Require c99_runtime and add the
     associated options.

> Thanks,
> Kyrill

Comments

Richard Biener April 26, 2016, 10:58 a.m. UTC | #1
On Mon, Apr 25, 2016 at 4:25 PM, Kyrill Tkachov
<kyrylo.tkachov@foss.arm.com> wrote:
>
> On 22/04/16 12:20, Kyrill Tkachov wrote:
>>
>>
>> On 22/04/16 11:34, Marc Glisse wrote:
>>>
>>> On Fri, 22 Apr 2016, Kyrill Tkachov wrote:
>>>
>>>>
>>>> On 22/04/16 10:43, Kyrill Tkachov wrote:
>>>>>
>>>>>
>>>>> On 22/04/16 10:42, Marc Glisse wrote:
>>>>>>
>>>>>> On Fri, 22 Apr 2016, Kyrill Tkachov wrote:
>>>>>>
>>>>>>>> 2016-04-21  Marc Glisse <marc.glisse@inria.fr>
>>>>>>>>
>>>>>>>> gcc/
>>>>>>>>     * match.pd (min(-x, -y), max(-x, -y), min(~x, ~y), max(~x, ~y)):
>>>>>>>>     New transformations.
>>>>>>>>
>>>>>>>> gcc/testsuite/
>>>>>>>>     * gcc.dg/tree-ssa/minmax-2.c: New testcase.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> I see the new testcase failing on aarch64:
>>>>>>> FAIL: gcc.dg/tree-ssa/minmax-2.c scan-tree-dump optimized
>>>>>>> "__builtin_fmin"
>>>>>>
>>>>>>
>>>>>> Strange, it seems to work in
>>>>>> https://gcc.gnu.org/ml/gcc-testresults/2016-04/msg02120.html
>>>>>>
>>>>>> Is that on some freestanding kind of setup where the builtin might be
>>>>>> disabled?
>>>>>>
>>>>>
>>>>> Ah, this is aarch64-none-elf which uses newlib as the C library.
>>>>> Let me check on aarch64-none-linux-gnu and get back to you.
>>>>>
>>>>
>>>> Yeah, I see it passing on aarch64-none-linux-gnu.
>>>> Do we have an appropriate effective target check to gate this test on?
>>>
>>>
>>> I don't know, I have a hard time finding something related. I am not even
>>> convinced the test should be skipped. It looks like __builtin_fmax was
>>> recognized, otherwise you would get a warning and a conversion int-double.
>>> Maybe gimple_call_combined_fn rejects it? Ah, builtins.def declares it with
>>> DEF_C99_BUILTIN, which checks targetm.libc_has_function (function_c99_misc).
>>> I assume newlib fails that check? That would make c99_runtime a relevant
>>> target check.
>>>
>>
>> Yeah, adding the below makes this test UNSUPPORTED on aarch64-none-elf.
>> /* { dg-add-options c99_runtime } */
>> /* { dg-require-effective-target c99_runtime } */
>>
>> I'll prepare a patch.
>>
>
> Sorry for the delay, here it is.
> Ok to commit?

Ok.

Richard.

> Thanks,
> Kyrill
>
> 2016-04-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * gcc.dg/tree-ssa/minmax-2.c: Require c99_runtime and add the
>     associated options.
>
>> Thanks,
>> Kyrill
>
>
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/minmax-2.c b/gcc/testsuite/gcc.dg/tree-ssa/minmax-2.c
index 98c38b1aa773d04a5d7cb36df73db8924d83ed65..87ff94cef1f3b178b315358f246c9a3f32383945 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/minmax-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/minmax-2.c
@@ -1,5 +1,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O -fstrict-overflow -fdump-tree-optimized" } */
+/* { dg-add-options c99_runtime } */
+/* { dg-require-effective-target c99_runtime } */
 
 static int max(int a,int b){return (a<b)?b:a;}
 int f(int x,int y){return max(-x,-y);}