On Fri, 2022-06-10 at 10:14 +0100, Richard Sandiford via Gcc-patches wrote: Several existing internal functions map directly to an instruction defined in target-insns.def. This patch makes it easier to define more such functions in future.
This should help to reduce cut-&-paste, but more importantly, it allows the difference between optab functions and target-insns.def functions to be abstracted away; both are now treated as “directly-mapped”. Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Richard gcc/ * internal-fn.def (DEF_INTERNAL_INSN_FN): New macro. (GOMP_SIMT_ENTER_ALLOC, GOMP_SIMT_EXIT, GOMP_SIMT_LANE) (GOMP_SIMT_LAST_LANE, GOMP_SIMT_ORDERED_PRED, GOMP_SIMT_VOTE_ANY) (GOMP_SIMT_XCHG_BFLY, GOMP_SIMT_XCHG_IDX): Use it. * internal-fn.h (direct_internal_fn_info::directly_mapped): New member variable. (direct_internal_fn_info::vectorizable): Reduce to 1 bit. (direct_internal_fn_p): Also return true for internal functions that map directly to instructions defined target-insns.def. (direct_internal_fn): Adjust comment accordingly. * internal-fn.c (direct_insn, optab1, optab2, vectorizable_optab1) [...snip...] --- gcc/internal-fn.cc | 152 +++++++++++++++----------------------------- gcc/internal-fn.def | 34 +++++++--- gcc/internal-fn.h | 20 +++--- 3 files changed, 87 insertions(+), 119 deletions(-) [...snip...] I can't comment on the correctness of the patch, but I happened to spot that the filename in the changelog entry needs renaming for the .c to .cc transition, or the git hooks will complain when you try to push this. Dave