aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-isel.cc
AgeCommit message (Collapse)AuthorFilesLines
2022-06-27Add 'final' and 'override' to opt_pass vfunc implsDavid Malcolm1-2/+2
gcc/ChangeLog: * adjust-alignment.cc: Add "final" and "override" to opt_pass vfunc implementations, removing redundant "virtual" as appropriate. * asan.cc: Likewise. * auto-inc-dec.cc: Likewise. * auto-profile.cc: Likewise. * bb-reorder.cc: Likewise. * cfgcleanup.cc: Likewise. * cfgexpand.cc: Likewise. * cfgrtl.cc: Likewise. * cgraphbuild.cc: Likewise. * combine-stack-adj.cc: Likewise. * combine.cc: Likewise. * compare-elim.cc: Likewise. * config/i386/i386-features.cc: Likewise. * coroutine-passes.cc: Likewise. * cprop.cc: Likewise. * cse.cc: Likewise. * dce.cc: Likewise. * df-core.cc: Likewise. * dse.cc: Likewise. * dwarf2cfi.cc: Likewise. * early-remat.cc: Likewise. * except.cc: Likewise. * final.cc: Likewise. * function.cc: Likewise. * fwprop.cc: Likewise. * gcse.cc: Likewise. * gimple-harden-conditionals.cc: Likewise. * gimple-if-to-switch.cc: Likewise. * gimple-isel.cc: Likewise. * gimple-laddress.cc: Likewise. * gimple-loop-interchange.cc: Likewise. * gimple-loop-jam.cc: Likewise. * gimple-loop-versioning.cc: Likewise. * gimple-low.cc: Likewise. * gimple-ssa-backprop.cc: Likewise. * gimple-ssa-evrp.cc: Likewise. * gimple-ssa-isolate-paths.cc: Likewise. * gimple-ssa-nonnull-compare.cc: Likewise. * gimple-ssa-split-paths.cc: Likewise. * gimple-ssa-store-merging.cc: Likewise. * gimple-ssa-strength-reduction.cc: Likewise. * gimple-ssa-warn-access.cc: Likewise. * gimple-ssa-warn-alloca.cc: Likewise. * gimple-ssa-warn-restrict.cc: Likewise. * gimple-warn-recursion.cc: Likewise. * graphite.cc: Likewise. * ifcvt.cc: Likewise. * init-regs.cc: Likewise. * ipa-comdats.cc: Likewise. * ipa-cp.cc: Likewise. * ipa-devirt.cc: Likewise. * ipa-fnsummary.cc: Likewise. * ipa-free-lang-data.cc: Likewise. * ipa-icf.cc: Likewise. * ipa-inline.cc: Likewise. * ipa-modref.cc: Likewise. * ipa-profile.cc: Likewise. * ipa-pure-const.cc: Likewise. * ipa-reference.cc: Likewise. * ipa-split.cc: Likewise. * ipa-sra.cc: Likewise. * ipa-visibility.cc: Likewise. * ipa.cc: Likewise. * ira.cc: Likewise. * jump.cc: Likewise. * loop-init.cc: Likewise. * lower-subreg.cc: Likewise. * mode-switching.cc: Likewise. * modulo-sched.cc: Likewise. * multiple_target.cc: Likewise. * omp-expand.cc: Likewise. * omp-low.cc: Likewise. * omp-oacc-kernels-decompose.cc: Likewise. * omp-oacc-neuter-broadcast.cc: Likewise. * omp-offload.cc: Likewise. * omp-simd-clone.cc: Likewise. * passes.cc: Likewise. * postreload-gcse.cc: Likewise. * postreload.cc: Likewise. * predict.cc: Likewise. * recog.cc: Likewise. * ree.cc: Likewise. * reg-stack.cc: Likewise. * regcprop.cc: Likewise. * reginfo.cc: Likewise. * regrename.cc: Likewise. * reorg.cc: Likewise. * sancov.cc: Likewise. * sanopt.cc: Likewise. * sched-rgn.cc: Likewise. * stack-ptr-mod.cc: Likewise. * store-motion.cc: Likewise. * tracer.cc: Likewise. * trans-mem.cc: Likewise. * tree-call-cdce.cc: Likewise. * tree-cfg.cc: Likewise. * tree-cfgcleanup.cc: Likewise. * tree-complex.cc: Likewise. * tree-eh.cc: Likewise. * tree-emutls.cc: Likewise. * tree-if-conv.cc: Likewise. * tree-into-ssa.cc: Likewise. * tree-loop-distribution.cc: Likewise. * tree-nrv.cc: Likewise. * tree-object-size.cc: Likewise. * tree-parloops.cc: Likewise. * tree-predcom.cc: Likewise. * tree-profile.cc: Likewise. * tree-sra.cc: Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-copy.cc: Likewise. * tree-ssa-dce.cc: Likewise. * tree-ssa-dom.cc: Likewise. * tree-ssa-dse.cc: Likewise. * tree-ssa-forwprop.cc: Likewise. * tree-ssa-ifcombine.cc: Likewise. * tree-ssa-loop-ch.cc: Likewise. * tree-ssa-loop-im.cc: Likewise. * tree-ssa-loop-ivcanon.cc: Likewise. * tree-ssa-loop-prefetch.cc: Likewise. * tree-ssa-loop-split.cc: Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-loop.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-phiopt.cc: Likewise. * tree-ssa-phiprop.cc: Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc: Likewise. * tree-ssa-sccvn.cc: Likewise. * tree-ssa-sink.cc: Likewise. * tree-ssa-strlen.cc: Likewise. * tree-ssa-structalias.cc: Likewise. * tree-ssa-uncprop.cc: Likewise. * tree-ssa-uninit.cc: Likewise. * tree-ssanames.cc: Likewise. * tree-stdarg.cc: Likewise. * tree-switch-conversion.cc: Likewise. * tree-tailcall.cc: Likewise. * tree-vect-generic.cc: Likewise. * tree-vectorizer.cc: Likewise. * tree-vrp.cc: Likewise. * tsan.cc: Likewise. * ubsan.cc: Likewise. * var-tracking.cc: Likewise. * vtable-verify.cc: Likewise. * web.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-05-10isel: Fix up gimple_expand_vec_set_expr [PR105528]Jakub Jelinek1-1/+2
The following testcase ICEs (and only without -g), because we don't replace one VEC_COND_EXPR with .VCOND* call. We don't do that because gimple_expand_vec_set_expr adds some stmts before *gsi and then uses gsi_remove to remove it. gsi_remove moves the iterator to the next stmt and in the caller we then do gsi_next before looking at another stmt, which means we can skip processing of one stmt, which in this case happened to be a VEC_COND_EXPR but with -g is some debug stmt in between. As we always emit some stmts before it, it is easy to update the iterator to the last stmt emitted there, so that caller continues really with the next stmt. 2022-05-10 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/105528 * gimple-isel.cc (gimple_expand_vec_set_expr): After gsi_remove set *gsi to gsi_for_stmt (ass_stmt). Fix up function comment. * gcc.dg/pr105528.c: New test.
2022-05-05tree-optimization/105484 - VEC_SET and EHRichard Biener1-7/+12
When the IL representation of VEC_SET is marked as throwing (unnecessarily), we need to clean that when replacing it with the .VEC_SET internal function call which cannot throw. 2022-05-05 Richard Biener <rguenther@suse.de> PR tree-optimization/105484 * gimple-isel.cc (gimple_expand_vec_set_expr): Clean EH, return whether the CFG changed. (gimple_expand_vec_exprs): When the CFG changed, clean it up. * gcc.dg/torture/pr105484.c: New testcase.
2022-04-20tree-optimization/105312 - fix ISEL VCOND expansionRichard Biener1-0/+8
The following aligns ISEL VEC_COND_EXPR expansion using VCOND with the optab query done by vector lowering. Instead of only allowing the signed optab to provide EQ/NE compares we allow both here though since there seems to be no documented canonicalization. 2022-04-20 Richard Biener <rguenther@suse.de> PR tree-optimization/105312 * gimple-isel.cc (gimple_expand_vec_cond_expr): Query both VCOND and VCONDU for EQ and NE. * gcc.target/arm/pr105312.c: New testcase.
2022-02-09middle-end/104464 - ISEL and non-call EH #2Richard Biener1-14/+14
The following adjusts the earlier change to still allow an uncritical replacement. 2022-02-09 Richard Biener <rguenther@suse.de> PR middle-end/104464 * gimple-isel.cc (gimple_expand_vec_cond_expr): Postpone throwing check to after unproblematic replacement. * gcc.dg/pr104464.c: New testcase.
2022-02-09middle-end/104450 - ISEL and non-call EHRichard Biener1-10/+14
The following avoids merging a vector compare with EH with a VEC_COND_EXPR. We should be able to do fallback expansion and if we really are for the optimization we need quite some shuffling to arrange for the proper EH redirection in all cases, IMHO not worth it. 2022-02-09 Richard Biener <rguenther@suse.de> PR middle-end/104450 * gimple-isel.cc: Pass cfun around. (+gimple_expand_vec_cond_expr): Do not combine a throwing comparison with the select. * g++.dg/torture/pr104450.C: New testcase.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-10-06[gimple-isel] Remove redundant if condition.prathamesh.kulkarni1-3/+0
gcc/ChangeLog: * gimple-isel.cc (gimple_expand_vec_cond_expr): Remove redundant if condition.
2021-01-07gimple-isel: Check whether IFN_VCONDEQ is supported [PR98560]Richard Sandiford1-1/+5
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.
2021-01-07gimple-isel: Fall back to using vcond_mask [PR98560]Richard Sandiford1-7/+19
PR98560 is about a case in which the vectoriser initially generates: mask_1 = a < 0; mask_2 = mask_1 & ...; res = VEC_COND_EXPR <mask_2, b, c>; The vectoriser thus expects res to be calculated using vcond_mask. However, we later manage to fold mask_2 to mask_1, leaving: mask_1 = a < 0; res = VEC_COND_EXPR <mask_1, b, c>; gimple-isel then required a combined vcond to exist. On most targets, it's not too onerous to provide all possible (compare x select) combinations. For each data mode, you just need to provide unsigned comparisons, signed comparisons, and floating-point comparisons, with the data mode and type of comparison uniquely determining the mode of the compared values. But for targets like SVE that support “unpacked” vectors, it's not that simple: the level of unpacking adds another degree of freedom. Rather than insist that the combined versions exist, I think we should be prepared to fall back to using separate comparisons and vcond_masks. I think that makes more sense on targets like AArch64 and AArch32 in which compares and selects are fundementally separate operations anyway. gcc/ PR tree-optimization/98560 * gimple-isel.cc (gimple_expand_vec_cond_expr): If we fail to use IFN_VCOND{,U,EQ}, fall back on IFN_VCOND_MASK. gcc/testsuite/ PR tree-optimization/98560 * gcc.dg/vect/pr98560-1.c: New test.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-12-08gimple-isel: Fold x CMP y ? -1 : 0 to x CMP y [PR97872]Prathamesh Kulkarni1-0/+14
gcc/ 2020-12-08 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR target/97872 * gimple-isel.cc (gimple_expand_vec_cond_expr): Try to fold x CMP y ? -1 : 0 to x CMP y. gcc/testsuite/ 2020-12-08 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR target/97872 * gcc.target/arm/pr97872.c: New test.
2020-11-30gimple ISEL: fix BB stmt iterationMartin Liska1-0/+2
gcc/ChangeLog: PR tree-optimization/98066 * gimple-isel.cc (gimple_expand_vec_exprs): Return when gimple_expand_vec_exprs replaces last stmt.
2020-11-26tree-optimization/98015 - fix VEC_COND_EXPR lowering conditionRichard Biener1-3/+3
This fixes the condition to match the comment and only lower VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs. 2020-11-26 Richard Biener <rguenther@suse.de> * gimple-isel.cc (gimple_expand_vec_cond_expr): Only lower VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs.
2020-11-25middle-end/97579 - lower VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRsRichard Biener1-2/+20
This makes sure to lower VECTOR_BOOLEAN_TYPE_P typed non-vector mode VEC_COND_EXPRs so we don't try to use vcond to expand those. That's required for x86 and gcn integer mode boolean vectors. 2020-11-25 Richard Biener <rguenther@suse.de> PR middle-end/97579 * gimple-isel.cc (gimple_expand_vec_cond_expr): Lower VECTOR_BOOLEAN_TYPE_P, non-vector mode VEC_COND_EXPRs. * gcc.dg/pr97579.c: New testcase.
2020-11-11vect: Allow vconds between different vector sizesRichard Sandiford1-3/+2
The vcond code requires the compared vectors and the selected vectors to have both the same size and the same number of elements as each other. But the operation makes logical sense even for different vector sizes. E.g. you could compare two V4SIs and use the result to select between two V4DIs. The underlying optab already allows the compared mode and the selected mode to be specified separately. Since the vectoriser now also supports mixed vector sizes, I think we can simply remove the equal-size check and just keep the equal-lanes check. It's then up to the target to decide which (if any) mixtures of sizes it supports. gcc/ * optabs-tree.c (expand_vec_cond_expr_p): Allow the compared values and the selected values to have different mode sizes. * gimple-isel.cc (gimple_expand_vec_cond_expr): Likewise.
2020-11-03middle-end/97579 - fix VEC_COND_EXPR ISEL optab queryRichard Biener1-2/+3
This fixes a mistake in the optab query done by ISEL. It doesn't fix the PR but shifts the ICE elsewhere. 2020-11-03 Richard Biener <rguenther@suse.de> PR middle-end/97579 * gimple-isel.cc (gimple_expand_vec_cond_expr): Use the correct types for the vcond_mask/vec_cmp optab queries.
2020-09-27IFN: Implement IFN_VEC_SET for ARRAY_REF with VIEW_CONVERT_EXPRXionghu Luo1-2/+73
This patch enables transformation from ARRAY_REF(VIEW_CONVERT_EXPR) to VEC_SET internal function in gimple-isel pass if target supports vec_set with variable index by checking can_vec_set_var_idx_p. gcc/ChangeLog: 2020-09-27 Xionghu Luo <luoxhu@linux.ibm.com> * gimple-isel.cc (gimple_expand_vec_set_expr): New function. (gimple_expand_vec_cond_exprs): Rename to ... (gimple_expand_vec_exprs): ... this and call gimple_expand_vec_set_expr. * internal-fn.c (vec_set_direct): New define. (expand_vec_set_optab_fn): New function. (direct_vec_set_optab_supported_p): New define. * internal-fn.def (VEC_SET): New DEF_INTERNAL_OPTAB_FN. * optabs.c (can_vec_set_var_idx_p): New function. * optabs.h (can_vec_set_var_idx_p): New declaration.
2020-09-23middle-end/96453 - relax gimple_expand_vec_cond_exprRichard Biener1-13/+2
This relaxes the condition under which we also try NE_EXPR for a fake generated compare in addition to LT_EXPR given the fact the verification ICEd when it failed but obviously was only implemented for constants. Thus the patch removes the verification and the restriction to constant operands. 2020-09-23 Richard Biener <rguenther@suse.de> PR middle-end/96453 * gimple-isel.cc (gimple_expand_vec_cond_expr): Remove LT_EXPR -> NE_EXPR verification and also apply it for non-constant masks. * gcc.dg/pr96453.c: New testcase.
2020-06-25VEC_COND_EXPR: clean up first argumentMartin Liska1-2/+10
gcc/ChangeLog: PR tree-optimization/95745 PR middle-end/95830 * gimple-isel.cc (gimple_expand_vec_cond_exprs): Delete dead SSA_NAMEs used as the first argument of a VEC_COND_EXPR. Always return 0. * tree-vect-generic.c (expand_vector_condition): Remove dead SSA_NAMEs used as the first argument of a VEC_COND_EXPR.
2020-06-17Lower VEC_COND_EXPR into internal functions.Martin Liska1-0/+244
gcc/ChangeLog: * Makefile.in: Add new file. * expr.c (expand_expr_real_2): Add gcc_unreachable as we should not meet this condition. (do_store_flag): Likewise. * gimplify.c (gimplify_expr): Gimplify first argument of VEC_COND_EXPR to be a SSA name. * internal-fn.c (vec_cond_mask_direct): New. (vec_cond_direct): Likewise. (vec_condu_direct): Likewise. (vec_condeq_direct): Likewise. (expand_vect_cond_optab_fn): New. (expand_vec_cond_optab_fn): Likewise. (expand_vec_condu_optab_fn): Likewise. (expand_vec_condeq_optab_fn): Likewise. (expand_vect_cond_mask_optab_fn): Likewise. (expand_vec_cond_mask_optab_fn): Likewise. (direct_vec_cond_mask_optab_supported_p): Likewise. (direct_vec_cond_optab_supported_p): Likewise. (direct_vec_condu_optab_supported_p): Likewise. (direct_vec_condeq_optab_supported_p): Likewise. * internal-fn.def (VCOND): New OPTAB. (VCONDU): Likewise. (VCONDEQ): Likewise. (VCOND_MASK): Likewise. * optabs.c (get_rtx_code): Make it global. (expand_vec_cond_mask_expr): Removed. (expand_vec_cond_expr): Removed. * optabs.h (expand_vec_cond_expr): Likewise. (vector_compare_rtx): Make it global. * passes.def: Add new pass_gimple_isel pass. * tree-cfg.c (verify_gimple_assign_ternary): Add check for VEC_COND_EXPR about first argument. * tree-pass.h (make_pass_gimple_isel): New. * tree-ssa-forwprop.c (pass_forwprop::execute): Prevent propagation of the first argument of a VEC_COND_EXPR. * tree-ssa-reassoc.c (ovce_extract_ops): Support SSA_NAME as first argument of a VEC_COND_EXPR. (optimize_vec_cond_expr): Likewise. * tree-vect-generic.c (expand_vector_divmod): Make SSA_NAME for a first argument of created VEC_COND_EXPR. (expand_vector_condition): Fix coding style. * tree-vect-stmts.c (vectorizable_condition): Gimplify first argument. * gimple-isel.cc: New file. gcc/testsuite/ChangeLog: * g++.dg/vect/vec-cond-expr-eh.C: New test.