diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-zvfh-run.c
index a4271810e58..1082695c5de 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-zvfh-run.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_zvfh } } } */
 /* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */
 
 #include "vmul-template.h"
@@ -7,24 +7,24 @@
 
 #define SZ 512
 
-#define RUN(TYPE,VAL)				\
-  TYPE a##TYPE[SZ];				\
-  TYPE b##TYPE[SZ];	  			\
-  for (int i = 0; i < SZ; i++)			\
-  {                             		\
-    a##TYPE[i] = 2;				\
-    b##TYPE[i] = VAL;           		\
-  }                             		\
-  vadd_##TYPE (a##TYPE, a##TYPE, b##TYPE, SZ);	\
-  for (int i = 0; i < SZ; i++)			\
+#define RUN(TYPE, VAL)                                                         \
+  TYPE a##TYPE[SZ];                                                            \
+  TYPE b##TYPE[SZ];                                                            \
+  for (int i = 0; i < SZ; i++)                                                 \
+    {                                                                          \
+      a##TYPE[i] = 2;                                                          \
+      b##TYPE[i] = VAL;                                                        \
+    }                                                                          \
+  vmul_##TYPE (a##TYPE, a##TYPE, b##TYPE, SZ);                                 \
+  for (int i = 0; i < SZ; i++)                                                 \
     assert (a##TYPE[i] == 2 * VAL);
 
-#define RUN2(TYPE,VAL)				\
-  TYPE as##TYPE[SZ];				\
-  for (int i = 0; i < SZ; i++)			\
-    as##TYPE[i] = 3;            		\
-  vadds_##TYPE (as##TYPE, as##TYPE, VAL, SZ);	\
-  for (int i = 0; i < SZ; i++)			\
+#define RUN2(TYPE, VAL)                                                        \
+  TYPE as##TYPE[SZ];                                                           \
+  for (int i = 0; i < SZ; i++)                                                 \
+    as##TYPE[i] = 3;                                                           \
+  vmuls_##TYPE (as##TYPE, as##TYPE, VAL, SZ);                                  \
+  for (int i = 0; i < SZ; i++)                                                 \
     assert (as##TYPE[i] == 3 * VAL);
 
 #define RUN_ALL()	\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-zvfh-run.c
index c996ce81270..b438beafeb9 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-zvfh-run.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */
 
 #include "vsub-template.h"
@@ -7,41 +7,41 @@
 
 #define SZ 512
 
-#define RUN(TYPE,VAL)				\
-  TYPE a##TYPE[SZ];				\
-  TYPE b##TYPE[SZ];	  			\
-  for (int i = 0; i < SZ; i++)			\
-  {                             		\
-    a##TYPE[i] = 999;           		\
-    b##TYPE[i] = VAL;           		\
-  }                             		\
-  vsub_##TYPE (a##TYPE, a##TYPE, b##TYPE, SZ);	\
-  for (int i = 0; i < SZ; i++)			\
-    assert (a##TYPE[i] == 999 - VAL);
-
-#define RUN2(TYPE,VAL)				\
-  TYPE as##TYPE[SZ];				\
-  for (int i = 0; i < SZ; i++)			\
-    as##TYPE[i] = 999;            		\
-  vsubs_##TYPE (as##TYPE, as##TYPE, VAL, SZ);	\
-  for (int i = 0; i < SZ; i++)			\
-    assert (as##TYPE[i] == 999 - VAL);
-
-#define RUN3(TYPE)				\
-  TYPE as2##TYPE[SZ];				\
-  for (int i = 0; i < SZ; i++)			\
-    as2##TYPE[i] = i * 33 - 779;            	\
-  vsubi_##TYPE (as2##TYPE, as2##TYPE, SZ);	\
-  for (int i = 0; i < SZ; i++)			\
-    assert (as2##TYPE[i] == (TYPE)(-16 - (i * 33 - 779)));
-
-#define RUN4(TYPE)				\
-  TYPE as3##TYPE[SZ];				\
-  for (int i = 0; i < SZ; i++)			\
-    as3##TYPE[i] = i * -17 + 667;            	\
-  vsubi2_##TYPE (as3##TYPE, as3##TYPE, SZ);	\
-  for (int i = 0; i < SZ; i++)			\
-    assert (as3##TYPE[i] == (TYPE)(15 - (i * -17 + 667)));
+#define RUN(TYPE, VAL)                                                         \
+  TYPE a##TYPE[SZ];                                                            \
+  TYPE b##TYPE[SZ];                                                            \
+  for (int i = 0; i < SZ; i++)                                                 \
+    {                                                                          \
+      a##TYPE[i] = 123;                                                        \
+      b##TYPE[i] = VAL;                                                        \
+    }                                                                          \
+  vsub_##TYPE (a##TYPE, a##TYPE, b##TYPE, SZ);                                 \
+  for (int i = 0; i < SZ; i++)                                                 \
+    assert (a##TYPE[i] == 123 - VAL);
+
+#define RUN2(TYPE, VAL)                                                        \
+  TYPE as##TYPE[SZ];                                                           \
+  for (int i = 0; i < SZ; i++)                                                 \
+    as##TYPE[i] = 234;                                                         \
+  vsubs_##TYPE (as##TYPE, as##TYPE, VAL, SZ);                                  \
+  for (int i = 0; i < SZ; i++)                                                 \
+    assert (as##TYPE[i] == 234 - VAL);
+
+#define RUN3(TYPE)                                                             \
+  TYPE as2##TYPE[SZ];                                                          \
+  for (int i = 0; i < SZ; i++)                                                 \
+    as2##TYPE[i] = i * 33 - 779;                                               \
+  vsubi_##TYPE (as2##TYPE, as2##TYPE, SZ);                                     \
+  for (int i = 0; i < SZ; i++)                                                 \
+    assert (as2##TYPE[i] == (TYPE) (-16 - (i * 33 - 779)));
+
+#define RUN4(TYPE)                                                             \
+  TYPE as3##TYPE[SZ];                                                          \
+  for (int i = 0; i < SZ; i++)                                                 \
+    as3##TYPE[i] = i * -3 + 267;                                               \
+  vsubi2_##TYPE (as3##TYPE, as3##TYPE, SZ);                                    \
+  for (int i = 0; i < SZ; i++)                                                 \
+    assert (as3##TYPE[i] == (TYPE) (15 - (i * -3 + 267)));
 
 #define RUN_ALL()	\
  RUN(_Float16, 4)	\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-3.c
index 27f9b686b38..0fcf2c5ca0f 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-3.c
@@ -3,7 +3,7 @@
 
 #include "cond_narrow_shift-3.c"
 
-#define N 99
+#define N 61
 
 #define TEST_LOOP(TYPE1, TYPE2)                                                \
   {                                                                            \
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/pr111401.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/pr111401.c
index 83dbd61b3f3..f593db3192a 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/pr111401.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/pr111401.c
@@ -1,5 +1,5 @@
 /* { dg-do run { target { riscv_v } } } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d --param riscv-autovec-preference=scalable -fdump-tree-vect-details" } */
+/* { dg-additional-options "--param riscv-autovec-preference=scalable -fdump-tree-vect-details" } */
 
 double
 __attribute__ ((noipa))
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-zvfh-run.c
index f30e55bf7f7..bd85f3f5814 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfcvt-itof-template.h"
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-zvfh-run.c
index 637e51a07bd..3164fed03fb 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfcvt_rtz-template.h"
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-zvfh-run.c
index ddbbdf35179..dbbbb615cc1 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfncvt-ftoi-template.h"
 
@@ -7,10 +7,8 @@
   TYPE1 src##TYPE1##TYPE2##NUM[NUM];                                           \
   TYPE2 dst##TYPE1##TYPE2##NUM[NUM];                                           \
   for (int i = 0; i < NUM; i++)                                                \
-    {                                                                          \
-      src##TYPE1##TYPE2##NUM[i] = i * -3.1315926 - 8.947289;                   \
-    }                                                                          \
-  vfcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM);  \
+    src##TYPE1##TYPE2##NUM[i] = i * -3.1315926 - 8.947289;                     \
+  vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
   for (int i = 0; i < NUM; i++)                                                \
     if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i])        \
       __builtin_abort ();
@@ -19,10 +17,8 @@
   TYPE1 src##TYPE1##TYPE2##NUM[NUM];                                           \
   TYPE2 dst##TYPE1##TYPE2##NUM[NUM];                                           \
   for (int i = 0; i < NUM; i++)                                                \
-    {                                                                          \
-      src##TYPE1##TYPE2##NUM[i] = i * 3.1315926 + 8.947289;                    \
-    }                                                                          \
-  vfcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM);  \
+    src##TYPE1##TYPE2##NUM[i] = i * 3.1315926 + 8.947289;                      \
+  vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
   for (int i = 0; i < NUM; i++)                                                \
     if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i])        \
       __builtin_abort ();
@@ -33,7 +29,7 @@ main ()
   RUN (_Float16, int8_t, 3)
   RUN (_Float16, int8_t, 4)
   RUN (_Float16, int8_t, 13)
-  RUN (_Float16, int8_t, 40)
+  RUN (_Float16, int8_t, 29)
 
   RUN2 (_Float16, uint8_t, 1)
   RUN2 (_Float16, uint8_t, 8)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-template.h
index c427cd167f6..bfc9179f310 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-template.h
@@ -1,21 +1,29 @@
 #include <stdint-gcc.h>
 
-#define TEST(TYPE1, TYPE2)                                        \
-  __attribute__ ((noipa))					  \
-  void vfncvt_##TYPE1##TYPE2 (TYPE2 *restrict dst,		  \
-			      TYPE1 *restrict a, int n)		  \
-  {								  \
-    for (int i = 0; i < n; i++)					  \
-      dst[i] = (TYPE2) (a[i] & 0x7ffffffful);			  \
+#define TEST(TYPE1, TYPE2)                                                     \
+  __attribute__ ((noipa)) void vfncvt_##TYPE1##TYPE2 (TYPE2 *restrict dst,     \
+						      TYPE1 *restrict a,       \
+						      int n)                   \
+  {                                                                            \
+    for (int i = 0; i < n; i++)                                                \
+      dst[i] = (TYPE2) (a[i] & 0x7ffffffful);                                   \
   }
 
+#define TESTS(TYPE1, TYPE2)                                                    \
+  __attribute__ ((noipa)) void vfncvts_##TYPE1##TYPE2 (TYPE2 *restrict dst,    \
+						       TYPE1 *restrict a,      \
+						       int n)                  \
+  {                                                                            \
+    for (int i = 0; i < n; i++)                                                \
+      dst[i] = (TYPE2) (a[i]);                                                 \
+  }
 
-#define TEST_ALL()						  \
-  TEST (int64_t, float)						  \
-  TEST (uint64_t, float)					  \
-  TEST (int64_t, _Float16)					  \
-  TEST (uint64_t, _Float16)					  \
-  TEST (int32_t, _Float16)					  \
-  TEST (uint32_t, _Float16)					  \
+#define TEST_ALL()                                                             \
+  TEST (int64_t, float)                                                        \
+  TEST (uint64_t, float)                                                       \
+  TEST (int64_t, _Float16)                                                     \
+  TEST (uint64_t, _Float16)                                                    \
+  TEST (int32_t, _Float16)                                                     \
+  TEST (uint32_t, _Float16)                                                    \
 
 TEST_ALL ()
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-zvfh-run.c
index ea084299d0b..0342d147de0 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-zvfh-run.c
@@ -1,32 +1,39 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_zvfh && riscv_zfh} } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfncvt-itof-template.h"
 
+#include <math.h>
+
+TESTS (int64_t, _Float16)
+TESTS (int32_t, _Float16)
+
+#define EPS 1e-5
+
 #define RUN(TYPE1, TYPE2, NUM)                                                 \
   TYPE1 src##TYPE1##TYPE2##NUM[NUM];                                           \
   TYPE2 dst##TYPE1##TYPE2##NUM[NUM];                                           \
   for (int i = 0; i < NUM; i++)                                                \
-    {                                                                          \
-      src##TYPE1##TYPE2##NUM[i] = i * -3 - 832;                                \
-    }                                                                          \
-  vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
+    src##TYPE1##TYPE2##NUM[i] = i * -3 + 833;                                  \
+  vfncvts_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM,      \
+			  NUM);                                                \
   for (int i = 0; i < NUM; i++)                                                \
