11debfc3dSmrg /* Preamble and helpers for the autogenerated generic-match.c file.
28feb0f0bSmrg Copyright (C) 2014-2020 Free Software Foundation, Inc.
31debfc3dSmrg
41debfc3dSmrg This file is part of GCC.
51debfc3dSmrg
61debfc3dSmrg GCC is free software; you can redistribute it and/or modify it under
71debfc3dSmrg the terms of the GNU General Public License as published by the Free
81debfc3dSmrg Software Foundation; either version 3, or (at your option) any later
91debfc3dSmrg version.
101debfc3dSmrg
111debfc3dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
121debfc3dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
131debfc3dSmrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
141debfc3dSmrg for more details.
151debfc3dSmrg
161debfc3dSmrg You should have received a copy of the GNU General Public License
171debfc3dSmrg along with GCC; see the file COPYING3. If not see
181debfc3dSmrg <http://www.gnu.org/licenses/>. */
191debfc3dSmrg
201debfc3dSmrg #include "config.h"
211debfc3dSmrg #include "system.h"
221debfc3dSmrg #include "coretypes.h"
231debfc3dSmrg #include "backend.h"
241debfc3dSmrg #include "target.h"
251debfc3dSmrg #include "rtl.h"
261debfc3dSmrg #include "tree.h"
271debfc3dSmrg #include "gimple.h"
281debfc3dSmrg #include "ssa.h"
291debfc3dSmrg #include "cgraph.h"
308feb0f0bSmrg #include "vec-perm-indices.h"
311debfc3dSmrg #include "fold-const.h"
32c0a68be4Smrg #include "fold-const-call.h"
331debfc3dSmrg #include "stor-layout.h"
341debfc3dSmrg #include "tree-dfa.h"
351debfc3dSmrg #include "builtins.h"
361debfc3dSmrg #include "case-cfn-macros.h"
371debfc3dSmrg #include "gimplify.h"
38a2dc1f3fSmrg #include "optabs-tree.h"
398feb0f0bSmrg #include "dbgcnt.h"
40*23f5f463Smrg #include "tm.h"
41*23f5f463Smrg #include "tree-pass.h"
421debfc3dSmrg
431debfc3dSmrg /* Routine to determine if the types T1 and T2 are effectively
441debfc3dSmrg the same for GENERIC. If T1 or T2 is not a type, the test
451debfc3dSmrg applies to their TREE_TYPE. */
461debfc3dSmrg
471debfc3dSmrg static inline bool
types_match(tree t1,tree t2)481debfc3dSmrg types_match (tree t1, tree t2)
491debfc3dSmrg {
501debfc3dSmrg if (!TYPE_P (t1))
511debfc3dSmrg t1 = TREE_TYPE (t1);
521debfc3dSmrg if (!TYPE_P (t2))
531debfc3dSmrg t2 = TREE_TYPE (t2);
541debfc3dSmrg
551debfc3dSmrg return TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2);
561debfc3dSmrg }
571debfc3dSmrg
581debfc3dSmrg /* Return if T has a single use. For GENERIC, we assume this is
591debfc3dSmrg always true. */
601debfc3dSmrg
611debfc3dSmrg static inline bool
single_use(tree t ATTRIBUTE_UNUSED)621debfc3dSmrg single_use (tree t ATTRIBUTE_UNUSED)
631debfc3dSmrg {
641debfc3dSmrg return true;
651debfc3dSmrg }
661debfc3dSmrg
671debfc3dSmrg /* Return true if math operations should be canonicalized,
681debfc3dSmrg e.g. sqrt(sqrt(x)) -> pow(x, 0.25). */
691debfc3dSmrg
701debfc3dSmrg static inline bool
canonicalize_math_p()711debfc3dSmrg canonicalize_math_p ()
721debfc3dSmrg {
73*23f5f463Smrg return !cfun || (cfun->curr_properties & PROP_gimple_opt_math) == 0;
741debfc3dSmrg }
75a2dc1f3fSmrg
76a2dc1f3fSmrg /* Return true if math operations that are beneficial only after
77a2dc1f3fSmrg vectorization should be canonicalized. */
78a2dc1f3fSmrg
79a2dc1f3fSmrg static inline bool
canonicalize_math_after_vectorization_p()80a2dc1f3fSmrg canonicalize_math_after_vectorization_p ()
81a2dc1f3fSmrg {
82a2dc1f3fSmrg return false;
83a2dc1f3fSmrg }
84c0a68be4Smrg
85c0a68be4Smrg /* Return true if successive divisions can be optimized.
86c0a68be4Smrg Defer to GIMPLE opts. */
87c0a68be4Smrg
88c0a68be4Smrg static inline bool
optimize_successive_divisions_p(tree,tree)89c0a68be4Smrg optimize_successive_divisions_p (tree, tree)
90c0a68be4Smrg {
91c0a68be4Smrg return false;
92c0a68be4Smrg }
93