Add an "else" argument to IFN_COND_* functions
commit47c5243583e19adaddc4a207e32cad1bec86a4e3
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 May 2018 06:48:47 +0000 (25 06:48 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 May 2018 06:48:47 +0000 (25 06:48 +0000)
tree76c1c854e1471b931585d5223486aaf8844c1f8b
parent5430ed0d4d2863a590d2a53aebf9a64e8ddbf77a
Add an "else" argument to IFN_COND_* functions

As suggested by Richard B, this patch changes the IFN_COND_*
functions so that they take the else value of the ?: operation
as a final argument, rather than always using argument 1.

All current callers will still use the equivalent of argument 1,
so this patch makes the SVE code assert that for now.  Later patches
add the general case.

2018-05-25  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* doc/md.texi: Update the documentation of the cond_* optabs
to mention the new final operand.  Fix GET_MODE_NUNITS call.
Describe the scalar case too.
* internal-fn.def (IFN_EXTRACT_LAST): Change type to fold_left.
* internal-fn.c (expand_cond_unary_optab_fn): Expect 3 operands
instead of 2.
(expand_cond_binary_optab_fn): Expect 4 operands instead of 3.
(get_conditional_internal_fn): Update comment.
* tree-vect-loop.c (vectorizable_reduction): Pass the original
accumulator value as a final argument to conditional functions.
* config/aarch64/aarch64-sve.md (cond_<optab><mode>): Turn into
a define_expand and add an "else" operand.  Assert for now that
the else operand is equal to operand 2.  Use SVE_INT_BINARY and
SVE_COND_FP_BINARY instead of SVE_COND_INT_OP and SVE_COND_FP_OP.
(*cond_<optab><mode>): New patterns.
* config/aarch64/iterators.md (UNSPEC_COND_SMAX, UNSPEC_COND_UMAX)
(UNSPEC_COND_SMIN, UNSPEC_COND_UMIN, UNSPEC_COND_AND, UNSPEC_COND_ORR)
(UNSPEC_COND_EOR): Delete.
(optab): Remove associated mappings.
(SVE_INT_BINARY): New code iterator.
(sve_int_op): Remove int attribute and add "minus" to the code
attribute.
(SVE_COND_INT_OP): Delete.
(SVE_COND_FP_OP): Rename to...
(SVE_COND_FP_BINARY): ...this.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260707 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/aarch64/aarch64-sve.md
gcc/config/aarch64/iterators.md
gcc/doc/md.texi
gcc/internal-fn.c
gcc/internal-fn.def
gcc/tree-vect-loop.c