[v4,4/4] RISC-V: Add zhinx/zhinxmin testcases.
Checks
Commit Message
From: Jiawei <jiawei@iscas.ac.cn>
Test zhinx/zhinxmin support, same like with zfh/zfhmin testcases
but use gprs and don't use fmv instruction.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/_Float16-zhinx-1.c: New test.
* gcc.target/riscv/_Float16-zhinx-2.c: New test.
* gcc.target/riscv/_Float16-zhinx-3.c: New test.
* gcc.target/riscv/_Float16-zhinxmin-1.c: New test.
* gcc.target/riscv/_Float16-zhinxmin-2.c: New test.
* gcc.target/riscv/_Float16-zhinxmin-3.c: New test.
---
gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c | 10 ++++++++++
gcc/testsuite/gcc.target/riscv/_Float16-zhinx-2.c | 9 +++++++++
gcc/testsuite/gcc.target/riscv/_Float16-zhinx-3.c | 9 +++++++++
gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-1.c | 10 ++++++++++
gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-2.c | 10 ++++++++++
gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-3.c | 10 ++++++++++
6 files changed, 58 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/_Float16-zhinx-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/_Float16-zhinx-3.c
create mode 100644 gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-1.c
create mode 100644 gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-2.c
create mode 100644 gcc/testsuite/gcc.target/riscv/_Float16-zhinxmin-3.c
Comments
On Okt 20 2022, jiawei wrote:
> diff --git a/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c
> new file mode 100644
> index 00000000000..90172b57e05
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/_Float16-zhinx-1.c
> @@ -0,0 +1,10 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
> +
> +_Float16 foo1 (_Float16 a, _Float16 b)
> +{
> + return b;
> +}
> +
> +/* { dg-final { scan-assembler-not "fmv.h" } } */
> +/* { dg-final { scan-assembler-times "mv" 1 } } */
This fails with -flto (mv is found twice).
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ return b;
+}
+
+/* { dg-final { scan-assembler-not "fmv.h" } } */
+/* { dg-final { scan-assembler-times "mv" 1 } } */
new file mode 100644
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fadd.h fa" } } */
+ /* { dg-final { scan-assembler-times "fadd.h a" 1 } } */
+ return a + b;
+}
new file mode 100644
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinx -mabi=lp64 -O" } */
+
+int foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fgt.h fa" } } */
+ /* { dg-final { scan-assembler-times "fgt.h a" 1 } } */
+ return a > b;
+}
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinxmin -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fmv.h" } } */
+ /* { dg-final { scan-assembler-not "fmv.s" } } */
+ /* { dg-final { scan-assembler-times "mv" 1 } } */
+ return b;
+}
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zhinxmin -mabi=lp64 -O" } */
+
+_Float16 foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fadd.h" } } */
+ /* { dg-final { scan-assembler-not "fadd.s fa" } } */
+ /* { dg-final { scan-assembler-times "fadd.s a" 1 } } */
+ return a + b;
+}
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfhmin -mabi=lp64f -O" } */
+
+int foo1 (_Float16 a, _Float16 b)
+{
+ /* { dg-final { scan-assembler-not "fgt.h" } } */
+ /* { dg-final { scan-assembler-not "fgt.s fa" } } */
+ /* { dg-final { scan-assembler-times "fgt.s a" 1 } } */
+ return a > b;
+}