summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.3.3/debian
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.3.3/debian')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.3.3/debian/arm-unbreak-eabi-armv4t.dpatch36
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.3.3/debian/gcc-ice-hack.dpatch331
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.3.3/debian/libstdc++-pic.dpatch71
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.3.3/debian/pr30961.dpatch179
4 files changed, 617 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.3.3/debian/arm-unbreak-eabi-armv4t.dpatch b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/arm-unbreak-eabi-armv4t.dpatch
new file mode 100644
index 0000000000..7bb8887068
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/arm-unbreak-eabi-armv4t.dpatch
@@ -0,0 +1,36 @@
1#! /bin/sh -e
2
3# DP: Fix armv4t build on ARM
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p1 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26--- src/gcc/config/arm/linux-eabi.h.orig 2007-11-24 12:37:38.000000000 +0000
27+++ src/gcc/config/arm/linux-eabi.h 2007-11-24 12:39:41.000000000 +0000
28@@ -44,7 +44,7 @@
29 The ARM10TDMI core is the default for armv5t, so set
30 SUBTARGET_CPU_DEFAULT to achieve this. */
31 #undef SUBTARGET_CPU_DEFAULT
32-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
33+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
34
35 /* TARGET_BIG_ENDIAN_DEFAULT is set in
36 config.gcc for big endian configurations. */
diff --git a/meta/recipes-devtools/gcc/gcc-4.3.3/debian/gcc-ice-hack.dpatch b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/gcc-ice-hack.dpatch
new file mode 100644
index 0000000000..84c5ef2ebd
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/gcc-ice-hack.dpatch
@@ -0,0 +1,331 @@
1#! /bin/sh -e
2
3# DP: Retry the build on an ice, save the calling options and preprocessed
4# DP: source when the ice is reproducible.
5
6dir=
7if [ $# -eq 3 -a "$2" = '-d' ]; then
8 pdir="-d $3"
9 dir="$3/"
10elif [ $# -ne 1 ]; then
11 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12 exit 1
13fi
14case "$1" in
15 -patch)
16 patch $pdir -f --no-backup-if-mismatch -p0 < $0
17 ;;
18 -unpatch)
19 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
20 ;;
21 *)
22 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
23 exit 1
24esac
25exit 0
26
272004-01-23 Jakub Jelinek <jakub@redhat.com>
28
29 * system.h (ICE_EXIT_CODE): Define.
30 * gcc.c (execute): Don't free first string early, but at the end
31 of the function. Call retry_ice if compiler exited with
32 ICE_EXIT_CODE.
33 (retry_ice): New function.
34 * diagnostic.c (diagnostic_count_diagnostic,
35 diagnostic_action_after_output, error_recursion): Exit with
36 ICE_EXIT_CODE instead of FATAL_EXIT_CODE.
37
38--- gcc/diagnostic.c.orig 2007-09-30 10:48:13.000000000 +0000
39+++ gcc/diagnostic.c 2007-09-30 10:49:57.000000000 +0000
40@@ -244,7 +244,7 @@
41 fnotice (stderr, "Please submit a full bug report,\n"
42 "with preprocessed source if appropriate.\n"
43 "See %s for instructions.\n", bug_report_url);
44- exit (ICE_EXIT_CODE);
45+ exit (FATAL_EXIT_CODE);
46
47 case DK_FATAL:
48 if (context->abort_on_error)
49--- gcc/gcc.c.orig 2007-09-30 10:48:13.000000000 +0000
50+++ gcc/gcc.c 2007-09-30 10:48:39.000000000 +0000
51@@ -357,6 +357,9 @@
52 #if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
53 static const char *convert_filename (const char *, int, int);
54 #endif
55+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
56+static void retry_ice (const char *prog, const char **argv);
57+#endif
58
59 static const char *getenv_spec_function (int, const char **);
60 static const char *if_exists_spec_function (int, const char **);
61@@ -2999,7 +3002,7 @@
62 }
63 }
64
65- if (string != commands[i].prog)
66+ if (i && string != commands[i].prog)
67 free (CONST_CAST (char *, string));
68 }
69
70@@ -3056,6 +3059,16 @@
71 else if (WIFEXITED (status)
72 && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
73 {
74+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
75+ /* For ICEs in cc1, cc1obj, cc1plus see if it is
76+ reproducible or not. */
77+ char *p;
78+ if (WEXITSTATUS (status) == ICE_EXIT_CODE
79+ && i == 0
80+ && (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
81+ && ! strncmp (p + 1, "cc1", 3))
82+ retry_ice (commands[0].prog, commands[0].argv);
83+#endif
84 if (WEXITSTATUS (status) > greatest_status)
85 greatest_status = WEXITSTATUS (status);
86 ret_code = -1;
87@@ -3076,6 +3089,9 @@
88 }
89 }
90
91+ if (commands[0].argv[0] != commands[0].prog)
92+ free ((PTR) commands[0].argv[0]);
93+
94 return ret_code;
95 }
96 }
97@@ -6016,6 +6032,224 @@
98 switches[switchnum].validated = 1;
99 }
100
101+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
102+#define RETRY_ICE_ATTEMPTS 2
103+
104+static void
105+retry_ice (const char *prog, const char **argv)
106+{
107+ int nargs, out_arg = -1, quiet = 0, attempt;
108+ int pid, retries, sleep_interval;
109+ const char **new_argv;
110+ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2];
111+
112+ if (input_filename == NULL || ! strcmp (input_filename, "-"))
113+ return;
114+
115+ for (nargs = 0; argv[nargs] != NULL; ++nargs)
116+ /* Only retry compiler ICEs, not preprocessor ones. */
117+ if (! strcmp (argv[nargs], "-E"))
118+ return;
119+ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o')
120+ {
121+ if (out_arg == -1)
122+ out_arg = nargs;
123+ else
124+ return;
125+ }
126+ /* If the compiler is going to output any time information,
127+ it might vary between invocations. */
128+ else if (! strcmp (argv[nargs], "-quiet"))
129+ quiet = 1;
130+ else if (! strcmp (argv[nargs], "-ftime-report"))
131+ return;
132+
133+ if (out_arg == -1 || !quiet)
134+ return;
135+
136+ memset (temp_filenames, '\0', sizeof (temp_filenames));
137+ new_argv = alloca ((nargs + 3) * sizeof (const char *));
138+ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *));
139+ new_argv[nargs++] = "-frandom-seed=0";
140+ new_argv[nargs] = NULL;
141+ if (new_argv[out_arg][2] == '\0')
142+ new_argv[out_arg + 1] = "-";
143+ else
144+ new_argv[out_arg] = "-o-";
145+
146+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt)
147+ {
148+ int fd = -1;
149+ int status;
150+
151+ temp_filenames[attempt * 2] = make_temp_file (".out");
152+ temp_filenames[attempt * 2 + 1] = make_temp_file (".err");
153+
154+ if (attempt == RETRY_ICE_ATTEMPTS)
155+ {
156+ int i;
157+ int fd1, fd2;
158+ struct stat st1, st2;
159+ size_t n, len;
160+ char *buf;
161+
162+ buf = xmalloc (8192);
163+
164+ for (i = 0; i < 2; ++i)
165+ {
166+ fd1 = open (temp_filenames[i], O_RDONLY);
167+ fd2 = open (temp_filenames[2 + i], O_RDONLY);
168+
169+ if (fd1 < 0 || fd2 < 0)
170+ {
171+ i = -1;
172+ close (fd1);
173+ close (fd2);
174+ break;
175+ }
176+
177+ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0)
178+ {
179+ i = -1;
180+ close (fd1);
181+ close (fd2);
182+ break;
183+ }
184+
185+ if (st1.st_size != st2.st_size)
186+ {
187+ close (fd1);
188+ close (fd2);
189+ break;
190+ }
191+
192+ len = 0;
193+ for (n = st1.st_size; n; n -= len)
194+ {
195+ len = n;
196+ if (len > 4096)
197+ len = 4096;
198+
199+ if (read (fd1, buf, len) != (int) len
200+ || read (fd2, buf + 4096, len) != (int) len)
201+ {
202+ i = -1;
203+ break;
204+ }
205+
206+ if (memcmp (buf, buf + 4096, len) != 0)
207+ break;
208+ }
209+
210+ close (fd1);
211+ close (fd2);
212+
213+ if (n)
214+ break;
215+ }
216+
217+ free (buf);
218+ if (i == -1)
219+ break;
220+
221+ if (i != 2)
222+ {
223+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
224+ break;
225+ }
226+
227+ fd = open (temp_filenames[attempt * 2], O_RDWR);
228+ if (fd < 0)
229+ break;
230+ write (fd, "//", 2);
231+ for (i = 0; i < nargs; i++)
232+ {
233+ write (fd, " ", 1);
234+ write (fd, new_argv[i], strlen (new_argv[i]));
235+ }
236+ write (fd, "\n", 1);
237+ new_argv[nargs] = "-E";
238+ new_argv[nargs + 1] = NULL;
239+ }
240+
241+ /* Fork a subprocess; wait and retry if it fails. */
242+ sleep_interval = 1;
243+ pid = -1;
244+ for (retries = 0; retries < 4; retries++)
245+ {
246+ pid = fork ();
247+ if (pid >= 0)
248+ break;
249+ sleep (sleep_interval);
250+ sleep_interval *= 2;
251+ }
252+
253+ if (pid < 0)
254+ break;
255+ else if (pid == 0)
256+ {
257+ if (attempt != RETRY_ICE_ATTEMPTS)
258+ fd = open (temp_filenames[attempt * 2], O_RDWR);
259+ if (fd < 0)
260+ exit (-1);
261+ if (fd != 1)
262+ {
263+ close (1);
264+ dup (fd);
265+ close (fd);
266+ }
267+
268+ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR);
269+ if (fd < 0)
270+ exit (-1);
271+ if (fd != 2)
272+ {
273+ close (2);
274+ dup (fd);
275+ close (fd);
276+ }
277+
278+ if (prog == new_argv[0])
279+ execvp (prog, (char *const *) new_argv);
280+ else
281+ execv (new_argv[0], (char *const *) new_argv);
282+ exit (-1);
283+ }
284+
285+ if (waitpid (pid, &status, 0) < 0)
286+ break;
287+
288+ if (attempt < RETRY_ICE_ATTEMPTS
289+ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE))
290+ {
291+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
292+ break;
293+ }
294+ else if (attempt == RETRY_ICE_ATTEMPTS)
295+ {
296+ close (fd);
297+ if (WIFEXITED (status)
298+ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE)
299+ {
300+ notice ("Preprocessed source stored into %s file, please attach this to your bugreport.\n",
301+ temp_filenames[attempt * 2]);
302+ /* Make sure it is not deleted. */
303+ free (temp_filenames[attempt * 2]);
304+ temp_filenames[attempt * 2] = NULL;
305+ break;
306+ }
307+ }
308+ }
309+
310+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++)
311+ if (temp_filenames[attempt])
312+ {
313+ unlink (temp_filenames[attempt]);
314+ free (temp_filenames[attempt]);
315+ }
316+}
317+#endif
318+
319 /* Search for a file named NAME trying various prefixes including the
320 user's -B prefix and some standard ones.
321 Return the absolute file name found. If nothing is found, return NAME. */
322--- gcc/Makefile.in.orig 2007-09-30 10:48:13.000000000 +0000
323+++ gcc/Makefile.in 2007-09-30 10:48:39.000000000 +0000
324@@ -192,6 +192,7 @@
325 build/gengtype-lex.o-warn = -Wno-error
326 # SYSCALLS.c misses prototypes
327 SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error
328+build/gcc.o-warn = -Wno-error
329
330 # All warnings have to be shut off in stage1 if the compiler used then
331 # isn't gcc; configure determines that. WARN_CFLAGS will be either
diff --git a/meta/recipes-devtools/gcc/gcc-4.3.3/debian/libstdc++-pic.dpatch b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/libstdc++-pic.dpatch
new file mode 100644
index 0000000000..70c9e81542
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/libstdc++-pic.dpatch
@@ -0,0 +1,71 @@
1#! /bin/sh -e
2
3# DP: Build and install libstdc++_pic.a library.
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p0 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26diff -ur libstdc++-v3/src/Makefile.am libstdc++-v3/src/Makefile.am
27--- libstdc++-v3/src/Makefile.am~ 2004-04-16 21:04:05.000000000 +0200
28+++ libstdc++-v3/src/Makefile.am 2004-07-03 20:22:43.000000000 +0200
29@@ -210,6 +210,10 @@
30 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
31
32
33+install-exec-local:
34+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o || touch libstdc++_pic.a
35+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
36+
37 # Added bits to build debug library.
38 if GLIBCXX_BUILD_DEBUG
39 all-local: build_debug
40diff -ur libstdc++-v3/src/Makefile.in libstdc++-v3/src/Makefile.in
41--- libstdc++-v3/src/Makefile.in 2004-07-03 06:41:13.000000000 +0200
42+++ libstdc++-v3/src/Makefile.in 2004-07-03 20:25:05.000000000 +0200
43@@ -611,7 +611,7 @@
44
45 install-data-am: install-data-local
46
47-install-exec-am: install-toolexeclibLTLIBRARIES
48+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
49
50 install-info: install-info-am
51
52@@ -644,6 +644,7 @@
53 distclean-libtool distclean-tags distdir dvi dvi-am html \
54 html-am info info-am install install-am install-data \
55 install-data-am install-data-local install-exec \
56+ install-exec-local \
57 install-exec-am install-info install-info-am install-man \
58 install-strip install-toolexeclibLTLIBRARIES installcheck \
59 installcheck-am installdirs maintainer-clean \
60@@ -729,6 +730,11 @@
61 install_debug:
62 (cd ${debugdir} && $(MAKE) \
63 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
64+
65+install-exec-local:
66+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o || touch libstdc++_pic.a
67+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
68+
69 # Tell versions [3.59,3.63) of GNU make to not export all variables.
70 # Otherwise a system limit (for SysV at least) may be exceeded.
71 .NOEXPORT:
diff --git a/meta/recipes-devtools/gcc/gcc-4.3.3/debian/pr30961.dpatch b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/pr30961.dpatch
new file mode 100644
index 0000000000..b20fdf5bf5
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.3.3/debian/pr30961.dpatch
@@ -0,0 +1,179 @@
1#! /bin/sh -e
2
3# DP: <your description>
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p0 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26From: "H.J. Lu" <hjl@lucon.org>
27Sender: gcc-patches-owner@gcc.gnu.org
28To: gcc-patches@gcc.gnu.org
29Subject: PATCH: PR target/30961: [4.1/4.2/4.3 regression] redundant reg/mem stores/moves
30Date: Mon, 27 Aug 2007 11:34:12 -0700
31
32We start with
33
34(note:HI 3 4 22 2 NOTE_INSN_FUNCTION_BEG)
35
36(insn:HI 6 3 10 2 c.c:3 (set (reg:DF 58 [ <result> ])
37 (subreg:DF (reg/v:DI 59 [ in ]) 0)) 102 {*movdf_integer_rex64} (expr_list:REG_DEAD (reg/v:DI 59 [ in ])
38 (nil)))
39
40(insn:HI 10 6 16 2 c.c:7 (set (reg/i:DF 21 xmm0 [ <result> ])
41 (reg:DF 58 [ <result> ])) 102 {*movdf_integer_rex64} (expr_list:REG_DEAD (reg:DF 58 [ <result> ])
42 (nil)))
43
44(insn:HI 16 10 0 2 c.c:7 (use (reg/i:DF 21 xmm0 [ <result> ])) -1 (nil))
45
46we are trying to allocate registers for insn 6 and we allocate
47xmm0 for the return value. Reload doesn't check if xmm0 can be used for
48DF 59, it allocates xmm1 for DF 59 and generates:
49
50Reloads for insn # 6
51Reload 0: reload_in (DF) = (reg:DF 5 di)
52 SSE_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine
53 reload_in_reg: (subreg:DF (reg/v:DI 5 di [orig:59 in ] [59]) 0)
54 reload_reg_rtx: (reg:DF 22 xmm1)
55...
56
57(note:HI 4 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
58
59(note:HI 3 4 22 2 NOTE_INSN_FUNCTION_BEG)
60
61(insn 22 3 23 2 c.c:3 (set (mem/c:DF (plus:DI (reg/f:DI 7 sp)
62 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])
63 (reg:DF 5 di)) 102 {*movdf_integer_rex64} (nil))
64
65(insn 23 22 6 2 c.c:3 (set (reg:DF 22 xmm1)
66 (mem/c:DF (plus:DI (reg/f:DI 7 sp)
67 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])) 102 {*movdf_integer_rex64} (nil))
68
69(insn:HI 6 23 16 2 c.c:3 (set (reg:DF 21 xmm0 [orig:58 <result> ] [58])
70 (reg:DF 22 xmm1)) 102 {*movdf_integer_rex64} (nil))
71
72(insn 16 6 21 2 c.c:7 (use (reg/i:DF 21 xmm0 [ <result> ])) -1 (nil))
73
74This patch tries to use the destination register when reloading for input. It
75generates
76
77Reloads for insn # 6
78Reload 0: reload_in (DF) = (reg:DF 5 di)
79 SSE_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine
80 reload_in_reg: (subreg:DF (reg/v:DI 5 di [orig:59 in ] [59]) 0)
81 reload_reg_rtx: (reg:DF 21 xmm0)
82...
83(note:HI 4 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
84
85(note:HI 3 4 22 2 NOTE_INSN_FUNCTION_BEG)
86
87(insn 22 3 23 2 c.c:3 (set (mem/c:DF (plus:DI (reg/f:DI 7 sp)
88 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])
89 (reg:DF 5 di)) 102 {*movdf_integer_rex64} (nil))
90
91(insn 23 22 6 2 c.c:3 (set (reg:DF 21 xmm0)
92 (mem/c:DF (plus:DI (reg/f:DI 7 sp)
93 (const_int -8 [0xfffffffffffffff8])) [0 S8 A8])) 102 {*movdf_integer_rex64} (nil))
94
95(insn:HI 6 23 10 2 c.c:3 (set (reg:DF 22 xmm1 [orig:58 <result> ] [58])
96 (reg:DF 21 xmm0)) 102 {*movdf_integer_rex64} (nil))
97
98(insn:HI 10 6 16 2 c.c:7 (set (reg/i:DF 21 xmm0 [ <result> ])
99 (reg:DF 22 xmm1 [orig:58 <result> ] [58])) 102 {*movdf_integer_rex64} (nil))
100
101(insn 16 10 21 2 c.c:7 (use (reg/i:DF 21 xmm0 [ <result> ])) -1 (nil))
102
103
104H.J.
105----
106gcc/
107
1082007-08-27 H.J. Lu <hongjiu.lu@intel.com>
109
110 PR target/30961
111 * reload1.c (find_reg): Favor the hard register in destination
112 if it is usable and a memory location is needed for reload
113 input.
114
115gcc/testsuite/
116
1172007-08-27 H.J. Lu <hongjiu.lu@intel.com>
118
119 PR target/30961
120 * gcc.target/i386/pr30961-1.c: New.
121
122--- gcc/reload1.c.second 2007-08-27 09:35:08.000000000 -0700
123+++ gcc/reload1.c 2007-08-27 09:36:33.000000000 -0700
124@@ -1781,6 +1781,20 @@ find_reg (struct insn_chain *chain, int
125 HARD_REG_SET not_usable;
126 HARD_REG_SET used_by_other_reload;
127 reg_set_iterator rsi;
128+#ifdef SECONDARY_MEMORY_NEEDED
129+ rtx body = PATTERN (chain->insn);
130+ unsigned int dest_reg = FIRST_PSEUDO_REGISTER;
131+
132+ if (GET_CODE (body) == SET)
133+ {
134+ rtx dest = SET_DEST (body);
135+
136+ if ((REG_P (dest)
137+ || (GET_CODE (dest) == SUBREG
138+ && REG_P (SUBREG_REG (dest)))))
139+ dest_reg = reg_or_subregno (dest);
140+ }
141+#endif
142
143 COPY_HARD_REG_SET (not_usable, bad_spill_regs);
144 IOR_HARD_REG_SET (not_usable, bad_spill_regs_global);
145@@ -1821,6 +1835,18 @@ find_reg (struct insn_chain *chain, int
146 this_cost--;
147 if (rl->out && REG_P (rl->out) && REGNO (rl->out) == regno)
148 this_cost--;
149+#ifdef SECONDARY_MEMORY_NEEDED
150+ /* If a memory location is needed for rl->in and dest_reg
151+ is usable, we will favor it. */
152+ else if (dest_reg == regno
153+ && rl->in
154+ && REG_P (rl->in)
155+ && REGNO (rl->in) < FIRST_PSEUDO_REGISTER
156+ && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (rl->in)),
157+ rl->class,
158+ rl->mode))
159+ this_cost = 0;
160+#endif
161 if (this_cost < best_cost
162 /* Among registers with equal cost, prefer caller-saved ones, or
163 use REG_ALLOC_ORDER if it is defined. */
164--- gcc/testsuite/gcc.target/i386/pr30961-1.c.second 2007-08-27 11:01:59.000000000 -0700
165+++ gcc/testsuite/gcc.target/i386/pr30961-1.c 2007-08-27 11:02:51.000000000 -0700
166@@ -0,0 +1,13 @@
167+/* { dg-do compile } */
168+/* { dg-require-effective-target lp64 } */
169+/* { dg-options "-O2" } */
170+
171+double
172+convert (long long in)
173+{
174+ double f;
175+ __builtin_memcpy( &f, &in, sizeof( in ) );
176+ return f;
177+}
178+
179+/* { dg-final { scan-assembler-not "movapd" } } */