aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-26 08:36:34 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-26 08:36:34 +0000
commitace85118bfd2d7de1ca08fba675bf64a8364a8ee (patch)
tree3bc05ec44e696d4b536183dd3125f39ef54959b7
parentdbf0eaeb58a1341e5c93032cece72889313c8cb2 (diff)
2017-07-26 Richard Biener <rguenther@suse.de>
Backport from mainline 2017-06-02 Richard Biener <rguenther@suse.de> Markus Eisenmann <meisenmann.lba@fh-salzburg.ac.at> PR libstdc++/80721 * libsupc++/eh_alloc.cc (pool::free): Keep list properly sorted and add missing freelist item merging cases. 2017-06-18 Richard Biener <rguenther@suse.de> PR tree-optimization/81410 * tree-vect-stmts.c (vectorizable_load): Properly adjust for the gap in the ! slp_perm SLP case after each group. * gcc.dg/vect/pr81410.c: New testcase. 2017-07-25 Richard Biener <rguenther@suse.de> PR tree-optimization/81455 * tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to not walk in cycles when looking for guards. * gcc.dg/pr81455.c: New testcase. 2017-07-25 Richard Biener <rguenther@suse.de> PR middle-end/81505 * fold-const.c (fold_negate_const): TREE_OVERFLOW should be sticky. * gcc.dg/ubsan/pr81505.c: New testcase. 2017-07-04 Jakub Jelinek <jakub@redhat.com> PR target/81175 * gcc.target/i386/pr69255-2.c (foo): Use the return value of the gather. 2017-06-28 Jakub Jelinek <jakub@redhat.com> PR target/81175 * config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin rather than def_builtin_pure for __builtin_ia32_gatherpf*. 2017-06-26 Richard Biener <rguenther@suse.de> PR target/81175 * config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin_pure for all gather builtins. * gfortran.dg/pr81175.f: New testcase. 2017-06-21 Marc Glisse <marc.glisse@inria.fr> * config/i386/i386.c (struct builtin_isa): New field pure_p. Reorder for compactness. (def_builtin, def_builtin2, ix86_add_new_builtins): Handle pure_p. (def_builtin_pure, def_builtin_pure2): New functions. (ix86_init_mmx_sse_builtins) [__builtin_ia32_stmxcsr]: Mark as pure. * gcc.dg/tree-ssa/addadd.c: Un-XFAIL. * gcc.dg/tree-ssa/addadd-2.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250560 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog41
-rw-r--r--gcc/config/i386/i386.c357
-rw-r--r--gcc/fold-const.c4
-rw-r--r--gcc/testsuite/ChangeLog34
-rw-r--r--gcc/testsuite/gcc.dg/pr81455.c15
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/pr81505.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr81410.c37
-rw-r--r--gcc/testsuite/gcc.target/i386/getround.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr69255-2.c7
-rw-r--r--gcc/testsuite/gfortran.dg/pr81175.f23
-rw-r--r--gcc/tree-ssa-loop-unswitch.c11
-rw-r--r--gcc/tree-vect-stmts.c32
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/libsupc++/eh_alloc.cc20
14 files changed, 445 insertions, 177 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 75bed5ed678..199ba027f53 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,44 @@
+2017-07-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-06-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/81410
+ * tree-vect-stmts.c (vectorizable_load): Properly adjust for
+ the gap in the ! slp_perm SLP case after each group.
+
+ 2017-07-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/81455
+ * tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to
+ not walk in cycles when looking for guards.
+
+ 2017-07-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81505
+ * fold-const.c (fold_negate_const): TREE_OVERFLOW should be
+ sticky.
+
+ 2017-06-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81175
+ * config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin
+ rather than def_builtin_pure for __builtin_ia32_gatherpf*.
+
+ 2017-06-26 Richard Biener <rguenther@suse.de>
+
+ PR target/81175
+ * config/i386/i386.c (ix86_init_mmx_sse_builtins):
+ Use def_builtin_pure for all gather builtins.
+
+ 2017-06-21 Marc Glisse <marc.glisse@inria.fr>
+
+ * config/i386/i386.c (struct builtin_isa): New field pure_p.
+ Reorder for compactness.
+ (def_builtin, def_builtin2, ix86_add_new_builtins): Handle pure_p.
+ (def_builtin_pure, def_builtin_pure2): New functions.
+ (ix86_init_mmx_sse_builtins) [__builtin_ia32_stmxcsr]: Mark as pure.
+
2017-07-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
Backport from mainline
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index fccbaf91110..697dc914681 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -31075,11 +31075,12 @@ static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX];
but are waiting to be built until a function is declared to use that
ISA. */
struct builtin_isa {
- const char *name; /* function name */
- enum ix86_builtin_func_type tcode; /* type to use in the declaration */
HOST_WIDE_INT isa; /* isa_flags this builtin is defined for */
HOST_WIDE_INT isa2; /* additional isa_flags this builtin is defined for */
- bool const_p; /* true if the declaration is constant */
+ const char *name; /* function name */
+ enum ix86_builtin_func_type tcode; /* type to use in the declaration */
+ unsigned char const_p:1; /* true if the declaration is constant */
+ unsigned char pure_p:1; /* true if the declaration has pure attribute */
bool leaf_p; /* true if the declaration has leaf attribute */
bool nothrow_p; /* true if the declaration has nothrow attribute */
bool set_and_not_built_p;
@@ -31150,6 +31151,7 @@ def_builtin (HOST_WIDE_INT mask, const char *name,
ix86_builtins_isa[(int) code].leaf_p = false;
ix86_builtins_isa[(int) code].nothrow_p = false;
ix86_builtins_isa[(int) code].const_p = false;
+ ix86_builtins_isa[(int) code].pure_p = false;
ix86_builtins_isa[(int) code].set_and_not_built_p = true;
}
}
@@ -31172,6 +31174,21 @@ def_builtin_const (HOST_WIDE_INT mask, const char *name,
return decl;
}
+/* Like def_builtin, but also marks the function decl "pure". */
+
+static inline tree
+def_builtin_pure (HOST_WIDE_INT mask, const char *name,
+ enum ix86_builtin_func_type tcode, enum ix86_builtins code)
+{
+ tree decl = def_builtin (mask, name, tcode, code);
+ if (decl)
+ DECL_PURE_P (decl) = 1;
+ else
+ ix86_builtins_isa[(int) code].pure_p = true;
+
+ return decl;
+}
+
/* Like def_builtin, but for additional isa2 flags. */
static inline tree
@@ -31206,6 +31223,7 @@ def_builtin2 (HOST_WIDE_INT mask, const char *name,
ix86_builtins_isa[(int) code].leaf_p = false;
ix86_builtins_isa[(int) code].nothrow_p = false;
ix86_builtins_isa[(int) code].const_p = false;
+ ix86_builtins_isa[(int) code].pure_p = false;
ix86_builtins_isa[(int) code].set_and_not_built_p = true;
}
@@ -31227,6 +31245,21 @@ def_builtin_const2 (HOST_WIDE_INT mask, const char *name,
return decl;
}
+/* Like def_builtin, but also marks the function decl "pure". */
+
+static inline tree
+def_builtin_pure2 (HOST_WIDE_INT mask, const char *name,
+ enum ix86_builtin_func_type tcode, enum ix86_builtins code)
+{
+ tree decl = def_builtin2 (mask, name, tcode, code);
+ if (decl)
+ DECL_PURE_P (decl) = 1;
+ else
+ ix86_builtins_isa[(int) code].pure_p = true;
+
+ return decl;
+}
+
/* Add any new builtin functions for a given ISA that may not have been
declared. This saves a bit of space compared to adding all of the
declarations to the tree, even if we didn't use them. */
@@ -31265,6 +31298,8 @@ ix86_add_new_builtins (HOST_WIDE_INT isa, HOST_WIDE_INT isa2)
ix86_builtins[i] = decl;
if (ix86_builtins_isa[i].const_p)
TREE_READONLY (decl) = 1;
+ if (ix86_builtins_isa[i].pure_p)
+ DECL_PURE_P (decl) = 1;
if (ix86_builtins_isa[i].leaf_p)
DECL_ATTRIBUTES (decl) = build_tree_list (get_identifier ("leaf"),
NULL_TREE);
@@ -31618,8 +31653,8 @@ ix86_init_mmx_sse_builtins (void)
/* SSE */
def_builtin (OPTION_MASK_ISA_SSE, "__builtin_ia32_ldmxcsr",
VOID_FTYPE_UNSIGNED, IX86_BUILTIN_LDMXCSR);
- def_builtin (OPTION_MASK_ISA_SSE, "__builtin_ia32_stmxcsr",
- UNSIGNED_FTYPE_VOID, IX86_BUILTIN_STMXCSR);
+ def_builtin_pure (OPTION_MASK_ISA_SSE, "__builtin_ia32_stmxcsr",
+ UNSIGNED_FTYPE_VOID, IX86_BUILTIN_STMXCSR);
/* SSE or 3DNow!A */
def_builtin (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A,
@@ -31669,134 +31704,134 @@ ix86_init_mmx_sse_builtins (void)
IX86_BUILTIN_RDRAND64_STEP);
/* AVX2 */
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv2df",
- V2DF_FTYPE_V2DF_PCDOUBLE_V4SI_V2DF_INT,
- IX86_BUILTIN_GATHERSIV2DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv2df",
+ V2DF_FTYPE_V2DF_PCDOUBLE_V4SI_V2DF_INT,
+ IX86_BUILTIN_GATHERSIV2DF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4df",
- V4DF_FTYPE_V4DF_PCDOUBLE_V4SI_V4DF_INT,
- IX86_BUILTIN_GATHERSIV4DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4df",
+ V4DF_FTYPE_V4DF_PCDOUBLE_V4SI_V4DF_INT,
+ IX86_BUILTIN_GATHERSIV4DF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv2df",
- V2DF_FTYPE_V2DF_PCDOUBLE_V2DI_V2DF_INT,
- IX86_BUILTIN_GATHERDIV2DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv2df",
+ V2DF_FTYPE_V2DF_PCDOUBLE_V2DI_V2DF_INT,
+ IX86_BUILTIN_GATHERDIV2DF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4df",
- V4DF_FTYPE_V4DF_PCDOUBLE_V4DI_V4DF_INT,
- IX86_BUILTIN_GATHERDIV4DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4df",
+ V4DF_FTYPE_V4DF_PCDOUBLE_V4DI_V4DF_INT,
+ IX86_BUILTIN_GATHERDIV4DF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4sf",
- V4SF_FTYPE_V4SF_PCFLOAT_V4SI_V4SF_INT,
- IX86_BUILTIN_GATHERSIV4SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4sf",
+ V4SF_FTYPE_V4SF_PCFLOAT_V4SI_V4SF_INT,
+ IX86_BUILTIN_GATHERSIV4SF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv8sf",
- V8SF_FTYPE_V8SF_PCFLOAT_V8SI_V8SF_INT,
- IX86_BUILTIN_GATHERSIV8SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv8sf",
+ V8SF_FTYPE_V8SF_PCFLOAT_V8SI_V8SF_INT,
+ IX86_BUILTIN_GATHERSIV8SF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4sf",
- V4SF_FTYPE_V4SF_PCFLOAT_V2DI_V4SF_INT,
- IX86_BUILTIN_GATHERDIV4SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4sf",
+ V4SF_FTYPE_V4SF_PCFLOAT_V2DI_V4SF_INT,
+ IX86_BUILTIN_GATHERDIV4SF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4sf256",
- V4SF_FTYPE_V4SF_PCFLOAT_V4DI_V4SF_INT,
- IX86_BUILTIN_GATHERDIV8SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4sf256",
+ V4SF_FTYPE_V4SF_PCFLOAT_V4DI_V4SF_INT,
+ IX86_BUILTIN_GATHERDIV8SF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv2di",
- V2DI_FTYPE_V2DI_PCINT64_V4SI_V2DI_INT,
- IX86_BUILTIN_GATHERSIV2DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv2di",
+ V2DI_FTYPE_V2DI_PCINT64_V4SI_V2DI_INT,
+ IX86_BUILTIN_GATHERSIV2DI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4di",
- V4DI_FTYPE_V4DI_PCINT64_V4SI_V4DI_INT,
- IX86_BUILTIN_GATHERSIV4DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4di",
+ V4DI_FTYPE_V4DI_PCINT64_V4SI_V4DI_INT,
+ IX86_BUILTIN_GATHERSIV4DI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv2di",
- V2DI_FTYPE_V2DI_PCINT64_V2DI_V2DI_INT,
- IX86_BUILTIN_GATHERDIV2DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv2di",
+ V2DI_FTYPE_V2DI_PCINT64_V2DI_V2DI_INT,
+ IX86_BUILTIN_GATHERDIV2DI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4di",
- V4DI_FTYPE_V4DI_PCINT64_V4DI_V4DI_INT,
- IX86_BUILTIN_GATHERDIV4DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4di",
+ V4DI_FTYPE_V4DI_PCINT64_V4DI_V4DI_INT,
+ IX86_BUILTIN_GATHERDIV4DI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4si",
- V4SI_FTYPE_V4SI_PCINT_V4SI_V4SI_INT,
- IX86_BUILTIN_GATHERSIV4SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv4si",
+ V4SI_FTYPE_V4SI_PCINT_V4SI_V4SI_INT,
+ IX86_BUILTIN_GATHERSIV4SI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv8si",
- V8SI_FTYPE_V8SI_PCINT_V8SI_V8SI_INT,
- IX86_BUILTIN_GATHERSIV8SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gathersiv8si",
+ V8SI_FTYPE_V8SI_PCINT_V8SI_V8SI_INT,
+ IX86_BUILTIN_GATHERSIV8SI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4si",
- V4SI_FTYPE_V4SI_PCINT_V2DI_V4SI_INT,
- IX86_BUILTIN_GATHERDIV4SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4si",
+ V4SI_FTYPE_V4SI_PCINT_V2DI_V4SI_INT,
+ IX86_BUILTIN_GATHERDIV4SI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4si256",
- V4SI_FTYPE_V4SI_PCINT_V4DI_V4SI_INT,
- IX86_BUILTIN_GATHERDIV8SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatherdiv4si256",
+ V4SI_FTYPE_V4SI_PCINT_V4DI_V4SI_INT,
+ IX86_BUILTIN_GATHERDIV8SI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltsiv4df ",
- V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_V4DF_INT,
- IX86_BUILTIN_GATHERALTSIV4DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltsiv4df ",
+ V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_V4DF_INT,
+ IX86_BUILTIN_GATHERALTSIV4DF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4sf256 ",
- V8SF_FTYPE_V8SF_PCFLOAT_V4DI_V8SF_INT,
- IX86_BUILTIN_GATHERALTDIV8SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4sf256 ",
+ V8SF_FTYPE_V8SF_PCFLOAT_V4DI_V8SF_INT,
+ IX86_BUILTIN_GATHERALTDIV8SF);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltsiv4di ",
- V4DI_FTYPE_V4DI_PCINT64_V8SI_V4DI_INT,
- IX86_BUILTIN_GATHERALTSIV4DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltsiv4di ",
+ V4DI_FTYPE_V4DI_PCINT64_V8SI_V4DI_INT,
+ IX86_BUILTIN_GATHERALTSIV4DI);
- def_builtin (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4si256 ",
- V8SI_FTYPE_V8SI_PCINT_V4DI_V8SI_INT,
- IX86_BUILTIN_GATHERALTDIV8SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX2, "__builtin_ia32_gatheraltdiv4si256 ",
+ V8SI_FTYPE_V8SI_PCINT_V4DI_V8SI_INT,
+ IX86_BUILTIN_GATHERALTDIV8SI);
/* AVX512F */
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv16sf",
- V16SF_FTYPE_V16SF_PCVOID_V16SI_HI_INT,
- IX86_BUILTIN_GATHER3SIV16SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv16sf",
+ V16SF_FTYPE_V16SF_PCVOID_V16SI_HI_INT,
+ IX86_BUILTIN_GATHER3SIV16SF);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv8df",
- V8DF_FTYPE_V8DF_PCVOID_V8SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV8DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv8df",
+ V8DF_FTYPE_V8DF_PCVOID_V8SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV8DF);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv16sf",
- V8SF_FTYPE_V8SF_PCVOID_V8DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV16SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv16sf",
+ V8SF_FTYPE_V8SF_PCVOID_V8DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV16SF);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv8df",
- V8DF_FTYPE_V8DF_PCVOID_V8DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV8DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv8df",
+ V8DF_FTYPE_V8DF_PCVOID_V8DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV8DF);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv16si",
- V16SI_FTYPE_V16SI_PCVOID_V16SI_HI_INT,
- IX86_BUILTIN_GATHER3SIV16SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv16si",
+ V16SI_FTYPE_V16SI_PCVOID_V16SI_HI_INT,
+ IX86_BUILTIN_GATHER3SIV16SI);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv8di",
- V8DI_FTYPE_V8DI_PCVOID_V8SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV8DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv8di",
+ V8DI_FTYPE_V8DI_PCVOID_V8SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV8DI);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv16si",
- V8SI_FTYPE_V8SI_PCVOID_V8DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV16SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv16si",
+ V8SI_FTYPE_V8SI_PCVOID_V8DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV16SI);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv8di",
- V8DI_FTYPE_V8DI_PCVOID_V8DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV8DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv8di",
+ V8DI_FTYPE_V8DI_PCVOID_V8DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV8DI);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltsiv8df ",
- V8DF_FTYPE_V8DF_PCDOUBLE_V16SI_QI_INT,
- IX86_BUILTIN_GATHER3ALTSIV8DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltsiv8df ",
+ V8DF_FTYPE_V8DF_PCDOUBLE_V16SI_QI_INT,
+ IX86_BUILTIN_GATHER3ALTSIV8DF);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltdiv8sf ",
- V16SF_FTYPE_V16SF_PCFLOAT_V8DI_HI_INT,
- IX86_BUILTIN_GATHER3ALTDIV16SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltdiv8sf ",
+ V16SF_FTYPE_V16SF_PCFLOAT_V8DI_HI_INT,
+ IX86_BUILTIN_GATHER3ALTDIV16SF);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltsiv8di ",
- V8DI_FTYPE_V8DI_PCINT64_V16SI_QI_INT,
- IX86_BUILTIN_GATHER3ALTSIV8DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltsiv8di ",
+ V8DI_FTYPE_V8DI_PCINT64_V16SI_QI_INT,
+ IX86_BUILTIN_GATHER3ALTSIV8DI);
- def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltdiv8si ",
- V16SI_FTYPE_V16SI_PCINT_V8DI_HI_INT,
- IX86_BUILTIN_GATHER3ALTDIV16SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltdiv8si ",
+ V16SI_FTYPE_V16SI_PCINT_V8DI_HI_INT,
+ IX86_BUILTIN_GATHER3ALTDIV16SI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scattersiv16sf",
VOID_FTYPE_PVOID_HI_V16SI_V16SF_INT,
@@ -31831,85 +31866,85 @@ ix86_init_mmx_sse_builtins (void)
IX86_BUILTIN_SCATTERDIV8DI);
/* AVX512VL */
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv2df",
- V2DF_FTYPE_V2DF_PCVOID_V4SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV2DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv2df",
+ V2DF_FTYPE_V2DF_PCVOID_V4SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV2DF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4df",
- V4DF_FTYPE_V4DF_PCVOID_V4SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV4DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4df",
+ V4DF_FTYPE_V4DF_PCVOID_V4SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV4DF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div2df",
- V2DF_FTYPE_V2DF_PCVOID_V2DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV2DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div2df",
+ V2DF_FTYPE_V2DF_PCVOID_V2DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV2DF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4df",
- V4DF_FTYPE_V4DF_PCVOID_V4DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV4DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4df",
+ V4DF_FTYPE_V4DF_PCVOID_V4DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV4DF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4sf",
- V4SF_FTYPE_V4SF_PCVOID_V4SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV4SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4sf",
+ V4SF_FTYPE_V4SF_PCVOID_V4SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV4SF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv8sf",
- V8SF_FTYPE_V8SF_PCVOID_V8SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV8SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv8sf",
+ V8SF_FTYPE_V8SF_PCVOID_V8SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV8SF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4sf",
- V4SF_FTYPE_V4SF_PCVOID_V2DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV4SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4sf",
+ V4SF_FTYPE_V4SF_PCVOID_V2DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV4SF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div8sf",
- V4SF_FTYPE_V4SF_PCVOID_V4DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV8SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div8sf",
+ V4SF_FTYPE_V4SF_PCVOID_V4DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV8SF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv2di",
- V2DI_FTYPE_V2DI_PCVOID_V4SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV2DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv2di",
+ V2DI_FTYPE_V2DI_PCVOID_V4SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV2DI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4di",
- V4DI_FTYPE_V4DI_PCVOID_V4SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV4DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4di",
+ V4DI_FTYPE_V4DI_PCVOID_V4SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV4DI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div2di",
- V2DI_FTYPE_V2DI_PCVOID_V2DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV2DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div2di",
+ V2DI_FTYPE_V2DI_PCVOID_V2DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV2DI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4di",
- V4DI_FTYPE_V4DI_PCVOID_V4DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV4DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4di",
+ V4DI_FTYPE_V4DI_PCVOID_V4DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV4DI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4si",
- V4SI_FTYPE_V4SI_PCVOID_V4SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV4SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4si",
+ V4SI_FTYPE_V4SI_PCVOID_V4SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV4SI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv8si",
- V8SI_FTYPE_V8SI_PCVOID_V8SI_QI_INT,
- IX86_BUILTIN_GATHER3SIV8SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv8si",
+ V8SI_FTYPE_V8SI_PCVOID_V8SI_QI_INT,
+ IX86_BUILTIN_GATHER3SIV8SI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4si",
- V4SI_FTYPE_V4SI_PCVOID_V2DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV4SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4si",
+ V4SI_FTYPE_V4SI_PCVOID_V2DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV4SI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div8si",
- V4SI_FTYPE_V4SI_PCVOID_V4DI_QI_INT,
- IX86_BUILTIN_GATHER3DIV8SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div8si",
+ V4SI_FTYPE_V4SI_PCVOID_V4DI_QI_INT,
+ IX86_BUILTIN_GATHER3DIV8SI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altsiv4df ",
- V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_QI_INT,
- IX86_BUILTIN_GATHER3ALTSIV4DF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altsiv4df ",
+ V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_QI_INT,
+ IX86_BUILTIN_GATHER3ALTSIV4DF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altdiv8sf ",
- V8SF_FTYPE_V8SF_PCFLOAT_V4DI_QI_INT,
- IX86_BUILTIN_GATHER3ALTDIV8SF);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altdiv8sf ",
+ V8SF_FTYPE_V8SF_PCFLOAT_V4DI_QI_INT,
+ IX86_BUILTIN_GATHER3ALTDIV8SF);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altsiv4di ",
- V4DI_FTYPE_V4DI_PCINT64_V8SI_QI_INT,
- IX86_BUILTIN_GATHER3ALTSIV4DI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altsiv4di ",
+ V4DI_FTYPE_V4DI_PCINT64_V8SI_QI_INT,
+ IX86_BUILTIN_GATHER3ALTSIV4DI);
- def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altdiv8si ",
- V8SI_FTYPE_V8SI_PCINT_V4DI_QI_INT,
- IX86_BUILTIN_GATHER3ALTDIV8SI);
+ def_builtin_pure (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altdiv8si ",
+ V8SI_FTYPE_V8SI_PCINT_V4DI_QI_INT,
+ IX86_BUILTIN_GATHER3ALTDIV8SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv8sf",
VOID_FTYPE_PVOID_QI_V8SI_V8SF_INT,
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8f082519654..7010cced4f5 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13727,8 +13727,8 @@ fold_negate_const (tree arg0, tree type)
bool overflow;
wide_int val = wi::neg (arg0, &overflow);
t = force_fit_type (type, val, 1,
- (overflow | TREE_OVERFLOW (arg0))
- && !TYPE_UNSIGNED (type));
+ (overflow && ! TYPE_UNSIGNED (type))
+ || TREE_OVERFLOW (arg0));
break;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6d1608bfe3d..dc16086dc0b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,37 @@
+2017-07-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-06-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/81410
+ * gcc.dg/vect/pr81410.c: New testcase.
+
+ 2017-07-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/81455
+ * gcc.dg/pr81455.c: New testcase.
+
+ 2017-07-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81505
+ * gcc.dg/ubsan/pr81505.c: New testcase.
+
+ 2017-07-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81175
+ * gcc.target/i386/pr69255-2.c (foo): Use the return value of the
+ gather.
+
+ 2017-06-26 Richard Biener <rguenther@suse.de>
+
+ PR target/81175
+ * gfortran.dg/pr81175.f: New testcase.
+
+ 2017-06-21 Marc Glisse <marc.glisse@inria.fr>
+
+ * gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
+ * gcc.dg/tree-ssa/addadd-2.c: New file.
+
2016-07-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/pr81455.c b/gcc/testsuite/gcc.dg/pr81455.c
new file mode 100644
index 00000000000..8ab88639ee8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81455.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -funswitch-loops" } */
+
+void
+jh (unsigned int aw, int sn)
+{
+ int xs;
+
+ for (xs = 0; xs < 1; ++xs)
+ aw &= 1;
+
+ while (aw < 1 || ++sn < 1)
+ {
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81505.c b/gcc/testsuite/gcc.dg/ubsan/pr81505.c
new file mode 100644
index 00000000000..1cebef56172
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr81505.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fsanitize=signed-integer-overflow" } */
+
+int a, b, c, h;
+
+int i[5][5];
+
+void
+fn1 ()
+{
+ int l = 0;
+
+ for (a = 0; a <= 3; a++)
+ for (b = 1; b >= 0; b -= 1)
+ l |= i[0][b];
+ c = l;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr81410.c b/gcc/testsuite/gcc.dg/vect/pr81410.c
new file mode 100644
index 00000000000..8d1bd6c8efd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr81410.c
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vect_long_long } */
+
+#include "tree-vect.h"
+
+long long x[24];
+long long y[16];
+long long z[8];
+
+void __attribute__((noinline)) foo()
+{
+ for (int i = 0; i < 8; ++i)
+ {
+ y[2*i] = x[3*i];
+ y[2*i + 1] = x[3*i + 1];
+ z[i] = 1;
+ }
+}
+
+int main()
+{
+ check_vect ();
+
+ for (int i = 0; i < 24; ++i)
+ {
+ x[i] = i;
+ __asm__ volatile ("" : : : "memory");
+ }
+ foo ();
+ for (int i = 0; i < 8; ++i)
+ if (y[2*i] != 3*i || y[2*i+1] != 3*i + 1)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/i386/getround.c b/gcc/testsuite/gcc.target/i386/getround.c
new file mode 100644
index 00000000000..e9d43b074aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/getround.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -msse" } */
+
+#include <xmmintrin.h>
+
+unsigned save;
+
+void f(unsigned mode){
+ unsigned tmp = _MM_GET_ROUNDING_MODE();
+ _MM_SET_ROUNDING_MODE(mode);
+ save = tmp;
+}
+
+/* { dg-final { scan-assembler-times "stmxcsr" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr69255-2.c b/gcc/testsuite/gcc.target/i386/pr69255-2.c
index 9ef6c2f4d9e..e80f3874714 100644
--- a/gcc/testsuite/gcc.target/i386/pr69255-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr69255-2.c
@@ -12,8 +12,9 @@ __attribute__ ((__vector_size__ (16))) int b;
void
foo (const long long *p)
{
- __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */
+ volatile __attribute__ ((__vector_size__ (32))) long long c;
+ c = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */
}
-/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 15 } */
-/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 15 } */
+/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 16 } */
+/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 16 } */
diff --git a/gcc/testsuite/gfortran.dg/pr81175.f b/gcc/testsuite/gfortran.dg/pr81175.f
new file mode 100644
index 00000000000..130ba9c1632
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr81175.f
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-Ofast -fwrapv" }
+! { dg-additional-options "-march=broadwell" { target x86_64-*-* i?86-*-* } }
+ SUBROUTINE ECPDRA(IC4C,FP,FQ,G)
+ IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+ DIMENSION FP(*),FQ(*),G(*)
+ DIMENSION CKLU(23,12,12)
+!
+ DO 240 I=IAMIN,IAMAX
+ DO 240 J=JAMIN,MMAX
+ DO 230 K=1,NPNP
+ DO 230 L=1,K
+ DO 230 MU=1,2*L-1
+ CKLTEM= CKLU(MU,L,K)
+ IF(IC4C.LE.0) THEN
+ IF(ABS(CKLTEM).GT.TOL) SUM= SUM+FP(N)*CKLTEM
+ ELSE
+ IF(ABS(CKLTEM).GT.TOL) SUM= SUM+FQ(N)*CKLTEM
+ END IF
+ 230 N= N+1
+ G(NN)= G(NN)+DUMJ*SUM
+ 240 NN= NN+1
+ END
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 1845148666d..9b2aa238f02 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -580,8 +580,9 @@ find_loop_guard (struct loop *loop)
gcond *cond;
do
{
+ basic_block next = NULL;
if (single_succ_p (header))
- header = single_succ (header);
+ next = single_succ (header);
else
{
cond = dyn_cast <gcond *> (last_stmt (header));
@@ -591,12 +592,16 @@ find_loop_guard (struct loop *loop)
/* Make sure to skip earlier hoisted guards that are left
in place as if (true). */
if (gimple_cond_true_p (cond))
- header = te->dest;
+ next = te->dest;
else if (gimple_cond_false_p (cond))
- header = fe->dest;
+ next = fe->dest;
else
break;
}
+ /* Never traverse a backedge. */
+ if (header->loop_father->header == next)
+ return NULL;
+ header = next;
}
while (1);
if (!flow_bb_inside_loop_p (loop, te->dest)
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index bfb7185f5e0..50f11de7bbe 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -7109,6 +7109,7 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
{
first_stmt = GROUP_FIRST_ELEMENT (stmt_info);
group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt));
+ int group_gap = GROUP_GAP (vinfo_for_stmt (first_stmt));
/* For SLP vectorization we directly vectorize a subchain
without permutation. */
if (slp && ! SLP_TREE_LOAD_PERMUTATION (slp_node).exists ())
@@ -7144,10 +7145,15 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
not only the number of vector stmts the permutation result
fits in. */
if (slp_perm)
- vec_num = (group_size * vf + nunits - 1) / nunits;
+ {
+ vec_num = (group_size * vf + nunits - 1) / nunits;
+ group_gap_adj = vf * group_size - nunits * vec_num;
+ }
else
- vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
- group_gap_adj = vf * group_size - nunits * vec_num;
+ {
+ vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+ group_gap_adj = group_gap;
+ }
}
else
vec_num = group_size;
@@ -7308,6 +7314,7 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
aggr_type = vectype;
prev_stmt_info = NULL;
+ int group_elt = 0;
for (j = 0; j < ncopies; j++)
{
/* 1. Create the vector or array pointer update chain. */
@@ -7599,10 +7606,27 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
/* Store vector loads in the corresponding SLP_NODE. */
if (slp && !slp_perm)
SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt);
+
+ /* With SLP permutation we load the gaps as well, without
+ we need to skip the gaps after we manage to fully load
+ all elements. group_gap_adj is GROUP_SIZE here. */
+ group_elt += nunits;
+ if (group_gap_adj != 0 && ! slp_perm
+ && group_elt == group_size - group_gap_adj)
+ {
+ bool ovf;
+ tree bump
+ = wide_int_to_tree (sizetype,
+ wi::smul (TYPE_SIZE_UNIT (elem_type),
+ group_gap_adj, &ovf));
+ dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi,
+ stmt, bump);
+ group_elt = 0;
+ }
}
/* Bump the vector pointer to account for a gap or for excess
elements loaded for a permuted SLP load. */
- if (group_gap_adj != 0)
+ if (group_gap_adj != 0 && slp_perm)
{
bool ovf;
tree bump
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 14bd43db839..fcf5c695579 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2017-07-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-06-02 Richard Biener <rguenther@suse.de>
+ Markus Eisenmann <meisenmann.lba@fh-salzburg.ac.at>
+
+ PR libstdc++/80721
+ * libsupc++/eh_alloc.cc (pool::free): Keep list properly
+ sorted and add missing freelist item merging cases.
+
2017-07-25 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index d03cbcef9b0..664daf38f8b 100644
--- a/libstdc++-v3/libsupc++/eh_alloc.cc
+++ b/libstdc++-v3/libsupc++/eh_alloc.cc
@@ -194,13 +194,17 @@ namespace
allocated_entry *e = reinterpret_cast <allocated_entry *>
(reinterpret_cast <char *> (data) - offsetof (allocated_entry, data));
std::size_t sz = e->size;
- if (!first_free_entry)
+ if (!first_free_entry
+ || (reinterpret_cast <char *> (e) + sz
+ < reinterpret_cast <char *> (first_free_entry)))
{
- // If the free list is empty just put the entry there.
+ // If the free list is empty or the entry is before the
+ // first element and cannot be merged with it add it as
+ // the first free entry.
free_entry *f = reinterpret_cast <free_entry *> (e);
new (f) free_entry;
f->size = sz;
- f->next = NULL;
+ f->next = first_free_entry;
first_free_entry = f;
}
else if (reinterpret_cast <char *> (e) + sz
@@ -224,9 +228,17 @@ namespace
> reinterpret_cast <char *> (e) + sz);
fe = &(*fe)->next)
;
+ // If we can merge the next block into us do so and continue
+ // with the cases below.
+ if (reinterpret_cast <char *> (e) + sz
+ == reinterpret_cast <char *> ((*fe)->next))
+ {
+ sz += (*fe)->next->size;
+ (*fe)->next = (*fe)->next->next;
+ }
if (reinterpret_cast <char *> (*fe) + (*fe)->size
== reinterpret_cast <char *> (e))
- /* Merge with the freelist entry. */
+ // Merge with the freelist entry.
(*fe)->size += sz;
else
{