RE: [PATCH v1] RISC-V: Leverage __builtin_xx instead of math.h for test

2023-09-21 Thread Li, Pan2
Committed, thanks Juzhe.

Pan

From: juzhe.zh...@rivai.ai 
Sent: Friday, September 22, 2023 9:17 AM
To: Li, Pan2 ; gcc-patches 
Cc: Li, Pan2 ; Wang, Yanzhang ; 
kito.cheng 
Subject: Re: [PATCH v1] RISC-V: Leverage __builtin_xx instead of math.h for test

LGTM。


juzhe.zh...@rivai.ai<mailto:juzhe.zh...@rivai.ai>

From: pan2.li<mailto:pan2...@intel.com>
Date: 2023-09-22 09:12
To: gcc-patches<mailto:gcc-patches@gcc.gnu.org>
CC: juzhe.zhong<mailto:juzhe.zh...@rivai.ai>; 
pan2.li<mailto:pan2...@intel.com>; 
yanzhang.wang<mailto:yanzhang.w...@intel.com>; 
kito.cheng<mailto:kito.ch...@gmail.com>
Subject: [PATCH v1] RISC-V: Leverage __builtin_xx instead of math.h for test
From: Pan Li mailto:pan2...@intel.com>>

The math.h may have problems in some environment, take __builtin__xx
instead for testing.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c:
Remove reference to math.h.
* gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/floating-point-sgnjx-2.c: Ditto.

Signed-off-by: Pan Li mailto:pan2...@intel.com>>
---
.../rvv/autovec/vls/floating-point-max-5.c| 43 +--
.../rvv/autovec/vls/floating-point-min-5.c| 43 +--
.../rvv/autovec/vls/floating-point-sgnjx-2.c  | 43 +--
3 files changed, 63 insertions(+), 66 deletions(-)

diff --git 
a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c
index 775ddb1d25e..dd163682396 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c
@@ -2,30 +2,29 @@
/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 
-fno-schedule-insns -fno-schedule-insns2 --param=riscv-autovec-lmul=m8 
-ffast-math" } */
#include "def.h"
-#include "math.h"
-DEF_CALL_VV (max, 1, float, fmaxf)
-DEF_CALL_VV (max, 2, float, fmaxf)
-DEF_CALL_VV (max, 4, float, fmaxf)
-DEF_CALL_VV (max, 8, float, fmaxf)
-DEF_CALL_VV (max, 16, float, fmaxf)
-DEF_CALL_VV (max, 32, float, fmaxf)
-DEF_CALL_VV (max, 64, float, fmaxf)
-DEF_CALL_VV (max, 128, float, fmaxf)
-DEF_CALL_VV (max, 256, float, fmaxf)
-DEF_CALL_VV (max, 512, float, fmaxf)
-DEF_CALL_VV (max, 1024, float, fmaxf)
+DEF_CALL_VV (max, 1, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 2, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 4, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 8, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 16, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 32, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 64, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 128, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 256, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 512, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 1024, float, __builtin_fmaxf)
-DEF_CALL_VV (max, 1, double, fmax)
-DEF_CALL_VV (max, 2, double, fmax)
-DEF_CALL_VV (max, 4, double, fmax)
-DEF_CALL_VV (max, 8, double, fmax)
-DEF_CALL_VV (max, 16, double, fmax)
-DEF_CALL_VV (max, 32, double, fmax)
-DEF_CALL_VV (max, 64, double, fmax)
-DEF_CALL_VV (max, 128, double, fmax)
-DEF_CALL_VV (max, 256, double, fmax)
-DEF_CALL_VV (max, 512, double, fmax)
+DEF_CALL_VV (max, 1, double, __builtin_fmax)
+DEF_CALL_VV (max, 2, double, __builtin_fmax)
+DEF_CALL_VV (max, 4, double, __builtin_fmax)
+DEF_CALL_VV (max, 8, double, __builtin_fmax)
+DEF_CALL_VV (max, 16, double, __builtin_fmax)
+DEF_CALL_VV (max, 32, double, __builtin_fmax)
+DEF_CALL_VV (max, 64, double, __builtin_fmax)
+DEF_CALL_VV (max, 128, double, __builtin_fmax)
+DEF_CALL_VV (max, 256, double, __builtin_fmax)
+DEF_CALL_VV (max, 512, double, __builtin_fmax)
/* { dg-final { scan-assembler-times 
{vfmax\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 19 } } */
/* { dg-final { scan-assembler-not {csrr} } } */
diff --git 
a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c
index 1e9ff7d5054..0e3cbf2acec 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c
@@ -2,30 +2,29 @@
/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 
-fno-schedule-insns -fno-schedule-insns2 --param=riscv-autovec-lmul=m8 
-ffast-math" } */
#include "def.h"
-#include "math.h"
-DEF_CALL_VV (min, 1, float, fminf)
-DEF_CALL_VV (min, 2, float, fminf)
-DEF_CALL_VV (min, 4, float, fminf)
-DEF_CALL_VV (min, 8, float, fminf)
-DEF_CALL_VV (min, 16, float, fminf)
-DEF_CALL_VV (min, 32, float, fminf)
-DEF_CALL_VV (min, 64, float, fminf)
-DEF_CALL_VV (min, 128, float, fminf)
-DEF_CALL_VV (min, 256, float, fminf)
-DEF_CALL_VV (min, 512, float, fminf)
-DEF_CALL_VV (min, 1024, float, fminf)
+DEF_CALL_VV (min, 1, float, __builtin_fminf)
+DEF_

Re: [PATCH v1] RISC-V: Leverage __builtin_xx instead of math.h for test

2023-09-21 Thread juzhe.zh...@rivai.ai
LGTM。



juzhe.zh...@rivai.ai
 