-    if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i])        \
+    if (__builtin_fabsf16 (dst##TYPE1##TYPE2##NUM[i]                           \
+			   - (TYPE2) src##TYPE1##TYPE2##NUM[i])                \
+	> EPS)                                                                 \
       __builtin_abort ();
 
 #define RUN2(TYPE1, TYPE2, NUM)                                                \
   TYPE1 src##TYPE1##TYPE2##NUM[NUM];                                           \
   TYPE2 dst##TYPE1##TYPE2##NUM[NUM];                                           \
   for (int i = 0; i < NUM; i++)                                                \
-    {                                                                          \
-      src##TYPE1##TYPE2##NUM[i] = i * 3 + 892;                                 \
-    }                                                                          \
+    src##TYPE1##TYPE2##NUM[i] = i * 3 + 892;                                   \
   vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
   for (int i = 0; i < NUM; i++)                                                \
-    if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i])        \
+    if (__builtin_fabsf16 (dst##TYPE1##TYPE2##NUM[i]                           \
+			   - (TYPE2) src##TYPE1##TYPE2##NUM[i])                \
+	> EPS)                                                                 \
       __builtin_abort ();
-
 int
 main ()
 {
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-zvfh-run.c
index 6b8f3b5dfb1..6eb9f146704 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfncvt-template.h"
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-zvfh-run.c
index d13d4dd6338..3d1165400d3 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-zvfh-run.c
@@ -1,7 +1,7 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
-#include "vfcvt_rtz-template.h"
+#include "vfwcvt-ftoi-template.h"
 
 #define RUN(TYPE1, TYPE2, NUM)                                                 \
   TYPE1 src##TYPE1##TYPE2##NUM[NUM];                                           \
@@ -10,7 +10,7 @@
     {                                                                          \
       src##TYPE1##TYPE2##NUM[i] = i * -3.1315926 - 832.947289;                 \
     }                                                                          \
-  vfcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM);  \
+  vfwcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
   for (int i = 0; i < NUM; i++)                                                \
     if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i])        \
       __builtin_abort ();
