public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [vxworks] [testsuite] [aarch64] use builtin in pred-not-gen-4.c
@ 2023-05-04 12:08 Alexandre Oliva
  2023-05-10 19:19 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 2023-05-04 12:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: Rainer Orth, Mike Stump


On vxworks, isunordered is defined as a macro that ultimately calls a
_Fpcomp function, that GCC doesn't recognize as a builtin, so it
can't optimize accordingly.

Use __builtin_isunordered instead to get the desired code for the
test.

Regstrapped on x86_64-linux-gnu.  Also tested on aarch64-vx7r2 with
gcc-12.  Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.target/aarch64/pred-not-gen-4.c: Drop math.h include,
	call builtin.
---
 .../gcc.target/aarch64/sve/pred-not-gen-4.c        |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c
index 0001dd3fc211f..1845bd3f0f704 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c
@@ -1,12 +1,10 @@
 /* { dg-do compile } */
 /* { dg-options "-O3" } */
 
-#include <math.h>
-
 void f13(double * restrict z, double * restrict w, double * restrict x, double * restrict y, int n)
 {
     for (int i = 0; i < n; i++) {
-        z[i] = (isunordered(w[i], 0)) ? x[i] + w[i] : y[i] - w[i];
+        z[i] = (__builtin_isunordered(w[i], 0)) ? x[i] + w[i] : y[i] - w[i];
     }
 }
 

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [vxworks] [testsuite] [aarch64] use builtin in pred-not-gen-4.c
  2023-05-04 12:08 [vxworks] [testsuite] [aarch64] use builtin in pred-not-gen-4.c Alexandre Oliva
@ 2023-05-10 19:19 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-05-10 19:19 UTC (permalink / raw)
  To: Alexandre Oliva via Gcc-patches; +Cc: Alexandre Oliva, Rainer Orth, Mike Stump

Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> On vxworks, isunordered is defined as a macro that ultimately calls a
> _Fpcomp function, that GCC doesn't recognize as a builtin, so it
> can't optimize accordingly.
>
> Use __builtin_isunordered instead to get the desired code for the
> test.
>
> Regstrapped on x86_64-linux-gnu.  Also tested on aarch64-vx7r2 with
> gcc-12.  Ok to install?
>
>
> for  gcc/testsuite/ChangeLog
>
> 	* gcc.target/aarch64/pred-not-gen-4.c: Drop math.h include,
> 	call builtin.

OK, thanks.

Richard

> ---
>  .../gcc.target/aarch64/sve/pred-not-gen-4.c        |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c
> index 0001dd3fc211f..1845bd3f0f704 100644
> --- a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c
> @@ -1,12 +1,10 @@
>  /* { dg-do compile } */
>  /* { dg-options "-O3" } */
>  
> -#include <math.h>
> -
>  void f13(double * restrict z, double * restrict w, double * restrict x, double * restrict y, int n)
>  {
>      for (int i = 0; i < n; i++) {
> -        z[i] = (isunordered(w[i], 0)) ? x[i] + w[i] : y[i] - w[i];
> +        z[i] = (__builtin_isunordered(w[i], 0)) ? x[i] + w[i] : y[i] - w[i];
>      }
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-10 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04 12:08 [vxworks] [testsuite] [aarch64] use builtin in pred-not-gen-4.c Alexandre Oliva
2023-05-10 19:19 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).