This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: match.pd patch: min(-x, -y), min(~x, ~y)
- From: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Apr 2016 15:25:20 +0100
- Subject: Re: match.pd patch: min(-x, -y), min(~x, ~y)
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1604211217410 dot 22599 at laptop-mg dot saclay dot inria dot fr> <5719EC75 dot 2040509 at foss dot arm dot com> <alpine dot DEB dot 2 dot 20 dot 1604221139160 dot 1900 at laptop-mg dot saclay dot inria dot fr> <5719F22D dot 5020501 at foss dot arm dot com> <5719F5A6 dot 9050806 at foss dot arm dot com> <alpine dot DEB dot 2 dot 20 dot 1604221221380 dot 1900 at laptop-mg dot saclay dot inria dot fr> <571A090B dot 50803 at foss dot arm dot com>
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
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);}
- References:
- match.pd patch: min(-x, -y), min(~x, ~y)
- Re: match.pd patch: min(-x, -y), min(~x, ~y)
- Re: match.pd patch: min(-x, -y), min(~x, ~y)
- Re: match.pd patch: min(-x, -y), min(~x, ~y)
- Re: match.pd patch: min(-x, -y), min(~x, ~y)
- Re: match.pd patch: min(-x, -y), min(~x, ~y)
- Re: match.pd patch: min(-x, -y), min(~x, ~y)