gimple-isel: Check whether IFN_VCONDEQ is supported [PR98560]
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 7 Jan 2021 15:00:39 +0000 (15:00 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 7 Jan 2021 15:00:39 +0000 (15:00 +0000)
commit298e76e6562bb79ed42cb4bc88aca817e6e58417
treef9abd4374bb6e5a20b0aa856cbe21740bccdbb85
parent78595e918ee168f595d16268073a3754c64d67fe
gimple-isel: Check whether IFN_VCONDEQ is supported [PR98560]

This patch follows on from the previous one for the PR and
makes sure that we can handle == as well as <.  Previously
we assumed without checking that IFN_VCONDEQ was available
if IFN_VCOND or IFN_VCONDU wasn't.

The patch also fixes the definition of the IFN_VCOND* functions.
The optabs are convert optabs in which the first mode is the
data mode and the second mode is the comparison or mask mode.

gcc/
PR tree-optimization/98560
* internal-fn.def (IFN_VCONDU, IFN_VCONDEQ): Use type vec_cond.
* internal-fn.c (vec_cond_mask_direct): Get the data mode from
argument 1.
(vec_cond_direct): Likewise argument 2.
(vec_condu_direct, vec_condeq_direct): Delete.
(expand_vect_cond_optab_fn): Rename to...
(expand_vec_cond_optab_fn): ...this, replacing old macro.
(expand_vec_condu_optab_fn, expand_vec_condeq_optab_fn): Delete.
(expand_vect_cond_mask_optab_fn): Rename to...
(expand_vec_cond_mask_optab_fn): ...this, replacing old macro.
(direct_vec_cond_mask_optab_supported_p): Treat the optab as a
convert optab.
(direct_vec_cond_optab_supported_p): Likewise.
(direct_vec_condu_optab_supported_p): Delete.
(direct_vec_condeq_optab_supported_p): Delete.
* gimple-isel.cc: Include internal-fn.h.
(gimple_expand_vec_cond_expr): Check that IFN_VCONDEQ is supported
before using it.

gcc/testsuite/
PR tree-optimization/98560
* gcc.dg/vect/pr98560-2.c: New test.
gcc/gimple-isel.cc
gcc/internal-fn.c
gcc/internal-fn.def
gcc/testsuite/gcc.dg/vect/pr98560-2.c [new file with mode: 0644]