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>

Reply via email to