angstrom-layers: meta-openembedded: replace poky gcc 4.5 sources with OE ones

This needs further investigation, but for now we can get the tested sources into the poky gcc harness

Signed-off-by: Koen Kooi <k-kooi@ti.com>
This commit is contained in:
Koen Kooi
2010-11-02 22:03:58 +01:00
parent 93b28937ac
commit be10a6b132
202 changed files with 90031 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
diff -urN gcc-4.2.2-orig/gcc/configure gcc-4.2.2/gcc/configure
--- gcc-4.2.2-orig/gcc/configure 2008-08-31 23:10:56.000000000 +0200
+++ gcc-4.2.2/gcc/configure 2008-08-31 23:03:02.000000000 +0200
@@ -12716,6 +12716,7 @@
esac
saved_CFLAGS="${CFLAGS}"
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+ CPP="${CPP_FOR_BUILD}" CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \
CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
diff -urN gcc-4.2.2-orig/gcc/configure.ac gcc-4.2.2/gcc/configure.ac
--- gcc-4.2.2-orig/gcc/configure.ac 2008-08-31 23:10:53.000000000 +0200
+++ gcc-4.2.2/gcc/configure.ac 2008-08-31 23:03:29.000000000 +0200
@@ -1490,6 +1490,7 @@
esac
saved_CFLAGS="${CFLAGS}"
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+ CPP="${CPP_FOR_BUILD}" CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \
${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias

View File

@@ -0,0 +1,12 @@
Index: gcc-4.3.3/Makefile.in
===================================================================
--- gcc-4.3.3.orig/Makefile.in 2010-06-16 18:04:38.379008150 +0400
+++ gcc-4.3.3/Makefile.in 2010-06-16 18:05:29.115006261 +0400
@@ -148,6 +148,7 @@
# built for the build system to override those in BASE_FLAGS_TO_PASSS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ LIBCFLAGS="$(CFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.

View File

@@ -0,0 +1,13 @@
Index: gcc-4.3.1/Makefile.in
===================================================================
--- gcc-4.3.1.orig/Makefile.in 2010-07-07 13:08:44.000000000 +0200
+++ gcc-4.3.1/Makefile.in 2010-07-07 13:11:59.246625709 +0200
@@ -149,7 +149,7 @@
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)" \
- LIBCFLAGS=""
+ LIBCFLAGS="$(CFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
SUBDIRS = @configdirs@

View File

@@ -0,0 +1,11 @@
--- gcc-3.4.6/gcc/collect2.c 2008-10-04 18:17:17.796750393 +0400
+++ gcc-3.4.6/gcc/collect2.new 2008-10-04 18:24:10.120748711 +0400
@@ -1534,7 +1534,7 @@ collect_execute (const char *prog, char
if (redir)
{
/* Open response file. */
- redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);
+ redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, S_IWUSR);
/* Duplicate the stdout and stderr file handles
so they can be restored later. */

View File

@@ -0,0 +1,14 @@
Patch for gcc3 to support gcc4-compatible (and consistent) values for -mtune= option.
--- gcc-3.4.4/gcc/config/arm/arm.c.org 2007-12-15 23:58:35.000000000 +0200
+++ gcc-3.4.4/gcc/config/arm/arm.c 2007-12-16 00:20:39.000000000 +0200
@@ -432,7 +432,9 @@
{"arm10tdmi", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_ARCH5 },
{"arm1020t", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_ARCH5 },
{"arm926ejs", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E },
+ {"arm926ej-s", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E },
{"arm1026ejs", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E },
+ {"arm1026ej-s", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E },
{"xscale", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_STRONG | FL_ARCH5 | FL_ARCH5E | FL_XSCALE },
{"iwmmxt", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_STRONG | FL_ARCH5 | FL_ARCH5E | FL_XSCALE | FL_IWMMXT },
/* V6 Architecture Processors */

View File

@@ -0,0 +1,40 @@
The patch below fixes a crash building libgfortran on arm-linux-gnueabi.
This target doesn't really have a 128-bit integer type, however it does use
TImode to represent the return value of certain special ABI defined library
functions. This results in type_for_size(TImode) being called.
Because TImode deosn't correspond to any gfortran integer kind
gfc_type_for_size returns NULL and we segfault shortly after.
The patch below fixes this by making gfc_type_for_size handle TImode in the
same way as the C frontend.
Tested on x86_64-linux and arm-linux-gnueabi.
Applied to trunk.
Paul
2007-05-15 Paul Brook <paul@codesourcery.com>
gcc/fortran/
* trans-types.c (gfc_type_for_size): Handle signed TImode.
Index: gcc-4.2.1/gcc/fortran/trans-types.c
===================================================================
--- gcc-4.2.1/gcc/fortran/trans-types.c (revision 170435)
+++ gcc-4.2.1/gcc/fortran/trans-types.c (working copy)
@@ -1800,6 +1800,13 @@ gfc_type_for_size (unsigned bits, int un
if (type && bits == TYPE_PRECISION (type))
return type;
}
+
+ /* Handle TImode as a special case because it is used by some backends
+ (eg. ARM) even though it is not available for normal use. */
+#if HOST_BITS_PER_WIDE_INT >= 65
+ if (bits == TYPE_PRECISION (intTI_type_node))
+ return intTI_type_node;
+#endif
}
else
{

View File

@@ -0,0 +1,40 @@
The patch below fixes a crash building libgfortran on arm-linux-gnueabi.
This target doesn't really have a 128-bit integer type, however it does use
TImode to represent the return value of certain special ABI defined library
functions. This results in type_for_size(TImode) being called.
Because TImode deosn't correspond to any gfortran integer kind
gfc_type_for_size returns NULL and we segfault shortly after.
The patch below fixes this by making gfc_type_for_size handle TImode in the
same way as the C frontend.
Tested on x86_64-linux and arm-linux-gnueabi.
Applied to trunk.
Paul
2007-05-15 Paul Brook <paul@codesourcery.com>
gcc/fortran/
* trans-types.c (gfc_type_for_size): Handle signed TImode.
Index: gcc-4.2.1/gcc/fortran/trans-types.c
===================================================================
--- gcc-4.2.1/gcc/fortran/trans-types.c (revision 170435)
+++ gcc-4.2.1/gcc/fortran/trans-types.c (working copy)
@@ -1800,6 +1800,13 @@ gfc_type_for_size (unsigned bits, int un
if (type && bits == TYPE_PRECISION (type))
return type;
}
+
+ /* Handle TImode as a special case because it is used by some backends
+ (eg. ARM) even though it is not available for normal use. */
+#if HOST_BITS_PER_WIDE_INT >= 64
+ if (bits == TYPE_PRECISION (intTI_type_node))
+ return intTI_type_node;
+#endif
}
else
{

View File

@@ -0,0 +1,29 @@
diff -rupN gcc-4.2.orig/gcc/c-incpath.c gcc-4.2/gcc/c-incpath.c
--- gcc-4.2.orig/gcc/c-incpath.c 2007-09-01 11:28:30.000000000 -0400
+++ gcc-4.2/gcc/c-incpath.c 2008-08-17 16:56:01.000000000 -0400
@@ -340,13 +340,18 @@ add_path (char *path, int chain, int cxx
cpp_dir *p;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Convert all backslashes to slashes. The native CRT stat()
- function does not recognize a directory that ends in a backslash
- (unless it is a drive root dir, such "c:\"). Forward slashes,
- trailing or otherwise, cause no problems for stat(). */
- char* c;
- for (c = path; *c; c++)
- if (*c == '\\') *c = '/';
+ /* Remove unnecessary trailing slashes. On some versions of MS
+ Windows, trailing _forward_ slashes cause no problems for stat().
+ On newer versions, stat() does not recognise a directory that ends
+ in a '\\' or '/', unless it is a drive root dir, such as "c:/",
+ where it is obligatory. */
+ int pathlen = strlen (path);
+ char* end = path + pathlen - 1;
+ /* Preserve the lead '/' or lead "c:/". */
+ char* start = path + (pathlen > 2 && path[1] == ':' ? 3 : 1);
+
+ for (; end > start && IS_DIR_SEPARATOR (*end); end--)
+ *end = 0;
#endif
p = XNEW (cpp_dir);

View File

@@ -0,0 +1,38 @@
---
config/mh-mingw | 3 +++
configure | 1 +
configure.in | 1 +
3 files changed, 5 insertions(+)
Index: gcc-4.2.3/config/mh-mingw
===================================================================
--- /dev/null
+++ gcc-4.2.3/config/mh-mingw
@@ -0,0 +1,3 @@
+# Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows
+# Vista (see PR33281 for details).
+BOOT_CFLAGS += -D__USE_MINGW_ACCESS
Index: gcc-4.2.3/configure.in
===================================================================
--- gcc-4.2.3.orig/configure.in
+++ gcc-4.2.3/configure.in
@@ -929,6 +929,7 @@ case "${host}" in
host_makefile_frag="config/mh-cygwin"
;;
*-mingw32*)
+ host_makefile_frag="config/mh-mingw"
;;
*-interix*)
host_makefile_frag="config/mh-interix"
Index: gcc-4.2.3/configure
===================================================================
--- gcc-4.2.3.orig/configure
+++ gcc-4.2.3/configure
@@ -1769,6 +1769,7 @@ case "${host}" in
host_makefile_frag="config/mh-cygwin"
;;
*-mingw32*)
+ host_makefile_frag="config/mh-mingw"
;;
*-interix*)
host_makefile_frag="config/mh-interix"

View File

@@ -0,0 +1,13 @@
---
config/mh-mingw | 1 +
1 file changed, 1 insertion(+)
Index: gcc-4.2.3/config/mh-mingw
===================================================================
--- gcc-4.2.3.orig/config/mh-mingw
+++ gcc-4.2.3/config/mh-mingw
@@ -1,3 +1,4 @@
# Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows
# Vista (see PR33281 for details).
BOOT_CFLAGS += -D__USE_MINGW_ACCESS
+CFLAGS += -D__USE_MINGW_ACCESS

View File

@@ -0,0 +1,167 @@
require gcc-common.inc
LICENSE = "GPLv3"
DEPENDS =+ "mpfr gmp libmpc elfutils"
NATIVEDEPS = "mpfr-native gmp-native gettext-native libmpc-native elfutils-native"
SRCREV = "165931"
PV = "4.5"
# BINV should be incremented after updating to a revision
# after a minor gcc release (e.g. 4.5.1 or 4.5.2) has been made
# the value will be minor-release+1 e.g. if minor release was
# 4.5.1 then the value below will be 2 which will mean 4.5.2
# which will be next minor release and so on.
BINV = "${PV}.2"
BRANCH = "gcc-4_5-branch"
PR_append = "+svnr${SRCPV}"
SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH} \
file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
file://100-uclibc-conf.patch \
file://gcc-uclibc-locale-ctype_touplow_t.patch \
file://cache-amnesia.patch \
file://gcc-flags-for-build.patch \
file://libstdc++-emit-__cxa_end_cleanup-in-text.patch \
file://arm-bswapsi2.patch \
file://Makefile.in.patch \
file://linaro/gcc-4.5-linaro-r99297.patch \
file://linaro/gcc-4.5-linaro-r99298.patch \
file://linaro/gcc-4.5-linaro-r99299.patch \
file://linaro/gcc-4.5-linaro-r99300.patch \
file://linaro/gcc-4.5-linaro-r99301.patch \
file://linaro/gcc-4.5-linaro-r99302.patch \
file://linaro/gcc-4.5-linaro-r99303.patch \
file://linaro/gcc-4.5-linaro-r99304.patch \
file://linaro/gcc-4.5-linaro-r99305.patch \
file://linaro/gcc-4.5-linaro-r99306.patch \
file://linaro/gcc-4.5-linaro-r99307.patch \
file://linaro/gcc-4.5-linaro-r99308.patch \
file://linaro/gcc-4.5-linaro-r99310.patch \
file://linaro/gcc-4.5-linaro-r99312.patch \
file://linaro/gcc-4.5-linaro-r99313.patch \
file://linaro/gcc-4.5-linaro-r99314.patch \
file://linaro/gcc-4.5-linaro-r99315.patch \
file://linaro/gcc-4.5-linaro-r99316.patch \
file://linaro/gcc-4.5-linaro-r99318.patch \
file://linaro/gcc-4.5-linaro-r99319.patch \
file://linaro/gcc-4.5-linaro-r99320.patch \
file://linaro/gcc-4.5-linaro-r99321.patch \
file://linaro/gcc-4.5-linaro-r99322.patch \
file://linaro/gcc-4.5-linaro-r99323.patch \
file://linaro/gcc-4.5-linaro-r99324.patch \
file://linaro/gcc-4.5-linaro-r99325.patch \
file://linaro/gcc-4.5-linaro-r99326.patch \
file://linaro/gcc-4.5-linaro-r99327.patch \
file://linaro/gcc-4.5-linaro-r99332.patch \
file://linaro/gcc-4.5-linaro-r99335.patch \
file://linaro/gcc-4.5-linaro-r99336.patch \
file://linaro/gcc-4.5-linaro-r99337.patch \
file://linaro/gcc-4.5-linaro-r99338.patch \
file://linaro/gcc-4.5-linaro-r99339.patch \
file://linaro/gcc-4.5-linaro-r99340.patch \
file://linaro/gcc-4.5-linaro-r99341.patch \
file://linaro/gcc-4.5-linaro-r99342.patch \
file://linaro/gcc-4.5-linaro-r99343.patch \
file://linaro/gcc-4.5-linaro-r99344.patch \
file://linaro/gcc-4.5-linaro-r99345.patch \
file://linaro/gcc-4.5-linaro-r99346.patch \
file://linaro/gcc-4.5-linaro-r99347.patch \
file://linaro/gcc-4.5-linaro-r99348.patch \
file://linaro/gcc-4.5-linaro-r99349.patch \
# file://linaro/gcc-4.5-linaro-r99350.patch \
file://linaro/gcc-4.5-linaro-r99351.patch \
file://linaro/gcc-4.5-linaro-r99352.patch \
file://linaro/gcc-4.5-linaro-r99353.patch \
file://linaro/gcc-4.5-linaro-r99354.patch \
file://linaro/gcc-4.5-linaro-r99355.patch \
file://linaro/gcc-4.5-linaro-r99356.patch \
file://linaro/gcc-4.5-linaro-r99357.patch \
file://linaro/gcc-4.5-linaro-r99358.patch \
file://linaro/gcc-4.5-linaro-r99359.patch \
file://linaro/gcc-4.5-linaro-r99360.patch \
file://linaro/gcc-4.5-linaro-r99361.patch \
file://linaro/gcc-4.5-linaro-r99363.patch \
file://linaro/gcc-4.5-linaro-r99364.patch \
file://linaro/gcc-4.5-linaro-r99365.patch \
file://linaro/gcc-4.5-linaro-r99366.patch \
file://linaro/gcc-4.5-linaro-r99367.patch \
file://linaro/gcc-4.5-linaro-r99368.patch \
file://linaro/gcc-4.5-linaro-r99369.patch \
file://linaro/gcc-4.5-linaro-r99371.patch \
file://linaro/gcc-4.5-linaro-r99372.patch \
file://linaro/gcc-4.5-linaro-r99373.patch \
file://linaro/gcc-4.5-linaro-r99374.patch \
file://linaro/gcc-4.5-linaro-r99375.patch \
file://linaro/gcc-4.5-linaro-r99376.patch \
file://linaro/gcc-4.5-linaro-r99377.patch \
file://linaro/gcc-4.5-linaro-r99378.patch \
file://linaro/gcc-4.5-linaro-r99379.patch \
file://linaro/gcc-4.5-linaro-r99380.patch \
file://linaro/gcc-4.5-linaro-r99381.patch \
file://linaro/gcc-4.5-linaro-r99383.patch \
file://linaro/gcc-4.5-linaro-r99384.patch \
file://linaro/gcc-4.5-linaro-r99385.patch \
file://linaro/gcc-4.5-linaro-r99388.patch \
file://linaro/gcc-4.5-linaro-r99391.patch \
file://linaro/gcc-4.5-linaro-r99392.patch \
file://linaro/gcc-4.5-linaro-r99393.patch \
file://linaro/gcc-4.5-linaro-r99395.patch \
file://linaro/gcc-4.5-linaro-r99396.patch \
file://linaro/gcc-4.5-linaro-r99397.patch \
file://linaro/gcc-4.5-linaro-r99398.patch \
file://linaro/gcc-4.5-linaro-r99402.patch \
file://linaro/gcc-4.5-linaro-r99403.patch \
file://linaro/gcc-4.5-linaro-r99404.patch \
file://linaro/gcc-4.5-linaro-r99405.patch \
file://linaro/gcc-4.5-linaro-r99406.patch \
file://linaro/gcc-4.5-linaro-r99407.patch \
file://linaro/gcc-4.5-linaro-r99408.patch \
file://linaro/gcc-4.5-linaro-r99409.patch \
file://linaro/gcc-4.5-linaro-r99410.patch \
file://linaro/gcc-4.5-linaro-r99411.patch \
file://linaro/gcc-4.5-linaro-r99412.patch \
file://linaro/gcc-4.5-linaro-r99413.patch \
file://linaro/gcc-4.5-linaro-r99414.patch \
file://linaro/gcc-4.5-linaro-r99415.patch \
file://gcc-vmovl-PR45805.patch \
file://gcc-scalar-widening-pr45847.patch \
file://gcc-linaro-fix-lp-653316.patch \
"
SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
# Language Overrides
FORTRAN = ""
JAVA = ""
rename_srcdir (){
mv ${WORKDIR}/${BRANCH} ${WORKDIR}/gcc-${PV}
}
do_unpack_append() {
bb.build.exec_func('rename_srcdir', d)
}
#EXTRA_OECONF_BASE = " --enable-cheaders=c_std \
# --enable-libssp \
# --disable-bootstrap \
# --disable-libgomp \
# --disable-libmudflap"
EXTRA_OECONF_BASE = " --enable-lto \
--enable-libssp \
--disable-bootstrap \
--disable-libgomp \
--disable-libmudflap \
--enable-cheaders=c_global "
EXTRA_OECONF_INITIAL = "--disable-libmudflap \
--disable-libgomp \
--disable-libssp \
--enable-decimal-float=no"
EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
--disable-libgomp \
--disable-libssp"
EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "

View File

@@ -0,0 +1,37 @@
Index: gcc-4.3.1/contrib/regression/objs-gcc.sh
===================================================================
--- gcc-4.3.1.orig/contrib/regression/objs-gcc.sh 2007-12-24 15:18:57.000000000 -0800
+++ gcc-4.3.1/contrib/regression/objs-gcc.sh 2008-08-16 01:15:12.000000000 -0700
@@ -105,6 +105,10 @@
then
make all-gdb all-dejagnu all-ld || exit 1
make install-gdb install-dejagnu install-ld || exit 1
+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
make bootstrap || exit 1
make install || exit 1
Index: gcc-4.3.1/libjava/classpath/ltconfig
===================================================================
--- gcc-4.3.1.orig/libjava/classpath/ltconfig 2007-06-03 16:18:43.000000000 -0700
+++ gcc-4.3.1/libjava/classpath/ltconfig 2008-08-16 01:15:12.000000000 -0700
@@ -603,7 +603,7 @@
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
-linux-gnu*) ;;
+linux-gnu*|linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1251,7 +1251,7 @@
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
version_type=linux
need_lib_prefix=no
need_version=no

View File

@@ -0,0 +1,15 @@
Corrects sub machine arch corectly
Index: gcc-4.5.0/gcc/config.gcc
===================================================================
--- gcc-4.5.0.orig/gcc/config.gcc 2010-06-25 10:17:43.809880847 -0700
+++ gcc-4.5.0/gcc/config.gcc 2010-06-25 10:38:09.689882136 -0700
@@ -2171,7 +2171,7 @@
;;
sh-*-elf* | sh[12346l]*-*-elf* | \
sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+ sh*-*-linux* | sh[2346lbe]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
sh64-*-netbsd* | sh64l*-*-netbsd*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,233 @@
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-08-16 01:33:23.000000000 -0700
@@ -60,4 +60,49 @@
extern "C" __typeof(wctype_l) __wctype_l;
#endif
+# define __nl_langinfo_l nl_langinfo_l
+# define __strcoll_l strcoll_l
+# define __strftime_l strftime_l
+# define __strtod_l strtod_l
+# define __strtof_l strtof_l
+# define __strtold_l strtold_l
+# define __strxfrm_l strxfrm_l
+# define __newlocale newlocale
+# define __freelocale freelocale
+# define __duplocale duplocale
+# define __uselocale uselocale
+
+# ifdef _GLIBCXX_USE_WCHAR_T
+# define __iswctype_l iswctype_l
+# define __towlower_l towlower_l
+# define __towupper_l towupper_l
+# define __wcscoll_l wcscoll_l
+# define __wcsftime_l wcsftime_l
+# define __wcsxfrm_l wcsxfrm_l
+# define __wctype_l wctype_l
+# endif
+
+#else
+# define __nl_langinfo_l(N, L) nl_langinfo((N))
+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
+# define __strtod_l(S, E, L) strtod((S), (E))
+# define __strtof_l(S, E, L) strtof((S), (E))
+# define __strtold_l(S, E, L) strtold((S), (E))
+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
+# warning should dummy __newlocale check for C|POSIX ?
+# define __newlocale(a, b, c) NULL
+# define __freelocale(a) ((void)0)
+# define __duplocale(a) __c_locale()
+//# define __uselocale ?
+//
+# ifdef _GLIBCXX_USE_WCHAR_T
+# define __iswctype_l(C, M, L) iswctype((C), (M))
+# define __towlower_l(C, L) towlower((C))
+# define __towupper_l(C, L) towupper((C))
+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
+# define __wctype_l(S, L) wctype((S))
+# endif
+
#endif // GLIBC 2.3 and later
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-08-16 01:33:00.000000000 -0700
@@ -39,20 +39,6 @@
#include <langinfo.h>
#include <bits/c++locale_internal.h>
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
-#define __strtof_l(S, E, L) strtof((S), (E))
-#define __strtod_l(S, E, L) strtod((S), (E))
-#define __strtold_l(S, E, L) strtold((S), (E))
-#warning should dummy __newlocale check for C|POSIX ?
-#define __newlocale(a, b, c) NULL
-#define __freelocale(a) ((void)0)
-#define __duplocale(a) __c_locale()
-#endif
-
namespace std
{
template<>
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-08-16 01:30:31.000000000 -0700
@@ -36,13 +36,6 @@
#include <locale>
#include <bits/c++locale_internal.h>
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
-#endif
-
namespace std
{
// These are basically extensions to char_traits, and perhaps should
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-08-16 01:30:31.000000000 -0700
@@ -43,10 +43,6 @@
#warning tailor for stub locale support
#endif
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __nl_langinfo_l(N, L) nl_langinfo((N))
-#endif
-
namespace std
{
// Construct and return valid pattern consisting of some combination of:
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-08-16 01:30:31.000000000 -0700
@@ -41,9 +41,6 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning tailor for stub locale support
#endif
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __nl_langinfo_l(N, L) nl_langinfo((N))
-#endif
namespace std
{
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-08-16 01:30:31.000000000 -0700
@@ -40,9 +40,6 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning tailor for stub locale support
#endif
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __nl_langinfo_l(N, L) nl_langinfo((N))
-#endif
namespace std
{
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-08-16 01:30:31.000000000 -0700
@@ -38,13 +38,6 @@
#undef _LIBC
#include <bits/c++locale_internal.h>
-#ifndef __UCLIBC_HAS_XLOCALE__
-#define __wctype_l(S, L) wctype((S))
-#define __towupper_l(C, L) towupper((C))
-#define __towlower_l(C, L) towlower((C))
-#define __iswctype_l(C, M, L) iswctype((C), (M))
-#endif
-
namespace std
{
// NB: The other ctype<char> specializations are in src/locale.cc and
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-08-16 01:27:18.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-08-16 01:30:31.000000000 -0700
@@ -39,13 +39,10 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix gettext stuff
#endif
-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-extern "C" char *__dcgettext(const char *domainname,
- const char *msgid, int category);
#undef gettext
-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
#else
-#undef gettext
#define gettext(msgid) (msgid)
#endif
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-08-16 01:31:43.000000000 -0700
@@ -36,15 +36,11 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix prototypes for *textdomain funcs
#endif
-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-extern "C" char *__textdomain(const char *domainname);
-extern "C" char *__bindtextdomain(const char *domainname,
- const char *dirname);
-#else
-#undef __textdomain
-#undef __bindtextdomain
-#define __textdomain(D) ((void)0)
-#define __bindtextdomain(D,P) ((void)0)
+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
+#undef textdomain
+#undef bindtextdomain
+#define textdomain(D) ((void)0)
+#define bindtextdomain(D,P) ((void)0)
#endif
// Non-virtual member functions.
@@ -70,7 +66,7 @@
messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
const char* __dir) const
{
- __bindtextdomain(__s.c_str(), __dir);
+ bindtextdomain(__s.c_str(), __dir);
return this->do_open(__s, __loc);
}
@@ -90,7 +86,7 @@
{
// No error checking is done, assume the catalog exists and can
// be used.
- __textdomain(__s.c_str());
+ textdomain(__s.c_str());
return 0;
}
Index: gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-08-16 01:29:20.000000000 -0700
+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-08-16 01:30:31.000000000 -0700
@@ -68,6 +68,7 @@
{
extern "C" __typeof(uselocale) __uselocale;
}
+#define __uselocale uselocale
#endif
namespace std

View File

@@ -0,0 +1,48 @@
--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
+++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:37:27 +0100
@@ -401,7 +401,7 @@
# ifdef __UCLIBC_HAS_XLOCALE__
_M_data->_M_decimal_point = __cloc->decimal_point_wc;
_M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-# else
+# elif defined __UCLIBC_HAS_LOCALE__
_M_data->_M_decimal_point = __global_locale->decimal_point_wc;
_M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
# endif
@@ -556,7 +556,7 @@
# ifdef __UCLIBC_HAS_XLOCALE__
_M_data->_M_decimal_point = __cloc->decimal_point_wc;
_M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-# else
+# elif defined __UCLIBC_HAS_LOCALE__
_M_data->_M_decimal_point = __global_locale->decimal_point_wc;
_M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
# endif
--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
+++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:37:27 +0100
@@ -127,12 +127,25 @@
{
// Named locale.
// NB: In the GNU model wchar_t is always 32 bit wide.
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this... should be numeric
+#endif
+#ifdef __UCLIBC__
+# ifdef __UCLIBC_HAS_XLOCALE__
+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+# elif defined __UCLIBC_HAS_LOCALE__
+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+# endif
+#else
union { char *__s; wchar_t __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
_M_data->_M_decimal_point = __u.__w;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
_M_data->_M_thousands_sep = __u.__w;
+#endif
if (_M_data->_M_thousands_sep == L'\0')
_M_data->_M_grouping = "";

View File

@@ -0,0 +1,519 @@
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-09-17 22:35:29.000000000 -0700
@@ -39,23 +39,20 @@
#include <langinfo.h>
#include <bits/c++locale_internal.h>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
template<>
void
__convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
const __c_locale& __cloc)
{
- if (!(__err & ios_base::failbit))
- {
- char* __sanity;
- errno = 0;
- float __f = __strtof_l(__s, &__sanity, __cloc);
- if (__sanity != __s && errno != ERANGE)
- __v = __f;
- else
- __err |= ios_base::failbit;
- }
+ char* __sanity;
+ errno = 0;
+ float __f = __strtof_l(__s, &__sanity, __cloc);
+ if (__sanity != __s && errno != ERANGE)
+ __v = __f;
+ else
+ __err |= ios_base::failbit;
}
template<>
@@ -63,16 +60,13 @@
__convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
const __c_locale& __cloc)
{
- if (!(__err & ios_base::failbit))
- {
- char* __sanity;
- errno = 0;
- double __d = __strtod_l(__s, &__sanity, __cloc);
- if (__sanity != __s && errno != ERANGE)
- __v = __d;
- else
- __err |= ios_base::failbit;
- }
+ char* __sanity;
+ errno = 0;
+ double __d = __strtod_l(__s, &__sanity, __cloc);
+ if (__sanity != __s && errno != ERANGE)
+ __v = __d;
+ else
+ __err |= ios_base::failbit;
}
template<>
@@ -80,16 +74,13 @@
__convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
const __c_locale& __cloc)
{
- if (!(__err & ios_base::failbit))
- {
- char* __sanity;
- errno = 0;
- long double __ld = __strtold_l(__s, &__sanity, __cloc);
- if (__sanity != __s && errno != ERANGE)
- __v = __ld;
- else
- __err |= ios_base::failbit;
- }
+ char* __sanity;
+ errno = 0;
+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
+ if (__sanity != __s && errno != ERANGE)
+ __v = __ld;
+ else
+ __err |= ios_base::failbit;
}
void
@@ -110,17 +101,18 @@
void
locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
{
- if (_S_get_c_locale() != __cloc)
+ if (__cloc && _S_get_c_locale() != __cloc)
__freelocale(__cloc);
}
__c_locale
locale::facet::_S_clone_c_locale(__c_locale& __cloc)
{ return __duplocale(__cloc); }
-} // namespace std
-namespace __gnu_cxx
-{
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
{
"LC_CTYPE",
@@ -138,9 +130,11 @@
"LC_IDENTIFICATION"
#endif
};
-}
-namespace std
-{
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
const char* const* const locale::_S_categories = __gnu_cxx::category_names;
-} // namespace std
+
+_GLIBCXX_END_NAMESPACE
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-09-17 23:09:49.000000000 -0700
@@ -33,16 +33,20 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
#define _LIBC
#include <locale>
#undef _LIBC
+#else
+#include <locale>
+#endif
#include <bits/c++locale_internal.h>
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
// NB: The other ctype<char> specializations are in src/locale.cc and
// various /config/os/* files.
- template<>
ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
: ctype<char>(0, false, __refs)
{
@@ -57,6 +61,8 @@
#endif
}
}
+ ctype_byname<char>::~ctype_byname()
+ { }
#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::__wmask_type
@@ -138,17 +144,33 @@
ctype<wchar_t>::
do_is(mask __m, wchar_t __c) const
{
- // Highest bitmask in ctype_base == 10, but extra in "C"
- // library for blank.
+ // The case of __m == ctype_base::space is particularly important,
+ // due to its use in many istream functions. Therefore we deal with
+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
+ // is the mask corresponding to ctype_base::space. NB: an encoding
+ // change would not affect correctness!
+
bool __ret = false;
- const size_t __bitmasksize = 11;
- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
- if (__m & _M_bit[__bitcur]
- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
- {
- __ret = true;
- break;
- }
+ if (__m == _M_bit[5])
+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
+ else
+ {
+ // Highest bitmask in ctype_base == 10, but extra in "C"
+ // library for blank.
+ const size_t __bitmasksize = 11;
+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
+ if (__m & _M_bit[__bitcur])
+ {
+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
+ {
+ __ret = true;
+ break;
+ }
+ else if (__m == _M_bit[__bitcur])
+ break;
+ }
+ }
+
return __ret;
}
@@ -290,4 +312,5 @@
#endif
}
#endif // _GLIBCXX_USE_WCHAR_T
-}
+
+_GLIBCXX_END_NAMESPACE
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-09-17 23:13:34.000000000 -0700
@@ -53,12 +53,16 @@
template<typename _CharT>
messages<_CharT>::messages(__c_locale __cloc, const char* __s,
size_t __refs)
- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
- _M_name_messages(__s)
+ : facet(__refs), _M_c_locale_messages(NULL),
+ _M_name_messages(NULL)
{
- char* __tmp = new char[std::strlen(__s) + 1];
- std::strcpy(__tmp, __s);
+ const size_t __len = std::strlen(__s) + 1;
+ char* __tmp = new char[__len];
+ std::memcpy(__tmp, __s, __len);
_M_name_messages = __tmp;
+
+ // Last to avoid leaking memory if new throws.
+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
}
template<typename _CharT>
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-09-17 22:35:29.000000000 -0700
@@ -33,9 +33,14 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
#define _LIBC
#include <locale>
#undef _LIBC
+#else
+#include <locale>
+#endif
#include <bits/c++locale_internal.h>
#ifdef __UCLIBC_MJN3_ONLY__
@@ -206,7 +211,7 @@
}
break;
default:
- ;
+ __ret = pattern();
}
return __ret;
}
@@ -390,7 +395,9 @@
__c_locale __old = __uselocale(__cloc);
#else
// Switch to named locale so that mbsrtowcs will work.
- char* __old = strdup(setlocale(LC_ALL, NULL));
+ char* __old = setlocale(LC_ALL, NULL);
+ const size_t __llen = strlen(__old) + 1;
+ char* __sav = new char[__llen];
setlocale(LC_ALL, __name);
#endif
@@ -477,8 +484,8 @@
#ifdef __UCLIBC_HAS_XLOCALE__
__uselocale(__old);
#else
- setlocale(LC_ALL, __old);
- free(__old);
+ setlocale(LC_ALL, __sav);
+ delete [] __sav;
#endif
__throw_exception_again;
}
@@ -498,8 +505,8 @@
#ifdef __UCLIBC_HAS_XLOCALE__
__uselocale(__old);
#else
- setlocale(LC_ALL, __old);
- free(__old);
+ setlocale(LC_ALL, __sav);
+ delete [] __sav;
#endif
}
}
@@ -545,8 +552,11 @@
__c_locale __old = __uselocale(__cloc);
#else
// Switch to named locale so that mbsrtowcs will work.
- char* __old = strdup(setlocale(LC_ALL, NULL));
- setlocale(LC_ALL, __name);
+ char* __old = setlocale(LC_ALL, NULL);
+ const size_t __llen = strlen(__old) + 1;
+ char* __sav = new char[__llen];
+ memcpy(__sav, __old, __llen);
+ setlocale(LC_ALL, __name);
#endif
#ifdef __UCLIBC_MJN3_ONLY__
@@ -633,8 +643,8 @@
#ifdef __UCLIBC_HAS_XLOCALE__
__uselocale(__old);
#else
- setlocale(LC_ALL, __old);
- free(__old);
+ setlocale(LC_ALL, __sav);
+ delete [] __sav;
#endif
__throw_exception_again;
}
@@ -653,8 +663,8 @@
#ifdef __UCLIBC_HAS_XLOCALE__
__uselocale(__old);
#else
- setlocale(LC_ALL, __old);
- free(__old);
+ setlocale(LC_ALL, __sav);
+ delete [] __sav;
#endif
}
}
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-09-17 22:35:29.000000000 -0700
@@ -33,9 +33,14 @@
// Written by Benjamin Kosnik <bkoz@redhat.com>
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
#define _LIBC
#include <locale>
#undef _LIBC
+#else
+#include <locale>
+#endif
#include <bits/c++locale_internal.h>
#ifdef __UCLIBC_MJN3_ONLY__
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/time_members.h
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-09-17 22:35:27.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/time_members.h 2008-09-17 23:13:34.000000000 -0700
@@ -50,12 +50,21 @@
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs)
: facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
- _M_name_timepunct(__s)
+ _M_name_timepunct(NULL)
{
- char* __tmp = new char[std::strlen(__s) + 1];
- std::strcpy(__tmp, __s);
+ const size_t __len = std::strlen(__s) + 1;
+ char* __tmp = new char[__len];
+ std::memcpy(__tmp, __s, __len);
_M_name_timepunct = __tmp;
- _M_initialize_timepunct(__cloc);
+
+ try
+ { _M_initialize_timepunct(__cloc); }
+ catch(...)
+ {
+ delete [] _M_name_timepunct;
+ __throw_exception_again;
+ }
+
}
template<typename _CharT>
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-09-17 22:35:29.000000000 -0700
@@ -39,21 +39,23 @@
#pragma GCC system_header
#include <cstring> // get std::strlen
-#include <cstdio> // get std::snprintf or std::sprintf
+#include <cstdio> // get std::vsnprintf or std::vsprintf
#include <clocale>
#include <langinfo.h> // For codecvt
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix this
#endif
-#ifdef __UCLIBC_HAS_LOCALE__
+#ifdef _GLIBCXX_USE_ICONV
#include <iconv.h> // For codecvt using iconv, iconv_t
#endif
-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-#include <libintl.h> // For messages
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h> // For messages
#endif
+#include <cstdarg>
#ifdef __UCLIBC_MJN3_ONLY__
#warning what is _GLIBCXX_C_LOCALE_GNU for
+// psm: used in os/gnu-linux/ctype_noninline.h
#endif
#define _GLIBCXX_C_LOCALE_GNU 1
@@ -78,23 +80,25 @@
#else
typedef int* __c_locale;
#endif
-
- // Convert numeric value of type _Tv to string and return length of
- // string. If snprintf is available use it, otherwise fall back to
- // the unsafe sprintf which, in general, can be dangerous and should
+ // Convert numeric value of type double to string and return length of
+ // string. If vsnprintf is available use it, otherwise fall back to
+ // the unsafe vsprintf which, in general, can be dangerous and should
// be avoided.
- template<typename _Tv>
- int
- __convert_from_v(char* __out,
- const int __size __attribute__ ((__unused__)),
- const char* __fmt,
-#ifdef __UCLIBC_HAS_XCLOCALE__
- _Tv __v, const __c_locale& __cloc, int __prec)
+ inline int
+ __convert_from_v(const __c_locale&
+#ifndef __UCLIBC_HAS_XCLOCALE__
+ __cloc __attribute__ ((__unused__))
+#endif
+ ,
+ char* __out,
+ const int __size,
+ const char* __fmt, ...)
{
+ va_list __args;
+#ifdef __UCLIBC_HAS_XCLOCALE__
+
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
- _Tv __v, const __c_locale&, int __prec)
- {
# ifdef __UCLIBC_HAS_LOCALE__
char* __old = std::setlocale(LC_ALL, NULL);
char* __sav = new char[std::strlen(__old) + 1];
@@ -103,7 +107,9 @@
# endif
#endif
- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
+ va_start(__args, __fmt);
+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
+ va_end(__args);
#ifdef __UCLIBC_HAS_XCLOCALE__
__gnu_cxx::__uselocale(__old);
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-09-17 22:35:29.000000000 -0700
@@ -53,11 +53,14 @@
const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
_M_c_locale_timepunct);
#else
- char* __old = strdup(setlocale(LC_ALL, NULL));
+ char* __old = setlocale(LC_ALL, NULL);
+ const size_t __llen = strlen(__old) + 1;
+ char* __sav = new char[__llen];
+ memcpy(__sav, __old, __llen);
setlocale(LC_ALL, _M_name_timepunct);
const size_t __len = strftime(__s, __maxlen, __format, __tm);
- setlocale(LC_ALL, __old);
- free(__old);
+ setlocale(LC_ALL, __sav);
+ delete [] __sav;
#endif
// Make sure __s is null terminated.
if (__len == 0)
@@ -207,11 +210,14 @@
const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
_M_c_locale_timepunct);
#else
- char* __old = strdup(setlocale(LC_ALL, NULL));
+ char* __old = setlocale(LC_ALL, NULL);
+ const size_t __llen = strlen(__old) + 1;
+ char* __sav = new char[__llen];
+ memcpy(__sav, __old, __llen);
setlocale(LC_ALL, _M_name_timepunct);
const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
- setlocale(LC_ALL, __old);
- free(__old);
+ setlocale(LC_ALL, __sav);
+ delete [] __sav;
#endif
// Make sure __s is null terminated.
if (__len == 0)
Index: gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
===================================================================
--- gcc-4.3.2.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-09-17 22:35:28.000000000 -0700
+++ gcc-4.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-09-17 22:35:29.000000000 -0700
@@ -31,6 +31,9 @@
#include <bits/c++config.h>
#include <clocale>
+#include <cstdlib>
+#include <cstring>
+#include <cstddef>
#ifdef __UCLIBC_MJN3_ONLY__
#warning clean this up

View File

@@ -0,0 +1,13 @@
Index: gcc-4.5.0/boehm-gc/include/gc.h
===================================================================
--- gcc-4.5.0.orig/boehm-gc/include/gc.h 2007-04-23 14:10:09.000000000 -0700
+++ gcc-4.5.0/boehm-gc/include/gc.h 2010-06-25 10:49:12.768883509 -0700
@@ -503,7 +503,7 @@
#if defined(__linux__) || defined(__GLIBC__)
# include <features.h>
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
- && !defined(__ia64__)
+ && !defined(__ia64__) && !defined(__UCLIBC__)
# ifndef GC_HAVE_BUILTIN_BACKTRACE
# define GC_HAVE_BUILTIN_BACKTRACE
# endif

View File

@@ -0,0 +1,13 @@
Index: gcc-4.5.0/libstdc++-v3/include/c_std/cstdio
===================================================================
--- gcc-4.5.0.orig/libstdc++-v3/include/c_std/cstdio 2010-02-04 10:20:34.000000000 -0800
+++ gcc-4.5.0/libstdc++-v3/include/c_std/cstdio 2010-06-25 10:51:12.712631679 -0700
@@ -139,7 +139,7 @@
_GLIBCXX_END_NAMESPACE
-#if _GLIBCXX_USE_C99
+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
#undef snprintf
#undef vfscanf

View File

@@ -0,0 +1,14 @@
Index: gcc-4.5.0/libstdc++-v3/configure
===================================================================
--- gcc-4.5.0.orig/libstdc++-v3/configure 2010-06-25 10:48:37.488384191 -0700
+++ gcc-4.5.0/libstdc++-v3/configure 2010-06-25 10:51:23.804380413 -0700
@@ -18262,6 +18262,9 @@
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <complex.h>
+#ifdef __UCLIBC__
+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
+#endif
int
main ()
{

View File

@@ -0,0 +1,28 @@
Index: gcc-4.5.0/libstdc++-v3/include/ext/rope
===================================================================
--- gcc-4.5.0.orig/libstdc++-v3/include/ext/rope 2009-04-09 08:00:19.000000000 -0700
+++ gcc-4.5.0/libstdc++-v3/include/ext/rope 2010-06-25 10:51:33.613383077 -0700
@@ -54,6 +54,9 @@
#include <bits/gthr.h>
#include <tr1/functional>
+/* cope w/ index defined as macro, SuSv3 proposal */
+#undef index
+
# ifdef __GC
# define __GC_CONST const
# else
Index: gcc-4.5.0/libstdc++-v3/include/ext/ropeimpl.h
===================================================================
--- gcc-4.5.0.orig/libstdc++-v3/include/ext/ropeimpl.h 2009-04-09 08:00:19.000000000 -0700
+++ gcc-4.5.0/libstdc++-v3/include/ext/ropeimpl.h 2010-06-25 10:51:33.621381669 -0700
@@ -49,6 +49,9 @@
#include <ext/memory> // For uninitialized_copy_n
#include <ext/numeric> // For power
+/* cope w/ index defined as macro, SuSv3 proposal */
+#undef index
+
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
using std::size_t;

View File

@@ -0,0 +1,49 @@
Index: gcc-4.5.0/libmudflap/mf-hooks2.c
===================================================================
--- gcc-4.5.0.orig/libmudflap/mf-hooks2.c 2009-04-09 08:00:19.000000000 -0700
+++ gcc-4.5.0/libmudflap/mf-hooks2.c 2010-06-25 10:52:13.937636901 -0700
@@ -421,7 +421,7 @@
{
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
- bzero (s, n);
+ memset (s, 0, n);
}
@@ -431,7 +431,7 @@
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
- bcopy (src, dest, n);
+ memmove (dest, src, n);
}
@@ -441,7 +441,7 @@
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
- return bcmp (s1, s2, n);
+ return n == 0 ? 0 : memcmp (s1, s2, n);
}
@@ -450,7 +450,7 @@
size_t n = strlen (s);
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
- return index (s, c);
+ return strchr (s, c);
}
@@ -459,7 +459,7 @@
size_t n = strlen (s);
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
- return rindex (s, c);
+ return strrchr (s, c);
}
/* XXX: stpcpy, memccpy */

View File

@@ -0,0 +1,38 @@
Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.h
===================================================================
--- gcc-4.5.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2010-06-25 10:49:07.024632961 -0700
+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2010-06-25 10:52:33.980632645 -0700
@@ -32,7 +32,8 @@
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
-
+namespace std
+{
#ifdef __UCLIBC_MJN3_ONLY__
#warning fix prototypes for *textdomain funcs
#endif
@@ -116,3 +117,4 @@
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
}
}
+}
Index: gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.h
===================================================================
--- gcc-4.5.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2010-06-25 10:49:07.024632961 -0700
+++ gcc-4.5.0/libstdc++-v3/config/locale/uclibc/time_members.h 2010-06-25 10:52:33.980632645 -0700
@@ -33,7 +33,8 @@
//
// Written by Benjamin Kosnik <bkoz@redhat.com>
-
+namespace std
+{
template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
@@ -75,3 +76,4 @@
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);
}
+}

View File

@@ -0,0 +1,19 @@
This patch fixes a bug into ostream::operator<<(double) due to the wrong size
passed into the __convert_from_v method. The wrong size is then passed to
std::snprintf function, that, on uClibc, doens't handle sized 0 buffer.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Index: gcc-4.3.1/libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
--- gcc-4.3.1.orig/libstdc++-v3/include/bits/locale_facets.tcc 2007-11-26 17:59:41.000000000 -0800
+++ gcc-4.3.1/libstdc++-v3/include/bits/locale_facets.tcc 2008-08-16 02:14:48.000000000 -0700
@@ -1004,7 +1004,7 @@
const int __cs_size = __fixed ? __max_exp + __prec + 4
: __max_digits * 2 + __prec;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
__prec, __v);
#endif

View File

@@ -0,0 +1,20 @@
--- gcc-4.1.0/libstdc++-v3/fragment.am 2005-03-21 11:40:14.000000000 -0600
+++ gcc-4.1.0-patched/libstdc++-v3/fragment.am 2005-04-25 20:14:39.856251785 -0500
@@ -21,5 +21,5 @@
$(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
# -I/-D flags to pass when compiling.
-AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include
--- gcc-4.1.0/libstdc++-v3/libmath/Makefile.am 2005-03-21 11:40:18.000000000 -0600
+++ gcc-4.1.0-patched/libstdc++-v3/libmath/Makefile.am 2005-04-25 20:14:39.682280735 -0500
@@ -35,7 +35,7 @@
libmath_la_SOURCES = stubs.c
-AM_CPPFLAGS = $(CANADIAN_INCLUDES)
+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include
# Only compiling "C" sources in this directory.
LIBTOOL = @LIBTOOL@ --tag CC

View File

@@ -0,0 +1,33 @@
By default gcc places 64 bit libs in a lib64 directory. This makes it use
"lib" instead.
RP 25/7/10
Index: gcc-4.5.0/gcc/config/i386/t-linux64
===================================================================
--- gcc-4.5.0.orig/gcc/config/i386/t-linux64 2010-08-10 15:47:42.000000000 +0100
+++ gcc-4.5.0/gcc/config/i386/t-linux64 2010-08-10 15:47:47.000000000 +0100
@@ -24,8 +24,8 @@
# MULTILIB_OSDIRNAMES according to what is found on the target.
MULTILIB_OPTIONS = m64/m32
-MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_DIRNAMES = . 32
+MULTILIB_OSDIRNAMES = . $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
Index: gcc-4.5.0/gcc/config/i386/linux64.h
===================================================================
--- gcc-4.5.0.orig/gcc/config/i386/linux64.h 2010-08-10 15:49:06.000000000 +0100
+++ gcc-4.5.0/gcc/config/i386/linux64.h 2010-08-10 15:49:16.000000000 +0100
@@ -59,7 +59,7 @@
done. */
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
#if TARGET_64BIT_DEFAULT
#define SPEC_32 "m32"

View File

@@ -0,0 +1,29 @@
http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
Index: gcc-4.5.0/gcc/configure.ac
===================================================================
--- gcc-4.5.0.orig/gcc/configure.ac 2010-03-25 22:40:32.000000000 -0700
+++ gcc-4.5.0/gcc/configure.ac 2010-06-25 11:02:48.489057877 -0700
@@ -2784,7 +2784,7 @@
tls_first_minor=14
tls_as_opt="-m64 -Aesame --fatal-warnings"
;;
- sh-*-* | sh[34]-*-*)
+ sh-*-* | sh[34]*-*-*)
conftest_s='
.section ".tdata","awT",@progbits
foo: .long 25
Index: gcc-4.5.0/gcc/configure
===================================================================
--- gcc-4.5.0.orig/gcc/configure 2010-03-25 22:40:32.000000000 -0700
+++ gcc-4.5.0/gcc/configure 2010-06-25 11:02:48.508381845 -0700
@@ -22156,7 +22156,7 @@
tls_first_minor=14
tls_as_opt="-m64 -Aesame --fatal-warnings"
;;
- sh-*-* | sh[34]-*-*)
+ sh-*-* | sh[34]*-*-*)
conftest_s='
.section ".tdata","awT",@progbits
foo: .long 25

View File

@@ -0,0 +1,34 @@
By Lennert Buytenhek <buytenh@wantstofly.org>
Adds support for arm*b-linux* big-endian ARM targets
See http://gcc.gnu.org/PR16350
Index: gcc-4.5.0/gcc/config/arm/linux-elf.h
===================================================================
--- gcc-4.5.0.orig/gcc/config/arm/linux-elf.h 2009-11-05 06:47:45.000000000 -0800
+++ gcc-4.5.0/gcc/config/arm/linux-elf.h 2010-06-25 11:03:06.997132728 -0700
@@ -51,7 +51,7 @@
#undef MULTILIB_DEFAULTS
#define MULTILIB_DEFAULTS \
- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
/* Now we define the strings used to build the spec file. */
#undef LIB_SPEC
Index: gcc-4.5.0/gcc/config.gcc
===================================================================
--- gcc-4.5.0.orig/gcc/config.gcc 2010-06-25 10:40:33.321880880 -0700
+++ gcc-4.5.0/gcc/config.gcc 2010-06-25 11:03:07.013133525 -0700
@@ -734,6 +734,11 @@
esac
tmake_file="${tmake_file} t-linux arm/t-arm"
case ${target} in
+ arm*b-*)
+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+ ;;
+ esac
+ case ${target} in
arm*-*-linux-*eabi)
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"

View File

@@ -0,0 +1,74 @@
Hi,
The attached patch makes sure that we create smaller object code for
simple switch statements. We just make sure to flatten the switch
statement into an if-else chain, basically.
This fixes a size-regression as compared to gcc-3.4, as can be seen
below.
2007-04-15 Bernhard Fischer <..>
* stmt.c (expand_case): Do not create a complex binary tree when
optimizing for size but rather use the simple ordered list.
(emit_case_nodes): do not emit jumps to the default_label when
optimizing for size.
Not regtested so far.
Comments?
Attached is the test switch.c mentioned below.
$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
$ size switch-*.o
text data bss dec hex filename
169 0 0 169 a9 switch-2.95.o
115 0 0 115 73 switch-3.3.o
103 0 0 103 67 switch-3.4.o
124 0 0 124 7c switch-4.0.o
124 0 0 124 7c switch-4.1.o
124 0 0 124 7c switch-4.2.orig-HEAD.o
95 0 0 95 5f switch-4.3-HEAD.o
124 0 0 124 7c switch-4.3.orig-HEAD.o
166 0 0 166 a6 switch-CHAIN-2.95.o
111 0 0 111 6f switch-CHAIN-3.3.o
95 0 0 95 5f switch-CHAIN-3.4.o
95 0 0 95 5f switch-CHAIN-4.0.o
95 0 0 95 5f switch-CHAIN-4.1.o
95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
Index: gcc-4.5.0/gcc/stmt.c
===================================================================
--- gcc-4.5.0.orig/gcc/stmt.c 2010-02-19 01:53:51.000000000 -0800
+++ gcc-4.5.0/gcc/stmt.c 2010-06-25 11:05:31.816881094 -0700
@@ -2440,7 +2440,11 @@
default code is emitted. */
use_cost_table = estimate_case_costs (case_list);
- balance_case_nodes (&case_list, NULL);
+ /* When optimizing for size, we want a straight list to avoid
+ jumps as much as possible. This basically creates an if-else
+ chain. */
+ if (!optimize_size)
+ balance_case_nodes (&case_list, NULL);
emit_case_nodes (index, case_list, default_label, index_type);
if (default_label)
emit_jump (default_label);
@@ -3008,6 +3012,7 @@
{
if (!node_has_low_bound (node, index_type))
{
+ if (!optimize_size) /* don't jl to the .default_label. */
emit_cmp_and_jump_insns (index,
convert_modes
(mode, imode,

View File

@@ -0,0 +1,30 @@
Index: gcc-4.5/gcc/Makefile.in
===================================================================
--- gcc-4.5.orig/gcc/Makefile.in
+++ gcc-4.5/gcc/Makefile.in
@@ -656,7 +656,7 @@ LIBGCC2_INCLUDES =
TARGET_LIBGCC2_CFLAGS =
# Options to use when compiling crtbegin/end.
-CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
+CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(TARGET_INCLUDES) $(MULTILIB_CFLAGS) -g0 \
-finhibit-size-directive -fno-inline -fno-exceptions \
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
$(INHIBIT_LIBC_CFLAGS)
@@ -1038,10 +1038,14 @@ BUILD_ERRORS = build/errors.o
# -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
# currently being compiled, in both source trees, to be examined as well.
# libintl.h will be found in ../intl if we are using the included libintl.
-INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
+#
+# TARGET_INCLUDES is added to avoid that GMPINC (which points to the host
+# include dir) is used for compiling libgcc.a
+TARGET_INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
-I$(srcdir)/../include @INCINTL@ \
- $(CPPINC) $(GMPINC) $(DECNUMINC) \
+ $(CPPINC) $(DECNUMINC) \
$(PPLINC) $(CLOOGINC) $(LIBELFINC)
+INCLUDES = $(TARGET_INCLUDES) $(GMPINC)
.c.o:
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)

View File

@@ -0,0 +1,13 @@
Index: gcc-4.5/gcc/config/arm/arm.md
===================================================================
--- gcc-4.5.orig/gcc/config/arm/arm.md 2010-06-17 09:13:07.000000000 -0700
+++ gcc-4.5/gcc/config/arm/arm.md 2010-06-22 08:08:45.397212002 -0700
@@ -11267,7 +11267,7 @@
(define_expand "bswapsi2"
[(set (match_operand:SI 0 "s_register_operand" "=r")
(bswap:SI (match_operand:SI 1 "s_register_operand" "r")))]
-"TARGET_EITHER"
+"TARGET_EITHER && (arm_arch6 && !optimize_size)"
"
if (!arm_arch6)
{

View File

@@ -0,0 +1,24 @@
# Dimitry Andric <dimitry@andric.com>, 2004-05-01
#
# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
# anymore. (The required functions are now in libgcc.)
#
# Fixes errors like
# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
# collect2: ld returned 1 exit status
# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat
Index: gcc-4.5.0/gcc/config/arm/linux-elf.h
===================================================================
--- gcc-4.5.0.orig/gcc/config/arm/linux-elf.h 2010-06-25 11:04:49.572437901 -0700
+++ gcc-4.5.0/gcc/config/arm/linux-elf.h 2010-06-25 11:06:12.273162283 -0700
@@ -60,7 +60,7 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
+#define LIBGCC_SPEC "-lgcc"
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"

View File

@@ -0,0 +1,16 @@
Index: gcc-4.5.0/gcc/config/arm/t-linux
===================================================================
--- gcc-4.5.0.orig/gcc/config/arm/t-linux 2009-04-21 12:03:23.000000000 -0700
+++ gcc-4.5.0/gcc/config/arm/t-linux 2010-06-25 11:11:06.836381365 -0700
@@ -23,7 +23,10 @@
LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
- _arm_addsubdf3 _arm_addsubsf3
+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
+ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
+# _arm_addsubdf3 _arm_addsubsf3
# MULTILIB_OPTIONS = mhard-float/msoft-float
# MULTILIB_DIRNAMES = hard-float soft-float

View File

@@ -0,0 +1,36 @@
#! /bin/sh -e
# DP: Fix armv4t build on ARM
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
--- src/gcc/config/arm/linux-eabi.h.orig 2007-11-24 12:37:38.000000000 +0000
+++ src/gcc/config/arm/linux-eabi.h 2007-11-24 12:39:41.000000000 +0000
@@ -44,7 +44,7 @@
The ARM10TDMI core is the default for armv5t, so set
SUBTARGET_CPU_DEFAULT to achieve this. */
#undef SUBTARGET_CPU_DEFAULT
-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
/* TARGET_BIG_ENDIAN_DEFAULT is set in
config.gcc for big endian configurations. */

View File

@@ -0,0 +1,31 @@
---
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: gcc-4.5+svnr155514/gcc/configure
===================================================================
--- gcc-4.5+svnr155514.orig/gcc/configure 2009-12-29 22:00:40.000000000 -0800
+++ gcc-4.5+svnr155514/gcc/configure 2009-12-29 23:52:43.381592113 -0800
@@ -10467,7 +10467,7 @@ else
saved_CFLAGS="${CFLAGS}"
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
LDFLAGS="${LDFLAGS_FOR_BUILD}" \
- ${realsrcdir}/configure \
+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
CFLAGS="${saved_CFLAGS}"
Index: gcc-4.5+svnr155514/gcc/configure.ac
===================================================================
--- gcc-4.5+svnr155514.orig/gcc/configure.ac 2009-12-29 22:00:40.000000000 -0800
+++ gcc-4.5+svnr155514/gcc/configure.ac 2009-12-29 23:51:54.589091778 -0800
@@ -1458,7 +1458,7 @@ else
saved_CFLAGS="${CFLAGS}"
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
LDFLAGS="${LDFLAGS_FOR_BUILD}" \
- ${realsrcdir}/configure \
+ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
CFLAGS="${saved_CFLAGS}"

View File

@@ -0,0 +1,44 @@
GCC: disable MASK_RELAX_PIC_CALLS bit
The new feature added after 4.3.3
"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
will cause cc1plus eat up all the system memory when build webkit-gtk.
The function mips_get_pic_call_symbol keeps on recursively calling itself.
Disable this feature to walk aside the bug.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
diff -ruN gcc-4.5.0-orig/gcc/configure gcc-4.5.0/gcc/configure
--- gcc-4.5.0-orig/gcc/configure 2010-09-17 23:30:21.000000000 +0800
+++ gcc-4.5.0/gcc/configure 2010-09-19 18:21:28.000000000 +0800
@@ -23945,13 +23945,6 @@
rm -f conftest.*
fi
fi
- if test $gcc_cv_as_ld_jalr_reloc = yes; then
- if test x$target_cpu_default = x; then
- target_cpu_default=MASK_RELAX_PIC_CALLS
- else
- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
- fi
- fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
$as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
diff -ruN gcc-4.5.0-orig/gcc/configure.ac gcc-4.5.0/gcc/configure.ac
--- gcc-4.5.0-orig/gcc/configure.ac 2010-09-17 23:30:21.000000000 +0800
+++ gcc-4.5.0/gcc/configure.ac 2010-09-19 18:21:11.000000000 +0800
@@ -3467,13 +3467,6 @@
rm -f conftest.*
fi
fi
- if test $gcc_cv_as_ld_jalr_reloc = yes; then
- if test x$target_cpu_default = x; then
- target_cpu_default=MASK_RELAX_PIC_CALLS
- else
- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
- fi
- fi
AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
AC_CACHE_CHECK([linker for .eh_frame personality relaxation],

View File

@@ -0,0 +1,114 @@
2007-10-02 Jakub Jelinek <jakub@redhat.com>
* decl.c (duplicate_decls): When redeclaring a builtin function,
keep the merged decl builtin whenever types match, even if new
decl defines a function.
* gcc.dg/builtins-65.c: New test.
* g++.dg/ext/builtin10.C: New test.
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c.orig 2010-04-01 11:48:46.000000000 -0700
+++ gcc/cp/decl.c 2010-06-25 10:10:54.749131719 -0700
@@ -2021,23 +2021,21 @@
DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
}
+ /* If redeclaring a builtin function, it stays built in. */
+ if (types_match && DECL_BUILT_IN (olddecl))
+ {
+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
+ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
+ /* If we're keeping the built-in definition, keep the rtl,
+ regardless of declaration matches. */
+ COPY_DECL_RTL (olddecl, newdecl);
+ }
if (new_defines_function)
/* If defining a function declared with other language
linkage, use the previously declared language linkage. */
SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
else if (types_match)
{
- /* If redeclaring a builtin function, and not a definition,
- it stays built in. */
- if (DECL_BUILT_IN (olddecl))
- {
- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
- /* If we're keeping the built-in definition, keep the rtl,
- regardless of declaration matches. */
- COPY_DECL_RTL (olddecl, newdecl);
- }
-
DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
/* Don't clear out the arguments if we're just redeclaring a
function. */
Index: gcc/testsuite/gcc.dg/builtins-65.c
===================================================================
--- gcc/testsuite/gcc.dg/builtins-65.c.orig 2009-06-26 02:02:04.000000000 -0700
+++ gcc/testsuite/gcc.dg/builtins-65.c 2010-06-25 10:10:54.784464429 -0700
@@ -1,3 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern void __chk_fail (void);
+extern int snprintf (char *, size_t, const char *, ...);
+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
+{
+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
+ __chk_fail ();
+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
+}
+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
+
+char buf[10];
+
+int
+main (void)
+{
+ snprintf (buf, 10, "%d%d\n", 10, 10);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mysnprintf" } } */
+/* { dg-final { scan-assembler-not "__chk_fail" } } */
/* { dg-do link } */
/* { dg-options "-O2 -ffast-math" } */
/* { dg-require-effective-target c99_runtime } */
Index: gcc/testsuite/g++.dg/ext/builtin10.C
===================================================================
--- gcc/testsuite/g++.dg/ext/builtin10.C.orig 2009-02-02 03:27:50.000000000 -0800
+++ gcc/testsuite/g++.dg/ext/builtin10.C 2010-06-25 10:10:54.816467202 -0700
@@ -1,3 +1,30 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" {
+extern void __chk_fail (void);
+extern int snprintf (char *, size_t, const char *, ...);
+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
+{
+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
+ __chk_fail ();
+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
+}
+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
+}
+
+char buf[10];
+
+int
+main (void)
+{
+ snprintf (buf, 10, "%d%d\n", 10, 10);
+ return 0;
+}
+
+// { dg-final { scan-assembler "mysnprintf" } }
+// { dg-final { scan-assembler-not "__chk_fail" } }
// { dg-do compile { target correct_iso_cpp_string_wchar_protos } }
// { dg-options "-O2 -fdump-tree-optimized" }

View File

@@ -0,0 +1,284 @@
2008-02-26 Jakub Jelinek <jakub@redhat.com>
* c-ppoutput.c (scan_translation_unit): Handle CPP_PRAGMA
and CPP_PRAGMA_EOL.
* c-pragma.c (pragma_ns_name): New typedef.
(registered_pp_pragmas): New variable.
(c_pp_lookup_pragma): New function.
(c_register_pragma_1): If flag_preprocess_only, do nothing
for non-expanded pragmas, for expanded ones push pragma's
namespace and name into registered_pp_pragmas vector.
(c_invoke_pragma_handler): Register OpenMP pragmas even when
flag_preprocess_only, don't register GCC pch_preprocess
pragma if flag_preprocess_only.
* c-opts.c (c_common_init): Call init_pragma even if
flag_preprocess_only.
* c-pragma.c (c_pp_lookup_pragma): New prototype.
* config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS): Don't call
cpp_register_pragma if flag_preprocess_only.
* gcc.dg/gomp/preprocess-1.c: New test.
--- gcc/c-ppoutput.c.jj 2008-01-26 18:01:16.000000000 +0100
+++ gcc/c-ppoutput.c 2008-02-26 22:54:57.000000000 +0100
@@ -1,6 +1,6 @@
/* Preprocess only, using cpplib.
- Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007,
+ 2008 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
This program is free software; you can redistribute it and/or modify it
@@ -177,7 +177,24 @@ scan_translation_unit (cpp_reader *pfile
avoid_paste = false;
print.source = NULL;
print.prev = token;
- cpp_output_token (token, print.outf);
+ if (token->type == CPP_PRAGMA)
+ {
+ const char *space;
+ const char *name;
+
+ maybe_print_line (token->src_loc);
+ fputs ("#pragma ", print.outf);
+ c_pp_lookup_pragma (token->val.pragma, &space, &name);
+ if (space)
+ fprintf (print.outf, "%s %s", space, name);
+ else
+ fprintf (print.outf, "%s", name);
+ print.printed = 1;
+ }
+ else if (token->type == CPP_PRAGMA_EOL)
+ maybe_print_line (token->src_loc);
+ else
+ cpp_output_token (token, print.outf);
if (token->type == CPP_COMMENT)
account_for_newlines (token->val.str.text, token->val.str.len);
--- gcc/c-pragma.c.jj 2008-02-15 18:43:03.000000000 +0100
+++ gcc/c-pragma.c 2008-02-26 22:59:44.000000000 +0100
@@ -1,6 +1,6 @@
/* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007 Free Software Foundation, Inc.
+ 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -872,6 +872,61 @@ DEF_VEC_ALLOC_O (pragma_handler, heap);
static VEC(pragma_handler, heap) *registered_pragmas;
+typedef struct
+{
+ const char *space;
+ const char *name;
+} pragma_ns_name;
+
+DEF_VEC_O (pragma_ns_name);
+DEF_VEC_ALLOC_O (pragma_ns_name, heap);
+
+static VEC(pragma_ns_name, heap) *registered_pp_pragmas;
+
+struct omp_pragma_def { const char *name; unsigned int id; };
+static const struct omp_pragma_def omp_pragmas[] = {
+ { "atomic", PRAGMA_OMP_ATOMIC },
+ { "barrier", PRAGMA_OMP_BARRIER },
+ { "critical", PRAGMA_OMP_CRITICAL },
+ { "flush", PRAGMA_OMP_FLUSH },
+ { "for", PRAGMA_OMP_FOR },
+ { "master", PRAGMA_OMP_MASTER },
+ { "ordered", PRAGMA_OMP_ORDERED },
+ { "parallel", PRAGMA_OMP_PARALLEL },
+ { "section", PRAGMA_OMP_SECTION },
+ { "sections", PRAGMA_OMP_SECTIONS },
+ { "single", PRAGMA_OMP_SINGLE },
+ { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
+};
+
+void
+c_pp_lookup_pragma (unsigned int id, const char **space, const char **name)
+{
+ const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
+ int i;
+
+ for (i = 0; i < n_omp_pragmas; ++i)
+ if (omp_pragmas[i].id == id)
+ {
+ *space = "omp";
+ *name = omp_pragmas[i].name;
+ return;
+ }
+
+ if (id >= PRAGMA_FIRST_EXTERNAL
+ && (id < PRAGMA_FIRST_EXTERNAL
+ + VEC_length (pragma_ns_name, registered_pp_pragmas)))
+ {
+ *space = VEC_index (pragma_ns_name, registered_pp_pragmas,
+ id - PRAGMA_FIRST_EXTERNAL)->space;
+ *name = VEC_index (pragma_ns_name, registered_pp_pragmas,
+ id - PRAGMA_FIRST_EXTERNAL)->name;
+ return;
+ }
+
+ gcc_unreachable ();
+}
+
/* Front-end wrappers for pragma registration to avoid dragging
cpplib.h in almost everywhere. */
@@ -881,13 +936,29 @@ c_register_pragma_1 (const char *space,
{
unsigned id;
- VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
- id = VEC_length (pragma_handler, registered_pragmas);
- id += PRAGMA_FIRST_EXTERNAL - 1;
-
- /* The C++ front end allocates 6 bits in cp_token; the C front end
- allocates 7 bits in c_token. At present this is sufficient. */
- gcc_assert (id < 64);
+ if (flag_preprocess_only)
+ {
+ pragma_ns_name ns_name;
+
+ if (!allow_expansion)
+ return;
+
+ ns_name.space = space;
+ ns_name.name = name;
+ VEC_safe_push (pragma_ns_name, heap, registered_pp_pragmas, &ns_name);
+ id = VEC_length (pragma_ns_name, registered_pp_pragmas);
+ id += PRAGMA_FIRST_EXTERNAL - 1;
+ }
+ else
+ {
+ VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
+ id = VEC_length (pragma_handler, registered_pragmas);
+ id += PRAGMA_FIRST_EXTERNAL - 1;
+
+ /* The C++ front end allocates 6 bits in cp_token; the C front end
+ allocates 7 bits in c_token. At present this is sufficient. */
+ gcc_assert (id < 64);
+ }
cpp_register_deferred_pragma (parse_in, space, name, id,
allow_expansion, false);
@@ -921,24 +992,8 @@ c_invoke_pragma_handler (unsigned int id
void
init_pragma (void)
{
- if (flag_openmp && !flag_preprocess_only)
+ if (flag_openmp)
{
- struct omp_pragma_def { const char *name; unsigned int id; };
- static const struct omp_pragma_def omp_pragmas[] = {
- { "atomic", PRAGMA_OMP_ATOMIC },
- { "barrier", PRAGMA_OMP_BARRIER },
- { "critical", PRAGMA_OMP_CRITICAL },
- { "flush", PRAGMA_OMP_FLUSH },
- { "for", PRAGMA_OMP_FOR },
- { "master", PRAGMA_OMP_MASTER },
- { "ordered", PRAGMA_OMP_ORDERED },
- { "parallel", PRAGMA_OMP_PARALLEL },
- { "section", PRAGMA_OMP_SECTION },
- { "sections", PRAGMA_OMP_SECTIONS },
- { "single", PRAGMA_OMP_SINGLE },
- { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
- };
-
const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
int i;
@@ -947,8 +1002,9 @@ init_pragma (void)
omp_pragmas[i].id, true, true);
}
- cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
- PRAGMA_GCC_PCH_PREPROCESS, false, false);
+ if (!flag_preprocess_only)
+ cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
+ PRAGMA_GCC_PCH_PREPROCESS, false, false);
#ifdef HANDLE_PRAGMA_PACK
#ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION
--- gcc/c-opts.c.jj 2008-02-26 22:53:23.000000000 +0100
+++ gcc/c-opts.c 2008-02-26 22:54:57.000000000 +0100
@@ -1,5 +1,5 @@
/* C/ObjC/C++ command line option handling.
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Neil Booth.
@@ -1239,6 +1239,9 @@ c_common_init (void)
if (version_flag)
c_common_print_pch_checksum (stderr);
+ /* Has to wait until now so that cpplib has its hash table. */
+ init_pragma ();
+
if (flag_preprocess_only)
{
finish_options ();
@@ -1246,9 +1249,6 @@ c_common_init (void)
return false;
}
- /* Has to wait until now so that cpplib has its hash table. */
- init_pragma ();
-
return true;
}
--- gcc/c-pragma.h.jj 2008-01-26 18:01:16.000000000 +0100
+++ gcc/c-pragma.h 2008-02-26 22:54:57.000000000 +0100
@@ -1,6 +1,6 @@
/* Pragma related interfaces.
Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2007 Free Software Foundation, Inc.
+ 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -124,4 +124,6 @@ extern enum cpp_ttype pragma_lex (tree *
extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
int);
+extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
+
#endif /* GCC_C_PRAGMA_H */
--- gcc/config/darwin.h.jj 2008-02-11 14:48:12.000000000 +0100
+++ gcc/config/darwin.h 2008-02-26 22:54:57.000000000 +0100
@@ -892,8 +892,9 @@ enum machopic_addr_class {
#define DARWIN_REGISTER_TARGET_PRAGMAS() \
do { \
- cpp_register_pragma (parse_in, NULL, "mark", \
- darwin_pragma_ignore, false); \
+ if (!flag_preprocess_only) \
+ cpp_register_pragma (parse_in, NULL, "mark", \
+ darwin_pragma_ignore, false); \
c_register_pragma (0, "options", darwin_pragma_options); \
c_register_pragma (0, "segment", darwin_pragma_ignore); \
c_register_pragma (0, "unused", darwin_pragma_unused); \
--- gcc/testsuite/gcc.dg/gomp/preprocess-1.c.jj 2008-02-26 22:54:57.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/preprocess-1.c 2008-02-26 22:54:57.000000000 +0100
@@ -0,0 +1,16 @@
+/* { dg-do preprocess } */
+
+void foo (void)
+{
+ int i1, j1, k1;
+#define p parallel
+#define P(x) private (x##1)
+#define S(x) shared (x##1)
+#define F(x) firstprivate (x##1)
+#pragma omp p P(i) \
+ S(j) \
+ F(k)
+ ;
+}
+
+/* { dg-final { scan-file preprocess-1.i "(^|\n)#pragma omp parallel private \\(i1\\) shared \\(j1\\) firstprivate \\(k1\\)($|\n)" } } */

View File

@@ -0,0 +1,65 @@
Build i386.rpm libgomp and libsupc++.a(guard.o) as i486+, pre-i486
hardware isn't supported because NPTL doesn't support it anyway.
Index: libgomp/configure.tgt
===================================================================
--- libgomp/configure.tgt.orig 2010-01-28 13:47:59.000000000 -0800
+++ libgomp/configure.tgt 2010-06-25 10:32:26.706135558 -0700
@@ -48,14 +48,14 @@
;;
# Note that bare i386 is not included here. We need cmpxchg.
- i[456]86-*-linux*)
+ i[3456]86-*-linux*)
config_path="linux/x86 linux posix"
case " ${CC} ${CFLAGS} " in
*" -m64 "*)
;;
*)
if test -z "$with_arch"; then
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
fi
esac
;;
@@ -67,7 +67,7 @@
config_path="linux/x86 linux posix"
case " ${CC} ${CFLAGS} " in
*" -m32 "*)
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=i686"
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
;;
esac
;;
Index: libstdc++-v3/libsupc++/guard.cc
===================================================================
--- libstdc++-v3/libsupc++/guard.cc.orig 2009-11-09 14:09:30.000000000 -0800
+++ libstdc++-v3/libsupc++/guard.cc 2010-06-25 10:32:26.710135964 -0700
@@ -30,6 +30,27 @@
#include <new>
#include <ext/atomicity.h>
#include <ext/concurrence.h>
+#if defined __i386__ && !defined _GLIBCXX_ATOMIC_BUILTINS
+# define _GLIBCXX_ATOMIC_BUILTINS 1
+# define __sync_val_compare_and_swap(a, b, c) \
+ ({ \
+ typedef char sltast[sizeof (*a) == sizeof (int) ? 1 : -1]; \
+ int sltas; \
+ __asm __volatile ("lock; cmpxchgl %3, (%1)" \
+ : "=a" (sltas) \
+ : "r" (a), "0" (b), "r" (c) : "memory"); \
+ sltas; \
+ })
+# define __sync_lock_test_and_set(a, b) \
+ ({ \
+ typedef char sltast[sizeof (*a) == sizeof (int) ? 1 : -1]; \
+ int sltas; \
+ __asm __volatile ("xchgl (%1), %0" \
+ : "=r" (sltas) \
+ : "r" (a), "0" (b) : "memory"); \
+ sltas; \
+ })
+#endif
#if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
# include <climits>

View File

@@ -0,0 +1,550 @@
2004-11-27 Jakub Jelinek <jakub@redhat.com>
* config.gcc (ia64*-*-linux*): If native and libelf is installed,
use ia64/t-glibc-no-libunwind instead of the other t-*unwind*
fragments.
* config/ia64/t-glibc-no-libunwind: New file.
* config/ia64/change-symver.c: New file.
* config/ia64/unwind-ia64.c: If USE_SYMVER_GLOBAL and SHARED,
define _Unwind_* to __symverglobal_Unwind_*.
(alias): Undefine.
(symverglobal): Define. Use it on _Unwind_*.
* config/ia64/mkmap-symver-multi.awk: New file.
* config/ia64/libgcc-ia64-no-libunwind.ver: New file.
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc.orig 2010-04-07 03:34:00.000000000 -0700
+++ gcc/config.gcc 2010-06-25 10:15:25.133131055 -0700
@@ -1457,9 +1457,16 @@
;;
ia64*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
- tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
- if test x$with_system_libunwind != xyes ; then
- tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
+ tmake_file="${tmake_file} ia64/t-ia64"
+ if test x${target} = x${host} && test x${target} = x${build} \
+ && grep gelf_getverdef /usr/include/gelf.h > /dev/null 2>&1 \
+ && test -f /usr/lib/libelf.so; then
+ tmake_file="${tmake_file} ia64/t-glibc-no-libunwind"
+ else
+ tmake_file="${tmake_file} t-libunwind ia64/t-glibc"
+ if test x$with_system_libunwind != xyes ; then
+ tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
+ fi
fi
target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
Index: gcc/config/ia64/t-glibc-no-libunwind
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/ia64/t-glibc-no-libunwind 2010-06-25 10:14:32.521880765 -0700
@@ -0,0 +1,30 @@
+# Don't use system libunwind library on IA-64 GLIBC based system,
+# but make _Unwind_* symbols unversioned, so that created programs
+# are usable even when libgcc_s uses libunwind.
+LIB2ADDEH += $(srcdir)/config/ia64/fde-glibc.c
+SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64-no-libunwind.ver
+SHLIB_MKMAP = $(srcdir)/config/ia64/mkmap-symver-multi.awk
+
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+ -Wl,--soname=$(SHLIB_SONAME) \
+ -Wl,--version-script=$(SHLIB_MAP) \
+ -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \
+ rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
+ if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
+ mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
+ $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
+ else true; fi && \
+ gcc -O2 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tweak \
+ $$(gcc_srcdir)/config/ia64/change-symver.c -lelf && \
+ $(SHLIB_DIR)/$(SHLIB_SONAME).tweak $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \
+ GCC_3.4.2 _GLOBAL_ \
+ _Unwind_GetGR _Unwind_RaiseException _Unwind_GetRegionStart _Unwind_SetIP \
+ _Unwind_GetIP _Unwind_GetLanguageSpecificData _Unwind_Resume \
+ _Unwind_DeleteException _Unwind_SetGR _Unwind_ForcedUnwind \
+ _Unwind_Backtrace _Unwind_FindEnclosingFunction _Unwind_GetCFA \
+ _Unwind_Resume_or_Rethrow _Unwind_GetBSP && \
+ rm -f $(SHLIB_DIR)/$(SHLIB_SONAME).tweak && \
+ mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
+ $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
+
+TARGET_LIBGCC2_CFLAGS += -DUSE_SYMVER_GLOBAL
Index: gcc/config/ia64/change-symver.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/ia64/change-symver.c 2010-06-25 10:14:32.521880765 -0700
@@ -0,0 +1,211 @@
+#define _GNU_SOURCE 1
+#define _FILE_OFFSET_BITS 64
+#include <endian.h>
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <fnmatch.h>
+#include <gelf.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+compute_veridx (const char *name, Elf *elf, Elf_Data *verd, GElf_Shdr *verd_shdr)
+{
+ if (strcmp (name, "_GLOBAL_") == 0)
+ return 1;
+
+ int cnt;
+ size_t offset = 0;
+ for (cnt = verd_shdr->sh_info; --cnt >= 0; )
+ {
+ GElf_Verdef defmem;
+ GElf_Verdef *def;
+ GElf_Verdaux auxmem;
+ GElf_Verdaux *aux;
+ unsigned int auxoffset;
+
+ /* Get the data at the next offset. */
+ def = gelf_getverdef (verd, offset, &defmem);
+ if (def == NULL)
+ break;
+
+ auxoffset = offset + def->vd_aux;
+ aux = gelf_getverdaux (verd, auxoffset, &auxmem);
+ if (aux == NULL)
+ break;
+
+ if (strcmp (name, elf_strptr (elf, verd_shdr->sh_link,
+ aux->vda_name)) == 0)
+ return def->vd_ndx;
+
+ /* Find the next offset. */
+ offset += def->vd_next;
+ }
+
+ return -1;
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc < 4)
+ error (1, 0, "Usage: change_symver library from_symver to_symver symbol...\nExample: change_symver libfoo.so FOO_1.0 *global* bar baz");
+
+ const char *fname = argv[1];
+
+ /* Open the file. */
+ int fd;
+ fd = open (fname, O_RDWR);
+ if (fd == -1)
+ error (1, errno, fname);
+
+ elf_version (EV_CURRENT);
+
+ /* Now get the ELF descriptor. */
+ Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
+ if (elf == NULL || elf_kind (elf) != ELF_K_ELF)
+ error (1, 0, "Couldn't open %s: %s", fname, elf_errmsg (-1));
+
+ size_t shstrndx;
+ /* Get the section header string table index. */
+ if (elf_getshstrndx (elf, &shstrndx) < 0)
+ error (1, 0, "cannot get shstrndx from %s", fname);
+
+ GElf_Ehdr ehdr_mem;
+ GElf_Ehdr *ehdr;
+
+ /* We need the ELF header in a few places. */
+ ehdr = gelf_getehdr (elf, &ehdr_mem);
+ if (ehdr == NULL)
+ error (1, 0, "couldn't get ELF headers %s: %s", fname, elf_errmsg (-1));
+
+ Elf_Scn *scn = NULL;
+ GElf_Shdr shdr_mem, verd_shdr, ver_shdr, dynsym_shdr;
+ Elf_Data *ver = NULL, *verd = NULL, *dynsym = NULL;
+
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
+ {
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+
+ if (shdr == NULL)
+ error (1, 0, "couldn't get shdr from %s", fname);
+
+ if ((shdr->sh_flags & SHF_ALLOC) != 0)
+ {
+ const char *name = elf_strptr (elf, shstrndx, shdr->sh_name);
+ Elf_Data **p;
+
+ if (strcmp (name, ".gnu.version") == 0)
+ {
+ p = &ver;
+ ver_shdr = *shdr;
+ }
+ else if (strcmp (name, ".gnu.version_d") == 0)
+ {
+ p = &verd;
+ verd_shdr = *shdr;
+ }
+ else if (strcmp (name, ".dynsym") == 0)
+ {
+ p = &dynsym;
+ dynsym_shdr = *shdr;
+ }
+ else
+ continue;
+
+ if (*p != NULL)
+ error (1, 0, "Two %s sections in %s", name, fname);
+ *p = elf_getdata (scn, NULL);
+ if (*p == NULL || elf_getdata (scn, *p) != NULL)
+ error (1, 0, "No data or non-contiguous data in %s section in %s",
+ name, fname);
+ }
+ }
+
+ if (ver == NULL || verd == NULL || dynsym == NULL)
+ error (1, 0, "Couldn't find one of the needed sections in %s", fname);
+
+ int from_idx = compute_veridx (argv[2], elf, verd, &verd_shdr);
+ if (from_idx == -1)
+ error (1, 0, "Could not find symbol version %s in %s", argv[2], fname);
+
+ int to_idx = compute_veridx (argv[3], elf, verd, &verd_shdr);
+ if (to_idx == -1)
+ error (1, 0, "Could not find symbol version %s in %s", argv[3], fname);
+
+ if (dynsym_shdr.sh_entsize != gelf_fsize (elf, ELF_T_SYM, 1, ehdr->e_version)
+ || dynsym_shdr.sh_size % dynsym_shdr.sh_entsize
+ || ver_shdr.sh_entsize != 2
+ || (ver_shdr.sh_size & 1)
+ || dynsym_shdr.sh_size / dynsym_shdr.sh_entsize != ver_shdr.sh_size / 2)
+ error (1, 0, "Unexpected sh_size or sh_entsize in %s", fname);
+
+ size_t nentries = ver_shdr.sh_size / 2;
+ size_t cnt;
+ GElf_Versym array[nentries];
+ for (cnt = 0; cnt < nentries; ++cnt)
+ {
+ GElf_Versym vsymmem;
+ GElf_Versym *vsym;
+
+ vsym = gelf_getversym (ver, cnt, &vsymmem);
+ if (vsym == NULL)
+ error (1, 0, "gelt_getversym failed in %s: %s", fname, elf_errmsg (-1));
+
+ array[cnt] = *vsym;
+ if (*vsym != from_idx)
+ continue;
+
+ GElf_Sym sym_mem;
+ GElf_Sym *sym;
+ sym = gelf_getsym (dynsym, cnt, &sym_mem);
+ if (sym == NULL)
+ error (1, 0, "gelt_getsym failed in %s: %s", fname, elf_errmsg (-1));
+
+ const char *name = elf_strptr (elf, dynsym_shdr.sh_link, sym->st_name);
+
+ int argn;
+ for (argn = 4; argn < argc; ++argn)
+ if (fnmatch (argv[argn], name, 0) == 0)
+ {
+ array[cnt] = to_idx;
+ break;
+ }
+ }
+
+ if (sizeof (array[0]) != 2)
+ abort ();
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+ ;
+ else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
+ ;
+ else if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
+#else
+# error Unsupported endianity
+#endif
+ {
+ for (cnt = 0; cnt < nentries; ++cnt)
+ array[cnt] = ((array[cnt] & 0xff) << 8) | ((array[cnt] & 0xff00) >> 8);
+ }
+ else
+ error (1, 0, "Unknown EI_DATA %d in %s", ehdr->e_ident[EI_DATA], fname);
+
+ if (elf_end (elf) != 0)
+ error (1, 0, "couldn't close %s: %s", fname, elf_errmsg (-1));
+
+ if (lseek (fd, ver_shdr.sh_offset, SEEK_SET) != (off_t) ver_shdr.sh_offset)
+ error (1, 0, "failed to seek to %zd in %s", (size_t) ver_shdr.sh_offset,
+ fname);
+
+ if (write (fd, array, 2 * nentries) != (ssize_t) (2 * nentries))
+ error (1, 0, "failed to write .gnu.version section into %s", fname);
+
+ close (fd);
+ return 0;
+}
Index: gcc/config/ia64/unwind-ia64.c
===================================================================
--- gcc/config/ia64/unwind-ia64.c.orig 2009-09-07 08:41:52.000000000 -0700
+++ gcc/config/ia64/unwind-ia64.c 2010-06-25 10:14:32.521880765 -0700
@@ -48,6 +48,51 @@
#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) 1
#endif
+#if defined (USE_SYMVER_GLOBAL) && defined (SHARED)
+extern _Unwind_Reason_Code __symverglobal_Unwind_Backtrace
+ (_Unwind_Trace_Fn, void *);
+extern void __symverglobal_Unwind_DeleteException
+ (struct _Unwind_Exception *);
+extern void * __symverglobal_Unwind_FindEnclosingFunction (void *);
+extern _Unwind_Reason_Code __symverglobal_Unwind_ForcedUnwind
+ (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
+extern _Unwind_Word __symverglobal_Unwind_GetCFA
+ (struct _Unwind_Context *);
+extern _Unwind_Word __symverglobal_Unwind_GetBSP
+ (struct _Unwind_Context *);
+extern _Unwind_Word __symverglobal_Unwind_GetGR
+ (struct _Unwind_Context *, int );
+extern _Unwind_Ptr __symverglobal_Unwind_GetIP (struct _Unwind_Context *);
+extern void *__symverglobal_Unwind_GetLanguageSpecificData
+ (struct _Unwind_Context *);
+extern _Unwind_Ptr __symverglobal_Unwind_GetRegionStart
+ (struct _Unwind_Context *);
+extern _Unwind_Reason_Code __symverglobal_Unwind_RaiseException
+ (struct _Unwind_Exception *);
+extern void __symverglobal_Unwind_Resume (struct _Unwind_Exception *);
+extern _Unwind_Reason_Code __symverglobal_Unwind_Resume_or_Rethrow
+ (struct _Unwind_Exception *);
+extern void __symverglobal_Unwind_SetGR
+ (struct _Unwind_Context *, int, _Unwind_Word);
+extern void __symverglobal_Unwind_SetIP
+ (struct _Unwind_Context *, _Unwind_Ptr);
+#define _Unwind_Backtrace __symverglobal_Unwind_Backtrace
+#define _Unwind_DeleteException __symverglobal_Unwind_DeleteException
+#define _Unwind_FindEnclosingFunction __symverglobal_Unwind_FindEnclosingFunction
+#define _Unwind_ForcedUnwind __symverglobal_Unwind_ForcedUnwind
+#define _Unwind_GetBSP __symverglobal_Unwind_GetBSP
+#define _Unwind_GetCFA __symverglobal_Unwind_GetCFA
+#define _Unwind_GetGR __symverglobal_Unwind_GetGR
+#define _Unwind_GetIP __symverglobal_Unwind_GetIP
+#define _Unwind_GetLanguageSpecificData __symverglobal_Unwind_GetLanguageSpecificData
+#define _Unwind_GetRegionStart __symverglobal_Unwind_GetRegionStart
+#define _Unwind_RaiseException __symverglobal_Unwind_RaiseException
+#define _Unwind_Resume __symverglobal_Unwind_Resume
+#define _Unwind_Resume_or_Rethrow __symverglobal_Unwind_Resume_or_Rethrow
+#define _Unwind_SetGR __symverglobal_Unwind_SetGR
+#define _Unwind_SetIP __symverglobal_Unwind_SetIP
+#endif
+
enum unw_application_register
{
UNW_AR_BSP,
@@ -2457,4 +2502,44 @@
alias (_Unwind_SetIP);
#endif
+#if defined (USE_SYMVER_GLOBAL) && defined (SHARED)
+#undef alias
+#define symverglobal(name, version) \
+__typeof (__symverglobal##name) __symverlocal##name \
+ __attribute__ ((alias ("__symverglobal" #name))); \
+__asm__ (".symver __symverglobal" #name"," #name "@@GCC_3.4.2");\
+__asm__ (".symver __symverlocal" #name"," #name "@" #version)
+
+#undef _Unwind_Backtrace
+#undef _Unwind_DeleteException
+#undef _Unwind_FindEnclosingFunction
+#undef _Unwind_ForcedUnwind
+#undef _Unwind_GetBSP
+#undef _Unwind_GetCFA
+#undef _Unwind_GetGR
+#undef _Unwind_GetIP
+#undef _Unwind_GetLanguageSpecificData
+#undef _Unwind_GetRegionStart
+#undef _Unwind_RaiseException
+#undef _Unwind_Resume
+#undef _Unwind_Resume_or_Rethrow
+#undef _Unwind_SetGR
+#undef _Unwind_SetIP
+symverglobal (_Unwind_Backtrace, GCC_3.3);
+symverglobal (_Unwind_DeleteException, GCC_3.0);
+symverglobal (_Unwind_FindEnclosingFunction, GCC_3.3);
+symverglobal (_Unwind_ForcedUnwind, GCC_3.0);
+symverglobal (_Unwind_GetBSP, GCC_3.3.2);
+symverglobal (_Unwind_GetCFA, GCC_3.3);
+symverglobal (_Unwind_GetGR, GCC_3.0);
+symverglobal (_Unwind_GetIP, GCC_3.0);
+symverglobal (_Unwind_GetLanguageSpecificData, GCC_3.0);
+symverglobal (_Unwind_GetRegionStart, GCC_3.0);
+symverglobal (_Unwind_RaiseException, GCC_3.0);
+symverglobal (_Unwind_Resume, GCC_3.0);
+symverglobal (_Unwind_Resume_or_Rethrow, GCC_3.3);
+symverglobal (_Unwind_SetGR, GCC_3.0);
+symverglobal (_Unwind_SetIP, GCC_3.0);
+#endif
+
#endif
Index: gcc/config/ia64/mkmap-symver-multi.awk
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/ia64/mkmap-symver-multi.awk 2010-06-25 10:14:32.521880765 -0700
@@ -0,0 +1,133 @@
+# Generate an ELF symbol version map a-la Solaris and GNU ld.
+# Contributed by Richard Henderson <rth@cygnus.com>
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING. If not, write to the Free
+# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+BEGIN {
+ state = "nm";
+ sawsymbol = 0;
+}
+
+# Remove comment and blank lines.
+/^ *#/ || /^ *$/ {
+ next;
+}
+
+# We begin with nm input. Collect the set of symbols that are present
+# so that we can not emit them into the final version script -- Solaris
+# complains at us if we do.
+
+state == "nm" && /^%%/ {
+ state = "ver";
+ next;
+}
+
+state == "nm" && ($1 == "U" || $2 == "U") {
+ next;
+}
+
+state == "nm" && NF == 3 {
+ if ($3 ~ /^[^@]*@GCC_[0-9.]*$/) {
+ def[$3] = 1
+ tl=$3
+ sub(/^.*@/,"",tl)
+ ver[$3] = tl
+ } else {
+ sub(/@@?GCC_[0-9.]*$/,"",$3)
+ def[$3] = 1;
+ }
+ sawsymbol = 1;
+ next;
+}
+
+state == "nm" {
+ next;
+}
+
+# Now we process a simplified variant of the Solaris symbol version
+# script. We have one symbol per line, no semicolons, simple markers
+# for beginning and ending each section, and %inherit markers for
+# describing version inheritence. A symbol may appear in more than
+# one symbol version, and the last seen takes effect.
+
+NF == 3 && $1 == "%inherit" {
+ inherit[$2] = $3;
+ next;
+}
+
+NF == 2 && $2 == "{" {
+ libs[$1] = 1;
+ thislib = $1;
+ next;
+}
+
+$1 == "}" {
+ thislib = "";
+ next;
+}
+
+{
+ ver[$1] = thislib;
+ next;
+}
+
+END {
+ if (!sawsymbol)
+ {
+ print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2";
+ exit 1;
+ }
+ for (l in libs)
+ output(l);
+}
+
+function output(lib) {
+ if (done[lib])
+ return;
+ done[lib] = 1;
+ if (inherit[lib])
+ output(inherit[lib]);
+
+ empty=1
+ for (sym in ver)
+ if ((ver[sym] == lib) && (sym in def))
+ {
+ if (empty)
+ {
+ printf("%s {\n", lib);
+ printf(" global:\n");
+ empty = 0;
+ }
+ symp = sym;
+ sub(/@GCC_[0-9.]*$/,"",symp);
+ printf("\t%s;\n", symp);
+ if (dotsyms)
+ printf("\t.%s;\n", symp);
+ }
+
+ if (empty)
+ {
+ for (l in libs)
+ if (inherit[l] == lib)
+ inherit[l] = inherit[lib];
+ }
+ else if (inherit[lib])
+ printf("} %s;\n", inherit[lib]);
+ else
+ printf ("\n local:\n\t*;\n};\n");
+}
Index: gcc/config/ia64/libgcc-ia64-no-libunwind.ver
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/ia64/libgcc-ia64-no-libunwind.ver 2010-06-25 10:14:32.525880902 -0700
@@ -0,0 +1,17 @@
+GCC_3.4.2 {
+ _Unwind_GetGR
+ _Unwind_RaiseException
+ _Unwind_GetRegionStart
+ _Unwind_SetIP
+ _Unwind_GetIP
+ _Unwind_GetLanguageSpecificData
+ _Unwind_Resume
+ _Unwind_DeleteException
+ _Unwind_SetGR
+ _Unwind_ForcedUnwind
+ _Unwind_Backtrace
+ _Unwind_FindEnclosingFunction
+ _Unwind_GetCFA
+ _Unwind_Resume_or_Rethrow
+ _Unwind_GetBSP
+}

View File

@@ -0,0 +1,19 @@
2008-01-25 Jakub Jelinek <jakub@redhat.com>
* lang.c (java_classify_record): Revert 2007-12-20 change.
Index: gcc/java/lang.c
===================================================================
--- gcc/java/lang.c.orig 2010-01-20 00:17:00.000000000 -0800
+++ gcc/java/lang.c 2010-06-25 10:28:46.569383189 -0700
@@ -881,9 +881,7 @@
if (! CLASS_P (type))
return RECORD_IS_STRUCT;
- /* ??? GDB does not support DW_TAG_interface_type as of December,
- 2007. Re-enable this at a later time. */
- if (0 && CLASS_INTERFACE (TYPE_NAME (type)))
+ if (CLASS_INTERFACE (TYPE_NAME (type)))
return RECORD_IS_INTERFACE;
return RECORD_IS_CLASS;

View File

@@ -0,0 +1,48 @@
Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac.orig 2010-03-21 12:41:37.000000000 -0700
+++ libjava/configure.ac 2010-06-25 10:17:47.489886278 -0700
@@ -139,6 +139,13 @@
[allow rebuilding of .class and .h files]))
AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
+AC_ARG_ENABLE(libjava-multilib,
+ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib]))
+if test "$enable_libjava_multilib" = no; then
+ multilib=no
+ ac_configure_args="$ac_configure_args --disable-multilib"
+fi
+
# It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
GCC_NO_EXECUTABLES
Index: libjava/configure
===================================================================
--- libjava/configure.orig 2010-04-02 11:18:06.000000000 -0700
+++ libjava/configure 2010-06-25 10:17:47.516381209 -0700
@@ -1609,6 +1609,8 @@
default=yes
--enable-java-maintainer-mode
allow rebuilding of .class and .h files
+ --enable-libjava-multilib
+ build libjava as multilib
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-maintainer-mode enable make rules and dependencies not useful
@@ -3346,6 +3348,16 @@
fi
+# Check whether --enable-libjava-multilib was given.
+if test "${enable_libjava_multilib+set}" = set; then
+ enableval=$enable_libjava_multilib;
+fi
+
+if test "$enable_libjava_multilib" = no; then
+ multilib=no
+ ac_configure_args="$ac_configure_args --disable-multilib"
+fi
+
# It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
2005-11-28 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0,
read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx
instead of doing an extran indirection from frame_pointer_rtx.
* gcc.dg/20051128-1.c: New test.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c.orig 2010-03-27 03:27:39.000000000 -0700
+++ gcc/config/rs6000/rs6000.c 2010-06-25 10:18:04.053381930 -0700
@@ -17646,17 +17646,22 @@
don't try to be too clever here. */
if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
{
+ rtx x;
cfun->machine->ra_needs_full_frame = 1;
- return
- gen_rtx_MEM
- (Pmode,
- memory_address
- (Pmode,
- plus_constant (copy_to_reg
- (gen_rtx_MEM (Pmode,
- memory_address (Pmode, frame))),
- RETURN_ADDRESS_OFFSET)));
+ if (count == 0)
+ {
+ gcc_assert (frame == frame_pointer_rtx);
+ x = arg_pointer_rtx;
+ }
+ else
+ {
+ x = memory_address (Pmode, frame);
+ x = copy_to_reg (gen_rtx_MEM (Pmode, x));
+ }
+
+ x = plus_constant (x, RETURN_ADDRESS_OFFSET);
+ return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
}
cfun->machine->ra_need_lr = 1;
Index: gcc/testsuite/gcc.dg/20051128-1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/20051128-1.c 2010-06-25 10:18:04.061382856 -0700
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fpic" } */
+
+extern void exit (int);
+extern void abort (void);
+
+int b;
+
+struct A
+{
+ void *pad[147];
+ void *ra, *h;
+ long o;
+};
+
+void
+__attribute__((noinline))
+foo (struct A *a, void *x)
+{
+ __builtin_memset (a, 0, sizeof (a));
+ if (!b)
+ exit (0);
+}
+
+void
+__attribute__((noinline))
+bar (void)
+{
+ struct A a;
+
+ __builtin_unwind_init ();
+ foo (&a, __builtin_return_address (0));
+}
+
+int
+main (void)
+{
+ bar ();
+ abort ();
+ return 0;
+}

View File

@@ -0,0 +1,16 @@
2006-08-18 Jakub Jelinek <jakub@redhat.com>
PR c/27898
* gcc.dg/pr27898.c: New test.
--- gcc/testsuite/gcc.dg/pr27898.c.jj 2006-08-18 09:19:33.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr27898.c 2006-08-18 09:19:27.000000000 +0200
@@ -0,0 +1,8 @@
+/* PR c/27898 */
+/* { dg-do compile } */
+/* { dg-options "--combine" } */
+/* { dg-additional-sources "pr27898.c" } */
+
+union u { struct { int i; }; };
+
+extern int foo (union u *);

View File

@@ -0,0 +1,19 @@
2007-06-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/32139
* gcc.c-torture/compile/20070531-1.c: New test.
--- gcc/testsuite/gcc.c-torture/compile/20070531-1.c.jj 2007-05-31 13:47:22.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/20070531-1.c 2007-06-01 10:57:15.000000000 +0200
@@ -0,0 +1,11 @@
+/* PR tree-optimization/32139 */
+int foo (void);
+int bar (void) __attribute__ ((const));
+
+int
+test (int x)
+{
+ int a = (x == 10000 ? foo : bar) ();
+ int b = (x == 10000 ? foo : bar) ();
+ return a + b;
+}

View File

@@ -0,0 +1,159 @@
2007-11-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/33763
* gcc.dg/pr33763.c: New test.
* g++.dg/opt/inline13.C: New test.
2007-11-06 Jan Hubicka <jh@suse.cz>
PR tree-optimization/33763
* tree-inline.c (expand_call_inline): Silently ignore always_inline
attribute for redefined extern inline functions.
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c.orig 2010-03-18 13:07:13.000000000 -0700
+++ gcc/tree-inline.c 2010-06-25 10:18:51.230139825 -0700
@@ -3545,6 +3545,12 @@
goto egress;
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn))
+ /* For extern inline functions that get redefined we always
+ silently ignored alway_inline flag. Better behaviour would
+ be to be able to keep both bodies and use extern inline body
+ for inlining, but we can't do that because frontends overwrite
+ the body. */
+ && !cg_edge->callee->local.redefined_extern_inline
/* Avoid warnings during early inline pass. */
&& cgraph_global_info_ready)
{
Index: gcc/testsuite/gcc.dg/pr33763.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/pr33763.c 2010-06-25 10:18:51.234141302 -0700
@@ -0,0 +1,60 @@
+/* PR tree-optimization/33763 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct
+{
+ void *a;
+ void *b;
+} T;
+extern void *foo (const char *, const char *);
+extern void *bar (void *, const char *, T);
+extern int baz (const char *, int);
+
+extern inline __attribute__ ((always_inline, gnu_inline)) int
+baz (const char *x, int y)
+{
+ return 2;
+}
+
+int
+baz (const char *x, int y)
+{
+ return 1;
+}
+
+int xa, xb;
+
+static void *
+inl (const char *x, const char *y)
+{
+ T t = { &xa, &xb };
+ int *f = (int *) __builtin_malloc (sizeof (int));
+ const char *z;
+ int o = 0;
+ void *r = 0;
+
+ for (z = y; *z; z++)
+ {
+ if (*z == 'r')
+ o |= 1;
+ if (*z == 'w')
+ o |= 2;
+ }
+ if (o == 1)
+ *f = baz (x, 0);
+ if (o == 2)
+ *f = baz (x, 1);
+ if (o == 3)
+ *f = baz (x, 2);
+
+ if (o && *f > 0)
+ r = bar (f, "w", t);
+ return r;
+}
+
+void *
+foo (const char *x, const char *y)
+{
+ return inl (x, y);
+}
Index: gcc/testsuite/g++.dg/opt/inline13.C
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/g++.dg/opt/inline13.C 2010-06-25 10:18:51.261052137 -0700
@@ -0,0 +1,60 @@
+// PR tree-optimization/33763
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef struct
+{
+ void *a;
+ void *b;
+} T;
+extern void *foo (const char *, const char *);
+extern void *bar (void *, const char *, T);
+extern int baz (const char *, int);
+
+extern inline __attribute__ ((always_inline, gnu_inline)) int
+baz (const char *x, int y)
+{
+ return 2;
+}
+
+int
+baz (const char *x, int y)
+{
+ return 1;
+}
+
+int xa, xb;
+
+static void *
+inl (const char *x, const char *y)
+{
+ T t = { &xa, &xb };
+ int *f = (int *) __builtin_malloc (sizeof (int));
+ const char *z;
+ int o = 0;
+ void *r = 0;
+
+ for (z = y; *z; z++)
+ {
+ if (*z == 'r')
+ o |= 1;
+ if (*z == 'w')
+ o |= 2;
+ }
+ if (o == 1)
+ *f = baz (x, 0);
+ if (o == 2)
+ *f = baz (x, 1);
+ if (o == 3)
+ *f = baz (x, 2);
+
+ if (o && *f > 0)
+ r = bar (f, "w", t);
+ return r;
+}
+
+void *
+foo (const char *x, const char *y)
+{
+ return inl (x, y);
+}

View File

@@ -0,0 +1,89 @@
2008-04-01 Jakub Jelinek <jakub@redhat.com>
PR pch/13675
* files.c (struct _cpp_file): Remove pch field.
(pch_open_file): Don't set file->pch, just file->pchname.
(should_stack_file): After pfile->cb.read_pch call
free pchname and clear pchname, don't close file->fd.
Test file->pchname instead of file->pch. Don't close fd after cb.
(_cpp_stack_include): Test file->pchname instead of file->pch.
* c-pch.c (c_common_read_pch): On error close (fd) resp. fclose (f).
--- libcpp/files.c.jj 2008-02-18 23:50:17.000000000 +0100
+++ libcpp/files.c 2008-03-31 15:59:01.000000000 +0200
@@ -106,9 +106,6 @@ struct _cpp_file
/* If BUFFER above contains the true contents of the file. */
bool buffer_valid;
-
- /* File is a PCH (on return from find_include_file). */
- bool pch;
};
/* A singly-linked list for all searches for a given file name, with
@@ -322,9 +319,7 @@ pch_open_file (cpp_reader *pfile, _cpp_f
}
closedir (pchdir);
}
- if (valid)
- file->pch = true;
- else
+ if (!valid)
*invalid_pch = true;
}
@@ -703,11 +698,12 @@ should_stack_file (cpp_reader *pfile, _c
return false;
/* Handle PCH files immediately; don't stack them. */
- if (file->pch)
+ if (file->pchname)
{
pfile->cb.read_pch (pfile, file->pchname, file->fd, file->path);
- close (file->fd);
file->fd = -1;
+ free ((void *) file->pchname);
+ file->pchname = NULL;
return false;
}
@@ -916,7 +912,7 @@ _cpp_stack_include (cpp_reader *pfile, c
complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we
found a PCH file (in which case linemap_add is not called) or we
were included from the command-line. */
- if (! file->pch && file->err_no == 0 && type != IT_CMDLINE)
+ if (file->pchname == NULL && file->err_no == 0 && type != IT_CMDLINE)
pfile->line_table->highest_location--;
return _cpp_stack_file (pfile, file, type == IT_IMPORT);
--- gcc/c-pch.c.jj 2008-02-18 23:46:08.000000000 +0100
+++ gcc/c-pch.c 2008-03-31 15:56:00.000000000 +0200
@@ -372,6 +372,7 @@ c_common_read_pch (cpp_reader *pfile, co
if (f == NULL)
{
cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
+ close (fd);
return;
}
@@ -380,6 +381,7 @@ c_common_read_pch (cpp_reader *pfile, co
if (fread (&h, sizeof (h), 1, f) != 1)
{
cpp_errno (pfile, CPP_DL_ERROR, "reading");
+ fclose (f);
return;
}
@@ -425,7 +427,10 @@ c_common_read_pch (cpp_reader *pfile, co
gt_pch_restore (f);
if (cpp_read_state (pfile, name, f, smd) != 0)
- return;
+ {
+ fclose (f);
+ return;
+ }
fclose (f);

View File

@@ -0,0 +1,31 @@
2007-10-16 Jakub Jelinek <jakub@redhat.com>
* Makefile.am (libgcj_tools_la_LIBADD): Add.
* Makefile.in: Regenerated.
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am.orig 2010-03-21 12:41:37.000000000 -0700
+++ libjava/Makefile.am 2010-06-25 10:22:11.394130458 -0700
@@ -507,6 +507,8 @@
libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch \
-fno-bootstrap-classes -fno-indirect-classes \
-fsource-filename=$(here)/classpath/tools/all-classes.lst
+## See jv_convert_LDADD.
+libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la
libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF)
Index: libjava/Makefile.in
===================================================================
--- libjava/Makefile.in.orig 2010-04-02 11:18:06.000000000 -0700
+++ libjava/Makefile.in 2010-06-25 10:27:41.841708512 -0700
@@ -1190,7 +1190,7 @@
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF)
-libgcj_tools_la_LIBADD = libgcj.la -lm
+libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la -lm
libgcj_tools_la_DEPENDENCIES = libgcj.la libgcj.spec $(am__append_22)
libgcj_tools_la_LINK = $(LIBLINK) $(libgcj_tools_la_LDFLAGS)
libjvm_la_SOURCES = jni-libjvm.cc

View File

@@ -0,0 +1,32 @@
2007-10-21 Jakub Jelinek <jakub@redhat.com>
* doc/Makefile.am (POD2MAN): Set date from cp-tools.texinfo
timestamp rather than from current date.
* doc/Makefile.in: Regenerated.
Index: libjava/classpath/doc/Makefile.am
===================================================================
--- libjava/classpath/doc/Makefile.am.orig 2008-10-21 10:55:01.000000000 -0700
+++ libjava/classpath/doc/Makefile.am 2010-06-25 10:28:30.237631599 -0700
@@ -31,7 +31,7 @@
gtnameserv.1 \
gjdoc.1
-POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
+POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date="$(shell ls --time-style=+%F -l $(srcdir)/cp-tools.texinfo | awk '{print $$6}')"
TEXI2POD = perl $(srcdir)/texi2pod.pl
STAMP = echo timestamp >
Index: libjava/classpath/doc/Makefile.in
===================================================================
--- libjava/classpath/doc/Makefile.in.orig 2010-04-02 11:18:06.000000000 -0700
+++ libjava/classpath/doc/Makefile.in 2010-06-25 10:28:30.245635728 -0700
@@ -376,7 +376,7 @@
gtnameserv.1 \
gjdoc.1
-POD2MAN = pod2man --center="GNU" --release="$(VERSION)"
+POD2MAN = pod2man --center="GNU" --release="$(VERSION)" --date="$(shell ls --time-style=+%F -l $(srcdir)/cp-tools.texinfo | awk '{print $$6}')"
TEXI2POD = perl $(srcdir)/texi2pod.pl
STAMP = echo timestamp >
@GENINSRC_FALSE@STAMP_GENINSRC =

View File

@@ -0,0 +1,30 @@
* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
directory.
Index: gcc-4.5+svnr155514/libgfortran/configure
===================================================================
--- gcc-4.5+svnr155514.orig/libgfortran/configure 2009-12-29 22:02:01.000000000 -0800
+++ gcc-4.5+svnr155514/libgfortran/configure 2009-12-30 08:12:40.889091657 -0800
@@ -11655,7 +11655,7 @@ CC="$lt_save_CC"
# We need gfortran to compile parts of the library
#AC_PROG_FC(gfortran)
-FC="$GFORTRAN"
+#FC="$GFORTRAN"
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
Index: gcc-4.5+svnr155514/libgfortran/configure.ac
===================================================================
--- gcc-4.5+svnr155514.orig/libgfortran/configure.ac 2009-12-29 22:02:01.000000000 -0800
+++ gcc-4.5+svnr155514/libgfortran/configure.ac 2009-12-30 08:12:13.453094218 -0800
@@ -187,7 +187,7 @@ AC_SUBST(enable_static)
# We need gfortran to compile parts of the library
#AC_PROG_FC(gfortran)
-FC="$GFORTRAN"
+#FC="$GFORTRAN"
AC_PROG_FC(gfortran)
# extra LD Flags which are required for targets

View File

@@ -0,0 +1,319 @@
Adds support for Freescale Power architecture e300c2 and e300c3 cores.
http://www.bitshrine.org/gpp/tc-fsl-x86lnx-e300c3-nptl-4.0.2-2.src.rpm
Leon Woestenberg <leonw@mailcan.com>
---
gcc/config.gcc | 2
gcc/config/rs6000/e300c2c3.md | 189 ++++++++++++++++++++++++++++++++++++++++++
gcc/config/rs6000/rs6000.c | 24 +++++
gcc/config/rs6000/rs6000.h | 4
gcc/config/rs6000/rs6000.md | 3
5 files changed, 220 insertions(+), 2 deletions(-)
Index: gcc-4.3.1/gcc/config/rs6000/e300c2c3.md
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc-4.3.1/gcc/config/rs6000/e300c2c3.md 2008-08-23 16:51:33.000000000 -0700
@@ -0,0 +1,189 @@
+;; Pipeline description for Motorola PowerPC e300c3 core.
+;; Copyright (C) 2003 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 2, or (at your
+;; option) any later version.
+
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING. If not, write to the
+;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+;; MA 02111-1307, USA.
+
+(define_automaton "ppce300c3_most,ppce300c3_long,ppce300c3_retire")
+(define_cpu_unit "ppce300c3_decode_0,ppce300c3_decode_1" "ppce300c3_most")
+
+;; We don't simulate general issue queue (GIC). If we have SU insn
+;; and then SU1 insn, they can not be issued on the same cycle
+;; (although SU1 insn and then SU insn can be issued) because the SU
+;; insn will go to SU1 from GIC0 entry. Fortunately, the first cycle
+;; multipass insn scheduling will find the situation and issue the SU1
+;; insn and then the SU insn.
+(define_cpu_unit "ppce300c3_issue_0,ppce300c3_issue_1" "ppce300c3_most")
+
+;; We could describe completion buffers slots in combination with the
+;; retirement units and the order of completion but the result
+;; automaton would behave in the same way because we can not describe
+;; real latency time with taking in order completion into account.
+;; Actually we could define the real latency time by querying reserved
+;; automaton units but the current scheduler uses latency time before
+;; issuing insns and making any reservations.
+;;
+;; So our description is aimed to achieve a insn schedule in which the
+;; insns would not wait in the completion buffer.
+(define_cpu_unit "ppce300c3_retire_0,ppce300c3_retire_1" "ppce300c3_retire")
+
+;; Branch unit:
+(define_cpu_unit "ppce300c3_bu" "ppce300c3_most")
+
+;; IU:
+(define_cpu_unit "ppce300c3_iu0_stage0,ppce300c3_iu1_stage0" "ppce300c3_most")
+
+;; IU: This used to describe non-pipelined division.
+(define_cpu_unit "ppce300c3_mu_div" "ppce300c3_long")
+
+;; SRU:
+(define_cpu_unit "ppce300c3_sru_stage0" "ppce300c3_most")
+
+;; Here we simplified LSU unit description not describing the stages.
+(define_cpu_unit "ppce300c3_lsu" "ppce300c3_most")
+
+;; FPU:
+(define_cpu_unit "ppce300c3_fpu" "ppce300c3_most")
+
+;; The following units are used to make automata deterministic
+(define_cpu_unit "present_ppce300c3_decode_0" "ppce300c3_most")
+(define_cpu_unit "present_ppce300c3_issue_0" "ppce300c3_most")
+(define_cpu_unit "present_ppce300c3_retire_0" "ppce300c3_retire")
+(define_cpu_unit "present_ppce300c3_iu0_stage0" "ppce300c3_most")
+
+;; The following sets to make automata deterministic when option ndfa is used.
+(presence_set "present_ppce300c3_decode_0" "ppce300c3_decode_0")
+(presence_set "present_ppce300c3_issue_0" "ppce300c3_issue_0")
+(presence_set "present_ppce300c3_retire_0" "ppce300c3_retire_0")
+(presence_set "present_ppce300c3_iu0_stage0" "ppce300c3_iu0_stage0")
+
+;; Some useful abbreviations.
+(define_reservation "ppce300c3_decode"
+ "ppce300c3_decode_0|ppce300c3_decode_1+present_ppce300c3_decode_0")
+(define_reservation "ppce300c3_issue"
+ "ppce300c3_issue_0|ppce300c3_issue_1+present_ppce300c3_issue_0")
+(define_reservation "ppce300c3_retire"
+ "ppce300c3_retire_0|ppce300c3_retire_1+present_ppce300c3_retire_0")
+(define_reservation "ppce300c3_iu_stage0"
+ "ppce300c3_iu0_stage0|ppce300c3_iu1_stage0+present_ppce300c3_iu0_stage0")
+
+;; Compares can be executed either one of the IU or SRU
+(define_insn_reservation "ppce300c3_cmp" 1
+ (and (eq_attr "type" "cmp,compare,delayed_compare,fast_compare")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+(ppce300c3_iu_stage0|ppce300c3_sru_stage0) \
+ +ppce300c3_retire")
+
+;; Other one cycle IU insns
+(define_insn_reservation "ppce300c3_iu" 1
+ (and (eq_attr "type" "integer,insert_word")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_retire")
+
+;; Branch. Actually this latency time is not used by the scheduler.
+(define_insn_reservation "ppce300c3_branch" 1
+ (and (eq_attr "type" "jmpreg,branch")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_bu,ppce300c3_retire")
+
+;; Multiply is non-pipelined but can be executed in any IU
+(define_insn_reservation "ppce300c3_multiply" 2
+ (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0, \
+ ppce300c3_iu_stage0+ppce300c3_retire")
+
+;; Divide. We use the average latency time here. We omit reserving a
+;; retire unit because of the result automata will be huge.
+(define_insn_reservation "ppce300c3_divide" 20
+ (and (eq_attr "type" "idiv")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_mu_div,\
+ ppce300c3_mu_div*19")
+
+;; CR logical
+(define_insn_reservation "ppce300c3_cr_logical" 1
+ (and (eq_attr "type" "cr_logical,delayed_cr")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
+
+;; Mfcr
+(define_insn_reservation "ppce300c3_mfcr" 1
+ (and (eq_attr "type" "mfcr")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
+
+;; Mtcrf
+(define_insn_reservation "ppce300c3_mtcrf" 1
+ (and (eq_attr "type" "mtcr")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
+
+;; Mtjmpr
+(define_insn_reservation "ppce300c3_mtjmpr" 1
+ (and (eq_attr "type" "mtjmpr,mfjmpr")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
+
+;; Float point instructions
+(define_insn_reservation "ppce300c3_fpcompare" 3
+ (and (eq_attr "type" "fpcompare")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire")
+
+(define_insn_reservation "ppce300c3_fp" 3
+ (and (eq_attr "type" "fp")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire")
+
+(define_insn_reservation "ppce300c3_dmul" 4
+ (and (eq_attr "type" "dmul")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu,nothing,ppce300c3_retire")
+
+; Divides are not pipelined
+(define_insn_reservation "ppce300c3_sdiv" 18
+ (and (eq_attr "type" "sdiv")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*17")
+
+(define_insn_reservation "ppce300c3_ddiv" 33
+ (and (eq_attr "type" "ddiv")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*32")
+
+;; Loads
+(define_insn_reservation "ppce300c3_load" 2
+ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
+
+(define_insn_reservation "ppce300c3_fpload" 2
+ (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
+
+;; Stores.
+(define_insn_reservation "ppce300c3_store" 2
+ (and (eq_attr "type" "store,store_ux,store_u")
+ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
+
+(define_insn_reservation "ppce300c3_fpstore" 2
+ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
+ (eq_attr "cpu" "ppce300c3"))
+ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire")
Index: gcc-4.3.1/gcc/config/rs6000/rs6000.c
===================================================================
--- gcc-4.3.1.orig/gcc/config/rs6000/rs6000.c 2008-08-23 16:49:39.000000000 -0700
+++ gcc-4.3.1/gcc/config/rs6000/rs6000.c 2008-08-23 16:54:25.000000000 -0700
@@ -669,6 +669,21 @@ struct processor_costs ppc8540_cost = {
1, /* prefetch streams /*/
};
+/* Instruction costs on E300C2 and E300C3 cores. */
+static const
+struct processor_costs ppce300c2c3_cost = {
+ COSTS_N_INSNS (4), /* mulsi */
+ COSTS_N_INSNS (4), /* mulsi_const */
+ COSTS_N_INSNS (4), /* mulsi_const9 */
+ COSTS_N_INSNS (4), /* muldi */
+ COSTS_N_INSNS (19), /* divsi */
+ COSTS_N_INSNS (19), /* divdi */
+ COSTS_N_INSNS (3), /* fp */
+ COSTS_N_INSNS (4), /* dmul */
+ COSTS_N_INSNS (18), /* sdiv */
+ COSTS_N_INSNS (33), /* ddiv */
+};
+
/* Instruction costs on POWER4 and POWER5 processors. */
static const
struct processor_costs power4_cost = {
@@ -1420,6 +1435,8 @@ rs6000_override_options (const char *def
{"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN},
/* 8548 has a dummy entry for now. */
{"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN},
+ {"e300c2", PROCESSOR_PPCE300C2, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
+ {"e300c3", PROCESSOR_PPCE300C3, POWERPC_BASE_MASK},
{"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
{"970", PROCESSOR_POWER4,
POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
@@ -1845,6 +1862,11 @@ rs6000_override_options (const char *def
rs6000_cost = &ppc8540_cost;
break;
+ case PROCESSOR_PPCE300C2:
+ case PROCESSOR_PPCE300C3:
+ rs6000_cost = &ppce300c2c3_cost;
+ break;
+
case PROCESSOR_POWER4:
case PROCESSOR_POWER5:
rs6000_cost = &power4_cost;
@@ -18606,6 +18628,8 @@ rs6000_issue_rate (void)
case CPU_PPC7400:
case CPU_PPC8540:
case CPU_CELL:
+ case CPU_PPCE300C2:
+ case CPU_PPCE300C3:
return 2;
case CPU_RIOS2:
case CPU_PPC604:
Index: gcc-4.3.1/gcc/config/rs6000/rs6000.h
===================================================================
--- gcc-4.3.1.orig/gcc/config/rs6000/rs6000.h 2008-01-26 09:18:35.000000000 -0800
+++ gcc-4.3.1/gcc/config/rs6000/rs6000.h 2008-08-23 16:55:30.000000000 -0700
@@ -117,6 +117,8 @@
%{mcpu=G5: -mpower4 -maltivec} \
%{mcpu=8540: -me500} \
%{mcpu=8548: -me500} \
+%{mcpu=e300c2: -mppc} \
+%{mcpu=e300c3: -mppc -mpmr} \
%{maltivec: -maltivec} \
-many"
@@ -262,6 +264,8 @@ enum processor_type
PROCESSOR_PPC7400,
PROCESSOR_PPC7450,
PROCESSOR_PPC8540,
+ PROCESSOR_PPCE300C2,
+ PROCESSOR_PPCE300C3,
PROCESSOR_POWER4,
PROCESSOR_POWER5,
PROCESSOR_POWER6,
Index: gcc-4.3.1/gcc/config/rs6000/rs6000.md
===================================================================
--- gcc-4.3.1.orig/gcc/config/rs6000/rs6000.md 2008-02-13 16:14:45.000000000 -0800
+++ gcc-4.3.1/gcc/config/rs6000/rs6000.md 2008-08-23 16:57:29.000000000 -0700
@@ -133,7 +133,7 @@
;; Processor type -- this attribute must exactly match the processor_type
;; enumeration in rs6000.h.
-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell"
+(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell,ppce300c2,ppce300c3"
(const (symbol_ref "rs6000_cpu_attr")))
@@ -166,6 +166,7 @@
(include "7xx.md")
(include "7450.md")
(include "8540.md")
+(include "e300c2c3.md")
(include "power4.md")
(include "power5.md")
(include "power6.md")
Index: gcc-4.3.1/gcc/config.gcc
===================================================================
--- gcc-4.3.1.orig/gcc/config.gcc 2008-08-23 16:49:43.000000000 -0700
+++ gcc-4.3.1/gcc/config.gcc 2008-08-23 17:03:55.000000000 -0700
@@ -3144,7 +3144,7 @@ case "${target}" in
| rios | rios1 | rios2 | rsc | rsc1 | rs64a \
| 401 | 403 | 405 | 405fp | 440 | 440fp | 505 \
| 601 | 602 | 603 | 603e | ec603e | 604 \
- | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
+ | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | e300c[23] \
| 854[08] | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
# OK
;;

View File

@@ -0,0 +1,31 @@
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: gcc-4.3.1/configure.ac
===================================================================
--- gcc-4.3.1.orig/configure.ac 2008-07-21 12:29:18.000000000 -0700
+++ gcc-4.3.1/configure.ac 2008-07-21 12:29:35.000000000 -0700
@@ -2352,7 +2352,7 @@ fi
# for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}"
-FLAGS_FOR_TARGET=
+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
case " $target_configdirs " in
*" newlib "*)
case " $target_configargs " in
Index: gcc-4.3.1/configure
===================================================================
--- gcc-4.3.1.orig/configure 2008-07-21 12:29:48.000000000 -0700
+++ gcc-4.3.1/configure 2008-07-21 12:29:59.000000000 -0700
@@ -5841,7 +5841,7 @@ fi
# for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}"
-FLAGS_FOR_TARGET=
+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
case " $target_configdirs " in
*" newlib "*)
case " $target_configargs " in

View File

@@ -0,0 +1,114 @@
Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
Other changes I had to do include:
- moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
- passing the right CFLAGS to configure scripts as exported environment variables
I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
Paolo
2008-02-19 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/32009
PR bootstrap/32161
* configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here.
* configure: Regenerate.
* Makefile.def: Define stage_libcflags for all bootstrap stages.
* Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS,
STAGE4_LIBCFLAGS): New.
(CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without
$(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
(BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS.
(EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS.
(configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags
for target modules. Don't export LIBCFLAGS.
(all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass
$(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after
the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
(invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with
$(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS).
* Makefile.in: Regenerate.
config:
2008-02-19 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/32009
* mh-ppc-darwin (BOOT_CFLAGS): Reenable.
gcc:
2008-02-19 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/32009
* doc/install.texi: Correct references to CFLAGS, replacing them
with BOOT_CFLAGS. Document flags used during bootstrap for
target libraries.
---
Makefile.def | 25
Makefile.in | 1845 ++++++++++++++++++++++++++++++-------------------
Makefile.tpl | 91 +-
config/mh-ppc-darwin | 3
configure | 36
configure.ac | 32
gcc/Makefile.in | 2
gcc/configure | 6
gcc/configure.ac | 3
gcc/doc/install.texi | 56 -
libiberty/Makefile.in | 162 ++--
libiberty/configure | 46 -
libiberty/configure.ac | 43 -
13 files changed, 1454 insertions(+), 896 deletions(-)
Index: gcc-4.5.0/configure
===================================================================
--- gcc-4.5.0.orig/configure 2010-06-25 14:51:59.409382073 -0700
+++ gcc-4.5.0/configure 2010-06-25 14:52:35.157132702 -0700
@@ -7130,6 +7130,38 @@
fi
+# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
+# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
+# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
+# We want to ensure that TARGET libraries (which we know are built with
+# gcc) are built with "-O2 -g", so include those options when setting
+# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
+if test "x$CFLAGS_FOR_TARGET" = x; then
+ CFLAGS_FOR_TARGET=$CFLAGS
+ case " $CFLAGS " in
+ *" -O2 "*) ;;
+ *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
+ esac
+ case " $CFLAGS " in
+ *" -g "* | *" -g3 "*) ;;
+ *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
+ esac
+fi
+
+
+if test "x$CXXFLAGS_FOR_TARGET" = x; then
+ CXXFLAGS_FOR_TARGET=$CXXFLAGS
+ case " $CXXFLAGS " in
+ *" -O2 "*) ;;
+ *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
+ esac
+ case " $CXXFLAGS " in
+ *" -g "* | *" -g3 "*) ;;
+ *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
+ esac
+fi
+
+
# Handle --with-headers=XXX. If the value is not "yes", the contents of
# the named directory are copied to $(tooldir)/sys-include.
if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then

View File

@@ -0,0 +1,25 @@
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35964
Index: gcc-4.3.0/gcc/regrename.c
===================================================================
--- gcc-4.3.0.orig/gcc/regrename.c 2008-05-28 08:31:15.000000000 -0700
+++ gcc-4.3.0/gcc/regrename.c 2008-05-28 08:34:00.000000000 -0700
@@ -782,6 +782,10 @@
|| (predicated && recog_data.operand_type[i] == OP_OUT))
recog_data.operand_type[i] = OP_INOUT;
}
+ /* Unshare dup_loc RTL */
+ for (i = 0; i < recog_data.n_dups; i++)
+ *recog_data.dup_loc[i] = copy_rtx(*recog_data.dup_loc[i]);
+
/* Step 1: Close chains for which we have overlapping reads. */
for (i = 0; i < n_ops; i++)
@@ -813,7 +817,7 @@
OP_IN, 0);
for (i = 0; i < recog_data.n_dups; i++)
- *recog_data.dup_loc[i] = copy_rtx (old_dups[i]);
+ *recog_data.dup_loc[i] = old_dups[i];
for (i = 0; i < n_ops; i++)
*recog_data.operand_loc[i] = old_operands[i];
if (recog_data.n_dups)

View File

@@ -0,0 +1,178 @@
Index: gcc-4.5/Makefile.def
===================================================================
--- gcc-4.5.orig/Makefile.def
+++ gcc-4.5/Makefile.def
@@ -240,6 +240,7 @@ flags_to_pass = { flag= AWK ; };
flags_to_pass = { flag= BISON ; };
flags_to_pass = { flag= CC_FOR_BUILD ; };
flags_to_pass = { flag= CFLAGS_FOR_BUILD ; };
+flags_to_pass = { flag= CPPFLAGS_FOR_BUILD ; };
flags_to_pass = { flag= CXX_FOR_BUILD ; };
flags_to_pass = { flag= EXPECT ; };
flags_to_pass = { flag= FLEX ; };
Index: gcc-4.5/gcc/Makefile.in
===================================================================
--- gcc-4.5.orig/gcc/Makefile.in
+++ gcc-4.5/gcc/Makefile.in
@@ -766,7 +766,7 @@ BUILD_LINKERFLAGS = $(BUILD_CFLAGS)
# Native linker and preprocessor flags. For x-fragment overrides.
BUILD_LDFLAGS=@BUILD_LDFLAGS@
-BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
+BUILD_CPPFLAGS=$(INCLUDES) @BUILD_CPPFLAGS@ $(X_CPPFLAGS)
# Actual name to use when installing a native compiler.
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
Index: gcc-4.5/gcc/configure.ac
===================================================================
--- gcc-4.5.orig/gcc/configure.ac
+++ gcc-4.5/gcc/configure.ac
@@ -1798,16 +1798,18 @@ AC_SUBST(inhibit_libc)
# Also, we cannot run fixincludes.
# These are the normal (build=host) settings:
-CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
-BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
-BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
-STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
+CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD)
+BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS)
+BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS)
+BUILD_CPPFLAGS='$(ALL_CPPFLAGS)' AC_SUBST(BUILD_CPPFLAGS)
+STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC)
# And these apply if build != host, or we are generating coverage data
if test x$build != x$host || test "x$coverage_flags" != x
then
BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
+ BUILD_CPPFLAGS='$(CPPFLAGS_FOR_BUILD)'
fi
# Expand extra_headers to include complete path.
Index: gcc-4.5/Makefile.in
===================================================================
--- gcc-4.5.orig/Makefile.in
+++ gcc-4.5/Makefile.in
@@ -333,6 +333,7 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
AS_FOR_BUILD = @AS_FOR_BUILD@
CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
CXX_FOR_BUILD = @CXX_FOR_BUILD@
DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
@@ -662,6 +663,7 @@ BASE_FLAGS_TO_PASS = \
"BISON=$(BISON)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CPPFLAGS_FOR_BUILD=$(CPPFLAGS_FOR_BUILD)" \
"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
"EXPECT=$(EXPECT)" \
"FLEX=$(FLEX)" \
Index: gcc-4.5/gcc/configure
===================================================================
--- gcc-4.5.orig/gcc/configure
+++ gcc-4.5/gcc/configure
@@ -707,6 +707,7 @@ SED
LIBTOOL
collect2
STMP_FIXINC
+BUILD_CPPFLAGS
BUILD_LDFLAGS
BUILD_CFLAGS
CC_FOR_BUILD
@@ -10982,6 +10983,7 @@ fi
CC_FOR_BUILD='$(CC)'
BUILD_CFLAGS='$(ALL_CFLAGS)'
BUILD_LDFLAGS='$(LDFLAGS)'
+BUILD_CPPFLAGS='$(ALL_CPPFLAGS)'
STMP_FIXINC=stmp-fixinc
# And these apply if build != host, or we are generating coverage data
@@ -10989,6 +10991,7 @@ if test x$build != x$host || test "x$cov
then
BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
+ BUILD_CPPFLAGS='$(CPPFLAGS_FOR_BUILD)'
fi
# Expand extra_headers to include complete path.
@@ -17108,7 +17111,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17111 "configure"
+#line 17114 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17214,7 +17217,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17217 "configure"
+#line 17220 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
Index: gcc-4.5/Makefile.tpl
===================================================================
--- gcc-4.5.orig/Makefile.tpl
+++ gcc-4.5/Makefile.tpl
@@ -336,6 +336,7 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
AS_FOR_BUILD = @AS_FOR_BUILD@
CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
CXX_FOR_BUILD = @CXX_FOR_BUILD@
DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
Index: gcc-4.5/configure
===================================================================
--- gcc-4.5.orig/configure
+++ gcc-4.5/configure
@@ -651,6 +651,7 @@ GCJ_FOR_BUILD
DLLTOOL_FOR_BUILD
CXX_FOR_BUILD
CXXFLAGS_FOR_BUILD
+CPPFLAGS_FOR_BUILD
CFLAGS_FOR_BUILD
CC_FOR_BUILD
AS_FOR_BUILD
@@ -8036,6 +8037,7 @@ esac
# our build compiler if desired.
if test x"${build}" = x"${host}" ; then
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
fi
@@ -8101,6 +8103,7 @@ done
+
Index: gcc-4.5/configure.ac
===================================================================
--- gcc-4.5.orig/configure.ac
+++ gcc-4.5/configure.ac
@@ -3089,6 +3089,7 @@ esac
# our build compiler if desired.
if test x"${build}" = x"${host}" ; then
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
fi
@@ -3155,6 +3156,7 @@ AC_SUBST(AR_FOR_BUILD)
AC_SUBST(AS_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
+AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(CXXFLAGS_FOR_BUILD)
AC_SUBST(CXX_FOR_BUILD)
AC_SUBST(DLLTOOL_FOR_BUILD)

View File

@@ -0,0 +1,331 @@
#! /bin/sh -e
# DP: Retry the build on an ice, save the calling options and preprocessed
# DP: source when the ice is reproducible.
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
2004-01-23 Jakub Jelinek <jakub@redhat.com>
* system.h (ICE_EXIT_CODE): Define.
* gcc.c (execute): Don't free first string early, but at the end
of the function. Call retry_ice if compiler exited with
ICE_EXIT_CODE.
(retry_ice): New function.
* diagnostic.c (diagnostic_count_diagnostic,
diagnostic_action_after_output, error_recursion): Exit with
ICE_EXIT_CODE instead of FATAL_EXIT_CODE.
--- gcc/diagnostic.c.orig 2007-09-30 10:48:13.000000000 +0000
+++ gcc/diagnostic.c 2007-09-30 10:49:57.000000000 +0000
@@ -244,7 +244,7 @@
fnotice (stderr, "Please submit a full bug report,\n"
"with preprocessed source if appropriate.\n"
"See %s for instructions.\n", bug_report_url);
- exit (ICE_EXIT_CODE);
+ exit (FATAL_EXIT_CODE);
case DK_FATAL:
if (context->abort_on_error)
--- gcc/gcc.c.orig 2007-09-30 10:48:13.000000000 +0000
+++ gcc/gcc.c 2007-09-30 10:48:39.000000000 +0000
@@ -357,6 +357,9 @@
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
static const char *convert_filename (const char *, int, int);
#endif
+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
+static void retry_ice (const char *prog, const char **argv);
+#endif
static const char *getenv_spec_function (int, const char **);
static const char *if_exists_spec_function (int, const char **);
@@ -2999,7 +3002,7 @@
}
}
- if (string != commands[i].prog)
+ if (i && string != commands[i].prog)
free (CONST_CAST (char *, string));
}
@@ -3056,6 +3059,16 @@
else if (WIFEXITED (status)
&& WEXITSTATUS (status) >= MIN_FATAL_STATUS)
{
+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
+ /* For ICEs in cc1, cc1obj, cc1plus see if it is
+ reproducible or not. */
+ char *p;
+ if (WEXITSTATUS (status) == ICE_EXIT_CODE
+ && i == 0
+ && (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
+ && ! strncmp (p + 1, "cc1", 3))
+ retry_ice (commands[0].prog, commands[0].argv);
+#endif
if (WEXITSTATUS (status) > greatest_status)
greatest_status = WEXITSTATUS (status);
ret_code = -1;
@@ -3076,6 +3089,9 @@
}
}
+ if (commands[0].argv[0] != commands[0].prog)
+ free ((PTR) commands[0].argv[0]);
+
return ret_code;
}
}
@@ -6016,6 +6032,224 @@
switches[switchnum].validated = 1;
}
+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
+#define RETRY_ICE_ATTEMPTS 2
+
+static void
+retry_ice (const char *prog, const char **argv)
+{
+ int nargs, out_arg = -1, quiet = 0, attempt;
+ int pid, retries, sleep_interval;
+ const char **new_argv;
+ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2];
+
+ if (input_filename == NULL || ! strcmp (input_filename, "-"))
+ return;
+
+ for (nargs = 0; argv[nargs] != NULL; ++nargs)
+ /* Only retry compiler ICEs, not preprocessor ones. */
+ if (! strcmp (argv[nargs], "-E"))
+ return;
+ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o')
+ {
+ if (out_arg == -1)
+ out_arg = nargs;
+ else
+ return;
+ }
+ /* If the compiler is going to output any time information,
+ it might vary between invocations. */
+ else if (! strcmp (argv[nargs], "-quiet"))
+ quiet = 1;
+ else if (! strcmp (argv[nargs], "-ftime-report"))
+ return;
+
+ if (out_arg == -1 || !quiet)
+ return;
+
+ memset (temp_filenames, '\0', sizeof (temp_filenames));
+ new_argv = alloca ((nargs + 3) * sizeof (const char *));
+ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *));
+ new_argv[nargs++] = "-frandom-seed=0";
+ new_argv[nargs] = NULL;
+ if (new_argv[out_arg][2] == '\0')
+ new_argv[out_arg + 1] = "-";
+ else
+ new_argv[out_arg] = "-o-";
+
+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt)
+ {
+ int fd = -1;
+ int status;
+
+ temp_filenames[attempt * 2] = make_temp_file (".out");
+ temp_filenames[attempt * 2 + 1] = make_temp_file (".err");
+
+ if (attempt == RETRY_ICE_ATTEMPTS)
+ {
+ int i;
+ int fd1, fd2;
+ struct stat st1, st2;
+ size_t n, len;
+ char *buf;
+
+ buf = xmalloc (8192);
+
+ for (i = 0; i < 2; ++i)
+ {
+ fd1 = open (temp_filenames[i], O_RDONLY);
+ fd2 = open (temp_filenames[2 + i], O_RDONLY);
+
+ if (fd1 < 0 || fd2 < 0)
+ {
+ i = -1;
+ close (fd1);
+ close (fd2);
+ break;
+ }
+
+ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0)
+ {
+ i = -1;
+ close (fd1);
+ close (fd2);
+ break;
+ }
+
+ if (st1.st_size != st2.st_size)
+ {
+ close (fd1);
+ close (fd2);
+ break;
+ }
+
+ len = 0;
+ for (n = st1.st_size; n; n -= len)
+ {
+ len = n;
+ if (len > 4096)
+ len = 4096;
+
+ if (read (fd1, buf, len) != (int) len
+ || read (fd2, buf + 4096, len) != (int) len)
+ {
+ i = -1;
+ break;
+ }
+
+ if (memcmp (buf, buf + 4096, len) != 0)
+ break;
+ }
+
+ close (fd1);
+ close (fd2);
+
+ if (n)
+ break;
+ }
+
+ free (buf);
+ if (i == -1)
+ break;
+
+ if (i != 2)
+ {
+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
+ break;
+ }
+
+ fd = open (temp_filenames[attempt * 2], O_RDWR);
+ if (fd < 0)
+ break;
+ write (fd, "//", 2);
+ for (i = 0; i < nargs; i++)
+ {
+ write (fd, " ", 1);
+ write (fd, new_argv[i], strlen (new_argv[i]));
+ }
+ write (fd, "\n", 1);
+ new_argv[nargs] = "-E";
+ new_argv[nargs + 1] = NULL;
+ }
+
+ /* Fork a subprocess; wait and retry if it fails. */
+ sleep_interval = 1;
+ pid = -1;
+ for (retries = 0; retries < 4; retries++)
+ {
+ pid = fork ();
+ if (pid >= 0)
+ break;
+ sleep (sleep_interval);
+ sleep_interval *= 2;
+ }
+
+ if (pid < 0)
+ break;
+ else if (pid == 0)
+ {
+ if (attempt != RETRY_ICE_ATTEMPTS)
+ fd = open (temp_filenames[attempt * 2], O_RDWR);
+ if (fd < 0)
+ exit (-1);
+ if (fd != 1)
+ {
+ close (1);
+ dup (fd);
+ close (fd);
+ }
+
+ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR);
+ if (fd < 0)
+ exit (-1);
+ if (fd != 2)
+ {
+ close (2);
+ dup (fd);
+ close (fd);
+ }
+
+ if (prog == new_argv[0])
+ execvp (prog, (char *const *) new_argv);
+ else
+ execv (new_argv[0], (char *const *) new_argv);
+ exit (-1);
+ }
+
+ if (waitpid (pid, &status, 0) < 0)
+ break;
+
+ if (attempt < RETRY_ICE_ATTEMPTS
+ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE))
+ {
+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
+ break;
+ }
+ else if (attempt == RETRY_ICE_ATTEMPTS)
+ {
+ close (fd);
+ if (WIFEXITED (status)
+ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE)
+ {
+ notice ("Preprocessed source stored into %s file, please attach this to your bugreport.\n",
+ temp_filenames[attempt * 2]);
+ /* Make sure it is not deleted. */
+ free (temp_filenames[attempt * 2]);
+ temp_filenames[attempt * 2] = NULL;
+ break;
+ }
+ }
+ }
+
+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++)
+ if (temp_filenames[attempt])
+ {
+ unlink (temp_filenames[attempt]);
+ free (temp_filenames[attempt]);
+ }
+}
+#endif
+
/* Search for a file named NAME trying various prefixes including the
user's -B prefix and some standard ones.
Return the absolute file name found. If nothing is found, return NAME. */
--- gcc/Makefile.in.orig 2007-09-30 10:48:13.000000000 +0000
+++ gcc/Makefile.in 2007-09-30 10:48:39.000000000 +0000
@@ -192,6 +192,7 @@
build/gengtype-lex.o-warn = -Wno-error
# SYSCALLS.c misses prototypes
SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error
+build/gcc.o-warn = -Wno-error
# All warnings have to be shut off in stage1 if the compiler used then
# isn't gcc; configure determines that. WARN_CFLAGS will be either

View File

@@ -0,0 +1,130 @@
2010-10-15 Chung-Lin Tang <cltang@codesourcery.com>
Backport from mainline:
2010-10-15 Chung-Lin Tang <cltang@codesourcery.com>
gcc/
* ifcvt.c (find_active_insn_before): New function.
(find_active_insn_after): New function.
(cond_exec_process_if_block): Use new functions to replace
prev_active_insn() and next_active_insn().
gcc/testsuite/
* gcc.dg/20101010-1.c: New testcase.
=== modified file 'gcc/ifcvt.c'
Index: gcc-4.5/gcc/ifcvt.c
===================================================================
--- gcc-4.5.orig/gcc/ifcvt.c
+++ gcc-4.5/gcc/ifcvt.c
@@ -88,6 +88,8 @@ static int count_bb_insns (const_basic_b
static bool cheap_bb_rtx_cost_p (const_basic_block, int);
static rtx first_active_insn (basic_block);
static rtx last_active_insn (basic_block, int);
+static rtx find_active_insn_before (basic_block, rtx);
+static rtx find_active_insn_after (basic_block, rtx);
static basic_block block_fallthru (basic_block);
static int cond_exec_process_insns (ce_if_block_t *, rtx, rtx, rtx, rtx, int);
static rtx cond_exec_get_condition (rtx);
@@ -230,6 +232,48 @@ last_active_insn (basic_block bb, int sk
return insn;
}
+/* Return the active insn before INSN inside basic block CURR_BB. */
+
+static rtx
+find_active_insn_before (basic_block curr_bb, rtx insn)
+{
+ if (!insn || insn == BB_HEAD (curr_bb))
+ return NULL_RTX;
+
+ while ((insn = PREV_INSN (insn)) != NULL_RTX)
+ {
+ if (NONJUMP_INSN_P (insn) || JUMP_P (insn) || CALL_P (insn))
+ break;
+
+ /* No other active insn all the way to the start of the basic block. */
+ if (insn == BB_HEAD (curr_bb))
+ return NULL_RTX;
+ }
+
+ return insn;
+}
+
+/* Return the active insn after INSN inside basic block CURR_BB. */
+
+static rtx
+find_active_insn_after (basic_block curr_bb, rtx insn)
+{
+ if (!insn || insn == BB_END (curr_bb))
+ return NULL_RTX;
+
+ while ((insn = NEXT_INSN (insn)) != NULL_RTX)
+ {
+ if (NONJUMP_INSN_P (insn) || JUMP_P (insn) || CALL_P (insn))
+ break;
+
+ /* No other active insn all the way to the end of the basic block. */
+ if (insn == BB_END (curr_bb))
+ return NULL_RTX;
+ }
+
+ return insn;
+}
+
/* Return the basic block reached by falling though the basic block BB. */
static basic_block
@@ -448,9 +492,9 @@ cond_exec_process_if_block (ce_if_block_
if (n_matching > 0)
{
if (then_end)
- then_end = prev_active_insn (then_first_tail);
+ then_end = find_active_insn_before (then_bb, then_first_tail);
if (else_end)
- else_end = prev_active_insn (else_first_tail);
+ else_end = find_active_insn_before (else_bb, else_first_tail);
n_insns -= 2 * n_matching;
}
@@ -488,9 +532,9 @@ cond_exec_process_if_block (ce_if_block_
if (n_matching > 0)
{
if (then_start)
- then_start = next_active_insn (then_last_head);
+ then_start = find_active_insn_after (then_bb, then_last_head);
if (else_start)
- else_start = next_active_insn (else_last_head);
+ else_start = find_active_insn_after (else_bb, else_last_head);
n_insns -= 2 * n_matching;
}
}
@@ -646,7 +690,7 @@ cond_exec_process_if_block (ce_if_block_
{
rtx from = then_first_tail;
if (!INSN_P (from))
- from = next_active_insn (from);
+ from = find_active_insn_after (then_bb, from);
delete_insn_chain (from, BB_END (then_bb), false);
}
if (else_last_head)
Index: gcc-4.5/gcc/testsuite/gcc.dg/20101010-1.c
===================================================================
--- /dev/null
+++ gcc-4.5/gcc/testsuite/gcc.dg/20101010-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-crossjumping" } */
+
+int foo (void)
+{
+ int len;
+ if (bar1 (&len))
+ {
+ char devpath [len];
+ if (bar2 (devpath) == len)
+ return len;
+ }
+ return -1;
+}

View File

@@ -0,0 +1,24 @@
Add /sw/include and /opt/include based on the original
zecke-no-host-includes.patch patch. The original patch checked for
/usr/include, /sw/include and /opt/include and then triggered a failure and
aborted.
Instead, we add the two missing items to the current scan. If the user
wants this to be a failure, they can add "-Werror=poison-system-directories".
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
diff -ur gcc-4.5.0.orig/gcc/incpath.c gcc-4.5.0/gcc/incpath.c
--- gcc-4.5.0.orig/gcc/incpath.c 2010-09-29 14:58:31.358975524 -0500
+++ gcc-4.5.0/gcc/incpath.c 2010-09-29 15:08:02.065975516 -0500
@@ -363,7 +363,9 @@
{
if ((!strncmp (p->name, "/usr/include", 12))
|| (!strncmp (p->name, "/usr/local/include", 18))
- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
warning (OPT_Wpoison_system_directories,
"include location \"%s\" is unsafe for "
"cross-compilation",

View File

@@ -0,0 +1,83 @@
gcc: add poison parameters detection
Add the logic that, if not configured with "--enable-target-optspace",
gcc will meet error when build target app with "-Os" option.
This could avoid potential binary crash.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
diff --git a/gcc/config.in b/gcc/config.in
index a9e208f..3004321 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -132,6 +132,12 @@
#endif
+/* Define to enable target optspace support. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_TARGET_OPTSPACE
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
diff --git a/gcc/configure b/gcc/configure
index 2e022ed..004ec0b 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -909,6 +909,7 @@ enable_maintainer_mode
enable_version_specific_runtime_libs
with_slibdir
enable_plugin
+enable_target_optspace
'
ac_precious_vars='build_alias
host_alias
@@ -25289,6 +25290,13 @@ $as_echo "#define ENABLE_PLUGIN 1" >>confdefs.h
fi
+if test x"$enable_target_optspace" != x; then :
+
+$as_echo "#define ENABLE_TARGET_OPTSPACE 1" >>confdefs.h
+
+fi
+
+
# Configure the subdirectories
# AC_CONFIG_SUBDIRS($subdirs)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index ac4ca70..18ec0aa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4434,6 +4434,11 @@ if test x"$enable_plugin" = x"yes"; then
AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
fi
+AC_SUBST(enable_target_optspace)
+if test x"$enable_target_optspace" != x; then
+ AC_DEFINE(ENABLE_TARGET_OPTSPACE, 1, [Define to enable target optspace support.])
+fi
+
# Configure the subdirectories
# AC_CONFIG_SUBDIRS($subdirs)
diff --git a/gcc/opts.c b/gcc/opts.c
index 139cd26..2fdd96a 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -945,6 +945,11 @@ decode_options (unsigned int argc, const char **argv)
else
set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
+#ifndef ENABLE_TARGET_OPTSPACE
+ if (optimize_size == 1)
+ error ("Do not use -Os option if --enable-target-optspace is not set.");
+#endif
+
if (first_time_p)
{
/* Initialize whether `char' is signed. */

View File

@@ -0,0 +1,201 @@
gcc/
2008-07-02 Joseph Myers <joseph@codesourcery.com>
* c-incpath.c: Include toplev.h.
(merge_include_chains): Use warning instead of cpp_error for
system directory poisoning diagnostic.
* Makefile.in (c-incpath.o): Depend on toplev.h.
* gcc.c (LINK_COMMAND_SPEC): Pass
--error-poison-system-directories if
-Werror=poison-system-directories.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
* common.opt (--Wno-poison-system-directories): New.
* doc/invoke.texi (-Wno-poison-system-directories): Document.
* c-incpath.c: Include flags.h.
(merge_include_chains): Check flag_poison_system_directories.
* gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
to linker if -Wno-poison-system-directories.
* Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* c-incpath.c (merge_include_chains): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
/usr/include, /usr/local/include or /usr/X11R6/include.
Index: gcc-4.5.0/gcc/common.opt
===================================================================
--- gcc-4.5.0.orig/gcc/common.opt 2010-03-17 20:01:09.000000000 -0700
+++ gcc-4.5.0/gcc/common.opt 2010-06-25 11:35:39.965383734 -0700
@@ -152,6 +152,10 @@
Common Var(warn_padded) Warning
Warn when padding is required to align structure members
+Wpoison-system-directories
+Common Var(flag_poison_system_directories) Init(1) Warning
+Warn for -I and -L options using system directories if cross compiling
+
Wshadow
Common Var(warn_shadow) Warning
Warn when one local variable shadows another
Index: gcc-4.5.0/gcc/config.in
===================================================================
--- gcc-4.5.0.orig/gcc/config.in 2010-04-14 02:30:07.000000000 -0700
+++ gcc-4.5.0/gcc/config.in 2010-06-25 11:35:39.969383588 -0700
@@ -132,6 +132,12 @@
#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
Index: gcc-4.5.0/gcc/configure.ac
===================================================================
--- gcc-4.5.0.orig/gcc/configure.ac 2010-06-25 11:34:01.433382161 -0700
+++ gcc-4.5.0/gcc/configure.ac 2010-06-25 11:35:39.969383588 -0700
@@ -4276,6 +4276,16 @@
fi)
AC_SUBST(slibdir)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
Index: gcc-4.5.0/gcc/doc/invoke.texi
===================================================================
--- gcc-4.5.0.orig/gcc/doc/invoke.texi 2010-04-06 07:02:22.000000000 -0700
+++ gcc-4.5.0/gcc/doc/invoke.texi 2010-06-25 11:35:39.992666345 -0700
@@ -252,6 +252,7 @@
-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
-Wpointer-arith -Wno-pointer-to-int-cast @gol
+-Wno-poison-system-directories @gol
-Wredundant-decls @gol
-Wreturn-type -Wsequence-point -Wshadow @gol
-Wsign-compare -Wsign-conversion -Wstack-protector @gol
@@ -3603,6 +3604,14 @@
option will @emph{not} warn about unknown pragmas in system
headers---for that, @option{-Wunknown-pragmas} must also be used.
+@item -Wno-poison-system-directories
+@opindex Wno-poison-system-directories
+Do not warn for @option{-I} or @option{-L} options using system
+directories such as @file{/usr/include} when cross compiling. This
+option is intended for use in chroot environments when such
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@item -Wfloat-equal
@opindex Wfloat-equal
@opindex Wno-float-equal
Index: gcc-4.5.0/gcc/gcc.c
===================================================================
--- gcc-4.5.0.orig/gcc/gcc.c 2010-02-11 04:23:08.000000000 -0800
+++ gcc-4.5.0/gcc/gcc.c 2010-06-25 11:35:40.009381858 -0700
@@ -792,6 +792,8 @@
%{flto} %{fwhopr} %l " LINK_PIE_SPEC \
"%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+ %{Wno-poison-system-directories:--no-poison-system-directories}\
+ %{Werror=poison-system-directories:--error-poison-system-directories}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
%{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
Index: gcc-4.5.0/gcc/incpath.c
===================================================================
--- gcc-4.5.0.orig/gcc/incpath.c 2009-11-25 02:55:54.000000000 -0800
+++ gcc-4.5.0/gcc/incpath.c 2010-06-25 11:35:40.017209818 -0700
@@ -353,6 +353,24 @@
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (flag_poison_system_directories)
+ {
+ struct cpp_dir *p;
+
+ for (p = heads[QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and
diff -ur gcc-4.5.0.orig/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in
--- gcc-4.5.0.orig/gcc/Makefile.in 2010-09-29 17:13:49.164088845 -0500
+++ gcc-4.5.0/gcc/Makefile.in 2010-09-29 18:48:19.300178501 -0500
@@ -1965,7 +1965,7 @@
incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
- $(MACHMODE_H)
+ $(MACHMODE_H) $(FLAGS_H) toplev.h
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
diff -ur gcc-4.5.0.orig/gcc/configure gcc-4.5.0/gcc/configure
--- gcc-4.5.0.orig/gcc/configure 2010-09-29 14:58:31.702054881 -0500
+++ gcc-4.5.0/gcc/configure 2010-09-29 18:46:31.486068500 -0500
@@ -913,6 +913,7 @@
enable_maintainer_mode
enable_version_specific_runtime_libs
with_slibdir
+enable_poison_system_directories
enable_plugin
enable_target_optspace
'
@@ -1621,6 +1622,8 @@
--enable-version-specific-runtime-libs
specify that runtime libraries should be
installed in a compiler-specific directory
+ --enable-poison-system-directories
+ warn for use of native system header directories
--enable-plugin enable plugin support
Optional Packages:
@@ -25339,6 +25377,19 @@
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
+
# Substitute configuration variables

View File

@@ -0,0 +1,117 @@
backport http://gcc.gnu.org/viewcvs?view=revision&revision=162404
from trunk
Which fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43698
2010-07-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/43698
* config/arm/arm.md: Split arm_rev into *arm_rev
and *thumb1_rev. Set *arm_rev to be predicable.
2010-07-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/43698
* gcc.target/arm/pr43698.c: New test.
/scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
Usage: date [OPTION]... [+FORMAT]
Display the current time in the given FORMAT.
-d, --date=STRING display time described by STRING, not `now'
-f, --file=DATEFILE like --date once for each line of DATEFILE
-R, --rfc-822 output RFC-822 compliant date string
-u, --utc, --universal print or set Coordinated Universal Time
--help display this help and exit
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /bin/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /bin/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /bin/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /scratch/oe/sysroots/i686-linux/usr/share/quilt/compat/date
date is /bin/date
date
Khem
Index: gcc-4.5/gcc/config/arm/arm.md
===================================================================
--- gcc-4.5.orig/gcc/config/arm/arm.md 2010-07-20 20:31:25.000000000 -0700
+++ gcc-4.5/gcc/config/arm/arm.md 2010-07-22 14:55:54.303169081 -0700
@@ -11197,15 +11197,21 @@
(set_attr "length" "4")]
)
-(define_insn "arm_rev"
+(define_insn "*arm_rev"
[(set (match_operand:SI 0 "s_register_operand" "=r")
(bswap:SI (match_operand:SI 1 "s_register_operand" "r")))]
- "TARGET_EITHER && arm_arch6"
- "rev\t%0, %1"
- [(set (attr "length")
- (if_then_else (eq_attr "is_thumb" "yes")
- (const_int 2)
- (const_int 4)))]
+ "TARGET_32BIT && arm_arch6"
+ "rev%?\t%0, %1"
+ [(set_attr "predicable" "yes")
+ (set_attr "length" "4")]
+)
+
+(define_insn "*thumb1_rev"
+ [(set (match_operand:SI 0 "s_register_operand" "=l")
+ (bswap:SI (match_operand:SI 1 "s_register_operand" "l")))]
+ "TARGET_THUMB1 && arm_arch6"
+ "rev\t%0, %1"
+ [(set_attr "length" "2")]
)
(define_expand "arm_legacy_rev"
Index: gcc-4.5/gcc/testsuite/gcc.target/arm/pr43698.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc-4.5/gcc/testsuite/gcc.target/arm/pr43698.c 2010-07-22 14:56:35.406670213 -0700
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-Os -march=armv7-a" } */
+#include <stdint.h>
+#include <stdlib.h>
+
+
+char do_reverse_endian = 0;
+
+# define bswap_32(x) \
+ ((((x) & 0xff000000) >> 24) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | \
+ (((x) & 0x000000ff) << 24))
+
+#define EGET(X) \
+ (__extension__ ({ \
+ uint64_t __res; \
+ if (!do_reverse_endian) { __res = (X); \
+ } else if (sizeof(X) == 4) { __res = bswap_32((X)); \
+ } \
+ __res; \
+ }))
+
+void __attribute__((noinline)) X(char **phdr, char **data, int *phoff)
+{
+ *phdr = *data + EGET(*phoff);
+}
+
+int main()
+{
+ char *phdr;
+ char *data = (char *)0x40164000;
+ int phoff = 0x34;
+ X(&phdr, &data, &phoff);
+ if (phdr != (char *)0x40164034)
+ abort ();
+ exit (0);
+}
+

View File

@@ -0,0 +1,63 @@
Hi,
The attached patch fixes Bugzilla 45847
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45847). When compiling
without -mvectorize-with-neon-quad and vectorizing scalar widening
operations that widen words to double words, there are no corresponding
vector types for DI scalar types. For this scenario, a call to
get_vect_type_for_scalar_type() returns NULL and an absent NULL-check
caused this segfault. The attached patch adds this NULL-check. Also,
this is consistent with all the other places where a NULL-check follows
a call to get_vect_type_for_scalar_type() in tree-vect-patterns.c.
Regression tested with arm-linux-gnueabi. OK?
--
Tejas Belagod
ARM.
gcc/
2010-10-05 Tejas Belagod <tejas.belagod@arm.com>
* tree-vect-patterns.c (vect_recog_widen_mult_pattern): Add NULL
check for vectype_out returned by get_vectype_for_scalar_type().
testsuite/
2010-10-05 Tejas Belagod <tejas.belagod@arm.com>
* gcc.dg/vect/pr45847.c: New test.
Index: gcc-4.5/gcc/testsuite/gcc.dg/vect/pr45847.c
===================================================================
--- /dev/null
+++ gcc-4.5/gcc/testsuite/gcc.dg/vect/pr45847.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+
+long long foo (long long *__restrict a, int *__restrict b, int *__restrict c )
+{
+ int i;
+ long long sum=0;
+ for (i=0;i<256;i++)
+ sum += (long long)b[i] * c[i];
+
+ return sum;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
Index: gcc-4.5/gcc/tree-vect-patterns.c
===================================================================
--- gcc-4.5.orig/gcc/tree-vect-patterns.c
+++ gcc-4.5/gcc/tree-vect-patterns.c
@@ -411,6 +411,7 @@ vect_recog_widen_mult_pattern (gimple la
/* Check target support */
vectype = get_vectype_for_scalar_type (half_type0);
if (!vectype
+ || !get_vectype_for_scalar_type (type)
|| !supportable_widening_operation (WIDEN_MULT_EXPR, last_stmt, vectype,
&dummy, &dummy, &dummy_code,
&dummy_code, &dummy_int, &dummy_vec))

View File

@@ -0,0 +1,67 @@
Index: gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.h
===================================================================
--- gcc-4.5.orig/libstdc++-v3/config/locale/generic/c_locale.h 2010-06-30 22:30:53.993316002 -0700
+++ gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.h 2010-06-30 22:31:26.043316001 -0700
@@ -41,12 +41,17 @@
#include <clocale>
#include <cstddef>
+#include <features.h>
+#include <ctype.h>
#define _GLIBCXX_NUM_CATEGORIES 0
_GLIBCXX_BEGIN_NAMESPACE(std)
-
- typedef int* __c_locale;
+#ifdef __UCLIBC__
+ typedef __ctype_touplow_t* __c_locale;
+#else
+ typedef int* __c_locale;
+#endif
// Convert numeric value of type double and long double to string and
// return length of string. If vsnprintf is available use it, otherwise
Index: gcc-4.5/libstdc++-v3/config/os/gnu-linux/ctype_base.h
===================================================================
--- gcc-4.5.orig/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2010-06-30 22:30:54.013316002 -0700
+++ gcc-4.5/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2010-06-30 22:31:26.053316001 -0700
@@ -33,14 +33,21 @@
*/
// Information as gleaned from /usr/include/ctype.h
-
+
+#include <features.h>
+#include <ctype.h>
+
_GLIBCXX_BEGIN_NAMESPACE(std)
/// @brief Base class for ctype.
struct ctype_base
{
// Non-standard typedefs.
- typedef const int* __to_type;
+#ifdef __UCLIBC__
+ typedef const __ctype_touplow_t* __to_type;
+#else
+ typedef const int* __to_type;
+#endif
// NB: Offsets into ctype<char>::_M_table force a particular size
// on the mask type. Because of this, we don't use an enum.
Index: gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.cc
===================================================================
--- gcc-4.5.orig/libstdc++-v3/config/locale/generic/c_locale.cc 2010-06-28 12:12:42.000000000 -0700
+++ gcc-4.5/libstdc++-v3/config/locale/generic/c_locale.cc 2010-06-30 22:31:26.063316001 -0700
@@ -256,5 +256,10 @@ _GLIBCXX_END_NAMESPACE
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
+#ifdef __UCLIBC__
+// This is because __c_locale is of type __ctype_touplow_t* which is short on uclibc. for glibc its int*
+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPs, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPs);
+#else
_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
+#endif
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT

View File

@@ -0,0 +1,27 @@
Source: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45805
Index: gcc-4.5/gcc/config/arm/neon.md
===================================================================
--- gcc-4.5.orig/gcc/config/arm/neon.md 2010-09-28 12:04:38.000000000 -0700
+++ gcc-4.5/gcc/config/arm/neon.md 2010-09-28 12:07:28.026227000 -0700
@@ -5682,9 +5682,9 @@
;; Vectorize for non-neon-quad case
(define_insn "neon_unpack<US>_<mode>"
[(set (match_operand:<V_widen> 0 "register_operand" "=w")
- (SE:<V_widen> (match_operand:VDI 1 "register_operand" "")))]
+ (SE:<V_widen> (match_operand:VDI 1 "register_operand" "w")))]
"TARGET_NEON"
- "vmovl.<US><V_sz_elem> %q0, %1"
+ "vmovl.<US><V_sz_elem> %q0, %P1"
[(set_attr "neon_type" "neon_shift_1")]
)
@@ -5721,7 +5721,7 @@
(SE:<V_widen>
(match_operand:VDI 2 "register_operand" "w"))))]
"TARGET_NEON"
- "vmull.<US><V_sz_elem> %q0, %1, %2"
+ "vmull.<US><V_sz_elem> %q0, %P1, %P2"
[(set_attr "neon_type" "neon_shift_1")]
)

View File

@@ -0,0 +1,9 @@
the svn patch changed the BASE-VER to 4.5.1, bring it back to 4.5.0
- Nitin A Kamble nitin.a.kamble@intel.com
- 2010/07/20
--- gcc-4.5.0/gcc/BASE-VER 2010-07-20 00:57:37.000000000 -0700
+++ gcc-4.5.0.new/gcc/BASE-VER 2010-07-20 01:06:17.000000000 -0700
@@ -1 +1 @@
-4.5.1
+4.5.0

View File

@@ -0,0 +1,40 @@
2010-06-07 Khem Raj <raj.khem@gmail.com>
* libsupc++/eh_arm.cc (__cxa_end_cleanup): Use .pushsection/.popsection
to emit inline assembly into .text section.
Index: gcc-4.5/libstdc++-v3/libsupc++/eh_arm.cc
===================================================================
--- gcc-4.5.orig/libstdc++-v3/libsupc++/eh_arm.cc 2010-06-04 23:20:18.000000000 -0700
+++ gcc-4.5/libstdc++-v3/libsupc++/eh_arm.cc 2010-06-08 11:27:34.247541722 -0700
@@ -157,22 +157,26 @@ __gnu_end_cleanup(void)
// Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3.
// Also push r4 to preserve stack alignment.
#ifdef __thumb__
-asm (".global __cxa_end_cleanup\n"
+asm (" .pushsection .text.__cxa_end_cleanup\n"
+" .global __cxa_end_cleanup\n"
" .type __cxa_end_cleanup, \"function\"\n"
" .thumb_func\n"
"__cxa_end_cleanup:\n"
" push\t{r1, r2, r3, r4}\n"
" bl\t__gnu_end_cleanup\n"
" pop\t{r1, r2, r3, r4}\n"
-" bl\t_Unwind_Resume @ Never returns\n");
+" bl\t_Unwind_Resume @ Never returns\n"
+" .popsection\n");
#else
-asm (".global __cxa_end_cleanup\n"
+asm (" .pushsection .text.__cxa_end_cleanup\n"
+" .global __cxa_end_cleanup\n"
" .type __cxa_end_cleanup, \"function\"\n"
"__cxa_end_cleanup:\n"
" stmfd\tsp!, {r1, r2, r3, r4}\n"
" bl\t__gnu_end_cleanup\n"
" ldmfd\tsp!, {r1, r2, r3, r4}\n"
-" bl\t_Unwind_Resume @ Never returns\n");
+" bl\t_Unwind_Resume @ Never returns\n"
+" .popsection\n");
#endif
#endif

View File

@@ -0,0 +1,71 @@
#! /bin/sh -e
# DP: Build and install libstdc++_pic.a library.
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
diff -ur libstdc++-v3/src/Makefile.am libstdc++-v3/src/Makefile.am
--- libstdc++-v3/src/Makefile.am~ 2004-04-16 21:04:05.000000000 +0200
+++ libstdc++-v3/src/Makefile.am 2004-07-03 20:22:43.000000000 +0200
@@ -210,6 +210,10 @@
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+install-exec-local:
+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o || touch libstdc++_pic.a
+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
+
# Added bits to build debug library.
if GLIBCXX_BUILD_DEBUG
all-local: build_debug
diff -ur libstdc++-v3/src/Makefile.in libstdc++-v3/src/Makefile.in
--- libstdc++-v3/src/Makefile.in 2004-07-03 06:41:13.000000000 +0200
+++ libstdc++-v3/src/Makefile.in 2004-07-03 20:25:05.000000000 +0200
@@ -611,7 +611,7 @@
install-data-am: install-data-local
-install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
install-info: install-info-am
@@ -644,6 +644,7 @@
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-data-local install-exec \
+ install-exec-local \
install-exec-am install-info install-info-am install-man \
install-strip install-toolexeclibLTLIBRARIES installcheck \
installcheck-am installdirs maintainer-clean \
@@ -729,6 +730,11 @@
install_debug:
(cd ${debugdir} && $(MAKE) \
toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
+
+install-exec-local:
+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o || touch libstdc++_pic.a
+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,207 @@
2010-06-28 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
Daniel Jacobowitz <dan@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
gcc/
* doc/invoke.texi (-Wno-poison-system-directories): Document.
* gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
if -Wno-poison-system-directories and --error-poison-system-directories
if -Werror=poison-system-directories to linker.
* incpath.c: Include flags.h. Include toplev.h.
(merge_include_chains): If ENABLE_POISON_SYSTEM_DIRECTORIES defined
and flag_poison_system_directories is true, warn for use of
/usr/include, /usr/local/include or /usr/X11R6/include.
* Makefile.in (incpath.o): Depend on $(FLAGS_H) and toplev.h.
* common.opt (--Wno-poison-system-directories): New.
* configure.ac (--enable-poison-system-directories): New option.
* configure: Regenerate.
* config.in: Regenerate.
Index: gcc-4.5/gcc/Makefile.in
===================================================================
--- gcc-4.5.orig/gcc/Makefile.in 2010-09-23 16:44:12.000000000 -0700
+++ gcc-4.5/gcc/Makefile.in 2010-09-23 16:46:33.552416860 -0700
@@ -1969,7 +1969,7 @@ gcc.srcextra: gengtype-lex.c
incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
- $(MACHMODE_H)
+ $(MACHMODE_H) $(FLAGS_H) toplev.h
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
Index: gcc-4.5/gcc/common.opt
===================================================================
--- gcc-4.5.orig/gcc/common.opt 2010-07-11 16:14:47.000000000 -0700
+++ gcc-4.5/gcc/common.opt 2010-09-23 16:46:33.556418045 -0700
@@ -152,6 +152,10 @@ Wpadded
Common Var(warn_padded) Warning
Warn when padding is required to align structure members
+Wpoison-system-directories
+Common Var(flag_poison_system_directories) Init(1)
+Warn for -I and -L options using system directories if cross compiling
+
Wshadow
Common Var(warn_shadow) Warning
Warn when one local variable shadows another
Index: gcc-4.5/gcc/config.in
===================================================================
--- gcc-4.5.orig/gcc/config.in 2010-07-11 16:14:46.000000000 -0700
+++ gcc-4.5/gcc/config.in 2010-09-23 16:46:33.556418045 -0700
@@ -132,6 +132,12 @@
#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
Index: gcc-4.5/gcc/configure
===================================================================
--- gcc-4.5.orig/gcc/configure 2010-09-23 16:44:11.000000000 -0700
+++ gcc-4.5/gcc/configure 2010-09-23 16:46:33.572415719 -0700
@@ -913,6 +913,7 @@ with_system_zlib
enable_maintainer_mode
enable_version_specific_runtime_libs
with_slibdir
+enable_poison_system_directories
enable_plugin
'
ac_precious_vars='build_alias
@@ -1620,6 +1621,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be
installed in a compiler-specific directory
+ --enable-poison-system-directories
+ warn for use of native system header directories
--enable-plugin enable plugin support
Optional Packages:
@@ -25345,6 +25348,19 @@ fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
+
# Substitute configuration variables
Index: gcc-4.5/gcc/configure.ac
===================================================================
--- gcc-4.5.orig/gcc/configure.ac 2010-09-23 16:44:11.000000000 -0700
+++ gcc-4.5/gcc/configure.ac 2010-09-23 16:46:33.576417624 -0700
@@ -4439,6 +4439,16 @@ else
fi)
AC_SUBST(slibdir)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
Index: gcc-4.5/gcc/doc/invoke.texi
===================================================================
--- gcc-4.5.orig/gcc/doc/invoke.texi 2010-09-23 15:33:28.000000000 -0700
+++ gcc-4.5/gcc/doc/invoke.texi 2010-09-23 16:46:33.584416934 -0700
@@ -252,6 +252,7 @@ Objective-C and Objective-C++ Dialects}.
-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
-Wpointer-arith -Wno-pointer-to-int-cast @gol
+-Wno-poison-system-directories @gol
-Wredundant-decls @gol
-Wreturn-type -Wsequence-point -Wshadow @gol
-Wsign-compare -Wsign-conversion -Wstack-protector @gol
@@ -3603,6 +3604,14 @@ code. However, note that using @option{
option will @emph{not} warn about unknown pragmas in system
headers---for that, @option{-Wunknown-pragmas} must also be used.
+@item -Wno-poison-system-directories
+@opindex Wno-poison-system-directories
+Do not warn for @option{-I} or @option{-L} options using system
+directories such as @file{/usr/include} when cross compiling. This
+option is intended for use in chroot environments when such
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@item -Wfloat-equal
@opindex Wfloat-equal
@opindex Wno-float-equal
Index: gcc-4.5/gcc/gcc.c
===================================================================
--- gcc-4.5.orig/gcc/gcc.c 2010-07-11 16:14:46.000000000 -0700
+++ gcc-4.5/gcc/gcc.c 2010-09-23 16:46:33.588417920 -0700
@@ -792,6 +792,8 @@ proper position among the other output f
%{flto} %{fwhopr} %l " LINK_PIE_SPEC \
"%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+ %{Wno-poison-system-directories:--no-poison-system-directories}\
+ %{Werror=poison-system-directories:--error-poison-system-directories}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
%{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
Index: gcc-4.5/gcc/incpath.c
===================================================================
--- gcc-4.5.orig/gcc/incpath.c 2010-07-11 16:14:44.000000000 -0700
+++ gcc-4.5/gcc/incpath.c 2010-09-23 16:46:33.588417920 -0700
@@ -30,6 +30,8 @@
#include "intl.h"
#include "incpath.h"
#include "cppdefault.h"
+#include "flags.h"
+#include "toplev.h"
/* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */
@@ -353,6 +355,24 @@ merge_include_chains (const char *sysroo
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (flag_poison_system_directories)
+ {
+ struct cpp_dir *p;
+
+ for (p = heads[QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
2010-07-07 Sandra Loosemore <sandra@codesourcery.com>
Merge from Sourcery G++ 4.4:
2010-03-08 Paul Brook <paul@codesourcery.com>
gcc/
* doc/invoke.texi: Document ARM -mcpu=cortex-m4.
* config/arm/arm.c (all_architectures): Change v7e-m default to
cortexm4.
* config/arm/arm-cores.def: Add cortex-m4.
* config/arm/arm-tune.md: Regenerate.
=== modified file 'gcc/config/arm/arm-cores.def'
--- old/gcc/config/arm/arm-cores.def 2009-11-20 17:37:30 +0000
+++ new/gcc/config/arm/arm-cores.def 2010-07-29 15:53:39 +0000
@@ -123,6 +123,7 @@
ARM_CORE("cortex-a9", cortexa9, 7A, FL_LDSCHED, 9e)
ARM_CORE("cortex-r4", cortexr4, 7R, FL_LDSCHED, 9e)
ARM_CORE("cortex-r4f", cortexr4f, 7R, FL_LDSCHED, 9e)
+ARM_CORE("cortex-m4", cortexm4, 7EM, FL_LDSCHED, 9e)
ARM_CORE("cortex-m3", cortexm3, 7M, FL_LDSCHED, 9e)
ARM_CORE("cortex-m1", cortexm1, 6M, FL_LDSCHED, 9e)
ARM_CORE("cortex-m0", cortexm0, 6M, FL_LDSCHED, 9e)
=== modified file 'gcc/config/arm/arm-tune.md'
--- old/gcc/config/arm/arm-tune.md 2009-11-20 17:37:30 +0000
+++ new/gcc/config/arm/arm-tune.md 2010-07-29 15:53:39 +0000
@@ -1,5 +1,5 @@
;; -*- buffer-read-only: t -*-
;; Generated automatically by gentune.sh from arm-cores.def
(define_attr "tune"
- "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1,cortexm0"
+ "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm4,cortexm3,cortexm1,cortexm0"
(const (symbol_ref "((enum attr_tune) arm_tune)")))
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-04-02 07:32:00 +0000
+++ new/gcc/config/arm/arm.c 2010-07-29 15:53:39 +0000
@@ -782,7 +782,7 @@
{"armv7-a", cortexa8, "7A", FL_CO_PROC | FL_FOR_ARCH7A, NULL},
{"armv7-r", cortexr4, "7R", FL_CO_PROC | FL_FOR_ARCH7R, NULL},
{"armv7-m", cortexm3, "7M", FL_CO_PROC | FL_FOR_ARCH7M, NULL},
- {"armv7e-m", cortexm3, "7EM", FL_CO_PROC | FL_FOR_ARCH7EM, NULL},
+ {"armv7e-m", cortexm4, "7EM", FL_CO_PROC | FL_FOR_ARCH7EM, NULL},
{"ep9312", ep9312, "4T", FL_LDSCHED | FL_CIRRUS | FL_FOR_ARCH4, NULL},
{"iwmmxt", iwmmxt, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL},
{"iwmmxt2", iwmmxt2, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL},
=== modified file 'gcc/doc/invoke.texi'
--- old/gcc/doc/invoke.texi 2010-07-29 14:59:35 +0000
+++ new/gcc/doc/invoke.texi 2010-07-29 15:53:39 +0000
@@ -9826,7 +9826,7 @@
@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
@samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9},
-@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
+@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
@samp{cortex-m1},
@samp{cortex-m0},
@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,675 @@
2010-07-02 Daniel Jacobowitz <dan@codesourcery.com>
Julian Brown <julian@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
gcc/
* config/arm/arm.c (arm_canonicalize_comparison): Canonicalize DImode
comparisons. Adjust to take both operands.
(arm_select_cc_mode): Handle DImode comparisons.
(arm_gen_compare_reg): Generate a scratch register for DImode
comparisons which require one. Use xor for Thumb equality checks.
(arm_const_double_by_immediates): New.
(arm_print_operand): Allow 'Q' and 'R' for constants.
(get_arm_condition_code): Handle new CC_CZmode and CC_NCVmode.
* config/arm/arm.h (CANONICALIZE_COMPARISON): Always use
arm_canonicalize_comparison.
* config/arm/arm-modes.def: Add CC_CZmode and CC_NCVmode.
* config/arm/arm-protos.h (arm_canonicalize_comparison): Update
prototype.
(arm_const_double_by_immediates): Declare.
* config/arm/constraints.md (Di): New constraint.
* config/arm/predicates.md (arm_immediate_di_operand)
(arm_di_operand, cmpdi_operand): New.
* config/arm/arm.md (cbranchdi4): Handle non-Cirrus also.
(*arm_cmpdi_insn, *arm_cmpdi_unsigned)
(*arm_cmpdi_zero, *thumb_cmpdi_zero): New insns.
(cstoredi4): Handle non-Cirrus also.
gcc/testsuite/
* gcc.c-torture/execute/20100416-1.c: New test case.
2010-07-08 Sandra Loosemore <sandra@codesourcery.com>
Backport from upstream (originally from Sourcery G++ 4.4):
2010-07-02 Sandra Loosemore <sandra@codesourcery.com>
gcc/
=== modified file 'gcc/config/arm/arm-modes.def'
--- old/gcc/config/arm/arm-modes.def 2009-06-18 11:24:10 +0000
+++ new/gcc/config/arm/arm-modes.def 2010-07-29 16:58:56 +0000
@@ -35,10 +35,16 @@
CC_NOOVmode should be used with SImode integer equalities.
CC_Zmode should be used if only the Z flag is set correctly
CC_Nmode should be used if only the N (sign) flag is set correctly
+ CC_CZmode should be used if only the C and Z flags are correct
+ (used for DImode unsigned comparisons).
+ CC_NCVmode should be used if only the N, C, and V flags are correct
+ (used for DImode signed comparisons).
CCmode should be used otherwise. */
CC_MODE (CC_NOOV);
CC_MODE (CC_Z);
+CC_MODE (CC_CZ);
+CC_MODE (CC_NCV);
CC_MODE (CC_SWP);
CC_MODE (CCFP);
CC_MODE (CCFPE);
=== modified file 'gcc/config/arm/arm-protos.h'
--- old/gcc/config/arm/arm-protos.h 2009-11-11 14:23:03 +0000
+++ new/gcc/config/arm/arm-protos.h 2010-07-29 16:58:56 +0000
@@ -49,8 +49,7 @@
extern int const_ok_for_arm (HOST_WIDE_INT);
extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx,
HOST_WIDE_INT, rtx, rtx, int);
-extern RTX_CODE arm_canonicalize_comparison (RTX_CODE, enum machine_mode,
- rtx *);
+extern RTX_CODE arm_canonicalize_comparison (RTX_CODE, rtx *, rtx *);
extern int legitimate_pic_operand_p (rtx);
extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
extern rtx legitimize_tls_address (rtx, rtx);
@@ -116,6 +115,7 @@
extern void arm_reload_out_hi (rtx *);
extern int arm_const_double_inline_cost (rtx);
extern bool arm_const_double_by_parts (rtx);
+extern bool arm_const_double_by_immediates (rtx);
extern const char *fp_immediate_constant (rtx);
extern void arm_emit_call_insn (rtx, rtx);
extern const char *output_call (rtx *);
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-07-29 15:59:12 +0000
+++ new/gcc/config/arm/arm.c 2010-07-29 16:58:56 +0000
@@ -3190,13 +3190,82 @@
immediate value easier to load. */
enum rtx_code
-arm_canonicalize_comparison (enum rtx_code code, enum machine_mode mode,
- rtx * op1)
+arm_canonicalize_comparison (enum rtx_code code, rtx *op0, rtx *op1)
{
- unsigned HOST_WIDE_INT i = INTVAL (*op1);
- unsigned HOST_WIDE_INT maxval;
+ enum machine_mode mode;
+ unsigned HOST_WIDE_INT i, maxval;
+
+ mode = GET_MODE (*op0);
+ if (mode == VOIDmode)
+ mode = GET_MODE (*op1);
+
maxval = (((unsigned HOST_WIDE_INT) 1) << (GET_MODE_BITSIZE(mode) - 1)) - 1;
+ /* For DImode, we have GE/LT/GEU/LTU comparisons. In ARM mode
+ we can also use cmp/cmpeq for GTU/LEU. GT/LE must be either
+ reversed or (for constant OP1) adjusted to GE/LT. Similarly
+ for GTU/LEU in Thumb mode. */
+ if (mode == DImode)
+ {
+ rtx tem;
+
+ /* To keep things simple, always use the Cirrus cfcmp64 if it is
+ available. */
+ if (TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK)
+ return code;
+
+ if (code == GT || code == LE
+ || (!TARGET_ARM && (code == GTU || code == LEU)))
+ {
+ /* Missing comparison. First try to use an available
+ comparison. */
+ if (GET_CODE (*op1) == CONST_INT)
+ {
+ i = INTVAL (*op1);
+ switch (code)
+ {
+ case GT:
+ case LE:
+ if (i != maxval
+ && arm_const_double_by_immediates (GEN_INT (i + 1)))
+ {
+ *op1 = GEN_INT (i + 1);
+ return code == GT ? GE : LT;
+ }
+ break;
+ case GTU:
+ case LEU:
+ if (i != ~((unsigned HOST_WIDE_INT) 0)
+ && arm_const_double_by_immediates (GEN_INT (i + 1)))
+ {
+ *op1 = GEN_INT (i + 1);
+ return code == GTU ? GEU : LTU;
+ }
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ /* If that did not work, reverse the condition. */
+ tem = *op0;
+ *op0 = *op1;
+ *op1 = tem;
+ return swap_condition (code);
+ }
+
+ return code;
+ }
+
+ /* Comparisons smaller than DImode. Only adjust comparisons against
+ an out-of-range constant. */
+ if (GET_CODE (*op1) != CONST_INT
+ || const_ok_for_arm (INTVAL (*op1))
+ || const_ok_for_arm (- INTVAL (*op1)))
+ return code;
+
+ i = INTVAL (*op1);
+
switch (code)
{
case EQ:
@@ -9912,6 +9981,55 @@
&& (rtx_equal_p (XEXP (x, 0), y) || rtx_equal_p (XEXP (x, 1), y)))
return CC_Cmode;
+ if (GET_MODE (x) == DImode || GET_MODE (y) == DImode)
+ {
+ /* To keep things simple, always use the Cirrus cfcmp64 if it is
+ available. */
+ if (TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK)
+ return CCmode;
+
+ switch (op)
+ {
+ case EQ:
+ case NE:
+ /* A DImode comparison against zero can be implemented by
+ or'ing the two halves together. */
+ if (y == const0_rtx)
+ return CC_Zmode;
+
+ /* We can do an equality test in three Thumb instructions. */
+ if (!TARGET_ARM)
+ return CC_Zmode;
+
+ /* FALLTHROUGH */
+
+ case LTU:
+ case LEU:
+ case GTU:
+ case GEU:
+ /* DImode unsigned comparisons can be implemented by cmp +
+ cmpeq without a scratch register. Not worth doing in
+ Thumb-2. */
+ if (TARGET_ARM)
+ return CC_CZmode;
+
+ /* FALLTHROUGH */
+
+ case LT:
+ case LE:
+ case GT:
+ case GE:
+ /* DImode signed and unsigned comparisons can be implemented
+ by cmp + sbcs with a scratch register, but that does not
+ set the Z flag - we must reverse GT/LE/GTU/LEU. */
+ gcc_assert (op != EQ && op != NE);
+ return CC_NCVmode;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
return CCmode;
}
@@ -9921,10 +10039,39 @@
rtx
arm_gen_compare_reg (enum rtx_code code, rtx x, rtx y)
{
- enum machine_mode mode = SELECT_CC_MODE (code, x, y);
- rtx cc_reg = gen_rtx_REG (mode, CC_REGNUM);
-
- emit_set_insn (cc_reg, gen_rtx_COMPARE (mode, x, y));
+ enum machine_mode mode;
+ rtx cc_reg;
+ int dimode_comparison = GET_MODE (x) == DImode || GET_MODE (y) == DImode;
+
+ /* We might have X as a constant, Y as a register because of the predicates
+ used for cmpdi. If so, force X to a register here. */
+ if (dimode_comparison && !REG_P (x))
+ x = force_reg (DImode, x);
+
+ mode = SELECT_CC_MODE (code, x, y);
+ cc_reg = gen_rtx_REG (mode, CC_REGNUM);
+
+ if (dimode_comparison
+ && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)
+ && mode != CC_CZmode)
+ {
+ rtx clobber, set;
+
+ /* To compare two non-zero values for equality, XOR them and
+ then compare against zero. Not used for ARM mode; there
+ CC_CZmode is cheaper. */
+ if (mode == CC_Zmode && y != const0_rtx)
+ {
+ x = expand_binop (DImode, xor_optab, x, y, NULL_RTX, 0, OPTAB_WIDEN);
+ y = const0_rtx;
+ }
+ /* A scratch register is required. */
+ clobber = gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode));
+ set = gen_rtx_SET (VOIDmode, cc_reg, gen_rtx_COMPARE (mode, x, y));
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
+ }
+ else
+ emit_set_insn (cc_reg, gen_rtx_COMPARE (mode, x, y));
return cc_reg;
}
@@ -11253,6 +11400,34 @@
return false;
}
+/* Return true if it is possible to inline both the high and low parts
+ of a 64-bit constant into 32-bit data processing instructions. */
+bool
+arm_const_double_by_immediates (rtx val)
+{
+ enum machine_mode mode = GET_MODE (val);
+ rtx part;
+
+ if (mode == VOIDmode)
+ mode = DImode;
+
+ part = gen_highpart_mode (SImode, mode, val);
+
+ gcc_assert (GET_CODE (part) == CONST_INT);
+
+ if (!const_ok_for_arm (INTVAL (part)))
+ return false;
+
+ part = gen_lowpart (SImode, val);
+
+ gcc_assert (GET_CODE (part) == CONST_INT);
+
+ if (!const_ok_for_arm (INTVAL (part)))
+ return false;
+
+ return true;
+}
+
/* Scan INSN and note any of its operands that need fixing.
If DO_PUSHES is false we do not actually push any of the fixups
needed. The function returns TRUE if any fixups were needed/pushed.
@@ -15097,8 +15272,18 @@
the value being loaded is big-wordian or little-wordian. The
order of the two register loads can matter however, if the address
of the memory location is actually held in one of the registers
- being overwritten by the load. */
+ being overwritten by the load.
+
+ The 'Q' and 'R' constraints are also available for 64-bit
+ constants. */
case 'Q':
+ if (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
+ {
+ rtx part = gen_lowpart (SImode, x);
+ fprintf (stream, "#" HOST_WIDE_INT_PRINT_DEC, INTVAL (part));
+ return;
+ }
+
if (GET_CODE (x) != REG || REGNO (x) > LAST_ARM_REGNUM)
{
output_operand_lossage ("invalid operand for code '%c'", code);
@@ -15109,6 +15294,18 @@
return;
case 'R':
+ if (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
+ {
+ enum machine_mode mode = GET_MODE (x);
+ rtx part;
+
+ if (mode == VOIDmode)
+ mode = DImode;
+ part = gen_highpart_mode (SImode, mode, x);
+ fprintf (stream, "#" HOST_WIDE_INT_PRINT_DEC, INTVAL (part));
+ return;
+ }
+
if (GET_CODE (x) != REG || REGNO (x) > LAST_ARM_REGNUM)
{
output_operand_lossage ("invalid operand for code '%c'", code);
@@ -15801,6 +15998,28 @@
default: gcc_unreachable ();
}
+ case CC_CZmode:
+ switch (comp_code)
+ {
+ case NE: return ARM_NE;
+ case EQ: return ARM_EQ;
+ case GEU: return ARM_CS;
+ case GTU: return ARM_HI;
+ case LEU: return ARM_LS;
+ case LTU: return ARM_CC;
+ default: gcc_unreachable ();
+ }
+
+ case CC_NCVmode:
+ switch (comp_code)
+ {
+ case GE: return ARM_GE;
+ case LT: return ARM_LT;
+ case GEU: return ARM_CS;
+ case LTU: return ARM_CC;
+ default: gcc_unreachable ();
+ }
+
case CCmode:
switch (comp_code)
{
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2009-12-23 16:36:40 +0000
+++ new/gcc/config/arm/arm.h 2010-07-29 16:58:56 +0000
@@ -2253,19 +2253,7 @@
: reverse_condition (code))
#define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \
- do \
- { \
- if (GET_CODE (OP1) == CONST_INT \
- && ! (const_ok_for_arm (INTVAL (OP1)) \
- || (const_ok_for_arm (- INTVAL (OP1))))) \
- { \
- rtx const_op = OP1; \
- CODE = arm_canonicalize_comparison ((CODE), GET_MODE (OP0), \
- &const_op); \
- OP1 = const_op; \
- } \
- } \
- while (0)
+ (CODE) = arm_canonicalize_comparison (CODE, &(OP0), &(OP1))
/* The arm5 clz instruction returns 32. */
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
=== modified file 'gcc/config/arm/arm.md'
--- old/gcc/config/arm/arm.md 2010-07-29 15:59:12 +0000
+++ new/gcc/config/arm/arm.md 2010-07-29 16:58:56 +0000
@@ -6718,17 +6718,45 @@
operands[3])); DONE;"
)
-;; this uses the Cirrus DI compare instruction
(define_expand "cbranchdi4"
[(set (pc) (if_then_else
(match_operator 0 "arm_comparison_operator"
- [(match_operand:DI 1 "cirrus_fp_register" "")
- (match_operand:DI 2 "cirrus_fp_register" "")])
+ [(match_operand:DI 1 "cmpdi_operand" "")
+ (match_operand:DI 2 "cmpdi_operand" "")])
(label_ref (match_operand 3 "" ""))
(pc)))]
- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
- "emit_jump_insn (gen_cbranch_cc (operands[0], operands[1], operands[2],
- operands[3])); DONE;"
+ "TARGET_32BIT"
+ "{
+ rtx swap = NULL_RTX;
+ enum rtx_code code = GET_CODE (operands[0]);
+
+ /* We should not have two constants. */
+ gcc_assert (GET_MODE (operands[1]) == DImode
+ || GET_MODE (operands[2]) == DImode);
+
+ /* Flip unimplemented DImode comparisons to a form that
+ arm_gen_compare_reg can handle. */
+ switch (code)
+ {
+ case GT:
+ swap = gen_rtx_LT (VOIDmode, operands[2], operands[1]); break;
+ case LE:
+ swap = gen_rtx_GE (VOIDmode, operands[2], operands[1]); break;
+ case GTU:
+ swap = gen_rtx_LTU (VOIDmode, operands[2], operands[1]); break;
+ case LEU:
+ swap = gen_rtx_GEU (VOIDmode, operands[2], operands[1]); break;
+ default:
+ break;
+ }
+ if (swap)
+ emit_jump_insn (gen_cbranch_cc (swap, operands[2], operands[1],
+ operands[3]));
+ else
+ emit_jump_insn (gen_cbranch_cc (operands[0], operands[1], operands[2],
+ operands[3]));
+ DONE;
+ }"
)
(define_insn "*cbranchsi4_insn"
@@ -7880,6 +7908,52 @@
(const_string "alu_shift_reg")))]
)
+;; DImode comparisons. The generic code generates branches that
+;; if-conversion can not reduce to a conditional compare, so we do
+;; that directly.
+
+(define_insn "*arm_cmpdi_insn"
+ [(set (reg:CC_NCV CC_REGNUM)
+ (compare:CC_NCV (match_operand:DI 0 "s_register_operand" "r")
+ (match_operand:DI 1 "arm_di_operand" "rDi")))
+ (clobber (match_scratch:SI 2 "=r"))]
+ "TARGET_32BIT && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)"
+ "cmp\\t%Q0, %Q1\;sbcs\\t%2, %R0, %R1"
+ [(set_attr "conds" "set")
+ (set_attr "length" "8")]
+)
+
+(define_insn "*arm_cmpdi_unsigned"
+ [(set (reg:CC_CZ CC_REGNUM)
+ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r")
+ (match_operand:DI 1 "arm_di_operand" "rDi")))]
+ "TARGET_ARM"
+ "cmp%?\\t%R0, %R1\;cmpeq\\t%Q0, %Q1"
+ [(set_attr "conds" "set")
+ (set_attr "length" "8")]
+)
+
+(define_insn "*arm_cmpdi_zero"
+ [(set (reg:CC_Z CC_REGNUM)
+ (compare:CC_Z (match_operand:DI 0 "s_register_operand" "r")
+ (const_int 0)))
+ (clobber (match_scratch:SI 1 "=r"))]
+ "TARGET_32BIT"
+ "orr%.\\t%1, %Q0, %R0"
+ [(set_attr "conds" "set")]
+)
+
+(define_insn "*thumb_cmpdi_zero"
+ [(set (reg:CC_Z CC_REGNUM)
+ (compare:CC_Z (match_operand:DI 0 "s_register_operand" "l")
+ (const_int 0)))
+ (clobber (match_scratch:SI 1 "=l"))]
+ "TARGET_THUMB1"
+ "orr\\t%1, %Q0, %R0"
+ [(set_attr "conds" "set")
+ (set_attr "length" "2")]
+)
+
;; Cirrus SF compare instruction
(define_insn "*cirrus_cmpsf"
[(set (reg:CCFP CC_REGNUM)
@@ -8183,18 +8257,45 @@
operands[2], operands[3])); DONE;"
)
-;; this uses the Cirrus DI compare instruction
(define_expand "cstoredi4"
[(set (match_operand:SI 0 "s_register_operand" "")
(match_operator:SI 1 "arm_comparison_operator"
- [(match_operand:DI 2 "cirrus_fp_register" "")
- (match_operand:DI 3 "cirrus_fp_register" "")]))]
- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK"
- "emit_insn (gen_cstore_cc (operands[0], operands[1],
- operands[2], operands[3])); DONE;"
+ [(match_operand:DI 2 "cmpdi_operand" "")
+ (match_operand:DI 3 "cmpdi_operand" "")]))]
+ "TARGET_32BIT"
+ "{
+ rtx swap = NULL_RTX;
+ enum rtx_code code = GET_CODE (operands[1]);
+
+ /* We should not have two constants. */
+ gcc_assert (GET_MODE (operands[2]) == DImode
+ || GET_MODE (operands[3]) == DImode);
+
+ /* Flip unimplemented DImode comparisons to a form that
+ arm_gen_compare_reg can handle. */
+ switch (code)
+ {
+ case GT:
+ swap = gen_rtx_LT (VOIDmode, operands[3], operands[2]); break;
+ case LE:
+ swap = gen_rtx_GE (VOIDmode, operands[3], operands[2]); break;
+ case GTU:
+ swap = gen_rtx_LTU (VOIDmode, operands[3], operands[2]); break;
+ case LEU:
+ swap = gen_rtx_GEU (VOIDmode, operands[3], operands[2]); break;
+ default:
+ break;
+ }
+ if (swap)
+ emit_insn (gen_cstore_cc (operands[0], swap, operands[3],
+ operands[2]));
+ else
+ emit_insn (gen_cstore_cc (operands[0], operands[1], operands[2],
+ operands[3]));
+ DONE;
+ }"
)
-
(define_expand "cstoresi_eq0_thumb1"
[(parallel
[(set (match_operand:SI 0 "s_register_operand" "")
=== modified file 'gcc/config/arm/constraints.md'
--- old/gcc/config/arm/constraints.md 2009-12-07 20:34:53 +0000
+++ new/gcc/config/arm/constraints.md 2010-07-29 16:58:56 +0000
@@ -29,7 +29,7 @@
;; in Thumb-1 state: I, J, K, L, M, N, O
;; The following multi-letter normal constraints have been used:
-;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy
+;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy, Di
;; in Thumb-1 state: Pa, Pb
;; in Thumb-2 state: Ps, Pt
@@ -191,6 +191,13 @@
(match_test "TARGET_32BIT && arm_const_double_inline_cost (op) == 4
&& !(optimize_size || arm_ld_sched)")))
+(define_constraint "Di"
+ "@internal
+ In ARM/Thumb-2 state a const_int or const_double where both the high
+ and low SImode words can be generated as immediates in 32-bit instructions."
+ (and (match_code "const_double,const_int")
+ (match_test "TARGET_32BIT && arm_const_double_by_immediates (op)")))
+
(define_constraint "Dn"
"@internal
In ARM/Thumb-2 state a const_vector which can be loaded with a Neon vmov
=== modified file 'gcc/config/arm/predicates.md'
--- old/gcc/config/arm/predicates.md 2010-07-29 15:59:12 +0000
+++ new/gcc/config/arm/predicates.md 2010-07-29 16:58:56 +0000
@@ -86,6 +86,12 @@
(and (match_code "const_int")
(match_test "const_ok_for_arm (INTVAL (op))")))
+;; A constant value which fits into two instructions, each taking
+;; an arithmetic constant operand for one of the words.
+(define_predicate "arm_immediate_di_operand"
+ (and (match_code "const_int,const_double")
+ (match_test "arm_const_double_by_immediates (op)")))
+
(define_predicate "arm_neg_immediate_operand"
(and (match_code "const_int")
(match_test "const_ok_for_arm (-INTVAL (op))")))
@@ -115,6 +121,10 @@
(ior (match_operand 0 "arm_rhs_operand")
(match_operand 0 "arm_not_immediate_operand")))
+(define_predicate "arm_di_operand"
+ (ior (match_operand 0 "s_register_operand")
+ (match_operand 0 "arm_immediate_di_operand")))
+
;; True if the operand is a memory reference which contains an
;; offsettable address.
(define_predicate "offsettable_memory_operand"
@@ -522,4 +532,12 @@
(define_predicate "neon_lane_number"
(and (match_code "const_int")
(match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7")))
+;; Predicates for named expanders that overlap multiple ISAs.
+
+(define_predicate "cmpdi_operand"
+ (if_then_else (match_test "TARGET_HARD_FLOAT && TARGET_MAVERICK")
+ (and (match_test "TARGET_ARM")
+ (match_operand 0 "cirrus_fp_register"))
+ (and (match_test "TARGET_32BIT")
+ (match_operand 0 "arm_di_operand"))))
=== added file 'gcc/testsuite/gcc.c-torture/execute/20100416-1.c'
--- old/gcc/testsuite/gcc.c-torture/execute/20100416-1.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.c-torture/execute/20100416-1.c 2010-07-29 16:58:56 +0000
@@ -0,0 +1,40 @@
+void abort(void);
+
+int
+movegt(int x, int y, long long a)
+{
+ int i;
+ int ret = 0;
+ for (i = 0; i < y; i++)
+ {
+ if (a >= (long long) 0xf000000000000000LL)
+ ret = x;
+ else
+ ret = y;
+ }
+ return ret;
+}
+
+struct test
+{
+ long long val;
+ int ret;
+} tests[] = {
+ { 0xf000000000000000LL, -1 },
+ { 0xefffffffffffffffLL, 1 },
+ { 0xf000000000000001LL, -1 },
+ { 0x0000000000000000LL, -1 },
+ { 0x8000000000000000LL, 1 },
+};
+
+int
+main()
+{
+ int i;
+ for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++)
+ {
+ if (movegt (-1, 1, tests[i].val) != tests[i].ret)
+ abort ();
+ }
+ return 0;
+}

View File

@@ -0,0 +1,244 @@
2010-07-09 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline (originally on Sourcery G++ 4.4):
2010-07-02 Julian Brown <julian@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
PR target/43703
gcc/
* config/arm/vec-common.md (add<mode>3, sub<mode>3, smin<mode>3)
(smax<mode>3): Disable for NEON float modes when
flag_unsafe_math_optimizations is false.
* config/arm/neon.md (*add<mode>3_neon, *sub<mode>3_neon)
(*mul<mode>3_neon)
(mul<mode>3add<mode>_neon, mul<mode>3neg<mode>add<mode>_neon)
(reduc_splus_<mode>, reduc_smin_<mode>, reduc_smax_<mode>): Disable
for NEON float modes when flag_unsafe_math_optimizations is false.
(quad_halves_<code>v4sf): Only enable if flag_unsafe_math_optimizations
is true.
* doc/invoke.texi (ARM Options): Add note about floating point
vectorization requiring -funsafe-math-optimizations.
gcc/testsuite/
* gcc.dg/vect/vect.exp: Add -ffast-math for NEON.
* gcc.dg/vect/vect-reduc-6.c: Add XFAIL for NEON.
2010-07-08 Sandra Loosemore <sandra@codesourcery.com>
Backport from upstream (originally from Sourcery G++ 4.4):
=== modified file 'gcc/config/arm/neon.md'
--- old/gcc/config/arm/neon.md 2010-07-29 15:59:12 +0000
+++ new/gcc/config/arm/neon.md 2010-07-29 17:03:20 +0000
@@ -819,7 +819,7 @@
[(set (match_operand:VDQ 0 "s_register_operand" "=w")
(plus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
(match_operand:VDQ 2 "s_register_operand" "w")))]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
"vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set (attr "neon_type")
(if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
@@ -853,7 +853,7 @@
[(set (match_operand:VDQ 0 "s_register_operand" "=w")
(minus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
(match_operand:VDQ 2 "s_register_operand" "w")))]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
"vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set (attr "neon_type")
(if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
@@ -888,7 +888,7 @@
[(set (match_operand:VDQ 0 "s_register_operand" "=w")
(mult:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
(match_operand:VDQ 2 "s_register_operand" "w")))]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
"vmul.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set (attr "neon_type")
(if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
@@ -910,7 +910,7 @@
(plus:VDQ (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w")
(match_operand:VDQ 3 "s_register_operand" "w"))
(match_operand:VDQ 1 "s_register_operand" "0")))]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
"vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
[(set (attr "neon_type")
(if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
@@ -932,7 +932,7 @@
(minus:VDQ (match_operand:VDQ 1 "s_register_operand" "0")
(mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w")
(match_operand:VDQ 3 "s_register_operand" "w"))))]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
"vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
[(set (attr "neon_type")
(if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
@@ -1361,7 +1361,7 @@
(parallel [(const_int 0) (const_int 1)]))
(vec_select:V2SF (match_dup 1)
(parallel [(const_int 2) (const_int 3)]))))]
- "TARGET_NEON"
+ "TARGET_NEON && flag_unsafe_math_optimizations"
"<VQH_mnem>.f32\t%P0, %e1, %f1"
[(set_attr "vqh_mnem" "<VQH_mnem>")
(set (attr "neon_type")
@@ -1496,7 +1496,7 @@
(define_expand "reduc_splus_<mode>"
[(match_operand:VD 0 "s_register_operand" "")
(match_operand:VD 1 "s_register_operand" "")]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
&gen_neon_vpadd_internal<mode>);
@@ -1506,7 +1506,7 @@
(define_expand "reduc_splus_<mode>"
[(match_operand:VQ 0 "s_register_operand" "")
(match_operand:VQ 1 "s_register_operand" "")]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
rtx step1 = gen_reg_rtx (<V_HALF>mode);
rtx res_d = gen_reg_rtx (<V_HALF>mode);
@@ -1541,7 +1541,7 @@
(define_expand "reduc_smin_<mode>"
[(match_operand:VD 0 "s_register_operand" "")
(match_operand:VD 1 "s_register_operand" "")]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
&gen_neon_vpsmin<mode>);
@@ -1551,7 +1551,7 @@
(define_expand "reduc_smin_<mode>"
[(match_operand:VQ 0 "s_register_operand" "")
(match_operand:VQ 1 "s_register_operand" "")]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
rtx step1 = gen_reg_rtx (<V_HALF>mode);
rtx res_d = gen_reg_rtx (<V_HALF>mode);
@@ -1566,7 +1566,7 @@
(define_expand "reduc_smax_<mode>"
[(match_operand:VD 0 "s_register_operand" "")
(match_operand:VD 1 "s_register_operand" "")]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
&gen_neon_vpsmax<mode>);
@@ -1576,7 +1576,7 @@
(define_expand "reduc_smax_<mode>"
[(match_operand:VQ 0 "s_register_operand" "")
(match_operand:VQ 1 "s_register_operand" "")]
- "TARGET_NEON"
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
rtx step1 = gen_reg_rtx (<V_HALF>mode);
rtx res_d = gen_reg_rtx (<V_HALF>mode);
=== modified file 'gcc/config/arm/vec-common.md'
--- old/gcc/config/arm/vec-common.md 2009-11-11 14:23:03 +0000
+++ new/gcc/config/arm/vec-common.md 2010-07-29 17:03:20 +0000
@@ -57,7 +57,8 @@
[(set (match_operand:VALL 0 "s_register_operand" "")
(plus:VALL (match_operand:VALL 1 "s_register_operand" "")
(match_operand:VALL 2 "s_register_operand" "")))]
- "TARGET_NEON
+ "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
+ || flag_unsafe_math_optimizations))
|| (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
{
})
@@ -66,7 +67,8 @@
[(set (match_operand:VALL 0 "s_register_operand" "")
(minus:VALL (match_operand:VALL 1 "s_register_operand" "")
(match_operand:VALL 2 "s_register_operand" "")))]
- "TARGET_NEON
+ "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
+ || flag_unsafe_math_optimizations))
|| (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
{
})
@@ -75,7 +77,9 @@
[(set (match_operand:VALLW 0 "s_register_operand" "")
(mult:VALLW (match_operand:VALLW 1 "s_register_operand" "")
(match_operand:VALLW 2 "s_register_operand" "")))]
- "TARGET_NEON || (<MODE>mode == V4HImode && TARGET_REALLY_IWMMXT)"
+ "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
+ || flag_unsafe_math_optimizations))
+ || (<MODE>mode == V4HImode && TARGET_REALLY_IWMMXT)"
{
})
@@ -83,7 +87,8 @@
[(set (match_operand:VALLW 0 "s_register_operand" "")
(smin:VALLW (match_operand:VALLW 1 "s_register_operand" "")
(match_operand:VALLW 2 "s_register_operand" "")))]
- "TARGET_NEON
+ "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
+ || flag_unsafe_math_optimizations))
|| (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
{
})
@@ -101,7 +106,8 @@
[(set (match_operand:VALLW 0 "s_register_operand" "")
(smax:VALLW (match_operand:VALLW 1 "s_register_operand" "")
(match_operand:VALLW 2 "s_register_operand" "")))]
- "TARGET_NEON
+ "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
+ || flag_unsafe_math_optimizations))
|| (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
{
})
=== modified file 'gcc/doc/invoke.texi'
--- old/gcc/doc/invoke.texi 2010-07-29 15:53:39 +0000
+++ new/gcc/doc/invoke.texi 2010-07-29 17:03:20 +0000
@@ -9874,6 +9874,14 @@
If @option{-msoft-float} is specified this specifies the format of
floating point values.
+If the selected floating-point hardware includes the NEON extension
+(e.g. @option{-mfpu}=@samp{neon}), note that floating-point
+operations will not be used by GCC's auto-vectorization pass unless
+@option{-funsafe-math-optimizations} is also specified. This is
+because NEON hardware does not fully implement the IEEE 754 standard for
+floating-point arithmetic (in particular denormal values are treated as
+zero), so the use of NEON instructions may lead to a loss of precision.
+
@item -mfp16-format=@var{name}
@opindex mfp16-format
Specify the format of the @code{__fp16} half-precision floating-point type.
=== modified file 'gcc/testsuite/gcc.dg/vect/vect-reduc-6.c'
--- old/gcc/testsuite/gcc.dg/vect/vect-reduc-6.c 2007-09-04 12:05:19 +0000
+++ new/gcc/testsuite/gcc.dg/vect/vect-reduc-6.c 2010-07-29 17:03:20 +0000
@@ -49,5 +49,6 @@
}
/* need -ffast-math to vectorizer these loops. */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
+/* ARM NEON passes -ffast-math to these tests, so expect this to fail. */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail arm_neon_ok } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
=== modified file 'gcc/testsuite/gcc.dg/vect/vect.exp'
--- old/gcc/testsuite/gcc.dg/vect/vect.exp 2010-07-29 15:38:15 +0000
+++ new/gcc/testsuite/gcc.dg/vect/vect.exp 2010-07-29 17:03:20 +0000
@@ -102,6 +102,10 @@
set dg-do-what-default run
} elseif [is-effective-target arm_neon_ok] {
eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
+ # NEON does not support denormals, so is not used for vectorization by
+ # default to avoid loss of precision. We must pass -ffast-math to test
+ # vectorization of float operations.
+ lappend DEFAULT_VECTCFLAGS "-ffast-math"
if [is-effective-target arm_neon_hw] {
set dg-do-what-default run
} else {

View File

@@ -0,0 +1,131 @@
Merge from Sourcery G++ 4.4:
2009-05-21 Sandra Loosemore <sandra@codesourcery.com>
Merge from Sourcery G++ 4.3:
2009-04-04 Sandra Loosemore <sandra@codesourcery.com>
Issue #5104
PR tree-optimization/39604
gcc/testsuite
* g++.dg/tree-ssa/sink-1.C: New.
gcc/
* tree_ssa-sink.c (sink_code_in_bb): Do not sink statements out
of a lexical block containing variable definitions.
2010-07-09 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline (originally on Sourcery G++ 4.4):
2010-07-02 Julian Brown <julian@codesourcery.com>
=== added file 'gcc/testsuite/g++.dg/tree-ssa/sink-1.C'
--- old/gcc/testsuite/g++.dg/tree-ssa/sink-1.C 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/g++.dg/tree-ssa/sink-1.C 2010-07-30 12:14:18 +0000
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+class A {
+ public:
+ A() {}
+ virtual ~A() {}
+ void * dostuff();
+
+ virtual int dovirtual() = 0;
+};
+
+
+class B : public A {
+ public:
+ B() {}
+ int dovirtual() { return 0;}
+ virtual ~B() {};
+};
+
+class C : public B {
+ public:
+ C() {}
+ virtual ~C() {};
+};
+
+void* A::dostuff()
+{
+ return (void*)dovirtual();
+}
+
+/* tree-ssa-sink was sinking the inlined destructor for STUFF out of
+ the first inner block and into the second one, where it was ending up
+ after the inlined constructor for STUFF2. This is bad because
+ cfgexpand aliases STUFF and STUFF2 to the same storage at -O1
+ (i.e., without -fstrict-aliasing), with the result that STUFF2's
+ vtable was getting trashed. */
+
+int main() {
+ {
+ B stuff;
+ stuff.dostuff();
+ }
+ {
+ C stuff2;
+ stuff2.dostuff();
+ }
+ return 0;
+}
+
=== modified file 'gcc/tree-ssa-sink.c'
--- old/gcc/tree-ssa-sink.c 2009-11-28 16:21:00 +0000
+++ new/gcc/tree-ssa-sink.c 2010-07-30 12:14:18 +0000
@@ -470,6 +470,47 @@
last = false;
continue;
}
+
+ /* We cannot move statements that contain references to block-scope
+ variables out of that block, as this may lead to incorrect aliasing
+ when we lay out the stack frame in cfgexpand.c.
+ In lieu of more sophisticated analysis, be very conservative here
+ and prohibit moving any statement that references memory out of a
+ block with variables. */
+ if (gimple_references_memory_p (stmt))
+ {
+ tree fromblock = gimple_block (stmt);
+ while (fromblock
+ && fromblock != current_function_decl
+ && !BLOCK_VARS (fromblock))
+ fromblock = BLOCK_SUPERCONTEXT (fromblock);
+ if (fromblock && fromblock != current_function_decl)
+ {
+ gimple tostmt;
+ tree toblock;
+
+ if (gsi_end_p (togsi))
+ tostmt = gimple_seq_last_stmt (gsi_seq (togsi));
+ else
+ tostmt = gsi_stmt (togsi);
+ if (tostmt)
+ toblock = gimple_block (tostmt);
+ else
+ toblock = NULL;
+ while (toblock
+ && toblock != current_function_decl
+ && toblock != fromblock)
+ toblock = BLOCK_SUPERCONTEXT (toblock);
+ if (!toblock || toblock != fromblock)
+ {
+ if (!gsi_end_p (gsi))
+ gsi_prev (&gsi);
+ last = false;
+ continue;
+ }
+ }
+ }
+
if (dump_file)
{
fprintf (dump_file, "Sinking ");

View File

@@ -0,0 +1,81 @@
2010-07-10 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
2009-05-28 Julian Brown <julian@codesourcery.com>
Merged from Sourcery G++ 4.3:
libgcc/
* config.host (arm*-*-linux*, arm*-*-uclinux*, arm*-*-eabi*)
(arm*-*-symbianelf): Add arm/t-divmod-ef to tmake_file.
* Makefile.in (LIB2_DIVMOD_EXCEPTION_FLAGS): Set to previous
default if not set by a target-specific Makefile fragment.
(lib2-divmod-o, lib2-divmod-s-o): Use above.
* config/arm/t-divmod-ef: New.
2010-07-09 Sandra Loosemore <sandra@codesourcery.com>
Merge from Sourcery G++ 4.4:
=== modified file 'libgcc/Makefile.in'
--- old/libgcc/Makefile.in 2010-03-30 12:08:52 +0000
+++ new/libgcc/Makefile.in 2010-07-30 12:21:02 +0000
@@ -400,18 +400,24 @@
endif
endif
+ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
+# Provide default flags for compiling divmod functions, if they haven't been
+# set already by a target-specific Makefile fragment.
+LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
+endif
+
# Build LIB2_DIVMOD_FUNCS.
lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
$(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
- -fexceptions -fnon-call-exceptions $(vis_hide)
+ $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide)
libgcc-objects += $(lib2-divmod-o)
ifeq ($(enable_shared),yes)
lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
$(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
- -fexceptions -fnon-call-exceptions
+ $(LIB2_DIVMOD_EXCEPTION_FLAGS)
libgcc-s-objects += $(lib2-divmod-s-o)
endif
=== modified file 'libgcc/config.host'
--- old/libgcc/config.host 2010-04-02 02:02:18 +0000
+++ new/libgcc/config.host 2010-07-30 12:21:02 +0000
@@ -208,12 +208,15 @@
arm*-*-netbsd*)
;;
arm*-*-linux*) # ARM GNU/Linux with ELF
+ tmake_file="${tmake_file} arm/t-divmod-ef"
;;
arm*-*-uclinux*) # ARM ucLinux
+ tmake_file="${tmake_file} arm/t-divmod-ef"
;;
arm*-*-ecos-elf)
;;
arm*-*-eabi* | arm*-*-symbianelf* )
+ tmake_file="${tmake_file} arm/t-divmod-ef"
;;
arm*-*-rtems*)
;;
=== added directory 'libgcc/config/arm'
=== added file 'libgcc/config/arm/t-divmod-ef'
--- old/libgcc/config/arm/t-divmod-ef 1970-01-01 00:00:00 +0000
+++ new/libgcc/config/arm/t-divmod-ef 2010-07-30 12:21:02 +0000
@@ -0,0 +1,4 @@
+# On ARM, specifying -fnon-call-exceptions will needlessly pull in
+# the unwinder in simple programs which use 64-bit division. Omitting
+# the option is safe.
+LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions

View File

@@ -0,0 +1,52 @@
2009-09-02 Daniel Jacobowitz <dan@codesourcery.com>
libgcc/
* shared-object.mk (c_flags-$(base)$(objext)): New.
($(base)$(objext)): Use above.
($(base)_s$(objext)): Likewise.
* static-object.mk (c_flags-$(base)$(objext)): New.
($(base)$(objext)): Use above.
2010-07-10 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
2009-05-28 Julian Brown <julian@codesourcery.com>
Merged from Sourcery G++ 4.3:
=== modified file 'libgcc/shared-object.mk'
--- old/libgcc/shared-object.mk 2008-07-03 18:22:00 +0000
+++ new/libgcc/shared-object.mk 2010-07-30 13:11:02 +0000
@@ -8,11 +8,13 @@
ifeq ($(suffix $o),.c)
+c_flags-$(base)$(objext) := $(c_flags)
$(base)$(objext): $o
- $(gcc_compile) $(c_flags) -c $< $(vis_hide)
+ $(gcc_compile) $(c_flags-$@) -c $< $(vis_hide)
+c_flags-$(base)_s$(objext) := $(c_flags)
$(base)_s$(objext): $o
- $(gcc_s_compile) $(c_flags) -c $<
+ $(gcc_s_compile) $(c_flags-$@) -c $<
else
=== modified file 'libgcc/static-object.mk'
--- old/libgcc/static-object.mk 2007-01-04 04:22:37 +0000
+++ new/libgcc/static-object.mk 2010-07-30 13:11:02 +0000
@@ -8,8 +8,9 @@
ifeq ($(suffix $o),.c)
+c_flags-$(base)$(objext) := $(c_flags)
$(base)$(objext): $o
- $(gcc_compile) $(c_flags) -c $< $(vis_hide)
+ $(gcc_compile) $(c_flags-$@) -c $< $(vis_hide)
else

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,138 @@
2010-07-12 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
2009-10-06 Paul Brook <paul@codesourcery.com>
Issue #3869
gcc/
* target.h (gcc_target): Add warn_func_result.
* target-def.h (TARGET_WARN_FUNC_RESULT): Define and use.
* tree-cfg.h (execute_warn_function_return): Use
targetm.warn_func_result.
* config/arm/arm.c (TARGET_WARN_FUNC_RESULT): Define.
(arm_warn_func_result): New function.
gcc/testuite/
* gcc.target/arm/naked-3.c: New test.
2010-07-10 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline:
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-07-29 16:58:56 +0000
+++ new/gcc/config/arm/arm.c 2010-07-30 13:58:02 +0000
@@ -214,6 +214,7 @@
static int arm_issue_rate (void);
static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static bool arm_allocate_stack_slots_for_args (void);
+static bool arm_warn_func_result (void);
static const char *arm_invalid_parameter_type (const_tree t);
static const char *arm_invalid_return_type (const_tree t);
static tree arm_promoted_type (const_tree t);
@@ -378,6 +379,9 @@
#undef TARGET_TRAMPOLINE_ADJUST_ADDRESS
#define TARGET_TRAMPOLINE_ADJUST_ADDRESS arm_trampoline_adjust_address
+#undef TARGET_WARN_FUNC_RESULT
+#define TARGET_WARN_FUNC_RESULT arm_warn_func_result
+
#undef TARGET_DEFAULT_SHORT_ENUMS
#define TARGET_DEFAULT_SHORT_ENUMS arm_default_short_enums
@@ -2008,6 +2012,14 @@
return !IS_NAKED (arm_current_func_type ());
}
+static bool
+arm_warn_func_result (void)
+{
+ /* Naked functions are implemented entirely in assembly, including the
+ return sequence, so suppress warnings about this. */
+ return !IS_NAKED (arm_current_func_type ());
+}
+
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts.
=== modified file 'gcc/target-def.h'
--- old/gcc/target-def.h 2010-03-24 20:44:48 +0000
+++ new/gcc/target-def.h 2010-07-30 13:58:02 +0000
@@ -212,6 +212,10 @@
#define TARGET_EXTRA_LIVE_ON_ENTRY hook_void_bitmap
#endif
+#ifndef TARGET_WARN_FUNC_RESULT
+#define TARGET_WARN_FUNC_RESULT hook_bool_void_true
+#endif
+
#ifndef TARGET_ASM_FILE_START_APP_OFF
#define TARGET_ASM_FILE_START_APP_OFF false
#endif
@@ -1020,6 +1024,7 @@
TARGET_EMUTLS, \
TARGET_OPTION_HOOKS, \
TARGET_EXTRA_LIVE_ON_ENTRY, \
+ TARGET_WARN_FUNC_RESULT, \
TARGET_UNWIND_TABLES_DEFAULT, \
TARGET_HAVE_NAMED_SECTIONS, \
TARGET_HAVE_SWITCHABLE_BSS_SECTIONS, \
=== modified file 'gcc/target.h'
--- old/gcc/target.h 2010-03-27 10:27:39 +0000
+++ new/gcc/target.h 2010-07-30 13:58:02 +0000
@@ -1171,6 +1171,10 @@
bits in the bitmap passed in. */
void (*live_on_entry) (bitmap);
+ /* Return false if warnings about missing return statements or suspect
+ noreturn attributes should be suppressed for the current function. */
+ bool (*warn_func_result) (void);
+
/* True if unwinding tables should be generated by default. */
bool unwind_tables_default;
=== added file 'gcc/testsuite/gcc.target/arm/naked-3.c'
--- old/gcc/testsuite/gcc.target/arm/naked-3.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/naked-3.c 2010-07-30 13:58:02 +0000
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+/* Check that we do not get warnings about missing return statements
+ or bogus looking noreturn functions. */
+int __attribute__((naked))
+foo(void)
+{
+ __asm__ volatile ("mov r0, #1\r\nbx lr\n");
+}
+
+int __attribute__((naked,noreturn))
+bar(void)
+{
+ __asm__ volatile ("frob r0\n");
+}
=== modified file 'gcc/tree-cfg.c'
--- old/gcc/tree-cfg.c 2010-03-16 12:31:38 +0000
+++ new/gcc/tree-cfg.c 2010-07-30 13:58:02 +0000
@@ -47,6 +47,7 @@
#include "value-prof.h"
#include "pointer-set.h"
#include "tree-inline.h"
+#include "target.h"
/* This file contains functions for building the Control Flow Graph (CFG)
for a function tree. */
@@ -7092,6 +7093,9 @@
edge e;
edge_iterator ei;
+ if (!targetm.warn_func_result())
+ return 0;
+
/* If we have a path to EXIT, then we do return. */
if (TREE_THIS_VOLATILE (cfun->decl)
&& EDGE_COUNT (EXIT_BLOCK_PTR->preds) > 0)

View File

@@ -0,0 +1,112 @@
2010-07-15 Jie Zhang <jie@codesourcery.com>
Backport from mainline (originally from Sourcery G++ 4.4):
gcc/cp/
2010-04-07 Jie Zhang <jie@codesourcery.com>
PR c++/42556
* typeck2.c (split_nonconstant_init_1): Drop empty CONSTRUCTOR
when all of its elements are non-constant and have been split out.
gcc/testsuite/
2010-04-07 Jie Zhang <jie@codesourcery.com>
PR c++/42556
* g++.dg/init/pr42556.C: New test.
2010-07-12 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
=== modified file 'gcc/cp/typeck2.c'
--- old/gcc/cp/typeck2.c 2010-02-23 18:32:20 +0000
+++ new/gcc/cp/typeck2.c 2010-07-30 14:05:57 +0000
@@ -549,13 +549,15 @@
expression to which INIT should be assigned. INIT is a CONSTRUCTOR. */
static void
-split_nonconstant_init_1 (tree dest, tree init)
+split_nonconstant_init_1 (tree dest, tree *initp)
{
unsigned HOST_WIDE_INT idx;
+ tree init = *initp;
tree field_index, value;
tree type = TREE_TYPE (dest);
tree inner_type = NULL;
bool array_type_p = false;
+ HOST_WIDE_INT num_type_elements, num_initialized_elements;
switch (TREE_CODE (type))
{
@@ -567,6 +569,7 @@
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
+ num_initialized_elements = 0;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (init), idx,
field_index, value)
{
@@ -589,12 +592,13 @@
sub = build3 (COMPONENT_REF, inner_type, dest, field_index,
NULL_TREE);
- split_nonconstant_init_1 (sub, value);
+ split_nonconstant_init_1 (sub, &value);
}
else if (!initializer_constant_valid_p (value, inner_type))
{
tree code;
tree sub;
+ HOST_WIDE_INT inner_elements;
/* FIXME: Ordered removal is O(1) so the whole function is
worst-case quadratic. This could be fixed using an aside
@@ -617,9 +621,22 @@
code = build2 (INIT_EXPR, inner_type, sub, value);
code = build_stmt (input_location, EXPR_STMT, code);
add_stmt (code);
+
+ inner_elements = count_type_elements (inner_type, true);
+ if (inner_elements < 0)
+ num_initialized_elements = -1;
+ else if (num_initialized_elements >= 0)
+ num_initialized_elements += inner_elements;
continue;
}
}
+
+ num_type_elements = count_type_elements (type, true);
+ /* If all elements of the initializer are non-constant and
+ have been split out, we don't need the empty CONSTRUCTOR. */
+ if (num_type_elements > 0
+ && num_type_elements == num_initialized_elements)
+ *initp = NULL;
break;
case VECTOR_TYPE:
@@ -655,7 +672,7 @@
if (TREE_CODE (init) == CONSTRUCTOR)
{
code = push_stmt_list ();
- split_nonconstant_init_1 (dest, init);
+ split_nonconstant_init_1 (dest, &init);
code = pop_stmt_list (code);
DECL_INITIAL (dest) = init;
TREE_READONLY (dest) = 0;
=== added file 'gcc/testsuite/g++.dg/init/pr42556.C'
--- old/gcc/testsuite/g++.dg/init/pr42556.C 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/g++.dg/init/pr42556.C 2010-07-30 14:05:57 +0000
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// { dg-options "-fdump-tree-gimple" }
+
+void foo (int a, int b, int c, int d)
+{
+ int v[4] = {a, b, c, d};
+}
+
+// { dg-final { scan-tree-dump-not "v = {}" "gimple" } }
+// { dg-final { cleanup-tree-dump "gimple" } }

View File

@@ -0,0 +1,36 @@
Backport from mainline (originally from Sourcery G++ 4.4):
gcc/
2010-07-07 Jie Zhang <jie@codesourcery.com>
* genautomata.c (output_automata_list_min_issue_delay_code):
Correctly decompress min_issue_delay.
2010-07-15 Jie Zhang <jie@codesourcery.com>
Issue #8980
Backport from mainline (originally from Sourcery G++ 4.4):
=== modified file 'gcc/genautomata.c'
--- old/gcc/genautomata.c 2009-11-25 10:55:54 +0000
+++ new/gcc/genautomata.c 2010-07-30 14:21:58 +0000
@@ -7865,12 +7865,15 @@
{
fprintf (output_file, ") / %d];\n",
automaton->min_issue_delay_table_compression_factor);
- fprintf (output_file, " %s = (%s >> (8 - (",
+ fprintf (output_file, " %s = (%s >> (8 - ((",
TEMPORARY_VARIABLE_NAME, TEMPORARY_VARIABLE_NAME);
output_translate_vect_name (output_file, automaton);
+ fprintf (output_file, " [%s] + ", INTERNAL_INSN_CODE_NAME);
+ fprintf (output_file, "%s->", CHIP_PARAMETER_NAME);
+ output_chip_member_name (output_file, automaton);
+ fprintf (output_file, " * %d)", automaton->insn_equiv_classes_num);
fprintf
- (output_file, " [%s] %% %d + 1) * %d)) & %d;\n",
- INTERNAL_INSN_CODE_NAME,
+ (output_file, " %% %d + 1) * %d)) & %d;\n",
automaton->min_issue_delay_table_compression_factor,
8 / automaton->min_issue_delay_table_compression_factor,
(1 << (8 / automaton->min_issue_delay_table_compression_factor))

View File

@@ -0,0 +1,714 @@
2010-07-15 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline:
2010-06-09 Sandra Loosemore <sandra@codesourcery.com>
gcc/
* tree-ssa-loop-ivopts.c (adjust_setup_cost): New function.
(get_computation_cost_at): Use it.
(determine_use_iv_cost_condition): Likewise.
(determine_iv_cost): Likewise.
2010-07-05 Sandra Loosemore <sandra@codesourcery.com>
PR middle-end/42505
gcc/
* tree-ssa-loop-ivopts.c (determine_set_costs): Delete obsolete
comments about cost model.
(try_add_cand_for): Add second strategy for choosing initial set
based on original IVs, controlled by ORIGINALP argument.
(get_initial_solution): Add ORIGINALP argument.
(find_optimal_iv_set_1): New function, split from find_optimal_iv_set.
(find_optimal_iv_set): Try two different strategies for choosing
the IV set, and return the one with lower cost.
gcc/testsuite/
* gcc.target/arm/pr42505.c: New test case.
2010-07-10 Sandra Loosemore <sandra@codesourcery.com>
PR middle-end/42505
gcc/
* tree-inline.c (estimate_num_insns): Refactor builtin complexity
lookup code into....
* builtins.c (is_simple_builtin, is_inexpensive_builtin): ...these
new functions.
* tree.h (is_simple_builtin, is_inexpensive_builtin): Declare.
* cfgloopanal.c (target_clobbered_regs): Define.
(init_set_costs): Initialize target_clobbered_regs.
(estimate_reg_pressure_cost): Add call_p argument. When true,
adjust the number of available registers to exclude the
call-clobbered registers.
* cfgloop.h (target_clobbered_regs): Declare.
(estimate_reg_pressure_cost): Adjust declaration.
* tree-ssa-loop-ivopts.c (struct ivopts_data): Add body_includes_call.
(ivopts_global_cost_for_size): Pass it to estimate_reg_pressure_cost.
(determine_set_costs): Dump target_clobbered_regs.
(loop_body_includes_call): New function.
(tree_ssa_iv_optimize_loop): Use it to initialize new field.
* loop-invariant.c (gain_for_invariant): Adjust arguments to pass
call_p flag through.
(best_gain_for_invariant): Likewise.
(find_invariants_to_move): Likewise.
(move_single_loop_invariants): Likewise, using already-computed
has_call field.
2010-07-15 Jie Zhang <jie@codesourcery.com>
Issue #8497, #8893
=== modified file 'gcc/builtins.c'
--- old/gcc/builtins.c 2010-04-13 12:47:11 +0000
+++ new/gcc/builtins.c 2010-08-02 13:51:23 +0000
@@ -13624,3 +13624,123 @@
break;
}
}
+
+/* Return true if DECL is a builtin that expands to a constant or similarly
+ simple code. */
+bool
+is_simple_builtin (tree decl)
+{
+ if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (decl))
+ {
+ /* Builtins that expand to constants. */
+ case BUILT_IN_CONSTANT_P:
+ case BUILT_IN_EXPECT:
+ case BUILT_IN_OBJECT_SIZE:
+ case BUILT_IN_UNREACHABLE:
+ /* Simple register moves or loads from stack. */
+ case BUILT_IN_RETURN_ADDRESS:
+ case BUILT_IN_EXTRACT_RETURN_ADDR:
+ case BUILT_IN_FROB_RETURN_ADDR:
+ case BUILT_IN_RETURN:
+ case BUILT_IN_AGGREGATE_INCOMING_ADDRESS:
+ case BUILT_IN_FRAME_ADDRESS:
+ case BUILT_IN_VA_END:
+ case BUILT_IN_STACK_SAVE:
+ case BUILT_IN_STACK_RESTORE:
+ /* Exception state returns or moves registers around. */
+ case BUILT_IN_EH_FILTER:
+ case BUILT_IN_EH_POINTER:
+ case BUILT_IN_EH_COPY_VALUES:
+ return true;
+
+ default:
+ return false;
+ }
+
+ return false;
+}
+
+/* Return true if DECL is a builtin that is not expensive, i.e., they are
+ most probably expanded inline into reasonably simple code. This is a
+ superset of is_simple_builtin. */
+bool
+is_inexpensive_builtin (tree decl)
+{
+ if (!decl)
+ return false;
+ else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_MD)
+ return true;
+ else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (decl))
+ {
+ case BUILT_IN_ABS:
+ case BUILT_IN_ALLOCA:
+ case BUILT_IN_BSWAP32:
+ case BUILT_IN_BSWAP64:
+ case BUILT_IN_CLZ:
+ case BUILT_IN_CLZIMAX:
+ case BUILT_IN_CLZL:
+ case BUILT_IN_CLZLL:
+ case BUILT_IN_CTZ:
+ case BUILT_IN_CTZIMAX:
+ case BUILT_IN_CTZL:
+ case BUILT_IN_CTZLL:
+ case BUILT_IN_FFS:
+ case BUILT_IN_FFSIMAX:
+ case BUILT_IN_FFSL:
+ case BUILT_IN_FFSLL:
+ case BUILT_IN_IMAXABS:
+ case BUILT_IN_FINITE:
+ case BUILT_IN_FINITEF:
+ case BUILT_IN_FINITEL:
+ case BUILT_IN_FINITED32:
+ case BUILT_IN_FINITED64:
+ case BUILT_IN_FINITED128:
+ case BUILT_IN_FPCLASSIFY:
+ case BUILT_IN_ISFINITE:
+ case BUILT_IN_ISINF_SIGN:
+ case BUILT_IN_ISINF:
+ case BUILT_IN_ISINFF:
+ case BUILT_IN_ISINFL:
+ case BUILT_IN_ISINFD32:
+ case BUILT_IN_ISINFD64:
+ case BUILT_IN_ISINFD128:
+ case BUILT_IN_ISNAN:
+ case BUILT_IN_ISNANF:
+ case BUILT_IN_ISNANL:
+ case BUILT_IN_ISNAND32:
+ case BUILT_IN_ISNAND64:
+ case BUILT_IN_ISNAND128:
+ case BUILT_IN_ISNORMAL:
+ case BUILT_IN_ISGREATER:
+ case BUILT_IN_ISGREATEREQUAL:
+ case BUILT_IN_ISLESS:
+ case BUILT_IN_ISLESSEQUAL:
+ case BUILT_IN_ISLESSGREATER:
+ case BUILT_IN_ISUNORDERED:
+ case BUILT_IN_VA_ARG_PACK:
+ case BUILT_IN_VA_ARG_PACK_LEN:
+ case BUILT_IN_VA_COPY:
+ case BUILT_IN_TRAP:
+ case BUILT_IN_SAVEREGS:
+ case BUILT_IN_POPCOUNTL:
+ case BUILT_IN_POPCOUNTLL:
+ case BUILT_IN_POPCOUNTIMAX:
+ case BUILT_IN_POPCOUNT:
+ case BUILT_IN_PARITYL:
+ case BUILT_IN_PARITYLL:
+ case BUILT_IN_PARITYIMAX:
+ case BUILT_IN_PARITY:
+ case BUILT_IN_LABS:
+ case BUILT_IN_LLABS:
+ case BUILT_IN_PREFETCH:
+ return true;
+
+ default:
+ return is_simple_builtin (decl);
+ }
+
+ return false;
+}
+
=== modified file 'gcc/cfgloop.h'
--- old/gcc/cfgloop.h 2009-11-25 10:55:54 +0000
+++ new/gcc/cfgloop.h 2010-08-02 13:51:23 +0000
@@ -622,13 +622,14 @@
/* The properties of the target. */
extern unsigned target_avail_regs;
+extern unsigned target_clobbered_regs;
extern unsigned target_res_regs;
extern unsigned target_reg_cost [2];
extern unsigned target_spill_cost [2];
/* Register pressure estimation for induction variable optimizations & loop
invariant motion. */
-extern unsigned estimate_reg_pressure_cost (unsigned, unsigned, bool);
+extern unsigned estimate_reg_pressure_cost (unsigned, unsigned, bool, bool);
extern void init_set_costs (void);
/* Loop optimizer initialization. */
=== modified file 'gcc/cfgloopanal.c'
--- old/gcc/cfgloopanal.c 2009-09-30 08:57:56 +0000
+++ new/gcc/cfgloopanal.c 2010-08-02 13:51:23 +0000
@@ -320,6 +320,8 @@
/* The properties of the target. */
unsigned target_avail_regs; /* Number of available registers. */
+unsigned target_clobbered_regs; /* Number of available registers that are
+ call-clobbered. */
unsigned target_res_regs; /* Number of registers reserved for temporary
expressions. */
unsigned target_reg_cost[2]; /* The cost for register when there still
@@ -342,10 +344,15 @@
unsigned i;
target_avail_regs = 0;
+ target_clobbered_regs = 0;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], i)
&& !fixed_regs[i])
- target_avail_regs++;
+ {
+ target_avail_regs++;
+ if (call_used_regs[i])
+ target_clobbered_regs++;
+ }
target_res_regs = 3;
@@ -379,20 +386,29 @@
/* Estimates cost of increased register pressure caused by making N_NEW new
registers live around the loop. N_OLD is the number of registers live
- around the loop. */
+ around the loop. If CALL_P is true, also take into account that
+ call-used registers may be clobbered in the loop body, reducing the
+ number of available registers before we spill. */
unsigned
-estimate_reg_pressure_cost (unsigned n_new, unsigned n_old, bool speed)
+estimate_reg_pressure_cost (unsigned n_new, unsigned n_old, bool speed,
+ bool call_p)
{
unsigned cost;
unsigned regs_needed = n_new + n_old;
+ unsigned available_regs = target_avail_regs;
+
+ /* If there is a call in the loop body, the call-clobbered registers
+ are not available for loop invariants. */
+ if (call_p)
+ available_regs = available_regs - target_clobbered_regs;
/* If we have enough registers, we should use them and not restrict
the transformations unnecessarily. */
- if (regs_needed + target_res_regs <= target_avail_regs)
+ if (regs_needed + target_res_regs <= available_regs)
return 0;
- if (regs_needed <= target_avail_regs)
+ if (regs_needed <= available_regs)
/* If we are close to running out of registers, try to preserve
them. */
cost = target_reg_cost [speed] * n_new;
=== modified file 'gcc/loop-invariant.c'
--- old/gcc/loop-invariant.c 2010-04-02 18:54:46 +0000
+++ new/gcc/loop-invariant.c 2010-08-02 13:51:23 +0000
@@ -1173,11 +1173,13 @@
/* Calculates gain for eliminating invariant INV. REGS_USED is the number
of registers used in the loop, NEW_REGS is the number of new variables
already added due to the invariant motion. The number of registers needed
- for it is stored in *REGS_NEEDED. */
+ for it is stored in *REGS_NEEDED. SPEED and CALL_P are flags passed
+ through to estimate_reg_pressure_cost. */
static int
gain_for_invariant (struct invariant *inv, unsigned *regs_needed,
- unsigned *new_regs, unsigned regs_used, bool speed)
+ unsigned *new_regs, unsigned regs_used,
+ bool speed, bool call_p)
{
int comp_cost, size_cost;
@@ -1188,9 +1190,9 @@
if (! flag_ira_loop_pressure)
{
size_cost = (estimate_reg_pressure_cost (new_regs[0] + regs_needed[0],
- regs_used, speed)
+ regs_used, speed, call_p)
- estimate_reg_pressure_cost (new_regs[0],
- regs_used, speed));
+ regs_used, speed, call_p));
}
else
{
@@ -1245,7 +1247,8 @@
static int
best_gain_for_invariant (struct invariant **best, unsigned *regs_needed,
- unsigned *new_regs, unsigned regs_used, bool speed)
+ unsigned *new_regs, unsigned regs_used,
+ bool speed, bool call_p)
{
struct invariant *inv;
int i, gain = 0, again;
@@ -1261,7 +1264,7 @@
continue;
again = gain_for_invariant (inv, aregs_needed, new_regs, regs_used,
- speed);
+ speed, call_p);
if (again > gain)
{
gain = again;
@@ -1314,7 +1317,7 @@
/* Determines which invariants to move. */
static void
-find_invariants_to_move (bool speed)
+find_invariants_to_move (bool speed, bool call_p)
{
int gain;
unsigned i, regs_used, regs_needed[N_REG_CLASSES], new_regs[N_REG_CLASSES];
@@ -1353,7 +1356,8 @@
new_regs[ira_reg_class_cover[i]] = 0;
}
while ((gain = best_gain_for_invariant (&inv, regs_needed,
- new_regs, regs_used, speed)) > 0)
+ new_regs, regs_used,
+ speed, call_p)) > 0)
{
set_move_mark (inv->invno, gain);
if (! flag_ira_loop_pressure)
@@ -1554,7 +1558,8 @@
init_inv_motion_data ();
find_invariants (loop);
- find_invariants_to_move (optimize_loop_for_speed_p (loop));
+ find_invariants_to_move (optimize_loop_for_speed_p (loop),
+ LOOP_DATA (loop)->has_call);
move_invariants (loop);
free_inv_motion_data ();
=== added file 'gcc/testsuite/gcc.target/arm/pr42505.c'
--- old/gcc/testsuite/gcc.target/arm/pr42505.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/pr42505.c 2010-08-02 13:51:23 +0000
@@ -0,0 +1,23 @@
+/* { dg-options "-mthumb -Os -march=armv5te" } */
+/* { dg-require-effective-target arm_thumb1_ok } */
+/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */
+
+struct A {
+ int f1;
+ int f2;
+};
+
+int func(int c);
+
+/* This function should not need to spill anything to the stack. */
+int test(struct A* src, struct A* dst, int count)
+{
+ while (count--) {
+ if (!func(src->f2)) {
+ return 0;
+ }
+ *dst++ = *src++;
+ }
+
+ return 1;
+}
=== modified file 'gcc/tree-inline.c'
--- old/gcc/tree-inline.c 2010-03-18 20:07:13 +0000
+++ new/gcc/tree-inline.c 2010-08-02 13:51:23 +0000
@@ -3246,34 +3246,13 @@
if (POINTER_TYPE_P (funtype))
funtype = TREE_TYPE (funtype);
- if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_MD)
+ if (is_simple_builtin (decl))
+ return 0;
+ else if (is_inexpensive_builtin (decl))
cost = weights->target_builtin_call_cost;
else
cost = weights->call_cost;
- if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
- switch (DECL_FUNCTION_CODE (decl))
- {
- case BUILT_IN_CONSTANT_P:
- return 0;
- case BUILT_IN_EXPECT:
- return 0;
-
- /* Prefetch instruction is not expensive. */
- case BUILT_IN_PREFETCH:
- cost = weights->target_builtin_call_cost;
- break;
-
- /* Exception state returns or moves registers around. */
- case BUILT_IN_EH_FILTER:
- case BUILT_IN_EH_POINTER:
- case BUILT_IN_EH_COPY_VALUES:
- return 0;
-
- default:
- break;
- }
-
if (decl)
funtype = TREE_TYPE (decl);
=== modified file 'gcc/tree-ssa-loop-ivopts.c'
--- old/gcc/tree-ssa-loop-ivopts.c 2010-04-01 15:18:07 +0000
+++ new/gcc/tree-ssa-loop-ivopts.c 2010-08-02 13:51:23 +0000
@@ -257,6 +257,9 @@
/* Are we optimizing for speed? */
bool speed;
+
+ /* Whether the loop body includes any function calls. */
+ bool body_includes_call;
};
/* An assignment of iv candidates to uses. */
@@ -2926,6 +2929,20 @@
return get_computation_at (loop, use, cand, use->stmt);
}
+/* Adjust the cost COST for being in loop setup rather than loop body.
+ If we're optimizing for space, the loop setup overhead is constant;
+ if we're optimizing for speed, amortize it over the per-iteration cost. */
+static unsigned
+adjust_setup_cost (struct ivopts_data *data, unsigned cost)
+{
+ if (cost == INFTY)
+ return cost;
+ else if (optimize_loop_for_speed_p (data->current_loop))
+ return cost / AVG_LOOP_NITER (data->current_loop);
+ else
+ return cost;
+}
+
/* Returns cost of addition in MODE. */
static unsigned
@@ -3838,8 +3855,8 @@
/* Symbol + offset should be compile-time computable so consider that they
are added once to the variable, if present. */
if (var_present && (symbol_present || offset))
- cost.cost += add_cost (TYPE_MODE (ctype), speed)
- / AVG_LOOP_NITER (data->current_loop);
+ cost.cost += adjust_setup_cost (data,
+ add_cost (TYPE_MODE (ctype), speed));
/* Having offset does not affect runtime cost in case it is added to
symbol, but it increases complexity. */
@@ -4104,7 +4121,7 @@
elim_cost = force_var_cost (data, bound, &depends_on_elim);
/* The bound is a loop invariant, so it will be only computed
once. */
- elim_cost.cost /= AVG_LOOP_NITER (data->current_loop);
+ elim_cost.cost = adjust_setup_cost (data, elim_cost.cost);
}
else
elim_cost = infinite_cost;
@@ -4351,7 +4368,7 @@
cost_base = force_var_cost (data, base, NULL);
cost_step = add_cost (TYPE_MODE (TREE_TYPE (base)), data->speed);
- cost = cost_step + cost_base.cost / AVG_LOOP_NITER (current_loop);
+ cost = cost_step + adjust_setup_cost (data, cost_base.cost);
/* Prefer the original ivs unless we may gain something by replacing it.
The reason is to make debugging simpler; so this is not relevant for
@@ -4404,7 +4421,8 @@
{
/* We add size to the cost, so that we prefer eliminating ivs
if possible. */
- return size + estimate_reg_pressure_cost (size, data->regs_used, data->speed);
+ return size + estimate_reg_pressure_cost (size, data->regs_used, data->speed,
+ data->body_includes_call);
}
/* For each size of the induction variable set determine the penalty. */
@@ -4419,30 +4437,11 @@
struct loop *loop = data->current_loop;
bitmap_iterator bi;
- /* We use the following model (definitely improvable, especially the
- cost function -- TODO):
-
- We estimate the number of registers available (using MD data), name it A.
-
- We estimate the number of registers used by the loop, name it U. This
- number is obtained as the number of loop phi nodes (not counting virtual
- registers and bivs) + the number of variables from outside of the loop.
-
- We set a reserve R (free regs that are used for temporary computations,
- etc.). For now the reserve is a constant 3.
-
- Let I be the number of induction variables.
-
- -- if U + I + R <= A, the cost is I * SMALL_COST (just not to encourage
- make a lot of ivs without a reason).
- -- if A - R < U + I <= A, the cost is I * PRES_COST
- -- if U + I > A, the cost is I * PRES_COST and
- number of uses * SPILL_COST * (U + I - A) / (U + I) is added. */
-
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Global costs:\n");
fprintf (dump_file, " target_avail_regs %d\n", target_avail_regs);
+ fprintf (dump_file, " target_clobbered_regs %d\n", target_clobbered_regs);
fprintf (dump_file, " target_reg_cost %d\n", target_reg_cost[data->speed]);
fprintf (dump_file, " target_spill_cost %d\n", target_spill_cost[data->speed]);
}
@@ -5062,11 +5061,13 @@
}
/* Tries to extend the sets IVS in the best possible way in order
- to express the USE. */
+ to express the USE. If ORIGINALP is true, prefer candidates from
+ the original set of IVs, otherwise favor important candidates not
+ based on any memory object. */
static bool
try_add_cand_for (struct ivopts_data *data, struct iv_ca *ivs,
- struct iv_use *use)
+ struct iv_use *use, bool originalp)
{
comp_cost best_cost, act_cost;
unsigned i;
@@ -5085,7 +5086,8 @@
iv_ca_set_no_cp (data, ivs, use);
}
- /* First try important candidates not based on any memory object. Only if
+ /* If ORIGINALP is true, try to find the original IV for the use. Otherwise
+ first try important candidates not based on any memory object. Only if
this fails, try the specific ones. Rationale -- in loops with many
variables the best choice often is to use just one generic biv. If we
added here many ivs specific to the uses, the optimization algorithm later
@@ -5097,7 +5099,10 @@
{
cand = iv_cand (data, i);
- if (cand->iv->base_object != NULL_TREE)
+ if (originalp && cand->pos !=IP_ORIGINAL)
+ continue;
+
+ if (!originalp && cand->iv->base_object != NULL_TREE)
continue;
if (iv_ca_cand_used_p (ivs, cand))
@@ -5133,8 +5138,13 @@
continue;
/* Already tried this. */
- if (cand->important && cand->iv->base_object == NULL_TREE)
- continue;
+ if (cand->important)
+ {
+ if (originalp && cand->pos == IP_ORIGINAL)
+ continue;
+ if (!originalp && cand->iv->base_object == NULL_TREE)
+ continue;
+ }
if (iv_ca_cand_used_p (ivs, cand))
continue;
@@ -5168,13 +5178,13 @@
/* Finds an initial assignment of candidates to uses. */
static struct iv_ca *
-get_initial_solution (struct ivopts_data *data)
+get_initial_solution (struct ivopts_data *data, bool originalp)
{
struct iv_ca *ivs = iv_ca_new (data);
unsigned i;
for (i = 0; i < n_iv_uses (data); i++)
- if (!try_add_cand_for (data, ivs, iv_use (data, i)))
+ if (!try_add_cand_for (data, ivs, iv_use (data, i), originalp))
{
iv_ca_free (&ivs);
return NULL;
@@ -5246,14 +5256,12 @@
solution and remove the unused ivs while this improves the cost. */
static struct iv_ca *
-find_optimal_iv_set (struct ivopts_data *data)
+find_optimal_iv_set_1 (struct ivopts_data *data, bool originalp)
{
- unsigned i;
struct iv_ca *set;
- struct iv_use *use;
/* Get the initial solution. */
- set = get_initial_solution (data);
+ set = get_initial_solution (data, originalp);
if (!set)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -5276,11 +5284,46 @@
}
}
+ return set;
+}
+
+static struct iv_ca *
+find_optimal_iv_set (struct ivopts_data *data)
+{
+ unsigned i;
+ struct iv_ca *set, *origset;
+ struct iv_use *use;
+ comp_cost cost, origcost;
+
+ /* Determine the cost based on a strategy that starts with original IVs,
+ and try again using a strategy that prefers candidates not based
+ on any IVs. */
+ origset = find_optimal_iv_set_1 (data, true);
+ set = find_optimal_iv_set_1 (data, false);
+
+ if (!origset && !set)
+ return NULL;
+
+ origcost = origset ? iv_ca_cost (origset) : infinite_cost;
+ cost = set ? iv_ca_cost (set) : infinite_cost;
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
- comp_cost cost = iv_ca_cost (set);
- fprintf (dump_file, "Final cost %d (complexity %d)\n\n", cost.cost, cost.complexity);
- }
+ fprintf (dump_file, "Original cost %d (complexity %d)\n\n",
+ origcost.cost, origcost.complexity);
+ fprintf (dump_file, "Final cost %d (complexity %d)\n\n",
+ cost.cost, cost.complexity);
+ }
+
+ /* Choose the one with the best cost. */
+ if (compare_costs (origcost, cost) <= 0)
+ {
+ if (set)
+ iv_ca_free (&set);
+ set = origset;
+ }
+ else if (origset)
+ iv_ca_free (&origset);
for (i = 0; i < n_iv_uses (data); i++)
{
@@ -5768,6 +5811,25 @@
VEC_free (iv_cand_p, heap, data->iv_candidates);
}
+/* Returns true if the loop body BODY includes any function calls. */
+
+static bool
+loop_body_includes_call (basic_block *body, unsigned num_nodes)
+{
+ gimple_stmt_iterator gsi;
+ unsigned i;
+
+ for (i = 0; i < num_nodes; i++)
+ for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ if (is_gimple_call (stmt)
+ && !is_inexpensive_builtin (gimple_call_fndecl (stmt)))
+ return true;
+ }
+ return false;
+}
+
/* Optimizes the LOOP. Returns true if anything changed. */
static bool
@@ -5799,6 +5861,7 @@
}
body = get_loop_body (loop);
+ data->body_includes_call = loop_body_includes_call (body, loop->num_nodes);
renumber_gimple_stmt_uids_in_blocks (body, loop->num_nodes);
free (body);
=== modified file 'gcc/tree.h'
--- old/gcc/tree.h 2010-04-02 18:54:46 +0000
+++ new/gcc/tree.h 2010-08-02 13:51:23 +0000
@@ -4962,6 +4962,8 @@
extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int,
tree, tree);
extern void set_builtin_user_assembler_name (tree decl, const char *asmspec);
+extern bool is_simple_builtin (tree);
+extern bool is_inexpensive_builtin (tree);
/* In convert.c */
extern tree strip_float_extensions (tree);

View File

@@ -0,0 +1,37 @@
2010-07-15 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
2010-02-25 Maxim Kuvyrkov <maxim@codesourcery.com>
gcc/
* tree.c (initializer_zerop): Handle STRING_CST.
2010-07-15 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline:
=== modified file 'gcc/tree.c'
--- old/gcc/tree.c 2010-04-01 15:18:07 +0000
+++ new/gcc/tree.c 2010-08-02 16:32:37 +0000
@@ -9335,6 +9335,19 @@
return true;
}
+ case STRING_CST:
+ {
+ int i;
+
+ /* We need to loop through all elements to handle cases like
+ "\0" and "\0foobar". */
+ for (i = 0; i < TREE_STRING_LENGTH (init); ++i)
+ if (TREE_STRING_POINTER (init)[i] != '\0')
+ return false;
+
+ return true;
+ }
+
default:
return false;
}

View File

@@ -0,0 +1,433 @@
2010-07-16 Jie Zhang <jie@codesourcery.com>
Issue #7688
Backport from mainline:
gcc/
2010-07-12 Jie Zhang <jie@codesourcery.com>
* postreload.c (reg_symbol_ref[]): New.
(move2add_use_add2_insn): New.
(move2add_use_add3_insn): New.
(reload_cse_move2add): Handle SYMBOL + OFFSET case.
(move2add_note_store): Likewise.
2010-07-15 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
=== modified file 'gcc/postreload.c'
--- old/gcc/postreload.c 2010-03-16 10:50:42 +0000
+++ new/gcc/postreload.c 2010-08-02 16:55:34 +0000
@@ -1160,17 +1160,19 @@
information about register contents we have would be costly, so we
use move2add_last_label_luid to note where the label is and then
later disable any optimization that would cross it.
- reg_offset[n] / reg_base_reg[n] / reg_mode[n] are only valid if
- reg_set_luid[n] is greater than move2add_last_label_luid. */
+ reg_offset[n] / reg_base_reg[n] / reg_symbol_ref[n] / reg_mode[n]
+ are only valid if reg_set_luid[n] is greater than
+ move2add_last_label_luid. */
static int reg_set_luid[FIRST_PSEUDO_REGISTER];
/* If reg_base_reg[n] is negative, register n has been set to
- reg_offset[n] in mode reg_mode[n] .
+ reg_offset[n] or reg_symbol_ref[n] + reg_offset[n] in mode reg_mode[n].
If reg_base_reg[n] is non-negative, register n has been set to the
sum of reg_offset[n] and the value of register reg_base_reg[n]
before reg_set_luid[n], calculated in mode reg_mode[n] . */
static HOST_WIDE_INT reg_offset[FIRST_PSEUDO_REGISTER];
static int reg_base_reg[FIRST_PSEUDO_REGISTER];
+static rtx reg_symbol_ref[FIRST_PSEUDO_REGISTER];
static enum machine_mode reg_mode[FIRST_PSEUDO_REGISTER];
/* move2add_luid is linearly increased while scanning the instructions
@@ -1190,6 +1192,151 @@
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (OUTMODE), \
GET_MODE_BITSIZE (INMODE))))
+/* This function is called with INSN that sets REG to (SYM + OFF),
+ while REG is known to already have value (SYM + offset).
+ This function tries to change INSN into an add instruction
+ (set (REG) (plus (REG) (OFF - offset))) using the known value.
+ It also updates the information about REG's known value. */
+
+static void
+move2add_use_add2_insn (rtx reg, rtx sym, rtx off, rtx insn)
+{
+ rtx pat = PATTERN (insn);
+ rtx src = SET_SRC (pat);
+ int regno = REGNO (reg);
+ rtx new_src = gen_int_mode (INTVAL (off) - reg_offset[regno],
+ GET_MODE (reg));
+ bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
+
+ /* (set (reg) (plus (reg) (const_int 0))) is not canonical;
+ use (set (reg) (reg)) instead.
+ We don't delete this insn, nor do we convert it into a
+ note, to avoid losing register notes or the return
+ value flag. jump2 already knows how to get rid of
+ no-op moves. */
+ if (new_src == const0_rtx)
+ {
+ /* If the constants are different, this is a
+ truncation, that, if turned into (set (reg)
+ (reg)), would be discarded. Maybe we should
+ try a truncMN pattern? */
+ if (INTVAL (off) == reg_offset [regno])
+ validate_change (insn, &SET_SRC (pat), reg, 0);
+ }
+ else if (rtx_cost (new_src, PLUS, speed) < rtx_cost (src, SET, speed)
+ && have_add2_insn (reg, new_src))
+ {
+ rtx tem = gen_rtx_PLUS (GET_MODE (reg), reg, new_src);
+ validate_change (insn, &SET_SRC (pat), tem, 0);
+ }
+ else if (sym == NULL_RTX && GET_MODE (reg) != BImode)
+ {
+ enum machine_mode narrow_mode;
+ for (narrow_mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
+ narrow_mode != VOIDmode
+ && narrow_mode != GET_MODE (reg);
+ narrow_mode = GET_MODE_WIDER_MODE (narrow_mode))
+ {
+ if (have_insn_for (STRICT_LOW_PART, narrow_mode)
+ && ((reg_offset[regno]
+ & ~GET_MODE_MASK (narrow_mode))
+ == (INTVAL (off)
+ & ~GET_MODE_MASK (narrow_mode))))
+ {
+ rtx narrow_reg = gen_rtx_REG (narrow_mode,
+ REGNO (reg));
+ rtx narrow_src = gen_int_mode (INTVAL (off),
+ narrow_mode);
+ rtx new_set =
+ gen_rtx_SET (VOIDmode,
+ gen_rtx_STRICT_LOW_PART (VOIDmode,
+ narrow_reg),
+ narrow_src);
+ if (validate_change (insn, &PATTERN (insn),
+ new_set, 0))
+ break;
+ }
+ }
+ }
+ reg_set_luid[regno] = move2add_luid;
+ reg_base_reg[regno] = -1;
+ reg_mode[regno] = GET_MODE (reg);
+ reg_symbol_ref[regno] = sym;
+ reg_offset[regno] = INTVAL (off);
+}
+
+
+/* This function is called with INSN that sets REG to (SYM + OFF),
+ but REG doesn't have known value (SYM + offset). This function
+ tries to find another register which is known to already have
+ value (SYM + offset) and change INSN into an add instruction
+ (set (REG) (plus (the found register) (OFF - offset))) if such
+ a register is found. It also updates the information about
+ REG's known value. */
+
+static void
+move2add_use_add3_insn (rtx reg, rtx sym, rtx off, rtx insn)
+{
+ rtx pat = PATTERN (insn);
+ rtx src = SET_SRC (pat);
+ int regno = REGNO (reg);
+ int min_cost = INT_MAX;
+ int min_regno;
+ bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
+ int i;
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (reg_set_luid[i] > move2add_last_label_luid
+ && reg_mode[i] == GET_MODE (reg)
+ && reg_base_reg[i] < 0
+ && reg_symbol_ref[i] != NULL_RTX
+ && rtx_equal_p (sym, reg_symbol_ref[i]))
+ {
+ rtx new_src = gen_int_mode (INTVAL (off) - reg_offset[i],
+ GET_MODE (reg));
+ /* (set (reg) (plus (reg) (const_int 0))) is not canonical;
+ use (set (reg) (reg)) instead.
+ We don't delete this insn, nor do we convert it into a
+ note, to avoid losing register notes or the return
+ value flag. jump2 already knows how to get rid of
+ no-op moves. */
+ if (new_src == const0_rtx)
+ {
+ min_cost = 0;
+ min_regno = i;
+ break;
+ }
+ else
+ {
+ int cost = rtx_cost (new_src, PLUS, speed);
+ if (cost < min_cost)
+ {
+ min_cost = cost;
+ min_regno = i;
+ }
+ }
+ }
+
+ if (min_cost < rtx_cost (src, SET, speed))
+ {
+ rtx tem;
+
+ tem = gen_rtx_REG (GET_MODE (reg), min_regno);
+ if (i != min_regno)
+ {
+ rtx new_src = gen_int_mode (INTVAL (off) - reg_offset[min_regno],
+ GET_MODE (reg));
+ tem = gen_rtx_PLUS (GET_MODE (reg), tem, new_src);
+ }
+ validate_change (insn, &SET_SRC (pat), tem, 0);
+ }
+ reg_set_luid[regno] = move2add_luid;
+ reg_base_reg[regno] = -1;
+ reg_mode[regno] = GET_MODE (reg);
+ reg_symbol_ref[regno] = sym;
+ reg_offset[regno] = INTVAL (off);
+}
+
static void
reload_cse_move2add (rtx first)
{
@@ -1197,7 +1344,13 @@
rtx insn;
for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
- reg_set_luid[i] = 0;
+ {
+ reg_set_luid[i] = 0;
+ reg_offset[i] = 0;
+ reg_base_reg[i] = 0;
+ reg_symbol_ref[i] = NULL_RTX;
+ reg_mode[i] = VOIDmode;
+ }
move2add_last_label_luid = 0;
move2add_luid = 2;
@@ -1245,65 +1398,11 @@
(set (STRICT_LOW_PART (REGX)) (CONST_INT B))
*/
- if (CONST_INT_P (src) && reg_base_reg[regno] < 0)
+ if (CONST_INT_P (src)
+ && reg_base_reg[regno] < 0
+ && reg_symbol_ref[regno] == NULL_RTX)
{
- rtx new_src = gen_int_mode (INTVAL (src) - reg_offset[regno],
- GET_MODE (reg));
- bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
-
- /* (set (reg) (plus (reg) (const_int 0))) is not canonical;
- use (set (reg) (reg)) instead.
- We don't delete this insn, nor do we convert it into a
- note, to avoid losing register notes or the return
- value flag. jump2 already knows how to get rid of
- no-op moves. */
- if (new_src == const0_rtx)
- {
- /* If the constants are different, this is a
- truncation, that, if turned into (set (reg)
- (reg)), would be discarded. Maybe we should
- try a truncMN pattern? */
- if (INTVAL (src) == reg_offset [regno])
- validate_change (insn, &SET_SRC (pat), reg, 0);
- }
- else if (rtx_cost (new_src, PLUS, speed) < rtx_cost (src, SET, speed)
- && have_add2_insn (reg, new_src))
- {
- rtx tem = gen_rtx_PLUS (GET_MODE (reg), reg, new_src);
- validate_change (insn, &SET_SRC (pat), tem, 0);
- }
- else if (GET_MODE (reg) != BImode)
- {
- enum machine_mode narrow_mode;
- for (narrow_mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- narrow_mode != VOIDmode
- && narrow_mode != GET_MODE (reg);
- narrow_mode = GET_MODE_WIDER_MODE (narrow_mode))
- {
- if (have_insn_for (STRICT_LOW_PART, narrow_mode)
- && ((reg_offset[regno]
- & ~GET_MODE_MASK (narrow_mode))
- == (INTVAL (src)
- & ~GET_MODE_MASK (narrow_mode))))
- {
- rtx narrow_reg = gen_rtx_REG (narrow_mode,
- REGNO (reg));
- rtx narrow_src = gen_int_mode (INTVAL (src),
- narrow_mode);
- rtx new_set =
- gen_rtx_SET (VOIDmode,
- gen_rtx_STRICT_LOW_PART (VOIDmode,
- narrow_reg),
- narrow_src);
- if (validate_change (insn, &PATTERN (insn),
- new_set, 0))
- break;
- }
- }
- }
- reg_set_luid[regno] = move2add_luid;
- reg_mode[regno] = GET_MODE (reg);
- reg_offset[regno] = INTVAL (src);
+ move2add_use_add2_insn (reg, NULL_RTX, src, insn);
continue;
}
@@ -1373,6 +1472,51 @@
}
}
}
+
+ /* Try to transform
+ (set (REGX) (CONST (PLUS (SYMBOL_REF) (CONST_INT A))))
+ ...
+ (set (REGY) (CONST (PLUS (SYMBOL_REF) (CONST_INT B))))
+ to
+ (set (REGX) (CONST (PLUS (SYMBOL_REF) (CONST_INT A))))
+ ...
+ (set (REGY) (CONST (PLUS (REGX) (CONST_INT B-A)))) */
+ if ((GET_CODE (src) == SYMBOL_REF
+ || (GET_CODE (src) == CONST
+ && GET_CODE (XEXP (src, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (src, 0), 0)) == SYMBOL_REF
+ && CONST_INT_P (XEXP (XEXP (src, 0), 1))))
+ && dbg_cnt (cse2_move2add))
+ {
+ rtx sym, off;
+
+ if (GET_CODE (src) == SYMBOL_REF)
+ {
+ sym = src;
+ off = const0_rtx;
+ }
+ else
+ {
+ sym = XEXP (XEXP (src, 0), 0);
+ off = XEXP (XEXP (src, 0), 1);
+ }
+
+ /* If the reg already contains the value which is sum of
+ sym and some constant value, we can use an add2 insn. */
+ if (reg_set_luid[regno] > move2add_last_label_luid
+ && MODES_OK_FOR_MOVE2ADD (GET_MODE (reg), reg_mode[regno])
+ && reg_base_reg[regno] < 0
+ && reg_symbol_ref[regno] != NULL_RTX
+ && rtx_equal_p (sym, reg_symbol_ref[regno]))
+ move2add_use_add2_insn (reg, sym, off, insn);
+
+ /* Otherwise, we have to find a register whose value is sum
+ of sym and some constant value. */
+ else
+ move2add_use_add3_insn (reg, sym, off, insn);
+
+ continue;
+ }
}
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
@@ -1386,7 +1530,7 @@
reg_set_luid[regno] = 0;
}
}
- note_stores (PATTERN (insn), move2add_note_store, NULL);
+ note_stores (PATTERN (insn), move2add_note_store, insn);
/* If INSN is a conditional branch, we try to extract an
implicit set out of it. */
@@ -1408,7 +1552,7 @@
{
rtx implicit_set =
gen_rtx_SET (VOIDmode, XEXP (cnd, 0), XEXP (cnd, 1));
- move2add_note_store (SET_DEST (implicit_set), implicit_set, 0);
+ move2add_note_store (SET_DEST (implicit_set), implicit_set, insn);
}
}
@@ -1426,13 +1570,15 @@
}
}
-/* SET is a SET or CLOBBER that sets DST.
+/* SET is a SET or CLOBBER that sets DST. DATA is the insn which
+ contains SET.
Update reg_set_luid, reg_offset and reg_base_reg accordingly.
Called from reload_cse_move2add via note_stores. */
static void
-move2add_note_store (rtx dst, const_rtx set, void *data ATTRIBUTE_UNUSED)
+move2add_note_store (rtx dst, const_rtx set, void *data)
{
+ rtx insn = (rtx) data;
unsigned int regno = 0;
unsigned int nregs = 0;
unsigned int i;
@@ -1466,6 +1612,38 @@
nregs = hard_regno_nregs[regno][mode];
if (SCALAR_INT_MODE_P (GET_MODE (dst))
+ && nregs == 1 && GET_CODE (set) == SET)
+ {
+ rtx note, sym = NULL_RTX;
+ HOST_WIDE_INT off;
+
+ note = find_reg_equal_equiv_note (insn);
+ if (note && GET_CODE (XEXP (note, 0)) == SYMBOL_REF)
+ {
+ sym = XEXP (note, 0);
+ off = 0;
+ }
+ else if (note && GET_CODE (XEXP (note, 0)) == CONST
+ && GET_CODE (XEXP (XEXP (note, 0), 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (XEXP (note, 0), 0), 0)) == SYMBOL_REF
+ && CONST_INT_P (XEXP (XEXP (XEXP (note, 0), 0), 1)))
+ {
+ sym = XEXP (XEXP (XEXP (note, 0), 0), 0);
+ off = INTVAL (XEXP (XEXP (XEXP (note, 0), 0), 1));
+ }
+
+ if (sym != NULL_RTX)
+ {
+ reg_base_reg[regno] = -1;
+ reg_symbol_ref[regno] = sym;
+ reg_offset[regno] = off;
+ reg_mode[regno] = mode;
+ reg_set_luid[regno] = move2add_luid;
+ return;
+ }
+ }
+
+ if (SCALAR_INT_MODE_P (GET_MODE (dst))
&& nregs == 1 && GET_CODE (set) == SET
&& GET_CODE (SET_DEST (set)) != ZERO_EXTRACT
&& GET_CODE (SET_DEST (set)) != STRICT_LOW_PART)
@@ -1525,6 +1703,7 @@
case CONST_INT:
/* Start tracking the register as a constant. */
reg_base_reg[regno] = -1;
+ reg_symbol_ref[regno] = NULL_RTX;
reg_offset[regno] = INTVAL (SET_SRC (set));
/* We assign the same luid to all registers set to constants. */
reg_set_luid[regno] = move2add_last_label_luid + 1;
@@ -1545,6 +1724,7 @@
if (reg_set_luid[base_regno] <= move2add_last_label_luid)
{
reg_base_reg[base_regno] = base_regno;
+ reg_symbol_ref[base_regno] = NULL_RTX;
reg_offset[base_regno] = 0;
reg_set_luid[base_regno] = move2add_luid;
reg_mode[base_regno] = mode;
@@ -1558,6 +1738,7 @@
/* Copy base information from our base register. */
reg_set_luid[regno] = reg_set_luid[base_regno];
reg_base_reg[regno] = reg_base_reg[base_regno];
+ reg_symbol_ref[regno] = reg_symbol_ref[base_regno];
/* Compute the sum of the offsets or constants. */
reg_offset[regno] = trunc_int_for_mode (offset

View File

@@ -0,0 +1,57 @@
2010-08-03 Chung-Lin Tang <cltang@codesourcery.com>
Backport from mainline:
gcc/
2010-07-28 Chung-Lin Tang <cltang@codesourcery.com>
* config/arm/arm.c (arm_pcs_default): Remove static.
* config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Define __ARM_PCS or
__ARM_PCS_VFP to indicate soft/hard-float calling convention.
(arm_pcs_default): Declare.
2010-07-16 Jie Zhang <jie@codesourcery.com>
Issue #7688
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-08-02 13:42:24 +0000
+++ new/gcc/config/arm/arm.c 2010-08-03 13:55:46 +0000
@@ -704,7 +704,7 @@
/* The maximum number of insns to be used when loading a constant. */
static int arm_constant_limit = 3;
-static enum arm_pcs arm_pcs_default;
+enum arm_pcs arm_pcs_default;
/* For an explanation of these variables, see final_prescan_insn below. */
int arm_ccfsm_state;
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2010-07-29 16:58:56 +0000
+++ new/gcc/config/arm/arm.h 2010-08-03 10:40:56 +0000
@@ -94,7 +94,13 @@
if (arm_arch_iwmmxt) \
builtin_define ("__IWMMXT__"); \
if (TARGET_AAPCS_BASED) \
- builtin_define ("__ARM_EABI__"); \
+ { \
+ if (arm_pcs_default == ARM_PCS_AAPCS_VFP) \
+ builtin_define ("__ARM_PCS_VFP"); \
+ else if (arm_pcs_default == ARM_PCS_AAPCS) \
+ builtin_define ("__ARM_PCS"); \
+ builtin_define ("__ARM_EABI__"); \
+ } \
} while (0)
/* The various ARM cores. */
@@ -1648,6 +1654,9 @@
ARM_PCS_UNKNOWN
};
+/* Default procedure calling standard of current compilation unit. */
+extern enum arm_pcs arm_pcs_default;
+
/* A C type for declaring a variable that is used as the first argument of
`FUNCTION_ARG' and other related values. */
typedef struct

View File

@@ -0,0 +1,76 @@
2010-07-20 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
2010-06-07 Kazu Hirata <kazu@codesourcery.com>
Issue #8535
Backport from mainline:
gcc/
2010-06-07 Kazu Hirata <kazu@codesourcery.com>
PR rtl-optimization/44404
* auto-inc-dec.c (find_inc): Use reg_overlap_mentioned_p instead
of count_occurrences to see if it's safe to modify mem_insn.insn.
gcc/testsuite/
2010-06-07 Kazu Hirata <kazu@codesourcery.com>
PR rtl-optimization/44404
* gcc.dg/pr44404.c: New.
2010-08-03 Chung-Lin Tang <cltang@codesourcery.com>
Backport from mainline:
=== modified file 'gcc/auto-inc-dec.c'
--- old/gcc/auto-inc-dec.c 2010-04-02 18:54:46 +0000
+++ new/gcc/auto-inc-dec.c 2010-08-05 11:30:21 +0000
@@ -1068,7 +1068,7 @@
/* For the post_add to work, the result_reg of the inc must not be
used in the mem insn since this will become the new index
register. */
- if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0)
+ if (reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn)))
{
if (dump_file)
fprintf (dump_file, "base reg replacement failure.\n");
=== added file 'gcc/testsuite/gcc.dg/pr44404.c'
--- old/gcc/testsuite/gcc.dg/pr44404.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/pr44404.c 2010-08-05 11:30:21 +0000
@@ -0,0 +1,35 @@
+/* PR rtl-optimization/44404
+ foo() used to be miscompiled on ARM due to a bug in auto-inc-dec.c,
+ which resulted in "strb r1, [r1], #-36". */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-unroll-loops" } */
+
+extern char *strcpy (char *, const char *);
+extern int strcmp (const char*, const char*);
+extern void abort (void);
+
+char buf[128];
+
+void __attribute__((noinline))
+bar (int a, const char *p)
+{
+ if (strcmp (p, "0123456789abcdefghijklmnopqrstuvwxyz") != 0)
+ abort ();
+}
+
+void __attribute__((noinline))
+foo (int a)
+{
+ if (a)
+ bar (0, buf);
+ strcpy (buf, "0123456789abcdefghijklmnopqrstuvwxyz");
+ bar (0, buf);
+}
+
+int
+main (void)
+{
+ foo (0);
+ return 0;
+}

View File

@@ -0,0 +1,118 @@
2010-07-24 Jie Zhang <jie@codesourcery.com>
Issue #9079
Backport from mainline:
gcc/
2010-07-23 Jie Zhang <jie@codesourcery.com>
PR target/44290
* attribs.c (decl_attributes): Insert "noinline" and "noclone"
if "naked".
* tree-sra.c (ipa_sra_preliminary_function_checks): Return
false if ! tree_versionable_function_p.
gcc/testsuite/
2010-07-23 Jie Zhang <jie@codesourcery.com>
PR target/44290
* gcc.dg/pr44290-1.c: New test.
* gcc.dg/pr44290-2.c: New test.
2010-07-22 Maxim Kuvyrkov <maxim@codesourcery.com>
Backport from FSF GCC 4.5 branch to fix PR45015:
=== modified file 'gcc/attribs.c'
--- old/gcc/attribs.c 2010-04-02 18:54:46 +0000
+++ new/gcc/attribs.c 2010-08-05 11:39:36 +0000
@@ -278,6 +278,19 @@
TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
}
+ /* A "naked" function attribute implies "noinline" and "noclone" for
+ those targets that support it. */
+ if (TREE_CODE (*node) == FUNCTION_DECL
+ && lookup_attribute_spec (get_identifier ("naked"))
+ && lookup_attribute ("naked", attributes) != NULL)
+ {
+ if (lookup_attribute ("noinline", attributes) == NULL)
+ attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
+
+ if (lookup_attribute ("noclone", attributes) == NULL)
+ attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
+ }
+
targetm.insert_attributes (*node, &attributes);
for (a = attributes; a; a = TREE_CHAIN (a))
=== added file 'gcc/testsuite/gcc.dg/pr44290-1.c'
--- old/gcc/testsuite/gcc.dg/pr44290-1.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/pr44290-1.c 2010-08-05 11:39:36 +0000
@@ -0,0 +1,18 @@
+/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+static void __attribute__((naked))
+foo(void *from, void *to)
+{
+ asm volatile("dummy"::"r"(from), "r"(to));
+}
+
+unsigned int fie[2];
+
+void fum(void *to)
+{
+ foo(fie, to);
+}
+
+/* { dg-final { scan-tree-dump "foo \\\(void \\\* from, void \\\* to\\\)" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
=== added file 'gcc/testsuite/gcc.dg/pr44290-2.c'
--- old/gcc/testsuite/gcc.dg/pr44290-2.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/pr44290-2.c 2010-08-05 11:39:36 +0000
@@ -0,0 +1,24 @@
+/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+static unsigned long __attribute__((naked))
+foo (unsigned long base)
+{
+ asm volatile ("dummy");
+}
+unsigned long
+bar (void)
+{
+ static int start, set;
+
+ if (!set)
+ {
+ set = 1;
+ start = foo (0);
+ }
+
+ return foo (start);
+}
+
+/* { dg-final { scan-tree-dump "foo \\\(long unsigned int base\\\)" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
=== modified file 'gcc/tree-sra.c'
--- old/gcc/tree-sra.c 2010-03-17 12:02:35 +0000
+++ new/gcc/tree-sra.c 2010-08-05 11:39:36 +0000
@@ -4096,6 +4096,13 @@
static bool
ipa_sra_preliminary_function_checks (struct cgraph_node *node)
{
+ if (!tree_versionable_function_p (current_function_decl))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Function isn't allowed to be versioned.\n");
+ return false;
+ }
+
if (!cgraph_node_can_be_local_p (node))
{
if (dump_file)

View File

@@ -0,0 +1,197 @@
2010-07-24 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline:
2010-04-10 Wei Guozhi <carrot@google.com>
PR target/42601
gcc/
* config/arm/arm.c (arm_pic_static_addr): New function.
(legitimize_pic_address): Call arm_pic_static_addr when it detects
a static symbol.
(arm_output_addr_const_extra): Output expression for new pattern.
* config/arm/arm.md (UNSPEC_SYMBOL_OFFSET): New unspec symbol.
2010-07-22 Sandra Loosemore <sandra@codesourcery.com>
PR tree-optimization/39839
gcc/testsuite/
* gcc.target/arm/pr39839.c: New test case.
2010-07-24 Jie Zhang <jie@codesourcery.com>
Issue #9079
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-08-03 13:55:46 +0000
+++ new/gcc/config/arm/arm.c 2010-08-05 12:06:40 +0000
@@ -225,6 +225,7 @@
static void arm_asm_trampoline_template (FILE *);
static void arm_trampoline_init (rtx, tree, rtx);
static rtx arm_trampoline_adjust_address (rtx);
+static rtx arm_pic_static_addr (rtx orig, rtx reg);
/* Table of machine attributes. */
@@ -4986,29 +4987,16 @@
{
rtx pic_ref, address;
rtx insn;
- int subregs = 0;
-
- /* If this function doesn't have a pic register, create one now. */
- require_pic_register ();
if (reg == 0)
{
gcc_assert (can_create_pseudo_p ());
reg = gen_reg_rtx (Pmode);
-
- subregs = 1;
+ address = gen_reg_rtx (Pmode);
}
-
- if (subregs)
- address = gen_reg_rtx (Pmode);
else
address = reg;
- if (TARGET_32BIT)
- emit_insn (gen_pic_load_addr_32bit (address, orig));
- else /* TARGET_THUMB1 */
- emit_insn (gen_pic_load_addr_thumb1 (address, orig));
-
/* VxWorks does not impose a fixed gap between segments; the run-time
gap can be different from the object-file gap. We therefore can't
use GOTOFF unless we are absolutely sure that the symbol is in the
@@ -5020,16 +5008,23 @@
SYMBOL_REF_LOCAL_P (orig)))
&& NEED_GOT_RELOC
&& !TARGET_VXWORKS_RTP)
- pic_ref = gen_rtx_PLUS (Pmode, cfun->machine->pic_reg, address);
+ insn = arm_pic_static_addr (orig, reg);
else
{
+ /* If this function doesn't have a pic register, create one now. */
+ require_pic_register ();
+
+ if (TARGET_32BIT)
+ emit_insn (gen_pic_load_addr_32bit (address, orig));
+ else /* TARGET_THUMB1 */
+ emit_insn (gen_pic_load_addr_thumb1 (address, orig));
+
pic_ref = gen_const_mem (Pmode,
gen_rtx_PLUS (Pmode, cfun->machine->pic_reg,
address));
+ insn = emit_move_insn (reg, pic_ref);
}
- insn = emit_move_insn (reg, pic_ref);
-
/* Put a REG_EQUAL note on this insn, so that it can be optimized
by loop. */
set_unique_reg_note (insn, REG_EQUAL, orig);
@@ -5236,6 +5231,43 @@
emit_use (pic_reg);
}
+/* Generate code to load the address of a static var when flag_pic is set. */
+static rtx
+arm_pic_static_addr (rtx orig, rtx reg)
+{
+ rtx l1, labelno, offset_rtx, insn;
+
+ gcc_assert (flag_pic);
+
+ /* We use an UNSPEC rather than a LABEL_REF because this label
+ never appears in the code stream. */
+ labelno = GEN_INT (pic_labelno++);
+ l1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, labelno), UNSPEC_PIC_LABEL);
+ l1 = gen_rtx_CONST (VOIDmode, l1);
+
+ /* On the ARM the PC register contains 'dot + 8' at the time of the
+ addition, on the Thumb it is 'dot + 4'. */
+ offset_rtx = plus_constant (l1, TARGET_ARM ? 8 : 4);
+ offset_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, orig, offset_rtx),
+ UNSPEC_SYMBOL_OFFSET);
+ offset_rtx = gen_rtx_CONST (Pmode, offset_rtx);
+
+ if (TARGET_32BIT)
+ {
+ emit_insn (gen_pic_load_addr_32bit (reg, offset_rtx));
+ if (TARGET_ARM)
+ insn = emit_insn (gen_pic_add_dot_plus_eight (reg, reg, labelno));
+ else
+ insn = emit_insn (gen_pic_add_dot_plus_four (reg, reg, labelno));
+ }
+ else /* TARGET_THUMB1 */
+ {
+ emit_insn (gen_pic_load_addr_thumb1 (reg, offset_rtx));
+ insn = emit_insn (gen_pic_add_dot_plus_four (reg, reg, labelno));
+ }
+
+ return insn;
+}
/* Return nonzero if X is valid as an ARM state addressing register. */
static int
@@ -21461,6 +21493,16 @@
fputc (')', fp);
return TRUE;
}
+ else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_SYMBOL_OFFSET)
+ {
+ output_addr_const (fp, XVECEXP (x, 0, 0));
+ if (GOT_PCREL)
+ fputs ("+.", fp);
+ fputs ("-(", fp);
+ output_addr_const (fp, XVECEXP (x, 0, 1));
+ fputc (')', fp);
+ return TRUE;
+ }
else if (GET_CODE (x) == CONST_VECTOR)
return arm_emit_vector_const (fp, x);
=== modified file 'gcc/config/arm/arm.md'
--- old/gcc/config/arm/arm.md 2010-07-30 14:17:05 +0000
+++ new/gcc/config/arm/arm.md 2010-08-05 12:06:40 +0000
@@ -101,6 +101,8 @@
; a given symbolic address.
(UNSPEC_THUMB1_CASESI 25) ; A Thumb1 compressed dispatch-table call.
(UNSPEC_RBIT 26) ; rbit operation.
+ (UNSPEC_SYMBOL_OFFSET 27) ; The offset of the start of the symbol from
+ ; another symbolic address.
]
)
=== added file 'gcc/testsuite/gcc.target/arm/pr39839.c'
--- old/gcc/testsuite/gcc.target/arm/pr39839.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/pr39839.c 2010-08-05 12:06:40 +0000
@@ -0,0 +1,24 @@
+/* { dg-options "-mthumb -Os -march=armv5te -mthumb-interwork -fpic" } */
+/* { dg-require-effective-target arm_thumb1_ok } */
+/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */
+
+struct S
+{
+ int count;
+ char *addr;
+};
+
+void func(const char*, const char*, int, const char*);
+
+/* This function should not need to spill to the stack. */
+void test(struct S *p)
+{
+ int off = p->count;
+ while (p->count >= 0)
+ {
+ const char *s = "xyz";
+ if (*p->addr) s = "pqr";
+ func("abcde", p->addr + off, off, s);
+ p->count--;
+ }
+}

View File

@@ -0,0 +1,138 @@
2010-08-05 Andrew Stubbs <ams@codesourcery.com>
gcc/testsuite/
* gcc.dg/vect/vect-shift-2.c: Revert all previous changes.
* gcc.dg/vect/vect-shift-4.c: New file.
2010-07-20 Yao Qi <yao@codesourcery.com>
Merge from Sourcery G++ 4.4:
2009-06-16 Daniel Jacobowitz <dan@codesourcery.com>
Merge from Sourcery G++ 4.3:
2008-12-03 Daniel Jacobowitz <dan@codesourcery.com>
gcc/testsuite/
* gcc.dg/vect/vect-shift-2.c, gcc.dg/vect/vect-shift-3.c: New.
* lib/target-supports.exp (check_effective_target_vect_shift_char): New
function.
2010-07-24 Sandra Loosemore <sandra@codesourcery.com>
Backport from mainline:
=== added file 'gcc/testsuite/gcc.dg/vect/vect-shift-3.c'
--- old/gcc/testsuite/gcc.dg/vect/vect-shift-3.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/vect/vect-shift-3.c 2010-08-05 14:13:43 +0000
@@ -0,0 +1,37 @@
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned short dst[N] __attribute__((aligned(N)));
+unsigned short src[N] __attribute__((aligned(N)));
+
+__attribute__ ((noinline))
+void array_shift(void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ dst[i] = src[i] >> 3;
+}
+
+int main()
+{
+ volatile int i;
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ src[i] = i << 3;
+
+ array_shift ();
+
+ for (i = 0; i < N; i++)
+ if (dst[i] != i)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
=== added file 'gcc/testsuite/gcc.dg/vect/vect-shift-4.c'
--- old/gcc/testsuite/gcc.dg/vect/vect-shift-4.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/vect/vect-shift-4.c 2010-08-05 14:13:43 +0000
@@ -0,0 +1,37 @@
+/* { dg-require-effective-target vect_shift_char } */
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned char dst[N] __attribute__((aligned(N)));
+unsigned char src[N] __attribute__((aligned(N)));
+
+__attribute__ ((noinline))
+void array_shift(void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ dst[i] = src[i] >> 3;
+}
+
+int main()
+{
+ volatile int i;
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ src[i] = i << 3;
+
+ array_shift ();
+
+ for (i = 0; i < N; i++)
+ if (dst[i] != i)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
=== modified file 'gcc/testsuite/lib/target-supports.exp'
--- old/gcc/testsuite/lib/target-supports.exp 2010-07-29 15:38:15 +0000
+++ new/gcc/testsuite/lib/target-supports.exp 2010-08-05 14:13:43 +0000
@@ -2001,6 +2001,26 @@
return $et_vect_shift_saved
}
+# Return 1 if the target supports hardware vector shift operation for char.
+
+proc check_effective_target_vect_shift_char { } {
+ global et_vect_shift_char_saved
+
+ if [info exists et_vect_shift_char_saved] {
+ verbose "check_effective_target_vect_shift_char: using cached result" 2
+ } else {
+ set et_vect_shift_char_saved 0
+ if { ([istarget powerpc*-*-*]
+ && ![istarget powerpc-*-linux*paired*])
+ || [check_effective_target_arm32] } {
+ set et_vect_shift_char_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
+ return $et_vect_shift_char_saved
+}
+
# Return 1 if the target supports hardware vectors of long, 0 otherwise.
#
# This can change for different subtargets so do not cache the result.

View File

@@ -0,0 +1,28 @@
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
2007-07-05 Mark Shinwell <shinwell@codesourcery.com>
gcc/
* config/arm/arm.h (BRANCH_COST): Set to 1 when optimizing for size
on Thumb-2.
2010-08-05 Andrew Stubbs <ams@codesourcery.com>
gcc/testsuite/
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2010-08-03 10:40:56 +0000
+++ new/gcc/config/arm/arm.h 2010-08-05 14:29:52 +0000
@@ -2210,7 +2210,8 @@
/* Try to generate sequences that don't involve branches, we can then use
conditional instructions */
#define BRANCH_COST(speed_p, predictable_p) \
- (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
+ (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \
+ : (optimize > 0 ? 2 : 0))
/* Position Independent Code. */
/* We decide which register to use based on the compilation options and

View File

@@ -0,0 +1,53 @@
2007-06-06 Joseph Myers <joseph@codesourcery.com>
gcc/
* config/arm/arm.h (VALID_IWMMXT_REG_MODE): Allow SImode.
(ARM_LEGITIMIZE_RELOAD_ADDRESS): Reduce range allowed for SImode
offsets with iWMMXt.
* config/arm/arm.c (arm_hard_regno_mode_ok): Update for change to
VALID_IWMMXT_REG_MODE.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
2007-07-05 Mark Shinwell <shinwell@codesourcery.com>
gcc/
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-08-05 12:06:40 +0000
+++ new/gcc/config/arm/arm.c 2010-08-05 14:33:31 +0000
@@ -16538,7 +16538,7 @@
return mode == SImode;
if (IS_IWMMXT_REGNUM (regno))
- return VALID_IWMMXT_REG_MODE (mode);
+ return VALID_IWMMXT_REG_MODE (mode) && mode != SImode;
}
/* We allow almost any value to be stored in the general registers.
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2010-08-05 14:29:52 +0000
+++ new/gcc/config/arm/arm.h 2010-08-05 14:33:31 +0000
@@ -1077,7 +1077,7 @@
(GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
#define VALID_IWMMXT_REG_MODE(MODE) \
- (arm_vector_mode_supported_p (MODE) || (MODE) == DImode)
+ (arm_vector_mode_supported_p (MODE) || (MODE) == DImode || (MODE) == SImode)
/* Modes valid for Neon D registers. */
#define VALID_NEON_DREG_MODE(MODE) \
@@ -1364,6 +1364,9 @@
else if (TARGET_MAVERICK && TARGET_HARD_FLOAT) \
/* Need to be careful, -256 is not a valid offset. */ \
low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
+ else if (TARGET_REALLY_IWMMXT && MODE == SImode) \
+ /* Need to be careful, -1024 is not a valid offset. */ \
+ low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff); \
else if (MODE == SImode \
|| (MODE == SFmode && TARGET_SOFT_FLOAT) \
|| ((MODE == HImode || MODE == QImode) && ! arm_arch4)) \

View File

@@ -0,0 +1,688 @@
Vladimir Prus <vladimir@codesourcery.com>
Julian Brown <julian@codesourcery.com>
gcc/
* config/arm/arm.c (arm_override_options): Warn if mlow-irq-latency is
specified in Thumb mode.
(load_multiple_sequence): Return 0 if low irq latency is requested.
(store_multiple_sequence): Likewise.
(arm_gen_load_multiple): Load registers one-by-one if low irq latency
is requested.
(arm_gen_store_multiple): Likewise.
(vfp_output_fldmd): When low_irq_latency is non zero, pop each
register separately.
(vfp_emit_fstmd): When low_irq_latency is non zero, save each register
separately.
(arm_get_vfp_saved_size): Adjust saved register size calculation for
the above changes.
(print_pop_reg_by_ldr): New.
(arm_output_epilogue): Use print_pop_reg_by_ldr when low irq latency
is requested.
(emit_multi_reg_push): Push registers separately if low irq latency
is requested.
* config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Set __low_irq_latency__.
(low_irq_latency): Define.
(USE_RETURN_INSN): Don't use return insn when low irq latency is
requested.
* config/arm/lib1funcs.asm (do_pop, do_push): Define as variadic
macros. When __low_irq_latency__ is defined, push and pop registers
individually.
(div0): Use correct punctuation.
* config/arm/ieee754-df.S: Adjust syntax of using do_push.
* config/arm/ieee754-sf.S: Likewise.
* config/arm/bpabi.S: Likewise.
* config/arm/arm.opt (mlow-irq-latency): New option.
* config/arm/predicates.md (load_multiple_operation): Return false is
low irq latency is requested.
(store_multiple_operation): Likewise.
* config/arm/arm.md (movmemqi): Don't use it if low irq latency is
requested.
* doc/invoke.texi (-mlow-irq-latency): Add documentation.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
2007-06-06 Joseph Myers <joseph@codesourcery.com>
gcc/
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-08-05 14:33:31 +0000
+++ new/gcc/config/arm/arm.c 2010-08-05 15:20:54 +0000
@@ -1884,6 +1884,13 @@
/* Register global variables with the garbage collector. */
arm_add_gc_roots ();
+
+ if (low_irq_latency && TARGET_THUMB)
+ {
+ warning (0,
+ "-mlow-irq-latency has no effect when compiling for Thumb");
+ low_irq_latency = 0;
+ }
}
static void
@@ -9053,6 +9060,9 @@
int base_reg = -1;
int i;
+ if (low_irq_latency)
+ return 0;
+
/* Can only handle 2, 3, or 4 insns at present,
though could be easily extended if required. */
gcc_assert (nops >= 2 && nops <= 4);
@@ -9282,6 +9292,9 @@
int base_reg = -1;
int i;
+ if (low_irq_latency)
+ return 0;
+
/* Can only handle 2, 3, or 4 insns at present, though could be easily
extended if required. */
gcc_assert (nops >= 2 && nops <= 4);
@@ -9489,7 +9502,7 @@
As a compromise, we use ldr for counts of 1 or 2 regs, and ldm
for counts of 3 or 4 regs. */
- if (arm_tune_xscale && count <= 2 && ! optimize_size)
+ if (low_irq_latency || (arm_tune_xscale && count <= 2 && ! optimize_size))
{
rtx seq;
@@ -9552,7 +9565,7 @@
/* See arm_gen_load_multiple for discussion of
the pros/cons of ldm/stm usage for XScale. */
- if (arm_tune_xscale && count <= 2 && ! optimize_size)
+ if (low_irq_latency || (arm_tune_xscale && count <= 2 && ! optimize_size))
{
rtx seq;
@@ -11795,6 +11808,21 @@
vfp_output_fldmd (FILE * stream, unsigned int base, int reg, int count)
{
int i;
+ int offset;
+
+ if (low_irq_latency)
+ {
+ /* Output a sequence of FLDD instructions. */
+ offset = 0;
+ for (i = reg; i < reg + count; ++i, offset += 8)
+ {
+ fputc ('\t', stream);
+ asm_fprintf (stream, "fldd\td%d, [%r,#%d]\n", i, base, offset);
+ }
+ asm_fprintf (stream, "\tadd\tsp, sp, #%d\n", count * 8);
+ return;
+ }
+
/* Workaround ARM10 VFPr1 bug. */
if (count == 2 && !arm_arch6)
@@ -11865,6 +11893,56 @@
rtx tmp, reg;
int i;
+ if (low_irq_latency)
+ {
+ int saved_size;
+ rtx sp_insn;
+
+ if (!count)
+ return 0;
+
+ saved_size = count * GET_MODE_SIZE (DFmode);
+
+ /* Since fstd does not have postdecrement addressing mode,
+ we first decrement stack pointer and then use base+offset
+ stores for VFP registers. The ARM EABI unwind information
+ can't easily describe base+offset loads, so we attach
+ a note for the effects of the whole block in the first insn,
+ and avoid marking the subsequent instructions
+ with RTX_FRAME_RELATED_P. */
+ sp_insn = gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (-saved_size));
+ sp_insn = emit_insn (sp_insn);
+ RTX_FRAME_RELATED_P (sp_insn) = 1;
+
+ dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (count + 1));
+ XVECEXP (dwarf, 0, 0) =
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (stack_pointer_rtx, -saved_size));
+
+ /* push double VFP registers to stack */
+ for (i = 0; i < count; ++i )
+ {
+ rtx reg;
+ rtx mem;
+ rtx addr;
+ rtx insn;
+ reg = gen_rtx_REG (DFmode, base_reg + 2*i);
+ addr = (i == 0) ? stack_pointer_rtx
+ : gen_rtx_PLUS (SImode, stack_pointer_rtx,
+ GEN_INT (i * GET_MODE_SIZE (DFmode)));
+ mem = gen_frame_mem (DFmode, addr);
+ insn = emit_move_insn (mem, reg);
+ XVECEXP (dwarf, 0, i+1) =
+ gen_rtx_SET (VOIDmode, mem, reg);
+ }
+
+ REG_NOTES (sp_insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
+ REG_NOTES (sp_insn));
+
+ return saved_size;
+ }
+
/* Workaround ARM10 VFPr1 bug. Data corruption can occur when exactly two
register pairs are stored by a store multiple insn. We avoid this
by pushing an extra pair. */
@@ -13307,7 +13385,7 @@
if (count > 0)
{
/* Workaround ARM10 VFPr1 bug. */
- if (count == 2 && !arm_arch6)
+ if (count == 2 && !arm_arch6 && !low_irq_latency)
count++;
saved += count * 8;
}
@@ -13645,6 +13723,41 @@
}
+/* Generate to STREAM a code sequence that pops registers identified
+ in REGS_MASK from SP. SP is incremented as the result.
+*/
+static void
+print_pop_reg_by_ldr (FILE *stream, int regs_mask, int rfe)
+{
+ int reg;
+
+ gcc_assert (! (regs_mask & (1 << SP_REGNUM)));
+
+ for (reg = 0; reg < PC_REGNUM; ++reg)
+ if (regs_mask & (1 << reg))
+ asm_fprintf (stream, "\tldr\t%r, [%r], #4\n",
+ reg, SP_REGNUM);
+
+ if (regs_mask & (1 << PC_REGNUM))
+ {
+ if (rfe)
+ /* When returning from exception, we need to
+ copy SPSR to CPSR. There are two ways to do
+ that: the ldm instruction with "^" suffix,
+ and movs instruction. The latter would
+ require that we load from stack to some
+ scratch register, and then move to PC.
+ Therefore, we'd need extra instruction and
+ have to make sure we actually have a spare
+ register. Using ldm with a single register
+ is simler. */
+ asm_fprintf (stream, "\tldm\tsp!, {pc}^\n");
+ else
+ asm_fprintf (stream, "\tldr\t%r, [%r], #4\n",
+ PC_REGNUM, SP_REGNUM);
+ }
+}
+
const char *
arm_output_epilogue (rtx sibling)
{
@@ -14018,22 +14131,19 @@
to load use the LDR instruction - it is faster. For Thumb-2
always use pop and the assembler will pick the best instruction.*/
if (TARGET_ARM && saved_regs_mask == (1 << LR_REGNUM)
- && !IS_INTERRUPT(func_type))
+ && !IS_INTERRUPT (func_type))
{
asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
}
else if (saved_regs_mask)
{
- if (saved_regs_mask & (1 << SP_REGNUM))
- /* Note - write back to the stack register is not enabled
- (i.e. "ldmfd sp!..."). We know that the stack pointer is
- in the list of registers and if we add writeback the
- instruction becomes UNPREDICTABLE. */
- print_multi_reg (f, "ldmfd\t%r, ", SP_REGNUM, saved_regs_mask,
- rfe);
- else if (TARGET_ARM)
- print_multi_reg (f, "ldmfd\t%r!, ", SP_REGNUM, saved_regs_mask,
- rfe);
+ gcc_assert ( ! (saved_regs_mask & (1 << SP_REGNUM)));
+ if (TARGET_ARM)
+ if (low_irq_latency)
+ print_pop_reg_by_ldr (f, saved_regs_mask, rfe);
+ else
+ print_multi_reg (f, "ldmfd\t%r!, ", SP_REGNUM, saved_regs_mask,
+ rfe);
else
print_multi_reg (f, "pop\t", SP_REGNUM, saved_regs_mask, 0);
}
@@ -14154,6 +14264,32 @@
gcc_assert (num_regs && num_regs <= 16);
+ if (low_irq_latency)
+ {
+ rtx insn = 0;
+
+ /* Emit a series of ldr instructions rather rather than a single ldm. */
+ /* TODO: Use ldrd where possible. */
+ gcc_assert (! (mask & (1 << SP_REGNUM)));
+
+ for (i = LAST_ARM_REGNUM; i >= 0; --i)
+ {
+ if (mask & (1 << i))
+
+ {
+ rtx reg, where, mem;
+
+ reg = gen_rtx_REG (SImode, i);
+ where = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx);
+ mem = gen_rtx_MEM (SImode, where);
+ insn = emit_move_insn (mem, reg);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+ }
+
+ return insn;
+ }
+
/* We don't record the PC in the dwarf frame information. */
num_dwarf_regs = num_regs;
if (mask & (1 << PC_REGNUM))
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2010-08-05 14:33:31 +0000
+++ new/gcc/config/arm/arm.h 2010-08-05 15:20:54 +0000
@@ -101,6 +101,8 @@
builtin_define ("__ARM_PCS"); \
builtin_define ("__ARM_EABI__"); \
} \
+ if (low_irq_latency) \
+ builtin_define ("__low_irq_latency__"); \
} while (0)
/* The various ARM cores. */
@@ -449,6 +451,10 @@
/* Nonzero if chip supports integer division instruction. */
extern int arm_arch_hwdiv;
+/* Nonzero if we should minimize interrupt latency of the
+ generated code. */
+extern int low_irq_latency;
+
#ifndef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_APCS_FRAME)
#endif
@@ -1823,9 +1829,10 @@
/* Determine if the epilogue should be output as RTL.
You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
/* This is disabled for Thumb-2 because it will confuse the
- conditional insn counter. */
+ conditional insn counter.
+ Do not use a return insn if we're avoiding ldm/stm instructions. */
#define USE_RETURN_INSN(ISCOND) \
- (TARGET_ARM ? use_return_insn (ISCOND, NULL) : 0)
+ ((TARGET_ARM && !low_irq_latency) ? use_return_insn (ISCOND, NULL) : 0)
/* Definitions for register eliminations.
=== modified file 'gcc/config/arm/arm.md'
--- old/gcc/config/arm/arm.md 2010-08-05 12:06:40 +0000
+++ new/gcc/config/arm/arm.md 2010-08-05 15:20:54 +0000
@@ -6587,7 +6587,7 @@
(match_operand:BLK 1 "general_operand" "")
(match_operand:SI 2 "const_int_operand" "")
(match_operand:SI 3 "const_int_operand" "")]
- "TARGET_EITHER"
+ "TARGET_EITHER && !low_irq_latency"
"
if (TARGET_32BIT)
{
=== modified file 'gcc/config/arm/arm.opt'
--- old/gcc/config/arm/arm.opt 2009-06-18 11:24:10 +0000
+++ new/gcc/config/arm/arm.opt 2010-08-05 15:20:54 +0000
@@ -161,6 +161,10 @@
Target Report Mask(NEON_VECTORIZE_QUAD)
Use Neon quad-word (rather than double-word) registers for vectorization
+mlow-irq-latency
+Target Report Var(low_irq_latency)
+Try to reduce interrupt latency of the generated code
+
mword-relocations
Target Report Var(target_word_relocations) Init(TARGET_DEFAULT_WORD_RELOCATIONS)
Only generate absolute relocations on word sized values.
=== modified file 'gcc/config/arm/bpabi.S'
--- old/gcc/config/arm/bpabi.S 2009-12-17 15:37:23 +0000
+++ new/gcc/config/arm/bpabi.S 2010-08-05 15:20:54 +0000
@@ -116,16 +116,17 @@
test_div_by_zero signed
sub sp, sp, #8
-#if defined(__thumb2__)
+/* Low latency and Thumb-2 do_push implementations can't push sp directly. */
+#if defined(__thumb2__) || defined(__irq_low_latency__)
mov ip, sp
- push {ip, lr}
+ do_push (ip, lr)
#else
- do_push {sp, lr}
+ stmfd sp!, {sp, lr}
#endif
bl SYM(__gnu_ldivmod_helper) __PLT__
ldr lr, [sp, #4]
add sp, sp, #8
- do_pop {r2, r3}
+ do_pop (r2, r3)
RET
#endif /* L_aeabi_ldivmod */
@@ -136,16 +137,17 @@
test_div_by_zero unsigned
sub sp, sp, #8
-#if defined(__thumb2__)
+/* Low latency and Thumb-2 do_push implementations can't push sp directly. */
+#if defined(__thumb2__) || defined(__irq_low_latency__)
mov ip, sp
- push {ip, lr}
+ do_push (ip, lr)
#else
- do_push {sp, lr}
+ stmfd sp!, {sp, lr}
#endif
bl SYM(__gnu_uldivmod_helper) __PLT__
ldr lr, [sp, #4]
add sp, sp, #8
- do_pop {r2, r3}
+ do_pop (r2, r3)
RET
#endif /* L_aeabi_divmod */
=== modified file 'gcc/config/arm/ieee754-df.S'
--- old/gcc/config/arm/ieee754-df.S 2009-06-05 12:52:36 +0000
+++ new/gcc/config/arm/ieee754-df.S 2010-08-05 15:20:54 +0000
@@ -83,7 +83,7 @@
ARM_FUNC_START adddf3
ARM_FUNC_ALIAS aeabi_dadd adddf3
-1: do_push {r4, r5, lr}
+1: do_push (r4, r5, lr)
@ Look for zeroes, equal values, INF, or NAN.
shift1 lsl, r4, xh, #1
@@ -427,7 +427,7 @@
do_it eq, t
moveq r1, #0
RETc(eq)
- do_push {r4, r5, lr}
+ do_push (r4, r5, lr)
mov r4, #0x400 @ initial exponent
add r4, r4, #(52-1 - 1)
mov r5, #0 @ sign bit is 0
@@ -447,7 +447,7 @@
do_it eq, t
moveq r1, #0
RETc(eq)
- do_push {r4, r5, lr}
+ do_push (r4, r5, lr)
mov r4, #0x400 @ initial exponent
add r4, r4, #(52-1 - 1)
ands r5, r0, #0x80000000 @ sign bit in r5
@@ -481,7 +481,7 @@
RETc(eq) @ we are done already.
@ value was denormalized. We can normalize it now.
- do_push {r4, r5, lr}
+ do_push (r4, r5, lr)
mov r4, #0x380 @ setup corresponding exponent
and r5, xh, #0x80000000 @ move sign bit in r5
bic xh, xh, #0x80000000
@@ -508,9 +508,9 @@
@ compatibility.
adr ip, LSYM(f0_ret)
@ Push pc as well so that RETLDM works correctly.
- do_push {r4, r5, ip, lr, pc}
+ do_push (r4, r5, ip, lr, pc)
#else
- do_push {r4, r5, lr}
+ do_push (r4, r5, lr)
#endif
mov r5, #0
@@ -534,9 +534,9 @@
@ compatibility.
adr ip, LSYM(f0_ret)
@ Push pc as well so that RETLDM works correctly.
- do_push {r4, r5, ip, lr, pc}
+ do_push (r4, r5, ip, lr, pc)
#else
- do_push {r4, r5, lr}
+ do_push (r4, r5, lr)
#endif
ands r5, ah, #0x80000000 @ sign bit in r5
@@ -585,7 +585,7 @@
@ Legacy code expects the result to be returned in f0. Copy it
@ there as well.
LSYM(f0_ret):
- do_push {r0, r1}
+ do_push (r0, r1)
ldfd f0, [sp], #8
RETLDM
@@ -602,7 +602,7 @@
ARM_FUNC_START muldf3
ARM_FUNC_ALIAS aeabi_dmul muldf3
- do_push {r4, r5, r6, lr}
+ do_push (r4, r5, r6, lr)
@ Mask out exponents, trap any zero/denormal/INF/NAN.
mov ip, #0xff
@@ -910,7 +910,7 @@
ARM_FUNC_START divdf3
ARM_FUNC_ALIAS aeabi_ddiv divdf3
- do_push {r4, r5, r6, lr}
+ do_push (r4, r5, r6, lr)
@ Mask out exponents, trap any zero/denormal/INF/NAN.
mov ip, #0xff
@@ -1195,7 +1195,7 @@
@ The status-returning routines are required to preserve all
@ registers except ip, lr, and cpsr.
-6: do_push {r0, lr}
+6: do_push (r0, lr)
ARM_CALL cmpdf2
@ Set the Z flag correctly, and the C flag unconditionally.
cmp r0, #0
=== modified file 'gcc/config/arm/ieee754-sf.S'
--- old/gcc/config/arm/ieee754-sf.S 2009-06-05 12:52:36 +0000
+++ new/gcc/config/arm/ieee754-sf.S 2010-08-05 15:20:54 +0000
@@ -481,7 +481,7 @@
and r3, ip, #0x80000000
@ Well, no way to make it shorter without the umull instruction.
- do_push {r3, r4, r5}
+ do_push (r3, r4, r5)
mov r4, r0, lsr #16
mov r5, r1, lsr #16
bic r0, r0, r4, lsl #16
@@ -492,7 +492,7 @@
mla r0, r4, r1, r0
adds r3, r3, r0, lsl #16
adc r1, ip, r0, lsr #16
- do_pop {r0, r4, r5}
+ do_pop (r0, r4, r5)
#else
@@ -882,7 +882,7 @@
@ The status-returning routines are required to preserve all
@ registers except ip, lr, and cpsr.
-6: do_push {r0, r1, r2, r3, lr}
+6: do_push (r0, r1, r2, r3, lr)
ARM_CALL cmpsf2
@ Set the Z flag correctly, and the C flag unconditionally.
cmp r0, #0
=== modified file 'gcc/config/arm/lib1funcs.asm'
--- old/gcc/config/arm/lib1funcs.asm 2010-04-02 18:54:46 +0000
+++ new/gcc/config/arm/lib1funcs.asm 2010-08-05 15:20:54 +0000
@@ -254,8 +254,8 @@
.macro shift1 op, arg0, arg1, arg2
\op \arg0, \arg1, \arg2
.endm
-#define do_push push
-#define do_pop pop
+#define do_push(...) push {__VA_ARGS__}
+#define do_pop(...) pop {__VA_ARGS__}
#define COND(op1, op2, cond) op1 ## op2 ## cond
/* Perform an arithmetic operation with a variable shift operand. This
requires two instructions and a scratch register on Thumb-2. */
@@ -269,8 +269,42 @@
.macro shift1 op, arg0, arg1, arg2
mov \arg0, \arg1, \op \arg2
.endm
-#define do_push stmfd sp!,
-#define do_pop ldmfd sp!,
+#if defined(__low_irq_latency__)
+#define do_push(...) \
+ _buildN1(do_push, _buildC1(__VA_ARGS__))( __VA_ARGS__)
+#define _buildN1(BASE, X) _buildN2(BASE, X)
+#define _buildN2(BASE, X) BASE##X
+#define _buildC1(...) _buildC2(__VA_ARGS__,9,8,7,6,5,4,3,2,1)
+#define _buildC2(a1,a2,a3,a4,a5,a6,a7,a8,a9,c,...) c
+
+#define do_push1(r1) str r1, [sp, #-4]!
+#define do_push2(r1, r2) str r2, [sp, #-4]! ; str r1, [sp, #-4]!
+#define do_push3(r1, r2, r3) str r3, [sp, #-4]! ; str r2, [sp, #-4]!; str r1, [sp, #-4]!
+#define do_push4(r1, r2, r3, r4) \
+ do_push3 (r2, r3, r4);\
+ do_push1 (r1)
+#define do_push5(r1, r2, r3, r4, r5) \
+ do_push4 (r2, r3, r4, r5);\
+ do_push1 (r1)
+
+#define do_pop(...) \
+_buildN1(do_pop, _buildC1(__VA_ARGS__))( __VA_ARGS__)
+
+#define do_pop1(r1) ldr r1, [sp], #4
+#define do_pop2(r1, r2) ldr r1, [sp], #4 ; ldr r2, [sp], #4
+#define do_pop3(r1, r2, r3) ldr r1, [sp], #4 ; str r2, [sp], #4; str r3, [sp], #4
+#define do_pop4(r1, r2, r3, r4) \
+ do_pop1 (r1);\
+ do_pup3 (r2, r3, r4)
+#define do_pop5(r1, r2, r3, r4, r5) \
+ do_pop1 (r1);\
+ do_pop4 (r2, r3, r4, r5)
+#else
+#define do_push(...) stmfd sp!, { __VA_ARGS__}
+#define do_pop(...) ldmfd sp!, {__VA_ARGS__}
+#endif
+
+
#define COND(op1, op2, cond) op1 ## cond ## op2
.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
\name \dest, \src1, \src2, \shiftop \shiftreg
@@ -1260,7 +1294,7 @@
ARM_FUNC_START div0
#endif
- do_push {r1, lr}
+ do_push (r1, lr)
mov r0, #SIGFPE
bl SYM(raise) __PLT__
RETLDM r1
@@ -1277,7 +1311,7 @@
#if defined __ARM_EABI__ && defined __linux__
@ EABI GNU/Linux call to cacheflush syscall.
ARM_FUNC_START clear_cache
- do_push {r7}
+ do_push (r7)
#if __ARM_ARCH__ >= 7 || defined(__ARM_ARCH_6T2__)
movw r7, #2
movt r7, #0xf
@@ -1287,7 +1321,7 @@
#endif
mov r2, #0
swi 0
- do_pop {r7}
+ do_pop (r7)
RET
FUNC_END clear_cache
#else
@@ -1490,7 +1524,7 @@
push {r4, lr}
# else
ARM_FUNC_START clzdi2
- do_push {r4, lr}
+ do_push (r4, lr)
# endif
cmp xxh, #0
bne 1f
=== modified file 'gcc/config/arm/predicates.md'
--- old/gcc/config/arm/predicates.md 2010-07-30 14:17:05 +0000
+++ new/gcc/config/arm/predicates.md 2010-08-05 15:20:54 +0000
@@ -328,6 +328,9 @@
HOST_WIDE_INT i = 1, base = 0;
rtx elt;
+ if (low_irq_latency)
+ return false;
+
if (count <= 1
|| GET_CODE (XVECEXP (op, 0, 0)) != SET)
return false;
@@ -385,6 +388,9 @@
HOST_WIDE_INT i = 1, base = 0;
rtx elt;
+ if (low_irq_latency)
+ return false;
+
if (count <= 1
|| GET_CODE (XVECEXP (op, 0, 0)) != SET)
return false;
=== modified file 'gcc/doc/invoke.texi'
--- old/gcc/doc/invoke.texi 2010-07-29 17:03:20 +0000
+++ new/gcc/doc/invoke.texi 2010-08-05 15:20:54 +0000
@@ -469,6 +469,7 @@
-mtpcs-frame -mtpcs-leaf-frame @gol
-mcaller-super-interworking -mcallee-super-interworking @gol
-mtp=@var{name} @gol
+-mlow-irq-latency @gol
-mword-relocations @gol
-mfix-cortex-m3-ldrd}
@@ -9489,6 +9490,12 @@
@code{,}, @code{!}, @code{|}, and @code{*} as needed.
+@item -mlow-irq-latency
+@opindex mlow-irq-latency
+Avoid instructions with high interrupt latency when generating
+code. This can increase code size and reduce performance.
+The option is off by default.
+
@end table
The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar

View File

@@ -0,0 +1,109 @@
Julian Brown <julian@codesourcery.com>
Mark Shinwell <mark@codesourcery.com>
gcc/
* regrename.c (addresses.h): Move include of addresses.h after
include of flags.h.
* recog.c: Likewise.
* regcprop.c: Likewise.
* config/arm/arm.h (CLASS_LIKELY_SPILLED_P): Check against
LO_REGS only for Thumb-1.
(MODE_BASE_REG_CLASS): Restrict base registers to those which can
be used in short instructions when optimising for size on Thumb-2.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
Vladimir Prus <vladimir@codesourcery.com>
Julian Brown <julian@codesourcery.com>
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2010-08-05 15:20:54 +0000
+++ new/gcc/config/arm/arm.h 2010-08-05 15:28:47 +0000
@@ -1254,11 +1254,14 @@
|| reg_classes_intersect_p (VFP_REGS, (CLASS)) \
: 0)
-/* We need to define this for LO_REGS on thumb. Otherwise we can end up
- using r0-r4 for function arguments, r7 for the stack frame and don't
- have enough left over to do doubleword arithmetic. */
+/* We need to define this for LO_REGS on Thumb-1. Otherwise we can end up
+ using r0-r4 for function arguments, r7 for the stack frame and don't have
+ enough left over to do doubleword arithmetic. For Thumb-2 all the
+ potentially problematic instructions accept high registers so this is not
+ necessary. Care needs to be taken to avoid adding new Thumb-2 patterns
+ that require many low registers. */
#define CLASS_LIKELY_SPILLED_P(CLASS) \
- ((TARGET_THUMB && (CLASS) == LO_REGS) \
+ ((TARGET_THUMB1 && (CLASS) == LO_REGS) \
|| (CLASS) == CC_REG)
/* The class value for index registers, and the one for base regs. */
@@ -1269,7 +1272,7 @@
when addressing quantities in QI or HI mode; if we don't know the
mode, then we must be conservative. */
#define MODE_BASE_REG_CLASS(MODE) \
- (TARGET_32BIT ? CORE_REGS : \
+ (TARGET_ARM || (TARGET_THUMB2 && !optimize_size) ? CORE_REGS : \
(((MODE) == SImode) ? BASE_REGS : LO_REGS))
/* For Thumb we can not support SP+reg addressing, so we return LO_REGS
=== modified file 'gcc/recog.c'
--- old/gcc/recog.c 2010-04-02 18:54:46 +0000
+++ new/gcc/recog.c 2010-08-05 15:28:47 +0000
@@ -31,10 +31,10 @@
#include "hard-reg-set.h"
#include "recog.h"
#include "regs.h"
-#include "addresses.h"
#include "expr.h"
#include "function.h"
#include "flags.h"
+#include "addresses.h"
#include "real.h"
#include "toplev.h"
#include "basic-block.h"
=== modified file 'gcc/regcprop.c'
--- old/gcc/regcprop.c 2010-02-26 11:01:28 +0000
+++ new/gcc/regcprop.c 2010-08-05 15:28:47 +0000
@@ -26,7 +26,6 @@
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
-#include "addresses.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "reload.h"
@@ -34,6 +33,7 @@
#include "function.h"
#include "recog.h"
#include "flags.h"
+#include "addresses.h"
#include "toplev.h"
#include "obstack.h"
#include "timevar.h"
=== modified file 'gcc/regrename.c'
--- old/gcc/regrename.c 2010-04-02 18:54:46 +0000
+++ new/gcc/regrename.c 2010-08-05 15:28:47 +0000
@@ -26,7 +26,6 @@
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
-#include "addresses.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "reload.h"
@@ -34,6 +33,7 @@
#include "function.h"
#include "recog.h"
#include "flags.h"
+#include "addresses.h"
#include "toplev.h"
#include "obstack.h"
#include "timevar.h"

View File

@@ -0,0 +1,174 @@
http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00811.html
Kazu Hirata <kazu@codesourcery.com>
gcc/testsuite/
* gcc.target/arm/vfp-ldmdbd.c, gcc.target/arm/vfp-ldmdbs.c,
gcc.target/arm/vfp-ldmiad.c, gcc.target/arm/vfp-ldmias.c,
gcc.target/arm/vfp-stmdbd.c, gcc.target/arm/vfp-stmdbs.c,
gcc.target/arm/vfp-stmiad.c, gcc.target/arm/vfp-stmias.c: New.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
Julian Brown <julian@codesourcery.com>
Mark Shinwell <mark@codesourcery.com>
=== added file 'gcc/testsuite/gcc.target/arm/vfp-ldmdbd.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-ldmdbd.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-ldmdbd.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+extern void bar (double);
+
+void
+foo (double *p, double a, int n)
+{
+ do
+ bar (*--p + a);
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fldmdbd" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-ldmdbs.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-ldmdbs.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-ldmdbs.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+extern void baz (float);
+
+void
+foo (float *p, float a, int n)
+{
+ do
+ bar (*--p + a);
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fldmdbs" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-ldmiad.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-ldmiad.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-ldmiad.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+extern void bar (double);
+
+void
+foo (double *p, double a, int n)
+{
+ do
+ bar (*p++ + a);
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fldmiad" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-ldmias.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-ldmias.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-ldmias.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+extern void baz (float);
+
+void
+foo (float *p, float a, int n)
+{
+ do
+ bar (*p++ + a);
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fldmias" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-stmdbd.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-stmdbd.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-stmdbd.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+void
+foo (double *p, double a, double b, int n)
+{
+ double c = a + b;
+ do
+ *--p = c;
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fstmdbd" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-stmdbs.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-stmdbs.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-stmdbs.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+void
+foo (float *p, float a, float b, int n)
+{
+ float c = a + b;
+ do
+ *--p = c;
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fstmdbs" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-stmiad.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-stmiad.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-stmiad.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+void
+foo (double *p, double a, double b, int n)
+{
+ double c = a + b;
+ do
+ *p++ = c;
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fstmiad" } } */
=== added file 'gcc/testsuite/gcc.target/arm/vfp-stmias.c'
--- old/gcc/testsuite/gcc.target/arm/vfp-stmias.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/vfp-stmias.c 2010-08-05 15:37:24 +0000
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-options "-O2 -mfpu=vfp -mfloat-abi=softfp" } */
+
+void
+foo (float *p, float a, float b, int n)
+{
+ float c = a + b;
+ do
+ *p++ = c;
+ while (n--);
+}
+
+/* { dg-final { scan-assembler "fstmias" } } */

View File

@@ -0,0 +1,86 @@
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00038.html
* g++.dg/other/armv7m-1.C: New.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00811.html
=== added file 'gcc/testsuite/g++.dg/other/armv7m-1.C'
--- old/gcc/testsuite/g++.dg/other/armv7m-1.C 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/g++.dg/other/armv7m-1.C 2010-08-05 16:23:43 +0000
@@ -0,0 +1,69 @@
+/* { dg-do run { target arm*-*-* } } */
+/* Test Armv7m interrupt routines. */
+#include <stdlib.h>
+
+#ifdef __ARM_ARCH_7M__
+void __attribute__((interrupt))
+foo(void)
+{
+ long long n;
+ long p;
+ asm volatile ("" : "=r" (p) : "0" (&n));
+ if (p & 4)
+ abort ();
+ return;
+}
+
+void __attribute__((interrupt))
+bar(void)
+{
+ throw 42;
+}
+
+int main()
+{
+ int a;
+ int before;
+ int after;
+ volatile register int sp asm("sp");
+
+ asm volatile ("mov %0, sp\n"
+ "blx %2\n"
+ "mov %1, sp\n"
+ : "=&r" (before), "=r" (after) : "r" (foo)
+ : "memory", "cc", "r0", "r1", "r2", "r3", "ip", "lr");
+ if (before != after)
+ abort();
+ asm volatile ("mov %0, sp\n"
+ "sub sp, sp, #4\n"
+ "blx %2\n"
+ "add sp, sp, #4\n"
+ "mov %1, sp\n"
+ : "=&r" (before), "=r" (after) : "r" (foo)
+ : "memory", "cc", "r0", "r1", "r2", "r3", "ip", "lr");
+ if (before != after)
+ abort();
+ before = sp;
+ try
+ {
+ bar();
+ }
+ catch (int i)
+ {
+ if (i != 42)
+ abort();
+ }
+ catch (...)
+ {
+ abort();
+ }
+ if (before != sp)
+ abort();
+ exit(0);
+}
+#else
+int main()
+{
+ exit (0);
+}
+#endif

View File

@@ -0,0 +1,132 @@
Backport from FSF mainline:
Mark Shinwell <shinwell@codesourcery.com>
Julian Brown <julian@codesourcery.com>
gcc/
* config/arm/thumb2.md (thumb2_movsi_insn): Split ldr and str
alternatives according to use of high and low regs.
* config/arm/vfp.md (thumb2_movsi_vfp): Likewise.
* config/arm/arm.h (CONDITIONAL_REGISTER_USAGE): Use high regs when
optimizing for size on Thumb-2.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00038.html
=== modified file 'gcc/config/arm/arm.h'
--- old/gcc/config/arm/arm.h 2010-08-05 15:28:47 +0000
+++ new/gcc/config/arm/arm.h 2010-08-05 16:34:46 +0000
@@ -783,12 +783,11 @@
fixed_regs[regno] = call_used_regs[regno] = 1; \
} \
\
- if (TARGET_THUMB && optimize_size) \
- { \
- /* When optimizing for size, it's better not to use \
- the HI regs, because of the overhead of stacking \
- them. */ \
- /* ??? Is this still true for thumb2? */ \
+ if (TARGET_THUMB1 && optimize_size) \
+ { \
+ /* When optimizing for size on Thumb-1, it's better not \
+ to use the HI regs, because of the overhead of \
+ stacking them. */ \
for (regno = FIRST_HI_REGNUM; \
regno <= LAST_HI_REGNUM; ++regno) \
fixed_regs[regno] = call_used_regs[regno] = 1; \
=== modified file 'gcc/config/arm/thumb2.md'
--- old/gcc/config/arm/thumb2.md 2010-04-02 07:32:00 +0000
+++ new/gcc/config/arm/thumb2.md 2010-08-05 16:34:46 +0000
@@ -223,9 +223,14 @@
(set_attr "neg_pool_range" "*,*,*,0,*")]
)
+;; We have two alternatives here for memory loads (and similarly for stores)
+;; to reflect the fact that the permissible constant pool ranges differ
+;; between ldr instructions taking low regs and ldr instructions taking high
+;; regs. The high register alternatives are not taken into account when
+;; choosing register preferences in order to reflect their expense.
(define_insn "*thumb2_movsi_insn"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m")
- (match_operand:SI 1 "general_operand" "rk ,I,K,j,mi,rk"))]
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,l, *hk,m,*m")
+ (match_operand:SI 1 "general_operand" "rk ,I,K,j,mi,*mi,l,*hk"))]
"TARGET_THUMB2 && ! TARGET_IWMMXT
&& !(TARGET_HARD_FLOAT && TARGET_VFP)
&& ( register_operand (operands[0], SImode)
@@ -236,11 +241,13 @@
mvn%?\\t%0, #%B1
movw%?\\t%0, %1
ldr%?\\t%0, %1
+ ldr%?\\t%0, %1
+ str%?\\t%1, %0
str%?\\t%1, %0"
- [(set_attr "type" "*,*,*,*,load1,store1")
+ [(set_attr "type" "*,*,*,*,load1,load1,store1,store1")
(set_attr "predicable" "yes")
- (set_attr "pool_range" "*,*,*,*,4096,*")
- (set_attr "neg_pool_range" "*,*,*,*,0,*")]
+ (set_attr "pool_range" "*,*,*,*,1020,4096,*,*")
+ (set_attr "neg_pool_range" "*,*,*,*,0,0,*,*")]
)
(define_insn "tls_load_dot_plus_four"
=== modified file 'gcc/config/arm/vfp.md'
--- old/gcc/config/arm/vfp.md 2010-07-30 14:17:05 +0000
+++ new/gcc/config/arm/vfp.md 2010-08-05 16:34:46 +0000
@@ -86,9 +86,11 @@
(set_attr "neg_pool_range" "*,*,*,*,4084,*,*,*,*,1008,*")]
)
+;; See thumb2.md:thumb2_movsi_insn for an explanation of the split
+;; high/low register alternatives for loads and stores here.
(define_insn "*thumb2_movsi_vfp"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m,*t,r, *t,*t, *Uv")
- (match_operand:SI 1 "general_operand" "rk, I,K,j,mi,rk,r,*t,*t,*Uvi,*t"))]
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,l,*hk,m,*m,*t,r, *t,*t, *Uv")
+ (match_operand:SI 1 "general_operand" "rk, I,K,j,mi,*mi,l,*hk,r,*t,*t,*Uvi,*t"))]
"TARGET_THUMB2 && TARGET_VFP && TARGET_HARD_FLOAT
&& ( s_register_operand (operands[0], SImode)
|| s_register_operand (operands[1], SImode))"
@@ -102,25 +104,27 @@
case 3:
return \"movw%?\\t%0, %1\";
case 4:
+ case 5:
return \"ldr%?\\t%0, %1\";
- case 5:
+ case 6:
+ case 7:
return \"str%?\\t%1, %0\";
- case 6:
+ case 8:
return \"fmsr%?\\t%0, %1\\t%@ int\";
- case 7:
+ case 9:
return \"fmrs%?\\t%0, %1\\t%@ int\";
- case 8:
+ case 10:
return \"fcpys%?\\t%0, %1\\t%@ int\";
- case 9: case 10:
+ case 11: case 12:
return output_move_vfp (operands);
default:
gcc_unreachable ();
}
"
[(set_attr "predicable" "yes")
- (set_attr "type" "*,*,*,*,load1,store1,r_2_f,f_2_r,fcpys,f_load,f_store")
- (set_attr "pool_range" "*,*,*,*,4096,*,*,*,*,1020,*")
- (set_attr "neg_pool_range" "*,*,*,*, 0,*,*,*,*,1008,*")]
+ (set_attr "type" "*,*,*,*,load1,load1,store1,store1,r_2_f,f_2_r,fcpys,f_load,f_store")
+ (set_attr "pool_range" "*,*,*,*,1020,4096,*,*,*,*,*,1020,*")
+ (set_attr "neg_pool_range" "*,*,*,*, 0, 0,*,*,*,*,*,1008,*")]
)

View File

@@ -0,0 +1,68 @@
2010-08-06 Yao Qi <yao@codesourcery.com>
LP: #612011
gcc/
* config/arm/arm.c (output_move_double): Fix typo generating
instructions ('ldr'->'str').
gcc/testsuite/
* gcc.target/arm/pr45094.c: New test.
2010-08-02 Ulrich Weigand <uweigand@de.ibm.com>
LP: #604874
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-08-10 13:31:21 +0000
+++ new/gcc/config/arm/arm.c 2010-08-10 14:03:02 +0000
@@ -12506,13 +12506,13 @@
{
if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)
{
- output_asm_insn ("ldr%?\t%0, [%1, %2]!", otherops);
- output_asm_insn ("ldr%?\t%H0, [%1, #4]", otherops);
+ output_asm_insn ("str%?\t%0, [%1, %2]!", otherops);
+ output_asm_insn ("str%?\t%H0, [%1, #4]", otherops);
}
else
{
- output_asm_insn ("ldr%?\t%H0, [%1, #4]", otherops);
- output_asm_insn ("ldr%?\t%0, [%1], %2", otherops);
+ output_asm_insn ("str%?\t%H0, [%1, #4]", otherops);
+ output_asm_insn ("str%?\t%0, [%1], %2", otherops);
}
}
else if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)
=== added file 'gcc/testsuite/gcc.target/arm/pr45094.c'
--- old/gcc/testsuite/gcc.target/arm/pr45094.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/arm/pr45094.c 2010-08-06 05:10:03 +0000
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-options "-O2 -mcpu=cortex-a8" } */
+/* { dg-add-options arm_neon } */
+
+#include <stdlib.h>
+
+long long buffer[32];
+
+void __attribute__((noinline)) f(long long *p, int n)
+{
+ while (--n >= 0)
+ {
+ *p = 1;
+ p += 32;
+ }
+}
+
+int main(void)
+{
+ f(buffer, 1);
+
+ if (!buffer[0])
+ abort();
+
+ return 0;
+}

View File

@@ -0,0 +1,138 @@
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
Mark Shinwell <shinwell@codesourcery.com>
gcc/
* config/arm/vfp.md (*arm_movsi_vfp, *thumb2_movsi_vfp)
(*arm_movdi_vfp, *thumb2_movdi_vfp, *movsf_vfp, *thumb2_movsf_vfp)
(*movdf_vfp, *thumb2_movdf_vfp, *movsfcc_vfp, *thumb2_movsfcc_vfp)
(*movdfcc_vfp, *thumb2_movdfcc_vfp): Add neon_type.
* config/arm/arm.md (neon_type): Update comment.
2010-08-10 Andrew Stubbs <ams@codesourcery.com>
gcc/
=== modified file 'gcc/config/arm/arm.md'
--- old/gcc/config/arm/arm.md 2010-08-10 13:31:21 +0000
+++ new/gcc/config/arm/arm.md 2010-08-12 11:29:02 +0000
@@ -255,8 +255,6 @@
(define_attr "ldsched" "no,yes" (const (symbol_ref "arm_ld_sched")))
;; Classification of NEON instructions for scheduling purposes.
-;; Do not set this attribute and the "type" attribute together in
-;; any one instruction pattern.
(define_attr "neon_type"
"neon_int_1,\
neon_int_2,\
=== modified file 'gcc/config/arm/vfp.md'
--- old/gcc/config/arm/vfp.md 2010-08-10 13:31:21 +0000
+++ new/gcc/config/arm/vfp.md 2010-08-12 11:29:02 +0000
@@ -82,6 +82,7 @@
"
[(set_attr "predicable" "yes")
(set_attr "type" "*,*,*,*,load1,store1,r_2_f,f_2_r,fcpys,f_loads,f_stores")
+ (set_attr "neon_type" "*,*,*,*,*,*,neon_mcr,neon_mrc,neon_vmov,*,*")
(set_attr "pool_range" "*,*,*,*,4096,*,*,*,*,1020,*")
(set_attr "neg_pool_range" "*,*,*,*,4084,*,*,*,*,1008,*")]
)
@@ -123,6 +124,7 @@
"
[(set_attr "predicable" "yes")
(set_attr "type" "*,*,*,*,load1,load1,store1,store1,r_2_f,f_2_r,fcpys,f_load,f_store")
+ (set_attr "neon_type" "*,*,*,*,*,*,*,*,neon_mcr,neon_mrc,neon_vmov,*,*")
(set_attr "pool_range" "*,*,*,*,1020,4096,*,*,*,*,*,1020,*")
(set_attr "neg_pool_range" "*,*,*,*, 0, 0,*,*,*,*,*,1008,*")]
)
@@ -160,6 +162,7 @@
}
"
[(set_attr "type" "*,load2,store2,r_2_f,f_2_r,ffarithd,f_loadd,f_stored")
+ (set_attr "neon_type" "*,*,*,neon_mcr_2_mcrr,neon_mrrc,neon_vmov,*,*")
(set (attr "length") (cond [(eq_attr "alternative" "0,1,2") (const_int 8)
(eq_attr "alternative" "5")
(if_then_else
@@ -198,6 +201,7 @@
}
"
[(set_attr "type" "*,load2,store2,r_2_f,f_2_r,ffarithd,f_load,f_store")
+ (set_attr "neon_type" "*,*,*,neon_mcr_2_mcrr,neon_mrrc,neon_vmov,*,*")
(set (attr "length") (cond [(eq_attr "alternative" "0,1,2") (const_int 8)
(eq_attr "alternative" "5")
(if_then_else
@@ -352,6 +356,7 @@
[(set_attr "predicable" "yes")
(set_attr "type"
"r_2_f,f_2_r,fconsts,f_loads,f_stores,load1,store1,fcpys,*")
+ (set_attr "neon_type" "neon_mcr,neon_mrc,*,*,*,*,*,neon_vmov,*")
(set_attr "pool_range" "*,*,*,1020,*,4096,*,*,*")
(set_attr "neg_pool_range" "*,*,*,1008,*,4080,*,*,*")]
)
@@ -388,6 +393,7 @@
[(set_attr "predicable" "yes")
(set_attr "type"
"r_2_f,f_2_r,fconsts,f_load,f_store,load1,store1,fcpys,*")
+ (set_attr "neon_type" "neon_mcr,neon_mrc,*,*,*,*,*,neon_vmov,*")
(set_attr "pool_range" "*,*,*,1020,*,4092,*,*,*")
(set_attr "neg_pool_range" "*,*,*,1008,*,0,*,*,*")]
)
@@ -430,6 +436,7 @@
"
[(set_attr "type"
"r_2_f,f_2_r,fconstd,f_loadd,f_stored,load2,store2,ffarithd,*")
+ (set_attr "neon_type" "neon_mcr_2_mcrr,neon_mrrc,*,*,*,*,*,neon_vmov,*")
(set (attr "length") (cond [(eq_attr "alternative" "3,4,8") (const_int 8)
(eq_attr "alternative" "7")
(if_then_else
@@ -474,6 +481,7 @@
"
[(set_attr "type"
"r_2_f,f_2_r,fconstd,load2,store2,f_load,f_store,ffarithd,*")
+ (set_attr "neon_type" "neon_mcr_2_mcrr,neon_mrrc,*,*,*,*,*,neon_vmov,*")
(set (attr "length") (cond [(eq_attr "alternative" "3,4,8") (const_int 8)
(eq_attr "alternative" "7")
(if_then_else
@@ -509,7 +517,8 @@
fmrs%D3\\t%0, %2\;fmrs%d3\\t%0, %1"
[(set_attr "conds" "use")
(set_attr "length" "4,4,8,4,4,8,4,4,8")
- (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
+ (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
+ (set_attr "neon_type" "neon_vmov,neon_vmov,neon_vmov,neon_mcr,neon_mcr,neon_mcr,neon_mrc,neon_mrc,neon_mrc")]
)
(define_insn "*thumb2_movsfcc_vfp"
@@ -532,7 +541,8 @@
ite\\t%D3\;fmrs%D3\\t%0, %2\;fmrs%d3\\t%0, %1"
[(set_attr "conds" "use")
(set_attr "length" "6,6,10,6,6,10,6,6,10")
- (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
+ (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
+ (set_attr "neon_type" "neon_vmov,neon_vmov,neon_vmov,neon_mcr,neon_mcr,neon_mcr,neon_mrc,neon_mrc,neon_mrc")]
)
(define_insn "*movdfcc_vfp"
@@ -555,7 +565,8 @@
fmrrd%D3\\t%Q0, %R0, %P2\;fmrrd%d3\\t%Q0, %R0, %P1"
[(set_attr "conds" "use")
(set_attr "length" "4,4,8,4,4,8,4,4,8")
- (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
+ (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
+ (set_attr "neon_type" "neon_vmov,neon_vmov,neon_vmov,neon_mcr_2_mcrr,neon_mcr_2_mcrr,neon_mcr_2_mcrr,neon_mrrc,neon_mrrc,neon_mrrc")]
)
(define_insn "*thumb2_movdfcc_vfp"
@@ -578,7 +589,8 @@
ite\\t%D3\;fmrrd%D3\\t%Q0, %R0, %P2\;fmrrd%d3\\t%Q0, %R0, %P1"
[(set_attr "conds" "use")
(set_attr "length" "6,6,10,6,6,10,6,6,10")
- (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
+ (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
+ (set_attr "neon_type" "neon_vmov,neon_vmov,neon_vmov,neon_mcr_2_mcrr,neon_mcr_2_mcrr,neon_mcr_2_mcrr,neon_mrrc,neon_mrrc,neon_mrrc")]
)

View File

@@ -0,0 +1,95 @@
gcc/
* config/arm/arm.c (arm_override_options): Override alignments if
tuning for Cortex-A8.
(create_fix_barrier, arm_reorg): If aligning to jumps or loops,
make labels have a size.
* config/arm/arm.md (VUNSPEC_ALIGN16, VUNSPEC_ALIGN32): New constants.
(align_16, align_32): New patterns.
2010-07-26 Julian Brown <julian@codesourcery.com>
Merge from Sourcery G++ 4.4:
Mark Shinwell <shinwell@codesourcery.com>
=== modified file 'gcc/config/arm/arm.c'
--- old/gcc/config/arm/arm.c 2010-08-10 14:03:02 +0000
+++ new/gcc/config/arm/arm.c 2010-08-12 11:33:54 +0000
@@ -1449,6 +1449,16 @@
chosen. */
gcc_assert (arm_tune != arm_none);
+ if (arm_tune == cortexa8 && optimize >= 3)
+ {
+ /* These alignments were experimentally determined to improve SPECint
+ performance on SPECCPU 2000. */
+ if (align_functions <= 0)
+ align_functions = 16;
+ if (align_jumps <= 0)
+ align_jumps = 16;
+ }
+
tune_flags = all_cores[(int)arm_tune].flags;
if (target_fp16_format_name)
@@ -11263,7 +11273,10 @@
gcc_assert (GET_CODE (from) != BARRIER);
/* Count the length of this insn. */
- count += get_attr_length (from);
+ if (LABEL_P (from) && (align_jumps > 0 || align_loops > 0))
+ count += MAX (align_jumps, align_loops);
+ else
+ count += get_attr_length (from);
/* If there is a jump table, add its length. */
tmp = is_jump_table (from);
@@ -11603,6 +11616,8 @@
insn = table;
}
}
+ else if (LABEL_P (insn) && (align_jumps > 0 || align_loops > 0))
+ address += MAX (align_jumps, align_loops);
}
fix = minipool_fix_head;
=== modified file 'gcc/config/arm/arm.md'
--- old/gcc/config/arm/arm.md 2010-08-12 11:29:02 +0000
+++ new/gcc/config/arm/arm.md 2010-08-12 11:33:54 +0000
@@ -135,6 +135,8 @@
(VUNSPEC_WCMP_EQ 12) ; Used by the iWMMXt WCMPEQ instructions
(VUNSPEC_WCMP_GTU 13) ; Used by the iWMMXt WCMPGTU instructions
(VUNSPEC_WCMP_GT 14) ; Used by the iwMMXT WCMPGT instructions
+ (VUNSPEC_ALIGN16 15) ; Used to force 16-byte alignment.
+ (VUNSPEC_ALIGN32 16) ; Used to force 32-byte alignment.
(VUNSPEC_EH_RETURN 20); Use to override the return address for exception
; handling.
]
@@ -11042,6 +11044,24 @@
"
)
+(define_insn "align_16"
+ [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN16)]
+ "TARGET_EITHER"
+ "*
+ assemble_align (128);
+ return \"\";
+ "
+)
+
+(define_insn "align_32"
+ [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN32)]
+ "TARGET_EITHER"
+ "*
+ assemble_align (256);
+ return \"\";
+ "
+)
+
(define_insn "consttable_end"
[(unspec_volatile [(const_int 0)] VUNSPEC_POOL_END)]
"TARGET_EITHER"

Some files were not shown because too many files have changed in this diff Show More