aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-02 12:38:04 +0100
committerRichard Biener <rguenther@suse.de>2020-11-02 15:58:14 +0100
commite881774d0dda6d5127eb8f0642f6edc16dc0b1e7 (patch)
tree246429551c79f231c1b41f6cf035e478fdc00452 /gcc/tree.c
parent86deadf8d3ac55b3cd07e15d4e83e3b6ccd9ee81 (diff)
downloadgcc-e881774d0dda6d5127eb8f0642f6edc16dc0b1e7.zip
gcc-e881774d0dda6d5127eb8f0642f6edc16dc0b1e7.tar.gz
gcc-e881774d0dda6d5127eb8f0642f6edc16dc0b1e7.tar.bz2
Rewrite SLP induction vectorization
This rewrites SLP induction vectorization to handle different inductions in the different SLP lanes. It also changes SLP build to represent the initial value (but not the cycle) so it can be enhanced to handle outer loop vectorization later. Note this FAILs gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c because it removes one CSE optimization that no longer works with non-uniform initial value and step. I'll see to recover from this after outer loop vectorization of inductions works. It might be a bit friendlier to variable-size vectors now but then we're now building the step vector from scalars ... 2020-11-02 Richard Biener <rguenther@suse.de> * tree.h (build_real_from_wide): Declare. * tree.c (build_real_from_wide): New function. * tree-vect-slp.c (vect_build_slp_tree_2): Remove restriction on induction vectorization, represent the initial value. * tree-vect-loop.c (vect_model_induction_cost): Inline ... (vectorizable_induction): ... here. Rewrite SLP code generation. * gcc.dg/vect/slp-49.c: New testcase.
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 81f867d..739c288 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2250,6 +2250,22 @@ build_real_from_int_cst (tree type, const_tree i)
return v;
}
+/* Return a new REAL_CST node whose type is TYPE
+ and whose value is the integer value I which has sign SGN. */
+
+tree
+build_real_from_wide (tree type, const wide_int_ref &i, signop sgn)
+{
+ REAL_VALUE_TYPE d;
+
+ /* Clear all bits of the real value type so that we can later do
+ bitwise comparisons to see if two values are the same. */
+ memset (&d, 0, sizeof d);
+
+ real_from_integer (&d, TYPE_MODE (type), i, sgn);
+ return build_real (type, d);
+}
+
/* Return a newly constructed STRING_CST node whose value is the LEN
characters at STR when STR is nonnull, or all zeros otherwise.
Note that for a C string literal, LEN should include the trailing NUL.