From: pan2.li
Date: 2023-09-22 09:12
To: gcc-patches
CC: juzhe.zhong; pan2.li; yanzhang.wang; kito.cheng
Subject: [PATCH v1] RISC-V: Leverage __builtin_xx instead of math.h for test
From: Pan Li 
 
The math.h may have problems in some environment, take __builtin__xx
instead for testing.
 
gcc/testsuite/ChangeLog:
 
* gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c:
Remove reference to math.h.
* gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/floating-point-sgnjx-2.c: Ditto.
 
Signed-off-by: Pan Li 
---
.../rvv/autovec/vls/floating-point-max-5.c| 43 +--
.../rvv/autovec/vls/floating-point-min-5.c| 43 +--
.../rvv/autovec/vls/floating-point-sgnjx-2.c  | 43 +--
3 files changed, 63 insertions(+), 66 deletions(-)
 
diff --git 
a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c
index 775ddb1d25e..dd163682396 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c
@@ -2,30 +2,29 @@
/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 
-fno-schedule-insns -fno-schedule-insns2 --param=riscv-autovec-lmul=m8 
-ffast-math" } */
#include "def.h"
-#include "math.h"
-DEF_CALL_VV (max, 1, float, fmaxf)
-DEF_CALL_VV (max, 2, float, fmaxf)
-DEF_CALL_VV (max, 4, float, fmaxf)
-DEF_CALL_VV (max, 8, float, fmaxf)
-DEF_CALL_VV (max, 16, float, fmaxf)
-DEF_CALL_VV (max, 32, float, fmaxf)
-DEF_CALL_VV (max, 64, float, fmaxf)
-DEF_CALL_VV (max, 128, float, fmaxf)
-DEF_CALL_VV (max, 256, float, fmaxf)
-DEF_CALL_VV (max, 512, float, fmaxf)
-DEF_CALL_VV (max, 1024, float, fmaxf)
+DEF_CALL_VV (max, 1, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 2, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 4, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 8, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 16, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 32, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 64, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 128, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 256, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 512, float, __builtin_fmaxf)
+DEF_CALL_VV (max, 1024, float, __builtin_fmaxf)
-DEF_CALL_VV (max, 1, double, fmax)
-DEF_CALL_VV (max, 2, double, fmax)
-DEF_CALL_VV (max, 4, double, fmax)
-DEF_CALL_VV (max, 8, double, fmax)
-DEF_CALL_VV (max, 16, double, fmax)
-DEF_CALL_VV (max, 32, double, fmax)
-DEF_CALL_VV (max, 64, double, fmax)
-DEF_CALL_VV (max, 128, double, fmax)
-DEF_CALL_VV (max, 256, double, fmax)
-DEF_CALL_VV (max, 512, double, fmax)
+DEF_CALL_VV (max, 1, double, __builtin_fmax)
+DEF_CALL_VV (max, 2, double, __builtin_fmax)
+DEF_CALL_VV (max, 4, double, __builtin_fmax)
+DEF_CALL_VV (max, 8, double, __builtin_fmax)
+DEF_CALL_VV (max, 16, double, __builtin_fmax)
+DEF_CALL_VV (max, 32, double, __builtin_fmax)
+DEF_CALL_VV (max, 64, double, __builtin_fmax)
+DEF_CALL_VV (max, 128, double, __builtin_fmax)
+DEF_CALL_VV (max, 256, double, __builtin_fmax)
+DEF_CALL_VV (max, 512, double, __builtin_fmax)
/* { dg-final { scan-assembler-times 
{vfmax\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 19 } } */
/* { dg-final { scan-assembler-not {csrr} } } */
diff --git 
a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c
index 1e9ff7d5054..0e3cbf2acec 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c
@@ -2,30 +2,29 @@
/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 
-fno-schedule-insns -fno-schedule-insns2 --param=riscv-autovec-lmul=m8 
-ffast-math" } */
#include "def.h"
-#include "math.h"
-DEF_CALL_VV (min, 1, float, fminf)
-DEF_CALL_VV (min, 2, float, fminf)
-DEF_CALL_VV (min, 4, float, fminf)
-DEF_CALL_VV (min, 8, float, fminf)
-DEF_CALL_VV (min, 16, float, fminf)
-DEF_CALL_VV (min, 32, float, fminf)
-DEF_CALL_VV (min, 64, float, fminf)
-DEF_CALL_VV (min, 128, float, fminf)
-DEF_CALL_VV (min, 256, float, fminf)
-DEF_CALL_VV (min, 512, float, fminf)
-DEF_CALL_VV (min, 1024, float, fminf)
+DEF_CALL_VV (min, 1, float, __builtin_fminf)
+DEF_CALL_VV (min, 2, float, __builtin_fminf)
+DEF_CALL_VV (min, 4, float, __builtin_fminf)
+DEF_CALL_VV (min, 8, float, __builtin_fminf)
+DEF_CALL_VV (min, 16, float, __builtin_fminf)
+DEF_CALL_VV (min, 32, float, __builtin_fminf)
+DEF_CALL_VV (min, 64, float, __builtin_fminf)
+DEF_CALL_VV (min, 128, float, __builtin_fminf)
+DEF_CALL_VV (min, 256, float, __builtin_fminf)
+DEF_CALL_VV (min, 512, float, __builtin_fminf)
+DEF_CALL_VV (min, 1024, float, __builtin_fminf)
-DEF_CALL_VV (min, 1, double, fmin)
-DEF_CALL_VV (min, 2, double, fmin)
-DEF_CALL_VV (min, 4, double, fmin)
-DEF_CALL_VV (min, 8, double, fmin)
-DEF_CALL_VV (min, 16, double, fmin)
-DEF_CALL_VV (