Expand can implement NEG and ABS of scalar floating-point modes
by using logic ops to manipulate the sign bit. This patch extends
that approach to vectors, since it fits relatively easily into the
same structure.
The motivating use case was to inline bf16 NEG and ABS operations
for AArch64. The patch includes tests for that.
get_absneg_bit_mode required a new opt_mode constructor, so that
opt_mode<T> can be constructed from opt_mode<U> if T is no less
general than U.
gcc/
* machmode.h (opt_mode::opt_mode): New overload.
* optabs-query.h (get_absneg_bit_mode): Declare.
* optabs-query.cc (get_absneg_bit_mode): New function, split
out from expand_absneg_bit.
(can_open_code_p): Use get_absneg_bit_mode.
* optabs.cc (expand_absneg_bit): Likewise. Take an outer and inner
mode, rather than just one. Handle vector modes.
(expand_unop, expand_abs_nojump): Update calls accordingly.
Handle vector modes.