return gimple_folder (rfn.instance, rfn.decl, gsi, stmt).fold ();
}
+static bool
+validate_instance_type_required_extensions (const rvv_type_info type,
+ tree exp)
+{
+ uint64_t exts = type.required_extensions;
+
+ if ((exts & RVV_REQUIRE_ELEN_FP_16) &&
+ !TARGET_VECTOR_ELEN_FP_16_P (riscv_vector_elen_flags))
+ {
+ error_at (EXPR_LOCATION (exp),
+ "built-in function %qE requires the "
+ "zvfhmin or zvfh ISA extension",
+ exp);
+ return false;
+ }
+
+ if ((exts & RVV_REQUIRE_ELEN_FP_32) &&
+ !TARGET_VECTOR_ELEN_FP_32_P (riscv_vector_elen_flags))
+ {
+ error_at (EXPR_LOCATION (exp),
+ "built-in function %qE requires the "
+ "zve32f, zve64f, zve64d or v ISA extension",
+ exp);
+ return false;
+ }
+
+ if ((exts & RVV_REQUIRE_ELEN_FP_64) &&
+ !TARGET_VECTOR_ELEN_FP_64_P (riscv_vector_elen_flags))
+ {
+ error_at (EXPR_LOCATION (exp),
+ "built-in function %qE requires the zve64d or v ISA extension",
+ exp);
+ return false;
+ }
+
+ if ((exts & RVV_REQUIRE_ELEN_64) &&
+ !TARGET_VECTOR_ELEN_64_P (riscv_vector_elen_flags))
+ {
+ error_at (EXPR_LOCATION (exp),
+ "built-in function %qE requires the "
+ "zve64x, zve64f, zve64d or v ISA extension",
+ exp);
+ return false;
+ }
+
+ return true;
+}
+
/* Expand a call to the RVV function with subcode CODE. EXP is the call
expression and TARGET is the preferred location for the result.
Return the value of the lhs. */
return target;
}
+ if (!validate_instance_type_required_extensions (rfn.instance.type, exp))
+ return target;
+
return function_expander (rfn.instance, rfn.decl, exp, target).expand ();
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
+
+#include "riscv_vector.h"
+
+vfloat32mf2_t test_vfwsub_wf_f32mf2(vfloat32mf2_t vs2, _Float16 rs1, size_t vl)
+{
+ return __riscv_vfwsub_wf_f32mf2(vs2, rs1, vl); /* { dg-error {built-in function '__riscv_vfwsub_wf_f32mf2\(vs2, rs1, vl\)' requires the zvfhmin or zvfh ISA extension} } */
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
+
+#include "riscv_vector.h"
+
+vfloat32mf2_t test_vfwadd_wf_f32mf2(vfloat32mf2_t vs2, _Float16 rs1, size_t vl)
+{
+ return __riscv_vfwadd_wf_f32mf2(vs2, rs1, vl); /* { dg-error {built-in function '__riscv_vfwadd_wf_f32mf2\(vs2, rs1, vl\)' requires the zvfhmin or zvfh ISA extension} } */
+}