@@ -22,7 +22,7 @@
     {                                                                          \
       src##TYPE1##TYPE2##NUM[i] = i * 3.1315926 + 832.947289;                  \
     }                                                                          \
-  vfcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM);  \
+  vfwcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
   for (int i = 0; i < NUM; i++)                                                \
     if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i])        \
       __builtin_abort ();
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-zvfh-run.c
index 8289e53523e..8df59a9a91d 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfwcvt-itof-template.h"
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-zvfh-run.c
index 10c8bdd530f..9f2c9835fd6 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfwcvt-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
-/* { dg-additional-options "-std=c99 -march=rv64gcv_zvfh -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
+/* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=scalable" } */
 
 #include "vfwcvt-template.h"
 
@@ -8,26 +8,24 @@
 #define SZ 512
 #define EPS 1e-4
 
-#define RUN(TYPE1,TYPE2)					\
-  TYPE1 src##TYPE1##TYPE2[SZ];					\
-  TYPE2 dst##TYPE1##TYPE2[SZ];					\
-  for (int i = 0; i < SZ; i++)					\
-  {                             				\
-    src##TYPE1##TYPE2[i] = (i & 1) ? -i : i;  			\
-    src##TYPE1##TYPE2[i] *= 0.0003141592;			\
-    dst##TYPE1##TYPE2[i] = -1;					\
-  }                             				\
-  vfwcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2,			\
-			src##TYPE1##TYPE2, SZ);			\
-  for (int i = 0; i < SZ; i++)					\
-    assert (__builtin_fabs (dst##TYPE1##TYPE2[i]		\
-	    - ((i & 1) ? -i : i) * 0.0003141592) < EPS);	\
-
-
-#define RUN_ALL()						\
- RUN(_Float16, float)						\
- RUN(_Float16, double)						\
+#define RUN(TYPE1, TYPE2)                                                      \
+  TYPE1 src##TYPE1##TYPE2[SZ];                                                 \
+  TYPE2 dst##TYPE1##TYPE2[SZ];                                                 \
+  for (int i = 0; i < SZ; i++)                                                 \
+    {                                                                          \
+      src##TYPE1##TYPE2[i] = (i & 1) ? -i : i;                                 \
+      src##TYPE1##TYPE2[i] *= 0.0003141592;                                    \
+      dst##TYPE1##TYPE2[i] = -1;                                               \
+    }                                                                          \
+  vfwcvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2, src##TYPE1##TYPE2, SZ);            \
+  for (int i = 0; i < SZ; i++)                                                 \
+    assert (__builtin_fabsf16 (dst##TYPE1##TYPE2[i]                            \
+			       - ((i & 1) ? -i : i) * 0.0003141592)            \
+	    < EPS);
 
