5.0.0-0.19
This commit is contained in:
parent
0bc6460875
commit
7fcf30a7ea
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@
|
||||
/gcc-5.0.0-20150217.tar.bz2
|
||||
/gcc-5.0.0-20150224.tar.bz2
|
||||
/gcc-5.0.0-20150226.tar.bz2
|
||||
/gcc-5.0.0-20150313.tar.bz2
|
||||
|
57
gcc.spec
57
gcc.spec
@ -1,9 +1,9 @@
|
||||
%global DATE 20150226
|
||||
%global SVNREV 221028
|
||||
%global DATE 20150313
|
||||
%global SVNREV 221424
|
||||
%global gcc_version 5.0.0
|
||||
# Note, gcc_release must be integer, if you want to add suffixes to
|
||||
# %{release}, append them after %{gcc_release} on Release: line.
|
||||
%global gcc_release 0.18
|
||||
%global gcc_release 0.19
|
||||
%global _unpackaged_files_terminate_build 0
|
||||
%global _performance_build 1
|
||||
%global multilib_64_archs sparc64 ppc64 ppc64p7 s390x x86_64
|
||||
@ -198,15 +198,9 @@ Patch11: gcc5-no-add-needed.patch
|
||||
Patch12: gcc5-libgo-p224.patch
|
||||
Patch13: gcc5-aarch64-async-unw-tables.patch
|
||||
Patch14: gcc5-libsanitize-aarch64-va42.patch
|
||||
Patch15: gcc5-arm-fnsect.patch
|
||||
Patch16: gcc5-pr65215.patch
|
||||
Patch17: gcc5-pr65216.patch
|
||||
Patch18: gcc5-pr64367.patch
|
||||
Patch19: gcc5-pr65032.patch
|
||||
Patch20: gcc5-pr65040.patch
|
||||
Patch21: gcc5-pr65048-test.patch
|
||||
Patch22: gcc5-pr65220.patch
|
||||
Patch23: gcc5-pr65228.patch
|
||||
Patch15: gcc5-pr65369.patch
|
||||
Patch16: gcc5-pr65401.patch
|
||||
Patch17: gcc5-pr65418.patch
|
||||
|
||||
# On ARM EABI systems, we do want -gnueabi to be part of the
|
||||
# target triple.
|
||||
@ -756,15 +750,9 @@ package or when debugging this package.
|
||||
rm -f libgo/go/crypto/elliptic/p224{,_test}.go
|
||||
%patch13 -p0 -b .aarch64-async-unw-tables~
|
||||
%patch14 -p0 -b .libsanitize-aarch64-va42~
|
||||
%patch15 -p0 -b .arm-fnsect~
|
||||
%patch16 -p0 -b .pr65215~
|
||||
%patch17 -p0 -b .pr65216~
|
||||
%patch18 -p0 -b .pr64367~
|
||||
%patch19 -p0 -b .pr65032~
|
||||
%patch20 -p0 -b .pr65040~
|
||||
%patch21 -p0 -b .pr65048-test~
|
||||
%patch22 -p0 -b .pr65220~
|
||||
%patch23 -p0 -b .pr65228~
|
||||
%patch15 -p0 -b .pr65369~
|
||||
%patch16 -p0 -b .pr65401~
|
||||
%patch17 -p0 -b .pr65418~
|
||||
|
||||
%if 0%{?_enable_debug_packages}
|
||||
mkdir dwz-wrapper
|
||||
@ -2950,6 +2938,33 @@ fi
|
||||
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
||||
|
||||
%changelog
|
||||
* Fri Mar 13 2015 Jakub Jelinek <jakub@redhat.com> 5.0.0-0.19
|
||||
- update from the trunk
|
||||
- PRs ada/65259, ada/65319, bootstrap/25672, bootstrap/65150, c++/64227,
|
||||
c++/64398, c++/64665, c++/64834, c++/65127, c++/65295, c++/65323,
|
||||
c++/65333, c++/65339, c++/65370, c/35330, c/65120, fortran/60898,
|
||||
fortran/65024, ipa/64693, ipa/64988, ipa/65130, ipa/65232, ipa/65236,
|
||||
ipa/65237, ipa/65245, ipa/65263, ipa/65270, ipa/65282, ipa/65287,
|
||||
ipa/65302, ipa/65316, ipa/65318, ipa/65334, libfortran/65200,
|
||||
libgcc/64885, libstdc++/64367, libstdc++/64441, libstdc++/64797,
|
||||
libstdc++/65246, libstdc++/65279, lto/65193, lto/65276, lto/65316,
|
||||
lto/65361, middle-end/44563, middle-end/63155, middle-end/63175,
|
||||
middle-end/64928, middle-end/65233, middle-end/65270,
|
||||
middle-end/65315, other/65384, rtl-optimization/64895,
|
||||
rtl-optimization/65067, rtl-optimization/65235,
|
||||
rtl-optimization/65321, sanitizer/63958, sanitizer/65280,
|
||||
sanitizer/65367, target/58158, target/59828, target/62247,
|
||||
target/62251, target/64317, target/64331, target/64342, target/64600,
|
||||
target/65038, target/65044, target/65103, target/65121, target/65138,
|
||||
target/65183, target/65184, target/65192, target/65242, target/65249,
|
||||
target/65261, target/65286, target/65296, target/65368,
|
||||
tree-optimization/63743, tree-optimization/65241,
|
||||
tree-optimization/65310, tree-optimization/65355,
|
||||
tree-optimization/65388
|
||||
- fix vectorization of unaligned loads on powerpc (PR tree-optimization/65369)
|
||||
- fix combiner on big-endian targets (PR rtl-optimization/65401)
|
||||
- fix reassoc bit test optimization (PR tree-optimization/65418)
|
||||
|
||||
* Fri Feb 27 2015 Jakub Jelinek <jakub@redhat.com> 5.0.0-0.18
|
||||
- fix compilation of stdexcept with clang (PR libstdc++-v3/64367)
|
||||
- fix scratch handling in LRA rematerialization (PR target/65032)
|
||||
|
@ -1,25 +0,0 @@
|
||||
2015-02-19 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* config/arm/arm.c (arm_function_in_section_p): Delete bogus
|
||||
TREE_STATIC check, use decl_binds_to_current_def_p instead of
|
||||
targetm.binds_local_p.
|
||||
|
||||
--- gcc/config/arm/arm.c
|
||||
+++ gcc/config/arm/arm.c
|
||||
@@ -6392,14 +6392,8 @@ arm_set_default_type_attributes (tree type)
|
||||
static bool
|
||||
arm_function_in_section_p (tree decl, section *section)
|
||||
{
|
||||
- /* We can only be certain about functions defined in the same
|
||||
- compilation unit. */
|
||||
- if (!TREE_STATIC (decl))
|
||||
- return false;
|
||||
-
|
||||
- /* Make sure that SYMBOL always binds to the definition in this
|
||||
- compilation unit. */
|
||||
- if (!targetm.binds_local_p (decl))
|
||||
+ /* We can only be certain about the prevailing symbol definition. */
|
||||
+ if (!decl_binds_to_current_def_p (decl))
|
||||
return false;
|
||||
|
||||
/* If DECL_SECTION_NAME is set, assume it is trustworthy. */
|
@ -1,17 +0,0 @@
|
||||
2015-02-26 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++-v3/64367
|
||||
* include/std/stdexcept (std::__sso_string::_M_bytes): Use
|
||||
sizeof(__str) instead of sizeof(_M_s).
|
||||
|
||||
--- libstdc++-v3/include/std/stdexcept
|
||||
+++ libstdc++-v3/include/std/stdexcept
|
||||
@@ -80,7 +80,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
union {
|
||||
__str _M_s;
|
||||
- char _M_bytes[sizeof(_M_s)];
|
||||
+ char _M_bytes[sizeof(__str)];
|
||||
};
|
||||
|
||||
__sso_string() _GLIBCXX_USE_NOEXCEPT;
|
@ -1,203 +0,0 @@
|
||||
2015-02-27 Vladimir Makarov <vmakarov@redhat.com>
|
||||
|
||||
PR target/65032
|
||||
* lra-remat.c (update_scratch_ops): New.
|
||||
(do_remat): Call it.
|
||||
* lra.c (lra_register_new_scratch_op): New. Take code from ...
|
||||
(remove_scratches): ... here.
|
||||
* lra-int.h (lra_register_new_scratch_op): New prototype.
|
||||
|
||||
* g++.dg/pr65032.C: New.
|
||||
|
||||
--- gcc/lra-int.h (revision 221061)
|
||||
+++ gcc/lra-int.h (revision 221062)
|
||||
@@ -321,6 +321,7 @@ extern void lra_create_copy (int, int, i
|
||||
extern lra_copy_t lra_get_copy (int);
|
||||
extern bool lra_former_scratch_p (int);
|
||||
extern bool lra_former_scratch_operand_p (rtx_insn *, int);
|
||||
+extern void lra_register_new_scratch_op (rtx_insn *, int);
|
||||
|
||||
extern int lra_new_regno_start;
|
||||
extern int lra_constraint_new_regno_start;
|
||||
--- gcc/lra.c (revision 221061)
|
||||
+++ gcc/lra.c (revision 221062)
|
||||
@@ -1907,6 +1907,24 @@ lra_former_scratch_operand_p (rtx_insn *
|
||||
INSN_UID (insn) * MAX_RECOG_OPERANDS + nop) != 0;
|
||||
}
|
||||
|
||||
+/* Register operand NOP in INSN as a former scratch. It will be
|
||||
+ changed to scratch back, if it is necessary, at the LRA end. */
|
||||
+void
|
||||
+lra_register_new_scratch_op (rtx_insn *insn, int nop)
|
||||
+{
|
||||
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
|
||||
+ rtx op = *id->operand_loc[nop];
|
||||
+ sloc_t loc = XNEW (struct sloc);
|
||||
+ lra_assert (REG_P (op));
|
||||
+ loc->insn = insn;
|
||||
+ loc->nop = nop;
|
||||
+ scratches.safe_push (loc);
|
||||
+ bitmap_set_bit (&scratch_bitmap, REGNO (op));
|
||||
+ bitmap_set_bit (&scratch_operand_bitmap,
|
||||
+ INSN_UID (insn) * MAX_RECOG_OPERANDS + nop);
|
||||
+ add_reg_note (insn, REG_UNUSED, op);
|
||||
+}
|
||||
+
|
||||
/* Change scratches onto pseudos and save their location. */
|
||||
static void
|
||||
remove_scratches (void)
|
||||
@@ -1916,7 +1934,6 @@ remove_scratches (void)
|
||||
basic_block bb;
|
||||
rtx_insn *insn;
|
||||
rtx reg;
|
||||
- sloc_t loc;
|
||||
lra_insn_recog_data_t id;
|
||||
struct lra_static_insn_data *static_id;
|
||||
|
||||
@@ -1938,15 +1955,7 @@ remove_scratches (void)
|
||||
*id->operand_loc[i] = reg
|
||||
= lra_create_new_reg (static_id->operand[i].mode,
|
||||
*id->operand_loc[i], ALL_REGS, NULL);
|
||||
- add_reg_note (insn, REG_UNUSED, reg);
|
||||
- lra_update_dup (id, i);
|
||||
- loc = XNEW (struct sloc);
|
||||
- loc->insn = insn;
|
||||
- loc->nop = i;
|
||||
- scratches.safe_push (loc);
|
||||
- bitmap_set_bit (&scratch_bitmap, REGNO (*id->operand_loc[i]));
|
||||
- bitmap_set_bit (&scratch_operand_bitmap,
|
||||
- INSN_UID (insn) * MAX_RECOG_OPERANDS + i);
|
||||
+ lra_register_new_scratch_op (insn, i);
|
||||
if (lra_dump_file != NULL)
|
||||
fprintf (lra_dump_file,
|
||||
"Removing SCRATCH in insn #%u (nop %d)\n",
|
||||
--- gcc/lra-remat.c (revision 221061)
|
||||
+++ gcc/lra-remat.c (revision 221062)
|
||||
@@ -1044,6 +1044,29 @@ get_hard_regs (struct lra_insn_reg *reg,
|
||||
return hard_regno;
|
||||
}
|
||||
|
||||
+/* Make copy of and register scratch pseudos in rematerialized insn
|
||||
+ REMAT_INSN. */
|
||||
+static void
|
||||
+update_scratch_ops (rtx_insn *remat_insn)
|
||||
+{
|
||||
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (remat_insn);
|
||||
+ struct lra_static_insn_data *static_id = id->insn_static_data;
|
||||
+ for (int i = 0; i < static_id->n_operands; i++)
|
||||
+ {
|
||||
+ rtx *loc = id->operand_loc[i];
|
||||
+ if (! REG_P (*loc))
|
||||
+ continue;
|
||||
+ int regno = REGNO (*loc);
|
||||
+ if (! lra_former_scratch_p (regno))
|
||||
+ continue;
|
||||
+ *loc = lra_create_new_reg (GET_MODE (*loc), *loc,
|
||||
+ lra_get_allocno_class (regno),
|
||||
+ "scratch pseudo copy");
|
||||
+ lra_register_new_scratch_op (remat_insn, i);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
/* Insert rematerialization insns using the data-flow data calculated
|
||||
earlier. */
|
||||
static bool
|
||||
@@ -1193,6 +1216,7 @@ do_remat (void)
|
||||
HOST_WIDE_INT sp_offset_change = cand_sp_offset - id->sp_offset;
|
||||
if (sp_offset_change != 0)
|
||||
change_sp_offset (remat_insn, sp_offset_change);
|
||||
+ update_scratch_ops (remat_insn);
|
||||
lra_process_new_insns (insn, remat_insn, NULL,
|
||||
"Inserting rematerialization insn");
|
||||
lra_set_insn_deleted (insn);
|
||||
--- gcc/testsuite/g++.dg/pr65032.C (revision 0)
|
||||
+++ gcc/testsuite/g++.dg/pr65032.C (revision 221062)
|
||||
@@ -0,0 +1,87 @@
|
||||
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
|
||||
+// { dg-options "-Os -std=c++11 -fPIC -fstack-protector-strong -fomit-frame-pointer" }
|
||||
+
|
||||
+#pragma GCC visibility push(hidden)
|
||||
+#pragma GCC visibility push(default)
|
||||
+extern "C" {
|
||||
+ typedef int int64_t __attribute__ ((__mode__ (__DI__)));
|
||||
+}
|
||||
+enum class nsresult;
|
||||
+#pragma GCC visibility pop
|
||||
+class A
|
||||
+{
|
||||
+ float mRawPtr;
|
||||
+
|
||||
+ public:
|
||||
+ A (float *);
|
||||
+};
|
||||
+class B
|
||||
+{
|
||||
+ public:
|
||||
+ B (int64_t, int, int);
|
||||
+};
|
||||
+typedef struct
|
||||
+{
|
||||
+ int channels;
|
||||
+} vorbis_info;
|
||||
+template <typename _Key> class C
|
||||
+{
|
||||
+ public:
|
||||
+ typedef int size_type;
|
||||
+ size_type erase (_Key &);
|
||||
+};
|
||||
+
|
||||
+template <typename _Key> class D
|
||||
+{
|
||||
+ public:
|
||||
+ typedef _Key key_type;
|
||||
+ typedef C<key_type> _Rep_type;
|
||||
+ _Rep_type _M_t;
|
||||
+ typename _Rep_type::size_type
|
||||
+ erase (key_type p1)
|
||||
+ {
|
||||
+ return _M_t.erase (p1);
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+class F
|
||||
+{
|
||||
+ public:
|
||||
+ vorbis_info mInfo;
|
||||
+ D<int *> mVorbisPacketSamples;
|
||||
+ void ValidateVorbisPacketSamples (int *);
|
||||
+ int64_t Time (int64_t);
|
||||
+};
|
||||
+class G
|
||||
+{
|
||||
+ nsresult DecodeVorbis (int *);
|
||||
+ F *mVorbisState;
|
||||
+ int64_t mDecodedAudioFrames;
|
||||
+};
|
||||
+int fn1 (float ***);
|
||||
+void fn2 (int);
|
||||
+void
|
||||
+F::ValidateVorbisPacketSamples (int *p1)
|
||||
+{
|
||||
+ mVorbisPacketSamples.erase (p1);
|
||||
+}
|
||||
+
|
||||
+nsresult
|
||||
+G::DecodeVorbis (int *p1)
|
||||
+{
|
||||
+ float **a;
|
||||
+ int b;
|
||||
+ long long c;
|
||||
+ while ((b = fn1 (&a)))
|
||||
+ {
|
||||
+ mVorbisState->ValidateVorbisPacketSamples (p1);
|
||||
+ A (new float);
|
||||
+ for (; mVorbisState->mInfo.channels;)
|
||||
+ {
|
||||
+ }
|
||||
+ int64_t d = mVorbisState->Time (c - b);
|
||||
+ (B (d, b, mVorbisState->mInfo.channels));
|
||||
+ mDecodedAudioFrames -= b;
|
||||
+ fn2 (b);
|
||||
+ }
|
||||
+}
|
@ -1,43 +0,0 @@
|
||||
2015-02-27 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/65040
|
||||
* doc/invoke.texi: Update to reflect that -Wformat=2 doesn't enable
|
||||
-Wformat-signedness anymore.
|
||||
c-family/
|
||||
* c.opt (Wformat-signedness): Don't enable by -Wformat=2.
|
||||
testsuite/
|
||||
* gcc.dg/pr65066.c: Use -Wformat -Wformat-signedness and not
|
||||
-Wformat=2.
|
||||
|
||||
--- gcc/doc/invoke.texi (revision 221060)
|
||||
+++ gcc/doc/invoke.texi (revision 221061)
|
||||
@@ -3631,7 +3631,7 @@ The C standard specifies that zero-lengt
|
||||
@opindex Wformat=2
|
||||
Enable @option{-Wformat} plus additional format checks. Currently
|
||||
equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
|
||||
--Wformat-signedness -Wformat-y2k}.
|
||||
+-Wformat-y2k}.
|
||||
|
||||
@item -Wformat-nonliteral
|
||||
@opindex Wformat-nonliteral
|
||||
--- gcc/c-family/c.opt (revision 221060)
|
||||
+++ gcc/c-family/c.opt (revision 221061)
|
||||
@@ -456,7 +456,7 @@ C ObjC C++ ObjC++ Var(warn_format_securi
|
||||
Warn about possible security problems with format functions
|
||||
|
||||
Wformat-signedness
|
||||
-C ObjC C++ ObjC++ Var(warn_format_signedness) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
|
||||
+C ObjC C++ ObjC++ Var(warn_format_signedness) Warning
|
||||
Warn about sign differences with format functions
|
||||
|
||||
Wformat-y2k
|
||||
--- gcc/testsuite/gcc.dg/pr65066.c (revision 221060)
|
||||
+++ gcc/testsuite/gcc.dg/pr65066.c (revision 221061)
|
||||
@@ -1,6 +1,6 @@
|
||||
/* PR c/65066 */
|
||||
/* { dg-do compile } */
|
||||
-/* { dg-options "-Wformat=2" } */
|
||||
+/* { dg-options "-Wformat -Wformat-signedness" } */
|
||||
|
||||
extern int sscanf (const char *restrict, const char *restrict, ...);
|
||||
int *a;
|
@ -1,24 +0,0 @@
|
||||
2015-02-27 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/65048
|
||||
* gcc.dg/tree-ssa/ssa-dom-thread-9.c: Add -std=gnu89 to dg-options.
|
||||
(foo): Use K&R style definition.
|
||||
|
||||
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-9.c (revision 221062)
|
||||
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-9.c (revision 221063)
|
||||
@@ -1,12 +1,13 @@
|
||||
/* PR 65048 */
|
||||
/* { dg-do compile } */
|
||||
-/* { dg-options "-O3" } */
|
||||
+/* { dg-options "-O3 -std=gnu89" } */
|
||||
|
||||
int a, b, c, d;
|
||||
void fn (void);
|
||||
|
||||
int
|
||||
-foo (int x)
|
||||
+foo (x)
|
||||
+ int x;
|
||||
{
|
||||
switch (x)
|
||||
{
|
@ -1,314 +0,0 @@
|
||||
2015-02-26 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/65215
|
||||
* tree-ssa-math-opts.c (find_bswap_or_nop_load): Return false
|
||||
for PDP endian targets.
|
||||
(perform_symbolic_merge, find_bswap_or_nop_1, find_bswap_or_nop):
|
||||
Fix up formatting issues.
|
||||
(bswap_replace): Likewise. For BYTES_BIG_ENDIAN, if the final access
|
||||
size is smaller than the original, adjust MEM_REF offset by the
|
||||
difference of sizes. Use is_gimple_mem_ref_addr instead of
|
||||
is_gimple_min_invariant test to avoid adding address temporaries.
|
||||
|
||||
* gcc.c-torture/execute/pr65215-1.c: New test.
|
||||
* gcc.c-torture/execute/pr65215-2.c: New test.
|
||||
* gcc.c-torture/execute/pr65215-3.c: New test.
|
||||
* gcc.c-torture/execute/pr65215-4.c: New test.
|
||||
* gcc.c-torture/execute/pr65215-5.c: New test.
|
||||
|
||||
--- gcc/tree-ssa-math-opts.c.jj 2015-01-28 21:24:56.000000000 +0100
|
||||
+++ gcc/tree-ssa-math-opts.c 2015-02-26 11:16:01.062024749 +0100
|
||||
@@ -1780,6 +1780,10 @@ find_bswap_or_nop_load (gimple stmt, tre
|
||||
int unsignedp, volatilep;
|
||||
tree offset, base_addr;
|
||||
|
||||
+ /* Not prepared to handle PDP endian. */
|
||||
+ if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN)
|
||||
+ return false;
|
||||
+
|
||||
if (!gimple_assign_load_p (stmt) || gimple_has_volatile_ops (stmt))
|
||||
return false;
|
||||
|
||||
@@ -1860,8 +1864,8 @@ perform_symbolic_merge (gimple source_st
|
||||
|| !operand_equal_p (n1->base_addr, n2->base_addr, 0))
|
||||
return NULL;
|
||||
|
||||
- if (!n1->offset != !n2->offset ||
|
||||
- (n1->offset && !operand_equal_p (n1->offset, n2->offset, 0)))
|
||||
+ if (!n1->offset != !n2->offset
|
||||
+ || (n1->offset && !operand_equal_p (n1->offset, n2->offset, 0)))
|
||||
return NULL;
|
||||
|
||||
if (n1->bytepos < n2->bytepos)
|
||||
@@ -1912,8 +1916,8 @@ perform_symbolic_merge (gimple source_st
|
||||
size = TYPE_PRECISION (n1->type) / BITS_PER_UNIT;
|
||||
for (i = 0; i < size; i++, inc <<= BITS_PER_MARKER)
|
||||
{
|
||||
- unsigned marker =
|
||||
- (toinc_n_ptr->n >> (i * BITS_PER_MARKER)) & MARKER_MASK;
|
||||
+ unsigned marker
|
||||
+ = (toinc_n_ptr->n >> (i * BITS_PER_MARKER)) & MARKER_MASK;
|
||||
if (marker && marker != MARKER_BYTE_UNKNOWN)
|
||||
toinc_n_ptr->n += inc;
|
||||
}
|
||||
@@ -2032,7 +2036,7 @@ find_bswap_or_nop_1 (gimple stmt, struct
|
||||
case RSHIFT_EXPR:
|
||||
case LROTATE_EXPR:
|
||||
case RROTATE_EXPR:
|
||||
- if (!do_shift_rotate (code, n, (int)TREE_INT_CST_LOW (rhs2)))
|
||||
+ if (!do_shift_rotate (code, n, (int) TREE_INT_CST_LOW (rhs2)))
|
||||
return NULL;
|
||||
break;
|
||||
CASE_CONVERT:
|
||||
@@ -2104,12 +2108,12 @@ find_bswap_or_nop_1 (gimple stmt, struct
|
||||
if (TYPE_PRECISION (n1.type) != TYPE_PRECISION (n2.type))
|
||||
return NULL;
|
||||
|
||||
- if (!n1.vuse != !n2.vuse ||
|
||||
- (n1.vuse && !operand_equal_p (n1.vuse, n2.vuse, 0)))
|
||||
+ if (!n1.vuse != !n2.vuse
|
||||
+ || (n1.vuse && !operand_equal_p (n1.vuse, n2.vuse, 0)))
|
||||
return NULL;
|
||||
|
||||
- source_stmt =
|
||||
- perform_symbolic_merge (source_stmt1, &n1, source_stmt2, &n2, n);
|
||||
+ source_stmt
|
||||
+ = perform_symbolic_merge (source_stmt1, &n1, source_stmt2, &n2, n);
|
||||
|
||||
if (!source_stmt)
|
||||
return NULL;
|
||||
@@ -2153,12 +2157,12 @@ find_bswap_or_nop (gimple stmt, struct s
|
||||
in libgcc, and for initial shift/and operation of the src operand. */
|
||||
limit = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (gimple_expr_type (stmt)));
|
||||
limit += 1 + (int) ceil_log2 ((unsigned HOST_WIDE_INT) limit);
|
||||
- source_stmt = find_bswap_or_nop_1 (stmt, n, limit);
|
||||
+ source_stmt = find_bswap_or_nop_1 (stmt, n, limit);
|
||||
|
||||
if (!source_stmt)
|
||||
return NULL;
|
||||
|
||||
- /* Find real size of result (highest non zero byte). */
|
||||
+ /* Find real size of result (highest non-zero byte). */
|
||||
if (n->base_addr)
|
||||
{
|
||||
int rsize;
|
||||
@@ -2261,8 +2265,30 @@ bswap_replace (gimple cur_stmt, gimple s
|
||||
tree load_offset_ptr, aligned_load_type;
|
||||
gimple addr_stmt, load_stmt;
|
||||
unsigned align;
|
||||
+ HOST_WIDE_INT load_offset = 0;
|
||||
|
||||
align = get_object_alignment (src);
|
||||
+ /* If the new access is smaller than the original one, we need
|
||||
+ to perform big endian adjustment. */
|
||||
+ if (BYTES_BIG_ENDIAN)
|
||||
+ {
|
||||
+ HOST_WIDE_INT bitsize, bitpos;
|
||||
+ machine_mode mode;
|
||||
+ int unsignedp, volatilep;
|
||||
+ tree offset;
|
||||
+
|
||||
+ get_inner_reference (src, &bitsize, &bitpos, &offset, &mode,
|
||||
+ &unsignedp, &volatilep, false);
|
||||
+ if (n->range < (unsigned HOST_WIDE_INT) bitsize)
|
||||
+ {
|
||||
+ load_offset = (bitsize - n->range) / BITS_PER_UNIT;
|
||||
+ unsigned HOST_WIDE_INT l
|
||||
+ = (load_offset * BITS_PER_UNIT) & (align - 1);
|
||||
+ if (l)
|
||||
+ align = l & -l;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (bswap
|
||||
&& align < GET_MODE_ALIGNMENT (TYPE_MODE (load_type))
|
||||
&& SLOW_UNALIGNED_ACCESS (TYPE_MODE (load_type), align))
|
||||
@@ -2274,10 +2300,10 @@ bswap_replace (gimple cur_stmt, gimple s
|
||||
gsi_move_before (&gsi, &gsi_ins);
|
||||
gsi = gsi_for_stmt (cur_stmt);
|
||||
|
||||
- /* Compute address to load from and cast according to the size
|
||||
- of the load. */
|
||||
+ /* Compute address to load from and cast according to the size
|
||||
+ of the load. */
|
||||
addr_expr = build_fold_addr_expr (unshare_expr (src));
|
||||
- if (is_gimple_min_invariant (addr_expr))
|
||||
+ if (is_gimple_mem_ref_addr (addr_expr))
|
||||
addr_tmp = addr_expr;
|
||||
else
|
||||
{
|
||||
@@ -2291,7 +2317,7 @@ bswap_replace (gimple cur_stmt, gimple s
|
||||
aligned_load_type = load_type;
|
||||
if (align < TYPE_ALIGN (load_type))
|
||||
aligned_load_type = build_aligned_type (load_type, align);
|
||||
- load_offset_ptr = build_int_cst (n->alias_set, 0);
|
||||
+ load_offset_ptr = build_int_cst (n->alias_set, load_offset);
|
||||
val_expr = fold_build2 (MEM_REF, aligned_load_type, addr_tmp,
|
||||
load_offset_ptr);
|
||||
|
||||
@@ -2328,7 +2354,7 @@ bswap_replace (gimple cur_stmt, gimple s
|
||||
{
|
||||
fprintf (dump_file,
|
||||
"%d bit load in target endianness found at: ",
|
||||
- (int)n->range);
|
||||
+ (int) n->range);
|
||||
print_gimple_stmt (dump_file, cur_stmt, 0, 0);
|
||||
}
|
||||
return true;
|
||||
@@ -2395,7 +2421,7 @@ bswap_replace (gimple cur_stmt, gimple s
|
||||
if (dump_file)
|
||||
{
|
||||
fprintf (dump_file, "%d bit bswap implementation found at: ",
|
||||
- (int)n->range);
|
||||
+ (int) n->range);
|
||||
print_gimple_stmt (dump_file, cur_stmt, 0, 0);
|
||||
}
|
||||
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65215-1.c.jj 2015-02-26 10:46:29.102441519 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65215-1.c 2015-02-26 10:44:39.000000000 +0100
|
||||
@@ -0,0 +1,24 @@
|
||||
+/* PR tree-optimization/65215 */
|
||||
+
|
||||
+static inline unsigned int
|
||||
+foo (unsigned int x)
|
||||
+{
|
||||
+ return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
|
||||
+}
|
||||
+
|
||||
+__attribute__((noinline, noclone)) unsigned int
|
||||
+bar (unsigned long long *x)
|
||||
+{
|
||||
+ return foo (*x);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
|
||||
+ return 0;
|
||||
+ unsigned long long l = foo (0xdeadbeefU) | 0xfeedbea800000000ULL;
|
||||
+ if (bar (&l) != 0xdeadbeefU)
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65215-2.c.jj 2015-02-26 10:46:31.524401403 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65215-2.c 2015-02-26 10:45:15.000000000 +0100
|
||||
@@ -0,0 +1,24 @@
|
||||
+/* PR tree-optimization/65215 */
|
||||
+
|
||||
+static inline unsigned int
|
||||
+foo (unsigned int x)
|
||||
+{
|
||||
+ return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
|
||||
+}
|
||||
+
|
||||
+__attribute__((noinline, noclone)) unsigned long long
|
||||
+bar (unsigned long long *x)
|
||||
+{
|
||||
+ return ((unsigned long long) foo (*x) << 32) | foo (*x >> 32);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
|
||||
+ return 0;
|
||||
+ unsigned long long l = foo (0xfeedbea8U) | ((unsigned long long) foo (0xdeadbeefU) << 32);
|
||||
+ if (bar (&l) != 0xfeedbea8deadbeefULL)
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65215-3.c.jj 2015-02-26 10:46:33.463369288 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65215-3.c 2015-02-26 10:45:37.000000000 +0100
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* PR tree-optimization/65215 */
|
||||
+
|
||||
+struct S { unsigned long long l1 : 24, l2 : 8, l3 : 32; };
|
||||
+
|
||||
+static inline unsigned int
|
||||
+foo (unsigned int x)
|
||||
+{
|
||||
+ return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
|
||||
+}
|
||||
+
|
||||
+__attribute__((noinline, noclone)) unsigned long long
|
||||
+bar (struct S *x)
|
||||
+{
|
||||
+ unsigned long long x1 = foo (((unsigned int) x->l1 << 8) | x->l2);
|
||||
+ unsigned long long x2 = foo (x->l3);
|
||||
+ return (x2 << 32) | x1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
|
||||
+ return 0;
|
||||
+ struct S s = { 0xdeadbeU, 0xefU, 0xfeedbea8U };
|
||||
+ unsigned long long l = bar (&s);
|
||||
+ if (foo (l >> 32) != s.l3
|
||||
+ || (foo (l) >> 8) != s.l1
|
||||
+ || (foo (l) & 0xff) != s.l2)
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65215-4.c.jj 2015-02-26 10:46:35.438336576 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65215-4.c 2015-02-26 10:45:46.000000000 +0100
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* PR tree-optimization/65215 */
|
||||
+
|
||||
+struct S { unsigned long long l1 : 48; };
|
||||
+
|
||||
+static inline unsigned int
|
||||
+foo (unsigned int x)
|
||||
+{
|
||||
+ return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
|
||||
+}
|
||||
+
|
||||
+__attribute__((noinline, noclone)) unsigned int
|
||||
+bar (struct S *x)
|
||||
+{
|
||||
+ return foo (x->l1);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
|
||||
+ return 0;
|
||||
+ struct S s;
|
||||
+ s.l1 = foo (0xdeadbeefU) | (0xfeedULL << 32);
|
||||
+ if (bar (&s) != 0xdeadbeefU)
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65215-5.c.jj 2015-02-26 11:14:44.664298719 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65215-5.c 2015-02-26 11:12:27.000000000 +0100
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* PR tree-optimization/65215 */
|
||||
+
|
||||
+__attribute__((noinline, noclone)) unsigned int
|
||||
+foo (unsigned char *p)
|
||||
+{
|
||||
+ return ((unsigned int) p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
|
||||
+}
|
||||
+
|
||||
+__attribute__((noinline, noclone)) unsigned int
|
||||
+bar (unsigned char *p)
|
||||
+{
|
||||
+ return ((unsigned int) p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
|
||||
+}
|
||||
+
|
||||
+struct S { unsigned int a; unsigned char b[5]; };
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ struct S s = { 1, { 2, 3, 4, 5, 6 } };
|
||||
+ if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4)
|
||||
+ return 0;
|
||||
+ if (foo (&s.b[1]) != 0x03040506U
|
||||
+ || bar (&s.b[1]) != 0x06050403U)
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
@ -1,56 +0,0 @@
|
||||
2015-02-26 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/65216
|
||||
* tree-ssa-reassoc.c (rewrite_expr_tree): Force creation of
|
||||
new stmt and new SSA_NAME for lhs whenever the arguments have
|
||||
changed and weren't just swapped. Fix comment typo.
|
||||
|
||||
* gcc.c-torture/execute/pr65216.c: New test.
|
||||
|
||||
--- gcc/tree-ssa-reassoc.c.jj 2015-02-14 09:21:56.000000000 +0100
|
||||
+++ gcc/tree-ssa-reassoc.c 2015-02-26 13:03:24.308614169 +0100
|
||||
@@ -3532,7 +3532,7 @@ rewrite_expr_tree (gimple stmt, unsigned
|
||||
|
||||
/* The final recursion case for this function is that you have
|
||||
exactly two operations left.
|
||||
- If we had one exactly one op in the entire list to start with, we
|
||||
+ If we had exactly one op in the entire list to start with, we
|
||||
would have never called this function, and the tail recursion
|
||||
rewrites them one at a time. */
|
||||
if (opindex + 2 == ops.length ())
|
||||
@@ -3553,7 +3553,11 @@ rewrite_expr_tree (gimple stmt, unsigned
|
||||
print_gimple_stmt (dump_file, stmt, 0, 0);
|
||||
}
|
||||
|
||||
- if (changed)
|
||||
+ /* Even when changed is false, reassociation could have e.g. removed
|
||||
+ some redundant operations, so unless we are just swapping the
|
||||
+ arguments or unless there is no change at all (then we just
|
||||
+ return lhs), force creation of a new SSA_NAME. */
|
||||
+ if (changed || ((rhs1 != oe2->op || rhs2 != oe1->op) && opindex))
|
||||
{
|
||||
gimple insert_point = find_insert_point (stmt, oe1->op, oe2->op);
|
||||
lhs = make_ssa_name (TREE_TYPE (lhs));
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65216.c.jj 2015-02-26 13:05:12.199816826 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65216.c 2015-02-26 13:04:53.000000000 +0100
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* PR tree-optimization/65216 */
|
||||
+
|
||||
+int a, b = 62, e;
|
||||
+volatile int c, d;
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ int f = 0;
|
||||
+ for (a = 0; a < 2; a++)
|
||||
+ {
|
||||
+ b &= (8 ^ f) & 1;
|
||||
+ for (e = 0; e < 6; e++)
|
||||
+ if (c)
|
||||
+ f = d;
|
||||
+ }
|
||||
+ if (b != 0)
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
@ -1,64 +0,0 @@
|
||||
2015-02-26 Jakub Jelinek <jakub@redhat.com>
|
||||
Aldy Hernandez <aldyh@redhat.com>
|
||||
|
||||
PR rtl-optimization/65220
|
||||
* config/i386/i386.md (*udivmod<mode>4_pow2): New.
|
||||
|
||||
--- gcc/config/i386/i386.md (revision 221063)
|
||||
+++ gcc/config/i386/i386.md (revision 221064)
|
||||
@@ -7331,6 +7331,32 @@ (define_insn_and_split "*udivmod<mode>4"
|
||||
[(set_attr "type" "multi")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
+;; Optimize division or modulo by constant power of 2, if the constant
|
||||
+;; materializes only after expansion.
|
||||
+(define_insn_and_split "*udivmod<mode>4_pow2"
|
||||
+ [(set (match_operand:SWI48 0 "register_operand" "=r")
|
||||
+ (udiv:SWI48 (match_operand:SWI48 2 "register_operand" "0")
|
||||
+ (match_operand:SWI48 3 "const_int_operand" "n")))
|
||||
+ (set (match_operand:SWI48 1 "register_operand" "=r")
|
||||
+ (umod:SWI48 (match_dup 2) (match_dup 3)))
|
||||
+ (clobber (reg:CC FLAGS_REG))]
|
||||
+ "UINTVAL (operands[3]) - 2 < <MODE_SIZE> * BITS_PER_UNIT
|
||||
+ && (UINTVAL (operands[3]) & (UINTVAL (operands[3]) - 1)) == 0"
|
||||
+ "#"
|
||||
+ "&& reload_completed"
|
||||
+ [(set (match_dup 1) (match_dup 2))
|
||||
+ (parallel [(set (match_dup 0) (lshiftrt:<MODE> (match_dup 2) (match_dup 4)))
|
||||
+ (clobber (reg:CC FLAGS_REG))])
|
||||
+ (parallel [(set (match_dup 1) (and:<MODE> (match_dup 1) (match_dup 5)))
|
||||
+ (clobber (reg:CC FLAGS_REG))])]
|
||||
+{
|
||||
+ int v = exact_log2 (UINTVAL (operands[3]));
|
||||
+ operands[4] = GEN_INT (v);
|
||||
+ operands[5] = GEN_INT ((HOST_WIDE_INT_1U << v) - 1);
|
||||
+}
|
||||
+ [(set_attr "type" "multi")
|
||||
+ (set_attr "mode" "<MODE>")])
|
||||
+
|
||||
(define_insn "*udivmod<mode>4_noext"
|
||||
[(set (match_operand:SWIM248 0 "register_operand" "=a")
|
||||
(udiv:SWIM248 (match_operand:SWIM248 2 "register_operand" "0")
|
||||
--- gcc/testsuite/gcc.target/i386/pr65520.c (revision 0)
|
||||
+++ gcc/testsuite/gcc.target/i386/pr65520.c (revision 221064)
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* PR target/65520 */
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2" } */
|
||||
+
|
||||
+int foo (void *);
|
||||
+
|
||||
+void
|
||||
+bar (void)
|
||||
+{
|
||||
+ unsigned s = 128;
|
||||
+ while (1)
|
||||
+ {
|
||||
+ unsigned b[s];
|
||||
+ if (foo (b))
|
||||
+ break;
|
||||
+ s *= 2;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* { dg-final { scan-assembler-not "div\[^\n\r]*%" } } */
|
@ -1,35 +0,0 @@
|
||||
2015-02-27 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/65228
|
||||
c/
|
||||
* c-decl.c (start_decl): Return NULL_TREE if decl is an error node.
|
||||
testsuite/
|
||||
* gcc.dg/pr65228.c: New test.
|
||||
|
||||
--- gcc/c/c-decl.c (revision 221055)
|
||||
+++ gcc/c/c-decl.c (revision 221056)
|
||||
@@ -4460,8 +4460,8 @@ start_decl (struct c_declarator *declara
|
||||
decl = grokdeclarator (declarator, declspecs,
|
||||
NORMAL, initialized, NULL, &attributes, &expr, NULL,
|
||||
deprecated_state);
|
||||
- if (!decl)
|
||||
- return 0;
|
||||
+ if (!decl || decl == error_mark_node)
|
||||
+ return NULL_TREE;
|
||||
|
||||
if (expr)
|
||||
add_stmt (fold_convert (void_type_node, expr));
|
||||
--- gcc/testsuite/gcc.dg/pr65228.c (revision 0)
|
||||
+++ gcc/testsuite/gcc.dg/pr65228.c (revision 221056)
|
||||
@@ -0,0 +1,11 @@
|
||||
+/* PR c/65228 */
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "" } */
|
||||
+
|
||||
+__auto_type a = b; /* { dg-error "undeclared" } */
|
||||
+
|
||||
+void
|
||||
+f (void)
|
||||
+{
|
||||
+ __auto_type c = d; /* { dg-error "undeclared" } */
|
||||
+}
|
81
gcc5-pr65369.patch
Normal file
81
gcc5-pr65369.patch
Normal file
@ -0,0 +1,81 @@
|
||||
2015-03-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/65369
|
||||
* tree-vect-stmts.c (vectorizable_load) <case dr_explicit_realign>:
|
||||
Set bump to vs * TYPE_SIZE_UNIT (elem_type) - 1 instead of
|
||||
(vs - 1) * TYPE_SIZE_UNIT (elem_type).
|
||||
|
||||
* gcc.c-torture/execute/pr65369.c: New test.
|
||||
|
||||
--- gcc/tree-vect-stmts.c.jj 2015-03-09 08:05:13.000000000 +0100
|
||||
+++ gcc/tree-vect-stmts.c 2015-03-13 17:27:30.613529768 +0100
|
||||
@@ -6468,9 +6468,8 @@ vectorizable_load (gimple stmt, gimple_s
|
||||
case dr_explicit_realign:
|
||||
{
|
||||
tree ptr, bump;
|
||||
- tree vs_minus_1;
|
||||
|
||||
- vs_minus_1 = size_int (TYPE_VECTOR_SUBPARTS (vectype) - 1);
|
||||
+ tree vs = size_int (TYPE_VECTOR_SUBPARTS (vectype));
|
||||
|
||||
if (compute_in_loop)
|
||||
msq = vect_setup_realignment (first_stmt, gsi,
|
||||
@@ -6499,8 +6498,9 @@ vectorizable_load (gimple stmt, gimple_s
|
||||
vect_finish_stmt_generation (stmt, new_stmt, gsi);
|
||||
msq = new_temp;
|
||||
|
||||
- bump = size_binop (MULT_EXPR, vs_minus_1,
|
||||
+ bump = size_binop (MULT_EXPR, vs,
|
||||
TYPE_SIZE_UNIT (elem_type));
|
||||
+ bump = size_binop (MINUS_EXPR, bump, size_one_node);
|
||||
ptr = bump_vector_ptr (dataref_ptr, NULL, gsi, stmt, bump);
|
||||
new_stmt = gimple_build_assign
|
||||
(NULL_TREE, BIT_AND_EXPR, ptr,
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65369.c.jj 2015-03-13 17:37:10.926175685 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65369.c 2015-03-13 17:35:40.000000000 +0100
|
||||
@@ -0,0 +1,45 @@
|
||||
+/* PR tree-optimization/65369 */
|
||||
+
|
||||
+static const char data[] =
|
||||
+ "12345678901234567890123456789012345678901234567890"
|
||||
+ "123456789012345678901234567890";
|
||||
+
|
||||
+__attribute__ ((noinline))
|
||||
+static void foo (const unsigned int *buf)
|
||||
+{
|
||||
+ if (__builtin_memcmp (buf, data, 64))
|
||||
+ __builtin_abort ();
|
||||
+}
|
||||
+
|
||||
+__attribute__ ((noinline))
|
||||
+static void bar (const unsigned char *block)
|
||||
+{
|
||||
+ unsigned int buf[16];
|
||||
+ __builtin_memcpy (buf + 0, block + 0, 4);
|
||||
+ __builtin_memcpy (buf + 1, block + 4, 4);
|
||||
+ __builtin_memcpy (buf + 2, block + 8, 4);
|
||||
+ __builtin_memcpy (buf + 3, block + 12, 4);
|
||||
+ __builtin_memcpy (buf + 4, block + 16, 4);
|
||||
+ __builtin_memcpy (buf + 5, block + 20, 4);
|
||||
+ __builtin_memcpy (buf + 6, block + 24, 4);
|
||||
+ __builtin_memcpy (buf + 7, block + 28, 4);
|
||||
+ __builtin_memcpy (buf + 8, block + 32, 4);
|
||||
+ __builtin_memcpy (buf + 9, block + 36, 4);
|
||||
+ __builtin_memcpy (buf + 10, block + 40, 4);
|
||||
+ __builtin_memcpy (buf + 11, block + 44, 4);
|
||||
+ __builtin_memcpy (buf + 12, block + 48, 4);
|
||||
+ __builtin_memcpy (buf + 13, block + 52, 4);
|
||||
+ __builtin_memcpy (buf + 14, block + 56, 4);
|
||||
+ __builtin_memcpy (buf + 15, block + 60, 4);
|
||||
+ foo (buf);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ unsigned char input[sizeof data + 16] __attribute__((aligned (16)));
|
||||
+ __builtin_memset (input, 0, sizeof input);
|
||||
+ __builtin_memcpy (input + 1, data, sizeof data);
|
||||
+ bar (input + 1);
|
||||
+ return 0;
|
||||
+}
|
151
gcc5-pr65401.patch
Normal file
151
gcc5-pr65401.patch
Normal file
@ -0,0 +1,151 @@
|
||||
2015-03-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/65401
|
||||
* combine.c (rtx_equal_for_field_assignment_p): Add widen_x
|
||||
argument. If true, adjust_address_nv of x with big-endian
|
||||
correction for the mode widening to GET_MODE (y).
|
||||
(make_field_assignment): Don't do MEM mode widening here.
|
||||
Use MEM_P instead of GET_CODE == MEM.
|
||||
|
||||
* gcc.c-torture/execute/pr65401.c: New test.
|
||||
|
||||
--- gcc/combine.c.jj 2015-02-03 10:38:46.000000000 +0100
|
||||
+++ gcc/combine.c 2015-03-13 18:46:45.710940306 +0100
|
||||
@@ -475,7 +475,7 @@ static rtx force_to_mode (rtx, machine_m
|
||||
unsigned HOST_WIDE_INT, int);
|
||||
static rtx if_then_else_cond (rtx, rtx *, rtx *);
|
||||
static rtx known_cond (rtx, enum rtx_code, rtx, rtx);
|
||||
-static int rtx_equal_for_field_assignment_p (rtx, rtx);
|
||||
+static int rtx_equal_for_field_assignment_p (rtx, rtx, bool = false);
|
||||
static rtx make_field_assignment (rtx);
|
||||
static rtx apply_distributive_law (rtx);
|
||||
static rtx distribute_and_simplify_rtx (rtx, int);
|
||||
@@ -9184,8 +9184,23 @@ known_cond (rtx x, enum rtx_code cond, r
|
||||
assignment as a field assignment. */
|
||||
|
||||
static int
|
||||
-rtx_equal_for_field_assignment_p (rtx x, rtx y)
|
||||
+rtx_equal_for_field_assignment_p (rtx x, rtx y, bool widen_x)
|
||||
{
|
||||
+ if (widen_x && GET_MODE (x) != GET_MODE (y))
|
||||
+ {
|
||||
+ if (GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (GET_MODE (y)))
|
||||
+ return 0;
|
||||
+ if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN)
|
||||
+ return 0;
|
||||
+ /* For big endian, adjust the memory offset. */
|
||||
+ if (BYTES_BIG_ENDIAN)
|
||||
+ x = adjust_address_nv (x, GET_MODE (y),
|
||||
+ -subreg_lowpart_offset (GET_MODE (x),
|
||||
+ GET_MODE (y)));
|
||||
+ else
|
||||
+ x = adjust_address_nv (x, GET_MODE (y), 0);
|
||||
+ }
|
||||
+
|
||||
if (x == y || rtx_equal_p (x, y))
|
||||
return 1;
|
||||
|
||||
@@ -9339,16 +9354,15 @@ make_field_assignment (rtx x)
|
||||
/* The second SUBREG that might get in the way is a paradoxical
|
||||
SUBREG around the first operand of the AND. We want to
|
||||
pretend the operand is as wide as the destination here. We
|
||||
- do this by creating a new MEM in the wider mode for the sole
|
||||
+ do this by adjusting the MEM to wider mode for the sole
|
||||
purpose of the call to rtx_equal_for_field_assignment_p. Also
|
||||
note this trick only works for MEMs. */
|
||||
else if (GET_CODE (rhs) == AND
|
||||
&& paradoxical_subreg_p (XEXP (rhs, 0))
|
||||
- && GET_CODE (SUBREG_REG (XEXP (rhs, 0))) == MEM
|
||||
+ && MEM_P (SUBREG_REG (XEXP (rhs, 0)))
|
||||
&& CONST_INT_P (XEXP (rhs, 1))
|
||||
- && rtx_equal_for_field_assignment_p (gen_rtx_MEM (GET_MODE (dest),
|
||||
- XEXP (SUBREG_REG (XEXP (rhs, 0)), 0)),
|
||||
- dest))
|
||||
+ && rtx_equal_for_field_assignment_p (SUBREG_REG (XEXP (rhs, 0)),
|
||||
+ dest, true))
|
||||
c1 = INTVAL (XEXP (rhs, 1)), other = lhs;
|
||||
else if (GET_CODE (lhs) == AND
|
||||
&& CONST_INT_P (XEXP (lhs, 1))
|
||||
@@ -9357,16 +9371,15 @@ make_field_assignment (rtx x)
|
||||
/* The second SUBREG that might get in the way is a paradoxical
|
||||
SUBREG around the first operand of the AND. We want to
|
||||
pretend the operand is as wide as the destination here. We
|
||||
- do this by creating a new MEM in the wider mode for the sole
|
||||
+ do this by adjusting the MEM to wider mode for the sole
|
||||
purpose of the call to rtx_equal_for_field_assignment_p. Also
|
||||
note this trick only works for MEMs. */
|
||||
else if (GET_CODE (lhs) == AND
|
||||
&& paradoxical_subreg_p (XEXP (lhs, 0))
|
||||
- && GET_CODE (SUBREG_REG (XEXP (lhs, 0))) == MEM
|
||||
+ && MEM_P (SUBREG_REG (XEXP (lhs, 0)))
|
||||
&& CONST_INT_P (XEXP (lhs, 1))
|
||||
- && rtx_equal_for_field_assignment_p (gen_rtx_MEM (GET_MODE (dest),
|
||||
- XEXP (SUBREG_REG (XEXP (lhs, 0)), 0)),
|
||||
- dest))
|
||||
+ && rtx_equal_for_field_assignment_p (SUBREG_REG (XEXP (lhs, 0)),
|
||||
+ dest, true))
|
||||
c1 = INTVAL (XEXP (lhs, 1)), other = rhs;
|
||||
else
|
||||
return x;
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65401.c.jj 2015-03-13 18:36:30.639817393 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65401.c 2015-03-13 18:42:02.693485127 +0100
|
||||
@@ -0,0 +1,59 @@
|
||||
+/* PR rtl-optimization/65401 */
|
||||
+
|
||||
+struct S { unsigned short s[64]; };
|
||||
+
|
||||
+__attribute__((noinline, noclone)) void
|
||||
+foo (struct S *x)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ unsigned char *s;
|
||||
+
|
||||
+ s = (unsigned char *) x->s;
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ x->s[i] = s[i * 2] | (s[i * 2 + 1] << 8);
|
||||
+}
|
||||
+
|
||||
+__attribute__((noinline, noclone)) void
|
||||
+bar (struct S *x)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ unsigned char *s;
|
||||
+
|
||||
+ s = (unsigned char *) x->s;
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ x->s[i] = (s[i * 2] << 8) | s[i * 2 + 1];
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ struct S s;
|
||||
+ if (sizeof (unsigned short) != 2)
|
||||
+ return 0;
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ s.s[i] = i + ((64 - i) << 8);
|
||||
+ foo (&s);
|
||||
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ if (s.s[i] != (64 - i) + (i << 8))
|
||||
+ __builtin_abort ();
|
||||
+#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ if (s.s[i] != i + ((64 - i) << 8))
|
||||
+ __builtin_abort ();
|
||||
+#endif
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ s.s[i] = i + ((64 - i) << 8);
|
||||
+ bar (&s);
|
||||
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ if (s.s[i] != (64 - i) + (i << 8))
|
||||
+ __builtin_abort ();
|
||||
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
+ for (i = 0; i < 64; i++)
|
||||
+ if (s.s[i] != i + ((64 - i) << 8))
|
||||
+ __builtin_abort ();
|
||||
+#endif
|
||||
+ return 0;
|
||||
+}
|
89
gcc5-pr65418.patch
Normal file
89
gcc5-pr65418.patch
Normal file
@ -0,0 +1,89 @@
|
||||
2015-03-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/65418
|
||||
* tree-ssa-reassoc.c (extract_bit_test_mask): If there
|
||||
are casts in the first PLUS_EXPR operand, ensure tbias and
|
||||
*totallowp are in the inner type.
|
||||
|
||||
* gcc.c-torture/execute/pr65418-1.c: New test.
|
||||
* gcc.c-torture/execute/pr65418-2.c: New test.
|
||||
|
||||
--- gcc/tree-ssa-reassoc.c.jj 2015-02-26 22:02:39.000000000 +0100
|
||||
+++ gcc/tree-ssa-reassoc.c 2015-03-13 16:22:50.506295252 +0100
|
||||
@@ -2439,26 +2439,25 @@ extract_bit_test_mask (tree exp, int pre
|
||||
&& TREE_CODE (exp) == PLUS_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
|
||||
{
|
||||
+ tree ret = TREE_OPERAND (exp, 0);
|
||||
+ STRIP_NOPS (ret);
|
||||
widest_int bias
|
||||
= wi::neg (wi::sext (wi::to_widest (TREE_OPERAND (exp, 1)),
|
||||
TYPE_PRECISION (TREE_TYPE (low))));
|
||||
- tree tbias = wide_int_to_tree (TREE_TYPE (low), bias);
|
||||
+ tree tbias = wide_int_to_tree (TREE_TYPE (ret), bias);
|
||||
if (totallowp)
|
||||
{
|
||||
*totallowp = tbias;
|
||||
- exp = TREE_OPERAND (exp, 0);
|
||||
- STRIP_NOPS (exp);
|
||||
- return exp;
|
||||
+ return ret;
|
||||
}
|
||||
else if (!tree_int_cst_lt (totallow, tbias))
|
||||
return NULL_TREE;
|
||||
+ bias = wi::to_widest (tbias);
|
||||
bias -= wi::to_widest (totallow);
|
||||
if (wi::ges_p (bias, 0) && wi::lts_p (bias, prec - max))
|
||||
{
|
||||
*mask = wi::lshift (*mask, bias);
|
||||
- exp = TREE_OPERAND (exp, 0);
|
||||
- STRIP_NOPS (exp);
|
||||
- return exp;
|
||||
+ return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65418-1.c.jj 2015-03-13 16:49:07.973604649 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65418-1.c 2015-03-13 16:48:28.000000000 +0100
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* PR tree-optimization/65418 */
|
||||
+
|
||||
+__attribute__((noinline, noclone)) int
|
||||
+foo (int x)
|
||||
+{
|
||||
+ if (x == -216 || x == -132 || x == -218 || x == -146)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ volatile int i;
|
||||
+ for (i = -230; i < -120; i++)
|
||||
+ if (foo (i) != (i == -216 || i == -132 || i == -218 || i == -146))
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr65418-2.c.jj 2015-03-13 16:49:10.992556110 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr65418-2.c 2015-03-13 16:48:44.000000000 +0100
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* PR tree-optimization/65418 */
|
||||
+
|
||||
+__attribute__((noinline, noclone)) int
|
||||
+foo (int x)
|
||||
+{
|
||||
+ if (x == -216 || x == -211 || x == -218 || x == -205 || x == -223)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ volatile int i;
|
||||
+ for (i = -230; i < -200; i++)
|
||||
+ if (foo (i) != (i == -216 || i == -211 || i == -218 || i == -205 || i == -223))
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
Loading…
Reference in New Issue
Block a user