case RISCV_BUILTIN_GENERAL:
break;
case RISCV_BUILTIN_VECTOR:
- new_fndecl = riscv_vector::resolve_overloaded_builtin (subcode, arglist);
+ new_fndecl = riscv_vector::resolve_overloaded_builtin (loc, subcode,
+ fndecl, arglist);
break;
default:
gcc_unreachable ();
rtx expand_builtin (unsigned int, tree, rtx);
bool check_builtin_call (location_t, vec<location_t>, unsigned int,
tree, unsigned int, tree *);
-tree resolve_overloaded_builtin (unsigned int, vec<tree, va_gc> *);
+tree resolve_overloaded_builtin (location_t, unsigned int, tree, vec<tree, va_gc> *);
bool const_vec_all_same_in_range_p (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
bool legitimize_move (rtx, rtx *);
void emit_vlmax_vsetvl (machine_mode, rtx);
}
tree
-resolve_overloaded_builtin (unsigned int code, vec<tree, va_gc> *arglist)
+resolve_overloaded_builtin (location_t loc, unsigned int code, tree fndecl,
+ vec<tree, va_gc> *arglist)
{
if (code >= vec_safe_length (registered_functions))
return NULL_TREE;
if (!rfun || !rfun->overloaded_p)
return NULL_TREE;
+ /* According to the rvv intrinisc doc, we have no such overloaded function
+ with empty args. Unfortunately, we register the empty args function as
+ overloaded for avoiding conflict. Thus, there will actual one register
+ function after return NULL_TREE back to the middle-end, and finally result
+ in ICE when expanding. For example:
+
+ 1. First we registered void __riscv_vfredmax () as the overloaded function.
+ 2. Then resolve_overloaded_builtin (this func) return NULL_TREE.
+ 3. The functions register in step 1 bypass the args check as empty args.
+ 4. Finally, fall into expand_builtin with empty args and meet ICE.
+
+ Here we report error when overloaded function with empty args. */
+ if (rfun->overloaded_p && arglist->length () == 0)
+ error_at (loc, "no matching function call to %qE with empty args", fndecl);
+
hashval_t hash = rfun->overloaded_hash (*arglist);
registered_function *rfn
= non_overloaded_function_table->find_with_hash (rfun, hash);
- if (rfn)
- return rfn->decl;
- return NULL_TREE;
+
+ return rfn ? rfn->decl : NULL_TREE;
}
function_instance
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3" } */
+
+#include "riscv_vector.h"
+
+void
+test ()
+{
+ __riscv_vand (); /* { dg-error {no matching function call to '__riscv_vand' with empty args} } */
+ __riscv_vand_tu (); /* { dg-error {no matching function call to '__riscv_vand_tu' with empty args} } */
+ __riscv_vand_tumu (); /* { dg-error {no matching function call to '__riscv_vand_tumu' with empty args} } */
+
+ __riscv_vcompress (); /* { dg-error {no matching function call to '__riscv_vcompress' with empty args} } */
+ __riscv_vcompress_tu (); /* { dg-error {no matching function call to '__riscv_vcompress_tu' with empty args} } */
+
+ __riscv_vcpop (); /* { dg-error {no matching function call to '__riscv_vcpop' with empty args} } */
+
+ __riscv_vdiv (); /* { dg-error {no matching function call to '__riscv_vdiv' with empty args} } */
+ __riscv_vdiv_tu (); /* { dg-error {no matching function call to '__riscv_vdiv_tu' with empty args} } */
+ __riscv_vdiv_tumu (); /* { dg-error {no matching function call to '__riscv_vdiv_tumu' with empty args} } */
+
+ __riscv_vfabs (); /* { dg-error {no matching function call to '__riscv_vfabs' with empty args} } */
+ __riscv_vfabs_tu (); /* { dg-error {no matching function call to '__riscv_vfabs_tu' with empty args} } */
+ __riscv_vfabs_tumu (); /* { dg-error {no matching function call to '__riscv_vfabs_tumu' with empty args} } */
+
+ __riscv_vfadd (); /* { dg-error {no matching function call to '__riscv_vfadd' with empty args} } */
+ __riscv_vfadd_tu (); /* { dg-error {no matching function call to '__riscv_vfadd_tu' with empty args} } */
+ __riscv_vfadd_tumu (); /* { dg-error {no matching function call to '__riscv_vfadd_tumu' with empty args} } */
+
+ __riscv_vfclass (); /* { dg-error {no matching function call to '__riscv_vfclass' with empty args} } */
+ __riscv_vfclass_tu (); /* { dg-error {no matching function call to '__riscv_vfclass_tu' with empty args} } */
+ __riscv_vfclass_tumu (); /* { dg-error {no matching function call to '__riscv_vfclass_tumu' with empty args} } */
+
+ __riscv_vfcvt_x (); /* { dg-error {no matching function call to '__riscv_vfcvt_x' with empty args} } */
+ __riscv_vfcvt_x_tu (); /* { dg-error {no matching function call to '__riscv_vfcvt_x_tu' with empty args} } */
+ __riscv_vfcvt_x_tumu (); /* { dg-error {no matching function call to '__riscv_vfcvt_x_tumu' with empty args} } */
+
+ __riscv_vfirst (); /* { dg-error {no matching function call to '__riscv_vfirst' with empty args} } */
+
+ __riscv_vfmadd (); /* { dg-error {no matching function call to '__riscv_vfmadd' with empty args} } */
+ __riscv_vfmadd_tu (); /* { dg-error {no matching function call to '__riscv_vfmadd_tu' with empty args} } */
+ __riscv_vfmadd_tumu (); /* { dg-error {no matching function call to '__riscv_vfmadd_tumu' with empty args} } */
+
+ __riscv_vfmerge (); /* { dg-error {no matching function call to '__riscv_vfmerge' with empty args} } */
+ __riscv_vfmerge_tu (); /* { dg-error {no matching function call to '__riscv_vfmerge_tu' with empty args} } */
+
+ __riscv_vfncvt_x (); /* { dg-error {no matching function call to '__riscv_vfncvt_x' with empty args} } */
+ __riscv_vfncvt_x_tu (); /* { dg-error {no matching function call to '__riscv_vfncvt_x_tu' with empty args} } */
+ __riscv_vfncvt_x_tumu (); /* { dg-error {no matching function call to '__riscv_vfncvt_x_tumu' with empty args} } */
+
+ __riscv_vfrec7 (); /* { dg-error {no matching function call to '__riscv_vfrec7' with empty args} } */
+ __riscv_vfrec7_tu (); /* { dg-error {no matching function call to '__riscv_vfrec7_tu' with empty args} } */
+ __riscv_vfrec7_tumu (); /* { dg-error {no matching function call to '__riscv_vfrec7_tumu' with empty args} } */
+
+ __riscv_vfrsqrt7 (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7' with empty args} } */
+ __riscv_vfrsqrt7_tu (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7_tu' with empty args} } */
+ __riscv_vfrsqrt7_tumu (); /* { dg-error {no matching function call to '__riscv_vfrsqrt7_tumu' with empty args} } */
+
+ __riscv_vfsgnjn (); /* { dg-error {no matching function call to '__riscv_vfsgnjn' with empty args} } */
+ __riscv_vfsgnjn_tu (); /* { dg-error {no matching function call to '__riscv_vfsgnjn_tu' with empty args} } */
+ __riscv_vfsgnjn_tumu (); /* { dg-error {no matching function call to '__riscv_vfsgnjn_tumu' with empty args} } */
+
+ __riscv_vfslide1down (); /* { dg-error {no matching function call to '__riscv_vfslide1down' with empty args} } */
+ __riscv_vfslide1down_tu (); /* { dg-error {no matching function call to '__riscv_vfslide1down_tu' with empty args} } */
+ __riscv_vfslide1down_tumu (); /* { dg-error {no matching function call to '__riscv_vfslide1down_tumu' with empty args} } */
+
+ __riscv_vfwmul (); /* { dg-error {no matching function call to '__riscv_vfwmul' with empty args} } */
+ __riscv_vfwmul_tu (); /* { dg-error {no matching function call to '__riscv_vfwmul_tu' with empty args} } */
+ __riscv_vfwmul_tumu (); /* { dg-error {no matching function call to '__riscv_vfwmul_tumu' with empty args} } */
+
+ __riscv_vle32 (); /* { dg-error {no matching function call to '__riscv_vle32' with empty args} } */
+ __riscv_vle32_tu (); /* { dg-error {no matching function call to '__riscv_vle32_tu' with empty args} } */
+ __riscv_vle32_tumu (); /* { dg-error {no matching function call to '__riscv_vle32_tumu' with empty args} } */
+
+ __riscv_vlse64 (); /* { dg-error {no matching function call to '__riscv_vlse64' with empty args} } */
+ __riscv_vlse64_tu (); /* { dg-error {no matching function call to '__riscv_vlse64_tu' with empty args} } */
+ __riscv_vlse64_tumu (); /* { dg-error {no matching function call to '__riscv_vlse64_tumu' with empty args} } */
+
+ __riscv_vmfeq (); /* { dg-error {no matching function call to '__riscv_vmfeq' with empty args} } */
+
+ __riscv_vreinterpret_u8m1 (); /* { dg-error {no matching function call to '__riscv_vreinterpret_u8m1' with empty args} } */
+
+ __riscv_vfredosum (); /* { dg-error {no matching function call to '__riscv_vfredosum' with empty args} } */
+ __riscv_vfredosum_tu (); /* { dg-error {no matching function call to '__riscv_vfredosum_tu' with empty args} } */
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3" } */
+
+#include "riscv_vector.h"
+
+void
+test (vint32m1_t vi32m1, vint64m1_t vi64m1, vfloat32m1_t vf32m1, unsigned vl)
+{
+ __riscv_vand (vi32m1, vl); /* { dg-error {too few arguments to function '__riscv_vand_vx_i32m1'} } */
+
+ __riscv_vcompress (vi32m1, vl); /* { dg-error {too many arguments to function '__riscv_vcompress'} } */
+
+ __riscv_vcpop (vi32m1, vl); /* { dg-error {too many arguments to function '__riscv_vcpop'} } */
+
+ __riscv_vdiv (vi32m1, vl); /* { dg-error {too few arguments to function '__riscv_vdiv_vx_i32m1'} } */
+
+ __riscv_vfabs (vf32m1); /* { dg-error {too many arguments to function '__riscv_vfabs'} } */
+
+ __riscv_vfadd (vf32m1, vl); /* { dg-error {too many arguments to function '__riscv_vfadd'} } */
+
+ __riscv_vfcvt_x (vf32m1); /* { dg-error {too many arguments to function '__riscv_vfcvt_x'} } */
+
+ __riscv_vfirst (vf32m1, vl); /* { dg-error {too many arguments to function '__riscv_vfirst'} } */
+
+ __riscv_vfmadd (vf32m1, vl); /* { dg-error {too many arguments to function '__riscv_vfmadd'} } */
+
+ __riscv_vfmerge (vf32m1, vl); /* { dg-error {too many arguments to function '__riscv_vfmerge'} } */
+
+ __riscv_vfncvt_x (vf32m1); /* { dg-error {too many arguments to function '__riscv_vfncvt_x'} } */
+
+ __riscv_vfrec7 (vf32m1); /* { dg-error {too many arguments to function '__riscv_vfrec7'} } */
+
+ __riscv_vfrsqrt7 (vf32m1); /* { dg-error {too many arguments to function '__riscv_vfrsqrt7'} } */
+
+ __riscv_vfsgnjn (vf32m1, vl); /* { dg-error {too few arguments to function '__riscv_vfsgnjn_vf_f32m1'} } */
+
+ __riscv_vfslide1down (vf32m1, vl); /* { dg-error {too few arguments to function '__riscv_vfslide1down_vf_f32m1'} } */
+
+ __riscv_vfwmul (vf32m1, vl); /* { dg-error {too many arguments to function '__riscv_vfwmul'} } */
+
+ __riscv_vle32 (vi32m1, vl); /* { dg-error {too many arguments to function '__riscv_vle32'} } */
+
+ __riscv_vlse64 (vi64m1, vl); /* { dg-error {too many arguments to function '__riscv_vlse64'} } */
+
+ __riscv_vmfeq (vf32m1, vl); /* { dg-error {too few arguments to function '__riscv_vmfeq_vf_f32m1_b32'} } */
+
+ __riscv_vfredosum (vf32m1, vl); /* { dg-error {too many arguments to function '__riscv_vfredosum'} } */
+}