Add tests and committed.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/def.h: Add FNMS VLS modes tests.
* gcc.target/riscv/rvv/autovec/vls/fnms-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnms-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/fnms-3.c: New test.
for (int i = 0; i < NUM; ++i) \
a[i] = b[i] * c[i] - d[i]; \
}
+
+#define DEF_FNMS_VV(PREFIX, NUM, TYPE) \
+ void __attribute__ ((noinline, noclone)) \
+ PREFIX##_##TYPE##NUM (TYPE *restrict a, TYPE *restrict b, TYPE *restrict c, \
+ TYPE *restrict d) \
+ { \
+ for (int i = 0; i < NUM; ++i) \
+ a[i] = -(b[i] * c[i]) - d[i]; \
+ }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FNMS_VV (fnms, 2, _Float16)
+DEF_FNMS_VV (fnms, 4, _Float16)
+DEF_FNMS_VV (fnms, 8, _Float16)
+DEF_FNMS_VV (fnms, 16, _Float16)
+DEF_FNMS_VV (fnms, 32, _Float16)
+DEF_FNMS_VV (fnms, 64, _Float16)
+DEF_FNMS_VV (fnms, 128, _Float16)
+DEF_FNMS_VV (fnms, 256, _Float16)
+DEF_FNMS_VV (fnms, 512, _Float16)
+DEF_FNMS_VV (fnms, 1024, _Float16)
+DEF_FNMS_VV (fnms, 2048, _Float16)
+
+/* { dg-final { scan-assembler-times {vfnma[c-d][c-d]\.vv} 11 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FNMS_VV (fnms, 2, float)
+DEF_FNMS_VV (fnms, 4, float)
+DEF_FNMS_VV (fnms, 8, float)
+DEF_FNMS_VV (fnms, 16, float)
+DEF_FNMS_VV (fnms, 32, float)
+DEF_FNMS_VV (fnms, 64, float)
+DEF_FNMS_VV (fnms, 128, float)
+DEF_FNMS_VV (fnms, 256, float)
+DEF_FNMS_VV (fnms, 512, float)
+DEF_FNMS_VV (fnms, 1024, float)
+
+/* { dg-final { scan-assembler-times {vfnma[c-d][c-d]\.vv} 10 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 --param=riscv-autovec-lmul=m8 -fdump-tree-optimized" } */
+
+#include "def.h"
+
+DEF_FNMS_VV (fnms, 2, double)
+DEF_FNMS_VV (fnms, 4, double)
+DEF_FNMS_VV (fnms, 8, double)
+DEF_FNMS_VV (fnms, 16, double)
+DEF_FNMS_VV (fnms, 32, double)
+DEF_FNMS_VV (fnms, 64, double)
+DEF_FNMS_VV (fnms, 128, double)
+DEF_FNMS_VV (fnms, 256, double)
+DEF_FNMS_VV (fnms, 512, double)
+
+/* { dg-final { scan-assembler-times {vfnma[c-d][c-d]\.vv} 9 } } */
+/* { dg-final { scan-assembler-not {csrr} } } */
+/* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4,4" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "16,16" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "32,32" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "64,64" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "128,128" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "256,256" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "512,512" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "1024,1024" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "2048,2048" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "4096,4096" "optimized" } } */