+#define RUN_ALL()                                                              \
+  RUN (_Float16, float)                                                        \
+  RUN (_Float16, double)
 int main ()
 {
   RUN_ALL()
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/slp-mask-run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/slp-mask-run-1.c
index b3469c41c87..b7d86c6fbb5 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/slp-mask-run-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/slp-mask-run-1.c
@@ -1,5 +1,5 @@
 /* { dg-do run { target { riscv_v } } } */
-/* { dg-additional-options "-std=gnu99 -O3 -march=rv64gcv -mabi=lp64d --param=riscv-autovec-preference=scalable" } */
+/* { dg-additional-options "-std=gnu99 -O3 --param=riscv-autovec-preference=scalable" } */
 
 #include <malloc.h>
 #include <stdio.h>
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c
index 3ae6e598877..6c707e3c6ad 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-1.c"
@@ -30,6 +30,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c
index 9b7e0572c68..4d57fe56e5b 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-10.c"
@@ -30,6 +30,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c
index 7a35d852ede..80f1d54aefa 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-11.c"
@@ -15,32 +15,34 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
- array1_##NUM[i] = (i & 1) + 5;                                         \
- array2_##NUM[i] = i - NUM / 3;                                         \
- array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array5_##NUM[i] = NUM + i * 7;                                         \
- array8_##NUM[i] = NUM + i * 7;                                         \
- asm volatile("" ::: "memory");                                         \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
+	array1_##NUM[i] = (i & 1) + 5;                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
-    array2_##NUM, NUM);                                         \
+		   array2_##NUM, NUM);                                         \
     for (int i = 0; i < NUM; i++)                                              \
       {                                                                        \
- array6_##NUM[i]                                                        \
-   = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array6_##NUM[i]);   \
- if (array3_##NUM[i] != array6_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array7_##NUM[i]                                                        \
-   = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]);      \
- if (array4_##NUM[i] != array7_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array8_##NUM[i]                                                        \
-   = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]);      \
- if (array5_##NUM[i] != array8_##NUM[i])                                \
-   __builtin_abort ();                                                  \
+	array6_##NUM[i]                                                        \
+	  = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array6_##NUM[i]);   \
+	if (array3_##NUM[i] != array6_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array7_##NUM[i]                                                        \
+	  = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]);      \
+	if (array4_##NUM[i] != array7_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array8_##NUM[i]                                                        \
+	  = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]);      \
+	if (array5_##NUM[i] != array8_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
       }                                                                        \
   }
 
