]> git.ipfire.org Git - thirdparty/gcc.git/commit
Add helpers to test whether an optab can be implemented
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 20 Nov 2024 10:04:45 +0000 (10:04 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 20 Nov 2024 10:04:45 +0000 (10:04 +0000)
commit485ab50c204ddba922c92d8d467ac734428a4e8a
tree4ee00aa0a199acf272ffae1fd02f2e501550d2ce
parent3ec0b7cd7ce7b64b58cb0ee52fb95fb0875c805c
Add helpers to test whether an optab can be implemented

The vectoriser and vector lowering passes both had tests of the form:

    if (op
&& (optab_handler (op, compute_mode) != CODE_FOR_nothing
    || optab_libfunc (op, compute_mode)))
      ...success...
    if (code == MULT_HIGHPART_EXPR
&& can_mult_highpart_p (compute_mode,
TYPE_UNSIGNED (compute_type)))
      ...success...

This patch adds helper routines for this kind of test, so that it's
easier to handle other optab alternatives in a similar way.

gcc/
* optabs-query.cc (can_open_code_p, can_implement_p): Declare.
* optabs-query.h (can_open_code_p, can_implement_p): New functions.
* optabs-tree.cc (target_supports_op_p): Use can_implement_p.
* tree-vect-stmts.cc (vectorizable_operation): Likewise.
* tree-vect-generic.cc (get_compute_type): Likewise.  Remove code
parameter.
(expand_vector_scalar_condition, expand_vector_conversion)
(expand_vector_operations_1): Update calls accordingly.
gcc/optabs-query.cc
gcc/optabs-query.h
gcc/optabs-tree.cc
gcc/tree-vect-generic.cc
gcc/tree-vect-stmts.cc