@@ -50,6 +52,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c
index 51b77da0d5d..29b1683ff67 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-12.c"
@@ -15,32 +15,34 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
- array1_##NUM[i] = (i & 1) + 5;                                         \
- array2_##NUM[i] = i - NUM / 3;                                         \
- array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array5_##NUM[i] = NUM + i * 7;                                         \
- array8_##NUM[i] = NUM + i * 7;                                         \
- asm volatile("" ::: "memory");                                         \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
+	array1_##NUM[i] = (i & 1) + 5;                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
-    array2_##NUM, NUM);                                         \
+		   array2_##NUM, NUM);                                         \
     for (int i = 0; i < NUM; i++)                                              \
       {                                                                        \
- array6_##NUM[i]                                                        \
-   = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array7_##NUM[i]);   \
- if (array3_##NUM[i] != array6_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array7_##NUM[i]                                                        \
-   = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]);      \
- if (array4_##NUM[i] != array7_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array8_##NUM[i]                                                        \
-   = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]);      \
- if (array5_##NUM[i] != array8_##NUM[i])                                \
-   __builtin_abort ();                                                  \
+	array6_##NUM[i]                                                        \
+	  = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) - array7_##NUM[i]);   \
+	if (array3_##NUM[i] != array6_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array7_##NUM[i]                                                        \
+	  = (TYPE) (array1_##NUM[i] * array6_##NUM[i] - array7_##NUM[i]);      \
+	if (array4_##NUM[i] != array7_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array8_##NUM[i]                                                        \
+	  = (TYPE) (array2_##NUM[i] * array7_##NUM[i] - array8_##NUM[i]);      \
+	if (array5_##NUM[i] != array8_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
       }                                                                        \
   }
 
@@ -50,6 +52,5 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c
index e069a8c7c14..3f9036c2868 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-2.c"
@@ -15,15 +15,17 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
 	array1_##NUM[i] = (i & 1) + 5;                                         \
-	array2_##NUM[i] = i - NUM / 3;                                         \
-	array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array5_##NUM[i] = NUM + i * 7;                                         \
-	array8_##NUM[i] = NUM + i * 7;                                         \
-	asm volatile("" ::: "memory");                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
 		   array2_##NUM, NUM);                                         \
@@ -48,8 +50,8 @@ int __attribute__ ((optimize (0))) main ()
 {
   TEST_LOOP (_Float16, 7)
   TEST_LOOP (_Float16, 16)
-  TEST_LOOP (_Float16, 77)
+  TEST_LOOP (_Float16, 94)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 199)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c
index 8b3994dad96..e9ad951e62f 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-3.c"
@@ -15,15 +15,17 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
 	array1_##NUM[i] = (i & 1) + 5;                                         \
-	array2_##NUM[i] = i - NUM / 3;                                         \
-	array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array5_##NUM[i] = NUM + i * 7;                                         \
-	array8_##NUM[i] = NUM + i * 7;                                         \
-	asm volatile("" ::: "memory");                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
 		   array2_##NUM, NUM);                                         \
@@ -50,6 +52,5 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c
index ef5bf498e3f..fb0cb1fef6b 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-4.c"
@@ -30,6 +30,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c
index 67fc570c6e3..06f6dbd1dbf 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-5.c"
@@ -15,32 +15,34 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
- array1_##NUM[i] = (i & 1) + 5;                                         \
- array2_##NUM[i] = i - NUM / 3;                                         \
- array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array5_##NUM[i] = NUM + i * 7;                                         \
- array8_##NUM[i] = NUM + i * 7;                                         \
- asm volatile("" ::: "memory");                                         \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
+	array1_##NUM[i] = (i & 1) + 5;                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2 * 2;                                      \
+	array8_##NUM[i] = val + val2 * 2;                                      \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
-    array2_##NUM, NUM);                                         \
+		   array2_##NUM, NUM);                                         \
     for (int i = 0; i < NUM; i++)                                              \
       {                                                                        \
- array6_##NUM[i]                                                        \
-   = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array6_##NUM[i]);   \
- if (array3_##NUM[i] != array6_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array7_##NUM[i]                                                        \
-   = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]);      \
- if (array4_##NUM[i] != array7_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array8_##NUM[i]                                                        \
-   = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]);      \
- if (array5_##NUM[i] != array8_##NUM[i])                                \
-   __builtin_abort ();                                                  \
+	array6_##NUM[i]                                                        \
+	  = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array6_##NUM[i]);   \
+	if (array3_##NUM[i] != array6_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array7_##NUM[i]                                                        \
+	  = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]);      \
+	if (array4_##NUM[i] != array7_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array8_##NUM[i]                                                        \
+	  = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]);      \
+	if (array5_##NUM[i] != array8_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
       }                                                                        \
   }
 
@@ -50,6 +52,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c
index d0361849639..b7f931e9d78 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-6.c"
@@ -15,32 +15,34 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
- array1_##NUM[i] = (i & 1) + 5;                                         \
- array2_##NUM[i] = i - NUM / 3;                                         \
- array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
- array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
- array5_##NUM[i] = NUM + i * 7;                                         \
- array8_##NUM[i] = NUM + i * 7;                                         \
- asm volatile("" ::: "memory");                                         \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
+	array1_##NUM[i] = (i & 1) + 5;                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
-    array2_##NUM, NUM);                                         \
+		   array2_##NUM, NUM);                                         \
     for (int i = 0; i < NUM; i++)                                              \
       {                                                                        \
- array6_##NUM[i]                                                        \
-   = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array7_##NUM[i]);   \
- if (array3_##NUM[i] != array6_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array7_##NUM[i]                                                        \
-   = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]);      \
- if (array4_##NUM[i] != array7_##NUM[i])                                \
-   __builtin_abort ();                                                  \
- array8_##NUM[i]                                                        \
-   = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]);      \
- if (array5_##NUM[i] != array8_##NUM[i])                                \
-   __builtin_abort ();                                                  \
+	array6_##NUM[i]                                                        \
+	  = (TYPE) (-(array1_##NUM[i] * array2_##NUM[i]) + array7_##NUM[i]);   \
+	if (array3_##NUM[i] != array6_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array7_##NUM[i]                                                        \
+	  = (TYPE) (array1_##NUM[i] * array6_##NUM[i] + array7_##NUM[i]);      \
+	if (array4_##NUM[i] != array7_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
+	array8_##NUM[i]                                                        \
+	  = (TYPE) (array2_##NUM[i] * array7_##NUM[i] + array8_##NUM[i]);      \
+	if (array5_##NUM[i] != array8_##NUM[i])                                \
+	  __builtin_abort ();                                                  \
       }                                                                        \
   }
 
@@ -50,6 +52,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c
index 7838406eba7..3a712fd0dcb 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-7.c"
@@ -30,6 +30,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c
index ec2907b3f25..f01cf6d9645 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-8.c"
@@ -15,15 +15,17 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
 	array1_##NUM[i] = (i & 1) + 5;                                         \
-	array2_##NUM[i] = i - NUM / 3;                                         \
-	array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array5_##NUM[i] = NUM + i * 7;                                         \
-	array8_##NUM[i] = NUM + i * 7;                                         \
-	asm volatile("" ::: "memory");                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val2 / 3 - val2;                               \
+	array6_##NUM[i] = val - val2 / 3 - val2;                               \
+	array4_##NUM[i] = val - val2 / 2 + val2;                               \
+	array7_##NUM[i] = val - val2 / 2 + val2;                               \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
 		   array2_##NUM, NUM);                                         \
@@ -50,6 +52,5 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c
index a855e0cc77f..eb8a105d0f1 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { riscv_v && riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_v && riscv_zvfh } } } */
 /* { dg-additional-options "--param=riscv-autovec-preference=scalable -ffast-math" } */
 
 #include "ternop-9.c"
@@ -15,15 +15,17 @@
     TYPE array8_##NUM[NUM] = {};                                               \
     for (int i = 0; i < NUM; ++i)                                              \
       {                                                                        \
+	int val = NUM / 18.3;                                                  \
+	int val2 = i / 18.7;                                                   \
 	array1_##NUM[i] = (i & 1) + 5;                                         \
-	array2_##NUM[i] = i - NUM / 3;                                         \
-	array3_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array6_##NUM[i] = NUM - NUM / 3 - i;                                   \
-	array4_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array7_##NUM[i] = NUM - NUM / 2 + i;                                   \
-	array5_##NUM[i] = NUM + i * 7;                                         \
-	array8_##NUM[i] = NUM + i * 7;                                         \
-	asm volatile("" ::: "memory");                                         \
+	array2_##NUM[i] = val2 - val / 3;                                      \
+	array3_##NUM[i] = val - val / 3 - val2;                                \
+	array6_##NUM[i] = val - val / 3 - val2;                                \
+	array4_##NUM[i] = val - val / 2 + val2;                                \
+	array7_##NUM[i] = val - val / 2 + val2;                                \
+	array5_##NUM[i] = val + val2;                                          \
+	array8_##NUM[i] = val + val2;                                          \
+	asm volatile ("" ::: "memory");                                        \
       }                                                                        \
     ternop_##TYPE (array3_##NUM, array4_##NUM, array5_##NUM, array1_##NUM,     \
 		   array2_##NUM, NUM);                                         \
@@ -50,6 +52,6 @@ int __attribute__ ((optimize (0))) main ()
   TEST_LOOP (_Float16, 16)
   TEST_LOOP (_Float16, 77)
   TEST_LOOP (_Float16, 128)
-  TEST_LOOP (_Float16, 795)
+  TEST_LOOP (_Float16, 299)
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-run.c
index 427252c81a3..739d1973229 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-run.c
@@ -3,28 +3,26 @@
 
 #include "vfsqrt-template.h"
 
-#include <assert.h>
-
 #define SZ 255
 
 #define EPS 1e-5
 
-#define RUN(TYPE)						\
-  TYPE a##TYPE[SZ];					      	\
-  for (int i = 0; i < SZ; i++)				      	\
-  {                             			      	\
-    a##TYPE[i] = (TYPE)i;             			      	\
-  }                             			      	\
-  vsqrt_##TYPE (a##TYPE, a##TYPE, SZ);	        	      	\
-  for (int i = 0; i < SZ; i++)				      	\
-    assert (__builtin_fabs				      	\
-	    (a##TYPE[i] -  __builtin_sqrtf ((TYPE)i)) < EPS);	\
+#define RUN(TYPE, SUFFIX)                                                      \
+  TYPE a##TYPE[SZ];                                                            \
+  for (int i = 0; i < SZ; i++)                                                 \
+    a##TYPE[i] = (TYPE) i;                                                     \
+  vsqrt_##TYPE (a##TYPE, a##TYPE, SZ);                                         \
+  for (int i = 0; i < SZ; i++)                                                 \
+    if (__builtin_fabs##SUFFIX (a##TYPE[i]                                     \
+				- __builtin_sqrt##SUFFIX ((TYPE) i))           \
+	> EPS)                                                                 \
+      __builtin_abort ();
 
-#define RUN_ALL()						\
- RUN(float)	                                	      	\
- RUN(double)	                                	      	\
+#define RUN_ALL()                                                              \
+  RUN (float, f)                                                               \
+  RUN (double, )
 
 int main ()
 {
-  RUN_ALL()
+  RUN_ALL ()
 }
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv32gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv32gcv.c
index a1874c8f9f0..dc3f7c49e24 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv32gcv.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv32gcv.c
@@ -7,6 +7,6 @@
    it here instead of in the template directly (which is also
    included by the run test that might need to be linked without
    the extension).  */
-TEST_TYPE3(_Float16)
+TEST_TYPE (_Float16, f16)
 
 /* { dg-final { scan-assembler-times {\tvfsqrt\.v} 3 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv64gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv64gcv.c
index 955621d4bcd..31d99756f02 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv64gcv.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv64gcv.c
@@ -7,6 +7,6 @@
    it here instead of in the template directly (which is also
    included by the run test that might need to be linked without
    the extension).  */
-TEST_TYPE3(_Float16)
+TEST_TYPE (_Float16, f16)
 
 /* { dg-final { scan-assembler-times {\tvfsqrt\.v} 3 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-template.h
index 314ea646bec..473792d0f1b 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-template.h
@@ -1,31 +1,15 @@
 #include <stdint-gcc.h>
 
-#define TEST_TYPE(TYPE) 				\
+#define TEST_TYPE(TYPE, SUFFIX) 				\
   __attribute__((noipa))				\
   void vsqrt_##TYPE (TYPE *dst, TYPE *a, int n)		\
   {							\
     for (int i = 0; i < n; i++)				\
-      dst[i] = __builtin_sqrtf (a[i]);			\
-  }
-
-#define TEST_TYPE2(TYPE) 				\
-  __attribute__((noipa))				\
-  void vsqrt_##TYPE (TYPE *dst, TYPE *a, int n)		\
-  {							\
-    for (int i = 0; i < n; i++)				\
-      dst[i] = __builtin_sqrt (a[i]);			\
-  }
-
-#define TEST_TYPE3(TYPE) 				\
-  __attribute__((noipa))				\
-  void vsqrt_##TYPE (TYPE *dst, TYPE *a, int n)		\
-  {							\
-    for (int i = 0; i < n; i++)				\
-      dst[i] = __builtin_sqrtf16 (a[i]);		\
+      dst[i] = __builtin_sqrt##SUFFIX (a[i]);			\
   }
 
 #define TEST_ALL()					\
- TEST_TYPE(float)					\
- TEST_TYPE2(double)					\
+ TEST_TYPE(float, f)					\
+ TEST_TYPE(double, )					\
 
 TEST_ALL()
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-zvfh-run.c
index 5849e486047..c974ef090ba 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vfsqrt-zvfh-run.c
@@ -1,31 +1,31 @@
-/* { dg-do run { target { riscv_zvfh_hw } } } */
+/* { dg-do run { target { riscv_zvfh && riscv_zfh } } } */
 /* { dg-additional-options "-std=c99 -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -ffast-math" } */
 
 #include "vfsqrt-template.h"
 
 /* We cannot link this without the Zvfh extension so define
    it here instead of in the template directly.  */
-TEST_TYPE3(_Float16)
-
-#include <assert.h>
+TEST_TYPE(_Float16, f16)
 
 #define SZ 255
 
 #define EPS 1e-5
 
-#define RUN(TYPE)						\
-  TYPE a##TYPE[SZ];						\
-  for (int i = 0; i < SZ; i++)				    	\
-  {                             			    	\
-    a##TYPE[i] = (TYPE)i;             			    	\
-  }                             			    	\
-  vsqrt_##TYPE (a##TYPE, a##TYPE, SZ);	        	    	\
-  for (int i = 0; i < SZ; i++)				    	\
-    assert (__builtin_fabs				    	\
-	    (a##TYPE[i] - __builtin_sqrtf ((TYPE)i)) < EPS);	\
-
-#define RUN_ALL()						\
- RUN(_Float16)	                                	    	\
+#define RUN(TYPE, SUFFIX)                                                      \
+  TYPE a##TYPE[SZ];                                                            \
+  for (int i = 0; i < SZ; i++)                                                 \
+    {                                                                          \
+      a##TYPE[i] = (TYPE) i;                                                   \
+    }                                                                          \
+  vsqrt_##TYPE (a##TYPE, a##TYPE, SZ);                                         \
+  for (int i = 0; i < SZ; i++)                                                 \
+    if (__builtin_fabs##SUFFIX (a##TYPE[i]                                     \
+				- __builtin_sqrt##SUFFIX ((TYPE) i))           \
+	> EPS)                                                                 \
+      __builtin_abort ();
+
+#define RUN_ALL() \
+      RUN (_Float16, f16)
 
 int main ()
 {
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-zvfh-run.c
index 365480ec254..fa8551b158b 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_extract-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run {target { riscv_zvfh_hw } } } */
-/* { dg-additional-options "-Wno-pedantic" } */
+/* { dg-do run {target { riscv_zvfh } } } */
+/* { dg-additional-options "-std=gnu99 -Wno-pedantic" } */
 
 #include <assert.h>
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_set-zvfh-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_set-zvfh-run.c
index 7e5a73a5ea8..98e673f4ad9 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_set-zvfh-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/vec_set-zvfh-run.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { riscv_zvfh_hw } } } */
-/* { dg-additional-options "-Wno-pedantic" } */
+/* { dg-do run { target { riscv_zvfh } } } */
+/* { dg-additional-options "-std=gnu99 -Wno-pedantic" } */
 
 #include <assert.h>
 
