add preliminary support for the latest CodeSourcery toolchain
[openwrt/openwrt.git] / toolchain / gcc / patches / 4.4.1+cs / 000-codesourcery_2009q3_68.patch
1 diff -Nur a/config/mh-mingw b/config/mh-mingw
2 --- a/config/mh-mingw 2008-11-21 14:54:41.000000000 +0100
3 +++ b/config/mh-mingw 2010-01-25 09:50:28.945687353 +0100
4 @@ -1,6 +1,8 @@
5 # Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows
6 # Vista (see PR33281 for details).
7 -BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
8 -CFLAGS += -D__USE_MINGW_ACCESS
9 +# Because we wrap access in libiberty/cygpath.c, we do not want to use
10 +# the MinGW wrappers for access.
11 +BOOT_CFLAGS += -Wno-pedantic-ms-format
12 +# CFLAGS += -D__USE_MINGW_ACCESS
13 # Increase stack limit to same as Linux default.
14 LDFLAGS += -Wl,--stack,8388608
15 diff -Nur a/config/stdint.m4 b/config/stdint.m4
16 --- a/config/stdint.m4 2007-04-12 15:06:43.000000000 +0200
17 +++ b/config/stdint.m4 2010-01-25 09:50:28.945687353 +0100
18 @@ -115,19 +115,19 @@
19
20 # Lacking an uintptr_t? Test size of void *
21 case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
22 - stddef.h:* | *:no) AC_CHECK_SIZEOF(void *) ;;
23 + stddef.h:* | *:no) AC_CHECK_SIZEOF(void *,,/* no standard headers */) ;;
24 esac
25
26 # Lacking an uint64_t? Test size of long
27 case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
28 - stddef.h:*:* | *:no:no) AC_CHECK_SIZEOF(long) ;;
29 + stddef.h:*:* | *:no:no) AC_CHECK_SIZEOF(long,,/* no standard headers */) ;;
30 esac
31
32 if test $acx_cv_header_stdint = stddef.h; then
33 # Lacking a good header? Test size of everything and deduce all types.
34 - AC_CHECK_SIZEOF(int)
35 - AC_CHECK_SIZEOF(short)
36 - AC_CHECK_SIZEOF(char)
37 + AC_CHECK_SIZEOF(int,,/* no standard headers */)
38 + AC_CHECK_SIZEOF(short,,/* no standard headers */)
39 + AC_CHECK_SIZEOF(char,,/* no standard headers */)
40
41 AC_MSG_CHECKING(for type equivalent to int8_t)
42 case "$ac_cv_sizeof_char" in
43 diff -Nur a/config/tls.m4 b/config/tls.m4
44 --- a/config/tls.m4 2009-01-23 05:58:03.000000000 +0100
45 +++ b/config/tls.m4 2010-01-25 09:50:28.945687353 +0100
46 @@ -1,5 +1,6 @@
47 dnl Check whether the target supports TLS.
48 AC_DEFUN([GCC_CHECK_TLS], [
49 + AC_REQUIRE([AC_CANONICAL_HOST])
50 GCC_ENABLE(tls, yes, [], [Use thread-local storage])
51 AC_CACHE_CHECK([whether the target supports thread-local storage],
52 gcc_cv_have_tls, [
53 @@ -66,7 +67,24 @@
54 [dnl This is the cross-compiling case. Assume libc supports TLS if the
55 dnl binutils and the compiler do.
56 AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }],
57 - [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no])
58 + [chktls_save_LDFLAGS="$LDFLAGS"
59 + dnl Shared library options may depend on the host; this check
60 + dnl is only known to be needed for GNU/Linux.
61 + case $host in
62 + *-*-linux*)
63 + LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS"
64 + ;;
65 + esac
66 + chktls_save_CFLAGS="$CFLAGS"
67 + CFLAGS="-fPIC $CFLAGS"
68 + dnl If -shared works, test if TLS works in a shared library.
69 + AC_LINK_IFELSE([int f() { return 0; }],
70 + [AC_LINK_IFELSE([__thread int a; int b; int f() { return a = b; }],
71 + [gcc_cv_have_tls=yes],
72 + [gcc_cv_have_tls=no])],
73 + [gcc_cv_have_tls=yes])
74 + CFLAGS="$chktls_save_CFLAGS"
75 + LDFLAGS="$chktls_save_LDFLAGS"], [gcc_cv_have_tls=no])
76 ]
77 )])
78 if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then
79 diff -Nur a/configure b/configure
80 --- a/configure 2009-04-25 06:10:29.000000000 +0200
81 +++ b/configure 2010-01-25 09:50:28.945687353 +0100
82 @@ -2277,7 +2277,7 @@
83 noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
84 ;;
85 *-*-vxworks*)
86 - noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
87 + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj}"
88 ;;
89 alpha*-dec-osf*)
90 # ld works, but does not support shared libraries.
91 diff -Nur a/configure.ac b/configure.ac
92 --- a/configure.ac 2009-04-25 06:10:29.000000000 +0200
93 +++ b/configure.ac 2010-01-25 09:50:28.945687353 +0100
94 @@ -512,7 +512,7 @@
95 noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
96 ;;
97 *-*-vxworks*)
98 - noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
99 + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj}"
100 ;;
101 alpha*-dec-osf*)
102 # ld works, but does not support shared libraries.
103 diff -Nur a/fixincludes/fixincl.tpl b/fixincludes/fixincl.tpl
104 --- a/fixincludes/fixincl.tpl 2008-09-06 21:57:26.000000000 +0200
105 +++ b/fixincludes/fixincl.tpl 2010-01-25 09:50:28.945687353 +0100
106 @@ -38,7 +38,7 @@
107 #ifndef SED_PROGRAM
108 #define SED_PROGRAM "/usr/bin/sed"
109 #endif
110 -static char const sed_cmd_z[] = SED_PROGRAM;
111 +static char const sed_cmd_z[] = "sed";
112 [=
113
114 FOR fix =]
115 diff -Nur a/fixincludes/fixincl.x b/fixincludes/fixincl.x
116 --- a/fixincludes/fixincl.x 2009-02-28 19:13:31.000000000 +0100
117 +++ b/fixincludes/fixincl.x 2010-01-25 09:50:28.945687353 +0100
118 @@ -2,11 +2,11 @@
119 *
120 * DO NOT EDIT THIS FILE (fixincl.x)
121 *
122 - * It has been AutoGen-ed Saturday February 28, 2009 at 10:11:41 AM PST
123 + * It has been AutoGen-ed Monday July 20, 2009 at 01:53:53 PM PDT
124 * From the definitions inclhack.def
125 * and the template file fixincl
126 */
127 -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Feb 28 10:11:41 PST 2009
128 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Jul 20 13:53:53 PDT 2009
129 *
130 * You must regenerate it. Use the ./genfixes script.
131 *
132 @@ -15,7 +15,7 @@
133 * certain ANSI-incompatible system header files which are fixed to work
134 * correctly with ANSI C and placed in a directory that GNU C will search.
135 *
136 - * This file contains 180 fixup descriptions.
137 + * This file contains 181 fixup descriptions.
138 *
139 * See README for more information.
140 *
141 @@ -39,7 +39,7 @@
142 #ifndef SED_PROGRAM
143 #define SED_PROGRAM "/usr/bin/sed"
144 #endif
145 -static char const sed_cmd_z[] = SED_PROGRAM;
146 +static char const sed_cmd_z[] = "sed";
147
148 /* * * * * * * * * * * * * * * * * * * * * * * * * *
149 *
150 @@ -2300,6 +2300,42 @@
151
152 /* * * * * * * * * * * * * * * * * * * * * * * * * *
153 *
154 + * Description of Glibc_String2_Memset fix
155 + */
156 +tSCC zGlibc_String2_MemsetName[] =
157 + "glibc_string2_memset";
158 +
159 +/*
160 + * File name selection pattern
161 + */
162 +tSCC zGlibc_String2_MemsetList[] =
163 + "bits/string2.h\0";
164 +/*
165 + * Machine/OS name selection pattern
166 + */
167 +#define apzGlibc_String2_MemsetMachs (const char**)NULL
168 +
169 +/*
170 + * content selection pattern - do fix if pattern found
171 + */
172 +tSCC zGlibc_String2_MemsetSelect0[] =
173 + "#ifndef _HAVE_STRING_ARCH_memset\n\
174 +# if _STRING_ARCH_unaligned";
175 +
176 +#define GLIBC_STRING2_MEMSET_TEST_CT 1
177 +static tTestDesc aGlibc_String2_MemsetTests[] = {
178 + { TT_EGREP, zGlibc_String2_MemsetSelect0, (regex_t*)NULL }, };
179 +
180 +/*
181 + * Fix Command Arguments for Glibc_String2_Memset
182 + */
183 +static const char* apzGlibc_String2_MemsetPatch[] = {
184 + "format",
185 + "%0 && 0",
186 + (char*)NULL };
187 +
188 +/* * * * * * * * * * * * * * * * * * * * * * * * * *
189 + *
190 * Description of Gnu_Types fix
191 */
192 tSCC zGnu_TypesName[] =
193 @@ -5617,8 +5653,7 @@
194 * Machine/OS name selection pattern
195 */
196 tSCC* apzSolaris_Mutex_Init_2Machs[] = {
197 - "*-*-solaris2.[0-9]",
198 - "*-*-solaris2.[0-9][!0-9]*",
199 + "*-*-solaris*",
200 (const char*)NULL };
201
202 /*
203 @@ -5627,8 +5662,15 @@
204 tSCC zSolaris_Mutex_Init_2Select0[] =
205 "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
206
207 -#define SOLARIS_MUTEX_INIT_2_TEST_CT 1
208 +/*
209 + * perform the 'test' shell command - do fix on success
210 + */
211 +tSCC zSolaris_Mutex_Init_2Test0[] =
212 + " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
213 +
214 +#define SOLARIS_MUTEX_INIT_2_TEST_CT 2
215 static tTestDesc aSolaris_Mutex_Init_2Tests[] = {
216 + { TT_TEST, zSolaris_Mutex_Init_2Test0, 0 /* unused */ },
217 { TT_EGREP, zSolaris_Mutex_Init_2Select0, (regex_t*)NULL }, };
218
219 /*
220 @@ -5670,8 +5712,15 @@
221 tSCC zSolaris_Rwlock_Init_1Select0[] =
222 "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
223
224 -#define SOLARIS_RWLOCK_INIT_1_TEST_CT 1
225 +/*
226 + * perform the 'test' shell command - do fix on success
227 + */
228 +tSCC zSolaris_Rwlock_Init_1Test0[] =
229 + " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
230 +
231 +#define SOLARIS_RWLOCK_INIT_1_TEST_CT 2
232 static tTestDesc aSolaris_Rwlock_Init_1Tests[] = {
233 + { TT_TEST, zSolaris_Rwlock_Init_1Test0, 0 /* unused */ },
234 { TT_EGREP, zSolaris_Rwlock_Init_1Select0, (regex_t*)NULL }, };
235
236 /*
237 @@ -5741,8 +5790,7 @@
238 * Machine/OS name selection pattern
239 */
240 tSCC* apzSolaris_Once_Init_2Machs[] = {
241 - "*-*-solaris2.[0-9]",
242 - "*-*-solaris2.[0-9][!0-9]*",
243 + "*-*-solaris*",
244 (const char*)NULL };
245
246 /*
247 @@ -5751,8 +5799,15 @@
248 tSCC zSolaris_Once_Init_2Select0[] =
249 "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
250
251 -#define SOLARIS_ONCE_INIT_2_TEST_CT 1
252 +/*
253 + * perform the 'test' shell command - do fix on success
254 + */
255 +tSCC zSolaris_Once_Init_2Test0[] =
256 + " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
257 +
258 +#define SOLARIS_ONCE_INIT_2_TEST_CT 2
259 static tTestDesc aSolaris_Once_Init_2Tests[] = {
260 + { TT_TEST, zSolaris_Once_Init_2Test0, 0 /* unused */ },
261 { TT_EGREP, zSolaris_Once_Init_2Select0, (regex_t*)NULL }, };
262
263 /*
264 @@ -7308,9 +7363,9 @@
265 *
266 * List of all fixes
267 */
268 -#define REGEX_COUNT 226
269 -#define MACH_LIST_SIZE_LIMIT 181
270 -#define FIX_COUNT 180
271 +#define REGEX_COUNT 227
272 +#define MACH_LIST_SIZE_LIMIT 169
273 +#define FIX_COUNT 181
274
275 /*
276 * Enumerate the fixes
277 @@ -7371,6 +7426,7 @@
278 GLIBC_C99_INLINE_3_FIXIDX,
279 GLIBC_C99_INLINE_4_FIXIDX,
280 GLIBC_MUTEX_INIT_FIXIDX,
281 + GLIBC_STRING2_MEMSET_FIXIDX,
282 GNU_TYPES_FIXIDX,
283 HP_INLINE_FIXIDX,
284 HP_SYSFILE_FIXIDX,
285 @@ -7774,6 +7830,11 @@
286 GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
287 aGlibc_Mutex_InitTests, apzGlibc_Mutex_InitPatch, 0 },
288
289 + { zGlibc_String2_MemsetName, zGlibc_String2_MemsetList,
290 + apzGlibc_String2_MemsetMachs,
291 + GLIBC_STRING2_MEMSET_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
292 + aGlibc_String2_MemsetTests, apzGlibc_String2_MemsetPatch, 0 },
293 +
294 { zGnu_TypesName, zGnu_TypesList,
295 apzGnu_TypesMachs,
296 GNU_TYPES_TEST_CT, FD_MACH_IFNOT | FD_SUBROUTINE,
297 diff -Nur a/fixincludes/inclhack.def b/fixincludes/inclhack.def
298 --- a/fixincludes/inclhack.def 2009-02-28 19:13:31.000000000 +0100
299 +++ b/fixincludes/inclhack.def 2010-01-25 09:50:28.955687088 +0100
300 @@ -1302,6 +1302,21 @@
301 };
302
303
304 +/* glibc's bits/string2.h (before 2004-05-26) generates bogus
305 + -Wstrict-aliasing warnings from calls to memset. */
306 +fix = {
307 + hackname = glibc_string2_memset;
308 + files = "bits/string2.h";
309 + select = "#ifndef _HAVE_STRING_ARCH_memset\n# if _STRING_ARCH_unaligned";
310 + c_fix = format;
311 + c_fix_arg = "%0 && 0";
312 + test_text = "#ifndef _HAVE_STRING_ARCH_memset\n"
313 + "# if _STRING_ARCH_unaligned\n"
314 + "# endif\n"
315 + "#endif\n";
316 +};
317 +
318 +
319 /*
320 * Fix these files to use the types we think they should for
321 * ptrdiff_t, size_t, and wchar_t.
322 @@ -2939,24 +2954,32 @@
323 };
324
325 /*
326 - * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
327 - * "0" for the last field of the pthread_mutex_t structure, which is
328 - * of type upad64_t, which itself is typedef'd to int64_t, but with
329 - * __STDC__ defined (e.g. by -ansi) it is a union. So change the
330 - * initializer to "{0}" instead
331 + * Sun Solaris defines the last field of the pthread_mutex_t structure
332 + * to have type upad64_t. Whether upad64_t is an integer type or a
333 + * union depends on whether or not the headers believe that a 64-bit
334 + * integer type is available. But, PTHREAD_MUTEX_INITIALIZER is not
335 + * appropriately conditionalized; it always uses "0", and never "{0}".
336 + * In order to avoid warnings/errors from the compiler, we must make
337 + * the initializer use braces where appropriate.
338 + *
339 + * Prior to Solaris 10, if __STDC__ is 1 (as when compiling with
340 + * -ansi), the definition would be a union. Beginning with Solaris
341 + * 10, the headers check for __GNUC__, and will never use a union with
342 + * GCC. We check /usr/include/sys/types.h to see if it checks for
343 + * __STDC__.
344 + *
345 + * A "mach" test for Solaris 10 is undesirable because we want to
346 + * allow a compiler built for Solaris <10 to be used on Solaris >=10,
347 + * but the installed version of fixincludes hard-wires the target
348 + * machine to the configure-time $target, rather than automatically
349 + * determining it at installation time.
350 */
351 fix = {
352 hackname = solaris_mutex_init_2;
353 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
354 files = pthread.h;
355 - /*
356 - * On Solaris 10, this fix is unnecessary because upad64_t is
357 - * always defined correctly regardless of the definition of the
358 - * __STDC__ macro. The first "mach" pattern matches up to
359 - * solaris9. The second "mach" pattern will not match any two (or
360 - * more) digit solaris version, but it will match e.g. 2.5.1.
361 - */
362 - mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
363 + mach = '*-*-solaris*';
364 + test = " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
365 c_fix = format;
366 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
367 "%0\n"
368 @@ -2967,6 +2990,7 @@
369 "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
370 ",[ \t]*0\\}" "(|[ \t].*)$";
371 test_text =
372 + "`mkdir -p sys; echo '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' >> sys/types.h`"
373 '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
374 "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
375 "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
376 @@ -2978,17 +3002,14 @@
377
378
379 /*
380 - * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
381 - * fields of the pthread_rwlock_t structure, which are of type
382 - * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
383 - * defined (e.g. by -ansi) it is a union. So change the initializer
384 - * to "{0}" instead.
385 + * See comments for solaris_mutex_init_2 re. upad64_t.
386 */
387 fix = {
388 hackname = solaris_rwlock_init_1;
389 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
390 files = pthread.h;
391 mach = '*-*-solaris*';
392 + test = " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
393 c_fix = format;
394 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
395 "%0\n"
396 @@ -3024,24 +3045,14 @@
397
398
399 /*
400 - * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
401 - * fields of the pthread_once_t structure, which are of type
402 - * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
403 - * defined (e.g. by -ansi) it is a union. So change the initializer
404 - * to "{0}" instead. This test relies on solaris_once_init_1.
405 + * See comments for solaris_mutex_init_2 re. upad64_t.
406 */
407 fix = {
408 hackname = solaris_once_init_2;
409 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
410 files = pthread.h;
411 - /*
412 - * On Solaris 10, this fix is unnecessary because upad64_t is
413 - * always defined correctly regardless of the definition of the
414 - * __STDC__ macro. The first "mach" pattern matches up to
415 - * solaris9. The second "mach" pattern will not match any two (or
416 - * more) digit solaris version, but it will match e.g. 2.5.1.
417 - */
418 - mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
419 + mach = '*-*-solaris*';
420 + test = " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
421 c_fix = format;
422 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
423 "%0\n"
424 diff -Nur a/fixincludes/server.c b/fixincludes/server.c
425 --- a/fixincludes/server.c 2005-08-15 02:50:43.000000000 +0200
426 +++ b/fixincludes/server.c 2010-01-25 09:50:28.955687088 +0100
427 @@ -266,7 +266,7 @@
428 /* Make sure the process will pay attention to us, send the
429 supplied command, and then have it output a special marker that
430 we can find. */
431 - fprintf (server_pair.pf_write, "cd %s\n%s\n\necho\necho %s\n",
432 + fprintf (server_pair.pf_write, "cd '%s'\n%s\n\necho\necho %s\n",
433 p_cur_dir, pz_cmd, z_done);
434 fflush (server_pair.pf_write);
435
436 diff -Nur a/fixincludes/tests/base/bits/string2.h b/fixincludes/tests/base/bits/string2.h
437 --- a/fixincludes/tests/base/bits/string2.h 2007-03-26 15:25:26.000000000 +0200
438 +++ b/fixincludes/tests/base/bits/string2.h 2010-01-25 09:50:28.955687088 +0100
439 @@ -16,3 +16,12 @@
440 # define __STRING_INLINE extern __inline
441 # endif
442 #endif /* GLIBC_C99_INLINE_3_CHECK */
443 +
444 +
445 +#if defined( GLIBC_STRING2_MEMSET_CHECK )
446 +#ifndef _HAVE_STRING_ARCH_memset
447 +# if _STRING_ARCH_unaligned && 0
448 +# endif
449 +#endif
450 +
451 +#endif /* GLIBC_STRING2_MEMSET_CHECK */
452 diff -Nur a/fixincludes/tests/base/sys/types.h b/fixincludes/tests/base/sys/types.h
453 --- a/fixincludes/tests/base/sys/types.h 2004-08-31 11:27:00.000000000 +0200
454 +++ b/fixincludes/tests/base/sys/types.h 2010-01-25 09:50:28.955687088 +0100
455 @@ -28,3 +28,4 @@
456
457 #endif /* ushort_t */
458 #endif /* GNU_TYPES_CHECK */
459 +#if !defined(__STRICT_ANSI__) && !defined(_NO_LONGLONG)
460 diff -Nur a/gcc/acinclude.m4 b/gcc/acinclude.m4
461 --- a/gcc/acinclude.m4 2008-06-02 21:37:45.000000000 +0200
462 +++ b/gcc/acinclude.m4 2010-01-25 09:50:28.955687088 +0100
463 @@ -482,3 +482,53 @@
464 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
465 ac_executable_extensions="$build_exeext"])
466
467 +
468 +# --with-license=PATH
469 +AC_DEFUN([CSL_AC_LICENSE],[
470 + AC_ARG_WITH(license,
471 + AC_HELP_STRING([--with-license],
472 + [the path to the installed license component]),
473 + [case "$withval" in
474 + (yes) AC_MSG_ERROR([license not specified]) ;;
475 + (no) with_license= ;;
476 + (*) ;;
477 + esac],
478 + [with_license=])
479 + AC_SUBST(licensedir, $with_license)
480 +])
481 +
482 +# --with-csl-license-feature=FOO
483 +AC_DEFUN([CSL_AC_LICENSE_FEATURE],[
484 + AC_ARG_WITH(csl-license-feature,
485 + AC_HELP_STRING([--with-csl-license-feature=FEATURE],
486 + [Use FEATURE to communicate with the license manager]),
487 + [case "$withval" in
488 + (yes) AC_MSG_ERROR([license feature not specified]) ;;
489 + (no) CSL_LICENSE_FEATURE="" ;;
490 + (*) CSL_LICENSE_FEATURE="$withval" ;;
491 + esac],
492 + CSL_LICENSE_FEATURE=""
493 + )
494 + if test x"$CSL_LICENSE_FEATURE" != x; then
495 + AC_DEFINE_UNQUOTED(CSL_LICENSE_FEATURE, "$CSL_LICENSE_FEATURE",
496 + [Required license feature])
497 + fi
498 +])
499 +
500 +# --with-csl-license-version=VERSION
501 +AC_DEFUN([CSL_AC_LICENSE_VERSION],[
502 + AC_ARG_WITH(csl-license-version,
503 + AC_HELP_STRING([--with-csl-license-version=VERSION],
504 + [Use VERSION to communicate with the license manager]),
505 + [case "$withval" in
506 + (yes) AC_MSG_ERROR([license version not specified]) ;;
507 + (no) CSL_LICENSE_VERSION="" ;;
508 + (*) CSL_LICENSE_VERSION="$withval" ;;
509 + esac],
510 + CSL_LICENSE_VERSION=""
511 + )
512 + if test x"$CSL_LICENSE_VERSION" != x; then
513 + AC_DEFINE_UNQUOTED(CSL_LICENSE_VERSION, "$CSL_LICENSE_VERSION",
514 + [Required license version])
515 + fi
516 +])
517 diff -Nur a/gcc/addresses.h b/gcc/addresses.h
518 --- a/gcc/addresses.h 2007-07-26 10:37:01.000000000 +0200
519 +++ b/gcc/addresses.h 2010-01-25 09:50:28.955687088 +0100
520 @@ -78,3 +78,42 @@
521
522 return ok_for_base_p_1 (regno, mode, outer_code, index_code);
523 }
524 +
525 +/* Wrapper function to unify target macros MODE_INDEX_REG_CLASS and
526 + INDEX_REG_CLASS. Arguments as for the MODE_INDEX_REG_CLASS macro. */
527 +
528 +static inline enum reg_class
529 +index_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED)
530 +{
531 +#ifdef MODE_INDEX_REG_CLASS
532 + return MODE_INDEX_REG_CLASS (mode);
533 +#else
534 + return INDEX_REG_CLASS;
535 +#endif
536 +}
537 +
538 +/* Wrapper function to unify target macros REGNO_MODE_OK_FOR_INDEX_P
539 + and REGNO_OK_FOR_INDEX_P. Arguments as for the
540 + REGNO_MODE_OK_FOR_INDEX_P macro. */
541 +
542 +static inline bool
543 +ok_for_index_p_1 (unsigned regno, enum machine_mode mode ATTRIBUTE_UNUSED)
544 +{
545 +#ifdef REGNO_MODE_OK_FOR_INDEX_P
546 + return REGNO_MODE_OK_FOR_INDEX_P (regno, mode);
547 +#else
548 + return REGNO_OK_FOR_INDEX_P (regno);
549 +#endif
550 +}
551 +
552 +/* Wrapper around ok_for_index_p_1, for use after register allocation is
553 + complete. Arguments as for the called function. */
554 +
555 +static inline bool
556 +regno_ok_for_index_p (unsigned regno, enum machine_mode mode)
557 +{
558 + if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0)
559 + regno = reg_renumber[regno];
560 +
561 + return ok_for_index_p_1 (regno, mode);
562 +}
563 diff -Nur a/gcc/calls.c b/gcc/calls.c
564 --- a/gcc/calls.c 2009-02-20 12:19:34.000000000 +0100
565 +++ b/gcc/calls.c 2010-01-25 09:50:28.955687088 +0100
566 @@ -3803,7 +3803,7 @@
567 cse'ing of library calls could delete a call and leave the pop. */
568 NO_DEFER_POP;
569 valreg = (mem_value == 0 && outmode != VOIDmode
570 - ? hard_libcall_value (outmode) : NULL_RTX);
571 + ? hard_libcall_value (outmode, orgfun) : NULL_RTX);
572
573 /* Stack must be properly aligned now. */
574 gcc_assert (!(stack_pointer_delta
575 @@ -4048,8 +4048,17 @@
576 /* We need to make a save area. */
577 unsigned int size = arg->locate.size.constant * BITS_PER_UNIT;
578 enum machine_mode save_mode = mode_for_size (size, MODE_INT, 1);
579 - rtx adr = memory_address (save_mode, XEXP (arg->stack_slot, 0));
580 - rtx stack_area = gen_rtx_MEM (save_mode, adr);
581 + rtx adr;
582 + rtx stack_area;
583 +
584 + /* We can only use save_mode if the arg is sufficiently
585 + aligned. */
586 + if (STRICT_ALIGNMENT
587 + && GET_MODE_ALIGNMENT (save_mode) > arg->locate.boundary)
588 + save_mode = BLKmode;
589 +
590 + adr = memory_address (save_mode, XEXP (arg->stack_slot, 0));
591 + stack_area = gen_rtx_MEM (save_mode, adr);
592
593 if (save_mode == BLKmode)
594 {
595 diff -Nur a/gcc/c-common.c b/gcc/c-common.c
596 --- a/gcc/c-common.c 2009-03-30 19:42:27.000000000 +0200
597 +++ b/gcc/c-common.c 2010-01-25 09:50:28.955687088 +0100
598 @@ -33,7 +33,6 @@
599 #include "varray.h"
600 #include "expr.h"
601 #include "c-common.h"
602 -#include "diagnostic.h"
603 #include "tm_p.h"
604 #include "obstack.h"
605 #include "cpplib.h"
606 @@ -42,6 +41,7 @@
607 #include "tree-inline.h"
608 #include "c-tree.h"
609 #include "toplev.h"
610 +#include "diagnostic.h"
611 #include "tree-iterator.h"
612 #include "hashtab.h"
613 #include "tree-mudflap.h"
614 @@ -497,6 +497,10 @@
615 This is a count, since unevaluated expressions can nest. */
616 int skip_evaluation;
617
618 +/* Whether lexing has been completed, so subsequent preprocessor
619 + errors should use the compiler's input_location. */
620 +bool done_lexing = false;
621 +
622 /* Information about how a function name is generated. */
623 struct fname_var_t
624 {
625 @@ -7522,6 +7526,68 @@
626 #undef catenate_messages
627 }
628
629 +/* Callback from cpp_error for PFILE to print diagnostics from the
630 + preprocessor. The diagnostic is of type LEVEL, at location
631 + LOCATION unless this is after lexing and the compiler's location
632 + should be used instead, with column number possibly overridden by
633 + COLUMN_OVERRIDE if not zero; MSG is the translated message and AP
634 + the arguments. Returns true if a diagnostic was emitted, false
635 + otherwise. */
636 +
637 +bool
638 +c_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
639 + location_t location, unsigned int column_override,
640 + const char *msg, va_list *ap)
641 +{
642 + diagnostic_info diagnostic;
643 + diagnostic_t dlevel;
644 + int save_warn_system_headers = warn_system_headers;
645 + bool ret;
646 +
647 + switch (level)
648 + {
649 + case CPP_DL_WARNING_SYSHDR:
650 + if (flag_no_output)
651 + return false;
652 + warn_system_headers = 1;
653 + /* Fall through. */
654 + case CPP_DL_WARNING:
655 + if (flag_no_output)
656 + return false;
657 + dlevel = DK_WARNING;
658 + break;
659 + case CPP_DL_PEDWARN:
660 + if (flag_no_output && !flag_pedantic_errors)
661 + return false;
662 + dlevel = DK_PEDWARN;
663 + break;
664 + case CPP_DL_ERROR:
665 + dlevel = DK_ERROR;
666 + break;
667 + case CPP_DL_ICE:
668 + dlevel = DK_ICE;
669 + break;
670 + case CPP_DL_NOTE:
671 + dlevel = DK_NOTE;
672 + break;
673 + case CPP_DL_FATAL:
674 + dlevel = DK_FATAL;
675 + break;
676 + default:
677 + gcc_unreachable ();
678 + }
679 + if (done_lexing)
680 + location = input_location;
681 + diagnostic_set_info_translated (&diagnostic, msg, ap,
682 + location, dlevel);
683 + if (column_override)
684 + diagnostic_override_column (&diagnostic, column_override);
685 + ret = report_diagnostic (&diagnostic);
686 + if (level == CPP_DL_WARNING_SYSHDR)
687 + warn_system_headers = save_warn_system_headers;
688 + return ret;
689 +}
690 +
691 /* Walk a gimplified function and warn for functions whose return value is
692 ignored and attribute((warn_unused_result)) is set. This is done before
693 inlining, so we don't have to worry about that. */
694 diff -Nur a/gcc/c-common.h b/gcc/c-common.h
695 --- a/gcc/c-common.h 2009-03-30 19:42:27.000000000 +0200
696 +++ b/gcc/c-common.h 2010-01-25 09:50:28.955687088 +0100
697 @@ -658,6 +658,11 @@
698
699 extern int skip_evaluation;
700
701 +/* Whether lexing has been completed, so subsequent preprocessor
702 + errors should use the compiler's input_location. */
703 +
704 +extern bool done_lexing;
705 +
706 /* C types are partitioned into three subsets: object, function, and
707 incomplete types. */
708 #define C_TYPE_OBJECT_P(type) \
709 diff -Nur a/gcc/c-convert.c b/gcc/c-convert.c
710 --- a/gcc/c-convert.c 2009-02-20 16:20:38.000000000 +0100
711 +++ b/gcc/c-convert.c 2010-01-25 09:50:28.955687088 +0100
712 @@ -70,6 +70,7 @@
713 tree e = expr;
714 enum tree_code code = TREE_CODE (type);
715 const char *invalid_conv_diag;
716 + tree ret;
717
718 if (type == error_mark_node
719 || expr == error_mark_node
720 @@ -85,6 +86,9 @@
721
722 if (type == TREE_TYPE (expr))
723 return expr;
724 + ret = targetm.convert_to_type (type, expr);
725 + if (ret)
726 + return ret;
727
728 if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
729 return fold_convert (type, expr);
730 diff -Nur a/gcc/c-decl.c b/gcc/c-decl.c
731 --- a/gcc/c-decl.c 2009-02-20 16:20:38.000000000 +0100
732 +++ b/gcc/c-decl.c 2010-01-25 09:50:28.955687088 +0100
733 @@ -3994,6 +3994,7 @@
734 bool bitfield = width != NULL;
735 tree element_type;
736 struct c_arg_info *arg_info = 0;
737 + const char *errmsg;
738
739 if (decl_context == FUNCDEF)
740 funcdef_flag = true, decl_context = NORMAL;
741 @@ -4531,6 +4532,12 @@
742 error ("%qs declared as function returning an array", name);
743 type = integer_type_node;
744 }
745 + errmsg = targetm.invalid_return_type (type);
746 + if (errmsg)
747 + {
748 + error (errmsg);
749 + type = integer_type_node;
750 + }
751
752 /* Construct the function type and go to the next
753 inner layer of declarator. */
754 @@ -5044,6 +5051,7 @@
755 {
756 tree parm, type, typelt;
757 unsigned int parmno;
758 + const char *errmsg;
759
760 /* If there is a parameter of incomplete type in a definition,
761 this is an error. In a declaration this is valid, and a
762 @@ -5087,6 +5095,14 @@
763 }
764 }
765
766 + errmsg = targetm.invalid_parameter_type (type);
767 + if (errmsg)
768 + {
769 + error (errmsg);
770 + TREE_VALUE (typelt) = error_mark_node;
771 + TREE_TYPE (parm) = error_mark_node;
772 + }
773 +
774 if (DECL_NAME (parm) && TREE_USED (parm))
775 warn_if_shadowing (parm);
776 }
777 @@ -8071,7 +8087,7 @@
778
779 /* Don't waste time on further processing if -fsyntax-only or we've
780 encountered errors. */
781 - if (flag_syntax_only || errorcount || sorrycount || cpp_errors (parse_in))
782 + if (flag_syntax_only || errorcount || sorrycount)
783 return;
784
785 /* Close the external scope. */
786 diff -Nur a/gcc/cfgexpand.c b/gcc/cfgexpand.c
787 --- a/gcc/cfgexpand.c 2009-07-11 21:06:26.000000000 +0200
788 +++ b/gcc/cfgexpand.c 2010-01-25 09:50:28.955687088 +0100
789 @@ -488,7 +488,8 @@
790 {
791 unsigned int align;
792
793 - align = LOCAL_DECL_ALIGNMENT (decl);
794 + align = alignment_for_aligned_arrays (TREE_TYPE (decl),
795 + LOCAL_DECL_ALIGNMENT (decl));
796
797 if (align > MAX_SUPPORTED_STACK_ALIGNMENT)
798 align = MAX_SUPPORTED_STACK_ALIGNMENT;
799 diff -Nur a/gcc/cgraph.c b/gcc/cgraph.c
800 --- a/gcc/cgraph.c 2008-11-16 23:31:58.000000000 +0100
801 +++ b/gcc/cgraph.c 2010-01-25 09:50:28.955687088 +0100
802 @@ -475,9 +475,11 @@
803 if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
804 {
805 node->origin = cgraph_node (DECL_CONTEXT (decl));
806 + node->origin->ever_was_nested = 1;
807 node->next_nested = node->origin->nested;
808 node->origin->nested = node;
809 node->master_clone = node;
810 + node->ever_was_nested = 1;
811 }
812 if (assembler_name_hash)
813 {
814 diff -Nur a/gcc/cgraph.h b/gcc/cgraph.h
815 --- a/gcc/cgraph.h 2009-03-23 17:29:33.000000000 +0100
816 +++ b/gcc/cgraph.h 2010-01-25 09:50:28.955687088 +0100
817 @@ -185,6 +185,8 @@
818 unsigned output : 1;
819 /* Set for aliases once they got through assemble_alias. */
820 unsigned alias : 1;
821 + /* Set if the function is a nested function or has nested functions. */
822 + unsigned ever_was_nested : 1;
823
824 /* In non-unit-at-a-time mode the function body of inline candidates is saved
825 into clone before compiling so the function in original form can be
826 diff -Nur a/gcc/common.opt b/gcc/common.opt
827 --- a/gcc/common.opt 2009-03-28 18:28:45.000000000 +0100
828 +++ b/gcc/common.opt 2010-01-25 09:50:28.955687088 +0100
829 @@ -153,6 +153,10 @@
830 Common Var(warn_padded) Warning
831 Warn when padding is required to align structure members
832
833 +Wpoison-system-directories
834 +Common Var(flag_poison_system_directories) Init(1)
835 +Warn for -I and -L options using system directories if cross compiling
836 +
837 Wshadow
838 Common Var(warn_shadow) Warning
839 Warn when one local variable shadows another
840 @@ -270,6 +274,12 @@
841 fabi-version=
842 Common Joined UInteger Var(flag_abi_version) Init(2)
843
844 +falign-arrays
845 +Target Report Var(flag_align_arrays)
846 +Set the minimum alignment for array variables to be the largest power
847 +of two less than or equal to their total storage size, or the biggest
848 +alignment used on the machine, whichever is smaller.
849 +
850 falign-functions
851 Common Report Var(align_functions,0) Optimization UInteger
852 Align the start of functions
853 @@ -467,6 +477,10 @@
854 Common Report Var(flag_early_inlining) Init(1) Optimization
855 Perform early inlining
856
857 +feglibc=
858 +Common Report Joined Undocumented
859 +EGLIBC configuration specifier, serves multilib purposes.
860 +
861 feliminate-dwarf2-dups
862 Common Report Var(flag_eliminate_dwarf2_dups)
863 Perform DWARF2 duplicate elimination
864 @@ -895,6 +909,10 @@
865 Common Report Var(flag_profile_values)
866 Insert code to profile values of expressions
867
868 +fpromote-loop-indices
869 +Common Report Var(flag_promote_loop_indices) Optimization
870 +Promote loop indices to word-sized indices when safe
871 +
872 frandom-seed
873 Common
874
875 @@ -1227,6 +1245,15 @@
876 Common Report Var(flag_tree_pre) Optimization
877 Enable SSA-PRE optimization on trees
878
879 +ftree-pre-partial-partial
880 +Common Report Var(flag_tree_pre_partial_partial) Optimization
881 +In SSA-PRE optimization on trees, enable partial-partial redundancy elimination.
882 +
883 +ftree-pre-partial-partial-obliviously
884 +Common Report Var(flag_tree_pre_partial_partial_obliviously) Optimization
885 +In SSA-PRE optimization on trees, enable partial-partial redundancy
886 +elimination without regard for the cost of the inserted phi nodes.
887 +
888 ftree-reassoc
889 Common Report Var(flag_tree_reassoc) Init(1) Optimization
890 Enable reassociation on tree level
891 diff -Nur a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
892 --- a/gcc/config/arm/arm.c 2009-06-02 09:18:16.000000000 +0200
893 +++ b/gcc/config/arm/arm.c 2010-01-25 09:50:28.975687047 +0100
894 @@ -43,6 +43,7 @@
895 #include "optabs.h"
896 #include "toplev.h"
897 #include "recog.h"
898 +#include "cgraph.h"
899 #include "ggc.h"
900 #include "except.h"
901 #include "c-pragma.h"
902 @@ -53,6 +54,8 @@
903 #include "debug.h"
904 #include "langhooks.h"
905 #include "df.h"
906 +#include "intl.h"
907 +#include "params.h"
908
909 /* Forward definitions of types. */
910 typedef struct minipool_node Mnode;
911 @@ -110,6 +113,7 @@
912 static unsigned long arm_isr_value (tree);
913 static unsigned long arm_compute_func_type (void);
914 static tree arm_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
915 +static tree arm_handle_pcs_attribute (tree *, tree, tree, int, bool *);
916 static tree arm_handle_isr_attribute (tree *, tree, tree, int, bool *);
917 #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
918 static tree arm_handle_notshared_attribute (tree *, tree, tree, int, bool *);
919 @@ -123,6 +127,10 @@
920 static int count_insns_for_constant (HOST_WIDE_INT, int);
921 static int arm_get_strip_length (int);
922 static bool arm_function_ok_for_sibcall (tree, tree);
923 +static bool arm_return_in_memory (const_tree, const_tree);
924 +static rtx arm_function_value (const_tree, const_tree, bool);
925 +static rtx arm_libcall_value (enum machine_mode, rtx);
926 +
927 static void arm_internal_label (FILE *, const char *, unsigned long);
928 static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
929 tree);
930 @@ -148,6 +156,9 @@
931 static rtx emit_set_insn (rtx, rtx);
932 static int arm_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
933 tree, bool);
934 +static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree,
935 + const_tree);
936 +static int aapcs_select_return_coproc (const_tree, const_tree);
937
938 #ifdef OBJECT_FORMAT_ELF
939 static void arm_elf_asm_constructor (rtx, int) ATTRIBUTE_UNUSED;
940 @@ -175,6 +186,7 @@
941 static bool arm_output_ttype (rtx);
942 #endif
943 static void arm_dwarf_handle_frame_unspec (const char *, rtx, int);
944 +static rtx arm_dwarf_register_span(rtx);
945
946 static tree arm_cxx_guard_type (void);
947 static bool arm_cxx_guard_mask_bit (void);
948 @@ -197,6 +209,15 @@
949 static int arm_issue_rate (void);
950 static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
951 static bool arm_allocate_stack_slots_for_args (void);
952 +static bool arm_warn_func_result (void);
953 +static int arm_multipass_dfa_lookahead (void);
954 +static const char *arm_invalid_parameter_type (const_tree t);
955 +static const char *arm_invalid_return_type (const_tree t);
956 +static tree arm_promoted_type (const_tree t);
957 +static tree arm_convert_to_type (tree type, tree expr);
958 +static bool arm_scalar_mode_supported_p (enum machine_mode);
959 +static int arm_vector_min_alignment (const_tree type);
960 +static bool arm_vector_always_misalign(const_tree);
961
962 \f
963 /* Initialize the GCC target structure. */
964 @@ -256,6 +277,12 @@
965 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
966 #define TARGET_FUNCTION_OK_FOR_SIBCALL arm_function_ok_for_sibcall
967
968 +#undef TARGET_FUNCTION_VALUE
969 +#define TARGET_FUNCTION_VALUE arm_function_value
970 +
971 +#undef TARGET_LIBCALL_VALUE
972 +#define TARGET_LIBCALL_VALUE arm_libcall_value
973 +
974 #undef TARGET_ASM_OUTPUT_MI_THUNK
975 #define TARGET_ASM_OUTPUT_MI_THUNK arm_output_mi_thunk
976 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
977 @@ -299,6 +326,9 @@
978 #undef TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
979 #define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS arm_allocate_stack_slots_for_args
980
981 +#undef TARGET_WARN_FUNC_RESULT
982 +#define TARGET_WARN_FUNC_RESULT arm_warn_func_result
983 +
984 #undef TARGET_DEFAULT_SHORT_ENUMS
985 #define TARGET_DEFAULT_SHORT_ENUMS arm_default_short_enums
986
987 @@ -353,6 +383,9 @@
988 #undef TARGET_ASM_TTYPE
989 #define TARGET_ASM_TTYPE arm_output_ttype
990
991 +#undef TARGET_CXX_TTYPE_REF_ENCODE
992 +#define TARGET_CXX_TTYPE_REF_ENCODE hook_cxx_ttype_ref_in_bit0
993 +
994 #undef TARGET_ARM_EABI_UNWINDER
995 #define TARGET_ARM_EABI_UNWINDER true
996 #endif /* TARGET_UNWIND_INFO */
997 @@ -360,6 +393,9 @@
998 #undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
999 #define TARGET_DWARF_HANDLE_FRAME_UNSPEC arm_dwarf_handle_frame_unspec
1000
1001 +#undef TARGET_DWARF_REGISTER_SPAN
1002 +#define TARGET_DWARF_REGISTER_SPAN arm_dwarf_register_span
1003 +
1004 #undef TARGET_CANNOT_COPY_INSN_P
1005 #define TARGET_CANNOT_COPY_INSN_P arm_cannot_copy_insn_p
1006
1007 @@ -398,6 +434,30 @@
1008 #define TARGET_ASM_OUTPUT_DWARF_DTPREL arm_output_dwarf_dtprel
1009 #endif
1010
1011 +#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
1012 +#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD arm_multipass_dfa_lookahead
1013 +
1014 +#undef TARGET_INVALID_PARAMETER_TYPE
1015 +#define TARGET_INVALID_PARAMETER_TYPE arm_invalid_parameter_type
1016 +
1017 +#undef TARGET_INVALID_RETURN_TYPE
1018 +#define TARGET_INVALID_RETURN_TYPE arm_invalid_return_type
1019 +
1020 +#undef TARGET_PROMOTED_TYPE
1021 +#define TARGET_PROMOTED_TYPE arm_promoted_type
1022 +
1023 +#undef TARGET_CONVERT_TO_TYPE
1024 +#define TARGET_CONVERT_TO_TYPE arm_convert_to_type
1025 +
1026 +#undef TARGET_SCALAR_MODE_SUPPORTED_P
1027 +#define TARGET_SCALAR_MODE_SUPPORTED_P arm_scalar_mode_supported_p
1028 +
1029 +#undef TARGET_VECTOR_MIN_ALIGNMENT
1030 +#define TARGET_VECTOR_MIN_ALIGNMENT arm_vector_min_alignment
1031 +
1032 +#undef TARGET_VECTOR_ALWAYS_MISALIGN
1033 +#define TARGET_VECTOR_ALWAYS_MISALIGN arm_vector_always_misalign
1034 +
1035 struct gcc_target targetm = TARGET_INITIALIZER;
1036 \f
1037 /* Obstack for minipool constant handling. */
1038 @@ -423,18 +483,18 @@
1039 /* The default processor used if not overridden by commandline. */
1040 static enum processor_type arm_default_cpu = arm_none;
1041
1042 -/* Which floating point model to use. */
1043 -enum arm_fp_model arm_fp_model;
1044 -
1045 -/* Which floating point hardware is available. */
1046 -enum fputype arm_fpu_arch;
1047 -
1048 /* Which floating point hardware to schedule for. */
1049 -enum fputype arm_fpu_tune;
1050 +int arm_fpu_attr;
1051 +
1052 +/* Which floating popint hardware to use. */
1053 +const struct arm_fpu_desc *arm_fpu_desc;
1054
1055 /* Whether to use floating point hardware. */
1056 enum float_abi_type arm_float_abi;
1057
1058 +/* Which __fp16 format to use. */
1059 +enum arm_fp16_format_type arm_fp16_format;
1060 +
1061 /* Which ABI to use. */
1062 enum arm_abi_type arm_abi;
1063
1064 @@ -473,9 +533,19 @@
1065 #define FL_DIV (1 << 18) /* Hardware divide. */
1066 #define FL_VFPV3 (1 << 19) /* Vector Floating Point V3. */
1067 #define FL_NEON (1 << 20) /* Neon instructions. */
1068 +#define FL_MARVELL_F (1 << 21) /* Marvell Feroceon. */
1069 +#define FL_ARCH7EM (1 << 22) /* Instructions present in ARMv7E-M. */
1070
1071 #define FL_IWMMXT (1 << 29) /* XScale v2 or "Intel Wireless MMX technology". */
1072
1073 +/* Some flags are ignored when comparing -mcpu and -march:
1074 + FL_MARVELL_F so that -mcpu=marvell-f -march=v5te works.
1075 + FL_LDSCHED and FL_WBUF only effect tuning,
1076 + FL_CO_PROC, FL_VFPV2, FL_VFPV3 and FL_NEON because FP
1077 + coprocessors are handled separately. */
1078 +#define FL_COMPAT (FL_MARVELL_F | FL_LDSCHED | FL_WBUF | FL_CO_PROC | \
1079 + FL_VFPV2 | FL_VFPV3 | FL_NEON)
1080 +
1081 #define FL_FOR_ARCH2 FL_NOTM
1082 #define FL_FOR_ARCH3 (FL_FOR_ARCH2 | FL_MODE32)
1083 #define FL_FOR_ARCH3M (FL_FOR_ARCH3 | FL_ARCH3M)
1084 @@ -497,6 +567,7 @@
1085 #define FL_FOR_ARCH7A (FL_FOR_ARCH7 | FL_NOTM)
1086 #define FL_FOR_ARCH7R (FL_FOR_ARCH7A | FL_DIV)
1087 #define FL_FOR_ARCH7M (FL_FOR_ARCH7 | FL_DIV)
1088 +#define FL_FOR_ARCH7EM (FL_FOR_ARCH7M | FL_ARCH7EM)
1089
1090 /* The bits in this mask specify which
1091 instructions we are allowed to generate. */
1092 @@ -533,6 +604,9 @@
1093 /* Nonzero if instructions not present in the 'M' profile can be used. */
1094 int arm_arch_notm = 0;
1095
1096 +/* Nonzero if instructions present in ARMv7E-M can be used. */
1097 +int arm_arch7em = 0;
1098 +
1099 /* Nonzero if this chip can benefit from load scheduling. */
1100 int arm_ld_sched = 0;
1101
1102 @@ -551,6 +625,9 @@
1103 /* Nonzero if tuning for XScale */
1104 int arm_tune_xscale = 0;
1105
1106 +/* Nonzero if tuning for Marvell Feroceon. */
1107 +int arm_tune_marvell_f = 0;
1108 +
1109 /* Nonzero if we want to tune for stores that access the write-buffer.
1110 This typically means an ARM6 or ARM7 with MMU or MPU. */
1111 int arm_tune_wbuf = 0;
1112 @@ -561,6 +638,9 @@
1113 /* Nonzero if generating Thumb instructions. */
1114 int thumb_code = 0;
1115
1116 +/* Nonzero if generating code for Janus2. */
1117 +int janus2_code = 0;
1118 +
1119 /* Nonzero if we should define __THUMB_INTERWORK__ in the
1120 preprocessor.
1121 XXX This is a bit of a hack, it's intended to help work around
1122 @@ -593,6 +673,8 @@
1123 /* The maximum number of insns to be used when loading a constant. */
1124 static int arm_constant_limit = 3;
1125
1126 +static enum arm_pcs arm_pcs_default;
1127 +
1128 /* For an explanation of these variables, see final_prescan_insn below. */
1129 int arm_ccfsm_state;
1130 /* arm_current_cc is also used for Thumb-2 cond_exec blocks. */
1131 @@ -673,9 +755,11 @@
1132 {"armv7-a", cortexa8, "7A", FL_CO_PROC | FL_FOR_ARCH7A, NULL},
1133 {"armv7-r", cortexr4, "7R", FL_CO_PROC | FL_FOR_ARCH7R, NULL},
1134 {"armv7-m", cortexm3, "7M", FL_CO_PROC | FL_FOR_ARCH7M, NULL},
1135 + {"armv7e-m", cortexm3, "7EM", FL_CO_PROC | FL_FOR_ARCH7EM, NULL},
1136 {"ep9312", ep9312, "4T", FL_LDSCHED | FL_CIRRUS | FL_FOR_ARCH4, NULL},
1137 {"iwmmxt", iwmmxt, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL},
1138 {"iwmmxt2", iwmmxt2, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL},
1139 + {"marvell-f", marvell_f, "5TE", FL_CO_PROC | FL_FOR_ARCH5TE | FL_MARVELL_F, NULL},
1140 {NULL, arm_none, NULL, 0 , NULL}
1141 };
1142
1143 @@ -705,49 +789,34 @@
1144
1145 /* The name of the preprocessor macro to define for this architecture. */
1146
1147 -char arm_arch_name[] = "__ARM_ARCH_0UNK__";
1148 -
1149 -struct fpu_desc
1150 -{
1151 - const char * name;
1152 - enum fputype fpu;
1153 -};
1154 -
1155 +#define ARM_ARCH_NAME_SIZE 25
1156 +char arm_arch_name[ARM_ARCH_NAME_SIZE] = "__ARM_ARCH_0UNK__";
1157
1158 /* Available values for -mfpu=. */
1159
1160 -static const struct fpu_desc all_fpus[] =
1161 +static const struct arm_fpu_desc all_fpus[] =
1162 {
1163 - {"fpa", FPUTYPE_FPA},
1164 - {"fpe2", FPUTYPE_FPA_EMU2},
1165 - {"fpe3", FPUTYPE_FPA_EMU2},
1166 - {"maverick", FPUTYPE_MAVERICK},
1167 - {"vfp", FPUTYPE_VFP},
1168 - {"vfp3", FPUTYPE_VFP3},
1169 - {"vfpv3", FPUTYPE_VFP3},
1170 - {"vfpv3-d16", FPUTYPE_VFP3D16},
1171 - {"neon", FPUTYPE_NEON}
1172 + {"fpa", ARM_FP_MODEL_FPA, 0, 0, false, false},
1173 + {"fpe2", ARM_FP_MODEL_FPA, 2, 0, false, false},
1174 + {"fpe3", ARM_FP_MODEL_FPA, 3, 0, false, false},
1175 + {"maverick", ARM_FP_MODEL_MAVERICK, 0, 0, false, false},
1176 + {"vfp", ARM_FP_MODEL_VFP, 2, VFP_REG_D16, false, false},
1177 + {"vfpv3", ARM_FP_MODEL_VFP, 3, VFP_REG_D32, false, false},
1178 + {"vfpv3-fp16", ARM_FP_MODEL_VFP, 3, VFP_REG_D32, false, true },
1179 + {"vfpv3-d16", ARM_FP_MODEL_VFP, 3, VFP_REG_D16, false, false},
1180 + {"vfpv3xd", ARM_FP_MODEL_VFP, 3, VFP_REG_SINGLE, false, false},
1181 + {"vfpv3xd-fp16", ARM_FP_MODEL_VFP, 3, VFP_REG_SINGLE, false, true },
1182 + {"vfpv3-d16-fp16", ARM_FP_MODEL_VFP, 3, VFP_REG_D16, false, true },
1183 + {"neon", ARM_FP_MODEL_VFP, 3, VFP_REG_D32, true , false},
1184 + {"neon-fp16", ARM_FP_MODEL_VFP, 3, VFP_REG_D32, true , true },
1185 + {"vfpv4", ARM_FP_MODEL_VFP, 4, VFP_REG_D32, false, true },
1186 + {"vfpv4-d16", ARM_FP_MODEL_VFP, 4, VFP_REG_D16, false, true },
1187 + {"fpv4-sp-d16", ARM_FP_MODEL_VFP, 4, VFP_REG_SINGLE, false, true },
1188 + {"neon-vfpv4", ARM_FP_MODEL_VFP, 4, VFP_REG_D32, true , true },
1189 + /* Compatibility aliases. */
1190 + {"vfp3", ARM_FP_MODEL_VFP, 3, VFP_REG_D32, false, false},
1191 };
1192
1193 -
1194 -/* Floating point models used by the different hardware.
1195 - See fputype in arm.h. */
1196 -
1197 -static const enum fputype fp_model_for_fpu[] =
1198 -{
1199 - /* No FP hardware. */
1200 - ARM_FP_MODEL_UNKNOWN, /* FPUTYPE_NONE */
1201 - ARM_FP_MODEL_FPA, /* FPUTYPE_FPA */
1202 - ARM_FP_MODEL_FPA, /* FPUTYPE_FPA_EMU2 */
1203 - ARM_FP_MODEL_FPA, /* FPUTYPE_FPA_EMU3 */
1204 - ARM_FP_MODEL_MAVERICK, /* FPUTYPE_MAVERICK */
1205 - ARM_FP_MODEL_VFP, /* FPUTYPE_VFP */
1206 - ARM_FP_MODEL_VFP, /* FPUTYPE_VFP3D16 */
1207 - ARM_FP_MODEL_VFP, /* FPUTYPE_VFP3 */
1208 - ARM_FP_MODEL_VFP /* FPUTYPE_NEON */
1209 -};
1210 -
1211 -
1212 struct float_abi
1213 {
1214 const char * name;
1215 @@ -765,6 +834,23 @@
1216 };
1217
1218
1219 +struct fp16_format
1220 +{
1221 + const char *name;
1222 + enum arm_fp16_format_type fp16_format_type;
1223 +};
1224 +
1225 +
1226 +/* Available values for -mfp16-format=. */
1227 +
1228 +static const struct fp16_format all_fp16_formats[] =
1229 +{
1230 + {"none", ARM_FP16_FORMAT_NONE},
1231 + {"ieee", ARM_FP16_FORMAT_IEEE},
1232 + {"alternative", ARM_FP16_FORMAT_ALTERNATIVE}
1233 +};
1234 +
1235 +
1236 struct abi_name
1237 {
1238 const char *name;
1239 @@ -922,6 +1008,44 @@
1240 set_optab_libfunc (umod_optab, DImode, NULL);
1241 set_optab_libfunc (smod_optab, SImode, NULL);
1242 set_optab_libfunc (umod_optab, SImode, NULL);
1243 +
1244 + /* Half-precision float operations. The compiler handles all operations
1245 + with NULL libfuncs by converting the SFmode. */
1246 + switch (arm_fp16_format)
1247 + {
1248 + case ARM_FP16_FORMAT_IEEE:
1249 + case ARM_FP16_FORMAT_ALTERNATIVE:
1250 +
1251 + /* Conversions. */
1252 + set_conv_libfunc (trunc_optab, HFmode, SFmode,
1253 + (arm_fp16_format == ARM_FP16_FORMAT_IEEE
1254 + ? "__gnu_f2h_ieee"
1255 + : "__gnu_f2h_alternative"));
1256 + set_conv_libfunc (sext_optab, SFmode, HFmode,
1257 + (arm_fp16_format == ARM_FP16_FORMAT_IEEE
1258 + ? "__gnu_h2f_ieee"
1259 + : "__gnu_h2f_alternative"));
1260 +
1261 + /* Arithmetic. */
1262 + set_optab_libfunc (add_optab, HFmode, NULL);
1263 + set_optab_libfunc (sdiv_optab, HFmode, NULL);
1264 + set_optab_libfunc (smul_optab, HFmode, NULL);
1265 + set_optab_libfunc (neg_optab, HFmode, NULL);
1266 + set_optab_libfunc (sub_optab, HFmode, NULL);
1267 +
1268 + /* Comparisons. */
1269 + set_optab_libfunc (eq_optab, HFmode, NULL);
1270 + set_optab_libfunc (ne_optab, HFmode, NULL);
1271 + set_optab_libfunc (lt_optab, HFmode, NULL);
1272 + set_optab_libfunc (le_optab, HFmode, NULL);
1273 + set_optab_libfunc (ge_optab, HFmode, NULL);
1274 + set_optab_libfunc (gt_optab, HFmode, NULL);
1275 + set_optab_libfunc (unord_optab, HFmode, NULL);
1276 + break;
1277 +
1278 + default:
1279 + break;
1280 + }
1281 }
1282
1283 /* On AAPCS systems, this is the "struct __va_list". */
1284 @@ -1135,6 +1259,7 @@
1285 arm_override_options (void)
1286 {
1287 unsigned i;
1288 + int len;
1289 enum processor_type target_arch_cpu = arm_none;
1290 enum processor_type selected_cpu = arm_none;
1291
1292 @@ -1152,7 +1277,11 @@
1293 {
1294 /* Set the architecture define. */
1295 if (i != ARM_OPT_SET_TUNE)
1296 - sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
1297 + {
1298 + len = snprintf (arm_arch_name, ARM_ARCH_NAME_SIZE,
1299 + "__ARM_ARCH_%s__", sel->arch);
1300 + gcc_assert (len < ARM_ARCH_NAME_SIZE);
1301 + }
1302
1303 /* Determine the processor core for which we should
1304 tune code-generation. */
1305 @@ -1178,8 +1307,8 @@
1306 make sure that they are compatible. We only generate
1307 a warning though, and we prefer the CPU over the
1308 architecture. */
1309 - if (insn_flags != 0 && (insn_flags ^ sel->flags))
1310 - warning (0, "switch -mcpu=%s conflicts with -march= switch",
1311 + if (insn_flags != 0 && ((insn_flags ^ sel->flags) & ~FL_COMPAT))
1312 + warning (0, "switch -mcpu=%s conflicts with -march= switch, assuming CPU feature set",
1313 ptr->string);
1314
1315 insn_flags = sel->flags;
1316 @@ -1279,7 +1408,11 @@
1317
1318 insn_flags = sel->flags;
1319 }
1320 - sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
1321 +
1322 + len = snprintf (arm_arch_name, ARM_ARCH_NAME_SIZE,
1323 + "__ARM_ARCH_%s__", sel->arch);
1324 + gcc_assert (len < ARM_ARCH_NAME_SIZE);
1325 +
1326 arm_default_cpu = (enum processor_type) (sel - all_cores);
1327 if (arm_tune == arm_none)
1328 arm_tune = arm_default_cpu;
1329 @@ -1289,8 +1422,35 @@
1330 chosen. */
1331 gcc_assert (arm_tune != arm_none);
1332
1333 + if (arm_tune == cortexa8 && optimize >= 3)
1334 + {
1335 + /* These alignments were experimentally determined to improve SPECint
1336 + performance on SPECCPU 2000. */
1337 + if (align_functions <= 0)
1338 + align_functions = 16;
1339 + if (align_jumps <= 0)
1340 + align_jumps = 16;
1341 + }
1342 +
1343 tune_flags = all_cores[(int)arm_tune].flags;
1344
1345 + if (target_fp16_format_name)
1346 + {
1347 + for (i = 0; i < ARRAY_SIZE (all_fp16_formats); i++)
1348 + {
1349 + if (streq (all_fp16_formats[i].name, target_fp16_format_name))
1350 + {
1351 + arm_fp16_format = all_fp16_formats[i].fp16_format_type;
1352 + break;
1353 + }
1354 + }
1355 + if (i == ARRAY_SIZE (all_fp16_formats))
1356 + error ("invalid __fp16 format option: -mfp16-format=%s",
1357 + target_fp16_format_name);
1358 + }
1359 + else
1360 + arm_fp16_format = ARM_FP16_FORMAT_NONE;
1361 +
1362 if (target_abi_name)
1363 {
1364 for (i = 0; i < ARRAY_SIZE (arm_all_abis); i++)
1365 @@ -1383,6 +1543,7 @@
1366 arm_arch6 = (insn_flags & FL_ARCH6) != 0;
1367 arm_arch6k = (insn_flags & FL_ARCH6K) != 0;
1368 arm_arch_notm = (insn_flags & FL_NOTM) != 0;
1369 + arm_arch7em = (insn_flags & FL_ARCH7EM) != 0;
1370 arm_arch_thumb2 = (insn_flags & FL_THUMB2) != 0;
1371 arm_arch_xscale = (insn_flags & FL_XSCALE) != 0;
1372 arm_arch_cirrus = (insn_flags & FL_CIRRUS) != 0;
1373 @@ -1390,12 +1551,25 @@
1374 arm_ld_sched = (tune_flags & FL_LDSCHED) != 0;
1375 arm_tune_strongarm = (tune_flags & FL_STRONG) != 0;
1376 thumb_code = (TARGET_ARM == 0);
1377 + janus2_code = (TARGET_FIX_JANUS != 0);
1378 + if (janus2_code && TARGET_THUMB2)
1379 + error ("janus2 fix is not applicable when targeting a thumb2 core");
1380 arm_tune_wbuf = (tune_flags & FL_WBUF) != 0;
1381 arm_tune_xscale = (tune_flags & FL_XSCALE) != 0;
1382 + arm_tune_marvell_f = (tune_flags & FL_MARVELL_F) != 0;
1383 arm_arch_iwmmxt = (insn_flags & FL_IWMMXT) != 0;
1384 - arm_arch_hwdiv = (insn_flags & FL_DIV) != 0;
1385 arm_tune_cortex_a9 = (arm_tune == cortexa9) != 0;
1386
1387 + /* Hardware integer division is supported by some variants of the ARM
1388 + architecture in Thumb-2 mode. In addition some (but not all) Marvell
1389 + CPUs support their own hardware integer division instructions.
1390 + The assembler will pick the correct encoding. */
1391 + if (TARGET_MARVELL_DIV && (insn_flags & FL_MARVELL_F) == 0)
1392 + error ("-mmarvell-div is only supported when targeting a Marvell core");
1393 +
1394 + arm_arch_hwdiv = (TARGET_ARM && TARGET_MARVELL_DIV)
1395 + || (TARGET_THUMB2 && (insn_flags & FL_DIV) != 0);
1396 +
1397 /* If we are not using the default (ARM mode) section anchor offset
1398 ranges, then set the correct ranges now. */
1399 if (TARGET_THUMB1)
1400 @@ -1434,7 +1608,6 @@
1401 if (TARGET_IWMMXT_ABI && !TARGET_IWMMXT)
1402 error ("iwmmxt abi requires an iwmmxt capable cpu");
1403
1404 - arm_fp_model = ARM_FP_MODEL_UNKNOWN;
1405 if (target_fpu_name == NULL && target_fpe_name != NULL)
1406 {
1407 if (streq (target_fpe_name, "2"))
1408 @@ -1445,46 +1618,52 @@
1409 error ("invalid floating point emulation option: -mfpe=%s",
1410 target_fpe_name);
1411 }
1412 - if (target_fpu_name != NULL)
1413 - {
1414 - /* The user specified a FPU. */
1415 - for (i = 0; i < ARRAY_SIZE (all_fpus); i++)
1416 - {
1417 - if (streq (all_fpus[i].name, target_fpu_name))
1418 - {
1419 - arm_fpu_arch = all_fpus[i].fpu;
1420 - arm_fpu_tune = arm_fpu_arch;
1421 - arm_fp_model = fp_model_for_fpu[arm_fpu_arch];
1422 - break;
1423 - }
1424 - }
1425 - if (arm_fp_model == ARM_FP_MODEL_UNKNOWN)
1426 - error ("invalid floating point option: -mfpu=%s", target_fpu_name);
1427 - }
1428 - else
1429 +
1430 + if (target_fpu_name == NULL)
1431 {
1432 #ifdef FPUTYPE_DEFAULT
1433 - /* Use the default if it is specified for this platform. */
1434 - arm_fpu_arch = FPUTYPE_DEFAULT;
1435 - arm_fpu_tune = FPUTYPE_DEFAULT;
1436 + target_fpu_name = FPUTYPE_DEFAULT;
1437 #else
1438 - /* Pick one based on CPU type. */
1439 - /* ??? Some targets assume FPA is the default.
1440 - if ((insn_flags & FL_VFP) != 0)
1441 - arm_fpu_arch = FPUTYPE_VFP;
1442 - else
1443 - */
1444 if (arm_arch_cirrus)
1445 - arm_fpu_arch = FPUTYPE_MAVERICK;
1446 + target_fpu_name = "maverick";
1447 else
1448 - arm_fpu_arch = FPUTYPE_FPA_EMU2;
1449 + target_fpu_name = "fpe2";
1450 #endif
1451 - if (tune_flags & FL_CO_PROC && arm_fpu_arch == FPUTYPE_FPA_EMU2)
1452 - arm_fpu_tune = FPUTYPE_FPA;
1453 + }
1454 +
1455 + arm_fpu_desc = NULL;
1456 + for (i = 0; i < ARRAY_SIZE (all_fpus); i++)
1457 + {
1458 + if (streq (all_fpus[i].name, target_fpu_name))
1459 + {
1460 + arm_fpu_desc = &all_fpus[i];
1461 + break;
1462 + }
1463 + }
1464 + if (!arm_fpu_desc)
1465 + error ("invalid floating point option: -mfpu=%s", target_fpu_name);
1466 +
1467 + switch (arm_fpu_desc->model)
1468 + {
1469 + case ARM_FP_MODEL_FPA:
1470 + if (arm_fpu_desc->rev == 2)
1471 + arm_fpu_attr = FPU_FPE2;
1472 + else if (arm_fpu_desc->rev == 3)
1473 + arm_fpu_attr = FPU_FPE3;
1474 else
1475 - arm_fpu_tune = arm_fpu_arch;
1476 - arm_fp_model = fp_model_for_fpu[arm_fpu_arch];
1477 - gcc_assert (arm_fp_model != ARM_FP_MODEL_UNKNOWN);
1478 + arm_fpu_attr = FPU_FPA;
1479 + break;
1480 +
1481 + case ARM_FP_MODEL_MAVERICK:
1482 + arm_fpu_attr = FPU_MAVERICK;
1483 + break;
1484 +
1485 + case ARM_FP_MODEL_VFP:
1486 + arm_fpu_attr = FPU_VFP;
1487 + break;
1488 +
1489 + default:
1490 + gcc_unreachable();
1491 }
1492
1493 if (target_float_abi_name != NULL)
1494 @@ -1505,9 +1684,6 @@
1495 else
1496 arm_float_abi = TARGET_DEFAULT_FLOAT_ABI;
1497
1498 - if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
1499 - sorry ("-mfloat-abi=hard and VFP");
1500 -
1501 /* FPA and iWMMXt are incompatible because the insn encodings overlap.
1502 VFP and iWMMXt can theoretically coexist, but it's unlikely such silicon
1503 will ever exist. GCC makes no attempt to support this combination. */
1504 @@ -1518,15 +1694,40 @@
1505 if (TARGET_THUMB2 && TARGET_IWMMXT)
1506 sorry ("Thumb-2 iWMMXt");
1507
1508 + /* __fp16 support currently assumes the core has ldrh. */
1509 + if (!arm_arch4 && arm_fp16_format != ARM_FP16_FORMAT_NONE)
1510 + sorry ("__fp16 and no ldrh");
1511 +
1512 /* If soft-float is specified then don't use FPU. */
1513 if (TARGET_SOFT_FLOAT)
1514 - arm_fpu_arch = FPUTYPE_NONE;
1515 + arm_fpu_attr = FPU_NONE;
1516 +
1517 + if (TARGET_AAPCS_BASED)
1518 + {
1519 + if (arm_abi == ARM_ABI_IWMMXT)
1520 + arm_pcs_default = ARM_PCS_AAPCS_IWMMXT;
1521 + else if (arm_float_abi == ARM_FLOAT_ABI_HARD
1522 + && TARGET_HARD_FLOAT
1523 + && TARGET_VFP)
1524 + arm_pcs_default = ARM_PCS_AAPCS_VFP;
1525 + else
1526 + arm_pcs_default = ARM_PCS_AAPCS;
1527 + }
1528 + else
1529 + {
1530 + if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
1531 + sorry ("-mfloat-abi=hard and VFP");
1532 +
1533 + if (arm_abi == ARM_ABI_APCS)
1534 + arm_pcs_default = ARM_PCS_APCS;
1535 + else
1536 + arm_pcs_default = ARM_PCS_ATPCS;
1537 + }
1538
1539 /* For arm2/3 there is no need to do any scheduling if there is only
1540 a floating point emulator, or we are doing software floating-point. */
1541 if ((TARGET_SOFT_FLOAT
1542 - || arm_fpu_tune == FPUTYPE_FPA_EMU2
1543 - || arm_fpu_tune == FPUTYPE_FPA_EMU3)
1544 + || (TARGET_FPA && arm_fpu_desc->rev))
1545 && (tune_flags & FL_MODE32) == 0)
1546 flag_schedule_insns = flag_schedule_insns_after_reload = 0;
1547
1548 @@ -1616,8 +1817,7 @@
1549 fix_cm3_ldrd = 0;
1550 }
1551
1552 - /* ??? We might want scheduling for thumb2. */
1553 - if (TARGET_THUMB && flag_schedule_insns)
1554 + if (TARGET_THUMB1 && flag_schedule_insns)
1555 {
1556 /* Don't warn since it's on by default in -O2. */
1557 flag_schedule_insns = 0;
1558 @@ -1653,6 +1853,36 @@
1559
1560 /* Register global variables with the garbage collector. */
1561 arm_add_gc_roots ();
1562 +
1563 + if (low_irq_latency && TARGET_THUMB)
1564 + {
1565 + warning (0,
1566 + "-low-irq-latency has no effect when compiling for the Thumb");
1567 + low_irq_latency = 0;
1568 + }
1569 +
1570 + /* CSL LOCAL */
1571 + /* Loop unrolling can be a substantial win. At -O2, limit to 2x
1572 + unrolling by default to prevent excessive code growth; at -O3,
1573 + limit to 4x unrolling by default. We know we are not optimizing
1574 + for size if this is set (see arm_optimization_options). */
1575 + if (flag_unroll_loops == 2)
1576 + {
1577 + if (optimize == 2)
1578 + {
1579 + flag_unroll_loops = 1;
1580 + if (!PARAM_SET_P (PARAM_MAX_UNROLL_TIMES))
1581 + set_param_value ("max-unroll-times", 2);
1582 + }
1583 + else if (optimize > 2)
1584 + {
1585 + flag_unroll_loops = 1;
1586 + if (!PARAM_SET_P (PARAM_MAX_UNROLL_TIMES))
1587 + set_param_value ("max-unroll-times", 4);
1588 + }
1589 + else
1590 + flag_unroll_loops = 0;
1591 + }
1592 }
1593
1594 static void
1595 @@ -1782,6 +2012,14 @@
1596 return !IS_NAKED (arm_current_func_type ());
1597 }
1598
1599 +static bool
1600 +arm_warn_func_result (void)
1601 +{
1602 + /* Naked functions are implemented entirely in assembly, including the
1603 + return sequence, so suppress warnings about this. */
1604 + return !IS_NAKED (arm_current_func_type ());
1605 +}
1606 +
1607 \f
1608 /* Return 1 if it is possible to return using a single instruction.
1609 If SIBLING is non-null, this is a test for a return before a sibling
1610 @@ -2873,14 +3111,19 @@
1611
1612 /* Define how to find the value returned by a function. */
1613
1614 -rtx
1615 -arm_function_value(const_tree type, const_tree func ATTRIBUTE_UNUSED)
1616 +static rtx
1617 +arm_function_value(const_tree type, const_tree func,
1618 + bool outgoing ATTRIBUTE_UNUSED)
1619 {
1620 enum machine_mode mode;
1621 int unsignedp ATTRIBUTE_UNUSED;
1622 rtx r ATTRIBUTE_UNUSED;
1623
1624 mode = TYPE_MODE (type);
1625 +
1626 + if (TARGET_AAPCS_BASED)
1627 + return aapcs_allocate_return_reg (mode, type, func);
1628 +
1629 /* Promote integer types. */
1630 if (INTEGRAL_TYPE_P (type))
1631 PROMOTE_FUNCTION_MODE (mode, unsignedp, type);
1632 @@ -2897,7 +3140,36 @@
1633 }
1634 }
1635
1636 - return LIBCALL_VALUE(mode);
1637 + return LIBCALL_VALUE (mode);
1638 +}
1639 +
1640 +rtx
1641 +arm_libcall_value (enum machine_mode mode, rtx libcall)
1642 +{
1643 + if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS
1644 + && GET_MODE_CLASS (mode) == MODE_FLOAT)
1645 + {
1646 + /* The following libcalls return their result in integer registers,
1647 + even though they return a floating point value. */
1648 + if (rtx_equal_p (libcall,
1649 + convert_optab_libfunc (sfloat_optab, mode, SImode))
1650 + || rtx_equal_p (libcall,
1651 + convert_optab_libfunc (ufloat_optab, mode, SImode))
1652 + || rtx_equal_p (libcall,
1653 + convert_optab_libfunc (sfloat_optab, mode, DImode))
1654 + || rtx_equal_p (libcall,
1655 + convert_optab_libfunc (ufloat_optab, mode, DImode))
1656 + || rtx_equal_p (libcall,
1657 + convert_optab_libfunc (trunc_optab, HFmode, SFmode))
1658 + || rtx_equal_p (libcall,
1659 + convert_optab_libfunc (sext_optab, SFmode, HFmode)))
1660 + return gen_rtx_REG (mode, ARG_REGISTER(1));
1661 +
1662 + /* XXX There are other libcalls that return in integer registers,
1663 + but I think they are all handled by hard insns. */
1664 + }
1665 +
1666 + return LIBCALL_VALUE (mode);
1667 }
1668
1669 /* Determine the amount of memory needed to store the possible return
1670 @@ -2907,10 +3179,12 @@
1671 {
1672 int size = 16;
1673
1674 - if (TARGET_ARM)
1675 + if (TARGET_32BIT)
1676 {
1677 if (TARGET_HARD_FLOAT_ABI)
1678 {
1679 + if (TARGET_VFP)
1680 + size += 32;
1681 if (TARGET_FPA)
1682 size += 12;
1683 if (TARGET_MAVERICK)
1684 @@ -2923,27 +3197,56 @@
1685 return size;
1686 }
1687
1688 -/* Decide whether a type should be returned in memory (true)
1689 - or in a register (false). This is called as the target hook
1690 - TARGET_RETURN_IN_MEMORY. */
1691 +/* Decide whether TYPE should be returned in memory (true)
1692 + or in a register (false). FNTYPE is the type of the function making
1693 + the call. */
1694 static bool
1695 -arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
1696 +arm_return_in_memory (const_tree type, const_tree fntype)
1697 {
1698 HOST_WIDE_INT size;
1699
1700 - size = int_size_in_bytes (type);
1701 + size = int_size_in_bytes (type); /* Negative if not fixed size. */
1702 +
1703 + if (TARGET_AAPCS_BASED)
1704 + {
1705 + /* Simple, non-aggregate types (ie not including vectors and
1706 + complex) are always returned in a register (or registers).
1707 + We don't care about which register here, so we can short-cut
1708 + some of the detail. */
1709 + if (!AGGREGATE_TYPE_P (type)
1710 + && TREE_CODE (type) != VECTOR_TYPE
1711 + && TREE_CODE (type) != COMPLEX_TYPE)
1712 + return false;
1713 +
1714 + /* Any return value that is no larger than one word can be
1715 + returned in r0. */
1716 + if (((unsigned HOST_WIDE_INT) size) <= UNITS_PER_WORD)
1717 + return false;
1718 +
1719 + /* Check any available co-processors to see if they accept the
1720 + type as a register candidate (VFP, for example, can return
1721 + some aggregates in consecutive registers). These aren't
1722 + available if the call is variadic. */
1723 + if (aapcs_select_return_coproc (type, fntype) >= 0)
1724 + return false;
1725 +
1726 + /* Vector values should be returned using ARM registers, not
1727 + memory (unless they're over 16 bytes, which will break since
1728 + we only have four call-clobbered registers to play with). */
1729 + if (TREE_CODE (type) == VECTOR_TYPE)
1730 + return (size < 0 || size > (4 * UNITS_PER_WORD));
1731 +
1732 + /* The rest go in memory. */
1733 + return true;
1734 + }
1735
1736 - /* Vector values should be returned using ARM registers, not memory (unless
1737 - they're over 16 bytes, which will break since we only have four
1738 - call-clobbered registers to play with). */
1739 if (TREE_CODE (type) == VECTOR_TYPE)
1740 return (size < 0 || size > (4 * UNITS_PER_WORD));
1741
1742 if (!AGGREGATE_TYPE_P (type) &&
1743 - !(TARGET_AAPCS_BASED && TREE_CODE (type) == COMPLEX_TYPE))
1744 - /* All simple types are returned in registers.
1745 - For AAPCS, complex types are treated the same as aggregates. */
1746 - return 0;
1747 + (TREE_CODE (type) != VECTOR_TYPE))
1748 + /* All simple types are returned in registers. */
1749 + return false;
1750
1751 if (arm_abi != ARM_ABI_APCS)
1752 {
1753 @@ -2960,7 +3263,7 @@
1754 the aggregate is either huge or of variable size, and in either case
1755 we will want to return it via memory and not in a register. */
1756 if (size < 0 || size > UNITS_PER_WORD)
1757 - return 1;
1758 + return true;
1759
1760 if (TREE_CODE (type) == RECORD_TYPE)
1761 {
1762 @@ -2980,18 +3283,18 @@
1763 continue;
1764
1765 if (field == NULL)
1766 - return 0; /* An empty structure. Allowed by an extension to ANSI C. */
1767 + return false; /* An empty structure. Allowed by an extension to ANSI C. */
1768
1769 /* Check that the first field is valid for returning in a register. */
1770
1771 /* ... Floats are not allowed */
1772 if (FLOAT_TYPE_P (TREE_TYPE (field)))
1773 - return 1;
1774 + return true;
1775
1776 /* ... Aggregates that are not themselves valid for returning in
1777 a register are not allowed. */
1778 if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
1779 - return 1;
1780 + return true;
1781
1782 /* Now check the remaining fields, if any. Only bitfields are allowed,
1783 since they are not addressable. */
1784 @@ -3003,10 +3306,10 @@
1785 continue;
1786
1787 if (!DECL_BIT_FIELD_TYPE (field))
1788 - return 1;
1789 + return true;
1790 }
1791
1792 - return 0;
1793 + return false;
1794 }
1795
1796 if (TREE_CODE (type) == UNION_TYPE)
1797 @@ -3023,18 +3326,18 @@
1798 continue;
1799
1800 if (FLOAT_TYPE_P (TREE_TYPE (field)))
1801 - return 1;
1802 + return true;
1803
1804 if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
1805 - return 1;
1806 + return true;
1807 }
1808
1809 - return 0;
1810 + return false;
1811 }
1812 #endif /* not ARM_WINCE */
1813
1814 /* Return all other types in memory. */
1815 - return 1;
1816 + return true;
1817 }
1818
1819 /* Indicate whether or not words of a double are in big-endian order. */
1820 @@ -3059,14 +3362,780 @@
1821 return 1;
1822 }
1823
1824 +const struct pcs_attribute_arg
1825 +{
1826 + const char *arg;
1827 + enum arm_pcs value;
1828 +} pcs_attribute_args[] =
1829 + {
1830 + {"aapcs", ARM_PCS_AAPCS},
1831 + {"aapcs-vfp", ARM_PCS_AAPCS_VFP},
1832 + {"aapcs-iwmmxt", ARM_PCS_AAPCS_IWMMXT},
1833 + {"atpcs", ARM_PCS_ATPCS},
1834 + {"apcs", ARM_PCS_APCS},
1835 + {NULL, ARM_PCS_UNKNOWN}
1836 + };
1837 +
1838 +static enum arm_pcs
1839 +arm_pcs_from_attribute (tree attr)
1840 +{
1841 + const struct pcs_attribute_arg *ptr;
1842 + const char *arg;
1843 +
1844 + /* Get the value of the argument. */
1845 + if (TREE_VALUE (attr) == NULL_TREE
1846 + || TREE_CODE (TREE_VALUE (attr)) != STRING_CST)
1847 + return ARM_PCS_UNKNOWN;
1848 +
1849 + arg = TREE_STRING_POINTER (TREE_VALUE (attr));
1850 +
1851 + /* Check it against the list of known arguments. */
1852 + for (ptr = pcs_attribute_args; ptr->arg != NULL; ptr++)
1853 + if (streq (arg, ptr->arg))
1854 + return ptr->value;
1855 +
1856 + /* An unrecognized interrupt type. */
1857 + return ARM_PCS_UNKNOWN;
1858 +}
1859 +
1860 +/* Get the PCS variant to use for this call. TYPE is the function's type
1861 + specification, DECL is the specific declartion. DECL may be null if
1862 + the call could be indirect or if this is a library call. */
1863 +static enum arm_pcs
1864 +arm_get_pcs_model (const_tree type, const_tree decl)
1865 +{
1866 + bool user_convention = false;
1867 + enum arm_pcs user_pcs = arm_pcs_default;
1868 + tree attr;
1869 +
1870 + gcc_assert (type);
1871 +
1872 + attr = lookup_attribute ("pcs", TYPE_ATTRIBUTES (type));
1873 + if (attr)
1874 + {
1875 + user_pcs = arm_pcs_from_attribute (TREE_VALUE (attr));
1876 + user_convention = true;
1877 + }
1878 +
1879 + if (TARGET_AAPCS_BASED)
1880 + {
1881 + /* Detect varargs functions. These always use the base rules
1882 + (no argument is ever a candidate for a co-processor
1883 + register). */
1884 + bool base_rules = (TYPE_ARG_TYPES (type) != 0
1885 + && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (type)))
1886 + != void_type_node));
1887 +
1888 + if (user_convention)
1889 + {
1890 + if (user_pcs > ARM_PCS_AAPCS_LOCAL)
1891 + sorry ("Non-AAPCS derived PCS variant");
1892 + else if (base_rules && user_pcs != ARM_PCS_AAPCS)
1893 + error ("Variadic functions must use the base AAPCS variant");
1894 + }
1895 +
1896 + if (base_rules)
1897 + return ARM_PCS_AAPCS;
1898 + else if (user_convention)
1899 + return user_pcs;
1900 + else if (decl && flag_unit_at_a_time)
1901 + {
1902 + /* Local functions never leak outside this compilation unit,
1903 + so we are free to use whatever conventions are
1904 + appropriate. */
1905 + /* FIXME: remove CONST_CAST_TREE when cgraph is constified. */
1906 + struct cgraph_local_info *i = cgraph_local_info (CONST_CAST_TREE(decl));
1907 + if (i && i->local)
1908 + return ARM_PCS_AAPCS_LOCAL;
1909 + }
1910 + }
1911 + else if (user_convention && user_pcs != arm_pcs_default)
1912 + sorry ("PCS variant");
1913 +
1914 + /* For everything else we use the target's default. */
1915 + return arm_pcs_default;
1916 +}
1917 +
1918 +
1919 +static void
1920 +aapcs_vfp_cum_init (CUMULATIVE_ARGS *pcum ATTRIBUTE_UNUSED,
1921 + const_tree fntype ATTRIBUTE_UNUSED,
1922 + rtx libcall ATTRIBUTE_UNUSED,
1923 + const_tree fndecl ATTRIBUTE_UNUSED)
1924 +{
1925 + /* Record the unallocated VFP registers. */
1926 + pcum->aapcs_vfp_regs_free = (1 << NUM_VFP_ARG_REGS) - 1;
1927 + pcum->aapcs_vfp_reg_alloc = 0;
1928 +}
1929 +
1930 +/* Walk down the type tree of TYPE counting consecutive base elements.
1931 + If *MODEP is VOIDmode, then set it to the first valid floating point
1932 + type. If a non-floating point type is found, or if a floating point
1933 + type that doesn't match a non-VOIDmode *MODEP is found, then return -1,
1934 + otherwise return the count in the sub-tree. */
1935 +static int
1936 +aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
1937 +{
1938 + enum machine_mode mode;
1939 + HOST_WIDE_INT size;
1940 +
1941 + switch (TREE_CODE (type))
1942 + {
1943 + case REAL_TYPE:
1944 + mode = TYPE_MODE (type);
1945 + if (mode != DFmode && mode != SFmode)
1946 + return -1;
1947 +
1948 + if (*modep == VOIDmode)
1949 + *modep = mode;
1950 +
1951 + if (*modep == mode)
1952 + return 1;
1953 +
1954 + break;
1955 +
1956 + case COMPLEX_TYPE:
1957 + mode = TYPE_MODE (TREE_TYPE (type));
1958 + if (mode != DFmode && mode != SFmode)
1959 + return -1;
1960 +
1961 + if (*modep == VOIDmode)
1962 + *modep = mode;
1963 +
1964 + if (*modep == mode)
1965 + return 2;
1966 +
1967 + break;
1968 +
1969 + case VECTOR_TYPE:
1970 + /* Use V2SImode and V4SImode as representatives of all 64-bit
1971 + and 128-bit vector types, whether or not those modes are
1972 + supported with the present options. */
1973 + size = int_size_in_bytes (type);
1974 + switch (size)
1975 + {
1976 + case 8:
1977 + mode = V2SImode;
1978 + break;
1979 + case 16:
1980 + mode = V4SImode;
1981 + break;
1982 + default:
1983 + return -1;
1984 + }
1985 +
1986 + if (*modep == VOIDmode)
1987 + *modep = mode;
1988 +
1989 + /* Vector modes are considered to be opaque: two vectors are
1990 + equivalent for the purposes of being homogeneous aggregates
1991 + if they are the same size. */
1992 + if (*modep == mode)
1993 + return 1;
1994 +
1995 + break;
1996 +
1997 + case ARRAY_TYPE:
1998 + {
1999 + int count;
2000 + tree index = TYPE_DOMAIN (type);
2001 +
2002 + /* Can't handle incomplete types. */
2003 + if (!COMPLETE_TYPE_P(type))
2004 + return -1;
2005 +
2006 + count = aapcs_vfp_sub_candidate (TREE_TYPE (type), modep);
2007 + if (count == -1
2008 + || !index
2009 + || !TYPE_MAX_VALUE (index)
2010 + || !host_integerp (TYPE_MAX_VALUE (index), 1)
2011 + || !TYPE_MIN_VALUE (index)
2012 + || !host_integerp (TYPE_MIN_VALUE (index), 1)
2013 + || count < 0)
2014 + return -1;
2015 +
2016 + count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
2017 + - tree_low_cst (TYPE_MIN_VALUE (index), 1));
2018 +
2019 + /* There must be no padding. */
2020 + if (!host_integerp (TYPE_SIZE (type), 1)
2021 + || (tree_low_cst (TYPE_SIZE (type), 1)
2022 + != count * GET_MODE_BITSIZE (*modep)))
2023 + return -1;
2024 +
2025 + return count;
2026 + }
2027 +
2028 + case RECORD_TYPE:
2029 + {
2030 + int count = 0;
2031 + int sub_count;
2032 + tree field;
2033 +
2034 + /* Can't handle incomplete types. */
2035 + if (!COMPLETE_TYPE_P(type))
2036 + return -1;
2037 +
2038 + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
2039 + {
2040 + if (TREE_CODE (field) != FIELD_DECL)
2041 + continue;
2042 +
2043 + sub_count = aapcs_vfp_sub_candidate (TREE_TYPE (field), modep);
2044 + if (sub_count < 0)
2045 + return -1;
2046 + count += sub_count;
2047 + }
2048 +
2049 + /* There must be no padding. */
2050 + if (!host_integerp (TYPE_SIZE (type), 1)
2051 + || (tree_low_cst (TYPE_SIZE (type), 1)
2052 + != count * GET_MODE_BITSIZE (*modep)))
2053 + return -1;
2054 +
2055 + return count;
2056 + }
2057 +
2058 + case UNION_TYPE:
2059 + case QUAL_UNION_TYPE:
2060 + {
2061 + /* These aren't very interesting except in a degenerate case. */
2062 + int count = 0;
2063 + int sub_count;
2064 + tree field;
2065 +
2066 + /* Can't handle incomplete types. */
2067 + if (!COMPLETE_TYPE_P(type))
2068 + return -1;
2069 +
2070 + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
2071 + {
2072 + if (TREE_CODE (field) != FIELD_DECL)
2073 + continue;
2074 +
2075 + sub_count = aapcs_vfp_sub_candidate (TREE_TYPE (field), modep);
2076 + if (sub_count < 0)
2077 + return -1;
2078 + count = count > sub_count ? count : sub_count;
2079 + }
2080 +
2081 + /* There must be no padding. */
2082 + if (!host_integerp (TYPE_SIZE (type), 1)
2083 + || (tree_low_cst (TYPE_SIZE (type), 1)
2084 + != count * GET_MODE_BITSIZE (*modep)))
2085 + return -1;
2086 +
2087 + return count;
2088 + }
2089 +
2090 + default:
2091 + break;
2092 + }
2093 +
2094 + return -1;
2095 +}
2096 +
2097 +/* Return true if PCS_VARIANT should use VFP registers. */
2098 +static bool
2099 +use_vfp_abi (enum arm_pcs pcs_variant, bool is_double)
2100 +{
2101 + if (pcs_variant == ARM_PCS_AAPCS_VFP)
2102 + return true;
2103 +
2104 + if (pcs_variant != ARM_PCS_AAPCS_LOCAL)
2105 + return false;
2106 +
2107 + return (TARGET_32BIT && TARGET_VFP && TARGET_HARD_FLOAT &&
2108 + (TARGET_VFP_DOUBLE || !is_double));
2109 +}
2110 +
2111 +static bool
2112 +aapcs_vfp_is_call_or_return_candidate (enum arm_pcs pcs_variant,
2113 + enum machine_mode mode, const_tree type,
2114 + int *base_mode, int *count)
2115 +{
2116 + enum machine_mode new_mode = VOIDmode;
2117 +
2118 + if (GET_MODE_CLASS (mode) == MODE_FLOAT
2119 + || GET_MODE_CLASS (mode) == MODE_VECTOR_INT
2120 + || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
2121 + {
2122 + *count = 1;
2123 + new_mode = mode;
2124 + }
2125 + else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
2126 + {
2127 + *count = 2;
2128 + new_mode = (mode == DCmode ? DFmode : SFmode);
2129 + }
2130 + else if (type && (mode == BLKmode || TREE_CODE (type) == VECTOR_TYPE))
2131 + {
2132 + int ag_count = aapcs_vfp_sub_candidate (type, &new_mode);
2133 +
2134 + if (ag_count > 0 && ag_count <= 4)
2135 + *count = ag_count;
2136 + else
2137 + return false;
2138 + }
2139 + else
2140 + return false;
2141 +
2142 +
2143 + if (!use_vfp_abi (pcs_variant, ARM_NUM_REGS (new_mode) > 1))
2144 + return false;
2145 +
2146 + *base_mode = new_mode;
2147 + return true;
2148 +}
2149 +
2150 +static bool
2151 +aapcs_vfp_is_return_candidate (enum arm_pcs pcs_variant,
2152 + enum machine_mode mode, const_tree type)
2153 +{
2154 + int count ATTRIBUTE_UNUSED;
2155 + int ag_mode ATTRIBUTE_UNUSED;
2156 +
2157 + if (!use_vfp_abi (pcs_variant, false))
2158 + return false;
2159 + return aapcs_vfp_is_call_or_return_candidate (pcs_variant, mode, type,
2160 + &ag_mode, &count);
2161 +}
2162 +
2163 +static bool
2164 +aapcs_vfp_is_call_candidate (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2165 + const_tree type)
2166 +{
2167 + if (!use_vfp_abi (pcum->pcs_variant, false))
2168 + return false;
2169 +
2170 + return aapcs_vfp_is_call_or_return_candidate (pcum->pcs_variant, mode, type,
2171 + &pcum->aapcs_vfp_rmode,
2172 + &pcum->aapcs_vfp_rcount);
2173 +}
2174 +
2175 +static bool
2176 +aapcs_vfp_allocate (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2177 + const_tree type ATTRIBUTE_UNUSED)
2178 +{
2179 + int shift = GET_MODE_SIZE (pcum->aapcs_vfp_rmode) / GET_MODE_SIZE (SFmode);
2180 + unsigned mask = (1 << (shift * pcum->aapcs_vfp_rcount)) - 1;
2181 + int regno;
2182 +
2183 + for (regno = 0; regno < NUM_VFP_ARG_REGS; regno += shift)
2184 + if (((pcum->aapcs_vfp_regs_free >> regno) & mask) == mask)
2185 + {
2186 + pcum->aapcs_vfp_reg_alloc = mask << regno;
2187 + if (mode == BLKmode || (mode == TImode && !TARGET_NEON))
2188 + {
2189 + int i;
2190 + int rcount = pcum->aapcs_vfp_rcount;
2191 + int rshift = shift;
2192 + enum machine_mode rmode = pcum->aapcs_vfp_rmode;
2193 + rtx par;
2194 + if (!TARGET_NEON)
2195 + {
2196 + /* Avoid using unsupported vector modes. */
2197 + if (rmode == V2SImode)
2198 + rmode = DImode;
2199 + else if (rmode == V4SImode)
2200 + {
2201 + rmode = DImode;
2202 + rcount *= 2;
2203 + rshift /= 2;
2204 + }
2205 + }
2206 + par = gen_rtx_PARALLEL (mode, rtvec_alloc (rcount));
2207 + for (i = 0; i < rcount; i++)
2208 + {
2209 + rtx tmp = gen_rtx_REG (rmode,
2210 + FIRST_VFP_REGNUM + regno + i * rshift);
2211 + tmp = gen_rtx_EXPR_LIST
2212 + (VOIDmode, tmp,
2213 + GEN_INT (i * GET_MODE_SIZE (rmode)));
2214 + XVECEXP (par, 0, i) = tmp;
2215 + }
2216 +
2217 + pcum->aapcs_reg = par;
2218 + }
2219 + else
2220 + pcum->aapcs_reg = gen_rtx_REG (mode, FIRST_VFP_REGNUM + regno);
2221 + return true;
2222 + }
2223 + return false;
2224 +}
2225 +
2226 +static rtx
2227 +aapcs_vfp_allocate_return_reg (enum arm_pcs pcs_variant ATTRIBUTE_UNUSED,
2228 + enum machine_mode mode,
2229 + const_tree type ATTRIBUTE_UNUSED)
2230 +{
2231 + if (!use_vfp_abi (pcs_variant, false))
2232 + return false;
2233 +
2234 + if (mode == BLKmode || (mode == TImode && !TARGET_NEON))
2235 + {
2236 + int count;
2237 + int ag_mode;
2238 + int i;
2239 + rtx par;
2240 + int shift;
2241 +
2242 + aapcs_vfp_is_call_or_return_candidate (pcs_variant, mode, type,
2243 + &ag_mode, &count);
2244 +
2245 + if (!TARGET_NEON)
2246 + {
2247 + if (ag_mode == V2SImode)
2248 + ag_mode = DImode;
2249 + else if (ag_mode == V4SImode)
2250 + {
2251 + ag_mode = DImode;
2252 + count *= 2;
2253 + }
2254 + }
2255 + shift = GET_MODE_SIZE(ag_mode) / GET_MODE_SIZE(SFmode);
2256 + par = gen_rtx_PARALLEL (mode, rtvec_alloc (count));
2257 + for (i = 0; i < count; i++)
2258 + {
2259 + rtx tmp = gen_rtx_REG (ag_mode, FIRST_VFP_REGNUM + i * shift);
2260 + tmp = gen_rtx_EXPR_LIST (VOIDmode, tmp,
2261 + GEN_INT (i * GET_MODE_SIZE (ag_mode)));
2262 + XVECEXP (par, 0, i) = tmp;
2263 + }
2264 +
2265 + return par;
2266 + }
2267 +
2268 + return gen_rtx_REG (mode, FIRST_VFP_REGNUM);
2269 +}
2270 +
2271 +static void
2272 +aapcs_vfp_advance (CUMULATIVE_ARGS *pcum ATTRIBUTE_UNUSED,
2273 + enum machine_mode mode ATTRIBUTE_UNUSED,
2274 + const_tree type ATTRIBUTE_UNUSED)
2275 +{
2276 + pcum->aapcs_vfp_regs_free &= ~pcum->aapcs_vfp_reg_alloc;
2277 + pcum->aapcs_vfp_reg_alloc = 0;
2278 + return;
2279 +}
2280 +
2281 +#define AAPCS_CP(X) \
2282 + { \
2283 + aapcs_ ## X ## _cum_init, \
2284 + aapcs_ ## X ## _is_call_candidate, \
2285 + aapcs_ ## X ## _allocate, \
2286 + aapcs_ ## X ## _is_return_candidate, \
2287 + aapcs_ ## X ## _allocate_return_reg, \
2288 + aapcs_ ## X ## _advance \
2289 + }
2290 +
2291 +/* Table of co-processors that can be used to pass arguments in
2292 + registers. Idealy no arugment should be a candidate for more than
2293 + one co-processor table entry, but the table is processed in order
2294 + and stops after the first match. If that entry then fails to put
2295 + the argument into a co-processor register, the argument will go on
2296 + the stack. */
2297 +static struct
2298 +{
2299 + /* Initialize co-processor related state in CUMULATIVE_ARGS structure. */
2300 + void (*cum_init) (CUMULATIVE_ARGS *, const_tree, rtx, const_tree);
2301 +
2302 + /* Return true if an argument of mode MODE (or type TYPE if MODE is
2303 + BLKmode) is a candidate for this co-processor's registers; this
2304 + function should ignore any position-dependent state in
2305 + CUMULATIVE_ARGS and only use call-type dependent information. */
2306 + bool (*is_call_candidate) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
2307 +
2308 + /* Return true if the argument does get a co-processor register; it
2309 + should set aapcs_reg to an RTX of the register allocated as is
2310 + required for a return from FUNCTION_ARG. */
2311 + bool (*allocate) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
2312 +
2313 + /* Return true if a result of mode MODE (or type TYPE if MODE is
2314 + BLKmode) is can be returned in this co-processor's registers. */
2315 + bool (*is_return_candidate) (enum arm_pcs, enum machine_mode, const_tree);
2316 +
2317 + /* Allocate and return an RTX element to hold the return type of a
2318 + call, this routine must not fail and will only be called if
2319 + is_return_candidate returned true with the same parameters. */
2320 + rtx (*allocate_return_reg) (enum arm_pcs, enum machine_mode, const_tree);
2321 +
2322 + /* Finish processing this argument and prepare to start processing
2323 + the next one. */
2324 + void (*advance) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
2325 +} aapcs_cp_arg_layout[ARM_NUM_COPROC_SLOTS] =
2326 + {
2327 + AAPCS_CP(vfp)
2328 + };
2329 +
2330 +#undef AAPCS_CP
2331 +
2332 +static int
2333 +aapcs_select_call_coproc (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2334 + tree type)
2335 +{
2336 + int i;
2337 +
2338 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2339 + if (aapcs_cp_arg_layout[i].is_call_candidate (pcum, mode, type))
2340 + return i;
2341 +
2342 + return -1;
2343 +}
2344 +
2345 +static int
2346 +aapcs_select_return_coproc (const_tree type, const_tree fntype)
2347 +{
2348 + /* We aren't passed a decl, so we can't check that a call is local.
2349 + However, it isn't clear that that would be a win anyway, since it
2350 + might limit some tail-calling opportunities. */
2351 + enum arm_pcs pcs_variant;
2352 +
2353 + if (fntype)
2354 + {
2355 + const_tree fndecl = NULL_TREE;
2356 +
2357 + if (TREE_CODE (fntype) == FUNCTION_DECL)
2358 + {
2359 + fndecl = fntype;
2360 + fntype = TREE_TYPE (fntype);
2361 + }
2362 +
2363 + pcs_variant = arm_get_pcs_model (fntype, fndecl);
2364 + }
2365 + else
2366 + pcs_variant = arm_pcs_default;
2367 +
2368 + if (pcs_variant != ARM_PCS_AAPCS)
2369 + {
2370 + int i;
2371 +
2372 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2373 + if (aapcs_cp_arg_layout[i].is_return_candidate (pcs_variant,
2374 + TYPE_MODE (type),
2375 + type))
2376 + return i;
2377 + }
2378 + return -1;
2379 +}
2380 +
2381 +static rtx
2382 +aapcs_allocate_return_reg (enum machine_mode mode, const_tree type,
2383 + const_tree fntype)
2384 +{
2385 + /* We aren't passed a decl, so we can't check that a call is local.
2386 + However, it isn't clear that that would be a win anyway, since it
2387 + might limit some tail-calling opportunities. */
2388 + enum arm_pcs pcs_variant;
2389 +
2390 + if (fntype)
2391 + {
2392 + const_tree fndecl = NULL_TREE;
2393 +
2394 + if (TREE_CODE (fntype) == FUNCTION_DECL)
2395 + {
2396 + fndecl = fntype;
2397 + fntype = TREE_TYPE (fntype);
2398 + }
2399 +
2400 + pcs_variant = arm_get_pcs_model (fntype, fndecl);
2401 + }
2402 + else
2403 + pcs_variant = arm_pcs_default;
2404 +
2405 + /* Promote integer types. */
2406 + if (type && INTEGRAL_TYPE_P (type))
2407 + PROMOTE_FUNCTION_MODE (mode, unsignedp, type);
2408 +
2409 + if (pcs_variant != ARM_PCS_AAPCS)
2410 + {
2411 + int i;
2412 +
2413 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2414 + if (aapcs_cp_arg_layout[i].is_return_candidate (pcs_variant, mode,
2415 + type))
2416 + return aapcs_cp_arg_layout[i].allocate_return_reg (pcs_variant,
2417 + mode, type);
2418 + }
2419 +
2420 + /* Promotes small structs returned in a register to full-word size
2421 + for big-endian AAPCS. */
2422 + if (type && arm_return_in_msb (type))
2423 + {
2424 + HOST_WIDE_INT size = int_size_in_bytes (type);
2425 + if (size % UNITS_PER_WORD != 0)
2426 + {
2427 + size += UNITS_PER_WORD - size % UNITS_PER_WORD;
2428 + mode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
2429 + }
2430 + }
2431 +
2432 + return gen_rtx_REG (mode, R0_REGNUM);
2433 +}
2434 +
2435 +rtx
2436 +aapcs_libcall_value (enum machine_mode mode)
2437 +{
2438 + return aapcs_allocate_return_reg (mode, NULL_TREE, NULL_TREE);
2439 +}
2440 +
2441 +/* Lay out a function argument using the AAPCS rules. The rule
2442 + numbers referred to here are those in the AAPCS. */
2443 +static void
2444 +aapcs_layout_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2445 + tree type, int named)
2446 +{
2447 + int nregs, nregs2;
2448 + int ncrn;
2449 +
2450 + /* We only need to do this once per argument. */
2451 + if (pcum->aapcs_arg_processed)
2452 + return;
2453 +
2454 + pcum->aapcs_arg_processed = true;
2455 +
2456 + /* Special case: if named is false then we are handling an incoming
2457 + anonymous argument which is on the stack. */
2458 + if (!named)
2459 + return;
2460 +
2461 + /* Is this a potential co-processor register candidate? */
2462 + if (pcum->pcs_variant != ARM_PCS_AAPCS)
2463 + {
2464 + int slot = aapcs_select_call_coproc (pcum, mode, type);
2465 + pcum->aapcs_cprc_slot = slot;
2466 +
2467 + /* We don't have to apply any of the rules from part B of the
2468 + preparation phase, these are handled elsewhere in the
2469 + compiler. */
2470 +
2471 + if (slot >= 0)
2472 + {
2473 + /* A Co-processor register candidate goes either in its own
2474 + class of registers or on the stack. */
2475 + if (!pcum->aapcs_cprc_failed[slot])
2476 + {
2477 + /* C1.cp - Try to allocate the argument to co-processor
2478 + registers. */
2479 + if (aapcs_cp_arg_layout[slot].allocate (pcum, mode, type))
2480 + return;
2481 +
2482 + /* C2.cp - Put the argument on the stack and note that we
2483 + can't assign any more candidates in this slot. We also
2484 + need to note that we have allocated stack space, so that
2485 + we won't later try to split a non-cprc candidate between
2486 + core registers and the stack. */
2487 + pcum->aapcs_cprc_failed[slot] = true;
2488 + pcum->can_split = false;
2489 + }
2490 +
2491 + /* We didn't get a register, so this argument goes on the
2492 + stack. */
2493 + gcc_assert (pcum->can_split == false);
2494 + return;
2495 + }
2496 + }
2497 +
2498 + /* C3 - For double-word aligned arguments, round the NCRN up to the
2499 + next even number. */
2500 + ncrn = pcum->aapcs_ncrn;
2501 + if ((ncrn & 1) && arm_needs_doubleword_align (mode, type))
2502 + ncrn++;
2503 +
2504 + nregs = ARM_NUM_REGS2(mode, type);
2505 +
2506 + /* Sigh, this test should really assert that nregs > 0, but a GCC
2507 + extension allows empty structs and then gives them empty size; it
2508 + then allows such a structure to be passed by value. For some of
2509 + the code below we have to pretend that such an argument has
2510 + non-zero size so that we 'locate' it correctly either in
2511 + registers or on the stack. */
2512 + gcc_assert (nregs >= 0);
2513 +
2514 + nregs2 = nregs ? nregs : 1;
2515 +
2516 + /* C4 - Argument fits entirely in core registers. */
2517 + if (ncrn + nregs2 <= NUM_ARG_REGS)
2518 + {
2519 + pcum->aapcs_reg = gen_rtx_REG (mode, ncrn);
2520 + pcum->aapcs_next_ncrn = ncrn + nregs;
2521 + return;
2522 + }
2523 +
2524 + /* C5 - Some core registers left and there are no arguments already
2525 + on the stack: split this argument between the remaining core
2526 + registers and the stack. */
2527 + if (ncrn < NUM_ARG_REGS && pcum->can_split)
2528 + {
2529 + pcum->aapcs_reg = gen_rtx_REG (mode, ncrn);
2530 + pcum->aapcs_next_ncrn = NUM_ARG_REGS;
2531 + pcum->aapcs_partial = (NUM_ARG_REGS - ncrn) * UNITS_PER_WORD;
2532 + return;
2533 + }
2534 +
2535 + /* C6 - NCRN is set to 4. */
2536 + pcum->aapcs_next_ncrn = NUM_ARG_REGS;
2537 +
2538 + /* C7,C8 - arugment goes on the stack. We have nothing to do here. */
2539 + return;
2540 +}
2541 +
2542 /* Initialize a variable CUM of type CUMULATIVE_ARGS
2543 for a call to a function whose data type is FNTYPE.
2544 For a library call, FNTYPE is NULL. */
2545 void
2546 arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype,
2547 - rtx libname ATTRIBUTE_UNUSED,
2548 + rtx libname,
2549 tree fndecl ATTRIBUTE_UNUSED)
2550 {
2551 + /* Long call handling. */
2552 + if (fntype)
2553 + pcum->pcs_variant = arm_get_pcs_model (fntype, fndecl);
2554 + else
2555 + pcum->pcs_variant = arm_pcs_default;
2556 +
2557 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2558 + {
2559 + /* XXX We should also detect some library calls here and handle
2560 + them using the base rules too; for example the floating point
2561 + support functions always work this way. */
2562 +
2563 + if (rtx_equal_p (libname,
2564 + convert_optab_libfunc (sfix_optab, DImode, DFmode))
2565 + || rtx_equal_p (libname,
2566 + convert_optab_libfunc (ufix_optab, DImode, DFmode))
2567 + || rtx_equal_p (libname,
2568 + convert_optab_libfunc (sfix_optab, DImode, SFmode))
2569 + || rtx_equal_p (libname,
2570 + convert_optab_libfunc (ufix_optab, DImode, SFmode))
2571 + || rtx_equal_p (libname,
2572 + convert_optab_libfunc (trunc_optab, HFmode, SFmode))
2573 + || rtx_equal_p (libname,
2574 + convert_optab_libfunc (sext_optab, SFmode, HFmode)))
2575 + pcum->pcs_variant = ARM_PCS_AAPCS;
2576 +
2577 + pcum->aapcs_ncrn = pcum->aapcs_next_ncrn = 0;
2578 + pcum->aapcs_reg = NULL_RTX;
2579 + pcum->aapcs_partial = 0;
2580 + pcum->aapcs_arg_processed = false;
2581 + pcum->aapcs_cprc_slot = -1;
2582 + pcum->can_split = true;
2583 +
2584 + if (pcum->pcs_variant != ARM_PCS_AAPCS)
2585 + {
2586 + int i;
2587 +
2588 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2589 + {
2590 + pcum->aapcs_cprc_failed[i] = false;
2591 + aapcs_cp_arg_layout[i].cum_init (pcum, fntype, libname, fndecl);
2592 + }
2593 + }
2594 + return;
2595 + }
2596 +
2597 + /* Legacy ABIs */
2598 +
2599 /* On the ARM, the offset starts at 0. */
2600 pcum->nregs = 0;
2601 pcum->iwmmxt_nregs = 0;
2602 @@ -3120,6 +4189,17 @@
2603 {
2604 int nregs;
2605
2606 + /* Handle the special case quickly. Pick an arbitrary value for op2 of
2607 + a call insn (op3 of a call_value insn). */
2608 + if (mode == VOIDmode)
2609 + return const0_rtx;
2610 +
2611 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2612 + {
2613 + aapcs_layout_arg (pcum, mode, type, named);
2614 + return pcum->aapcs_reg;
2615 + }
2616 +
2617 /* Varargs vectors are treated the same as long long.
2618 named_count avoids having to change the way arm handles 'named' */
2619 if (TARGET_IWMMXT_ABI
2620 @@ -3161,10 +4241,16 @@
2621
2622 static int
2623 arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2624 - tree type, bool named ATTRIBUTE_UNUSED)
2625 + tree type, bool named)
2626 {
2627 int nregs = pcum->nregs;
2628
2629 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2630 + {
2631 + aapcs_layout_arg (pcum, mode, type, named);
2632 + return pcum->aapcs_partial;
2633 + }
2634 +
2635 if (TARGET_IWMMXT_ABI && arm_vector_mode_supported_p (mode))
2636 return 0;
2637
2638 @@ -3173,7 +4259,40 @@
2639 && pcum->can_split)
2640 return (NUM_ARG_REGS - nregs) * UNITS_PER_WORD;
2641
2642 - return 0;
2643 + return 0;
2644 +}
2645 +
2646 +void
2647 +arm_function_arg_advance (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2648 + tree type, bool named)
2649 +{
2650 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2651 + {
2652 + aapcs_layout_arg (pcum, mode, type, named);
2653 +
2654 + if (pcum->aapcs_cprc_slot >= 0)
2655 + {
2656 + aapcs_cp_arg_layout[pcum->aapcs_cprc_slot].advance (pcum, mode,
2657 + type);
2658 + pcum->aapcs_cprc_slot = -1;
2659 + }
2660 +
2661 + /* Generic stuff. */
2662 + pcum->aapcs_arg_processed = false;
2663 + pcum->aapcs_ncrn = pcum->aapcs_next_ncrn;
2664 + pcum->aapcs_reg = NULL_RTX;
2665 + pcum->aapcs_partial = 0;
2666 + }
2667 + else
2668 + {
2669 + pcum->nargs += 1;
2670 + if (arm_vector_mode_supported_p (mode)
2671 + && pcum->named_count > pcum->nargs
2672 + && TARGET_IWMMXT_ABI)
2673 + pcum->iwmmxt_nregs += 1;
2674 + else
2675 + pcum->nregs += ARM_NUM_REGS2 (mode, type);
2676 + }
2677 }
2678
2679 /* Variable sized types are passed by reference. This is a GCC
2680 @@ -3226,6 +4345,8 @@
2681 /* Whereas these functions are always known to reside within the 26 bit
2682 addressing range. */
2683 { "short_call", 0, 0, false, true, true, NULL },
2684 + /* Specify the procedure call conventions for a function. */
2685 + { "pcs", 1, 1, false, true, true, arm_handle_pcs_attribute },
2686 /* Interrupt Service Routines have special prologue and epilogue requirements. */
2687 { "isr", 0, 1, false, false, false, arm_handle_isr_attribute },
2688 { "interrupt", 0, 1, false, false, false, arm_handle_isr_attribute },
2689 @@ -3328,6 +4449,21 @@
2690 return NULL_TREE;
2691 }
2692
2693 +/* Handle a "pcs" attribute; arguments as in struct
2694 + attribute_spec.handler. */
2695 +static tree
2696 +arm_handle_pcs_attribute (tree *node ATTRIBUTE_UNUSED, tree name, tree args,
2697 + int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
2698 +{
2699 + if (arm_pcs_from_attribute (args) == ARM_PCS_UNKNOWN)
2700 + {
2701 + warning (OPT_Wattributes, "%qs attribute ignored",
2702 + IDENTIFIER_POINTER (name));
2703 + *no_add_attrs = true;
2704 + }
2705 + return NULL_TREE;
2706 +}
2707 +
2708 #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
2709 /* Handle the "notshared" attribute. This attribute is another way of
2710 requesting hidden visibility. ARM's compiler supports
2711 @@ -3489,7 +4625,7 @@
2712
2713 /* Return nonzero if it is ok to make a tail-call to DECL. */
2714 static bool
2715 -arm_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
2716 +arm_function_ok_for_sibcall (tree decl, tree exp)
2717 {
2718 unsigned long func_type;
2719
2720 @@ -3522,6 +4658,21 @@
2721 if (IS_INTERRUPT (func_type))
2722 return false;
2723
2724 + if (!VOID_TYPE_P (TREE_TYPE (DECL_RESULT (cfun->decl))))
2725 + {
2726 + /* Check that the return value locations are the same. For
2727 + example that we aren't returning a value from the sibling in
2728 + a VFP register but then need to transfer it to a core
2729 + register. */
2730 + rtx a, b;
2731 +
2732 + a = arm_function_value (TREE_TYPE (exp), decl, false);
2733 + b = arm_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)),
2734 + cfun->decl, false);
2735 + if (!rtx_equal_p (a, b))
2736 + return false;
2737 + }
2738 +
2739 /* Never tailcall if function may be called with a misaligned SP. */
2740 if (IS_STACKALIGN (func_type))
2741 return false;
2742 @@ -4120,6 +5271,7 @@
2743 if (GET_MODE_SIZE (mode) <= 4
2744 && ! (arm_arch4
2745 && (mode == HImode
2746 + || mode == HFmode
2747 || (mode == QImode && outer == SIGN_EXTEND))))
2748 {
2749 if (code == MULT)
2750 @@ -4148,13 +5300,15 @@
2751 load. */
2752 if (arm_arch4)
2753 {
2754 - if (mode == HImode || (outer == SIGN_EXTEND && mode == QImode))
2755 + if (mode == HImode
2756 + || mode == HFmode
2757 + || (outer == SIGN_EXTEND && mode == QImode))
2758 range = 256;
2759 else
2760 range = 4096;
2761 }
2762 else
2763 - range = (mode == HImode) ? 4095 : 4096;
2764 + range = (mode == HImode || mode == HFmode) ? 4095 : 4096;
2765
2766 return (code == CONST_INT
2767 && INTVAL (index) < range
2768 @@ -4325,7 +5479,8 @@
2769 return 1;
2770
2771 /* This is PC relative data after arm_reorg runs. */
2772 - else if (GET_MODE_SIZE (mode) >= 4 && reload_completed
2773 + else if ((GET_MODE_SIZE (mode) >= 4 || mode == HFmode)
2774 + && reload_completed
2775 && (GET_CODE (x) == LABEL_REF
2776 || (GET_CODE (x) == CONST
2777 && GET_CODE (XEXP (x, 0)) == PLUS
2778 @@ -5024,7 +6179,7 @@
2779 case UMOD:
2780 if (TARGET_HARD_FLOAT && mode == SFmode)
2781 *total = COSTS_N_INSNS (2);
2782 - else if (TARGET_HARD_FLOAT && mode == DFmode)
2783 + else if (TARGET_HARD_FLOAT && mode == DFmode && !TARGET_VFP_SINGLE)
2784 *total = COSTS_N_INSNS (4);
2785 else
2786 *total = COSTS_N_INSNS (20);
2787 @@ -5063,23 +6218,6 @@
2788 return true;
2789
2790 case MINUS:
2791 - if (TARGET_THUMB2)
2792 - {
2793 - if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2794 - {
2795 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2796 - *total = COSTS_N_INSNS (1);
2797 - else
2798 - *total = COSTS_N_INSNS (20);
2799 - }
2800 - else
2801 - *total = COSTS_N_INSNS (ARM_NUM_REGS (mode));
2802 - /* Thumb2 does not have RSB, so all arguments must be
2803 - registers (subtracting a constant is canonicalized as
2804 - addition of the negated constant). */
2805 - return false;
2806 - }
2807 -
2808 if (mode == DImode)
2809 {
2810 *total = COSTS_N_INSNS (ARM_NUM_REGS (mode));
2811 @@ -5102,7 +6240,9 @@
2812
2813 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2814 {
2815 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2816 + if (TARGET_HARD_FLOAT
2817 + && (mode == SFmode
2818 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2819 {
2820 *total = COSTS_N_INSNS (1);
2821 if (GET_CODE (XEXP (x, 0)) == CONST_DOUBLE
2822 @@ -5143,6 +6283,17 @@
2823 return true;
2824 }
2825
2826 + /* A shift as a part of RSB costs no more than RSB itself. */
2827 + if (GET_CODE (XEXP (x, 0)) == MULT
2828 + && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
2829 + && ((INTVAL (XEXP (XEXP (x, 0), 1))
2830 + & (INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0))
2831 + {
2832 + *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, speed);
2833 + *total += rtx_cost (XEXP (x, 1), code, speed);
2834 + return true;
2835 + }
2836 +
2837 if (subcode == MULT
2838 && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
2839 && ((INTVAL (XEXP (XEXP (x, 1), 1)) &
2840 @@ -5164,6 +6315,19 @@
2841 return true;
2842 }
2843
2844 + /* MLS is just as expensive as its underlying multiplication.
2845 + Exclude a shift by a constant, which is expressed as a
2846 + multiplication. */
2847 + if (TARGET_32BIT && arm_arch_thumb2
2848 + && GET_CODE (XEXP (x, 1)) == MULT
2849 + && ! (GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
2850 + && ((INTVAL (XEXP (XEXP (x, 1), 1)) &
2851 + (INTVAL (XEXP (XEXP (x, 1), 1)) - 1)) == 0)))
2852 + {
2853 + /* The cost comes from the cost of the multiply. */
2854 + return false;
2855 + }
2856 +
2857 /* Fall through */
2858
2859 case PLUS:
2860 @@ -5192,7 +6356,9 @@
2861
2862 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2863 {
2864 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2865 + if (TARGET_HARD_FLOAT
2866 + && (mode == SFmode
2867 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2868 {
2869 *total = COSTS_N_INSNS (1);
2870 if (GET_CODE (XEXP (x, 1)) == CONST_DOUBLE
2871 @@ -5307,7 +6473,9 @@
2872 case NEG:
2873 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2874 {
2875 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2876 + if (TARGET_HARD_FLOAT
2877 + && (mode == SFmode
2878 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2879 {
2880 *total = COSTS_N_INSNS (1);
2881 return false;
2882 @@ -5460,7 +6628,9 @@
2883 case ABS:
2884 if (GET_MODE_CLASS (mode == MODE_FLOAT))
2885 {
2886 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2887 + if (TARGET_HARD_FLOAT
2888 + && (mode == SFmode
2889 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2890 {
2891 *total = COSTS_N_INSNS (1);
2892 return false;
2893 @@ -5563,7 +6733,8 @@
2894 return true;
2895
2896 case CONST_DOUBLE:
2897 - if (TARGET_HARD_FLOAT && vfp3_const_double_rtx (x))
2898 + if (TARGET_HARD_FLOAT && vfp3_const_double_rtx (x)
2899 + && (mode == SFmode || !TARGET_VFP_SINGLE))
2900 *total = COSTS_N_INSNS (1);
2901 else
2902 *total = COSTS_N_INSNS (4);
2903 @@ -5638,7 +6809,8 @@
2904 return false;
2905
2906 case MINUS:
2907 - if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT)
2908 + if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT
2909 + && (mode == SFmode || !TARGET_VFP_SINGLE))
2910 {
2911 *total = COSTS_N_INSNS (1);
2912 return false;
2913 @@ -5668,7 +6840,8 @@
2914 return false;
2915
2916 case PLUS:
2917 - if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT)
2918 + if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT
2919 + && (mode == SFmode || !TARGET_VFP_SINGLE))
2920 {
2921 *total = COSTS_N_INSNS (1);
2922 return false;
2923 @@ -5698,7 +6871,8 @@
2924 return false;
2925
2926 case NEG:
2927 - if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT)
2928 + if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT
2929 + && (mode == SFmode || !TARGET_VFP_SINGLE))
2930 {
2931 *total = COSTS_N_INSNS (1);
2932 return false;
2933 @@ -5722,7 +6896,8 @@
2934 return false;
2935
2936 case ABS:
2937 - if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT)
2938 + if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT
2939 + && (mode == SFmode || !TARGET_VFP_SINGLE))
2940 *total = COSTS_N_INSNS (1);
2941 else
2942 *total = COSTS_N_INSNS (1 + ARM_NUM_REGS (mode));
2943 @@ -5939,7 +7114,9 @@
2944
2945 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2946 {
2947 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2948 + if (TARGET_HARD_FLOAT
2949 + && (mode == SFmode
2950 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2951 {
2952 *total = COSTS_N_INSNS (1);
2953 return false;
2954 @@ -6096,7 +7273,9 @@
2955
2956 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2957 {
2958 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2959 + if (TARGET_HARD_FLOAT
2960 + && (mode == SFmode
2961 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2962 {
2963 *total = COSTS_N_INSNS (1);
2964 return false;
2965 @@ -6919,10 +8098,13 @@
2966 }
2967
2968 /* Return TRUE if OP is a memory operand which we can load or store a vector
2969 - to/from. If CORE is true, we're moving from ARM registers not Neon
2970 - registers. */
2971 + to/from. TYPE is one of the following values:
2972 + 0 - Vector load/stor (vldr)
2973 + 1 - Core registers (ldm)
2974 + 2 - Element/structure loads (vld1)
2975 + */
2976 int
2977 -neon_vector_mem_operand (rtx op, bool core)
2978 +neon_vector_mem_operand (rtx op, int type)
2979 {
2980 rtx ind;
2981
2982 @@ -6955,23 +8137,16 @@
2983 return arm_address_register_rtx_p (ind, 0);
2984
2985 /* Allow post-increment with Neon registers. */
2986 - if (!core && GET_CODE (ind) == POST_INC)
2987 + if ((type != 1 && GET_CODE (ind) == POST_INC)
2988 + || (type == 0 && GET_CODE (ind) == PRE_DEC))
2989 return arm_address_register_rtx_p (XEXP (ind, 0), 0);
2990
2991 -#if 0
2992 - /* FIXME: We can support this too if we use VLD1/VST1. */
2993 - if (!core
2994 - && GET_CODE (ind) == POST_MODIFY
2995 - && arm_address_register_rtx_p (XEXP (ind, 0), 0)
2996 - && GET_CODE (XEXP (ind, 1)) == PLUS
2997 - && rtx_equal_p (XEXP (XEXP (ind, 1), 0), XEXP (ind, 0)))
2998 - ind = XEXP (ind, 1);
2999 -#endif
3000 + /* FIXME: vld1 allows register post-modify. */
3001
3002 /* Match:
3003 (plus (reg)
3004 (const)). */
3005 - if (!core
3006 + if (type == 0
3007 && GET_CODE (ind) == PLUS
3008 && GET_CODE (XEXP (ind, 0)) == REG
3009 && REG_MODE_OK_FOR_BASE_P (XEXP (ind, 0), VOIDmode)
3010 @@ -7038,10 +8213,19 @@
3011 enum reg_class
3012 coproc_secondary_reload_class (enum machine_mode mode, rtx x, bool wb)
3013 {
3014 + if (mode == HFmode)
3015 + {
3016 + if (!TARGET_NEON_FP16)
3017 + return GENERAL_REGS;
3018 + if (s_register_operand (x, mode) || neon_vector_mem_operand (x, 2))
3019 + return NO_REGS;
3020 + return GENERAL_REGS;
3021 + }
3022 +
3023 if (TARGET_NEON
3024 && (GET_MODE_CLASS (mode) == MODE_VECTOR_INT
3025 || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
3026 - && neon_vector_mem_operand (x, FALSE))
3027 + && neon_vector_mem_operand (x, 0))
3028 return NO_REGS;
3029
3030 if (arm_coproc_mem_operand (x, wb) || s_register_operand (x, mode))
3031 @@ -7438,6 +8622,9 @@
3032 int base_reg = -1;
3033 int i;
3034
3035 + if (low_irq_latency)
3036 + return 0;
3037 +
3038 /* Can only handle 2, 3, or 4 insns at present,
3039 though could be easily extended if required. */
3040 gcc_assert (nops >= 2 && nops <= 4);
3041 @@ -7667,6 +8854,9 @@
3042 int base_reg = -1;
3043 int i;
3044
3045 + if (low_irq_latency)
3046 + return 0;
3047 +
3048 /* Can only handle 2, 3, or 4 insns at present, though could be easily
3049 extended if required. */
3050 gcc_assert (nops >= 2 && nops <= 4);
3051 @@ -7874,7 +9064,7 @@
3052
3053 As a compromise, we use ldr for counts of 1 or 2 regs, and ldm
3054 for counts of 3 or 4 regs. */
3055 - if (arm_tune_xscale && count <= 2 && ! optimize_size)
3056 + if (low_irq_latency || (arm_tune_xscale && count <= 2 && ! optimize_size))
3057 {
3058 rtx seq;
3059
3060 @@ -7937,7 +9127,7 @@
3061
3062 /* See arm_gen_load_multiple for discussion of
3063 the pros/cons of ldm/stm usage for XScale. */
3064 - if (arm_tune_xscale && count <= 2 && ! optimize_size)
3065 + if (low_irq_latency || (arm_tune_xscale && count <= 2 && ! optimize_size))
3066 {
3067 rtx seq;
3068
3069 @@ -9555,7 +10745,10 @@
3070 gcc_assert (GET_CODE (from) != BARRIER);
3071
3072 /* Count the length of this insn. */
3073 - count += get_attr_length (from);
3074 + if (LABEL_P (from) && (align_jumps > 0 || align_loops > 0))
3075 + count += MAX (align_jumps, align_loops);
3076 + else
3077 + count += get_attr_length (from);
3078
3079 /* If there is a jump table, add its length. */
3080 tmp = is_jump_table (from);
3081 @@ -9867,6 +11060,8 @@
3082 insn = table;
3083 }
3084 }
3085 + else if (LABEL_P (insn) && (align_jumps > 0 || align_loops > 0))
3086 + address += MAX (align_jumps, align_loops);
3087 }
3088
3089 fix = minipool_fix_head;
3090 @@ -10072,6 +11267,21 @@
3091 vfp_output_fldmd (FILE * stream, unsigned int base, int reg, int count)
3092 {
3093 int i;
3094 + int offset;
3095 +
3096 + if (low_irq_latency)
3097 + {
3098 + /* Output a sequence of FLDD instructions. */
3099 + offset = 0;
3100 + for (i = reg; i < reg + count; ++i, offset += 8)
3101 + {
3102 + fputc ('\t', stream);
3103 + asm_fprintf (stream, "fldd\td%d, [%r,#%d]\n", i, base, offset);
3104 + }
3105 + asm_fprintf (stream, "\tadd\tsp, sp, #%d\n", count * 8);
3106 + return;
3107 + }
3108 +
3109
3110 /* Workaround ARM10 VFPr1 bug. */
3111 if (count == 2 && !arm_arch6)
3112 @@ -10142,6 +11352,56 @@
3113 rtx tmp, reg;
3114 int i;
3115
3116 + if (low_irq_latency)
3117 + {
3118 + int saved_size;
3119 + rtx sp_insn;
3120 +
3121 + if (!count)
3122 + return 0;
3123 +
3124 + saved_size = count * GET_MODE_SIZE (DFmode);
3125 +
3126 + /* Since fstd does not have postdecrement addressing mode,
3127 + we first decrement stack pointer and then use base+offset
3128 + stores for VFP registers. The ARM EABI unwind information
3129 + can't easily describe base+offset loads, so we attach
3130 + a note for the effects of the whole block in the first insn,
3131 + and avoid marking the subsequent instructions
3132 + with RTX_FRAME_RELATED_P. */
3133 + sp_insn = gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
3134 + GEN_INT (-saved_size));
3135 + sp_insn = emit_insn (sp_insn);
3136 + RTX_FRAME_RELATED_P (sp_insn) = 1;
3137 +
3138 + dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (count + 1));
3139 + XVECEXP (dwarf, 0, 0) =
3140 + gen_rtx_SET (VOIDmode, stack_pointer_rtx,
3141 + plus_constant (stack_pointer_rtx, -saved_size));
3142 +
3143 + /* push double VFP registers to stack */
3144 + for (i = 0; i < count; ++i )
3145 + {
3146 + rtx reg;
3147 + rtx mem;
3148 + rtx addr;
3149 + rtx insn;
3150 + reg = gen_rtx_REG (DFmode, base_reg + 2*i);
3151 + addr = (i == 0) ? stack_pointer_rtx
3152 + : gen_rtx_PLUS (SImode, stack_pointer_rtx,
3153 + GEN_INT (i * GET_MODE_SIZE (DFmode)));
3154 + mem = gen_frame_mem (DFmode, addr);
3155 + insn = emit_move_insn (mem, reg);
3156 + XVECEXP (dwarf, 0, i+1) =
3157 + gen_rtx_SET (VOIDmode, mem, reg);
3158 + }
3159 +
3160 + REG_NOTES (sp_insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
3161 + REG_NOTES (sp_insn));
3162 +
3163 + return saved_size;
3164 + }
3165 +
3166 /* Workaround ARM10 VFPr1 bug. Data corruption can occur when exactly two
3167 register pairs are stored by a store multiple insn. We avoid this
3168 by pushing an extra pair. */
3169 @@ -10758,7 +12018,7 @@
3170 }
3171
3172 /* Output a move, load or store for quad-word vectors in ARM registers. Only
3173 - handles MEMs accepted by neon_vector_mem_operand with CORE=true. */
3174 + handles MEMs accepted by neon_vector_mem_operand with TYPE=1. */
3175
3176 const char *
3177 output_move_quad (rtx *operands)
3178 @@ -10954,6 +12214,12 @@
3179 ops[1] = reg;
3180 break;
3181
3182 + case PRE_DEC:
3183 + templ = "v%smdb%%?\t%%0!, %%h1";
3184 + ops[0] = XEXP (addr, 0);
3185 + ops[1] = reg;
3186 + break;
3187 +
3188 case POST_MODIFY:
3189 /* FIXME: Not currently enabled in neon_vector_mem_operand. */
3190 gcc_unreachable ();
3191 @@ -10968,7 +12234,7 @@
3192 {
3193 /* We're only using DImode here because it's a convenient size. */
3194 ops[0] = gen_rtx_REG (DImode, REGNO (reg) + 2 * i);
3195 - ops[1] = adjust_address (mem, SImode, 8 * i);
3196 + ops[1] = adjust_address (mem, DImode, 8 * i);
3197 if (reg_overlap_mentioned_p (ops[0], mem))
3198 {
3199 gcc_assert (overlap == -1);
3200 @@ -11557,7 +12823,7 @@
3201 if (count > 0)
3202 {
3203 /* Workaround ARM10 VFPr1 bug. */
3204 - if (count == 2 && !arm_arch6)
3205 + if (count == 2 && !arm_arch6 && !low_irq_latency)
3206 count++;
3207 saved += count * 8;
3208 }
3209 @@ -11886,6 +13152,41 @@
3210 return_used_this_function = 0;
3211 }
3212
3213 +/* Generate to STREAM a code sequence that pops registers identified
3214 + in REGS_MASK from SP. SP is incremented as the result.
3215 +*/
3216 +static void
3217 +print_pop_reg_by_ldr (FILE *stream, int regs_mask, int rfe)
3218 +{
3219 + int reg;
3220 +
3221 + gcc_assert (! (regs_mask & (1 << SP_REGNUM)));
3222 +
3223 + for (reg = 0; reg < PC_REGNUM; ++reg)
3224 + if (regs_mask & (1 << reg))
3225 + asm_fprintf (stream, "\tldr\t%r, [%r], #4\n",
3226 + reg, SP_REGNUM);
3227 +
3228 + if (regs_mask & (1 << PC_REGNUM))
3229 + {
3230 + if (rfe)
3231 + /* When returning from exception, we need to
3232 + copy SPSR to CPSR. There are two ways to do
3233 + that: the ldm instruction with "^" suffix,
3234 + and movs instruction. The latter would
3235 + require that we load from stack to some
3236 + scratch register, and then move to PC.
3237 + Therefore, we'd need extra instruction and
3238 + have to make sure we actually have a spare
3239 + register. Using ldm with a single register
3240 + is simler. */
3241 + asm_fprintf (stream, "\tldm\tsp!, {pc}^\n");
3242 + else
3243 + asm_fprintf (stream, "\tldr\t%r, [%r], #4\n",
3244 + PC_REGNUM, SP_REGNUM);
3245 + }
3246 +}
3247 +
3248 const char *
3249 arm_output_epilogue (rtx sibling)
3250 {
3251 @@ -11946,7 +13247,7 @@
3252 /* This variable is for the Virtual Frame Pointer, not VFP regs. */
3253 int vfp_offset = offsets->frame;
3254
3255 - if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
3256 + if (TARGET_FPA_EMU2)
3257 {
3258 for (reg = LAST_FPA_REGNUM; reg >= FIRST_FPA_REGNUM; reg--)
3259 if (df_regs_ever_live_p (reg) && !call_used_regs[reg])
3260 @@ -12169,7 +13470,7 @@
3261 SP_REGNUM, HARD_FRAME_POINTER_REGNUM);
3262 }
3263
3264 - if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
3265 + if (TARGET_FPA_EMU2)
3266 {
3267 for (reg = FIRST_FPA_REGNUM; reg <= LAST_FPA_REGNUM; reg++)
3268 if (df_regs_ever_live_p (reg) && !call_used_regs[reg])
3269 @@ -12253,22 +13554,19 @@
3270 to load use the LDR instruction - it is faster. For Thumb-2
3271 always use pop and the assembler will pick the best instruction.*/
3272 if (TARGET_ARM && saved_regs_mask == (1 << LR_REGNUM)
3273 - && !IS_INTERRUPT(func_type))
3274 + && !IS_INTERRUPT (func_type))
3275 {
3276 asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
3277 }
3278 else if (saved_regs_mask)
3279 {
3280 - if (saved_regs_mask & (1 << SP_REGNUM))
3281 - /* Note - write back to the stack register is not enabled
3282 - (i.e. "ldmfd sp!..."). We know that the stack pointer is
3283 - in the list of registers and if we add writeback the
3284 - instruction becomes UNPREDICTABLE. */
3285 - print_multi_reg (f, "ldmfd\t%r, ", SP_REGNUM, saved_regs_mask,
3286 - rfe);
3287 - else if (TARGET_ARM)
3288 - print_multi_reg (f, "ldmfd\t%r!, ", SP_REGNUM, saved_regs_mask,
3289 - rfe);
3290 + gcc_assert ( ! (saved_regs_mask & (1 << SP_REGNUM)));
3291 + if (TARGET_ARM)
3292 + if (low_irq_latency)
3293 + print_pop_reg_by_ldr (f, saved_regs_mask, rfe);
3294 + else
3295 + print_multi_reg (f, "ldmfd\t%r!, ", SP_REGNUM, saved_regs_mask,
3296 + rfe);
3297 else
3298 print_multi_reg (f, "pop\t", SP_REGNUM, saved_regs_mask, 0);
3299 }
3300 @@ -12389,6 +13687,32 @@
3301
3302 gcc_assert (num_regs && num_regs <= 16);
3303
3304 + if (low_irq_latency)
3305 + {
3306 + rtx insn = 0;
3307 +
3308 + /* Emit a series of ldr instructions rather rather than a single ldm. */
3309 + /* TODO: Use ldrd where possible. */
3310 + gcc_assert (! (mask & (1 << SP_REGNUM)));
3311 +
3312 + for (i = LAST_ARM_REGNUM; i >= 0; --i)
3313 + {
3314 + if (mask & (1 << i))
3315 +
3316 + {
3317 + rtx reg, where, mem;
3318 +
3319 + reg = gen_rtx_REG (SImode, i);
3320 + where = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx);
3321 + mem = gen_rtx_MEM (SImode, where);
3322 + insn = emit_move_insn (mem, reg);
3323 + RTX_FRAME_RELATED_P (insn) = 1;
3324 + }
3325 + }
3326 +
3327 + return insn;
3328 + }
3329 +
3330 /* We don't record the PC in the dwarf frame information. */
3331 num_dwarf_regs = num_regs;
3332 if (mask & (1 << PC_REGNUM))
3333 @@ -12737,22 +14061,23 @@
3334 {
3335 int reg = -1;
3336
3337 - for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
3338 - {
3339 - if ((offsets->saved_regs_mask & (1 << i)) == 0)
3340 - {
3341 - reg = i;
3342 - break;
3343 - }
3344 - }
3345 -
3346 - if (reg == -1 && arm_size_return_regs () <= 12
3347 - && !crtl->tail_call_emit)
3348 + /* If it is safe to use r3, then do so. This sometimes
3349 + generates better code on Thumb-2 by avoiding the need to
3350 + use 32-bit push/pop instructions. */
3351 + if (!crtl->tail_call_emit
3352 + && arm_size_return_regs () <= 12)
3353 {
3354 - /* Push/pop an argument register (r3) if all callee saved
3355 - registers are already being pushed. */
3356 reg = 3;
3357 }
3358 + else
3359 + for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
3360 + {
3361 + if ((offsets->saved_regs_mask & (1 << i)) == 0)
3362 + {
3363 + reg = i;
3364 + break;
3365 + }
3366 + }
3367
3368 if (reg != -1)
3369 {
3370 @@ -12876,7 +14201,7 @@
3371
3372 /* Save any floating point call-saved registers used by this
3373 function. */
3374 - if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
3375 + if (TARGET_FPA_EMU2)
3376 {
3377 for (reg = LAST_FPA_REGNUM; reg >= FIRST_FPA_REGNUM; reg--)
3378 if (df_regs_ever_live_p (reg) && !call_used_regs[reg])
3379 @@ -13483,7 +14808,11 @@
3380 {
3381 fprintf (stream, ", %s ", shift);
3382 if (val == -1)
3383 - arm_print_operand (stream, XEXP (x, 1), 0);
3384 + {
3385 + arm_print_operand (stream, XEXP (x, 1), 0);
3386 + if (janus2_code)
3387 + fprintf(stream, "\n\tnop");
3388 + }
3389 else
3390 fprintf (stream, "#" HOST_WIDE_INT_PRINT_DEC, val);
3391 }
3392 @@ -13704,6 +15033,30 @@
3393 }
3394 return;
3395
3396 + /* Print the high single-precision register of a VFP double-precision
3397 + register. */
3398 + case 'p':
3399 + {
3400 + int mode = GET_MODE (x);
3401 + int regno;
3402 +
3403 + if (GET_MODE_SIZE (mode) != 8 || GET_CODE (x) != REG)
3404 + {
3405 + output_operand_lossage ("invalid operand for code '%c'", code);
3406 + return;
3407 + }
3408 +
3409 + regno = REGNO (x);
3410 + if (!VFP_REGNO_OK_FOR_DOUBLE (regno))
3411 + {
3412 + output_operand_lossage ("invalid operand for code '%c'", code);
3413 + return;
3414 + }
3415 +
3416 + fprintf (stream, "s%d", regno - FIRST_VFP_REGNUM + 1);
3417 + }
3418 + return;
3419 +
3420 /* Print a VFP/Neon double precision or quad precision register name. */
3421 case 'P':
3422 case 'q':
3423 @@ -13821,6 +15174,57 @@
3424 }
3425 return;
3426
3427 + /* Memory operand for vld1/vst1 instruction. */
3428 + case 'A':
3429 + {
3430 + rtx addr;
3431 + bool postinc = FALSE;
3432 + unsigned align;
3433 +
3434 + gcc_assert (GET_CODE (x) == MEM);
3435 + addr = XEXP (x, 0);
3436 + if (GET_CODE (addr) == POST_INC)
3437 + {
3438 + postinc = 1;
3439 + addr = XEXP (addr, 0);
3440 + }
3441 + align = MEM_ALIGN (x) >> 3;
3442 + asm_fprintf (stream, "[%r", REGNO (addr));
3443 + if (align > GET_MODE_SIZE (GET_MODE (x)))
3444 + align = GET_MODE_SIZE (GET_MODE (x));
3445 + if (align >= 8)
3446 + asm_fprintf (stream, ", :%d", align << 3);
3447 + asm_fprintf (stream, "]");
3448 + if (postinc)
3449 + fputs("!", stream);
3450 + }
3451 + return;
3452 +
3453 + /* Register specifier for vld1.16/vst1.16. Translate the S register
3454 + number into a D register number and element index. */
3455 + case 'z':
3456 + {
3457 + int mode = GET_MODE (x);
3458 + int regno;
3459 +
3460 + if (GET_MODE_SIZE (mode) != 2 || GET_CODE (x) != REG)
3461 + {
3462 + output_operand_lossage ("invalid operand for code '%c'", code);
3463 + return;
3464 + }
3465 +
3466 + regno = REGNO (x);
3467 + if (!VFP_REGNO_OK_FOR_SINGLE (regno))
3468 + {
3469 + output_operand_lossage ("invalid operand for code '%c'", code);
3470 + return;
3471 + }
3472 +
3473 + regno = regno - FIRST_VFP_REGNUM;
3474 + fprintf (stream, "d%d[%d]", regno/2, ((regno % 2) ? 2 : 0));
3475 + }
3476 + return;
3477 +
3478 default:
3479 if (x == 0)
3480 {
3481 @@ -13854,6 +15258,12 @@
3482 default:
3483 gcc_assert (GET_CODE (x) != NEG);
3484 fputc ('#', stream);
3485 + if (GET_CODE (x) == HIGH)
3486 + {
3487 + fputs (":lower16:", stream);
3488 + x = XEXP (x, 0);
3489 + }
3490 +
3491 output_addr_const (stream, x);
3492 break;
3493 }
3494 @@ -14245,6 +15655,10 @@
3495 first insn after the following code_label if REVERSE is true. */
3496 rtx start_insn = insn;
3497
3498 + /* Don't do this if we're not considering conditional execution. */
3499 + if (TARGET_NO_SINGLE_COND_EXEC)
3500 + return;
3501 +
3502 /* If in state 4, check if the target branch is reached, in order to
3503 change back to state 0. */
3504 if (arm_ccfsm_state == 4)
3505 @@ -14618,6 +16032,11 @@
3506 if (mode == DFmode)
3507 return VFP_REGNO_OK_FOR_DOUBLE (regno);
3508
3509 + /* VFP registers can hold HFmode values, but there is no point in
3510 + putting them there unless we have hardware conversion insns. */
3511 + if (mode == HFmode)
3512 + return TARGET_FP16 && VFP_REGNO_OK_FOR_SINGLE (regno);
3513 +
3514 if (TARGET_NEON)
3515 return (VALID_NEON_DREG_MODE (mode) && VFP_REGNO_OK_FOR_DOUBLE (regno))
3516 || (VALID_NEON_QREG_MODE (mode)
3517 @@ -14637,16 +16056,16 @@
3518 return mode == SImode;
3519
3520 if (IS_IWMMXT_REGNUM (regno))
3521 - return VALID_IWMMXT_REG_MODE (mode);
3522 + return VALID_IWMMXT_REG_MODE (mode) && mode != SImode;
3523 }
3524
3525 - /* We allow any value to be stored in the general registers.
3526 + /* We allow almost any value to be stored in the general registers.
3527 Restrict doubleword quantities to even register pairs so that we can
3528 - use ldrd. Do not allow Neon structure opaque modes in general registers;
3529 - they would use too many. */
3530 + use ldrd. Do not allow very large Neon structure opaque modes in
3531 + general registers; they would use too many. */
3532 if (regno <= LAST_ARM_REGNUM)
3533 return !(TARGET_LDRD && GET_MODE_SIZE (mode) > 4 && (regno & 1) != 0)
3534 - && !VALID_NEON_STRUCT_MODE (mode);
3535 + && ARM_NUM_REGS (mode) <= 4;
3536
3537 if (regno == FRAME_POINTER_REGNUM
3538 || regno == ARG_POINTER_REGNUM)
3539 @@ -16103,6 +17522,15 @@
3540 }
3541
3542 static void
3543 +arm_init_fp16_builtins (void)
3544 +{
3545 + tree fp16_type = make_node (REAL_TYPE);
3546 + TYPE_PRECISION (fp16_type) = 16;
3547 + layout_type (fp16_type);
3548 + (*lang_hooks.types.register_builtin_type) (fp16_type, "__fp16");
3549 +}
3550 +
3551 +static void
3552 arm_init_builtins (void)
3553 {
3554 arm_init_tls_builtins ();
3555 @@ -16112,6 +17540,71 @@
3556
3557 if (TARGET_NEON)
3558 arm_init_neon_builtins ();
3559 +
3560 + if (arm_fp16_format)
3561 + arm_init_fp16_builtins ();
3562 +}
3563 +
3564 +/* Implement TARGET_INVALID_PARAMETER_TYPE. */
3565 +
3566 +static const char *
3567 +arm_invalid_parameter_type (const_tree t)
3568 +{
3569 + if (SCALAR_FLOAT_TYPE_P (t) && TYPE_PRECISION (t) == 16)
3570 + return N_("function parameters cannot have __fp16 type");
3571 + return NULL;
3572 +}
3573 +
3574 +/* Implement TARGET_INVALID_PARAMETER_TYPE. */
3575 +
3576 +static const char *
3577 +arm_invalid_return_type (const_tree t)
3578 +{
3579 + if (SCALAR_FLOAT_TYPE_P (t) && TYPE_PRECISION (t) == 16)
3580 + return N_("functions cannot return __fp16 type");
3581 + return NULL;
3582 +}
3583 +
3584 +/* Implement TARGET_PROMOTED_TYPE. */
3585 +
3586 +static tree
3587 +arm_promoted_type (const_tree t)
3588 +{
3589 + if (SCALAR_FLOAT_TYPE_P (t) && TYPE_PRECISION (t) == 16)
3590 + return float_type_node;
3591 + return NULL_TREE;
3592 +}
3593 +
3594 +/* Implement TARGET_CONVERT_TO_TYPE.
3595 + Specifically, this hook implements the peculiarity of the ARM
3596 + half-precision floating-point C semantics that requires conversions between
3597 + __fp16 to or from double to do an intermediate conversion to float. */
3598 +
3599 +static tree
3600 +arm_convert_to_type (tree type, tree expr)
3601 +{
3602 + tree fromtype = TREE_TYPE (expr);
3603 + if (!SCALAR_FLOAT_TYPE_P (fromtype) || !SCALAR_FLOAT_TYPE_P (type))
3604 + return NULL_TREE;
3605 + if ((TYPE_PRECISION (fromtype) == 16 && TYPE_PRECISION (type) > 32)
3606 + || (TYPE_PRECISION (type) == 16 && TYPE_PRECISION (fromtype) > 32))
3607 + return convert (type, convert (float_type_node, expr));
3608 + return NULL_TREE;
3609 +}
3610 +
3611 +/* Implement TARGET_SCALAR_MODE_SUPPORTED_P.
3612 + This simply adds HFmode as a supported mode; even though we don't
3613 + implement arithmetic on this type directly, it's supported by
3614 + optabs conversions, much the way the double-word arithmetic is
3615 + special-cased in the default hook. */
3616 +
3617 +static bool
3618 +arm_scalar_mode_supported_p (enum machine_mode mode)
3619 +{
3620 + if (mode == HFmode)
3621 + return (arm_fp16_format != ARM_FP16_FORMAT_NONE);
3622 + else
3623 + return default_scalar_mode_supported_p (mode);
3624 }
3625
3626 /* Errors in the source file can cause expand_expr to return const0_rtx
3627 @@ -17191,6 +18684,7 @@
3628 unsigned HOST_WIDE_INT mask = 0xff;
3629 int i;
3630
3631 + val = val & (unsigned HOST_WIDE_INT)0xffffffffu;
3632 if (val == 0) /* XXX */
3633 return 0;
3634
3635 @@ -18279,40 +19773,8 @@
3636 else
3637 {
3638 int set_float_abi_attributes = 0;
3639 - switch (arm_fpu_arch)
3640 - {
3641 - case FPUTYPE_FPA:
3642 - fpu_name = "fpa";
3643 - break;
3644 - case FPUTYPE_FPA_EMU2:
3645 - fpu_name = "fpe2";
3646 - break;
3647 - case FPUTYPE_FPA_EMU3:
3648 - fpu_name = "fpe3";
3649 - break;
3650 - case FPUTYPE_MAVERICK:
3651 - fpu_name = "maverick";
3652 - break;
3653 - case FPUTYPE_VFP:
3654 - fpu_name = "vfp";
3655 - set_float_abi_attributes = 1;
3656 - break;
3657 - case FPUTYPE_VFP3D16:
3658 - fpu_name = "vfpv3-d16";
3659 - set_float_abi_attributes = 1;
3660 - break;
3661 - case FPUTYPE_VFP3:
3662 - fpu_name = "vfpv3";
3663 - set_float_abi_attributes = 1;
3664 - break;
3665 - case FPUTYPE_NEON:
3666 - fpu_name = "neon";
3667 - set_float_abi_attributes = 1;
3668 - break;
3669 - default:
3670 - abort();
3671 - }
3672 - if (set_float_abi_attributes)
3673 + fpu_name = arm_fpu_desc->name;
3674 + if (arm_fp_model == ARM_FP_MODEL_VFP)
3675 {
3676 if (TARGET_HARD_FLOAT)
3677 asm_fprintf (asm_out_file, "\t.eabi_attribute 27, 3\n");
3678 @@ -18362,6 +19824,11 @@
3679 val = 6;
3680 asm_fprintf (asm_out_file, "\t.eabi_attribute 30, %d\n", val);
3681
3682 + /* Tag_ABI_FP_16bit_format. */
3683 + if (arm_fp16_format)
3684 + asm_fprintf (asm_out_file, "\t.eabi_attribute 38, %d\n",
3685 + (int)arm_fp16_format);
3686 +
3687 if (arm_lang_output_object_attributes_hook)
3688 arm_lang_output_object_attributes_hook();
3689 }
3690 @@ -18591,6 +20058,23 @@
3691 return 1;
3692 }
3693
3694 +/* Emit a fp16 constant appropriately padded to occupy a 4-byte word.
3695 + HFmode constant pool entries are actually loaded with ldr. */
3696 +void
3697 +arm_emit_fp16_const (rtx c)
3698 +{
3699 + REAL_VALUE_TYPE r;
3700 + long bits;
3701 +
3702 + REAL_VALUE_FROM_CONST_DOUBLE (r, c);
3703 + bits = real_to_target (NULL, &r, HFmode);
3704 + if (WORDS_BIG_ENDIAN)
3705 + assemble_zeros (2);
3706 + assemble_integer (GEN_INT (bits), 2, BITS_PER_WORD, 1);
3707 + if (!WORDS_BIG_ENDIAN)
3708 + assemble_zeros (2);
3709 +}
3710 +
3711 const char *
3712 arm_output_load_gr (rtx *operands)
3713 {
3714 @@ -18628,19 +20112,24 @@
3715 that way. */
3716
3717 static void
3718 -arm_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
3719 +arm_setup_incoming_varargs (CUMULATIVE_ARGS *pcum,
3720 enum machine_mode mode,
3721 tree type,
3722 int *pretend_size,
3723 int second_time ATTRIBUTE_UNUSED)
3724 {
3725 - int nregs = cum->nregs;
3726 - if (nregs & 1
3727 - && ARM_DOUBLEWORD_ALIGN
3728 - && arm_needs_doubleword_align (mode, type))
3729 - nregs++;
3730 -
3731 + int nregs;
3732 +
3733 cfun->machine->uses_anonymous_args = 1;
3734 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
3735 + {
3736 + nregs = pcum->aapcs_ncrn;
3737 + if ((nregs & 1) && arm_needs_doubleword_align (mode, type))
3738 + nregs++;
3739 + }
3740 + else
3741 + nregs = pcum->nregs;
3742 +
3743 if (nregs < NUM_ARG_REGS)
3744 *pretend_size = (NUM_ARG_REGS - nregs) * UNITS_PER_WORD;
3745 }
3746 @@ -19024,9 +20513,10 @@
3747 || mode == V16QImode || mode == V4SFmode || mode == V2DImode))
3748 return true;
3749
3750 - if ((mode == V2SImode)
3751 - || (mode == V4HImode)
3752 - || (mode == V8QImode))
3753 + if ((TARGET_NEON || TARGET_IWMMXT)
3754 + && ((mode == V2SImode)
3755 + || (mode == V4HImode)
3756 + || (mode == V8QImode)))
3757 return true;
3758
3759 return false;
3760 @@ -19057,9 +20547,14 @@
3761 if (IS_FPA_REGNUM (regno))
3762 return (TARGET_AAPCS_BASED ? 96 : 16) + regno - FIRST_FPA_REGNUM;
3763
3764 - /* FIXME: VFPv3 register numbering. */
3765 if (IS_VFP_REGNUM (regno))
3766 - return 64 + regno - FIRST_VFP_REGNUM;
3767 + {
3768 + /* See comment in arm_dwarf_register_span. */
3769 + if (VFP_REGNO_OK_FOR_SINGLE (regno))
3770 + return 64 + regno - FIRST_VFP_REGNUM;
3771 + else
3772 + return 256 + (regno - FIRST_VFP_REGNUM) / 2;
3773 + }
3774
3775 if (IS_IWMMXT_GR_REGNUM (regno))
3776 return 104 + regno - FIRST_IWMMXT_GR_REGNUM;
3777 @@ -19070,6 +20565,39 @@
3778 gcc_unreachable ();
3779 }
3780
3781 +/* Dwarf models VFPv3 registers as 32 64-bit registers.
3782 + GCC models tham as 64 32-bit registers, so we need to describe this to
3783 + the DWARF generation code. Other registers can use the default. */
3784 +static rtx
3785 +arm_dwarf_register_span(rtx rtl)
3786 +{
3787 + unsigned regno;
3788 + int nregs;
3789 + int i;
3790 + rtx p;
3791 +
3792 + regno = REGNO (rtl);
3793 + if (!IS_VFP_REGNUM (regno))
3794 + return NULL_RTX;
3795 +
3796 + /* The EABI defines two VFP register ranges:
3797 + 64-95: Legacy VFPv2 numbering for S0-S31 (obsolescent)
3798 + 256-287: D0-D31
3799 + The recommended encodings for s0-s31 is a DW_OP_bit_piece of the
3800 + corresponding D register. However gdb6.6 does not support this, so
3801 + we use the legacy encodings. We also use these encodings for D0-D15
3802 + for compatibility with older debuggers. */
3803 + if (VFP_REGNO_OK_FOR_SINGLE (regno))
3804 + return NULL_RTX;
3805 +
3806 + nregs = GET_MODE_SIZE (GET_MODE (rtl)) / 8;
3807 + p = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc(nregs));
3808 + regno = (regno - FIRST_VFP_REGNUM) / 2;
3809 + for (i = 0; i < nregs; i++)
3810 + XVECEXP (p, 0, i) = gen_rtx_REG (DImode, 256 + regno + i);
3811 +
3812 + return p;
3813 +}
3814
3815 #ifdef TARGET_UNWIND_INFO
3816 /* Emit unwind directives for a store-multiple instruction or stack pointer
3817 @@ -19556,6 +21084,7 @@
3818 case cortexr4f:
3819 case cortexa8:
3820 case cortexa9:
3821 + case marvell_f:
3822 return 2;
3823
3824 default:
3825 @@ -19620,6 +21149,10 @@
3826 return "St9__va_list";
3827 }
3828
3829 + /* Half-precision float. */
3830 + if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16)
3831 + return "Dh";
3832 +
3833 if (TREE_CODE (type) != VECTOR_TYPE)
3834 return NULL;
3835
3836 @@ -19676,6 +21209,86 @@
3837 given on the command line. */
3838 if (level > 0)
3839 flag_section_anchors = 2;
3840 +
3841 + if (size)
3842 + {
3843 + /* Select optimizations that are a win for code size.
3844 +
3845 + The inlining options set below have two important
3846 + consequences for functions not explicitly marked
3847 + inline:
3848 + - Static functions used once are inlined if
3849 + sufficiently small. Static functions used twice
3850 + are not inlined.
3851 + - Non-static functions are never inlined.
3852 + So in effect, inlining will never cause two copies
3853 + of function bodies to be created. */
3854 + /* Empirical results show that these options benefit code
3855 + size on arm. */
3856 + /* FIXME: -fsee seems to be broken for Thumb-2. */
3857 + /* flag_see = 1; */
3858 + flag_move_loop_invariants = 0;
3859 + /* In Thumb mode the function call code size overhead is typically very
3860 + small, and narrow branch instructions have very limited range.
3861 + Inlining even medium sized functions tends to bloat the caller and
3862 + require the use of long branch instructions. On average the long
3863 + branches cost more than eliminating the function call overhead saves,
3864 + so we use extremely restrictive automatic inlining heuristics. In ARM
3865 + mode the results are fairly neutral, probably due to better constant
3866 + pool placement. */
3867 + set_param_value ("max-inline-insns-single", 1);
3868 + set_param_value ("max-inline-insns-auto", 1);
3869 + }
3870 + else
3871 + {
3872 + /* CSL LOCAL */
3873 + /* Set flag_unroll_loops to a default value, so that we can tell
3874 + if it was specified on the command line; see
3875 + arm_override_options. */
3876 + flag_unroll_loops = 2;
3877 + /* Promote loop indices to int where possible. Consider moving this
3878 + to -Os, also. */
3879 + flag_promote_loop_indices = 1;
3880 + }
3881 +}
3882 +
3883 +/* Return how many instructions to look ahead for better insn
3884 + scheduling. */
3885 +static int
3886 +arm_multipass_dfa_lookahead (void)
3887 +{
3888 + return (arm_tune == marvell_f) ? 4 : 0;
3889 +}
3890 +
3891 +/* Return the minimum alignment required to load or store a
3892 + vector of the given type, which may be less than the
3893 + natural alignment of the type. */
3894 +
3895 +static int
3896 +arm_vector_min_alignment (const_tree type)
3897 +{
3898 + if (TARGET_NEON)
3899 + {
3900 + /* The NEON element load and store instructions only require the
3901 + alignment of the element type. They can benefit from higher
3902 + statically reported alignment, but we do not take advantage
3903 + of that yet. */
3904 + gcc_assert (TREE_CODE (type) == VECTOR_TYPE);
3905 + return TYPE_ALIGN_UNIT (TREE_TYPE (type));
3906 + }
3907 +
3908 + return default_vector_min_alignment (type);
3909 +}
3910 +
3911 +static bool
3912 +arm_vector_always_misalign(const_tree type ATTRIBUTE_UNUSED)
3913 +{
3914 + /* On big-endian targets array loads (vld1) and vector loads (vldm)
3915 + use a different format. Always use the "misaligned" array variant.
3916 + FIXME: this still doesn't work for big-endian because of constant
3917 + loads and other operations using vldm ordering. See
3918 + issue 6722. */
3919 + return TARGET_NEON && !BYTES_BIG_ENDIAN;
3920 }
3921
3922 #include "gt-arm.h"
3923 diff -Nur a/gcc/config/arm/arm-cores.def b/gcc/config/arm/arm-cores.def
3924 --- a/gcc/config/arm/arm-cores.def 2009-02-20 16:20:38.000000000 +0100
3925 +++ b/gcc/config/arm/arm-cores.def 2010-01-25 09:50:28.975687047 +0100
3926 @@ -104,6 +104,7 @@
3927 ARM_CORE("xscale", xscale, 5TE, FL_LDSCHED | FL_STRONG | FL_XSCALE, xscale)
3928 ARM_CORE("iwmmxt", iwmmxt, 5TE, FL_LDSCHED | FL_STRONG | FL_XSCALE | FL_IWMMXT, xscale)
3929 ARM_CORE("iwmmxt2", iwmmxt2, 5TE, FL_LDSCHED | FL_STRONG | FL_XSCALE | FL_IWMMXT, xscale)
3930 +ARM_CORE("marvell-f", marvell_f, 5TE, FL_LDSCHED | FL_VFPV2 | FL_MARVELL_F, 9e)
3931
3932 /* V5TEJ Architecture Processors */
3933 ARM_CORE("arm926ej-s", arm926ejs, 5TEJ, FL_LDSCHED, 9e)
3934 @@ -117,9 +118,13 @@
3935 ARM_CORE("mpcorenovfp", mpcorenovfp, 6K, FL_LDSCHED, 9e)
3936 ARM_CORE("mpcore", mpcore, 6K, FL_LDSCHED | FL_VFPV2, 9e)
3937 ARM_CORE("arm1156t2-s", arm1156t2s, 6T2, FL_LDSCHED, 9e)
3938 +
3939 +/* V7 Architecture Processors */
3940 +ARM_CORE("cortex-a5", cortexa5, 7A, FL_LDSCHED, 9e)
3941 ARM_CORE("cortex-a8", cortexa8, 7A, FL_LDSCHED, 9e)
3942 ARM_CORE("cortex-a9", cortexa9, 7A, FL_LDSCHED, 9e)
3943 ARM_CORE("cortex-r4", cortexr4, 7R, FL_LDSCHED, 9e)
3944 ARM_CORE("cortex-r4f", cortexr4f, 7R, FL_LDSCHED, 9e)
3945 ARM_CORE("cortex-m3", cortexm3, 7M, FL_LDSCHED, 9e)
3946 ARM_CORE("cortex-m1", cortexm1, 6M, FL_LDSCHED, 9e)
3947 +ARM_CORE("cortex-m0", cortexm0, 6M, FL_LDSCHED, 9e)
3948 diff -Nur a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
3949 --- a/gcc/config/arm/arm.h 2009-04-23 02:31:13.000000000 +0200
3950 +++ b/gcc/config/arm/arm.h 2010-01-25 09:50:28.975687047 +0100
3951 @@ -85,6 +85,10 @@
3952 builtin_define ("__IWMMXT__"); \
3953 if (TARGET_AAPCS_BASED) \
3954 builtin_define ("__ARM_EABI__"); \
3955 + if (arm_tune_marvell_f) \
3956 + builtin_define ("__ARM_TUNE_MARVELL_F__"); \
3957 + if (low_irq_latency) \
3958 + builtin_define ("__low_irq_latency__"); \
3959 } while (0)
3960
3961 /* The various ARM cores. */
3962 @@ -199,6 +203,13 @@
3963 #define TARGET_AAPCS_BASED \
3964 (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS)
3965
3966 +/* True if we should avoid generating conditional execution instructions. */
3967 +#define TARGET_NO_COND_EXEC (arm_tune_marvell_f && !optimize_size)
3968 +/* Avoid most conditional instructions, but allow pairs with opposite
3969 + conditions and the same destination. */
3970 +#define TARGET_NO_SINGLE_COND_EXEC \
3971 + ((arm_tune_cortex_a9 || arm_tune_marvell_f) && !optimize_size)
3972 +
3973 #define TARGET_HARD_TP (target_thread_pointer == TP_CP15)
3974 #define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT)
3975
3976 @@ -211,35 +222,43 @@
3977 /* Thumb-1 only. */
3978 #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
3979
3980 +#define TARGET_FPA_EMU2 (TARGET_FPA && arm_fpu_desc->rev == 2)
3981 /* The following two macros concern the ability to execute coprocessor
3982 instructions for VFPv3 or NEON. TARGET_VFP3/TARGET_VFPD32 are currently
3983 only ever tested when we know we are generating for VFP hardware; we need
3984 to be more careful with TARGET_NEON as noted below. */
3985
3986 /* FPU is has the full VFPv3/NEON register file of 32 D registers. */
3987 -#define TARGET_VFPD32 (arm_fp_model == ARM_FP_MODEL_VFP \
3988 - && (arm_fpu_arch == FPUTYPE_VFP3 \
3989 - || arm_fpu_arch == FPUTYPE_NEON))
3990 +#define TARGET_VFPD32 (TARGET_VFP && arm_arch_vfp_regs == VFP_REG_D32)
3991
3992 /* FPU supports VFPv3 instructions. */
3993 -#define TARGET_VFP3 (arm_fp_model == ARM_FP_MODEL_VFP \
3994 - && (arm_fpu_arch == FPUTYPE_VFP3D16 \
3995 - || TARGET_VFPD32))
3996 +#define TARGET_VFP3 (TARGET_VFP && arm_arch_vfp_rev >= 3)
3997 +
3998 +/* FPU only supports VFP single-precision instructions. */
3999 +#define TARGET_VFP_SINGLE (TARGET_VFP && arm_arch_vfp_regs == VFP_REG_SINGLE)
4000 +
4001 +/* FPU supports VFP double-precision instructions. */
4002 +#define TARGET_VFP_DOUBLE (TARGET_VFP && arm_arch_vfp_regs != VFP_REG_SINGLE)
4003 +
4004 +/* FPU supports half-precision floating-point with NEON element load/store. */
4005 +#define TARGET_NEON_FP16 (TARGET_VFP && arm_arch_vfp_neon && arm_arch_vfp_fp16)
4006 +
4007 +/* FPU supports VFP half-precision floating-point. */
4008 +#define TARGET_FP16 (TARGET_VFP && arm_arch_vfp_fp16)
4009
4010 /* FPU supports Neon instructions. The setting of this macro gets
4011 revealed via __ARM_NEON__ so we add extra guards upon TARGET_32BIT
4012 and TARGET_HARD_FLOAT to ensure that NEON instructions are
4013 available. */
4014 #define TARGET_NEON (TARGET_32BIT && TARGET_HARD_FLOAT \
4015 - && arm_fp_model == ARM_FP_MODEL_VFP \
4016 - && arm_fpu_arch == FPUTYPE_NEON)
4017 + && TARGET_VFP && arm_arch_vfp_neon)
4018
4019 /* "DSP" multiply instructions, eg. SMULxy. */
4020 #define TARGET_DSP_MULTIPLY \
4021 - (TARGET_32BIT && arm_arch5e && arm_arch_notm)
4022 + (TARGET_32BIT && arm_arch5e && (arm_arch_notm || arm_arch7em))
4023 /* Integer SIMD instructions, and extend-accumulate instructions. */
4024 #define TARGET_INT_SIMD \
4025 - (TARGET_32BIT && arm_arch6 && arm_arch_notm)
4026 + (TARGET_32BIT && arm_arch6 && (arm_arch_notm || arm_arch7em))
4027
4028 /* Should MOVW/MOVT be used in preference to a constant pool. */
4029 #define TARGET_USE_MOVT (arm_arch_thumb2 && !optimize_size)
4030 @@ -289,40 +308,30 @@
4031 ARM_FP_MODEL_VFP
4032 };
4033
4034 -extern enum arm_fp_model arm_fp_model;
4035 -
4036 -/* Which floating point hardware is available. Also update
4037 - fp_model_for_fpu in arm.c when adding entries to this list. */
4038 -enum fputype
4039 -{
4040 - /* No FP hardware. */
4041 - FPUTYPE_NONE,
4042 - /* Full FPA support. */
4043 - FPUTYPE_FPA,
4044 - /* Emulated FPA hardware, Issue 2 emulator (no LFM/SFM). */
4045 - FPUTYPE_FPA_EMU2,
4046 - /* Emulated FPA hardware, Issue 3 emulator. */
4047 - FPUTYPE_FPA_EMU3,
4048 - /* Cirrus Maverick floating point co-processor. */
4049 - FPUTYPE_MAVERICK,
4050 - /* VFP. */
4051 - FPUTYPE_VFP,
4052 - /* VFPv3-D16. */
4053 - FPUTYPE_VFP3D16,
4054 - /* VFPv3. */
4055 - FPUTYPE_VFP3,
4056 - /* Neon. */
4057 - FPUTYPE_NEON
4058 +enum vfp_reg_type {
4059 + VFP_REG_D16,
4060 + VFP_REG_D32,
4061 + VFP_REG_SINGLE
4062 };
4063
4064 -/* Recast the floating point class to be the floating point attribute. */
4065 -#define arm_fpu_attr ((enum attr_fpu) arm_fpu_tune)
4066 -
4067 -/* What type of floating point to tune for */
4068 -extern enum fputype arm_fpu_tune;
4069 +extern const struct arm_fpu_desc
4070 +{
4071 + const char *name;
4072 + enum arm_fp_model model;
4073 + int rev;
4074 + enum vfp_reg_type myregs;
4075 + int neon;
4076 + int fp16;
4077 +} *arm_fpu_desc;
4078 +
4079 +#define arm_fp_model arm_fpu_desc->model
4080 +#define arm_arch_vfp_rev arm_fpu_desc->rev
4081 +#define arm_arch_vfp_regs arm_fpu_desc->myregs
4082 +#define arm_arch_vfp_neon arm_fpu_desc->neon
4083 +#define arm_arch_vfp_fp16 arm_fpu_desc->fp16
4084
4085 -/* What type of floating point instructions are available */
4086 -extern enum fputype arm_fpu_arch;
4087 +/* Which floating point hardware to schedule for. */
4088 +extern int arm_fpu_attr;
4089
4090 enum float_abi_type
4091 {
4092 @@ -337,6 +346,21 @@
4093 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
4094 #endif
4095
4096 +/* Which __fp16 format to use.
4097 + The enumeration values correspond to the numbering for the
4098 + Tag_ABI_FP_16bit_format attribute.
4099 + */
4100 +enum arm_fp16_format_type
4101 +{
4102 + ARM_FP16_FORMAT_NONE = 0,
4103 + ARM_FP16_FORMAT_IEEE = 1,
4104 + ARM_FP16_FORMAT_ALTERNATIVE = 2
4105 +};
4106 +
4107 +extern enum arm_fp16_format_type arm_fp16_format;
4108 +#define LARGEST_EXPONENT_IS_NORMAL(bits) \
4109 + ((bits) == 16 && arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE)
4110 +
4111 /* Which ABI to use. */
4112 enum arm_abi_type
4113 {
4114 @@ -383,12 +407,18 @@
4115 /* Nonzero if instructions not present in the 'M' profile can be used. */
4116 extern int arm_arch_notm;
4117
4118 +/* Nonzero if instructions present in ARMv7E-M can be used. */
4119 +extern int arm_arch7em;
4120 +
4121 /* Nonzero if this chip can benefit from load scheduling. */
4122 extern int arm_ld_sched;
4123
4124 /* Nonzero if generating thumb code. */
4125 extern int thumb_code;
4126
4127 +/* Nonzero if generating Janus2 code. */
4128 +extern int janus2_code;
4129 +
4130 /* Nonzero if this chip is a StrongARM. */
4131 extern int arm_tune_strongarm;
4132
4133 @@ -404,6 +434,9 @@
4134 /* Nonzero if tuning for XScale. */
4135 extern int arm_tune_xscale;
4136
4137 +/* Nonzero if tuning for Marvell Feroceon. */
4138 +extern int arm_tune_marvell_f;
4139 +
4140 /* Nonzero if tuning for stores via the write buffer. */
4141 extern int arm_tune_wbuf;
4142
4143 @@ -423,6 +456,10 @@
4144 /* Nonzero if chip supports integer division instruction. */
4145 extern int arm_arch_hwdiv;
4146
4147 +/* Nonzero if we should minimize interrupt latency of the
4148 + generated code. */
4149 +extern int low_irq_latency;
4150 +
4151 #ifndef TARGET_DEFAULT
4152 #define TARGET_DEFAULT (MASK_APCS_FRAME)
4153 #endif
4154 @@ -757,12 +794,11 @@
4155 fixed_regs[regno] = call_used_regs[regno] = 1; \
4156 } \
4157 \
4158 - if (TARGET_THUMB && optimize_size) \
4159 - { \
4160 - /* When optimizing for size, it's better not to use \
4161 - the HI regs, because of the overhead of stacking \
4162 - them. */ \
4163 - /* ??? Is this still true for thumb2? */ \
4164 + if (TARGET_THUMB1 && optimize_size) \
4165 + { \
4166 + /* When optimizing for size on Thumb-1, it's better not \
4167 + to use the HI regs, because of the overhead of \
4168 + stacking them. */ \
4169 for (regno = FIRST_HI_REGNUM; \
4170 regno <= LAST_HI_REGNUM; ++regno) \
4171 fixed_regs[regno] = call_used_regs[regno] = 1; \
4172 @@ -881,6 +917,9 @@
4173 /* The number of (integer) argument register available. */
4174 #define NUM_ARG_REGS 4
4175
4176 +/* And similarly for the VFP. */
4177 +#define NUM_VFP_ARG_REGS 16
4178 +
4179 /* Return the register number of the N'th (integer) argument. */
4180 #define ARG_REGISTER(N) (N - 1)
4181
4182 @@ -1059,7 +1098,7 @@
4183 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
4184
4185 #define VALID_IWMMXT_REG_MODE(MODE) \
4186 - (arm_vector_mode_supported_p (MODE) || (MODE) == DImode)
4187 + (arm_vector_mode_supported_p (MODE) || (MODE) == DImode || (MODE) == SImode)
4188
4189 /* Modes valid for Neon D registers. */
4190 #define VALID_NEON_DREG_MODE(MODE) \
4191 @@ -1230,11 +1269,14 @@
4192 || reg_classes_intersect_p (VFP_REGS, (CLASS)) \
4193 : 0)
4194
4195 -/* We need to define this for LO_REGS on thumb. Otherwise we can end up
4196 - using r0-r4 for function arguments, r7 for the stack frame and don't
4197 - have enough left over to do doubleword arithmetic. */
4198 +/* We need to define this for LO_REGS on Thumb-1. Otherwise we can end up
4199 + using r0-r4 for function arguments, r7 for the stack frame and don't have
4200 + enough left over to do doubleword arithmetic. For Thumb-2 all the
4201 + potentially problematic instructions accept high registers so this is not
4202 + necessary. Care needs to be taken to avoid adding new Thumb-2 patterns
4203 + that require many low registers. */
4204 #define CLASS_LIKELY_SPILLED_P(CLASS) \
4205 - ((TARGET_THUMB && (CLASS) == LO_REGS) \
4206 + ((TARGET_THUMB1 && (CLASS) == LO_REGS) \
4207 || (CLASS) == CC_REG)
4208
4209 /* The class value for index registers, and the one for base regs. */
4210 @@ -1245,7 +1287,7 @@
4211 when addressing quantities in QI or HI mode; if we don't know the
4212 mode, then we must be conservative. */
4213 #define MODE_BASE_REG_CLASS(MODE) \
4214 - (TARGET_32BIT ? CORE_REGS : \
4215 + (TARGET_32BIT ? (TARGET_THUMB2 ? LO_REGS : CORE_REGS) : \
4216 (((MODE) == SImode) ? BASE_REGS : LO_REGS))
4217
4218 /* For Thumb we can not support SP+reg addressing, so we return LO_REGS
4219 @@ -1346,6 +1388,9 @@
4220 else if (TARGET_MAVERICK && TARGET_HARD_FLOAT) \
4221 /* Need to be careful, -256 is not a valid offset. */ \
4222 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
4223 + else if (TARGET_REALLY_IWMMXT && MODE == SImode) \
4224 + /* Need to be careful, -1024 is not a valid offset. */ \
4225 + low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff); \
4226 else if (MODE == SImode \
4227 || (MODE == SFmode && TARGET_SOFT_FLOAT) \
4228 || ((MODE == HImode || MODE == QImode) && ! arm_arch4)) \
4229 @@ -1416,13 +1461,17 @@
4230 /* If defined, gives a class of registers that cannot be used as the
4231 operand of a SUBREG that changes the mode of the object illegally. */
4232
4233 -/* Moves between FPA_REGS and GENERAL_REGS are two memory insns. */
4234 +/* Moves between FPA_REGS and GENERAL_REGS are two memory insns.
4235 + Moves between VFP_REGS and GENERAL_REGS are a single insn, but
4236 + it is typically more expensive than a single memory access. We set
4237 + the cost to less than two memory accesses so that floating
4238 + point to integer conversion does not go through memory. */
4239 #define REGISTER_MOVE_COST(MODE, FROM, TO) \
4240 (TARGET_32BIT ? \
4241 ((FROM) == FPA_REGS && (TO) != FPA_REGS ? 20 : \
4242 (FROM) != FPA_REGS && (TO) == FPA_REGS ? 20 : \
4243 - IS_VFP_CLASS (FROM) && !IS_VFP_CLASS (TO) ? 10 : \
4244 - !IS_VFP_CLASS (FROM) && IS_VFP_CLASS (TO) ? 10 : \
4245 + IS_VFP_CLASS (FROM) && !IS_VFP_CLASS (TO) ? 15 : \
4246 + !IS_VFP_CLASS (FROM) && IS_VFP_CLASS (TO) ? 15 : \
4247 (FROM) == IWMMXT_REGS && (TO) != IWMMXT_REGS ? 4 : \
4248 (FROM) != IWMMXT_REGS && (TO) == IWMMXT_REGS ? 4 : \
4249 (FROM) == IWMMXT_GR_REGS || (TO) == IWMMXT_GR_REGS ? 20 : \
4250 @@ -1491,9 +1540,10 @@
4251
4252 /* Define how to find the value returned by a library function
4253 assuming the value has mode MODE. */
4254 -#define LIBCALL_VALUE(MODE) \
4255 - (TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
4256 - && GET_MODE_CLASS (MODE) == MODE_FLOAT \
4257 +#define LIBCALL_VALUE(MODE) \
4258 + (TARGET_AAPCS_BASED ? aapcs_libcall_value (MODE) \
4259 + : (TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
4260 + && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
4261 ? gen_rtx_REG (MODE, FIRST_FPA_REGNUM) \
4262 : TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK \
4263 && GET_MODE_CLASS (MODE) == MODE_FLOAT \
4264 @@ -1502,22 +1552,16 @@
4265 ? gen_rtx_REG (MODE, FIRST_IWMMXT_REGNUM) \
4266 : gen_rtx_REG (MODE, ARG_REGISTER (1)))
4267
4268 -/* Define how to find the value returned by a function.
4269 - VALTYPE is the data type of the value (as a tree).
4270 - If the precise function being called is known, FUNC is its FUNCTION_DECL;
4271 - otherwise, FUNC is 0. */
4272 -#define FUNCTION_VALUE(VALTYPE, FUNC) \
4273 - arm_function_value (VALTYPE, FUNC);
4274 -
4275 -/* 1 if N is a possible register number for a function value.
4276 - On the ARM, only r0 and f0 can return results. */
4277 -/* On a Cirrus chip, mvf0 can return results. */
4278 -#define FUNCTION_VALUE_REGNO_P(REGNO) \
4279 - ((REGNO) == ARG_REGISTER (1) \
4280 - || (TARGET_32BIT && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
4281 - && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
4282 - || ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
4283 - || (TARGET_32BIT && ((REGNO) == FIRST_FPA_REGNUM) \
4284 +/* 1 if REGNO is a possible register number for a function value. */
4285 +#define FUNCTION_VALUE_REGNO_P(REGNO) \
4286 + ((REGNO) == ARG_REGISTER (1) \
4287 + || (TARGET_AAPCS_BASED && TARGET_32BIT \
4288 + && TARGET_VFP && TARGET_HARD_FLOAT \
4289 + && (REGNO) == FIRST_VFP_REGNUM) \
4290 + || (TARGET_32BIT && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
4291 + && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
4292 + || ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
4293 + || (TARGET_32BIT && ((REGNO) == FIRST_FPA_REGNUM) \
4294 && TARGET_HARD_FLOAT_ABI && TARGET_FPA))
4295
4296 /* Amount of memory needed for an untyped call to save all possible return
4297 @@ -1617,9 +1661,27 @@
4298 that is in text_section. */
4299 extern GTY(()) rtx thumb_call_via_label[14];
4300
4301 +/* The number of potential ways of assigning to a co-processor. */
4302 +#define ARM_NUM_COPROC_SLOTS 1
4303 +
4304 +/* Enumeration of procedure calling standard variants. We don't really
4305 + support all of these yet. */
4306 +enum arm_pcs
4307 +{
4308 + ARM_PCS_AAPCS, /* Base standard AAPCS. */
4309 + ARM_PCS_AAPCS_VFP, /* Use VFP registers for floating point values. */
4310 + ARM_PCS_AAPCS_IWMMXT, /* Use iWMMXT registers for vectors. */
4311 + /* This must be the last AAPCS variant. */
4312 + ARM_PCS_AAPCS_LOCAL, /* Private call within this compilation unit. */
4313 + ARM_PCS_ATPCS, /* ATPCS. */
4314 + ARM_PCS_APCS, /* APCS (legacy Linux etc). */
4315 + ARM_PCS_UNKNOWN
4316 +};
4317 +
4318 +/* We can't define this inside a generator file because it needs enum
4319 + machine_mode. */
4320 /* A C type for declaring a variable that is used as the first argument of
4321 - `FUNCTION_ARG' and other related values. For some target machines, the
4322 - type `int' suffices and can hold the number of bytes of argument so far. */
4323 + `FUNCTION_ARG' and other related values. */
4324 typedef struct
4325 {
4326 /* This is the number of registers of arguments scanned so far. */
4327 @@ -1628,9 +1690,33 @@
4328 int iwmmxt_nregs;
4329 int named_count;
4330 int nargs;
4331 - int can_split;
4332 + /* Which procedure call variant to use for this call. */
4333 + enum arm_pcs pcs_variant;
4334 +
4335 + /* AAPCS related state tracking. */
4336 + int aapcs_arg_processed; /* No need to lay out this argument again. */
4337 + int aapcs_cprc_slot; /* Index of co-processor rules to handle
4338 + this argument, or -1 if using core
4339 + registers. */
4340 + int aapcs_ncrn;
4341 + int aapcs_next_ncrn;
4342 + rtx aapcs_reg; /* Register assigned to this argument. */
4343 + int aapcs_partial; /* How many bytes are passed in regs (if
4344 + split between core regs and stack.
4345 + Zero otherwise. */
4346 + int aapcs_cprc_failed[ARM_NUM_COPROC_SLOTS];
4347 + int can_split; /* Argument can be split between core regs
4348 + and the stack. */
4349 + /* Private data for tracking VFP register allocation */
4350 + unsigned aapcs_vfp_regs_free;
4351 + unsigned aapcs_vfp_reg_alloc;
4352 + int aapcs_vfp_rcount;
4353 + /* Can't include insn-modes.h because this header is needed before we
4354 + generate it. */
4355 + int /* enum machine_mode */ aapcs_vfp_rmode;
4356 } CUMULATIVE_ARGS;
4357
4358 +
4359 /* Define where to put the arguments to a function.
4360 Value is zero to push the argument on the stack,
4361 or a hard register in which to store the argument.
4362 @@ -1674,13 +1760,7 @@
4363 of mode MODE and data type TYPE.
4364 (TYPE is null for libcalls where that information may not be available.) */
4365 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
4366 - (CUM).nargs += 1; \
4367 - if (arm_vector_mode_supported_p (MODE) \
4368 - && (CUM).named_count > (CUM).nargs \
4369 - && TARGET_IWMMXT_ABI) \
4370 - (CUM).iwmmxt_nregs += 1; \
4371 - else \
4372 - (CUM).nregs += ARM_NUM_REGS2 (MODE, TYPE)
4373 + arm_function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
4374
4375 /* If defined, a C expression that gives the alignment boundary, in bits, of an
4376 argument with the specified mode and type. If it is not defined,
4377 @@ -1692,9 +1772,11 @@
4378
4379 /* 1 if N is a possible register number for function argument passing.
4380 On the ARM, r0-r3 are used to pass args. */
4381 -#define FUNCTION_ARG_REGNO_P(REGNO) \
4382 - (IN_RANGE ((REGNO), 0, 3) \
4383 - || (TARGET_IWMMXT_ABI \
4384 +#define FUNCTION_ARG_REGNO_P(REGNO) \
4385 + (IN_RANGE ((REGNO), 0, 3) \
4386 + || (TARGET_AAPCS_BASED && TARGET_VFP && TARGET_HARD_FLOAT \
4387 + && IN_RANGE ((REGNO), FIRST_VFP_REGNUM, FIRST_VFP_REGNUM + 15)) \
4388 + || (TARGET_IWMMXT_ABI \
4389 && IN_RANGE ((REGNO), FIRST_IWMMXT_REGNUM, FIRST_IWMMXT_REGNUM + 9)))
4390
4391 \f
4392 @@ -2324,7 +2406,8 @@
4393 /* Try to generate sequences that don't involve branches, we can then use
4394 conditional instructions */
4395 #define BRANCH_COST(speed_p, predictable_p) \
4396 - (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
4397 + (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \
4398 + : (optimize > 0 ? 2 : 0))
4399 \f
4400 /* Position Independent Code. */
4401 /* We decide which register to use based on the compilation options and
4402 @@ -2392,6 +2475,7 @@
4403
4404 /* The arm5 clz instruction returns 32. */
4405 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
4406 +#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
4407 \f
4408 #undef ASM_APP_OFF
4409 #define ASM_APP_OFF (TARGET_THUMB1 ? "\t.code\t16\n" : \
4410 @@ -2404,6 +2488,19 @@
4411 if (TARGET_ARM) \
4412 asm_fprintf (STREAM,"\tstmfd\t%r!,{%r}\n", \
4413 STACK_POINTER_REGNUM, REGNO); \
4414 + else if (TARGET_THUMB1 \
4415 + && (REGNO) == STATIC_CHAIN_REGNUM) \
4416 + { \
4417 + /* We can't push STATIC_CHAIN_REGNUM (r12) directly with Thumb-1.
4418 + We know that ASM_OUTPUT_REG_PUSH will be matched with
4419 + ASM_OUTPUT_REG_POP, and that r7 isn't used by the function
4420 + profiler, so we can use it as a scratch reg. WARNING: This isn't
4421 + safe in the general case! It may be sensitive to future changes
4422 + in final.c:profile_function. */ \
4423 + asm_fprintf (STREAM, "\tpush\t{r7}\n"); \
4424 + asm_fprintf (STREAM, "\tmov\tr7, %r\n", REGNO);\
4425 + asm_fprintf (STREAM, "\tpush\t{r7}\n"); \
4426 + } \
4427 else \
4428 asm_fprintf (STREAM, "\tpush {%r}\n", REGNO); \
4429 } while (0)
4430 @@ -2415,6 +2512,14 @@
4431 if (TARGET_ARM) \
4432 asm_fprintf (STREAM, "\tldmfd\t%r!,{%r}\n", \
4433 STACK_POINTER_REGNUM, REGNO); \
4434 + else if (TARGET_THUMB1 \
4435 + && (REGNO) == STATIC_CHAIN_REGNUM) \
4436 + { \
4437 + /* See comment in ASM_OUTPUT_REG_PUSH. */ \
4438 + asm_fprintf (STREAM, "\tpop\t{r7}\n"); \
4439 + asm_fprintf (STREAM, "\tmov\t%r, r7\n", REGNO);\
4440 + asm_fprintf (STREAM, "\tpop\t{r7}\n"); \
4441 + } \
4442 else \
4443 asm_fprintf (STREAM, "\tpop {%r}\n", REGNO); \
4444 } while (0)
4445 diff -Nur a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
4446 --- a/gcc/config/arm/arm.md 2009-05-16 15:28:27.000000000 +0200
4447 +++ b/gcc/config/arm/arm.md 2010-01-25 09:50:28.985687200 +0100
4448 @@ -99,6 +99,7 @@
4449 ; correctly for PIC usage.
4450 (UNSPEC_GOTSYM_OFF 24) ; The offset of the start of the the GOT from a
4451 ; a given symbolic address.
4452 + (UNSPEC_RBIT 25) ; rbit operation.
4453 ]
4454 )
4455
4456 @@ -131,6 +132,8 @@
4457 (VUNSPEC_WCMP_EQ 12) ; Used by the iWMMXt WCMPEQ instructions
4458 (VUNSPEC_WCMP_GTU 13) ; Used by the iWMMXt WCMPGTU instructions
4459 (VUNSPEC_WCMP_GT 14) ; Used by the iwMMXT WCMPGT instructions
4460 + (VUNSPEC_ALIGN16 15) ; Used to force 16-byte alignment.
4461 + (VUNSPEC_ALIGN32 16) ; Used to force 32-byte alignment.
4462 (VUNSPEC_EH_RETURN 20); Use to override the return address for exception
4463 ; handling.
4464 ]
4465 @@ -144,6 +147,10 @@
4466 ; patterns that share the same RTL in both ARM and Thumb code.
4467 (define_attr "is_thumb" "no,yes" (const (symbol_ref "thumb_code")))
4468
4469 +; FIX_JANUS is set to 'yes' when compiling for Janus2, it causes to
4470 +; add a nop after shifts, in order to work around a Janus2 bug
4471 +(define_attr "fix_janus" "no,yes" (const (symbol_ref "janus2_code")))
4472 +
4473 ; IS_STRONGARM is set to 'yes' when compiling for StrongARM, it affects
4474 ; scheduling decisions for the load unit and the multiplier.
4475 (define_attr "is_strongarm" "no,yes" (const (symbol_ref "arm_tune_strongarm")))
4476 @@ -158,7 +165,7 @@
4477 ; Floating Point Unit. If we only have floating point emulation, then there
4478 ; is no point in scheduling the floating point insns. (Well, for best
4479 ; performance we should try and group them together).
4480 -(define_attr "fpu" "none,fpa,fpe2,fpe3,maverick,vfp,vfpv3d16,vfpv3,neon"
4481 +(define_attr "fpu" "none,fpa,fpe2,fpe3,maverick,vfp"
4482 (const (symbol_ref "arm_fpu_attr")))
4483
4484 ; LENGTH of an instruction (in bytes)
4485 @@ -185,7 +192,7 @@
4486 ;; scheduling information.
4487
4488 (define_attr "insn"
4489 - "mov,mvn,smulxy,smlaxy,smlalxy,smulwy,smlawx,mul,muls,mla,mlas,umull,umulls,umlal,umlals,smull,smulls,smlal,smlals,smlawy,smuad,smuadx,smlad,smladx,smusd,smusdx,smlsd,smlsdx,smmul,smmulr,smmla,umaal,smlald,smlsld,clz,mrs,msr,xtab,sdiv,udiv,other"
4490 + "mov,mvn,and,orr,eor,smulxy,smlaxy,smlalxy,smulwy,smlawx,mul,muls,mla,mlas,umull,umulls,umlal,umlals,smull,smulls,smlal,smlals,smlawy,smuad,smuadx,smlad,smladx,smusd,smusdx,smlsd,smlsdx,smmul,smmulr,smmla,umaal,smlald,smlsld,clz,mrs,msr,xtab,sdiv,udiv,other"
4491 (const_string "other"))
4492
4493 ; TYPE attribute is used to detect floating point instructions which, if
4494 @@ -251,8 +258,6 @@
4495 (define_attr "ldsched" "no,yes" (const (symbol_ref "arm_ld_sched")))
4496
4497 ;; Classification of NEON instructions for scheduling purposes.
4498 -;; Do not set this attribute and the "type" attribute together in
4499 -;; any one instruction pattern.
4500 (define_attr "neon_type"
4501 "neon_int_1,\
4502 neon_int_2,\
4503 @@ -415,7 +420,7 @@
4504
4505 (define_attr "generic_sched" "yes,no"
4506 (const (if_then_else
4507 - (ior (eq_attr "tune" "arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa8,cortexa9")
4508 + (ior (eq_attr "tune" "arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa8,cortexa9,marvell_f")
4509 (eq_attr "tune_cortexr4" "yes"))
4510 (const_string "no")
4511 (const_string "yes"))))
4512 @@ -423,7 +428,7 @@
4513 (define_attr "generic_vfp" "yes,no"
4514 (const (if_then_else
4515 (and (eq_attr "fpu" "vfp")
4516 - (eq_attr "tune" "!arm1020e,arm1022e,cortexa8,cortexa9")
4517 + (eq_attr "tune" "!arm1020e,arm1022e,cortexa8,cortexa9,marvell_f")
4518 (eq_attr "tune_cortexr4" "no"))
4519 (const_string "yes")
4520 (const_string "no"))))
4521 @@ -437,6 +442,8 @@
4522 (include "cortex-a9.md")
4523 (include "cortex-r4.md")
4524 (include "cortex-r4f.md")
4525 +(include "marvell-f.md")
4526 +(include "marvell-f-vfp.md")
4527 (include "vfp11.md")
4528
4529 \f
4530 @@ -472,9 +479,9 @@
4531 if (TARGET_THUMB1)
4532 {
4533 if (GET_CODE (operands[1]) != REG)
4534 - operands[1] = force_reg (SImode, operands[1]);
4535 + operands[1] = force_reg (DImode, operands[1]);
4536 if (GET_CODE (operands[2]) != REG)
4537 - operands[2] = force_reg (SImode, operands[2]);
4538 + operands[2] = force_reg (DImode, operands[2]);
4539 }
4540 "
4541 )
4542 @@ -620,10 +627,11 @@
4543 sub%?\\t%0, %1, #%n2
4544 sub%?\\t%0, %1, #%n2
4545 #"
4546 - "TARGET_32BIT &&
4547 - GET_CODE (operands[2]) == CONST_INT
4548 + "TARGET_32BIT
4549 + && GET_CODE (operands[2]) == CONST_INT
4550 && !(const_ok_for_arm (INTVAL (operands[2]))
4551 - || const_ok_for_arm (-INTVAL (operands[2])))"
4552 + || const_ok_for_arm (-INTVAL (operands[2])))
4553 + && (reload_completed || !arm_eliminable_register (operands[1]))"
4554 [(clobber (const_int 0))]
4555 "
4556 arm_split_constant (PLUS, SImode, curr_insn,
4557 @@ -639,10 +647,10 @@
4558 ;; register. Trying to reload it will always fail catastrophically,
4559 ;; so never allow those alternatives to match if reloading is needed.
4560
4561 -(define_insn "*thumb1_addsi3"
4562 - [(set (match_operand:SI 0 "register_operand" "=l,l,l,*rk,*hk,l,!k")
4563 - (plus:SI (match_operand:SI 1 "register_operand" "%0,0,l,*0,*0,!k,!k")
4564 - (match_operand:SI 2 "nonmemory_operand" "I,J,lL,*hk,*rk,!M,!O")))]
4565 +(define_insn_and_split "*thumb1_addsi3"
4566 + [(set (match_operand:SI 0 "register_operand" "=l,l,l,*rk,*hk,l,!k,l,l")
4567 + (plus:SI (match_operand:SI 1 "register_operand" "%0,0,l,*0,*0,!k,!k,0,l")
4568 + (match_operand:SI 2 "nonmemory_operand" "I,J,lL,*hk,*rk,!M,!O,Pa,Pb")))]
4569 "TARGET_THUMB1"
4570 "*
4571 static const char * const asms[] =
4572 @@ -653,7 +661,9 @@
4573 \"add\\t%0, %0, %2\",
4574 \"add\\t%0, %0, %2\",
4575 \"add\\t%0, %1, %2\",
4576 - \"add\\t%0, %1, %2\"
4577 + \"add\\t%0, %1, %2\",
4578 + \"#\",
4579 + \"#\"
4580 };
4581 if ((which_alternative == 2 || which_alternative == 6)
4582 && GET_CODE (operands[2]) == CONST_INT
4583 @@ -661,7 +671,22 @@
4584 return \"sub\\t%0, %1, #%n2\";
4585 return asms[which_alternative];
4586 "
4587 - [(set_attr "length" "2")]
4588 + "&& reload_completed && CONST_INT_P (operands[2])
4589 + && operands[1] != stack_pointer_rtx
4590 + && (INTVAL (operands[2]) > 255 || INTVAL (operands[2]) < -255)"
4591 + [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))
4592 + (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
4593 + {
4594 + HOST_WIDE_INT offset = INTVAL (operands[2]);
4595 + if (offset > 255)
4596 + offset = 255;
4597 + else if (offset < -255)
4598 + offset = -255;
4599 +
4600 + operands[3] = GEN_INT (offset);
4601 + operands[2] = GEN_INT (INTVAL (operands[2]) - offset);
4602 + }
4603 + [(set_attr "length" "2,2,2,2,2,2,2,4,4")]
4604 )
4605
4606 ;; Reloading and elimination of the frame pointer can
4607 @@ -854,7 +879,11 @@
4608 [(set_attr "conds" "use")
4609 (set (attr "type") (if_then_else (match_operand 4 "const_int_operand" "")
4610 (const_string "alu_shift")
4611 - (const_string "alu_shift_reg")))]
4612 + (const_string "alu_shift_reg")))
4613 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
4614 + (eq_attr "fix_janus" "yes"))
4615 + (const_int 8)
4616 + (const_int 4)))]
4617 )
4618
4619 (define_insn "*addsi3_carryin_alt1"
4620 @@ -938,7 +967,7 @@
4621 [(set (match_operand:DF 0 "s_register_operand" "")
4622 (plus:DF (match_operand:DF 1 "s_register_operand" "")
4623 (match_operand:DF 2 "arm_float_add_operand" "")))]
4624 - "TARGET_32BIT && TARGET_HARD_FLOAT"
4625 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
4626 "
4627 if (TARGET_MAVERICK
4628 && !cirrus_fp_register (operands[2], DFmode))
4629 @@ -1176,7 +1205,7 @@
4630 [(set (match_operand:DF 0 "s_register_operand" "")
4631 (minus:DF (match_operand:DF 1 "arm_float_rhs_operand" "")
4632 (match_operand:DF 2 "arm_float_rhs_operand" "")))]
4633 - "TARGET_32BIT && TARGET_HARD_FLOAT"
4634 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
4635 "
4636 if (TARGET_MAVERICK)
4637 {
4638 @@ -1332,6 +1361,49 @@
4639 (set_attr "predicable" "yes")]
4640 )
4641
4642 +; The combiner cannot combine the first and last insns in the
4643 +; following sequence because of the intervening insn, so help the
4644 +; combiner with this splitter. The combiner does attempt to split
4645 +; this particular combination but does not know this exact split.
4646 +; Note that the combiner puts the constant at the outermost operation
4647 +; as a part of canonicalization.
4648 +;
4649 +; mul r3, r2, r1
4650 +; <add/sub> r3, r3, <constant>
4651 +; add r3, r3, r4
4652 +
4653 +(define_split
4654 + [(set (match_operand:SI 0 "s_register_operand" "")
4655 + (match_operator:SI 1 "plusminus_operator"
4656 + [(plus:SI (mult:SI (match_operand:SI 2 "s_register_operand" "")
4657 + (match_operand:SI 3 "s_register_operand" ""))
4658 + (match_operand:SI 4 "s_register_operand" ""))
4659 + (match_operand:SI 5 "arm_immediate_operand" "")]))]
4660 + "TARGET_32BIT"
4661 + [(set (match_dup 0)
4662 + (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4663 + (match_dup 4)))
4664 + (set (match_dup 0)
4665 + (match_op_dup:SI 1 [(match_dup 0) (match_dup 5)]))]
4666 + "")
4667 +
4668 +; Likewise for MLS. MLS is available only on select architectures.
4669 +
4670 +(define_split
4671 + [(set (match_operand:SI 0 "s_register_operand" "")
4672 + (match_operator:SI 1 "plusminus_operator"
4673 + [(minus:SI (match_operand:SI 2 "s_register_operand" "")
4674 + (mult:SI (match_operand:SI 3 "s_register_operand" "")
4675 + (match_operand:SI 4 "s_register_operand" "")))
4676 + (match_operand:SI 5 "arm_immediate_operand" "")]))]
4677 + "TARGET_32BIT && arm_arch_thumb2"
4678 + [(set (match_dup 0)
4679 + (minus:SI (match_dup 2)
4680 + (mult:SI (match_dup 3) (match_dup 4))))
4681 + (set (match_dup 0)
4682 + (match_op_dup:SI 1 [(match_dup 0) (match_dup 5)]))]
4683 + "")
4684 +
4685 (define_insn "*mulsi3addsi_compare0"
4686 [(set (reg:CC_NOOV CC_REGNUM)
4687 (compare:CC_NOOV
4688 @@ -1713,7 +1785,7 @@
4689 [(set (match_operand:DF 0 "s_register_operand" "")
4690 (mult:DF (match_operand:DF 1 "s_register_operand" "")
4691 (match_operand:DF 2 "arm_float_rhs_operand" "")))]
4692 - "TARGET_32BIT && TARGET_HARD_FLOAT"
4693 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
4694 "
4695 if (TARGET_MAVERICK
4696 && !cirrus_fp_register (operands[2], DFmode))
4697 @@ -1733,7 +1805,7 @@
4698 [(set (match_operand:DF 0 "s_register_operand" "")
4699 (div:DF (match_operand:DF 1 "arm_float_rhs_operand" "")
4700 (match_operand:DF 2 "arm_float_rhs_operand" "")))]
4701 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
4702 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)"
4703 "")
4704 \f
4705 ;; Modulo insns
4706 @@ -1960,6 +2032,7 @@
4707 DONE;
4708 "
4709 [(set_attr "length" "4,4,16")
4710 + (set_attr "insn" "and")
4711 (set_attr "predicable" "yes")]
4712 )
4713
4714 @@ -1969,7 +2042,8 @@
4715 (match_operand:SI 2 "register_operand" "l")))]
4716 "TARGET_THUMB1"
4717 "and\\t%0, %0, %2"
4718 - [(set_attr "length" "2")]
4719 + [(set_attr "length" "2")
4720 + (set_attr "insn" "and")]
4721 )
4722
4723 (define_insn "*andsi3_compare0"
4724 @@ -1984,7 +2058,8 @@
4725 "@
4726 and%.\\t%0, %1, %2
4727 bic%.\\t%0, %1, #%B2"
4728 - [(set_attr "conds" "set")]
4729 + [(set_attr "conds" "set")
4730 + (set_attr "insn" "and,*")]
4731 )
4732
4733 (define_insn "*andsi3_compare0_scratch"
4734 @@ -2280,7 +2355,7 @@
4735 }
4736 }
4737
4738 - target = operands[0];
4739 + target = copy_rtx (operands[0]);
4740 /* Avoid using a subreg as a subtarget, and avoid writing a paradoxical
4741 subreg as the final target. */
4742 if (GET_CODE (target) == SUBREG)
4743 @@ -2528,7 +2603,11 @@
4744 (set_attr "shift" "2")
4745 (set (attr "type") (if_then_else (match_operand 3 "const_int_operand" "")
4746 (const_string "alu_shift")
4747 - (const_string "alu_shift_reg")))]
4748 + (const_string "alu_shift_reg")))
4749 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
4750 + (eq_attr "fix_janus" "yes"))
4751 + (const_int 8)
4752 + (const_int 4)))]
4753 )
4754
4755 (define_insn "*andsi_notsi_si_compare0"
4756 @@ -2576,6 +2655,7 @@
4757 orr%?\\t%Q0, %Q1, %2
4758 #"
4759 [(set_attr "length" "4,8")
4760 + (set_attr "insn" "orr")
4761 (set_attr "predicable" "yes")]
4762 )
4763
4764 @@ -2638,7 +2718,8 @@
4765 (match_operand:SI 2 "register_operand" "l")))]
4766 "TARGET_THUMB1"
4767 "orr\\t%0, %0, %2"
4768 - [(set_attr "length" "2")]
4769 + [(set_attr "length" "2")
4770 + (set_attr "insn" "orr")]
4771 )
4772
4773 (define_peephole2
4774 @@ -2663,7 +2744,8 @@
4775 (ior:SI (match_dup 1) (match_dup 2)))]
4776 "TARGET_32BIT"
4777 "orr%.\\t%0, %1, %2"
4778 - [(set_attr "conds" "set")]
4779 + [(set_attr "conds" "set")
4780 + (set_attr "insn" "orr")]
4781 )
4782
4783 (define_insn "*iorsi3_compare0_scratch"
4784 @@ -2674,7 +2756,8 @@
4785 (clobber (match_scratch:SI 0 "=r"))]
4786 "TARGET_32BIT"
4787 "orr%.\\t%0, %1, %2"
4788 - [(set_attr "conds" "set")]
4789 + [(set_attr "conds" "set")
4790 + (set_attr "insn" "orr")]
4791 )
4792
4793 (define_insn "xordi3"
4794 @@ -2697,7 +2780,8 @@
4795 eor%?\\t%Q0, %Q1, %2
4796 #"
4797 [(set_attr "length" "4,8")
4798 - (set_attr "predicable" "yes")]
4799 + (set_attr "predicable" "yes")
4800 + (set_attr "insn" "eor")]
4801 )
4802
4803 (define_insn "*xordi_sesidi_di"
4804 @@ -2728,7 +2812,8 @@
4805 (match_operand:SI 2 "arm_rhs_operand" "rI")))]
4806 "TARGET_32BIT"
4807 "eor%?\\t%0, %1, %2"
4808 - [(set_attr "predicable" "yes")]
4809 + [(set_attr "predicable" "yes")
4810 + (set_attr "insn" "eor")]
4811 )
4812
4813 (define_insn "*thumb1_xorsi3"
4814 @@ -2737,7 +2822,8 @@
4815 (match_operand:SI 2 "register_operand" "l")))]
4816 "TARGET_THUMB1"
4817 "eor\\t%0, %0, %2"
4818 - [(set_attr "length" "2")]
4819 + [(set_attr "length" "2")
4820 + (set_attr "insn" "eor")]
4821 )
4822
4823 (define_insn "*xorsi3_compare0"
4824 @@ -2749,7 +2835,8 @@
4825 (xor:SI (match_dup 1) (match_dup 2)))]
4826 "TARGET_32BIT"
4827 "eor%.\\t%0, %1, %2"
4828 - [(set_attr "conds" "set")]
4829 + [(set_attr "conds" "set")
4830 + (set_attr "insn" "eor")]
4831 )
4832
4833 (define_insn "*xorsi3_compare0_scratch"
4834 @@ -2906,7 +2993,7 @@
4835 (smax:SI (match_operand:SI 1 "s_register_operand" "")
4836 (match_operand:SI 2 "arm_rhs_operand" "")))
4837 (clobber (reg:CC CC_REGNUM))])]
4838 - "TARGET_32BIT"
4839 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4840 "
4841 if (operands[2] == const0_rtx || operands[2] == constm1_rtx)
4842 {
4843 @@ -2933,7 +3020,8 @@
4844 (const_int -1)))]
4845 "TARGET_32BIT"
4846 "orr%?\\t%0, %1, %1, asr #31"
4847 - [(set_attr "predicable" "yes")]
4848 + [(set_attr "predicable" "yes")
4849 + (set_attr "insn" "orr")]
4850 )
4851
4852 (define_insn "*arm_smax_insn"
4853 @@ -2941,7 +3029,7 @@
4854 (smax:SI (match_operand:SI 1 "s_register_operand" "%0,?r")
4855 (match_operand:SI 2 "arm_rhs_operand" "rI,rI")))
4856 (clobber (reg:CC CC_REGNUM))]
4857 - "TARGET_ARM"
4858 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
4859 "@
4860 cmp\\t%1, %2\;movlt\\t%0, %2
4861 cmp\\t%1, %2\;movge\\t%0, %1\;movlt\\t%0, %2"
4862 @@ -2955,7 +3043,7 @@
4863 (smin:SI (match_operand:SI 1 "s_register_operand" "")
4864 (match_operand:SI 2 "arm_rhs_operand" "")))
4865 (clobber (reg:CC CC_REGNUM))])]
4866 - "TARGET_32BIT"
4867 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4868 "
4869 if (operands[2] == const0_rtx)
4870 {
4871 @@ -2973,7 +3061,8 @@
4872 (const_int 0)))]
4873 "TARGET_32BIT"
4874 "and%?\\t%0, %1, %1, asr #31"
4875 - [(set_attr "predicable" "yes")]
4876 + [(set_attr "predicable" "yes")
4877 + (set_attr "insn" "and")]
4878 )
4879
4880 (define_insn "*arm_smin_insn"
4881 @@ -2981,7 +3070,7 @@
4882 (smin:SI (match_operand:SI 1 "s_register_operand" "%0,?r")
4883 (match_operand:SI 2 "arm_rhs_operand" "rI,rI")))
4884 (clobber (reg:CC CC_REGNUM))]
4885 - "TARGET_ARM"
4886 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
4887 "@
4888 cmp\\t%1, %2\;movge\\t%0, %2
4889 cmp\\t%1, %2\;movlt\\t%0, %1\;movge\\t%0, %2"
4890 @@ -2995,7 +3084,7 @@
4891 (umax:SI (match_operand:SI 1 "s_register_operand" "")
4892 (match_operand:SI 2 "arm_rhs_operand" "")))
4893 (clobber (reg:CC CC_REGNUM))])]
4894 - "TARGET_32BIT"
4895 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4896 ""
4897 )
4898
4899 @@ -3004,7 +3093,7 @@
4900 (umax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
4901 (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
4902 (clobber (reg:CC CC_REGNUM))]
4903 - "TARGET_ARM"
4904 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
4905 "@
4906 cmp\\t%1, %2\;movcc\\t%0, %2
4907 cmp\\t%1, %2\;movcs\\t%0, %1
4908 @@ -3019,7 +3108,7 @@
4909 (umin:SI (match_operand:SI 1 "s_register_operand" "")
4910 (match_operand:SI 2 "arm_rhs_operand" "")))
4911 (clobber (reg:CC CC_REGNUM))])]
4912 - "TARGET_32BIT"
4913 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4914 ""
4915 )
4916
4917 @@ -3028,7 +3117,7 @@
4918 (umin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
4919 (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
4920 (clobber (reg:CC CC_REGNUM))]
4921 - "TARGET_ARM"
4922 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
4923 "@
4924 cmp\\t%1, %2\;movcs\\t%0, %2
4925 cmp\\t%1, %2\;movcc\\t%0, %1
4926 @@ -3043,7 +3132,7 @@
4927 [(match_operand:SI 1 "s_register_operand" "r")
4928 (match_operand:SI 2 "s_register_operand" "r")]))
4929 (clobber (reg:CC CC_REGNUM))]
4930 - "TARGET_32BIT"
4931 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4932 "*
4933 operands[3] = gen_rtx_fmt_ee (minmax_code (operands[3]), SImode,
4934 operands[1], operands[2]);
4935 @@ -3163,11 +3252,23 @@
4936 [(set (match_operand:SI 0 "register_operand" "=l,l")
4937 (ashift:SI (match_operand:SI 1 "register_operand" "l,0")
4938 (match_operand:SI 2 "nonmemory_operand" "N,l")))]
4939 - "TARGET_THUMB1"
4940 + "TARGET_THUMB1 && !janus2_code"
4941 "lsl\\t%0, %1, %2"
4942 [(set_attr "length" "2")]
4943 )
4944
4945 +(define_insn "*thumb1_ashlsi3_janus2"
4946 + [(set (match_operand:SI 0 "register_operand" "=l,l")
4947 + (ashift:SI (match_operand:SI 1 "register_operand" "l,0")
4948 + (match_operand:SI 2 "nonmemory_operand" "N,l")))]
4949 + "TARGET_THUMB1 && janus2_code"
4950 + "@
4951 + lsl\\t%0, %1, %2
4952 + lsl\\t%0, %1, %2\;nop"
4953 + [(set_attr "length" "2,4")]
4954 +)
4955 +
4956 +
4957 (define_expand "ashrdi3"
4958 [(set (match_operand:DI 0 "s_register_operand" "")
4959 (ashiftrt:DI (match_operand:DI 1 "s_register_operand" "")
4960 @@ -3200,6 +3301,7 @@
4961 "TARGET_32BIT"
4962 "movs\\t%R0, %R1, asr #1\;mov\\t%Q0, %Q1, rrx"
4963 [(set_attr "conds" "clob")
4964 + (set_attr "insn" "mov")
4965 (set_attr "length" "8")]
4966 )
4967
4968 @@ -3219,11 +3321,22 @@
4969 [(set (match_operand:SI 0 "register_operand" "=l,l")
4970 (ashiftrt:SI (match_operand:SI 1 "register_operand" "l,0")
4971 (match_operand:SI 2 "nonmemory_operand" "N,l")))]
4972 - "TARGET_THUMB1"
4973 + "TARGET_THUMB1 && !janus2_code"
4974 "asr\\t%0, %1, %2"
4975 [(set_attr "length" "2")]
4976 )
4977
4978 +(define_insn "*thumb1_ashrsi3_janus2"
4979 + [(set (match_operand:SI 0 "register_operand" "=l,l")
4980 + (ashiftrt:SI (match_operand:SI 1 "register_operand" "l,0")
4981 + (match_operand:SI 2 "nonmemory_operand" "N,l")))]
4982 + "TARGET_THUMB1 && janus2_code"
4983 + "@
4984 + asr\\t%0, %1, %2
4985 + asr\\t%0, %1, %2\;nop"
4986 + [(set_attr "length" "2,4")]
4987 +)
4988 +
4989 (define_expand "lshrdi3"
4990 [(set (match_operand:DI 0 "s_register_operand" "")
4991 (lshiftrt:DI (match_operand:DI 1 "s_register_operand" "")
4992 @@ -3256,6 +3369,7 @@
4993 "TARGET_32BIT"
4994 "movs\\t%R0, %R1, lsr #1\;mov\\t%Q0, %Q1, rrx"
4995 [(set_attr "conds" "clob")
4996 + (set_attr "insn" "mov")
4997 (set_attr "length" "8")]
4998 )
4999
5000 @@ -3278,11 +3392,22 @@
5001 [(set (match_operand:SI 0 "register_operand" "=l,l")
5002 (lshiftrt:SI (match_operand:SI 1 "register_operand" "l,0")
5003 (match_operand:SI 2 "nonmemory_operand" "N,l")))]
5004 - "TARGET_THUMB1"
5005 + "TARGET_THUMB1 && !janus2_code"
5006 "lsr\\t%0, %1, %2"
5007 [(set_attr "length" "2")]
5008 )
5009
5010 +(define_insn "*thumb1_lshrsi3_janus2"
5011 + [(set (match_operand:SI 0 "register_operand" "=l,l")
5012 + (lshiftrt:SI (match_operand:SI 1 "register_operand" "l,0")
5013 + (match_operand:SI 2 "nonmemory_operand" "N,l")))]
5014 + "TARGET_THUMB1 && janus2_code"
5015 + "@
5016 + lsr\\t%0, %1, %2
5017 + lsr\\t%0, %1, %2; nop"
5018 + [(set_attr "length" "2,4")]
5019 +)
5020 +
5021 (define_expand "rotlsi3"
5022 [(set (match_operand:SI 0 "s_register_operand" "")
5023 (rotatert:SI (match_operand:SI 1 "s_register_operand" "")
5024 @@ -3324,11 +3449,20 @@
5025 [(set (match_operand:SI 0 "register_operand" "=l")
5026 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
5027 (match_operand:SI 2 "register_operand" "l")))]
5028 - "TARGET_THUMB1"
5029 + "TARGET_THUMB1 && !janus2_code"
5030 "ror\\t%0, %0, %2"
5031 [(set_attr "length" "2")]
5032 )
5033
5034 +(define_insn "*thumb1_rotrsi3_janus2"
5035 + [(set (match_operand:SI 0 "register_operand" "=l")
5036 + (rotatert:SI (match_operand:SI 1 "register_operand" "0")
5037 + (match_operand:SI 2 "register_operand" "l")))]
5038 + "TARGET_THUMB1 && janus2_code"
5039 + "ror\\t%0, %0, %2; nop"
5040 + [(set_attr "length" "4")]
5041 +)
5042 +
5043 (define_insn "*arm_shiftsi3"
5044 [(set (match_operand:SI 0 "s_register_operand" "=r")
5045 (match_operator:SI 3 "shift_operator"
5046 @@ -3340,7 +3474,11 @@
5047 (set_attr "shift" "1")
5048 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5049 (const_string "alu_shift")
5050 - (const_string "alu_shift_reg")))]
5051 + (const_string "alu_shift_reg")))
5052 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5053 + (eq_attr "fix_janus" "yes"))
5054 + (const_int 8)
5055 + (const_int 4)))]
5056 )
5057
5058 (define_insn "*shiftsi3_compare0"
5059 @@ -3357,7 +3495,11 @@
5060 (set_attr "shift" "1")
5061 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5062 (const_string "alu_shift")
5063 - (const_string "alu_shift_reg")))]
5064 + (const_string "alu_shift_reg")))
5065 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5066 + (eq_attr "fix_janus" "yes"))
5067 + (const_int 8)
5068 + (const_int 4)))]
5069 )
5070
5071 (define_insn "*shiftsi3_compare0_scratch"
5072 @@ -3370,7 +3512,11 @@
5073 "TARGET_32BIT"
5074 "* return arm_output_shift(operands, 1);"
5075 [(set_attr "conds" "set")
5076 - (set_attr "shift" "1")]
5077 + (set_attr "shift" "1")
5078 + (set (attr "length") (if_then_else (and (match_operand 2 "s_register_operand" "")
5079 + (eq_attr "fix_janus" "yes"))
5080 + (const_int 8)
5081 + (const_int 4)))]
5082 )
5083
5084 (define_insn "*arm_notsi_shiftsi"
5085 @@ -3382,9 +3528,14 @@
5086 "mvn%?\\t%0, %1%S3"
5087 [(set_attr "predicable" "yes")
5088 (set_attr "shift" "1")
5089 + (set_attr "insn" "mvn")
5090 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5091 (const_string "alu_shift")
5092 - (const_string "alu_shift_reg")))]
5093 + (const_string "alu_shift_reg")))
5094 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5095 + (eq_attr "fix_janus" "yes"))
5096 + (const_int 8)
5097 + (const_int 4)))]
5098 )
5099
5100 (define_insn "*arm_notsi_shiftsi_compare0"
5101 @@ -3399,9 +3550,14 @@
5102 "mvn%.\\t%0, %1%S3"
5103 [(set_attr "conds" "set")
5104 (set_attr "shift" "1")
5105 + (set_attr "insn" "mvn")
5106 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5107 (const_string "alu_shift")
5108 - (const_string "alu_shift_reg")))]
5109 + (const_string "alu_shift_reg")))
5110 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5111 + (eq_attr "fix_janus" "yes"))
5112 + (const_int 8)
5113 + (const_int 4)))]
5114 )
5115
5116 (define_insn "*arm_not_shiftsi_compare0_scratch"
5117 @@ -3415,9 +3571,14 @@
5118 "mvn%.\\t%0, %1%S3"
5119 [(set_attr "conds" "set")
5120 (set_attr "shift" "1")
5121 + (set_attr "insn" "mvn")
5122 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5123 (const_string "alu_shift")
5124 - (const_string "alu_shift_reg")))]
5125 + (const_string "alu_shift_reg")))
5126 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5127 + (eq_attr "fix_janus" "yes"))
5128 + (const_int 8)
5129 + (const_int 4)))]
5130 )
5131
5132 ;; We don't really have extzv, but defining this using shifts helps
5133 @@ -3550,12 +3711,12 @@
5134 (define_expand "negdf2"
5135 [(set (match_operand:DF 0 "s_register_operand" "")
5136 (neg:DF (match_operand:DF 1 "s_register_operand" "")))]
5137 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5138 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)"
5139 "")
5140
5141 ;; abssi2 doesn't really clobber the condition codes if a different register
5142 ;; is being set. To keep things simple, assume during rtl manipulations that
5143 -;; it does, but tell the final scan operator the truth. Similarly for
5144 +;; it does, and the splitter will eliminate it. Similarly for
5145 ;; (neg (abs...))
5146
5147 (define_expand "abssi2"
5148 @@ -3567,22 +3728,28 @@
5149 "
5150 if (TARGET_THUMB1)
5151 operands[2] = gen_rtx_SCRATCH (SImode);
5152 + else if (TARGET_NO_SINGLE_COND_EXEC)
5153 + {
5154 + emit_insn(gen_rtx_SET(VOIDmode, operands[0],
5155 + gen_rtx_ABS(SImode, operands[1])));
5156 + DONE;
5157 + }
5158 else
5159 operands[2] = gen_rtx_REG (CCmode, CC_REGNUM);
5160 ")
5161
5162 (define_insn "*arm_abssi2"
5163 - [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
5164 - (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))
5165 + [(set (match_operand:SI 0 "s_register_operand" "=r")
5166 + (abs:SI (match_operand:SI 1 "s_register_operand" "r")))
5167 (clobber (reg:CC CC_REGNUM))]
5168 - "TARGET_ARM"
5169 - "@
5170 - cmp\\t%0, #0\;rsblt\\t%0, %0, #0
5171 - eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31"
5172 - [(set_attr "conds" "clob,*")
5173 - (set_attr "shift" "1")
5174 + "TARGET_32BIT && !TARGET_NO_SINGLE_COND_EXEC"
5175 + "#"
5176 + [(set_attr "shift" "1")
5177 ;; predicable can't be set based on the variant, so left as no
5178 - (set_attr "length" "8")]
5179 + (set (attr "length")
5180 + (if_then_else (eq_attr "is_thumb" "yes")
5181 + (const_int 10)
5182 + (const_int 8)))]
5183 )
5184
5185 (define_insn_and_split "*thumb1_abssi2"
5186 @@ -3600,17 +3767,17 @@
5187 )
5188
5189 (define_insn "*arm_neg_abssi2"
5190 - [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
5191 - (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))))
5192 + [(set (match_operand:SI 0 "s_register_operand" "=r")
5193 + (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "r"))))
5194 (clobber (reg:CC CC_REGNUM))]
5195 - "TARGET_ARM"
5196 - "@
5197 - cmp\\t%0, #0\;rsbgt\\t%0, %0, #0
5198 - eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31"
5199 - [(set_attr "conds" "clob,*")
5200 - (set_attr "shift" "1")
5201 + "TARGET_32BIT && !TARGET_NO_SINGLE_COND_EXEC"
5202 + "#"
5203 + [(set_attr "shift" "1")
5204 ;; predicable can't be set based on the variant, so left as no
5205 - (set_attr "length" "8")]
5206 + (set (attr "length")
5207 + (if_then_else (eq_attr "is_thumb" "yes")
5208 + (const_int 10)
5209 + (const_int 8)))]
5210 )
5211
5212 (define_insn_and_split "*thumb1_neg_abssi2"
5213 @@ -3627,6 +3794,93 @@
5214 [(set_attr "length" "6")]
5215 )
5216
5217 +;; Simplified version for when avoiding conditional execution
5218 +(define_insn "*arm_nocond_abssi2"
5219 + [(set (match_operand:SI 0 "s_register_operand" "=&r")
5220 + (abs:SI (match_operand:SI 1 "s_register_operand" "r")))]
5221 + "TARGET_32BIT && TARGET_NO_SINGLE_COND_EXEC"
5222 + "#"
5223 + [(set_attr "shift" "1")
5224 + (set_attr "length" "8")
5225 + (set_attr "predicable" "yes")]
5226 +)
5227 +
5228 +(define_insn "*arm_nocond_neg_abssi2"
5229 + [(set (match_operand:SI 0 "s_register_operand" "=&r")
5230 + (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "r"))))]
5231 + "TARGET_32BIT && TARGET_NO_SINGLE_COND_EXEC"
5232 + "#"
5233 + [(set_attr "shift" "1")
5234 + (set_attr "length" "8")
5235 + (set_attr "predicable" "yes")]
5236 +)
5237 +
5238 +;; Splitters for ABS patterns.
5239 +
5240 +(define_split
5241 + [(set (match_operand:SI 0 "s_register_operand" "")
5242 + (abs:SI (match_operand:SI 1 "s_register_operand" "")))
5243 + (clobber (reg:CC CC_REGNUM))]
5244 + "TARGET_32BIT && reload_completed && rtx_equal_p(operands[0], operands[1])"
5245 + [(set (reg:CC CC_REGNUM) (compare:CC (match_dup 1) (const_int 0)))
5246 + (cond_exec (lt (reg:CC CC_REGNUM) (const_int 0))
5247 + (set (match_dup 0) (neg:SI (match_dup 1))))]
5248 +)
5249 +
5250 +(define_split
5251 + [(set (match_operand:SI 0 "s_register_operand" "")
5252 + (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" ""))))
5253 + (clobber (reg:CC CC_REGNUM))]
5254 + "TARGET_32BIT && reload_completed && rtx_equal_p(operands[0], operands[1])"
5255 + [(set (reg:CC CC_REGNUM) (compare:CC (match_dup 1) (const_int 0)))
5256 + (cond_exec (gt (reg:CC CC_REGNUM) (const_int 0))
5257 + (set (match_dup 0) (neg:SI (match_dup 1))))]
5258 +)
5259 +
5260 +;; GCC does not add/remove clobbers when matching splitters, so we need
5261 +;; variants with and without the CC clobber.
5262 +(define_split
5263 + [(set (match_operand:SI 0 "s_register_operand" "")
5264 + (abs:SI (match_operand:SI 1 "s_register_operand" "")))]
5265 + "TARGET_32BIT && reload_completed && !rtx_equal_p(operands[0], operands[1])"
5266 + [(set (match_dup 0) (xor:SI (ashiftrt:SI (match_dup 1) (const_int 31))
5267 + (match_dup 1)))
5268 + (set (match_dup 0) (minus:SI (match_dup 0)
5269 + (ashiftrt:SI (match_dup 1) (const_int 31))))]
5270 +)
5271 +
5272 +(define_split
5273 + [(set (match_operand:SI 0 "s_register_operand" "")
5274 + (abs:SI (match_operand:SI 1 "s_register_operand" "")))
5275 + (clobber (reg:CC CC_REGNUM))]
5276 + "TARGET_32BIT && reload_completed && !rtx_equal_p(operands[0], operands[1])"
5277 + [(set (match_dup 0) (xor:SI (ashiftrt:SI (match_dup 1) (const_int 31))
5278 + (match_dup 1)))
5279 + (set (match_dup 0) (minus:SI (match_dup 0)
5280 + (ashiftrt:SI (match_dup 1) (const_int 31))))]
5281 +)
5282 +
5283 +(define_split
5284 + [(set (match_operand:SI 0 "s_register_operand" "")
5285 + (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" ""))))]
5286 + "TARGET_32BIT && reload_completed && !rtx_equal_p(operands[0], operands[1])"
5287 + [(set (match_dup 0) (xor:SI (ashiftrt:SI (match_dup 1) (const_int 31))
5288 + (match_dup 1)))
5289 + (set (match_dup 0) (minus:SI (ashiftrt:SI (match_dup 1) (const_int 31))
5290 + (match_dup 0)))]
5291 +)
5292 +
5293 +(define_split
5294 + [(set (match_operand:SI 0 "s_register_operand" "")
5295 + (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" ""))))
5296 + (clobber (reg:CC CC_REGNUM))]
5297 + "TARGET_32BIT && reload_completed && !rtx_equal_p(operands[0], operands[1])"
5298 + [(set (match_dup 0) (xor:SI (ashiftrt:SI (match_dup 1) (const_int 31))
5299 + (match_dup 1)))
5300 + (set (match_dup 0) (minus:SI (ashiftrt:SI (match_dup 1) (const_int 31))
5301 + (match_dup 0)))]
5302 +)
5303 +
5304 (define_expand "abssf2"
5305 [(set (match_operand:SF 0 "s_register_operand" "")
5306 (abs:SF (match_operand:SF 1 "s_register_operand" "")))]
5307 @@ -3636,7 +3890,7 @@
5308 (define_expand "absdf2"
5309 [(set (match_operand:DF 0 "s_register_operand" "")
5310 (abs:DF (match_operand:DF 1 "s_register_operand" "")))]
5311 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5312 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
5313 "")
5314
5315 (define_expand "sqrtsf2"
5316 @@ -3648,7 +3902,7 @@
5317 (define_expand "sqrtdf2"
5318 [(set (match_operand:DF 0 "s_register_operand" "")
5319 (sqrt:DF (match_operand:DF 1 "s_register_operand" "")))]
5320 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5321 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)"
5322 "")
5323
5324 (define_insn_and_split "one_cmpldi2"
5325 @@ -3682,7 +3936,8 @@
5326 (not:SI (match_operand:SI 1 "s_register_operand" "r")))]
5327 "TARGET_32BIT"
5328 "mvn%?\\t%0, %1"
5329 - [(set_attr "predicable" "yes")]
5330 + [(set_attr "predicable" "yes")
5331 + (set_attr "insn" "mvn")]
5332 )
5333
5334 (define_insn "*thumb1_one_cmplsi2"
5335 @@ -3690,7 +3945,8 @@
5336 (not:SI (match_operand:SI 1 "register_operand" "l")))]
5337 "TARGET_THUMB1"
5338 "mvn\\t%0, %1"
5339 - [(set_attr "length" "2")]
5340 + [(set_attr "length" "2")
5341 + (set_attr "insn" "mvn")]
5342 )
5343
5344 (define_insn "*notsi_compare0"
5345 @@ -3701,7 +3957,8 @@
5346 (not:SI (match_dup 1)))]
5347 "TARGET_32BIT"
5348 "mvn%.\\t%0, %1"
5349 - [(set_attr "conds" "set")]
5350 + [(set_attr "conds" "set")
5351 + (set_attr "insn" "mvn")]
5352 )
5353
5354 (define_insn "*notsi_compare0_scratch"
5355 @@ -3711,11 +3968,40 @@
5356 (clobber (match_scratch:SI 0 "=r"))]
5357 "TARGET_32BIT"
5358 "mvn%.\\t%0, %1"
5359 - [(set_attr "conds" "set")]
5360 + [(set_attr "conds" "set")
5361 + (set_attr "insn" "mvn")]
5362 )
5363 \f
5364 ;; Fixed <--> Floating conversion insns
5365
5366 +(define_expand "floatsihf2"
5367 + [(set (match_operand:HF 0 "general_operand" "")
5368 + (float:HF (match_operand:SI 1 "general_operand" "")))]
5369 + "TARGET_EITHER"
5370 + "
5371 + {
5372 + rtx op1 = gen_reg_rtx (SFmode);
5373 + expand_float (op1, operands[1], 0);
5374 + op1 = convert_to_mode (HFmode, op1, 0);
5375 + emit_move_insn (operands[0], op1);
5376 + DONE;
5377 + }"
5378 +)
5379 +
5380 +(define_expand "floatdihf2"
5381 + [(set (match_operand:HF 0 "general_operand" "")
5382 + (float:HF (match_operand:DI 1 "general_operand" "")))]
5383 + "TARGET_EITHER"
5384 + "
5385 + {
5386 + rtx op1 = gen_reg_rtx (SFmode);
5387 + expand_float (op1, operands[1], 0);
5388 + op1 = convert_to_mode (HFmode, op1, 0);
5389 + emit_move_insn (operands[0], op1);
5390 + DONE;
5391 + }"
5392 +)
5393 +
5394 (define_expand "floatsisf2"
5395 [(set (match_operand:SF 0 "s_register_operand" "")
5396 (float:SF (match_operand:SI 1 "s_register_operand" "")))]
5397 @@ -3731,7 +4017,7 @@
5398 (define_expand "floatsidf2"
5399 [(set (match_operand:DF 0 "s_register_operand" "")
5400 (float:DF (match_operand:SI 1 "s_register_operand" "")))]
5401 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5402 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
5403 "
5404 if (TARGET_MAVERICK)
5405 {
5406 @@ -3740,6 +4026,30 @@
5407 }
5408 ")
5409
5410 +(define_expand "fix_trunchfsi2"
5411 + [(set (match_operand:SI 0 "general_operand" "")
5412 + (fix:SI (fix:HF (match_operand:HF 1 "general_operand" ""))))]
5413 + "TARGET_EITHER"
5414 + "
5415 + {
5416 + rtx op1 = convert_to_mode (SFmode, operands[1], 0);
5417 + expand_fix (operands[0], op1, 0);
5418 + DONE;
5419 + }"
5420 +)
5421 +
5422 +(define_expand "fix_trunchfdi2"
5423 + [(set (match_operand:DI 0 "general_operand" "")
5424 + (fix:DI (fix:HF (match_operand:HF 1 "general_operand" ""))))]
5425 + "TARGET_EITHER"
5426 + "
5427 + {
5428 + rtx op1 = convert_to_mode (SFmode, operands[1], 0);
5429 + expand_fix (operands[0], op1, 0);
5430 + DONE;
5431 + }"
5432 +)
5433 +
5434 (define_expand "fix_truncsfsi2"
5435 [(set (match_operand:SI 0 "s_register_operand" "")
5436 (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))]
5437 @@ -3759,7 +4069,7 @@
5438 (define_expand "fix_truncdfsi2"
5439 [(set (match_operand:SI 0 "s_register_operand" "")
5440 (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))]
5441 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5442 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
5443 "
5444 if (TARGET_MAVERICK)
5445 {
5446 @@ -3776,9 +4086,25 @@
5447 [(set (match_operand:SF 0 "s_register_operand" "")
5448 (float_truncate:SF
5449 (match_operand:DF 1 "s_register_operand" "")))]
5450 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5451 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
5452 ""
5453 )
5454 +
5455 +/* DFmode -> HFmode conversions have to go through SFmode. */
5456 +(define_expand "truncdfhf2"
5457 + [(set (match_operand:HF 0 "general_operand" "")
5458 + (float_truncate:HF
5459 + (match_operand:DF 1 "general_operand" "")))]
5460 + "TARGET_EITHER"
5461 + "
5462 + {
5463 + rtx op1;
5464 + op1 = convert_to_mode (SFmode, operands[1], 0);
5465 + op1 = convert_to_mode (HFmode, op1, 0);
5466 + emit_move_insn (operands[0], op1);
5467 + DONE;
5468 + }"
5469 +)
5470 \f
5471 ;; Zero and sign extension instructions.
5472
5473 @@ -3800,6 +4126,7 @@
5474 return \"mov%?\\t%R0, #0\";
5475 "
5476 [(set_attr "length" "8")
5477 + (set_attr "insn" "mov")
5478 (set_attr "predicable" "yes")]
5479 )
5480
5481 @@ -3843,6 +4170,7 @@
5482 "
5483 [(set_attr "length" "8")
5484 (set_attr "shift" "1")
5485 + (set_attr "insn" "mov")
5486 (set_attr "predicable" "yes")]
5487 )
5488
5489 @@ -4123,6 +4451,28 @@
5490 ""
5491 )
5492
5493 +(define_code_iterator ior_xor [ior xor])
5494 +
5495 +(define_split
5496 + [(set (match_operand:SI 0 "s_register_operand" "")
5497 + (ior_xor:SI (and:SI (ashift:SI
5498 + (match_operand:SI 1 "s_register_operand" "")
5499 + (match_operand:SI 2 "const_int_operand" ""))
5500 + (match_operand:SI 3 "const_int_operand" ""))
5501 + (zero_extend:SI
5502 + (match_operator 5 "subreg_lowpart_operator"
5503 + [(match_operand:SI 4 "s_register_operand" "")]))))]
5504 + "TARGET_32BIT
5505 + && (INTVAL (operands[3])
5506 + == (GET_MODE_MASK (GET_MODE (operands[5]))
5507 + & (GET_MODE_MASK (GET_MODE (operands[5]))
5508 + << (INTVAL (operands[2])))))"
5509 + [(set (match_dup 0) (ior_xor:SI (ashift:SI (match_dup 1) (match_dup 2))
5510 + (match_dup 4)))
5511 + (set (match_dup 0) (zero_extend:SI (match_dup 5)))]
5512 + "operands[5] = gen_lowpart (GET_MODE (operands[5]), operands[0]);"
5513 +)
5514 +
5515 (define_insn "*compareqi_eq0"
5516 [(set (reg:CC_Z CC_REGNUM)
5517 (compare:CC_Z (match_operand:QI 0 "s_register_operand" "r")
5518 @@ -4639,9 +4989,24 @@
5519 (define_expand "extendsfdf2"
5520 [(set (match_operand:DF 0 "s_register_operand" "")
5521 (float_extend:DF (match_operand:SF 1 "s_register_operand" "")))]
5522 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5523 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
5524 ""
5525 )
5526 +
5527 +/* HFmode -> DFmode conversions have to go through SFmode. */
5528 +(define_expand "extendhfdf2"
5529 + [(set (match_operand:DF 0 "general_operand" "")
5530 + (float_extend:DF (match_operand:HF 1 "general_operand" "")))]
5531 + "TARGET_EITHER"
5532 + "
5533 + {
5534 + rtx op1;
5535 + op1 = convert_to_mode (SFmode, operands[1], 0);
5536 + op1 = convert_to_mode (DFmode, op1, 0);
5537 + emit_insn (gen_movdf (operands[0], op1));
5538 + DONE;
5539 + }"
5540 +)
5541 \f
5542 ;; Move insns (including loads and stores)
5543
5544 @@ -4877,6 +5242,7 @@
5545 }"
5546 [(set_attr "length" "4,4,6,2,2,6,4,4")
5547 (set_attr "type" "*,*,*,load2,store2,load2,store2,*")
5548 + (set_attr "insn" "*,mov,*,*,*,*,*,mov")
5549 (set_attr "pool_range" "*,*,*,*,*,1020,*,*")]
5550 )
5551
5552 @@ -4903,14 +5269,6 @@
5553 optimize && can_create_pseudo_p ());
5554 DONE;
5555 }
5556 -
5557 - if (TARGET_USE_MOVT && !target_word_relocations
5558 - && GET_CODE (operands[1]) == SYMBOL_REF
5559 - && !flag_pic && !arm_tls_referenced_p (operands[1]))
5560 - {
5561 - arm_emit_movpair (operands[0], operands[1]);
5562 - DONE;
5563 - }
5564 }
5565 else /* TARGET_THUMB1... */
5566 {
5567 @@ -4984,18 +5342,9 @@
5568 (set_attr "length" "4")]
5569 )
5570
5571 -(define_insn "*arm_movw"
5572 - [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
5573 - (high:SI (match_operand:SI 1 "general_operand" "i")))]
5574 - "TARGET_32BIT"
5575 - "movw%?\t%0, #:lower16:%c1"
5576 - [(set_attr "predicable" "yes")
5577 - (set_attr "length" "4")]
5578 -)
5579 -
5580 (define_insn "*arm_movsi_insn"
5581 [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m")
5582 - (match_operand:SI 1 "general_operand" "rk, I,K,N,mi,rk"))]
5583 + (match_operand:SI 1 "general_operand" "rk, I,K,j,mi,rk"))]
5584 "TARGET_ARM && ! TARGET_IWMMXT
5585 && !(TARGET_HARD_FLOAT && TARGET_VFP)
5586 && ( register_operand (operands[0], SImode)
5587 @@ -5008,6 +5357,7 @@
5588 ldr%?\\t%0, %1
5589 str%?\\t%1, %0"
5590 [(set_attr "type" "*,*,*,*,load1,store1")
5591 + (set_attr "insn" "mov,mov,mvn,mov,*,*")
5592 (set_attr "predicable" "yes")
5593 (set_attr "pool_range" "*,*,*,*,4096,*")
5594 (set_attr "neg_pool_range" "*,*,*,*,4084,*")]
5595 @@ -5027,6 +5377,19 @@
5596 "
5597 )
5598
5599 +(define_split
5600 + [(set (match_operand:SI 0 "arm_general_register_operand" "")
5601 + (match_operand:SI 1 "general_operand" ""))]
5602 + "TARGET_32BIT
5603 + && TARGET_USE_MOVT && GET_CODE (operands[1]) == SYMBOL_REF
5604 + && !flag_pic && !target_word_relocations
5605 + && !arm_tls_referenced_p (operands[1])"
5606 + [(clobber (const_int 0))]
5607 +{
5608 + arm_emit_movpair (operands[0], operands[1]);
5609 + DONE;
5610 +})
5611 +
5612 (define_insn "*thumb1_movsi_insn"
5613 [(set (match_operand:SI 0 "nonimmediate_operand" "=l,l,l,l,l,>,l, m,*lhk")
5614 (match_operand:SI 1 "general_operand" "l, I,J,K,>,l,mi,l,*lhk"))]
5615 @@ -5065,7 +5428,7 @@
5616 (set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))]
5617 "
5618 {
5619 - unsigned HOST_WIDE_INT val = INTVAL (operands[1]);
5620 + unsigned HOST_WIDE_INT val = INTVAL (operands[1]) & 0xffffffffu;
5621 unsigned HOST_WIDE_INT mask = 0xff;
5622 int i;
5623
5624 @@ -5627,6 +5990,7 @@
5625 ldr%(h%)\\t%0, %1\\t%@ movhi"
5626 [(set_attr "type" "*,*,store1,load1")
5627 (set_attr "predicable" "yes")
5628 + (set_attr "insn" "mov,mvn,*,*")
5629 (set_attr "pool_range" "*,*,*,256")
5630 (set_attr "neg_pool_range" "*,*,*,244")]
5631 )
5632 @@ -5638,7 +6002,8 @@
5633 "@
5634 mov%?\\t%0, %1\\t%@ movhi
5635 mvn%?\\t%0, #%B1\\t%@ movhi"
5636 - [(set_attr "predicable" "yes")]
5637 + [(set_attr "predicable" "yes")
5638 + (set_attr "insn" "mov,mvn")]
5639 )
5640
5641 (define_expand "thumb_movhi_clobber"
5642 @@ -5769,6 +6134,7 @@
5643 ldr%(b%)\\t%0, %1
5644 str%(b%)\\t%1, %0"
5645 [(set_attr "type" "*,*,load1,store1")
5646 + (set_attr "insn" "mov,mvn,*,*")
5647 (set_attr "predicable" "yes")]
5648 )
5649
5650 @@ -5787,9 +6153,111 @@
5651 mov\\t%0, %1"
5652 [(set_attr "length" "2")
5653 (set_attr "type" "*,load1,store1,*,*,*")
5654 + (set_attr "insn" "*,*,*,mov,mov,mov")
5655 (set_attr "pool_range" "*,32,*,*,*,*")]
5656 )
5657
5658 +;; HFmode moves
5659 +(define_expand "movhf"
5660 + [(set (match_operand:HF 0 "general_operand" "")
5661 + (match_operand:HF 1 "general_operand" ""))]
5662 + "TARGET_EITHER"
5663 + "
5664 + if (TARGET_32BIT)
5665 + {
5666 + if (GET_CODE (operands[0]) == MEM)
5667 + operands[1] = force_reg (HFmode, operands[1]);
5668 + }
5669 + else /* TARGET_THUMB1 */
5670 + {
5671 + if (can_create_pseudo_p ())
5672 + {
5673 + if (GET_CODE (operands[0]) != REG)
5674 + operands[1] = force_reg (HFmode, operands[1]);
5675 + }
5676 + }
5677 + "
5678 +)
5679 +
5680 +(define_insn "*arm32_movhf"
5681 + [(set (match_operand:HF 0 "nonimmediate_operand" "=r,m,r,r")
5682 + (match_operand:HF 1 "general_operand" " m,r,r,F"))]
5683 + "TARGET_32BIT && !(TARGET_HARD_FLOAT && TARGET_FP16)
5684 + && ( s_register_operand (operands[0], HFmode)
5685 + || s_register_operand (operands[1], HFmode))"
5686 + "*
5687 + switch (which_alternative)
5688 + {
5689 + case 0: /* ARM register from memory */
5690 + return \"ldr%(h%)\\t%0, %1\\t%@ __fp16\";
5691 + case 1: /* memory from ARM register */
5692 + return \"str%(h%)\\t%1, %0\\t%@ __fp16\";
5693 + case 2: /* ARM register from ARM register */
5694 + return \"mov%?\\t%0, %1\\t%@ __fp16\";
5695 + case 3: /* ARM register from constant */
5696 + {
5697 + REAL_VALUE_TYPE r;
5698 + long bits;
5699 + rtx ops[4];
5700 +
5701 + REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
5702 + bits = real_to_target (NULL, &r, HFmode);
5703 + ops[0] = operands[0];
5704 + ops[1] = GEN_INT (bits);
5705 + ops[2] = GEN_INT (bits & 0xff00);
5706 + ops[3] = GEN_INT (bits & 0x00ff);
5707 +
5708 + if (arm_arch_thumb2)
5709 + output_asm_insn (\"movw%?\\t%0, %1\", ops);
5710 + else
5711 + output_asm_insn (\"mov%?\\t%0, %2\;orr%?\\t%0, %0, %3\", ops);
5712 + return \"\";
5713 + }
5714 + default:
5715 + gcc_unreachable ();
5716 + }
5717 + "
5718 + [(set_attr "conds" "unconditional")
5719 + (set_attr "type" "load1,store1,*,*")
5720 + (set_attr "length" "4,4,4,8")
5721 + (set_attr "predicable" "yes")
5722 + ]
5723 +)
5724 +
5725 +(define_insn "*thumb1_movhf"
5726 + [(set (match_operand:HF 0 "nonimmediate_operand" "=l,l,m,*r,*h")
5727 + (match_operand:HF 1 "general_operand" "l,mF,l,*h,*r"))]
5728 + "TARGET_THUMB1
5729 + && ( s_register_operand (operands[0], HFmode)
5730 + || s_register_operand (operands[1], HFmode))"
5731 + "*
5732 + switch (which_alternative)
5733 + {
5734 + case 1:
5735 + {
5736 + rtx addr;
5737 + gcc_assert (GET_CODE(operands[1]) == MEM);
5738 + addr = XEXP (operands[1], 0);
5739 + if (GET_CODE (addr) == LABEL_REF
5740 + || (GET_CODE (addr) == CONST
5741 + && GET_CODE (XEXP (addr, 0)) == PLUS
5742 + && GET_CODE (XEXP (XEXP (addr, 0), 0)) == LABEL_REF
5743 + && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT))
5744 + {
5745 + /* Constant pool entry. */
5746 + return \"ldr\\t%0, %1\";
5747 + }
5748 + return \"ldrh\\t%0, %1\";
5749 + }
5750 + case 2: return \"strh\\t%1, %0\";
5751 + default: return \"mov\\t%0, %1\";
5752 + }
5753 + "
5754 + [(set_attr "length" "2")
5755 + (set_attr "type" "*,load1,store1,*,*")
5756 + (set_attr "pool_range" "*,1020,*,*,*")]
5757 +)
5758 +
5759 (define_expand "movsf"
5760 [(set (match_operand:SF 0 "general_operand" "")
5761 (match_operand:SF 1 "general_operand" ""))]
5762 @@ -5842,6 +6310,7 @@
5763 [(set_attr "length" "4,4,4")
5764 (set_attr "predicable" "yes")
5765 (set_attr "type" "*,load1,store1")
5766 + (set_attr "insn" "mov,*,*")
5767 (set_attr "pool_range" "*,4096,*")
5768 (set_attr "neg_pool_range" "*,4084,*")]
5769 )
5770 @@ -6297,7 +6766,7 @@
5771 (match_operand:BLK 1 "general_operand" "")
5772 (match_operand:SI 2 "const_int_operand" "")
5773 (match_operand:SI 3 "const_int_operand" "")]
5774 - "TARGET_EITHER"
5775 + "TARGET_EITHER && !low_irq_latency"
5776 "
5777 if (TARGET_32BIT)
5778 {
5779 @@ -7476,7 +7945,7 @@
5780 (define_expand "cmpdf"
5781 [(match_operand:DF 0 "s_register_operand" "")
5782 (match_operand:DF 1 "arm_float_compare_operand" "")]
5783 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5784 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
5785 "
5786 arm_compare_op0 = operands[0];
5787 arm_compare_op1 = operands[1];
5788 @@ -7507,7 +7976,11 @@
5789 (set_attr "shift" "1")
5790 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5791 (const_string "alu_shift")
5792 - (const_string "alu_shift_reg")))]
5793 + (const_string "alu_shift_reg")))
5794 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5795 + (eq_attr "fix_janus" "yes"))
5796 + (const_int 8)
5797 + (const_int 4)))]
5798 )
5799
5800 (define_insn "*arm_cmpsi_shiftsi_swp"
5801 @@ -7522,7 +7995,11 @@
5802 (set_attr "shift" "1")
5803 (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "")
5804 (const_string "alu_shift")
5805 - (const_string "alu_shift_reg")))]
5806 + (const_string "alu_shift_reg")))
5807 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5808 + (eq_attr "fix_janus" "yes"))
5809 + (const_int 8)
5810 + (const_int 4)))]
5811 )
5812
5813 (define_insn "*arm_cmpsi_negshiftsi_si"
5814 @@ -7537,7 +8014,11 @@
5815 [(set_attr "conds" "set")
5816 (set (attr "type") (if_then_else (match_operand 3 "const_int_operand" "")
5817 (const_string "alu_shift")
5818 - (const_string "alu_shift_reg")))]
5819 + (const_string "alu_shift_reg")))
5820 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
5821 + (eq_attr "fix_janus" "yes"))
5822 + (const_int 8)
5823 + (const_int 4)))]
5824 )
5825
5826 ;; Cirrus SF compare instruction
5827 @@ -7879,77 +8360,77 @@
5828 (define_expand "seq"
5829 [(set (match_operand:SI 0 "s_register_operand" "")
5830 (eq:SI (match_dup 1) (const_int 0)))]
5831 - "TARGET_32BIT"
5832 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5833 "operands[1] = arm_gen_compare_reg (EQ, arm_compare_op0, arm_compare_op1);"
5834 )
5835
5836 (define_expand "sne"
5837 [(set (match_operand:SI 0 "s_register_operand" "")
5838 (ne:SI (match_dup 1) (const_int 0)))]
5839 - "TARGET_32BIT"
5840 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5841 "operands[1] = arm_gen_compare_reg (NE, arm_compare_op0, arm_compare_op1);"
5842 )
5843
5844 (define_expand "sgt"
5845 [(set (match_operand:SI 0 "s_register_operand" "")
5846 (gt:SI (match_dup 1) (const_int 0)))]
5847 - "TARGET_32BIT"
5848 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5849 "operands[1] = arm_gen_compare_reg (GT, arm_compare_op0, arm_compare_op1);"
5850 )
5851
5852 (define_expand "sle"
5853 [(set (match_operand:SI 0 "s_register_operand" "")
5854 (le:SI (match_dup 1) (const_int 0)))]
5855 - "TARGET_32BIT"
5856 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5857 "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);"
5858 )
5859
5860 (define_expand "sge"
5861 [(set (match_operand:SI 0 "s_register_operand" "")
5862 (ge:SI (match_dup 1) (const_int 0)))]
5863 - "TARGET_32BIT"
5864 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5865 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
5866 )
5867
5868 (define_expand "slt"
5869 [(set (match_operand:SI 0 "s_register_operand" "")
5870 (lt:SI (match_dup 1) (const_int 0)))]
5871 - "TARGET_32BIT"
5872 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5873 "operands[1] = arm_gen_compare_reg (LT, arm_compare_op0, arm_compare_op1);"
5874 )
5875
5876 (define_expand "sgtu"
5877 [(set (match_operand:SI 0 "s_register_operand" "")
5878 (gtu:SI (match_dup 1) (const_int 0)))]
5879 - "TARGET_32BIT"
5880 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5881 "operands[1] = arm_gen_compare_reg (GTU, arm_compare_op0, arm_compare_op1);"
5882 )
5883
5884 (define_expand "sleu"
5885 [(set (match_operand:SI 0 "s_register_operand" "")
5886 (leu:SI (match_dup 1) (const_int 0)))]
5887 - "TARGET_32BIT"
5888 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5889 "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);"
5890 )
5891
5892 (define_expand "sgeu"
5893 [(set (match_operand:SI 0 "s_register_operand" "")
5894 (geu:SI (match_dup 1) (const_int 0)))]
5895 - "TARGET_32BIT"
5896 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5897 "operands[1] = arm_gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1);"
5898 )
5899
5900 (define_expand "sltu"
5901 [(set (match_operand:SI 0 "s_register_operand" "")
5902 (ltu:SI (match_dup 1) (const_int 0)))]
5903 - "TARGET_32BIT"
5904 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5905 "operands[1] = arm_gen_compare_reg (LTU, arm_compare_op0, arm_compare_op1);"
5906 )
5907
5908 (define_expand "sunordered"
5909 [(set (match_operand:SI 0 "s_register_operand" "")
5910 (unordered:SI (match_dup 1) (const_int 0)))]
5911 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5912 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP) && !TARGET_NO_COND_EXEC"
5913 "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0,
5914 arm_compare_op1);"
5915 )
5916 @@ -7957,7 +8438,7 @@
5917 (define_expand "sordered"
5918 [(set (match_operand:SI 0 "s_register_operand" "")
5919 (ordered:SI (match_dup 1) (const_int 0)))]
5920 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5921 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP) && !TARGET_NO_COND_EXEC"
5922 "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0,
5923 arm_compare_op1);"
5924 )
5925 @@ -7965,7 +8446,7 @@
5926 (define_expand "sungt"
5927 [(set (match_operand:SI 0 "s_register_operand" "")
5928 (ungt:SI (match_dup 1) (const_int 0)))]
5929 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5930 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP) && !TARGET_NO_COND_EXEC"
5931 "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0,
5932 arm_compare_op1);"
5933 )
5934 @@ -7973,7 +8454,7 @@
5935 (define_expand "sunge"
5936 [(set (match_operand:SI 0 "s_register_operand" "")
5937 (unge:SI (match_dup 1) (const_int 0)))]
5938 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5939 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP) && !TARGET_NO_COND_EXEC"
5940 "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0,
5941 arm_compare_op1);"
5942 )
5943 @@ -7981,7 +8462,7 @@
5944 (define_expand "sunlt"
5945 [(set (match_operand:SI 0 "s_register_operand" "")
5946 (unlt:SI (match_dup 1) (const_int 0)))]
5947 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5948 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP) && !TARGET_NO_COND_EXEC"
5949 "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0,
5950 arm_compare_op1);"
5951 )
5952 @@ -7989,7 +8470,7 @@
5953 (define_expand "sunle"
5954 [(set (match_operand:SI 0 "s_register_operand" "")
5955 (unle:SI (match_dup 1) (const_int 0)))]
5956 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
5957 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP) && !TARGET_NO_COND_EXEC"
5958 "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0,
5959 arm_compare_op1);"
5960 )
5961 @@ -8018,6 +8499,7 @@
5962 "TARGET_ARM"
5963 "mov%D1\\t%0, #0\;mov%d1\\t%0, #1"
5964 [(set_attr "conds" "use")
5965 + (set_attr "insn" "mov")
5966 (set_attr "length" "8")]
5967 )
5968
5969 @@ -8028,6 +8510,7 @@
5970 "TARGET_ARM"
5971 "mov%D1\\t%0, #0\;mvn%d1\\t%0, #0"
5972 [(set_attr "conds" "use")
5973 + (set_attr "insn" "mov")
5974 (set_attr "length" "8")]
5975 )
5976
5977 @@ -8038,6 +8521,7 @@
5978 "TARGET_ARM"
5979 "mov%D1\\t%0, #0\;mvn%d1\\t%0, #1"
5980 [(set_attr "conds" "use")
5981 + (set_attr "insn" "mov")
5982 (set_attr "length" "8")]
5983 )
5984
5985 @@ -8241,7 +8725,7 @@
5986 (if_then_else:SI (match_operand 1 "arm_comparison_operator" "")
5987 (match_operand:SI 2 "arm_not_operand" "")
5988 (match_operand:SI 3 "arm_not_operand" "")))]
5989 - "TARGET_32BIT"
5990 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5991 "
5992 {
5993 enum rtx_code code = GET_CODE (operands[1]);
5994 @@ -8260,7 +8744,7 @@
5995 (if_then_else:SF (match_operand 1 "arm_comparison_operator" "")
5996 (match_operand:SF 2 "s_register_operand" "")
5997 (match_operand:SF 3 "nonmemory_operand" "")))]
5998 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5999 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_NO_COND_EXEC"
6000 "
6001 {
6002 enum rtx_code code = GET_CODE (operands[1]);
6003 @@ -8285,7 +8769,7 @@
6004 (if_then_else:DF (match_operand 1 "arm_comparison_operator" "")
6005 (match_operand:DF 2 "s_register_operand" "")
6006 (match_operand:DF 3 "arm_float_add_operand" "")))]
6007 - "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)"
6008 + "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE) && !TARGET_NO_COND_EXEC"
6009 "
6010 {
6011 enum rtx_code code = GET_CODE (operands[1]);
6012 @@ -8317,7 +8801,8 @@
6013 mvn%d3\\t%0, #%B1\;mov%D3\\t%0, %2
6014 mvn%d3\\t%0, #%B1\;mvn%D3\\t%0, #%B2"
6015 [(set_attr "length" "4,4,4,4,8,8,8,8")
6016 - (set_attr "conds" "use")]
6017 + (set_attr "conds" "use")
6018 + (set_attr "insn" "mov,mvn,mov,mvn,mov,mov,mvn,mvn")]
6019 )
6020
6021 (define_insn "*movsfcc_soft_insn"
6022 @@ -8330,7 +8815,8 @@
6023 "@
6024 mov%D3\\t%0, %2
6025 mov%d3\\t%0, %1"
6026 - [(set_attr "conds" "use")]
6027 + [(set_attr "conds" "use")
6028 + (set_attr "insn" "mov")]
6029 )
6030
6031 \f
6032 @@ -8733,7 +9219,7 @@
6033 [(match_operand 1 "cc_register" "") (const_int 0)])
6034 (return)
6035 (pc)))]
6036 - "TARGET_ARM && USE_RETURN_INSN (TRUE)"
6037 + "TARGET_ARM && USE_RETURN_INSN (TRUE) && !TARGET_NO_COND_EXEC"
6038 "*
6039 {
6040 if (arm_ccfsm_state == 2)
6041 @@ -8754,7 +9240,7 @@
6042 [(match_operand 1 "cc_register" "") (const_int 0)])
6043 (pc)
6044 (return)))]
6045 - "TARGET_ARM && USE_RETURN_INSN (TRUE)"
6046 + "TARGET_ARM && USE_RETURN_INSN (TRUE) && !TARGET_NO_COND_EXEC"
6047 "*
6048 {
6049 if (arm_ccfsm_state == 2)
6050 @@ -9072,7 +9558,11 @@
6051 (set_attr "shift" "4")
6052 (set (attr "type") (if_then_else (match_operand 5 "const_int_operand" "")
6053 (const_string "alu_shift")
6054 - (const_string "alu_shift_reg")))]
6055 + (const_string "alu_shift_reg")))
6056 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6057 + (eq_attr "fix_janus" "yes"))
6058 + (const_int 8)
6059 + (const_int 4)))]
6060 )
6061
6062 (define_split
6063 @@ -9110,7 +9600,11 @@
6064 (set_attr "shift" "4")
6065 (set (attr "type") (if_then_else (match_operand 5 "const_int_operand" "")
6066 (const_string "alu_shift")
6067 - (const_string "alu_shift_reg")))]
6068 + (const_string "alu_shift_reg")))
6069 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6070 + (eq_attr "fix_janus" "yes"))
6071 + (const_int 8)
6072 + (const_int 4)))]
6073 )
6074
6075 (define_insn "*arith_shiftsi_compare0_scratch"
6076 @@ -9128,7 +9622,11 @@
6077 (set_attr "shift" "4")
6078 (set (attr "type") (if_then_else (match_operand 5 "const_int_operand" "")
6079 (const_string "alu_shift")
6080 - (const_string "alu_shift_reg")))]
6081 + (const_string "alu_shift_reg")))
6082 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6083 + (eq_attr "fix_janus" "yes"))
6084 + (const_int 8)
6085 + (const_int 4)))]
6086 )
6087
6088 (define_insn "*sub_shiftsi"
6089 @@ -9143,7 +9641,11 @@
6090 (set_attr "shift" "3")
6091 (set (attr "type") (if_then_else (match_operand 4 "const_int_operand" "")
6092 (const_string "alu_shift")
6093 - (const_string "alu_shift_reg")))]
6094 + (const_string "alu_shift_reg")))
6095 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6096 + (eq_attr "fix_janus" "yes"))
6097 + (const_int 8)
6098 + (const_int 4)))]
6099 )
6100
6101 (define_insn "*sub_shiftsi_compare0"
6102 @@ -9163,7 +9665,11 @@
6103 (set_attr "shift" "3")
6104 (set (attr "type") (if_then_else (match_operand 4 "const_int_operand" "")
6105 (const_string "alu_shift")
6106 - (const_string "alu_shift_reg")))]
6107 + (const_string "alu_shift_reg")))
6108 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6109 + (eq_attr "fix_janus" "yes"))
6110 + (const_int 8)
6111 + (const_int 4)))]
6112 )
6113
6114 (define_insn "*sub_shiftsi_compare0_scratch"
6115 @@ -9181,7 +9687,11 @@
6116 (set_attr "shift" "3")
6117 (set (attr "type") (if_then_else (match_operand 4 "const_int_operand" "")
6118 (const_string "alu_shift")
6119 - (const_string "alu_shift_reg")))]
6120 + (const_string "alu_shift_reg")))
6121 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6122 + (eq_attr "fix_janus" "yes"))
6123 + (const_int 8)
6124 + (const_int 4)))]
6125 )
6126
6127 \f
6128 @@ -9194,6 +9704,7 @@
6129 "TARGET_ARM"
6130 "mov%D1\\t%0, #0\;and%d1\\t%0, %2, #1"
6131 [(set_attr "conds" "use")
6132 + (set_attr "insn" "mov")
6133 (set_attr "length" "8")]
6134 )
6135
6136 @@ -9207,6 +9718,7 @@
6137 orr%d2\\t%0, %1, #1
6138 mov%D2\\t%0, %1\;orr%d2\\t%0, %1, #1"
6139 [(set_attr "conds" "use")
6140 + (set_attr "insn" "orr")
6141 (set_attr "length" "4,8")]
6142 )
6143
6144 @@ -9216,7 +9728,7 @@
6145 [(match_operand:SI 2 "s_register_operand" "r,r")
6146 (match_operand:SI 3 "arm_add_operand" "rI,L")]))
6147 (clobber (reg:CC CC_REGNUM))]
6148 - "TARGET_ARM"
6149 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
6150 "*
6151 if (operands[3] == const0_rtx)
6152 {
6153 @@ -9271,6 +9783,7 @@
6154 return \"\";
6155 "
6156 [(set_attr "conds" "use")
6157 + (set_attr "insn" "mov")
6158 (set_attr "length" "4,4,8")]
6159 )
6160
6161 @@ -9282,7 +9795,7 @@
6162 (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])
6163 (match_operand:SI 1 "s_register_operand" "0,?r")]))
6164 (clobber (reg:CC CC_REGNUM))]
6165 - "TARGET_ARM"
6166 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6167 "*
6168 if (GET_CODE (operands[4]) == LT && operands[3] == const0_rtx)
6169 return \"%i5\\t%0, %1, %2, lsr #31\";
6170 @@ -9678,7 +10191,7 @@
6171 (match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI")
6172 (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
6173 (clobber (reg:CC CC_REGNUM))]
6174 - "TARGET_ARM"
6175 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
6176 "*
6177 if (GET_CODE (operands[5]) == LT
6178 && (operands[4] == const0_rtx))
6179 @@ -9744,7 +10257,7 @@
6180 (match_operand:SI 3 "arm_add_operand" "rIL,rIL"))
6181 (match_operand:SI 1 "arm_rhs_operand" "0,?rI")))
6182 (clobber (reg:CC CC_REGNUM))]
6183 - "TARGET_ARM"
6184 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6185 "#"
6186 [(set_attr "conds" "clob")
6187 (set_attr "length" "8,12")]
6188 @@ -9780,7 +10293,7 @@
6189 (match_operand:SI 2 "s_register_operand" "r,r")
6190 (match_operand:SI 3 "arm_add_operand" "rIL,rIL"))))
6191 (clobber (reg:CC CC_REGNUM))]
6192 - "TARGET_ARM"
6193 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6194 "#"
6195 [(set_attr "conds" "clob")
6196 (set_attr "length" "8,12")]
6197 @@ -9818,7 +10331,7 @@
6198 [(match_operand:SI 3 "s_register_operand" "r")
6199 (match_operand:SI 4 "arm_rhs_operand" "rI")])))
6200 (clobber (reg:CC CC_REGNUM))]
6201 - "TARGET_ARM"
6202 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6203 "#"
6204 [(set_attr "conds" "clob")
6205 (set_attr "length" "12")]
6206 @@ -9968,7 +10481,7 @@
6207 (not:SI
6208 (match_operand:SI 2 "s_register_operand" "r,r"))))
6209 (clobber (reg:CC CC_REGNUM))]
6210 - "TARGET_ARM"
6211 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6212 "#"
6213 [(set_attr "conds" "clob")
6214 (set_attr "length" "8,12")]
6215 @@ -9987,6 +10500,7 @@
6216 mov%d4\\t%0, %1\;mvn%D4\\t%0, %2
6217 mvn%d4\\t%0, #%B1\;mvn%D4\\t%0, %2"
6218 [(set_attr "conds" "use")
6219 + (set_attr "insn" "mvn")
6220 (set_attr "length" "4,8,8")]
6221 )
6222
6223 @@ -10000,7 +10514,7 @@
6224 (match_operand:SI 2 "s_register_operand" "r,r"))
6225 (match_operand:SI 1 "arm_not_operand" "0,?rIK")))
6226 (clobber (reg:CC CC_REGNUM))]
6227 - "TARGET_ARM"
6228 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6229 "#"
6230 [(set_attr "conds" "clob")
6231 (set_attr "length" "8,12")]
6232 @@ -10019,6 +10533,7 @@
6233 mov%D4\\t%0, %1\;mvn%d4\\t%0, %2
6234 mvn%D4\\t%0, #%B1\;mvn%d4\\t%0, %2"
6235 [(set_attr "conds" "use")
6236 + (set_attr "insn" "mvn")
6237 (set_attr "length" "4,8,8")]
6238 )
6239
6240 @@ -10033,7 +10548,7 @@
6241 (match_operand:SI 3 "arm_rhs_operand" "rM,rM")])
6242 (match_operand:SI 1 "arm_not_operand" "0,?rIK")))
6243 (clobber (reg:CC CC_REGNUM))]
6244 - "TARGET_ARM"
6245 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6246 "#"
6247 [(set_attr "conds" "clob")
6248 (set_attr "length" "8,12")]
6249 @@ -10055,10 +10570,23 @@
6250 mvn%D5\\t%0, #%B1\;mov%d5\\t%0, %2%S4"
6251 [(set_attr "conds" "use")
6252 (set_attr "shift" "2")
6253 - (set_attr "length" "4,8,8")
6254 + (set_attr "insn" "mov")
6255 (set (attr "type") (if_then_else (match_operand 3 "const_int_operand" "")
6256 (const_string "alu_shift")
6257 - (const_string "alu_shift_reg")))]
6258 + (const_string "alu_shift_reg")))
6259 + (set_attr_alternative "length"
6260 + [(if_then_else (and (eq_attr "type" "alu_shift_reg")
6261 + (eq_attr "fix_janus" "yes"))
6262 + (const_int 8)
6263 + (const_int 4))
6264 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6265 + (eq_attr "fix_janus" "yes"))
6266 + (const_int 12)
6267 + (const_int 8))
6268 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6269 + (eq_attr "fix_janus" "yes"))
6270 + (const_int 12)
6271 + (const_int 8))])]
6272 )
6273
6274 (define_insn "*ifcompare_move_shift"
6275 @@ -10072,7 +10600,7 @@
6276 [(match_operand:SI 2 "s_register_operand" "r,r")
6277 (match_operand:SI 3 "arm_rhs_operand" "rM,rM")])))
6278 (clobber (reg:CC CC_REGNUM))]
6279 - "TARGET_ARM"
6280 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6281 "#"
6282 [(set_attr "conds" "clob")
6283 (set_attr "length" "8,12")]
6284 @@ -10094,10 +10622,24 @@
6285 mvn%d5\\t%0, #%B1\;mov%D5\\t%0, %2%S4"
6286 [(set_attr "conds" "use")
6287 (set_attr "shift" "2")
6288 - (set_attr "length" "4,8,8")
6289 + (set_attr "insn" "mov")
6290 (set (attr "type") (if_then_else (match_operand 3 "const_int_operand" "")
6291 (const_string "alu_shift")
6292 - (const_string "alu_shift_reg")))]
6293 + (const_string "alu_shift_reg")))
6294 + (set_attr_alternative "length"
6295 + [(if_then_else (and (eq_attr "type" "alu_shift_reg")
6296 + (eq_attr "fix_janus" "yes"))
6297 + (const_int 8)
6298 + (const_int 4))
6299 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6300 + (eq_attr "fix_janus" "yes"))
6301 + (const_int 12)
6302 + (const_int 8))
6303 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6304 + (eq_attr "fix_janus" "yes"))
6305 + (const_int 12)
6306 + (const_int 8))])
6307 + (set_attr "insn" "mov")]
6308 )
6309
6310 (define_insn "*ifcompare_shift_shift"
6311 @@ -10113,7 +10655,7 @@
6312 [(match_operand:SI 3 "s_register_operand" "r")
6313 (match_operand:SI 4 "arm_rhs_operand" "rM")])))
6314 (clobber (reg:CC CC_REGNUM))]
6315 - "TARGET_ARM"
6316 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6317 "#"
6318 [(set_attr "conds" "clob")
6319 (set_attr "length" "12")]
6320 @@ -10134,12 +10676,16 @@
6321 "mov%d5\\t%0, %1%S6\;mov%D5\\t%0, %3%S7"
6322 [(set_attr "conds" "use")
6323 (set_attr "shift" "1")
6324 - (set_attr "length" "8")
6325 + (set_attr "insn" "mov")
6326 (set (attr "type") (if_then_else
6327 (and (match_operand 2 "const_int_operand" "")
6328 (match_operand 4 "const_int_operand" ""))
6329 (const_string "alu_shift")
6330 - (const_string "alu_shift_reg")))]
6331 + (const_string "alu_shift_reg")))
6332 + (set (attr "length") (if_then_else (and (eq_attr "type" "alu_shift_reg")
6333 + (eq_attr "fix_janus" "yes"))
6334 + (const_int 16)
6335 + (const_int 8)))]
6336 )
6337
6338 (define_insn "*ifcompare_not_arith"
6339 @@ -10153,7 +10699,7 @@
6340 [(match_operand:SI 2 "s_register_operand" "r")
6341 (match_operand:SI 3 "arm_rhs_operand" "rI")])))
6342 (clobber (reg:CC CC_REGNUM))]
6343 - "TARGET_ARM"
6344 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6345 "#"
6346 [(set_attr "conds" "clob")
6347 (set_attr "length" "12")]
6348 @@ -10171,6 +10717,7 @@
6349 "TARGET_ARM"
6350 "mvn%d5\\t%0, %1\;%I6%D5\\t%0, %2, %3"
6351 [(set_attr "conds" "use")
6352 + (set_attr "insn" "mvn")
6353 (set_attr "length" "8")]
6354 )
6355
6356 @@ -10185,7 +10732,7 @@
6357 (match_operand:SI 3 "arm_rhs_operand" "rI")])
6358 (not:SI (match_operand:SI 1 "s_register_operand" "r"))))
6359 (clobber (reg:CC CC_REGNUM))]
6360 - "TARGET_ARM"
6361 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6362 "#"
6363 [(set_attr "conds" "clob")
6364 (set_attr "length" "12")]
6365 @@ -10203,6 +10750,7 @@
6366 "TARGET_ARM"
6367 "mvn%D5\\t%0, %1\;%I6%d5\\t%0, %2, %3"
6368 [(set_attr "conds" "use")
6369 + (set_attr "insn" "mvn")
6370 (set_attr "length" "8")]
6371 )
6372
6373 @@ -10215,7 +10763,7 @@
6374 (neg:SI (match_operand:SI 2 "s_register_operand" "r,r"))
6375 (match_operand:SI 1 "arm_not_operand" "0,?rIK")))
6376 (clobber (reg:CC CC_REGNUM))]
6377 - "TARGET_ARM"
6378 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6379 "#"
6380 [(set_attr "conds" "clob")
6381 (set_attr "length" "8,12")]
6382 @@ -10246,7 +10794,7 @@
6383 (match_operand:SI 1 "arm_not_operand" "0,?rIK")
6384 (neg:SI (match_operand:SI 2 "s_register_operand" "r,r"))))
6385 (clobber (reg:CC CC_REGNUM))]
6386 - "TARGET_ARM"
6387 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6388 "#"
6389 [(set_attr "conds" "clob")
6390 (set_attr "length" "8,12")]
6391 @@ -10614,7 +11162,7 @@
6392 (match_dup 0)
6393 (match_operand 4 "" "")))
6394 (clobber (reg:CC CC_REGNUM))]
6395 - "TARGET_ARM && reload_completed"
6396 + "TARGET_ARM && reload_completed && !TARGET_NO_SINGLE_COND_EXEC"
6397 [(set (match_dup 5) (match_dup 6))
6398 (cond_exec (match_dup 7)
6399 (set (match_dup 0) (match_dup 4)))]
6400 @@ -10642,7 +11190,7 @@
6401 (match_operand 4 "" "")
6402 (match_dup 0)))
6403 (clobber (reg:CC CC_REGNUM))]
6404 - "TARGET_ARM && reload_completed"
6405 + "TARGET_ARM && reload_completed && !TARGET_NO_SINGLE_COND_EXEC"
6406 [(set (match_dup 5) (match_dup 6))
6407 (cond_exec (match_op_dup 1 [(match_dup 5) (const_int 0)])
6408 (set (match_dup 0) (match_dup 4)))]
6409 @@ -10663,7 +11211,7 @@
6410 (match_operand 4 "" "")
6411 (match_operand 5 "" "")))
6412 (clobber (reg:CC CC_REGNUM))]
6413 - "TARGET_ARM && reload_completed"
6414 + "TARGET_ARM && reload_completed && !TARGET_NO_SINGLE_COND_EXEC"
6415 [(set (match_dup 6) (match_dup 7))
6416 (cond_exec (match_op_dup 1 [(match_dup 6) (const_int 0)])
6417 (set (match_dup 0) (match_dup 4)))
6418 @@ -10695,7 +11243,7 @@
6419 (not:SI
6420 (match_operand:SI 5 "s_register_operand" ""))))
6421 (clobber (reg:CC CC_REGNUM))]
6422 - "TARGET_ARM && reload_completed"
6423 + "TARGET_ARM && reload_completed && !TARGET_NO_SINGLE_COND_EXEC"
6424 [(set (match_dup 6) (match_dup 7))
6425 (cond_exec (match_op_dup 1 [(match_dup 6) (const_int 0)])
6426 (set (match_dup 0) (match_dup 4)))
6427 @@ -10730,6 +11278,7 @@
6428 mvn%D4\\t%0, %2
6429 mov%d4\\t%0, %1\;mvn%D4\\t%0, %2"
6430 [(set_attr "conds" "use")
6431 + (set_attr "insn" "mvn")
6432 (set_attr "length" "4,8")]
6433 )
6434
6435 @@ -10864,6 +11413,24 @@
6436 "
6437 )
6438
6439 +(define_insn "align_16"
6440 + [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN16)]
6441 + "TARGET_EITHER"
6442 + "*
6443 + assemble_align (128);
6444 + return \"\";
6445 + "
6446 +)
6447 +
6448 +(define_insn "align_32"
6449 + [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN32)]
6450 + "TARGET_EITHER"
6451 + "*
6452 + assemble_align (256);
6453 + return \"\";
6454 + "
6455 +)
6456 +
6457 (define_insn "consttable_end"
6458 [(unspec_volatile [(const_int 0)] VUNSPEC_POOL_END)]
6459 "TARGET_EITHER"
6460 @@ -10890,6 +11457,7 @@
6461 "TARGET_THUMB1"
6462 "*
6463 making_const_table = TRUE;
6464 + gcc_assert (GET_MODE_CLASS (GET_MODE (operands[0])) != MODE_FLOAT);
6465 assemble_integer (operands[0], 2, BITS_PER_WORD, 1);
6466 assemble_zeros (2);
6467 return \"\";
6468 @@ -10902,19 +11470,30 @@
6469 "TARGET_EITHER"
6470 "*
6471 {
6472 + rtx x = operands[0];
6473 making_const_table = TRUE;
6474 - switch (GET_MODE_CLASS (GET_MODE (operands[0])))
6475 + switch (GET_MODE_CLASS (GET_MODE (x)))
6476 {
6477 case MODE_FLOAT:
6478 - {
6479 - REAL_VALUE_TYPE r;
6480 - REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
6481 - assemble_real (r, GET_MODE (operands[0]), BITS_PER_WORD);
6482 - break;
6483 - }
6484 + if (GET_MODE (x) == HFmode)
6485 + arm_emit_fp16_const (x);
6486 + else
6487 + {
6488 + REAL_VALUE_TYPE r;
6489 + REAL_VALUE_FROM_CONST_DOUBLE (r, x);
6490 + assemble_real (r, GET_MODE (x), BITS_PER_WORD);
6491 + }
6492 + break;
6493 default:
6494 - assemble_integer (operands[0], 4, BITS_PER_WORD, 1);
6495 - mark_symbol_refs_as_used (operands[0]);
6496 + /* XXX: Sometimes gcc does something really dumb and ends up with
6497 + a HIGH in a constant pool entry, usually because it's trying to
6498 + load into a VFP register. We know this will always be used in
6499 + combination with a LO_SUM which ignores the high bits, so just
6500 + strip off the HIGH. */
6501 + if (GET_CODE (x) == HIGH)
6502 + x = XEXP (x, 0);
6503 + assemble_integer (x, 4, BITS_PER_WORD, 1);
6504 + mark_symbol_refs_as_used (x);
6505 break;
6506 }
6507 return \"\";
6508 @@ -11008,6 +11587,28 @@
6509 [(set_attr "predicable" "yes")
6510 (set_attr "insn" "clz")])
6511
6512 +(define_insn "rbitsi2"
6513 + [(set (match_operand:SI 0 "s_register_operand" "=r")
6514 + (unspec:SI [(match_operand:SI 1 "s_register_operand" "r")] UNSPEC_RBIT))]
6515 + "TARGET_32BIT && arm_arch_thumb2"
6516 + "rbit%?\\t%0, %1"
6517 + [(set_attr "predicable" "yes")
6518 + (set_attr "insn" "clz")])
6519 +
6520 +(define_expand "ctzsi2"
6521 + [(set (match_operand:SI 0 "s_register_operand" "")
6522 + (ctz:SI (match_operand:SI 1 "s_register_operand" "")))]
6523 + "TARGET_32BIT && arm_arch_thumb2"
6524 + "
6525 + {
6526 + rtx tmp = gen_reg_rtx (SImode);
6527 + emit_insn (gen_rbitsi2 (tmp, operands[1]));
6528 + emit_insn (gen_clzsi2 (operands[0], tmp));
6529 + }
6530 + DONE;
6531 + "
6532 +)
6533 +
6534 ;; V5E instructions.
6535
6536 (define_insn "prefetch"
6537 @@ -11017,13 +11618,15 @@
6538 "TARGET_32BIT && arm_arch5e"
6539 "pld\\t%a0")
6540
6541 -;; General predication pattern
6542 +;; General predication pattern.
6543 +;; Conditional branches are available as both arm_cond_branch and
6544 +;; predicated arm_jump, so it doesn't matter if we disable the latter.
6545
6546 (define_cond_exec
6547 [(match_operator 0 "arm_comparison_operator"
6548 [(match_operand 1 "cc_register" "")
6549 (const_int 0)])]
6550 - "TARGET_32BIT"
6551 + "TARGET_32BIT && !TARGET_NO_SINGLE_COND_EXEC"
6552 ""
6553 )
6554
6555 diff -Nur a/gcc/config/arm/arm-modes.def b/gcc/config/arm/arm-modes.def
6556 --- a/gcc/config/arm/arm-modes.def 2007-08-02 12:49:31.000000000 +0200
6557 +++ b/gcc/config/arm/arm-modes.def 2010-01-25 09:50:28.985687200 +0100
6558 @@ -25,6 +25,11 @@
6559 FIXME What format is this? */
6560 FLOAT_MODE (XF, 12, 0);
6561
6562 +/* Half-precision floating point */
6563 +FLOAT_MODE (HF, 2, 0);
6564 +ADJUST_FLOAT_FORMAT (HF, ((arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE)
6565 + ? &arm_half_format : &ieee_half_format));
6566 +
6567 /* CCFPEmode should be used with floating inequalities,
6568 CCFPmode should be used with floating equalities.
6569 CC_NOOVmode should be used with SImode integer equalities.
6570 @@ -62,6 +67,4 @@
6571 INT_MODE (EI, 24);
6572 INT_MODE (OI, 32);
6573 INT_MODE (CI, 48);
6574 -/* ??? This should actually have 512 bits but the precision only has 9
6575 - bits. */
6576 -FRACTIONAL_INT_MODE (XI, 511, 64);
6577 +INT_MODE (XI, 64);
6578 diff -Nur a/gcc/config/arm/arm_neon.h b/gcc/config/arm/arm_neon.h
6579 --- a/gcc/config/arm/arm_neon.h 2009-04-10 01:23:07.000000000 +0200
6580 +++ b/gcc/config/arm/arm_neon.h 2010-01-25 09:50:28.985687200 +0100
6581 @@ -36,7 +36,11 @@
6582 extern "C" {
6583 #endif
6584
6585 +#if defined (__vxworks) && defined (_WRS_KERNEL)
6586 +#include <vxWorks.h>
6587 +#else
6588 #include <stdint.h>
6589 +#endif
6590
6591 typedef __builtin_neon_qi int8x8_t __attribute__ ((__vector_size__ (8)));
6592 typedef __builtin_neon_hi int16x4_t __attribute__ ((__vector_size__ (8)));
6593 @@ -61,7 +65,7 @@
6594 typedef __builtin_neon_usi uint32x4_t __attribute__ ((__vector_size__ (16)));
6595 typedef __builtin_neon_udi uint64x2_t __attribute__ ((__vector_size__ (16)));
6596
6597 -typedef __builtin_neon_sf float32_t;
6598 +typedef float float32_t;
6599 typedef __builtin_neon_poly8 poly8_t;
6600 typedef __builtin_neon_poly16 poly16_t;
6601
6602 @@ -5085,7 +5089,7 @@
6603 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6604 vset_lane_f32 (float32_t __a, float32x2_t __b, const int __c)
6605 {
6606 - return (float32x2_t)__builtin_neon_vset_lanev2sf (__a, __b, __c);
6607 + return (float32x2_t)__builtin_neon_vset_lanev2sf ((__builtin_neon_sf) __a, __b, __c);
6608 }
6609
6610 __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
6611 @@ -5151,7 +5155,7 @@
6612 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6613 vsetq_lane_f32 (float32_t __a, float32x4_t __b, const int __c)
6614 {
6615 - return (float32x4_t)__builtin_neon_vset_lanev4sf (__a, __b, __c);
6616 + return (float32x4_t)__builtin_neon_vset_lanev4sf ((__builtin_neon_sf) __a, __b, __c);
6617 }
6618
6619 __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__))
6620 @@ -5283,7 +5287,7 @@
6621 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6622 vdup_n_f32 (float32_t __a)
6623 {
6624 - return (float32x2_t)__builtin_neon_vdup_nv2sf (__a);
6625 + return (float32x2_t)__builtin_neon_vdup_nv2sf ((__builtin_neon_sf) __a);
6626 }
6627
6628 __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
6629 @@ -5349,7 +5353,7 @@
6630 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6631 vdupq_n_f32 (float32_t __a)
6632 {
6633 - return (float32x4_t)__builtin_neon_vdup_nv4sf (__a);
6634 + return (float32x4_t)__builtin_neon_vdup_nv4sf ((__builtin_neon_sf) __a);
6635 }
6636
6637 __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__))
6638 @@ -5415,7 +5419,7 @@
6639 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6640 vmov_n_f32 (float32_t __a)
6641 {
6642 - return (float32x2_t)__builtin_neon_vdup_nv2sf (__a);
6643 + return (float32x2_t)__builtin_neon_vdup_nv2sf ((__builtin_neon_sf) __a);
6644 }
6645
6646 __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
6647 @@ -5481,7 +5485,7 @@
6648 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6649 vmovq_n_f32 (float32_t __a)
6650 {
6651 - return (float32x4_t)__builtin_neon_vdup_nv4sf (__a);
6652 + return (float32x4_t)__builtin_neon_vdup_nv4sf ((__builtin_neon_sf) __a);
6653 }
6654
6655 __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__))
6656 @@ -6591,7 +6595,7 @@
6657 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6658 vmul_n_f32 (float32x2_t __a, float32_t __b)
6659 {
6660 - return (float32x2_t)__builtin_neon_vmul_nv2sf (__a, __b, 3);
6661 + return (float32x2_t)__builtin_neon_vmul_nv2sf (__a, (__builtin_neon_sf) __b, 3);
6662 }
6663
6664 __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
6665 @@ -6621,7 +6625,7 @@
6666 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6667 vmulq_n_f32 (float32x4_t __a, float32_t __b)
6668 {
6669 - return (float32x4_t)__builtin_neon_vmul_nv4sf (__a, __b, 3);
6670 + return (float32x4_t)__builtin_neon_vmul_nv4sf (__a, (__builtin_neon_sf) __b, 3);
6671 }
6672
6673 __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
6674 @@ -6735,7 +6739,7 @@
6675 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6676 vmla_n_f32 (float32x2_t __a, float32x2_t __b, float32_t __c)
6677 {
6678 - return (float32x2_t)__builtin_neon_vmla_nv2sf (__a, __b, __c, 3);
6679 + return (float32x2_t)__builtin_neon_vmla_nv2sf (__a, __b, (__builtin_neon_sf) __c, 3);
6680 }
6681
6682 __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
6683 @@ -6765,7 +6769,7 @@
6684 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6685 vmlaq_n_f32 (float32x4_t __a, float32x4_t __b, float32_t __c)
6686 {
6687 - return (float32x4_t)__builtin_neon_vmla_nv4sf (__a, __b, __c, 3);
6688 + return (float32x4_t)__builtin_neon_vmla_nv4sf (__a, __b, (__builtin_neon_sf) __c, 3);
6689 }
6690
6691 __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
6692 @@ -6831,7 +6835,7 @@
6693 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6694 vmls_n_f32 (float32x2_t __a, float32x2_t __b, float32_t __c)
6695 {
6696 - return (float32x2_t)__builtin_neon_vmls_nv2sf (__a, __b, __c, 3);
6697 + return (float32x2_t)__builtin_neon_vmls_nv2sf (__a, __b, (__builtin_neon_sf) __c, 3);
6698 }
6699
6700 __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
6701 @@ -6861,7 +6865,7 @@
6702 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6703 vmlsq_n_f32 (float32x4_t __a, float32x4_t __b, float32_t __c)
6704 {
6705 - return (float32x4_t)__builtin_neon_vmls_nv4sf (__a, __b, __c, 3);
6706 + return (float32x4_t)__builtin_neon_vmls_nv4sf (__a, __b, (__builtin_neon_sf) __c, 3);
6707 }
6708
6709 __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
6710 @@ -7851,7 +7855,7 @@
6711 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6712 vld1_f32 (const float32_t * __a)
6713 {
6714 - return (float32x2_t)__builtin_neon_vld1v2sf (__a);
6715 + return (float32x2_t)__builtin_neon_vld1v2sf ((const __builtin_neon_sf *) __a);
6716 }
6717
6718 __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
6719 @@ -7917,7 +7921,7 @@
6720 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6721 vld1q_f32 (const float32_t * __a)
6722 {
6723 - return (float32x4_t)__builtin_neon_vld1v4sf (__a);
6724 + return (float32x4_t)__builtin_neon_vld1v4sf ((const __builtin_neon_sf *) __a);
6725 }
6726
6727 __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__))
6728 @@ -7977,7 +7981,7 @@
6729 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6730 vld1_lane_f32 (const float32_t * __a, float32x2_t __b, const int __c)
6731 {
6732 - return (float32x2_t)__builtin_neon_vld1_lanev2sf (__a, __b, __c);
6733 + return (float32x2_t)__builtin_neon_vld1_lanev2sf ((const __builtin_neon_sf *) __a, __b, __c);
6734 }
6735
6736 __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
6737 @@ -8043,7 +8047,7 @@
6738 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6739 vld1q_lane_f32 (const float32_t * __a, float32x4_t __b, const int __c)
6740 {
6741 - return (float32x4_t)__builtin_neon_vld1_lanev4sf (__a, __b, __c);
6742 + return (float32x4_t)__builtin_neon_vld1_lanev4sf ((const __builtin_neon_sf *) __a, __b, __c);
6743 }
6744
6745 __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__))
6746 @@ -8109,7 +8113,7 @@
6747 __extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
6748 vld1_dup_f32 (const float32_t * __a)
6749 {
6750 - return (float32x2_t)__builtin_neon_vld1_dupv2sf (__a);
6751 + return (float32x2_t)__builtin_neon_vld1_dupv2sf ((const __builtin_neon_sf *) __a);
6752 }
6753
6754 __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
6755 @@ -8175,7 +8179,7 @@
6756 __extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
6757 vld1q_dup_f32 (const float32_t * __a)
6758 {
6759 - return (float32x4_t)__builtin_neon_vld1_dupv4sf (__a);
6760 + return (float32x4_t)__builtin_neon_vld1_dupv4sf ((const __builtin_neon_sf *) __a);
6761 }
6762
6763 __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__))
6764 @@ -8247,7 +8251,7 @@
6765 __extension__ static __inline void __attribute__ ((__always_inline__))
6766 vst1_f32 (float32_t * __a, float32x2_t __b)
6767 {
6768 - __builtin_neon_vst1v2sf (__a, __b);
6769 + __builtin_neon_vst1v2sf ((__builtin_neon_sf *) __a, __b);
6770 }
6771
6772 __extension__ static __inline void __attribute__ ((__always_inline__))
6773 @@ -8313,7 +8317,7 @@
6774 __extension__ static __inline void __attribute__ ((__always_inline__))
6775 vst1q_f32 (float32_t * __a, float32x4_t __b)
6776 {
6777 - __builtin_neon_vst1v4sf (__a, __b);
6778 + __builtin_neon_vst1v4sf ((__builtin_neon_sf *) __a, __b);
6779 }
6780
6781 __extension__ static __inline void __attribute__ ((__always_inline__))
6782 @@ -8373,7 +8377,7 @@
6783 __extension__ static __inline void __attribute__ ((__always_inline__))
6784 vst1_lane_f32 (float32_t * __a, float32x2_t __b, const int __c)
6785 {
6786 - __builtin_neon_vst1_lanev2sf (__a, __b, __c);
6787 + __builtin_neon_vst1_lanev2sf ((__builtin_neon_sf *) __a, __b, __c);
6788 }
6789
6790 __extension__ static __inline void __attribute__ ((__always_inline__))
6791 @@ -8439,7 +8443,7 @@
6792 __extension__ static __inline void __attribute__ ((__always_inline__))
6793 vst1q_lane_f32 (float32_t * __a, float32x4_t __b, const int __c)
6794 {
6795 - __builtin_neon_vst1_lanev4sf (__a, __b, __c);
6796 + __builtin_neon_vst1_lanev4sf ((__builtin_neon_sf *) __a, __b, __c);
6797 }
6798
6799 __extension__ static __inline void __attribute__ ((__always_inline__))
6800 @@ -8512,7 +8516,7 @@
6801 vld2_f32 (const float32_t * __a)
6802 {
6803 union { float32x2x2_t __i; __builtin_neon_ti __o; } __rv;
6804 - __rv.__o = __builtin_neon_vld2v2sf (__a);
6805 + __rv.__o = __builtin_neon_vld2v2sf ((const __builtin_neon_sf *) __a);
6806 return __rv.__i;
6807 }
6808
6809 @@ -8600,7 +8604,7 @@
6810 vld2q_f32 (const float32_t * __a)
6811 {
6812 union { float32x4x2_t __i; __builtin_neon_oi __o; } __rv;
6813 - __rv.__o = __builtin_neon_vld2v4sf (__a);
6814 + __rv.__o = __builtin_neon_vld2v4sf ((const __builtin_neon_sf *) __a);
6815 return __rv.__i;
6816 }
6817
6818 @@ -8676,7 +8680,7 @@
6819 {
6820 union { float32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b };
6821 union { float32x2x2_t __i; __builtin_neon_ti __o; } __rv;
6822 - __rv.__o = __builtin_neon_vld2_lanev2sf (__a, __bu.__o, __c);
6823 + __rv.__o = __builtin_neon_vld2_lanev2sf ((const __builtin_neon_sf *) __a, __bu.__o, __c);
6824 return __rv.__i;
6825 }
6826
6827 @@ -8748,7 +8752,7 @@
6828 {
6829 union { float32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b };
6830 union { float32x4x2_t __i; __builtin_neon_oi __o; } __rv;
6831 - __rv.__o = __builtin_neon_vld2_lanev4sf (__a, __bu.__o, __c);
6832 + __rv.__o = __builtin_neon_vld2_lanev4sf ((const __builtin_neon_sf *) __a, __bu.__o, __c);
6833 return __rv.__i;
6834 }
6835
6836 @@ -8807,7 +8811,7 @@
6837 vld2_dup_f32 (const float32_t * __a)
6838 {
6839 union { float32x2x2_t __i; __builtin_neon_ti __o; } __rv;
6840 - __rv.__o = __builtin_neon_vld2_dupv2sf (__a);
6841 + __rv.__o = __builtin_neon_vld2_dupv2sf ((const __builtin_neon_sf *) __a);
6842 return __rv.__i;
6843 }
6844
6845 @@ -8892,7 +8896,7 @@
6846 vst2_f32 (float32_t * __a, float32x2x2_t __b)
6847 {
6848 union { float32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b };
6849 - __builtin_neon_vst2v2sf (__a, __bu.__o);
6850 + __builtin_neon_vst2v2sf ((__builtin_neon_sf *) __a, __bu.__o);
6851 }
6852
6853 __extension__ static __inline void __attribute__ ((__always_inline__))
6854 @@ -8969,7 +8973,7 @@
6855 vst2q_f32 (float32_t * __a, float32x4x2_t __b)
6856 {
6857 union { float32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b };
6858 - __builtin_neon_vst2v4sf (__a, __bu.__o);
6859 + __builtin_neon_vst2v4sf ((__builtin_neon_sf *) __a, __bu.__o);
6860 }
6861
6862 __extension__ static __inline void __attribute__ ((__always_inline__))
6863 @@ -9032,7 +9036,7 @@
6864 vst2_lane_f32 (float32_t * __a, float32x2x2_t __b, const int __c)
6865 {
6866 union { float32x2x2_t __i; __builtin_neon_ti __o; } __bu = { __b };
6867 - __builtin_neon_vst2_lanev2sf (__a, __bu.__o, __c);
6868 + __builtin_neon_vst2_lanev2sf ((__builtin_neon_sf *) __a, __bu.__o, __c);
6869 }
6870
6871 __extension__ static __inline void __attribute__ ((__always_inline__))
6872 @@ -9088,7 +9092,7 @@
6873 vst2q_lane_f32 (float32_t * __a, float32x4x2_t __b, const int __c)
6874 {
6875 union { float32x4x2_t __i; __builtin_neon_oi __o; } __bu = { __b };
6876 - __builtin_neon_vst2_lanev4sf (__a, __bu.__o, __c);
6877 + __builtin_neon_vst2_lanev4sf ((__builtin_neon_sf *) __a, __bu.__o, __c);
6878 }
6879
6880 __extension__ static __inline void __attribute__ ((__always_inline__))
6881 @@ -9140,7 +9144,7 @@
6882 vld3_f32 (const float32_t * __a)
6883 {
6884 union { float32x2x3_t __i; __builtin_neon_ei __o; } __rv;
6885 - __rv.__o = __builtin_neon_vld3v2sf (__a);
6886 + __rv.__o = __builtin_neon_vld3v2sf ((const __builtin_neon_sf *) __a);
6887 return __rv.__i;
6888 }
6889
6890 @@ -9228,7 +9232,7 @@
6891 vld3q_f32 (const float32_t * __a)
6892 {
6893 union { float32x4x3_t __i; __builtin_neon_ci __o; } __rv;
6894 - __rv.__o = __builtin_neon_vld3v4sf (__a);
6895 + __rv.__o = __builtin_neon_vld3v4sf ((const __builtin_neon_sf *) __a);
6896 return __rv.__i;
6897 }
6898
6899 @@ -9304,7 +9308,7 @@
6900 {
6901 union { float32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b };
6902 union { float32x2x3_t __i; __builtin_neon_ei __o; } __rv;
6903 - __rv.__o = __builtin_neon_vld3_lanev2sf (__a, __bu.__o, __c);
6904 + __rv.__o = __builtin_neon_vld3_lanev2sf ((const __builtin_neon_sf *) __a, __bu.__o, __c);
6905 return __rv.__i;
6906 }
6907
6908 @@ -9376,7 +9380,7 @@
6909 {
6910 union { float32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b };
6911 union { float32x4x3_t __i; __builtin_neon_ci __o; } __rv;
6912 - __rv.__o = __builtin_neon_vld3_lanev4sf (__a, __bu.__o, __c);
6913 + __rv.__o = __builtin_neon_vld3_lanev4sf ((const __builtin_neon_sf *) __a, __bu.__o, __c);
6914 return __rv.__i;
6915 }
6916
6917 @@ -9435,7 +9439,7 @@
6918 vld3_dup_f32 (const float32_t * __a)
6919 {
6920 union { float32x2x3_t __i; __builtin_neon_ei __o; } __rv;
6921 - __rv.__o = __builtin_neon_vld3_dupv2sf (__a);
6922 + __rv.__o = __builtin_neon_vld3_dupv2sf ((const __builtin_neon_sf *) __a);
6923 return __rv.__i;
6924 }
6925
6926 @@ -9520,7 +9524,7 @@
6927 vst3_f32 (float32_t * __a, float32x2x3_t __b)
6928 {
6929 union { float32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b };
6930 - __builtin_neon_vst3v2sf (__a, __bu.__o);
6931 + __builtin_neon_vst3v2sf ((__builtin_neon_sf *) __a, __bu.__o);
6932 }
6933
6934 __extension__ static __inline void __attribute__ ((__always_inline__))
6935 @@ -9597,7 +9601,7 @@
6936 vst3q_f32 (float32_t * __a, float32x4x3_t __b)
6937 {
6938 union { float32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b };
6939 - __builtin_neon_vst3v4sf (__a, __bu.__o);
6940 + __builtin_neon_vst3v4sf ((__builtin_neon_sf *) __a, __bu.__o);
6941 }
6942
6943 __extension__ static __inline void __attribute__ ((__always_inline__))
6944 @@ -9660,7 +9664,7 @@
6945 vst3_lane_f32 (float32_t * __a, float32x2x3_t __b, const int __c)
6946 {
6947 union { float32x2x3_t __i; __builtin_neon_ei __o; } __bu = { __b };
6948 - __builtin_neon_vst3_lanev2sf (__a, __bu.__o, __c);
6949 + __builtin_neon_vst3_lanev2sf ((__builtin_neon_sf *) __a, __bu.__o, __c);
6950 }
6951
6952 __extension__ static __inline void __attribute__ ((__always_inline__))
6953 @@ -9716,7 +9720,7 @@
6954 vst3q_lane_f32 (float32_t * __a, float32x4x3_t __b, const int __c)
6955 {
6956 union { float32x4x3_t __i; __builtin_neon_ci __o; } __bu = { __b };
6957 - __builtin_neon_vst3_lanev4sf (__a, __bu.__o, __c);
6958 + __builtin_neon_vst3_lanev4sf ((__builtin_neon_sf *) __a, __bu.__o, __c);
6959 }
6960
6961 __extension__ static __inline void __attribute__ ((__always_inline__))
6962 @@ -9768,7 +9772,7 @@
6963 vld4_f32 (const float32_t * __a)
6964 {
6965 union { float32x2x4_t __i; __builtin_neon_oi __o; } __rv;
6966 - __rv.__o = __builtin_neon_vld4v2sf (__a);
6967 + __rv.__o = __builtin_neon_vld4v2sf ((const __builtin_neon_sf *) __a);
6968 return __rv.__i;
6969 }
6970
6971 @@ -9856,7 +9860,7 @@
6972 vld4q_f32 (const float32_t * __a)
6973 {
6974 union { float32x4x4_t __i; __builtin_neon_xi __o; } __rv;
6975 - __rv.__o = __builtin_neon_vld4v4sf (__a);
6976 + __rv.__o = __builtin_neon_vld4v4sf ((const __builtin_neon_sf *) __a);
6977 return __rv.__i;
6978 }
6979
6980 @@ -9932,7 +9936,7 @@
6981 {
6982 union { float32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b };
6983 union { float32x2x4_t __i; __builtin_neon_oi __o; } __rv;
6984 - __rv.__o = __builtin_neon_vld4_lanev2sf (__a, __bu.__o, __c);
6985 + __rv.__o = __builtin_neon_vld4_lanev2sf ((const __builtin_neon_sf *) __a, __bu.__o, __c);
6986 return __rv.__i;
6987 }
6988
6989 @@ -10004,7 +10008,7 @@
6990 {
6991 union { float32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b };
6992 union { float32x4x4_t __i; __builtin_neon_xi __o; } __rv;
6993 - __rv.__o = __builtin_neon_vld4_lanev4sf (__a, __bu.__o, __c);
6994 + __rv.__o = __builtin_neon_vld4_lanev4sf ((const __builtin_neon_sf *) __a, __bu.__o, __c);
6995 return __rv.__i;
6996 }
6997
6998 @@ -10063,7 +10067,7 @@
6999 vld4_dup_f32 (const float32_t * __a)
7000 {
7001 union { float32x2x4_t __i; __builtin_neon_oi __o; } __rv;
7002 - __rv.__o = __builtin_neon_vld4_dupv2sf (__a);
7003 + __rv.__o = __builtin_neon_vld4_dupv2sf ((const __builtin_neon_sf *) __a);
7004 return __rv.__i;
7005 }
7006
7007 @@ -10148,7 +10152,7 @@
7008 vst4_f32 (float32_t * __a, float32x2x4_t __b)
7009 {
7010 union { float32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b };
7011 - __builtin_neon_vst4v2sf (__a, __bu.__o);
7012 + __builtin_neon_vst4v2sf ((__builtin_neon_sf *) __a, __bu.__o);
7013 }
7014
7015 __extension__ static __inline void __attribute__ ((__always_inline__))
7016 @@ -10225,7 +10229,7 @@
7017 vst4q_f32 (float32_t * __a, float32x4x4_t __b)
7018 {
7019 union { float32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b };
7020 - __builtin_neon_vst4v4sf (__a, __bu.__o);
7021 + __builtin_neon_vst4v4sf ((__builtin_neon_sf *) __a, __bu.__o);
7022 }
7023
7024 __extension__ static __inline void __attribute__ ((__always_inline__))
7025 @@ -10288,7 +10292,7 @@
7026 vst4_lane_f32 (float32_t * __a, float32x2x4_t __b, const int __c)
7027 {
7028 union { float32x2x4_t __i; __builtin_neon_oi __o; } __bu = { __b };
7029 - __builtin_neon_vst4_lanev2sf (__a, __bu.__o, __c);
7030 + __builtin_neon_vst4_lanev2sf ((__builtin_neon_sf *) __a, __bu.__o, __c);
7031 }
7032
7033 __extension__ static __inline void __attribute__ ((__always_inline__))
7034 @@ -10344,7 +10348,7 @@
7035 vst4q_lane_f32 (float32_t * __a, float32x4x4_t __b, const int __c)
7036 {
7037 union { float32x4x4_t __i; __builtin_neon_xi __o; } __bu = { __b };
7038 - __builtin_neon_vst4_lanev4sf (__a, __bu.__o, __c);
7039 + __builtin_neon_vst4_lanev4sf ((__builtin_neon_sf *) __a, __bu.__o, __c);
7040 }
7041
7042 __extension__ static __inline void __attribute__ ((__always_inline__))
7043 diff -Nur a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt
7044 --- a/gcc/config/arm/arm.opt 2009-02-20 16:20:38.000000000 +0100
7045 +++ b/gcc/config/arm/arm.opt 2010-01-25 09:50:28.985687200 +0100
7046 @@ -78,6 +78,10 @@
7047 mfp=
7048 Target RejectNegative Joined Undocumented Var(target_fpe_name)
7049
7050 +mfp16-format=
7051 +Target RejectNegative Joined Var(target_fp16_format_name)
7052 +Specify the __fp16 floating-point format
7053 +
7054 ;; Now ignored.
7055 mfpe
7056 Target RejectNegative Mask(FPE) Undocumented
7057 @@ -93,6 +97,10 @@
7058 Target RejectNegative
7059 Alias for -mfloat-abi=hard
7060
7061 +mfix-janus-2cc
7062 +Target Report Mask(FIX_JANUS)
7063 +Work around hardware errata for Avalent Janus 2CC cores.
7064 +
7065 mlittle-endian
7066 Target Report RejectNegative InverseMask(BIG_END)
7067 Assume target CPU is configured as little endian
7068 @@ -101,6 +109,10 @@
7069 Target Report Mask(LONG_CALLS)
7070 Generate call insns as indirect calls, if necessary
7071
7072 +mmarvell-div
7073 +Target Report Mask(MARVELL_DIV)
7074 +Generate hardware integer division instructions supported by some Marvell cores.
7075 +
7076 mpic-register=
7077 Target RejectNegative Joined Var(arm_pic_register_string)
7078 Specify the register to be used for PIC addressing
7079 @@ -157,6 +169,10 @@
7080 Target Report Mask(NEON_VECTORIZE_QUAD)
7081 Use Neon quad-word (rather than double-word) registers for vectorization
7082
7083 +mlow-irq-latency
7084 +Target Report Var(low_irq_latency)
7085 +Try to reduce interrupt latency of the generated code
7086 +
7087 mword-relocations
7088 Target Report Var(target_word_relocations) Init(TARGET_DEFAULT_WORD_RELOCATIONS)
7089 Only generate absolute relocations on word sized values.
7090 diff -Nur a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
7091 --- a/gcc/config/arm/arm-protos.h 2009-02-20 16:20:38.000000000 +0100
7092 +++ b/gcc/config/arm/arm-protos.h 2010-01-25 09:50:28.985687200 +0100
7093 @@ -88,7 +88,7 @@
7094
7095 extern int cirrus_memory_offset (rtx);
7096 extern int arm_coproc_mem_operand (rtx, bool);
7097 -extern int neon_vector_mem_operand (rtx, bool);
7098 +extern int neon_vector_mem_operand (rtx, int);
7099 extern int neon_struct_mem_operand (rtx);
7100 extern int arm_no_early_store_addr_dep (rtx, rtx);
7101 extern int arm_no_early_alu_shift_dep (rtx, rtx);
7102 @@ -144,6 +144,7 @@
7103 extern int arm_debugger_arg_offset (int, rtx);
7104 extern bool arm_is_long_call_p (tree);
7105 extern int arm_emit_vector_const (FILE *, rtx);
7106 +extern void arm_emit_fp16_const (rtx c);
7107 extern const char * arm_output_load_gr (rtx *);
7108 extern const char *vfp_output_fstmd (rtx *);
7109 extern void arm_set_return_address (rtx, rtx);
7110 @@ -154,13 +155,15 @@
7111
7112 #if defined TREE_CODE
7113 extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
7114 +extern void arm_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
7115 + tree, bool);
7116 extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
7117 extern bool arm_pad_arg_upward (enum machine_mode, const_tree);
7118 extern bool arm_pad_reg_upward (enum machine_mode, tree, int);
7119 extern bool arm_needs_doubleword_align (enum machine_mode, tree);
7120 -extern rtx arm_function_value(const_tree, const_tree);
7121 #endif
7122 extern int arm_apply_result_size (void);
7123 +extern rtx aapcs_libcall_value (enum machine_mode);
7124
7125 #endif /* RTX_CODE */
7126
7127 diff -Nur a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md
7128 --- a/gcc/config/arm/arm-tune.md 2009-07-22 09:43:59.000000000 +0200
7129 +++ b/gcc/config/arm/arm-tune.md 2010-01-25 09:50:28.985687200 +0100
7130 @@ -1,5 +1,5 @@
7131 ;; -*- buffer-read-only: t -*-
7132 ;; Generated automatically by gentune.sh from arm-cores.def
7133 (define_attr "tune"
7134 - "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,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1"
7135 + "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,marvell_f,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1,cortexm0"
7136 (const (symbol_ref "arm_tune")))
7137 diff -Nur a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h
7138 --- a/gcc/config/arm/bpabi.h 2009-02-20 16:20:38.000000000 +0100
7139 +++ b/gcc/config/arm/bpabi.h 2010-01-25 09:50:28.985687200 +0100
7140 @@ -30,7 +30,7 @@
7141
7142 /* Section 4.1 of the AAPCS requires the use of VFP format. */
7143 #undef FPUTYPE_DEFAULT
7144 -#define FPUTYPE_DEFAULT FPUTYPE_VFP
7145 +#define FPUTYPE_DEFAULT "vfp"
7146
7147 /* TARGET_BIG_ENDIAN_DEFAULT is set in
7148 config.gcc for big endian configurations. */
7149 @@ -53,6 +53,8 @@
7150
7151 #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}"
7152
7153 +#define BE8_LINK_SPEC " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
7154 +
7155 /* Tell the assembler to build BPABI binaries. */
7156 #undef SUBTARGET_EXTRA_ASM_SPEC
7157 #define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC
7158 @@ -65,7 +67,7 @@
7159 #define BPABI_LINK_SPEC \
7160 "%{mbig-endian:-EB} %{mlittle-endian:-EL} " \
7161 "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} " \
7162 - "-X" SUBTARGET_EXTRA_LINK_SPEC TARGET_FIX_V4BX_SPEC
7163 + "-X" SUBTARGET_EXTRA_LINK_SPEC TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC
7164
7165 #undef LINK_SPEC
7166 #define LINK_SPEC BPABI_LINK_SPEC
7167 @@ -90,16 +92,22 @@
7168 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
7169 #endif
7170 #ifdef L_fixdfdi
7171 -#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz)
7172 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz) \
7173 + extern DWtype __fixdfdi (DFtype) __attribute__((pcs("aapcs"))); \
7174 + extern UDWtype __fixunsdfdi (DFtype) __asm__("__aeabi_d2ulz") __attribute__((pcs("aapcs")));
7175 #endif
7176 #ifdef L_fixunsdfdi
7177 -#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz)
7178 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz) \
7179 + extern UDWtype __fixunsdfdi (DFtype) __attribute__((pcs("aapcs")));
7180 #endif
7181 #ifdef L_fixsfdi
7182 -#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz)
7183 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz) \
7184 + extern DWtype __fixsfdi (SFtype) __attribute__((pcs("aapcs"))); \
7185 + extern UDWtype __fixunssfdi (SFtype) __asm__("__aeabi_f2ulz") __attribute__((pcs("aapcs")));
7186 #endif
7187 #ifdef L_fixunssfdi
7188 -#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz)
7189 +#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz) \
7190 + extern UDWtype __fixunssfdi (SFtype) __attribute__((pcs("aapcs")));
7191 #endif
7192 #ifdef L_floatdidf
7193 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, l2d)
7194 diff -Nur a/gcc/config/arm/bpabi.S b/gcc/config/arm/bpabi.S
7195 --- a/gcc/config/arm/bpabi.S 2009-04-10 01:23:07.000000000 +0200
7196 +++ b/gcc/config/arm/bpabi.S 2010-01-25 09:50:28.985687200 +0100
7197 @@ -64,20 +64,69 @@
7198
7199 #endif /* L_aeabi_ulcmp */
7200
7201 +.macro test_div_by_zero signed
7202 +/* Tail-call to divide-by-zero handlers which may be overridden by the user,
7203 + so unwinding works properly. */
7204 +#if defined(__thumb2__)
7205 + cbnz yyh, 1f
7206 + cbnz yyl, 1f
7207 + cmp xxh, #0
7208 + do_it eq
7209 + cmpeq xxl, #0
7210 + .ifc \signed, unsigned
7211 + beq 2f
7212 + mov xxh, #0xffffffff
7213 + mov xxl, xxh
7214 +2:
7215 + .else
7216 + do_it lt, t
7217 + movlt xxl, #0
7218 + movlt xxh, #0x80000000
7219 + do_it gt, t
7220 + movgt xxh, #0x7fffffff
7221 + movgt xxl, #0xffffffff
7222 + .endif
7223 + b SYM (__aeabi_ldiv0) __PLT__
7224 +1:
7225 +#else
7226 + /* Note: Thumb-1 code calls via an ARM shim on processors which
7227 + support ARM mode. */
7228 + cmp yyh, #0
7229 + cmpeq yyl, #0
7230 + bne 2f
7231 + cmp xxh, #0
7232 + cmpeq xxl, #0
7233 + .ifc \signed, unsigned
7234 + movne xxh, #0xffffffff
7235 + movne xxl, #0xffffffff
7236 + .else
7237 + movlt xxh, #0x80000000
7238 + movlt xxl, #0
7239 + movgt xxh, #0x7fffffff
7240 + movgt xxl, #0xffffffff
7241 + .endif
7242 + b SYM (__aeabi_ldiv0) __PLT__
7243 +2:
7244 +#endif
7245 +.endm
7246 +
7247 #ifdef L_aeabi_ldivmod
7248
7249 ARM_FUNC_START aeabi_ldivmod
7250 + test_div_by_zero signed
7251 +
7252 sub sp, sp, #8
7253 -#if defined(__thumb2__)
7254 +/* Low latency and Thumb-2 do_push implementations can't push sp directly. */
7255 +#if defined(__thumb2__) || defined(__irq_low_latency__)
7256 mov ip, sp
7257 - push {ip, lr}
7258 + do_push (ip, lr)
7259 #else
7260 - do_push {sp, lr}
7261 + stmfd sp!, {sp, lr}
7262 #endif
7263 bl SYM(__gnu_ldivmod_helper) __PLT__
7264 ldr lr, [sp, #4]
7265 add sp, sp, #8
7266 - do_pop {r2, r3}
7267 + do_pop (r2, r3)
7268 RET
7269
7270 #endif /* L_aeabi_ldivmod */
7271 @@ -85,17 +134,20 @@
7272 #ifdef L_aeabi_uldivmod
7273
7274 ARM_FUNC_START aeabi_uldivmod
7275 + test_div_by_zero unsigned
7276 +
7277 sub sp, sp, #8
7278 -#if defined(__thumb2__)
7279 +/* Low latency and Thumb-2 do_push implementations can't push sp directly. */
7280 +#if defined(__thumb2__) || defined(__irq_low_latency__)
7281 mov ip, sp
7282 - push {ip, lr}
7283 + do_push (ip, lr)
7284 #else
7285 - do_push {sp, lr}
7286 + stmfd sp!, {sp, lr}
7287 #endif
7288 bl SYM(__gnu_uldivmod_helper) __PLT__
7289 ldr lr, [sp, #4]
7290 add sp, sp, #8
7291 - do_pop {r2, r3}
7292 + do_pop (r2, r3)
7293 RET
7294
7295 #endif /* L_aeabi_divmod */
7296 diff -Nur a/gcc/config/arm/bpabi-v6m.S b/gcc/config/arm/bpabi-v6m.S
7297 --- a/gcc/config/arm/bpabi-v6m.S 2009-04-10 01:23:07.000000000 +0200
7298 +++ b/gcc/config/arm/bpabi-v6m.S 2010-01-25 09:50:28.985687200 +0100
7299 @@ -69,9 +69,52 @@
7300
7301 #endif /* L_aeabi_ulcmp */
7302
7303 +.macro test_div_by_zero signed
7304 + cmp yyh, #0
7305 + bne 7f
7306 + cmp yyl, #0
7307 + bne 7f
7308 + cmp xxh, #0
7309 + bne 2f
7310 + cmp xxl, #0
7311 +2:
7312 + .ifc \signed, unsigned
7313 + beq 3f
7314 + mov xxh, #0
7315 + mvn xxh, xxh @ 0xffffffff
7316 + mov xxl, xxh
7317 +3:
7318 + .else
7319 + beq 5f
7320 + blt 6f
7321 + mov xxl, #0
7322 + mvn xxl, xxl @ 0xffffffff
7323 + lsr xxh, xxl, #1 @ 0x7fffffff
7324 + b 5f
7325 +6: mov xxh, #0x80
7326 + lsl xxh, xxh, #24 @ 0x80000000
7327 + mov xxl, #0
7328 +5:
7329 + .endif
7330 + @ tailcalls are tricky on v6-m.
7331 + push {r0, r1, r2}
7332 + ldr r0, 1f
7333 + adr r1, 1f
7334 + add r0, r1
7335 + str r0, [sp, #8]
7336 + @ We know we are not on armv4t, so pop pc is safe.
7337 + pop {r0, r1, pc}
7338 + .align 2
7339 +1:
7340 + .word __aeabi_ldiv0 - 1b
7341 +7:
7342 +.endm
7343 +
7344 #ifdef L_aeabi_ldivmod
7345
7346 FUNC_START aeabi_ldivmod
7347 + test_div_by_zero signed
7348 +
7349 push {r0, r1}
7350 mov r0, sp
7351 push {r0, lr}
7352 @@ -89,6 +132,8 @@
7353 #ifdef L_aeabi_uldivmod
7354
7355 FUNC_START aeabi_uldivmod
7356 + test_div_by_zero unsigned
7357 +
7358 push {r0, r1}
7359 mov r0, sp
7360 push {r0, lr}
7361 diff -Nur a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md
7362 --- a/gcc/config/arm/constraints.md 2009-02-20 16:20:38.000000000 +0100
7363 +++ b/gcc/config/arm/constraints.md 2010-01-25 09:50:28.985687200 +0100
7364 @@ -25,14 +25,15 @@
7365 ;; In ARM state, 'l' is an alias for 'r'
7366
7367 ;; The following normal constraints have been used:
7368 -;; in ARM/Thumb-2 state: G, H, I, J, K, L, M
7369 +;; in ARM/Thumb-2 state: G, H, I, j, J, K, L, M
7370 ;; in Thumb-1 state: I, J, K, L, M, N, O
7371
7372 ;; The following multi-letter normal constraints have been used:
7373 -;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv
7374 +;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy
7375 +;; in Thumb-1 state: Pa, Pb
7376
7377 ;; The following memory constraints have been used:
7378 -;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Us
7379 +;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Um, Us
7380 ;; in ARM state: Uq
7381
7382
7383 @@ -65,6 +66,13 @@
7384 (define_register_constraint "h" "TARGET_THUMB ? HI_REGS : NO_REGS"
7385 "In Thumb state the core registers @code{r8}-@code{r15}.")
7386
7387 +(define_constraint "j"
7388 + "A constant suitable for a MOVW instruction. (ARM/Thumb-2)"
7389 + (and (match_test "TARGET_32BIT && arm_arch_thumb2")
7390 + (ior (match_code "high")
7391 + (and (match_code "const_int")
7392 + (match_test "(ival & 0xffff0000) == 0")))))
7393 +
7394 (define_register_constraint "k" "STACK_REG"
7395 "@internal The stack register.")
7396
7397 @@ -116,11 +124,9 @@
7398 : ((ival >= 0 && ival <= 1020) && ((ival & 3) == 0))")))
7399
7400 (define_constraint "N"
7401 - "In ARM/Thumb-2 state a constant suitable for a MOVW instruction.
7402 - In Thumb-1 state a constant in the range 0-31."
7403 + "Thumb-1 state a constant in the range 0-31."
7404 (and (match_code "const_int")
7405 - (match_test "TARGET_32BIT ? arm_arch_thumb2 && ((ival & 0xffff0000) == 0)
7406 - : (ival >= 0 && ival <= 31)")))
7407 + (match_test "!TARGET_32BIT && (ival >= 0 && ival <= 31)")))
7408
7409 (define_constraint "O"
7410 "In Thumb-1 state a constant that is a multiple of 4 in the range
7411 @@ -129,6 +135,18 @@
7412 (match_test "TARGET_THUMB1 && ival >= -508 && ival <= 508
7413 && ((ival & 3) == 0)")))
7414
7415 +(define_constraint "Pa"
7416 + "@internal In Thumb-1 state a constant in the range -510 to +510"
7417 + (and (match_code "const_int")
7418 + (match_test "TARGET_THUMB1 && ival >= -510 && ival <= 510
7419 + && (ival > 255 || ival < -255)")))
7420 +
7421 +(define_constraint "Pb"
7422 + "@internal In Thumb-1 state a constant in the range -262 to +262"
7423 + (and (match_code "const_int")
7424 + (match_test "TARGET_THUMB1 && ival >= -262 && ival <= 262
7425 + && (ival > 255 || ival < -255)")))
7426 +
7427 (define_constraint "G"
7428 "In ARM/Thumb-2 state a valid FPA immediate constant."
7429 (and (match_code "const_double")
7430 @@ -189,10 +207,17 @@
7431 (define_constraint "Dv"
7432 "@internal
7433 In ARM/Thumb-2 state a const_double which can be used with a VFP fconsts
7434 - or fconstd instruction."
7435 + instruction."
7436 (and (match_code "const_double")
7437 (match_test "TARGET_32BIT && vfp3_const_double_rtx (op)")))
7438
7439 +(define_constraint "Dy"
7440 + "@internal
7441 + In ARM/Thumb-2 state a const_double which can be used with a VFP fconstd
7442 + instruction."
7443 + (and (match_code "const_double")
7444 + (match_test "TARGET_32BIT && TARGET_VFP_DOUBLE && vfp3_const_double_rtx (op)")))
7445 +
7446 (define_memory_constraint "Ut"
7447 "@internal
7448 In ARM/Thumb-2 state an address valid for loading/storing opaque structure
7449 @@ -214,17 +239,24 @@
7450
7451 (define_memory_constraint "Un"
7452 "@internal
7453 + In ARM/Thumb-2 state a valid address for Neon doubleword vector
7454 + load/store instructions."
7455 + (and (match_code "mem")
7456 + (match_test "TARGET_32BIT && neon_vector_mem_operand (op, 0)")))
7457 +
7458 +(define_memory_constraint "Um"
7459 + "@internal
7460 In ARM/Thumb-2 state a valid address for Neon element and structure
7461 load/store instructions."
7462 (and (match_code "mem")
7463 - (match_test "TARGET_32BIT && neon_vector_mem_operand (op, FALSE)")))
7464 + (match_test "TARGET_32BIT && neon_vector_mem_operand (op, 2)")))
7465
7466 (define_memory_constraint "Us"
7467 "@internal
7468 In ARM/Thumb-2 state a valid address for non-offset loads/stores of
7469 quad-word values in four ARM registers."
7470 (and (match_code "mem")
7471 - (match_test "TARGET_32BIT && neon_vector_mem_operand (op, TRUE)")))
7472 + (match_test "TARGET_32BIT && neon_vector_mem_operand (op, 1)")))
7473
7474 (define_memory_constraint "Uq"
7475 "@internal
7476 diff -Nur a/gcc/config/arm/fp16.c b/gcc/config/arm/fp16.c
7477 --- a/gcc/config/arm/fp16.c 1970-01-01 01:00:00.000000000 +0100
7478 +++ b/gcc/config/arm/fp16.c 2010-01-25 09:50:28.985687200 +0100
7479 @@ -0,0 +1,145 @@
7480 +/* Half-float conversion routines.
7481 +
7482 + Copyright (C) 2008, 2009 Free Software Foundation, Inc.
7483 + Contributed by CodeSourcery.
7484 +
7485 + This file is free software; you can redistribute it and/or modify it
7486 + under the terms of the GNU General Public License as published by the
7487 + Free Software Foundation; either version 3, or (at your option) any
7488 + later version.
7489 +
7490 + This file is distributed in the hope that it will be useful, but
7491 + WITHOUT ANY WARRANTY; without even the implied warranty of
7492 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7493 + General Public License for more details.
7494 +
7495 + Under Section 7 of GPL version 3, you are granted additional
7496 + permissions described in the GCC Runtime Library Exception, version
7497 + 3.1, as published by the Free Software Foundation.
7498 +
7499 + You should have received a copy of the GNU General Public License and
7500 + a copy of the GCC Runtime Library Exception along with this program;
7501 + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
7502 + <http://www.gnu.org/licenses/>. */
7503 +
7504 +static inline unsigned short
7505 +__gnu_f2h_internal(unsigned int a, int ieee)
7506 +{
7507 + unsigned short sign = (a >> 16) & 0x8000;
7508 + int aexp = (a >> 23) & 0xff;
7509 + unsigned int mantissa = a & 0x007fffff;
7510 + unsigned int mask;
7511 + unsigned int increment;
7512 +
7513 + if (aexp == 0xff)
7514 + {
7515 + if (!ieee)
7516 + return sign;
7517 + return sign | 0x7e00 | (mantissa >> 13);
7518 + }
7519 +
7520 + if (aexp == 0 && mantissa == 0)
7521 + return sign;
7522 +
7523 + aexp -= 127;
7524 +
7525 + /* Decimal point between bits 22 and 23. */
7526 + mantissa |= 0x00800000;
7527 + if (aexp < -14)
7528 + {
7529 + mask = 0x007fffff;
7530 + if (aexp < -25)
7531 + aexp = -26;
7532 + else if (aexp != -25)
7533 + mask >>= 24 + aexp;
7534 + }
7535 + else
7536 + mask = 0x00001fff;
7537 +
7538 + /* Round. */
7539 + if (mantissa & mask)
7540 + {
7541 + increment = (mask + 1) >> 1;
7542 + if ((mantissa & mask) == increment)
7543 + increment = mantissa & (increment << 1);
7544 + mantissa += increment;
7545 + if (mantissa >= 0x01000000)
7546 + {
7547 + mantissa >>= 1;
7548 + aexp++;
7549 + }
7550 + }
7551 +
7552 + if (ieee)
7553 + {
7554 + if (aexp > 15)
7555 + return sign | 0x7c00;
7556 + }
7557 + else
7558 + {
7559 + if (aexp > 16)
7560 + return sign | 0x7fff;
7561 + }
7562 +
7563 + if (aexp < -24)
7564 + return sign;
7565 +
7566 + if (aexp < -14)
7567 + {
7568 + mantissa >>= -14 - aexp;
7569 + aexp = -14;
7570 + }
7571 +
7572 + /* We leave the leading 1 in the mantissa, and subtract one
7573 + from the exponent bias to compensate. */
7574 + return sign | (((aexp + 14) << 10) + (mantissa >> 13));
7575 +}
7576 +
7577 +unsigned int
7578 +__gnu_h2f_internal(unsigned short a, int ieee)
7579 +{
7580 + unsigned int sign = (unsigned int)(a & 0x8000) << 16;
7581 + int aexp = (a >> 10) & 0x1f;
7582 + unsigned int mantissa = a & 0x3ff;
7583 +
7584 + if (aexp == 0x1f && ieee)
7585 + return sign | 0x7f800000 | (mantissa << 13);
7586 +
7587 + if (aexp == 0)
7588 + {
7589 + int shift;
7590 +
7591 + if (mantissa == 0)
7592 + return sign;
7593 +
7594 + shift = __builtin_clz(mantissa) - 21;
7595 + mantissa <<= shift;
7596 + aexp = -shift;
7597 + }
7598 +
7599 + return sign | (((aexp + 0x70) << 23) + (mantissa << 13));
7600 +}
7601 +
7602 +unsigned short
7603 +__gnu_f2h_ieee(unsigned int a)
7604 +{
7605 + return __gnu_f2h_internal(a, 1);
7606 +}
7607 +
7608 +unsigned int
7609 +__gnu_h2f_ieee(unsigned short a)
7610 +{
7611 + return __gnu_h2f_internal(a, 1);
7612 +}
7613 +
7614 +unsigned short
7615 +__gnu_f2h_alternative(unsigned int x)
7616 +{
7617 + return __gnu_f2h_internal(x, 0);
7618 +}
7619 +
7620 +unsigned int
7621 +__gnu_h2f_alternative(unsigned short a)
7622 +{
7623 + return __gnu_h2f_internal(a, 0);
7624 +}
7625 diff -Nur a/gcc/config/arm/fpa.md b/gcc/config/arm/fpa.md
7626 --- a/gcc/config/arm/fpa.md 2007-08-02 12:49:31.000000000 +0200
7627 +++ b/gcc/config/arm/fpa.md 2010-01-25 09:50:28.985687200 +0100
7628 @@ -599,10 +599,10 @@
7629 {
7630 default:
7631 case 0: return \"mvf%?e\\t%0, %1\";
7632 - case 1: if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
7633 + case 1: if (TARGET_FPA_EMU2)
7634 return \"ldf%?e\\t%0, %1\";
7635 return \"lfm%?\\t%0, 1, %1\";
7636 - case 2: if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
7637 + case 2: if (TARGET_FPA_EMU2)
7638 return \"stf%?e\\t%1, %0\";
7639 return \"sfm%?\\t%1, 1, %0\";
7640 }
7641 diff -Nur a/gcc/config/arm/hwdiv.md b/gcc/config/arm/hwdiv.md
7642 --- a/gcc/config/arm/hwdiv.md 1970-01-01 01:00:00.000000000 +0100
7643 +++ b/gcc/config/arm/hwdiv.md 2010-01-25 09:50:28.985687200 +0100
7644 @@ -0,0 +1,41 @@
7645 +;; ARM instruction patterns for hardware division
7646 +;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
7647 +;; Written by CodeSourcery, LLC.
7648 +;;
7649 +;; This file is part of GCC.
7650 +;;
7651 +;; GCC is free software; you can redistribute it and/or modify it
7652 +;; under the terms of the GNU General Public License as published by
7653 +;; the Free Software Foundation; either version 2, or (at your option)
7654 +;; any later version.
7655 +;;
7656 +;; GCC is distributed in the hope that it will be useful, but
7657 +;; WITHOUT ANY WARRANTY; without even the implied warranty of
7658 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7659 +;; General Public License for more details.
7660 +;;
7661 +;; You should have received a copy of the GNU General Public License
7662 +;; along with GCC; see the file COPYING. If not, write to
7663 +;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
7664 +;; Boston, MA 02110-1301, USA.
7665 +
7666 +(define_insn "divsi3"
7667 + [(set (match_operand:SI 0 "s_register_operand" "=r")
7668 + (div:SI (match_operand:SI 1 "s_register_operand" "r")
7669 + (match_operand:SI 2 "s_register_operand" "r")))]
7670 + "arm_arch_hwdiv"
7671 + "sdiv%?\t%0, %1, %2"
7672 + [(set_attr "predicable" "yes")
7673 + (set_attr "insn" "sdiv")]
7674 +)
7675 +
7676 +(define_insn "udivsi3"
7677 + [(set (match_operand:SI 0 "s_register_operand" "=r")
7678 + (udiv:SI (match_operand:SI 1 "s_register_operand" "r")
7679 + (match_operand:SI 2 "s_register_operand" "r")))]
7680 + "arm_arch_hwdiv"
7681 + "udiv%?\t%0, %1, %2"
7682 + [(set_attr "predicable" "yes")
7683 + (set_attr "insn" "udiv")]
7684 +)
7685 +
7686 diff -Nur a/gcc/config/arm/ieee754-df.S b/gcc/config/arm/ieee754-df.S
7687 --- a/gcc/config/arm/ieee754-df.S 2009-04-10 01:23:07.000000000 +0200
7688 +++ b/gcc/config/arm/ieee754-df.S 2010-01-25 09:50:28.985687200 +0100
7689 @@ -83,7 +83,7 @@
7690 ARM_FUNC_START adddf3
7691 ARM_FUNC_ALIAS aeabi_dadd adddf3
7692
7693 -1: do_push {r4, r5, lr}
7694 +1: do_push (r4, r5, lr)
7695
7696 @ Look for zeroes, equal values, INF, or NAN.
7697 shift1 lsl, r4, xh, #1
7698 @@ -427,7 +427,7 @@
7699 do_it eq, t
7700 moveq r1, #0
7701 RETc(eq)
7702 - do_push {r4, r5, lr}
7703 + do_push (r4, r5, lr)
7704 mov r4, #0x400 @ initial exponent
7705 add r4, r4, #(52-1 - 1)
7706 mov r5, #0 @ sign bit is 0
7707 @@ -447,7 +447,7 @@
7708 do_it eq, t
7709 moveq r1, #0
7710 RETc(eq)
7711 - do_push {r4, r5, lr}
7712 + do_push (r4, r5, lr)
7713 mov r4, #0x400 @ initial exponent
7714 add r4, r4, #(52-1 - 1)
7715 ands r5, r0, #0x80000000 @ sign bit in r5
7716 @@ -481,7 +481,7 @@
7717 RETc(eq) @ we are done already.
7718
7719 @ value was denormalized. We can normalize it now.
7720 - do_push {r4, r5, lr}
7721 + do_push (r4, r5, lr)
7722 mov r4, #0x380 @ setup corresponding exponent
7723 and r5, xh, #0x80000000 @ move sign bit in r5
7724 bic xh, xh, #0x80000000
7725 @@ -508,9 +508,9 @@
7726 @ compatibility.
7727 adr ip, LSYM(f0_ret)
7728 @ Push pc as well so that RETLDM works correctly.
7729 - do_push {r4, r5, ip, lr, pc}
7730 + do_push (r4, r5, ip, lr, pc)
7731 #else
7732 - do_push {r4, r5, lr}
7733 + do_push (r4, r5, lr)
7734 #endif
7735
7736 mov r5, #0
7737 @@ -534,9 +534,9 @@
7738 @ compatibility.
7739 adr ip, LSYM(f0_ret)
7740 @ Push pc as well so that RETLDM works correctly.
7741 - do_push {r4, r5, ip, lr, pc}
7742 + do_push (r4, r5, ip, lr, pc)
7743 #else
7744 - do_push {r4, r5, lr}
7745 + do_push (r4, r5, lr)
7746 #endif
7747
7748 ands r5, ah, #0x80000000 @ sign bit in r5
7749 @@ -585,7 +585,7 @@
7750 @ Legacy code expects the result to be returned in f0. Copy it
7751 @ there as well.
7752 LSYM(f0_ret):
7753 - do_push {r0, r1}
7754 + do_push (r0, r1)
7755 ldfd f0, [sp], #8
7756 RETLDM
7757
7758 @@ -602,7 +602,7 @@
7759
7760 ARM_FUNC_START muldf3
7761 ARM_FUNC_ALIAS aeabi_dmul muldf3
7762 - do_push {r4, r5, r6, lr}
7763 + do_push (r4, r5, r6, lr)
7764
7765 @ Mask out exponents, trap any zero/denormal/INF/NAN.
7766 mov ip, #0xff
7767 @@ -910,7 +910,7 @@
7768 ARM_FUNC_START divdf3
7769 ARM_FUNC_ALIAS aeabi_ddiv divdf3
7770
7771 - do_push {r4, r5, r6, lr}
7772 + do_push (r4, r5, r6, lr)
7773
7774 @ Mask out exponents, trap any zero/denormal/INF/NAN.
7775 mov ip, #0xff
7776 @@ -1117,7 +1117,7 @@
7777 ARM_FUNC_ALIAS eqdf2 cmpdf2
7778 mov ip, #1 @ how should we specify unordered here?
7779
7780 -1: str ip, [sp, #-4]
7781 +1: str ip, [sp, #-4]!
7782
7783 @ Trap any INF/NAN first.
7784 mov ip, xh, lsl #1
7785 @@ -1129,7 +1129,8 @@
7786
7787 @ Test for equality.
7788 @ Note that 0.0 is equal to -0.0.
7789 -2: orrs ip, xl, xh, lsl #1 @ if x == 0.0 or -0.0
7790 +2: add sp, sp, #4
7791 + orrs ip, xl, xh, lsl #1 @ if x == 0.0 or -0.0
7792 do_it eq, e
7793 COND(orr,s,eq) ip, yl, yh, lsl #1 @ and y == 0.0 or -0.0
7794 teqne xh, yh @ or xh == yh
7795 @@ -1168,7 +1169,7 @@
7796 bne 2b
7797 orrs ip, yl, yh, lsl #12
7798 beq 2b @ y is not NAN
7799 -5: ldr r0, [sp, #-4] @ unordered return code
7800 +5: ldr r0, [sp], #4 @ unordered return code
7801 RET
7802
7803 FUNC_END gedf2
7804 @@ -1194,7 +1195,7 @@
7805
7806 @ The status-returning routines are required to preserve all
7807 @ registers except ip, lr, and cpsr.
7808 -6: do_push {r0, lr}
7809 +6: do_push (r0, lr)
7810 ARM_CALL cmpdf2
7811 @ Set the Z flag correctly, and the C flag unconditionally.
7812 cmp r0, #0
7813 diff -Nur a/gcc/config/arm/ieee754-sf.S b/gcc/config/arm/ieee754-sf.S
7814 --- a/gcc/config/arm/ieee754-sf.S 2009-04-10 01:23:07.000000000 +0200
7815 +++ b/gcc/config/arm/ieee754-sf.S 2010-01-25 09:50:28.985687200 +0100
7816 @@ -481,7 +481,7 @@
7817 and r3, ip, #0x80000000
7818
7819 @ Well, no way to make it shorter without the umull instruction.
7820 - do_push {r3, r4, r5}
7821 + do_push (r3, r4, r5)
7822 mov r4, r0, lsr #16
7823 mov r5, r1, lsr #16
7824 bic r0, r0, r4, lsl #16
7825 @@ -492,7 +492,7 @@
7826 mla r0, r4, r1, r0
7827 adds r3, r3, r0, lsl #16
7828 adc r1, ip, r0, lsr #16
7829 - do_pop {r0, r4, r5}
7830 + do_pop (r0, r4, r5)
7831
7832 #else
7833
7834 @@ -822,7 +822,7 @@
7835 ARM_FUNC_ALIAS eqsf2 cmpsf2
7836 mov ip, #1 @ how should we specify unordered here?
7837
7838 -1: str ip, [sp, #-4]
7839 +1: str ip, [sp, #-4]!
7840
7841 @ Trap any INF/NAN first.
7842 mov r2, r0, lsl #1
7843 @@ -834,7 +834,8 @@
7844
7845 @ Compare values.
7846 @ Note that 0.0 is equal to -0.0.
7847 -2: orrs ip, r2, r3, lsr #1 @ test if both are 0, clear C flag
7848 +2: add sp, sp, #4
7849 + orrs ip, r2, r3, lsr #1 @ test if both are 0, clear C flag
7850 do_it ne
7851 teqne r0, r1 @ if not 0 compare sign
7852 do_it pl
7853 @@ -858,7 +859,7 @@
7854 bne 2b
7855 movs ip, r1, lsl #9
7856 beq 2b @ r1 is not NAN
7857 -5: ldr r0, [sp, #-4] @ return unordered code.
7858 +5: ldr r0, [sp], #4 @ return unordered code.
7859 RET
7860
7861 FUNC_END gesf2
7862 @@ -881,7 +882,7 @@
7863
7864 @ The status-returning routines are required to preserve all
7865 @ registers except ip, lr, and cpsr.
7866 -6: do_push {r0, r1, r2, r3, lr}
7867 +6: do_push (r0, r1, r2, r3, lr)
7868 ARM_CALL cmpsf2
7869 @ Set the Z flag correctly, and the C flag unconditionally.
7870 cmp r0, #0
7871 diff -Nur a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
7872 --- a/gcc/config/arm/lib1funcs.asm 2009-04-10 01:23:07.000000000 +0200
7873 +++ b/gcc/config/arm/lib1funcs.asm 2010-01-25 09:50:28.985687200 +0100
7874 @@ -27,8 +27,17 @@
7875 #if defined(__ELF__) && defined(__linux__)
7876 .section .note.GNU-stack,"",%progbits
7877 .previous
7878 -#endif
7879 +#endif /* __ELF__ and __linux__ */
7880
7881 +#ifdef __ARM_EABI__
7882 +/* Some attributes that are common to all routines in this file. */
7883 + /* Tag_ABI_align8_needed: This code does not require 8-byte
7884 + alignment from the caller. */
7885 + /* .eabi_attribute 24, 0 -- default setting. */
7886 + /* Tag_ABI_align8_preserved: This code preserves 8-byte
7887 + alignment in any callee. */
7888 + .eabi_attribute 25, 1
7889 +#endif /* __ARM_EABI__ */
7890 /* ------------------------------------------------------------------------ */
7891
7892 /* We need to know what prefix to add to function names. */
7893 @@ -233,8 +242,8 @@
7894 .macro shift1 op, arg0, arg1, arg2
7895 \op \arg0, \arg1, \arg2
7896 .endm
7897 -#define do_push push
7898 -#define do_pop pop
7899 +#define do_push(...) push {__VA_ARGS__}
7900 +#define do_pop(...) pop {__VA_ARGS__}
7901 #define COND(op1, op2, cond) op1 ## op2 ## cond
7902 /* Perform an arithmetic operation with a variable shift operand. This
7903 requires two instructions and a scratch register on Thumb-2. */
7904 @@ -248,24 +257,133 @@
7905 .macro shift1 op, arg0, arg1, arg2
7906 mov \arg0, \arg1, \op \arg2
7907 .endm
7908 -#define do_push stmfd sp!,
7909 -#define do_pop ldmfd sp!,
7910 +#if defined(__low_irq_latency__)
7911 +#define do_push(...) \
7912 + _buildN1(do_push, _buildC1(__VA_ARGS__))( __VA_ARGS__)
7913 +#define _buildN1(BASE, X) _buildN2(BASE, X)
7914 +#define _buildN2(BASE, X) BASE##X
7915 +#define _buildC1(...) _buildC2(__VA_ARGS__,9,8,7,6,5,4,3,2,1)
7916 +#define _buildC2(a1,a2,a3,a4,a5,a6,a7,a8,a9,c,...) c
7917 +
7918 +#define do_push1(r1) str r1, [sp, #-4]!
7919 +#define do_push2(r1, r2) str r2, [sp, #-4]! ; str r1, [sp, #-4]!
7920 +#define do_push3(r1, r2, r3) str r3, [sp, #-4]! ; str r2, [sp, #-4]!; str r1, [sp, #-4]!
7921 +#define do_push4(r1, r2, r3, r4) \
7922 + do_push3 (r2, r3, r4);\
7923 + do_push1 (r1)
7924 +#define do_push5(r1, r2, r3, r4, r5) \
7925 + do_push4 (r2, r3, r4, r5);\
7926 + do_push1 (r1)
7927 +
7928 +#define do_pop(...) \
7929 +_buildN1(do_pop, _buildC1(__VA_ARGS__))( __VA_ARGS__)
7930 +
7931 +#define do_pop1(r1) ldr r1, [sp], #4
7932 +#define do_pop2(r1, r2) ldr r1, [sp], #4 ; ldr r2, [sp], #4
7933 +#define do_pop3(r1, r2, r3) ldr r1, [sp], #4 ; str r2, [sp], #4; str r3, [sp], #4
7934 +#define do_pop4(r1, r2, r3, r4) \
7935 + do_pop1 (r1);\
7936 + do_pup3 (r2, r3, r4)
7937 +#define do_pop5(r1, r2, r3, r4, r5) \
7938 + do_pop1 (r1);\
7939 + do_pop4 (r2, r3, r4, r5)
7940 +#else
7941 +#define do_push(...) stmfd sp!, { __VA_ARGS__}
7942 +#define do_pop(...) ldmfd sp!, {__VA_ARGS__}
7943 +#endif
7944 +
7945 +
7946 #define COND(op1, op2, cond) op1 ## cond ## op2
7947 .macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
7948 \name \dest, \src1, \src2, \shiftop \shiftreg
7949 .endm
7950 #endif
7951
7952 -.macro ARM_LDIV0 name
7953 +#ifdef __ARM_EABI__
7954 +.macro ARM_LDIV0 name signed
7955 + cmp r0, #0
7956 + .ifc \signed, unsigned
7957 + movne r0, #0xffffffff
7958 + .else
7959 + movgt r0, #0x7fffffff
7960 + movlt r0, #0x80000000
7961 + .endif
7962 + b SYM (__aeabi_idiv0) __PLT__
7963 +.endm
7964 +#else
7965 +.macro ARM_LDIV0 name signed
7966 str lr, [sp, #-8]!
7967 98: cfi_push 98b - __\name, 0xe, -0x8, 0x8
7968 bl SYM (__div0) __PLT__
7969 mov r0, #0 @ About as wrong as it could be.
7970 RETLDM unwind=98b
7971 .endm
7972 +#endif
7973
7974
7975 -.macro THUMB_LDIV0 name
7976 +#ifdef __ARM_EABI__
7977 +.macro THUMB_LDIV0 name signed
7978 +#if defined(__ARM_ARCH_6M__)
7979 + .ifc \signed, unsigned
7980 + cmp r0, #0
7981 + beq 1f
7982 + mov r0, #0
7983 + mvn r0, r0 @ 0xffffffff
7984 +1:
7985 + .else
7986 + cmp r0, #0
7987 + beq 2f
7988 + blt 3f
7989 + mov r0, #0
7990 + mvn r0, r0
7991 + lsr r0, r0, #1 @ 0x7fffffff
7992 + b 2f
7993 +3: mov r0, #0x80
7994 + lsl r0, r0, #24 @ 0x80000000
7995 +2:
7996 + .endif
7997 + push {r0, r1, r2}
7998 + ldr r0, 4f
7999 + adr r1, 4f
8000 + add r0, r1
8001 + str r0, [sp, #8]
8002 + @ We know we are not on armv4t, so pop pc is safe.
8003 + pop {r0, r1, pc}
8004 + .align 2
8005 +4:
8006 + .word __aeabi_idiv0 - 4b
8007 +#elif defined(__thumb2__)
8008 + .syntax unified
8009 + .ifc \signed, unsigned
8010 + cbz r0, 1f
8011 + mov r0, #0xffffffff
8012 +1:
8013 + .else
8014 + cmp r0, #0
8015 + do_it gt
8016 + movgt r0, #0x7fffffff
8017 + do_it lt
8018 + movlt r0, #0x80000000
8019 + .endif
8020 + b.w SYM(__aeabi_idiv0) __PLT__
8021 +#else
8022 + .align 2
8023 + bx pc
8024 + nop
8025 + .arm
8026 + cmp r0, #0
8027 + .ifc \signed, unsigned
8028 + movne r0, #0xffffffff
8029 + .else
8030 + movgt r0, #0x7fffffff
8031 + movlt r0, #0x80000000
8032 + .endif
8033 + b SYM(__aeabi_idiv0) __PLT__
8034 + .thumb
8035 +#endif
8036 +.endm
8037 +#else
8038 +.macro THUMB_LDIV0 name signed
8039 push { r1, lr }
8040 98: cfi_push 98b - __\name, 0xe, -0x4, 0x8
8041 bl SYM (__div0)
8042 @@ -277,18 +395,19 @@
8043 pop { r1, pc }
8044 #endif
8045 .endm
8046 +#endif
8047
8048 .macro FUNC_END name
8049 SIZE (__\name)
8050 .endm
8051
8052 -.macro DIV_FUNC_END name
8053 +.macro DIV_FUNC_END name signed
8054 cfi_start __\name, LSYM(Lend_div0)
8055 LSYM(Ldiv0):
8056 #ifdef __thumb__
8057 - THUMB_LDIV0 \name
8058 + THUMB_LDIV0 \name \signed
8059 #else
8060 - ARM_LDIV0 \name
8061 + ARM_LDIV0 \name \signed
8062 #endif
8063 cfi_end LSYM(Lend_div0)
8064 FUNC_END \name
8065 @@ -413,6 +532,12 @@
8066 #define yyl r2
8067 #endif
8068
8069 +#ifdef __ARM_EABI__
8070 +.macro WEAK name
8071 + .weak SYM (__\name)
8072 +.endm
8073 +#endif
8074 +
8075 #ifdef __thumb__
8076 /* Register aliases. */
8077
8078 @@ -437,6 +562,43 @@
8079
8080 #if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
8081
8082 +#if defined (__thumb2__)
8083 + clz \curbit, \dividend
8084 + clz \result, \divisor
8085 + sub \curbit, \result, \curbit
8086 + rsb \curbit, \curbit, #31
8087 + adr \result, 1f
8088 + add \curbit, \result, \curbit, lsl #4
8089 + mov \result, #0
8090 + mov pc, \curbit
8091 +.p2align 3
8092 +1:
8093 + .set shift, 32
8094 + .rept 32
8095 + .set shift, shift - 1
8096 + cmp.w \dividend, \divisor, lsl #shift
8097 + nop.n
8098 + adc.w \result, \result, \result
8099 + it cs
8100 + subcs.w \dividend, \dividend, \divisor, lsl #shift
8101 + .endr
8102 +#elif defined(__ARM_TUNE_MARVELL_F__)
8103 + clz \curbit, \dividend
8104 + clz \result, \divisor
8105 + sub \curbit, \result, \curbit
8106 + mov \divisor, \divisor, lsl \curbit
8107 + rsb \curbit, \curbit, #31
8108 + mov \curbit, \curbit, lsl #2
8109 + mov \result, #0
8110 + add pc, pc, \curbit, lsl #2
8111 + nop
8112 + .rept 32
8113 + cmp \dividend, \divisor
8114 + subcs \dividend, \dividend, \divisor
8115 + mov \divisor, \divisor, lsr #1
8116 + adc \result, \result, \result
8117 + .endr
8118 +#else /* ! defined(__ARM_TUNE_MARVELL_F__) */
8119 clz \curbit, \dividend
8120 clz \result, \divisor
8121 sub \curbit, \result, \curbit
8122 @@ -452,6 +614,7 @@
8123 adc \result, \result, \result
8124 subcs \dividend, \dividend, \divisor, lsl #shift
8125 .endr
8126 +#endif /* defined(__ARM_TUNE_MARVELL_F__) */
8127
8128 #else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
8129 #if __ARM_ARCH__ >= 5
8130 @@ -499,18 +662,23 @@
8131
8132 @ Division loop
8133 1: cmp \dividend, \divisor
8134 + do_it hs, t
8135 subhs \dividend, \dividend, \divisor
8136 orrhs \result, \result, \curbit
8137 cmp \dividend, \divisor, lsr #1
8138 + do_it hs, t
8139 subhs \dividend, \dividend, \divisor, lsr #1
8140 orrhs \result, \result, \curbit, lsr #1
8141 cmp \dividend, \divisor, lsr #2
8142 + do_it hs, t
8143 subhs \dividend, \dividend, \divisor, lsr #2
8144 orrhs \result, \result, \curbit, lsr #2
8145 cmp \dividend, \divisor, lsr #3
8146 + do_it hs, t
8147 subhs \dividend, \dividend, \divisor, lsr #3
8148 orrhs \result, \result, \curbit, lsr #3
8149 cmp \dividend, #0 @ Early termination?
8150 + do_it ne, t
8151 movnes \curbit, \curbit, lsr #4 @ No, any more bits to do?
8152 movne \divisor, \divisor, lsr #4
8153 bne 1b
8154 @@ -799,13 +967,14 @@
8155 /* ------------------------------------------------------------------------ */
8156 #ifdef L_udivsi3
8157
8158 +#if defined(__ARM_ARCH_6M__)
8159 +
8160 FUNC_START udivsi3
8161 FUNC_ALIAS aeabi_uidiv udivsi3
8162
8163 -#ifdef __thumb__
8164 -
8165 cmp divisor, #0
8166 beq LSYM(Ldiv0)
8167 +LSYM(udivsi3_nodiv0):
8168 mov curbit, #1
8169 mov result, #0
8170
8171 @@ -819,9 +988,16 @@
8172 pop { work }
8173 RET
8174
8175 -#else /* ARM version. */
8176 +#else /* ARM/Thumb-2 version. */
8177 +
8178 + ARM_FUNC_START udivsi3
8179 + ARM_FUNC_ALIAS aeabi_uidiv udivsi3
8180
8181 + /* Note: if called via udivsi3_nodiv0, this will unnecessarily check
8182 + for division-by-zero a second time. */
8183 +LSYM(udivsi3_nodiv0):
8184 subs r2, r1, #1
8185 + do_it eq
8186 RETc(eq)
8187 bcc LSYM(Ldiv0)
8188 cmp r0, r1
8189 @@ -834,7 +1010,8 @@
8190 mov r0, r2
8191 RET
8192
8193 -11: moveq r0, #1
8194 +11: do_it eq, e
8195 + moveq r0, #1
8196 movne r0, #0
8197 RET
8198
8199 @@ -845,19 +1022,24 @@
8200
8201 #endif /* ARM version */
8202
8203 - DIV_FUNC_END udivsi3
8204 + DIV_FUNC_END udivsi3 unsigned
8205
8206 +#if defined(__ARM_ARCH_6M__)
8207 FUNC_START aeabi_uidivmod
8208 -#ifdef __thumb__
8209 + cmp r1, #0
8210 + beq LSYM(Ldiv0)
8211 push {r0, r1, lr}
8212 - bl SYM(__udivsi3)
8213 + bl LSYM(udivsi3_nodiv0)
8214 POP {r1, r2, r3}
8215 mul r2, r0
8216 sub r1, r1, r2
8217 bx r3
8218 #else
8219 +ARM_FUNC_START aeabi_uidivmod
8220 + cmp r1, #0
8221 + beq LSYM(Ldiv0)
8222 stmfd sp!, { r0, r1, lr }
8223 - bl SYM(__udivsi3)
8224 + bl LSYM(udivsi3_nodiv0)
8225 ldmfd sp!, { r1, r2, lr }
8226 mul r3, r2, r0
8227 sub r1, r1, r3
8228 @@ -904,19 +1086,20 @@
8229
8230 #endif /* ARM version. */
8231
8232 - DIV_FUNC_END umodsi3
8233 + DIV_FUNC_END umodsi3 unsigned
8234
8235 #endif /* L_umodsi3 */
8236 /* ------------------------------------------------------------------------ */
8237 #ifdef L_divsi3
8238
8239 +#if defined(__ARM_ARCH_6M__)
8240 +
8241 FUNC_START divsi3
8242 FUNC_ALIAS aeabi_idiv divsi3
8243
8244 -#ifdef __thumb__
8245 cmp divisor, #0
8246 beq LSYM(Ldiv0)
8247 -
8248 +LSYM(divsi3_nodiv0):
8249 push { work }
8250 mov work, dividend
8251 eor work, divisor @ Save the sign of the result.
8252 @@ -945,15 +1128,21 @@
8253 pop { work }
8254 RET
8255
8256 -#else /* ARM version. */
8257 +#else /* ARM/Thumb-2 version. */
8258
8259 + ARM_FUNC_START divsi3
8260 + ARM_FUNC_ALIAS aeabi_idiv divsi3
8261 +
8262 cmp r1, #0
8263 - eor ip, r0, r1 @ save the sign of the result.
8264 beq LSYM(Ldiv0)
8265 +LSYM(divsi3_nodiv0):
8266 + eor ip, r0, r1 @ save the sign of the result.
8267 + do_it mi
8268 rsbmi r1, r1, #0 @ loops below use unsigned.
8269 subs r2, r1, #1 @ division by 1 or -1 ?
8270 beq 10f
8271 movs r3, r0
8272 + do_it mi
8273 rsbmi r3, r0, #0 @ positive dividend value
8274 cmp r3, r1
8275 bls 11f
8276 @@ -963,14 +1152,18 @@
8277 ARM_DIV_BODY r3, r1, r0, r2
8278
8279 cmp ip, #0
8280 + do_it mi
8281 rsbmi r0, r0, #0
8282 RET
8283
8284 10: teq ip, r0 @ same sign ?
8285 + do_it mi
8286 rsbmi r0, r0, #0
8287 RET
8288
8289 -11: movlo r0, #0
8290 +11: do_it lo
8291 + movlo r0, #0
8292 + do_it eq,t
8293 moveq r0, ip, asr #31
8294 orreq r0, r0, #1
8295 RET
8296 @@ -979,24 +1172,30 @@
8297
8298 cmp ip, #0
8299 mov r0, r3, lsr r2
8300 + do_it mi
8301 rsbmi r0, r0, #0
8302 RET
8303
8304 #endif /* ARM version */
8305
8306 - DIV_FUNC_END divsi3
8307 + DIV_FUNC_END divsi3 signed
8308
8309 +#if defined(__ARM_ARCH_6M__)
8310 FUNC_START aeabi_idivmod
8311 -#ifdef __thumb__
8312 + cmp r1, #0
8313 + beq LSYM(Ldiv0)
8314 push {r0, r1, lr}
8315 - bl SYM(__divsi3)
8316 + bl LSYM(divsi3_nodiv0)
8317 POP {r1, r2, r3}
8318 mul r2, r0
8319 sub r1, r1, r2
8320 bx r3
8321 #else
8322 +ARM_FUNC_START aeabi_idivmod
8323 + cmp r1, #0
8324 + beq LSYM(Ldiv0)
8325 stmfd sp!, { r0, r1, lr }
8326 - bl SYM(__divsi3)
8327 + bl LSYM(divsi3_nodiv0)
8328 ldmfd sp!, { r1, r2, lr }
8329 mul r3, r2, r0
8330 sub r1, r1, r3
8331 @@ -1062,21 +1261,25 @@
8332
8333 #endif /* ARM version */
8334
8335 - DIV_FUNC_END modsi3
8336 + DIV_FUNC_END modsi3 signed
8337
8338 #endif /* L_modsi3 */
8339 /* ------------------------------------------------------------------------ */
8340 #ifdef L_dvmd_tls
8341
8342 - FUNC_START div0
8343 - FUNC_ALIAS aeabi_idiv0 div0
8344 - FUNC_ALIAS aeabi_ldiv0 div0
8345 -
8346 +#ifdef __ARM_EABI__
8347 + WEAK aeabi_idiv0
8348 + WEAK aeabi_ldiv0
8349 + FUNC_START aeabi_idiv0
8350 + FUNC_START aeabi_ldiv0
8351 RET
8352 -
8353 FUNC_END aeabi_ldiv0
8354 FUNC_END aeabi_idiv0
8355 +#else
8356 + FUNC_START div0
8357 + RET
8358 FUNC_END div0
8359 +#endif
8360
8361 #endif /* L_divmodsi_tools */
8362 /* ------------------------------------------------------------------------ */
8363 @@ -1086,16 +1289,49 @@
8364 /* Constant taken from <asm/signal.h>. */
8365 #define SIGFPE 8
8366
8367 +#ifdef __ARM_EABI__
8368 + WEAK aeabi_idiv0
8369 + WEAK aeabi_ldiv0
8370 + ARM_FUNC_START aeabi_idiv0
8371 + ARM_FUNC_START aeabi_ldiv0
8372 +#else
8373 ARM_FUNC_START div0
8374 +#endif
8375
8376 - do_push {r1, lr}
8377 + do_push (r1, lr)
8378 mov r0, #SIGFPE
8379 bl SYM(raise) __PLT__
8380 RETLDM r1
8381
8382 +#ifdef __ARM_EABI__
8383 + FUNC_END aeabi_ldiv0
8384 + FUNC_END aeabi_idiv0
8385 +#else
8386 FUNC_END div0
8387 +#endif
8388
8389 #endif /* L_dvmd_lnx */
8390 +#ifdef L_clear_cache
8391 +#if defined __ARM_EABI__ && defined __linux__
8392 +@ EABI GNU/Linux call to cacheflush syscall.
8393 + ARM_FUNC_START clear_cache
8394 + do_push (r7)
8395 +#if __ARM_ARCH__ >= 7 || defined(__ARM_ARCH_6T2__)
8396 + movw r7, #2
8397 + movt r7, #0xf
8398 +#else
8399 + mov r7, #0xf0000
8400 + add r7, r7, #2
8401 +#endif
8402 + mov r2, #0
8403 + swi 0
8404 + do_pop (r7)
8405 + RET
8406 + FUNC_END clear_cache
8407 +#else
8408 +#error "This is only for ARM EABI GNU/Linux"
8409 +#endif
8410 +#endif /* L_clear_cache */
8411 /* ------------------------------------------------------------------------ */
8412 /* Dword shift operations. */
8413 /* All the following Dword shift variants rely on the fact that
8414 @@ -1292,7 +1528,7 @@
8415 push {r4, lr}
8416 # else
8417 ARM_FUNC_START clzdi2
8418 - do_push {r4, lr}
8419 + do_push (r4, lr)
8420 # endif
8421 cmp xxh, #0
8422 bne 1f
8423 diff -Nur a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
8424 --- a/gcc/config/arm/linux-eabi.h 2007-11-08 14:44:09.000000000 +0100
8425 +++ b/gcc/config/arm/linux-eabi.h 2010-01-25 09:50:28.995687913 +0100
8426 @@ -66,22 +66,14 @@
8427 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
8428 use the GNU/Linux version, not the generic BPABI version. */
8429 #undef LINK_SPEC
8430 -#define LINK_SPEC LINUX_TARGET_LINK_SPEC
8431 +#define LINK_SPEC LINUX_TARGET_LINK_SPEC BE8_LINK_SPEC
8432
8433 /* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
8434 do not use -lfloat. */
8435 #undef LIBGCC_SPEC
8436
8437 -/* Clear the instruction cache from `beg' to `end'. This makes an
8438 - inline system call to SYS_cacheflush. */
8439 +/* Clear the instruction cache from `beg' to `end'. This is
8440 + implemented in lib1funcs.asm, so ensure an error if this definition
8441 + is used. */
8442 #undef CLEAR_INSN_CACHE
8443 -#define CLEAR_INSN_CACHE(BEG, END) \
8444 -{ \
8445 - register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
8446 - register unsigned long _end __asm ("a2") = (unsigned long) (END); \
8447 - register unsigned long _flg __asm ("a3") = 0; \
8448 - register unsigned long _scno __asm ("r7") = 0xf0002; \
8449 - __asm __volatile ("swi 0 @ sys_cacheflush" \
8450 - : "=r" (_beg) \
8451 - : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \
8452 -}
8453 +#define CLEAR_INSN_CACHE(BEG, END) not used
8454 diff -Nur a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
8455 --- a/gcc/config/arm/linux-elf.h 2009-02-20 16:20:38.000000000 +0100
8456 +++ b/gcc/config/arm/linux-elf.h 2010-01-25 09:50:28.995687913 +0100
8457 @@ -98,7 +98,7 @@
8458
8459 /* NWFPE always understands FPA instructions. */
8460 #undef FPUTYPE_DEFAULT
8461 -#define FPUTYPE_DEFAULT FPUTYPE_FPA_EMU3
8462 +#define FPUTYPE_DEFAULT "fpe3"
8463
8464 /* Call the function profiler with a given profile label. */
8465 #undef ARM_FUNCTION_PROFILER
8466 diff -Nur a/gcc/config/arm/marvell-f.md b/gcc/config/arm/marvell-f.md
8467 --- a/gcc/config/arm/marvell-f.md 1970-01-01 01:00:00.000000000 +0100
8468 +++ b/gcc/config/arm/marvell-f.md 2010-01-25 09:50:28.995687913 +0100
8469 @@ -0,0 +1,365 @@
8470 +;; Marvell 2850 pipeline description
8471 +;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
8472 +;; Written by Marvell and CodeSourcery, Inc.
8473 +
8474 +;; This file is part of GCC.
8475 +
8476 +;; GCC is free software; you can redistribute it and/or modify it
8477 +;; under the terms of the GNU General Public License as published
8478 +;; by the Free Software Foundation; either version 2, or (at your
8479 +;; option) any later version.
8480 +
8481 +;; GCC is distributed in the hope that it will be useful, but WITHOUT
8482 +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8483 +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
8484 +;; License for more details.
8485 +
8486 +;; You should have received a copy of the GNU General Public License
8487 +;; along with GCC; see the file COPYING. If not, write to
8488 +;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
8489 +;; Boston, MA 02110-1301, USA.
8490 +
8491 +;; This automaton provides a pipeline description for the Marvell
8492 +;; 2850 core.
8493 +;;
8494 +;; The model given here assumes that the condition for all conditional
8495 +;; instructions is "true", i.e., that all of the instructions are
8496 +;; actually executed.
8497 +
8498 +(define_automaton "marvell_f")
8499 +
8500 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8501 +;; Pipelines
8502 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8503 +
8504 +;; This is a dual-issue processor with three pipelines:
8505 +;;
8506 +;; 1. Arithmetic and load/store pipeline A1.
8507 +;; Issue | E1 | E2 | OF | WR | WB for load-store instructions
8508 +;; Issue | E1 | E2 | WB for arithmetic instructions
8509 +;;
8510 +;; 2. Arithmetic pipeline A2.
8511 +;; Issue | E1 | E2 | WB
8512 +;;
8513 +;; 3. Multiply and multiply-accumulate pipeline.
8514 +;; Issue | MAC1 | MAC2 | MAC3 | WB
8515 +;;
8516 +;; There are various bypasses modelled to a greater or lesser extent.
8517 +;;
8518 +;; Latencies in this file correspond to the number of cycles after
8519 +;; the issue stage that it takes for the result of the instruction to
8520 +;; be computed, or for its side-effects to occur.
8521 +
8522 +(define_cpu_unit "a1_e1,a1_e2,a1_of,a1_wr,a1_wb" "marvell_f") ; ALU 1
8523 +(define_cpu_unit "a2_e1,a2_e2,a2_wb" "marvell_f") ; ALU 2
8524 +(define_cpu_unit "m_1,m_2,m_3,m_wb" "marvell_f") ; MAC
8525 +
8526 +;; We define an SRAM cpu unit to enable us to describe conflicts
8527 +;; between loads at the E2 stage and stores at the WR stage.
8528 +
8529 +(define_cpu_unit "sram" "marvell_f")
8530 +
8531 +;; Handling of dual-issue constraints.
8532 +;;
8533 +;; Certain pairs of instructions can be issued in parallel, and certain
8534 +;; pairs cannot. We divide a subset of the instructions into groups as
8535 +;; follows.
8536 +;;
8537 +;; - data processing 1 (mov, mvn);
8538 +;; - data processing 2 (adc, add, and, bic, cmn, cmp, eor, orr, rsb,
8539 +;; rsc, sbc, sub, teq, tst);
8540 +;; - load single (ldr, ldrb, ldrbt, ldrt, ldrh, ldrsb, ldrsh);
8541 +;; - store single (str, strb, strbt, strt, strh);
8542 +;; - swap (swp, swpb);
8543 +;; - pld;
8544 +;; - count leading zeros and DSP add/sub (clz, qadd, qdadd, qsub, qdsub);
8545 +;; - multiply 2 (mul, muls, smull, umull, smulxy, smulls, umulls);
8546 +;; - multiply 3 (mla, mlas, smlal, umlal, smlaxy, smlalxy, smlawx,
8547 +;; smlawy, smlals, umlals);
8548 +;; - branches (b, bl, blx, bx).
8549 +;;
8550 +;; Ignoring conditional execution, it is a good approximation to the core
8551 +;; to model that two instructions may only be issued in parallel if the
8552 +;; following conditions are met.
8553 +;; I. The instructions both fall into one of the above groups and their
8554 +;; corresponding groups have a entry in the matrix below that is not X.
8555 +;; II. The second instruction does not read any register updated by the
8556 +;; first instruction (already enforced by the GCC scheduler).
8557 +;; III. The second instruction does not need the carry flag updated by the
8558 +;; first instruction. Currently we do not model this.
8559 +;;
8560 +;; First Second instruction group
8561 +;; insn
8562 +;; DP1 DP2 L S SWP PLD CLZ M2 M3 B
8563 +;;
8564 +;; DP1 ok ok ok ok ok ok ok ok ok ok
8565 +;; DP2(1) ok ok ok ok ok ok ok ok ok ok
8566 +;; DP2(2) ok (2) ok (4) ok ok ok ok X ok
8567 +;; L }
8568 +;; SWP } ok ok X X X X ok ok ok ok
8569 +;; PLD }
8570 +;; S(3) ok ok X X X X ok ok ok ok
8571 +;; S(4) ok (2) X X X X ok ok X ok
8572 +;; CLZ ok ok ok ok ok ok ok ok ok ok
8573 +;; M2 ok ok ok ok ok ok ok X X ok
8574 +;; M3 ok (2) ok (4) ok ok ok X X ok
8575 +;; B ok ok ok ok ok ok ok ok ok ok
8576 +;;
8577 +;; (1) without register shift
8578 +;; (2) with register shift
8579 +;; (3) with immediate offset
8580 +;; (4) with register offset
8581 +;;
8582 +;; We define a fake cpu unit "reg_shift_lock" to enforce constraints
8583 +;; between instructions in groups DP2(2) and M3. All other
8584 +;; constraints are enforced automatically by virtue of the limited
8585 +;; number of pipelines available for the various operations, with
8586 +;; the exception of constraints involving S(4) that we do not model.
8587 +
8588 +(define_cpu_unit "reg_shift_lock" "marvell_f")
8589 +
8590 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8591 +;; ALU instructions
8592 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8593 +
8594 +;; 1. Certain logic operations can be retired after the E1 stage if
8595 +;; the pipeline is not already retiring another instruction. In this
8596 +;; model we assume this behaviour always holds for mov, mvn, and, orr, eor
8597 +;; instructions. If a register shift is involved and the instruction is
8598 +;; not mov or mvn, then a dual-issue constraint must be enforced.
8599 +
8600 +;; The first two cases are separate so they can be identified for
8601 +;; bypasses below.
8602 +
8603 +(define_insn_reservation "marvell_f_alu_early_retire" 1
8604 + (and (eq_attr "tune" "marvell_f")
8605 + (and (eq_attr "type" "alu")
8606 + (eq_attr "insn" "mov,mvn,and,orr,eor")))
8607 + "(a1_e1,a1_wb)|(a2_e1,a2_wb)")
8608 +
8609 +(define_insn_reservation "marvell_f_alu_early_retire_shift" 1
8610 + (and (eq_attr "tune" "marvell_f")
8611 + (and (eq_attr "type" "alu_shift_reg")
8612 + (eq_attr "insn" "mov,mvn,and,orr,eor")))
8613 + "(a1_e1,a1_wb)|(a2_e1,a2_wb)")
8614 +
8615 +(define_insn_reservation "marvell_f_alu_early_retire_reg_shift1" 1
8616 + (and (eq_attr "tune" "marvell_f")
8617 + (and (eq_attr "type" "alu_shift_reg")
8618 + (eq_attr "insn" "mov,mvn")))
8619 + "(a1_e1,a1_wb)|(a2_e1,a2_wb)")
8620 +
8621 +(define_insn_reservation "marvell_f_alu_early_retire_reg_shift2" 1
8622 + (and (eq_attr "tune" "marvell_f")
8623 + (and (eq_attr "type" "alu_shift_reg")
8624 + (eq_attr "insn" "and,orr,eor")))
8625 + "(reg_shift_lock+a1_e1,a1_wb)|(reg_shift_lock+a2_e1,a2_wb)")
8626 +
8627 +;; 2. ALU operations with no shifted operand. These bypass the E1 stage if
8628 +;; the E2 stage of the corresponding pipeline is clear; here, we always
8629 +;; model this scenario [*]. We give the operation a latency of 1 yet reserve
8630 +;; both E1 and E2 for it (thus preventing the GCC scheduler, in the case
8631 +;; where both E1 and E2 of one pipeline are clear, from issuing one
8632 +;; instruction to each).
8633 +;;
8634 +;; [*] The non-bypass case is a latency of two, reserving E1 on the first
8635 +;; cycle and E2 on the next. Due to the way the scheduler works we
8636 +;; have to choose between taking this as the default and taking the
8637 +;; above case (with latency one) as the default; we choose the latter.
8638 +
8639 +(define_insn_reservation "marvell_f_alu_op_bypass_e1" 1
8640 + (and (eq_attr "tune" "marvell_f")
8641 + (and (eq_attr "type" "alu")
8642 + (not (eq_attr "insn" "mov,mvn,and,orr,eor"))))
8643 + "(a1_e1+a1_e2,a1_wb)|(a2_e1+a2_e2,a2_wb)")
8644 +
8645 +;; 3. ALU operations with a shift-by-constant operand.
8646 +
8647 +(define_insn_reservation "marvell_f_alu_shift_op" 2
8648 + (and (eq_attr "tune" "marvell_f")
8649 + (and (eq_attr "type" "alu_shift")
8650 + (not (eq_attr "insn" "mov,mvn,and,orr,eor"))))
8651 + "(a1_e1,a1_e2,a1_wb)|(a2_e1,a2_e2,a2_wb)")
8652 +
8653 +;; 4. ALU operations with a shift-by-register operand. Since the
8654 +;; instruction is never mov or mvn, a dual-issue constraint must
8655 +;; be enforced.
8656 +
8657 +(define_insn_reservation "marvell_f_alu_shift_reg_op" 2
8658 + (and (eq_attr "tune" "marvell_f")
8659 + (and (eq_attr "type" "alu_shift_reg")
8660 + (not (eq_attr "insn" "mov,mvn,and,orr,eor"))))
8661 + "(reg_shift_lock+a1_e1,a1_e2,a1_wb)|(reg_shift_lock+a2_e1,a2_e2,a2_wb)")
8662 +
8663 +;; Given an ALU operation with shift (I1) followed by another ALU
8664 +;; operation (I2), with I2 depending on the destination register Rd of I1
8665 +;; and with I2 not using that value as the amount or the starting value for
8666 +;; a shift, then I1 and I2 may be issued to the same pipeline on
8667 +;; consecutive cycles. In terms of this model that corresponds to I1
8668 +;; having a latency of one cycle. There are three cases for various
8669 +;; I1 and I2 as follows.
8670 +
8671 +;; (a) I1 has a constant or register shift and I2 doesn't have a shift at all.
8672 +(define_bypass 1 "marvell_f_alu_shift_op,\
8673 + marvell_f_alu_shift_reg_op"
8674 + "marvell_f_alu_op_bypass_e1,marvell_f_alu_early_retire")
8675 +
8676 +;; (b) I1 has a constant or register shift and I2 has a constant shift.
8677 +;; Rd must not provide the starting value for the shift.
8678 +(define_bypass 1 "marvell_f_alu_shift_op,\
8679 + marvell_f_alu_shift_reg_op"
8680 + "marvell_f_alu_shift_op,marvell_f_alu_early_retire_shift"
8681 + "arm_no_early_alu_shift_value_dep")
8682 +
8683 +;; (c) I1 has a constant or register shift and I2 has a register shift.
8684 +;; Rd must not provide the amount by which to shift.
8685 +(define_bypass 1 "marvell_f_alu_shift_op,\
8686 + marvell_f_alu_shift_reg_op"
8687 + "marvell_f_alu_shift_reg_op,\
8688 + marvell_f_alu_early_retire_reg_shift1,\
8689 + marvell_f_alu_early_retire_reg_shift2"
8690 + "arm_no_early_alu_shift_dep")
8691 +
8692 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8693 +;; Multiplication instructions
8694 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8695 +
8696 +;; Multiplication instructions in group "Multiply 2".
8697 +
8698 +(define_insn_reservation "marvell_f_multiply_2" 3
8699 + (and (eq_attr "tune" "marvell_f")
8700 + (eq_attr "insn" "mul,muls,smull,umull,smulxy,smulls,umulls"))
8701 + "m_1,m_2,m_3,m_wb")
8702 +
8703 +;; Multiplication instructions in group "Multiply 3". There is a
8704 +;; dual-issue constraint with non-multiplication ALU instructions
8705 +;; to be respected here.
8706 +
8707 +(define_insn_reservation "marvell_f_multiply_3" 3
8708 + (and (eq_attr "tune" "marvell_f")
8709 + (eq_attr "insn" "mla,mlas,smlal,umlal,smlaxy,smlalxy,smlawx,\
8710 + smlawy,smlals,umlals"))
8711 + "reg_shift_lock+m_1,m_2,m_3,m_wb")
8712 +
8713 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8714 +;; Branch instructions
8715 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8716 +
8717 +;; Conditional backward b instructions can have a zero-cycle penalty, and
8718 +;; other conditional b and bl instructions have a one-cycle penalty if
8719 +;; predicted correctly. Currently we model the zero-cycle case for all
8720 +;; branches.
8721 +
8722 +(define_insn_reservation "marvell_f_branches" 0
8723 + (and (eq_attr "tune" "marvell_f")
8724 + (eq_attr "type" "branch"))
8725 + "nothing")
8726 +
8727 +;; Call latencies are not predictable; a semi-arbitrary very large
8728 +;; number is used as "positive infinity" for such latencies.
8729 +
8730 +(define_insn_reservation "marvell_f_call" 32
8731 + (and (eq_attr "tune" "marvell_f")
8732 + (eq_attr "type" "call"))
8733 + "nothing")
8734 +
8735 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8736 +;; Load/store instructions
8737 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8738 +
8739 +;; The models for load/store instructions do not accurately describe
8740 +;; the difference between operations with a base register writeback.
8741 +;; These models assume that all memory references hit in dcache.
8742 +
8743 +;; 1. Load/store for single registers.
8744 +
8745 +;; The worst case for a load is when the load result is needed in E1
8746 +;; (for example for a register shift), giving a latency of four. Loads
8747 +;; skip E1 and access memory at the E2 stage.
8748 +
8749 +(define_insn_reservation "marvell_f_load1" 4
8750 + (and (eq_attr "tune" "marvell_f")
8751 + (eq_attr "type" "load1,load_byte"))
8752 + "a1_e2+sram,a1_of,a1_wr,a1_wb")
8753 +
8754 +;; The result for a load may be bypassed (to be available at the same
8755 +;; time as the load arrives in the WR stage, so effectively at the OF
8756 +;; stage) to the Rn operand at E2 with a latency of two. The result may
8757 +;; be bypassed to a non-Rn operand at E2 with a latency of three. For
8758 +;; instructions without shifts, detection of an Rn bypass situation is
8759 +;; difficult (because some of the instruction patterns switch their
8760 +;; operands), and so we do not model that here. For instructions with
8761 +;; shifts, the operand used at E2 will always be Rn, and so we can
8762 +;; model the latency-two bypass for these.
8763 +
8764 +(define_bypass 2 "marvell_f_load1"
8765 + "marvell_f_alu_shift_op"
8766 + "arm_no_early_alu_shift_value_dep")
8767 +
8768 +(define_bypass 2 "marvell_f_load1"
8769 + "marvell_f_alu_shift_reg_op"
8770 + "arm_no_early_alu_shift_dep")
8771 +
8772 +;; Stores write at the WR stage and loads read at the E2 stage, giving
8773 +;; a store latency of three.
8774 +
8775 +(define_insn_reservation "marvell_f_store1" 3
8776 + (and (eq_attr "tune" "marvell_f")
8777 + (eq_attr "type" "store1"))
8778 + "a1_e2,a1_of,a1_wr+sram,a1_wb")
8779 +
8780 +;; 2. Load/store for two consecutive registers. These may be dealt
8781 +;; with in the same number of cycles as single loads and stores.
8782 +
8783 +(define_insn_reservation "marvell_f_load2" 4
8784 + (and (eq_attr "tune" "marvell_f")
8785 + (eq_attr "type" "load2"))
8786 + "a1_e2+sram,a1_of,a1_wr,a1_wb")
8787 +
8788 +(define_insn_reservation "marvell_f_store2" 3
8789 + (and (eq_attr "tune" "marvell_f")
8790 + (eq_attr "type" "store2"))
8791 + "a1_e2,a1_of,a1_wr+sram,a1_wb")
8792 +
8793 +;; The first word of a doubleword load is eligible for the latency-two
8794 +;; bypass described above for single loads, but this is not modelled here.
8795 +;; We do however assume that either word may also be bypassed with
8796 +;; latency three for ALU operations with shifts (where the shift value and
8797 +;; amount do not depend on the loaded value) and latency four for ALU
8798 +;; operations without shifts. The latency four case is of course the default.
8799 +
8800 +(define_bypass 3 "marvell_f_load2"
8801 + "marvell_f_alu_shift_op"
8802 + "arm_no_early_alu_shift_value_dep")
8803 +
8804 +(define_bypass 3 "marvell_f_load2"
8805 + "marvell_f_alu_shift_reg_op"
8806 + "arm_no_early_alu_shift_dep")
8807 +
8808 +;; 3. Load/store for more than two registers.
8809 +
8810 +;; These instructions stall for an extra cycle in the decode stage;
8811 +;; individual load/store instructions for each register are then issued.
8812 +;; The load/store multiple instruction itself is removed from the decode
8813 +;; stage at the same time as the final load/store instruction is issued.
8814 +;; To complicate matters, pairs of loads/stores referencing two
8815 +;; consecutive registers will be issued together as doubleword operations.
8816 +;; We model a 3-word load as an LDR plus an LDRD, and a 4-word load
8817 +;; as two LDRDs; thus, these are allocated the same latencies (the
8818 +;; latency for two consecutive loads plus one for the setup stall).
8819 +;; The extra stall is modelled by reserving E1.
8820 +
8821 +(define_insn_reservation "marvell_f_load3_4" 6
8822 + (and (eq_attr "tune" "marvell_f")
8823 + (eq_attr "type" "load3,load4"))
8824 + "a1_e1,a1_e1+a1_e2+sram,a1_e2+sram+a1_of,a1_of+a1_wr,a1_wr+a1_wb,a1_wb")
8825 +
8826 +;; Bypasses are possible for ldm as for single loads, but we do not
8827 +;; model them here since the order of the constituent loads is
8828 +;; difficult to predict.
8829 +
8830 +(define_insn_reservation "marvell_f_store3_4" 5
8831 + (and (eq_attr "tune" "marvell_f")
8832 + (eq_attr "type" "store3,store4"))
8833 + "a1_e1,a1_e1+a1_e2,a1_e2+a1_of,a1_of+a1_wr+sram,a1_wr+sram+a1_wb,a1_wb")
8834 +
8835 diff -Nur a/gcc/config/arm/marvell-f-vfp.md b/gcc/config/arm/marvell-f-vfp.md
8836 --- a/gcc/config/arm/marvell-f-vfp.md 1970-01-01 01:00:00.000000000 +0100
8837 +++ b/gcc/config/arm/marvell-f-vfp.md 2010-01-25 09:50:28.995687913 +0100
8838 @@ -0,0 +1,153 @@
8839 +;; Marvell 2850 VFP pipeline description
8840 +;; Copyright (C) 2007 Free Software Foundation, Inc.
8841 +;; Written by CodeSourcery, Inc.
8842 +
8843 +;; This file is part of GCC.
8844 +
8845 +;; GCC is distributed in the hope that it will be useful, but WITHOUT
8846 +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8847 +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
8848 +;; License for more details.
8849 +
8850 +;; You should have received a copy of the GNU General Public License
8851 +;; along with GCC; see the file COPYING. If not, write to
8852 +;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
8853 +;; Boston, MA 02110-1301, USA.
8854 +
8855 +;; This automaton provides a pipeline description for the Marvell
8856 +;; 2850 core.
8857 +;;
8858 +;; The model given here assumes that the condition for all conditional
8859 +;; instructions is "true", i.e., that all of the instructions are
8860 +;; actually executed.
8861 +
8862 +(define_automaton "marvell_f_vfp")
8863 +
8864 +;; This is a single-issue VFPv2 implementation with the following execution
8865 +;; units:
8866 +;;
8867 +;; 1. Addition/subtraction unit; takes three cycles, pipelined.
8868 +;; 2. Multiplication unit; takes four cycles, pipelined.
8869 +;; 3. Add buffer, used for multiply-accumulate (see below).
8870 +;; 4. Divide/square root unit, not pipelined.
8871 +;; For single-precision: takes sixteen cycles, can accept another insn
8872 +;; after fifteen cycles.
8873 +;; For double-precision: takes thirty-one cycles, can accept another insn
8874 +;; after thirty cycles.
8875 +;; 5. Single-cycle unit, pipelined.
8876 +;; This does absolute value/copy/negate/compare in one cycle and
8877 +;; conversion in two cycles.
8878 +;;
8879 +;; When all three operands of a multiply-accumulate instruction are ready,
8880 +;; one is issued to the add buffer (which can hold six operands in a FIFO)
8881 +;; and the two to be multiplied are issued to the multiply unit. After
8882 +;; four cycles in the multiply unit, one cycle is taken to issue the
8883 +;; operand from the add buffer plus the multiplication result to the
8884 +;; addition/subtraction unit. That issue takes priority over any add/sub
8885 +;; instruction waiting at the normal issue stage, but may be performed in
8886 +;; parallel with the issue of a non-add/sub instruction. The total time
8887 +;; for a multiply-accumulate instruction to pass through the execution
8888 +;; units is hence eight cycles.
8889 +;;
8890 +;; We do not need to explicitly model the add buffer because it can
8891 +;; always issue the instruction at the head of its FIFO (due to the above
8892 +;; priority rule) and there are more spaces in the add buffer (six) than
8893 +;; there are stages (four) in the multiplication unit.
8894 +;;
8895 +;; Two instructions may be retired at once from the head of an 8-entry
8896 +;; reorder buffer. Data from these first two instructions only may be
8897 +;; forwarded to the inputs of the issue unit. We assume that the
8898 +;; pressure on the reorder buffer will be sufficiently low that every
8899 +;; instruction entering it will be eligible for data forwarding. Since
8900 +;; data is forwarded to the issue unit and not the execution units (so
8901 +;; for example single-cycle instructions cannot be issued back-to-back),
8902 +;; the latencies given below are the cycle counts above plus one.
8903 +
8904 +(define_cpu_unit "mf_vfp_issue" "marvell_f_vfp")
8905 +(define_cpu_unit "mf_vfp_add" "marvell_f_vfp")
8906 +(define_cpu_unit "mf_vfp_mul" "marvell_f_vfp")
8907 +(define_cpu_unit "mf_vfp_div" "marvell_f_vfp")
8908 +(define_cpu_unit "mf_vfp_single_cycle" "marvell_f_vfp")
8909 +
8910 +;; An attribute to indicate whether our reservations are applicable.
8911 +
8912 +(define_attr "marvell_f_vfp" "yes,no"
8913 + (const (if_then_else (and (eq_attr "tune" "marvell_f")
8914 + (eq_attr "fpu" "vfp"))
8915 + (const_string "yes") (const_string "no"))))
8916 +
8917 +;; Reservations of functional units. The nothing*2 reservations at the
8918 +;; start of many of the reservation strings correspond to the decode
8919 +;; stages. We need to have these reservations so that we can correctly
8920 +;; reserve parts of the core's A1 pipeline for loads and stores. For
8921 +;; that case (since loads skip E1) the pipelines line up thus:
8922 +;; A1 pipe: Issue E2 OF WR WB ...
8923 +;; VFP pipe: Fetch Decode1 Decode2 Issue Execute1 ...
8924 +;; For a load, we need to make a reservation of E2, and thus we must
8925 +;; use Decode1 as the starting point for all VFP reservations here.
8926 +;;
8927 +;; For reservations of pipelined VFP execution units we only reserve
8928 +;; the execution unit for the first execution cycle, omitting any trailing
8929 +;; "nothing" reservations.
8930 +
8931 +(define_insn_reservation "marvell_f_vfp_add" 4
8932 + (and (eq_attr "marvell_f_vfp" "yes")
8933 + (eq_attr "type" "farith"))
8934 + "nothing*2,mf_vfp_issue,mf_vfp_add")
8935 +
8936 +(define_insn_reservation "marvell_f_vfp_mul" 5
8937 + (and (eq_attr "marvell_f_vfp" "yes")
8938 + (eq_attr "type" "fmuls,fmuld"))
8939 + "nothing*2,mf_vfp_issue,mf_vfp_mul")
8940 +
8941 +(define_insn_reservation "marvell_f_vfp_divs" 17
8942 + (and (eq_attr "marvell_f_vfp" "yes")
8943 + (eq_attr "type" "fdivs"))
8944 + "nothing*2,mf_vfp_issue,mf_vfp_div*15")
8945 +
8946 +(define_insn_reservation "marvell_f_vfp_divd" 32
8947 + (and (eq_attr "marvell_f_vfp" "yes")
8948 + (eq_attr "type" "fdivd"))
8949 + "nothing*2,mf_vfp_issue,mf_vfp_div*30")
8950 +
8951 +;; The DFA lookahead is small enough that the "add" reservation here
8952 +;; will always take priority over any addition/subtraction instruction
8953 +;; issued five cycles after the multiply-accumulate instruction, as
8954 +;; required.
8955 +(define_insn_reservation "marvell_f_vfp_mac" 9
8956 + (and (eq_attr "marvell_f_vfp" "yes")
8957 + (eq_attr "type" "fmacs,fmacd"))
8958 + "nothing*2,mf_vfp_issue,mf_vfp_mul,nothing*4,mf_vfp_add")
8959 +
8960 +(define_insn_reservation "marvell_f_vfp_single" 2
8961 + (and (eq_attr "marvell_f_vfp" "yes")
8962 + (eq_attr "type" "ffarith"))
8963 + "nothing*2,mf_vfp_issue,mf_vfp_single_cycle")
8964 +
8965 +(define_insn_reservation "marvell_f_vfp_convert" 3
8966 + (and (eq_attr "marvell_f_vfp" "yes")
8967 + (eq_attr "type" "f_cvt"))
8968 + "nothing*2,mf_vfp_issue,mf_vfp_single_cycle")
8969 +
8970 +(define_insn_reservation "marvell_f_vfp_load" 2
8971 + (and (eq_attr "marvell_f_vfp" "yes")
8972 + (eq_attr "type" "f_loads,f_loadd"))
8973 + "a1_e2+sram,a1_of,a1_wr+mf_vfp_issue,a1_wb+mf_vfp_single_cycle")
8974 +
8975 +(define_insn_reservation "marvell_f_vfp_from_core" 2
8976 + (and (eq_attr "marvell_f_vfp" "yes")
8977 + (eq_attr "type" "r_2_f"))
8978 + "a1_e2,a1_of,a1_wr+mf_vfp_issue,a1_wb+mf_vfp_single_cycle")
8979 +
8980 +;; The interaction between the core and VFP pipelines during VFP
8981 +;; store operations and core <-> VFP moves is not clear, so we guess.
8982 +(define_insn_reservation "marvell_f_vfp_store" 3
8983 + (and (eq_attr "marvell_f_vfp" "yes")
8984 + (eq_attr "type" "f_stores,f_stored"))
8985 + "a1_e2,a1_of,mf_vfp_issue,a1_wr+sram+mf_vfp_single_cycle")
8986 +
8987 +(define_insn_reservation "marvell_f_vfp_to_core" 4
8988 + (and (eq_attr "marvell_f_vfp" "yes")
8989 + (eq_attr "type" "f_2_r"))
8990 + "a1_e2,a1_of,a1_wr+mf_vfp_issue,a1_wb+mf_vfp_single_cycle")
8991 +
8992 diff -Nur a/gcc/config/arm/montavista-linux.h b/gcc/config/arm/montavista-linux.h
8993 --- a/gcc/config/arm/montavista-linux.h 1970-01-01 01:00:00.000000000 +0100
8994 +++ b/gcc/config/arm/montavista-linux.h 2010-01-25 09:50:28.995687913 +0100
8995 @@ -0,0 +1,33 @@
8996 +/* MontaVista GNU/Linux Configuration.
8997 + Copyright (C) 2009
8998 + Free Software Foundation, Inc.
8999 +
9000 +This file is part of GCC.
9001 +
9002 +GCC is free software; you can redistribute it and/or modify
9003 +it under the terms of the GNU General Public License as published by
9004 +the Free Software Foundation; either version 3, or (at your option)
9005 +any later version.
9006 +
9007 +GCC is distributed in the hope that it will be useful,
9008 +but WITHOUT ANY WARRANTY; without even the implied warranty of
9009 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9010 +GNU General Public License for more details.
9011 +
9012 +You should have received a copy of the GNU General Public License
9013 +along with GCC; see the file COPYING3. If not see
9014 +<http://www.gnu.org/licenses/>. */
9015 +
9016 +/* Add -tarmv6 and -tthumb2 options for convenience in generating multilibs.
9017 +*/
9018 +#undef CC1_SPEC
9019 +#define CC1_SPEC " \
9020 + %{tarmv6: -march=armv6 -mfloat-abi=softfp ; \
9021 + tthumb2: -mthumb -march=armv7-a -mfloat-abi=softfp ; \
9022 + : -march=armv5t}"
9023 +
9024 +/* The various C libraries each have their own subdirectory. */
9025 +#undef SYSROOT_SUFFIX_SPEC
9026 +#define SYSROOT_SUFFIX_SPEC \
9027 + "%{tarmv6:/armv6 ; \
9028 + tthumb2:/thumb2}"
9029 diff -Nur a/gcc/config/arm/neon-gen.ml b/gcc/config/arm/neon-gen.ml
9030 --- a/gcc/config/arm/neon-gen.ml 2009-04-10 01:23:07.000000000 +0200
9031 +++ b/gcc/config/arm/neon-gen.ml 2010-01-25 09:50:28.995687913 +0100
9032 @@ -122,6 +122,7 @@
9033 | T_uint16 | T_int16 -> T_intHI
9034 | T_uint32 | T_int32 -> T_intSI
9035 | T_uint64 | T_int64 -> T_intDI
9036 + | T_float32 -> T_floatSF
9037 | T_poly8 -> T_intQI
9038 | T_poly16 -> T_intHI
9039 | T_arrayof (n, elt) -> T_arrayof (n, signed_ctype elt)
9040 @@ -320,7 +321,7 @@
9041 typeinfo;
9042 Format.print_newline ();
9043 (* Extra types not in <stdint.h>. *)
9044 - Format.printf "typedef __builtin_neon_sf float32_t;\n";
9045 + Format.printf "typedef float float32_t;\n";
9046 Format.printf "typedef __builtin_neon_poly8 poly8_t;\n";
9047 Format.printf "typedef __builtin_neon_poly16 poly16_t;\n"
9048
9049 @@ -399,7 +400,11 @@
9050 "extern \"C\" {";
9051 "#endif";
9052 "";
9053 +"#if defined (__vxworks) && defined (_WRS_KERNEL)";
9054 +"#include <vxWorks.h>";
9055 +"#else";
9056 "#include <stdint.h>";
9057 +"#endif";
9058 ""];
9059 deftypes ();
9060 arrtypes ();
9061 diff -Nur a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
9062 --- a/gcc/config/arm/neon.md 2009-02-20 16:20:38.000000000 +0100
9063 +++ b/gcc/config/arm/neon.md 2010-01-25 09:50:28.995687913 +0100
9064 @@ -159,7 +159,8 @@
9065 (UNSPEC_VUZP1 201)
9066 (UNSPEC_VUZP2 202)
9067 (UNSPEC_VZIP1 203)
9068 - (UNSPEC_VZIP2 204)])
9069 + (UNSPEC_VZIP2 204)
9070 + (UNSPEC_MISALIGNED_ACCESS 205)])
9071
9072 ;; Double-width vector modes.
9073 (define_mode_iterator VD [V8QI V4HI V2SI V2SF])
9074 @@ -459,7 +460,9 @@
9075 "=w,Uv,w, w, ?r,?w,?r,?r, ?Us")
9076 (match_operand:VD 1 "general_operand"
9077 " w,w, Dn,Uvi, w, r, r, Usi,r"))]
9078 - "TARGET_NEON"
9079 + "TARGET_NEON
9080 + && (register_operand (operands[0], <MODE>mode)
9081 + || register_operand (operands[1], <MODE>mode))"
9082 {
9083 if (which_alternative == 2)
9084 {
9085 @@ -481,7 +484,7 @@
9086
9087 /* FIXME: If the memory layout is changed in big-endian mode, output_move_vfp
9088 below must be changed to output_move_neon (which will use the
9089 - element/structure loads/stores), and the constraint changed to 'Un' instead
9090 + element/structure loads/stores), and the constraint changed to 'Um' instead
9091 of 'Uv'. */
9092
9093 switch (which_alternative)
9094 @@ -506,7 +509,9 @@
9095 "=w,Un,w, w, ?r,?w,?r,?r, ?Us")
9096 (match_operand:VQXMOV 1 "general_operand"
9097 " w,w, Dn,Uni, w, r, r, Usi, r"))]
9098 - "TARGET_NEON"
9099 + "TARGET_NEON
9100 + && (register_operand (operands[0], <MODE>mode)
9101 + || register_operand (operands[1], <MODE>mode))"
9102 {
9103 if (which_alternative == 2)
9104 {
9105 @@ -549,6 +554,11 @@
9106 (match_operand:TI 1 "general_operand" ""))]
9107 "TARGET_NEON"
9108 {
9109 + if (can_create_pseudo_p ())
9110 + {
9111 + if (GET_CODE (operands[0]) != REG)
9112 + operands[1] = force_reg (TImode, operands[1]);
9113 + }
9114 })
9115
9116 (define_expand "mov<mode>"
9117 @@ -556,12 +566,19 @@
9118 (match_operand:VSTRUCT 1 "general_operand" ""))]
9119 "TARGET_NEON"
9120 {
9121 + if (can_create_pseudo_p ())
9122 + {
9123 + if (GET_CODE (operands[0]) != REG)
9124 + operands[1] = force_reg (<MODE>mode, operands[1]);
9125 + }
9126 })
9127
9128 (define_insn "*neon_mov<mode>"
9129 [(set (match_operand:VSTRUCT 0 "nonimmediate_operand" "=w,Ut,w")
9130 (match_operand:VSTRUCT 1 "general_operand" " w,w, Ut"))]
9131 - "TARGET_NEON"
9132 + "TARGET_NEON
9133 + && (register_operand (operands[0], <MODE>mode)
9134 + || register_operand (operands[1], <MODE>mode))"
9135 {
9136 switch (which_alternative)
9137 {
9138 @@ -658,6 +675,49 @@
9139 neon_disambiguate_copy (operands, dest, src, 4);
9140 })
9141
9142 +(define_expand "movmisalign<mode>"
9143 + [(set (match_operand:VDQX 0 "nonimmediate_operand" "")
9144 + (unspec:VDQX [(match_operand:VDQX 1 "general_operand" "")]
9145 + UNSPEC_MISALIGNED_ACCESS))]
9146 + "TARGET_NEON && !BYTES_BIG_ENDIAN"
9147 +{
9148 + if (!s_register_operand (operands[0], <MODE>mode)
9149 + && !s_register_operand (operands[1], <MODE>mode))
9150 + FAIL;
9151 +})
9152 +
9153 +(define_insn "*movmisalign<mode>_neon_store"
9154 + [(set (match_operand:VDX 0 "memory_operand" "=Um")
9155 + (unspec:VDX [(match_operand:VDX 1 "s_register_operand" " w")]
9156 + UNSPEC_MISALIGNED_ACCESS))]
9157 + "TARGET_NEON && !BYTES_BIG_ENDIAN"
9158 + "vst1.<V_sz_elem>\t{%P1}, %A0"
9159 + [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")])
9160 +
9161 +(define_insn "*movmisalign<mode>_neon_load"
9162 + [(set (match_operand:VDX 0 "s_register_operand" "=w")
9163 + (unspec:VDX [(match_operand:VDX 1 "memory_operand" " Um")]
9164 + UNSPEC_MISALIGNED_ACCESS))]
9165 + "TARGET_NEON && !BYTES_BIG_ENDIAN"
9166 + "vld1.<V_sz_elem>\t{%P0}, %A1"
9167 + [(set_attr "neon_type" "neon_vld1_1_2_regs")])
9168 +
9169 +(define_insn "*movmisalign<mode>_neon_store"
9170 + [(set (match_operand:VQX 0 "memory_operand" "=Um")
9171 + (unspec:VQX [(match_operand:VQX 1 "s_register_operand" " w")]
9172 + UNSPEC_MISALIGNED_ACCESS))]
9173 + "TARGET_NEON && !BYTES_BIG_ENDIAN"
9174 + "vst1.<V_sz_elem>\t{%q1}, %A0"
9175 + [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")])
9176 +
9177 +(define_insn "*movmisalign<mode>_neon_load"
9178 + [(set (match_operand:VQX 0 "s_register_operand" "=w")
9179 + (unspec:VQX [(match_operand:VQX 1 "general_operand" " Um")]
9180 + UNSPEC_MISALIGNED_ACCESS))]
9181 + "TARGET_NEON && !BYTES_BIG_ENDIAN"
9182 + "vld1.<V_sz_elem>\t{%q0}, %A1"
9183 + [(set_attr "neon_type" "neon_vld1_1_2_regs")])
9184 +
9185 (define_insn "vec_set<mode>_internal"
9186 [(set (match_operand:VD 0 "s_register_operand" "=w")
9187 (vec_merge:VD
9188 @@ -862,6 +922,50 @@
9189 (const_string "neon_mul_qqq_8_16_32_ddd_32")))))]
9190 )
9191
9192 +(define_insn "*mul<mode>3add<mode>_neon"
9193 + [(set (match_operand:VDQ 0 "s_register_operand" "=w")
9194 + (plus:VDQ (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w")
9195 + (match_operand:VDQ 3 "s_register_operand" "w"))
9196 + (match_operand:VDQ 1 "s_register_operand" "0")))]
9197 + "TARGET_NEON"
9198 + "vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
9199 + [(set (attr "neon_type")
9200 + (if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
9201 + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0))
9202 + (const_string "neon_fp_vmla_ddd")
9203 + (const_string "neon_fp_vmla_qqq"))
9204 + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0))
9205 + (if_then_else
9206 + (ne (symbol_ref "<Scalar_mul_8_16>") (const_int 0))
9207 + (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
9208 + (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))
9209 + (if_then_else (ne (symbol_ref "<Scalar_mul_8_16>") (const_int 0))
9210 + (const_string "neon_mla_qqq_8_16")
9211 + (const_string "neon_mla_qqq_32_qqd_32_scalar")))))]
9212 +)
9213 +
9214 +(define_insn "*mul<mode>3neg<mode>add<mode>_neon"
9215 + [(set (match_operand:VDQ 0 "s_register_operand" "=w")
9216 + (minus:VDQ (match_operand:VDQ 1 "s_register_operand" "0")
9217 + (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w")
9218 + (match_operand:VDQ 3 "s_register_operand" "w"))))]
9219 + "TARGET_NEON"
9220 + "vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
9221 + [(set (attr "neon_type")
9222 + (if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
9223 + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0))
9224 + (const_string "neon_fp_vmla_ddd")
9225 + (const_string "neon_fp_vmla_qqq"))
9226 + (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0))
9227 + (if_then_else
9228 + (ne (symbol_ref "<Scalar_mul_8_16>") (const_int 0))
9229 + (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
9230 + (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))
9231 + (if_then_else (ne (symbol_ref "<Scalar_mul_8_16>") (const_int 0))
9232 + (const_string "neon_mla_qqq_8_16")
9233 + (const_string "neon_mla_qqq_32_qqd_32_scalar")))))]
9234 +)
9235 +
9236 (define_insn "ior<mode>3"
9237 [(set (match_operand:VDQ 0 "s_register_operand" "=w,w")
9238 (ior:VDQ (match_operand:VDQ 1 "s_register_operand" "w,0")
9239 @@ -3611,7 +3715,8 @@
9240 UNSPEC_VSHLL_N))]
9241 "TARGET_NEON"
9242 {
9243 - neon_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode));
9244 + /* The boundaries are: 0 < imm <= size. */
9245 + neon_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode) + 1);
9246 return "vshll.%T3%#<V_sz_elem>\t%q0, %P1, %2";
9247 }
9248 [(set_attr "neon_type" "neon_shift_1")]
9249 diff -Nur a/gcc/config/arm/neon.ml b/gcc/config/arm/neon.ml
9250 --- a/gcc/config/arm/neon.ml 2007-08-02 12:49:31.000000000 +0200
9251 +++ b/gcc/config/arm/neon.ml 2010-01-25 09:50:28.995687913 +0100
9252 @@ -50,7 +50,7 @@
9253 | T_ptrto of vectype | T_const of vectype
9254 | T_void | T_intQI
9255 | T_intHI | T_intSI
9256 - | T_intDI
9257 + | T_intDI | T_floatSF
9258
9259 (* The meanings of the following are:
9260 TImode : "Tetra", two registers (four words).
9261 @@ -1693,6 +1693,7 @@
9262 | T_intHI -> "__builtin_neon_hi"
9263 | T_intSI -> "__builtin_neon_si"
9264 | T_intDI -> "__builtin_neon_di"
9265 + | T_floatSF -> "__builtin_neon_sf"
9266 | T_arrayof (num, base) ->
9267 let basename = name (fun x -> x) base in
9268 affix (Printf.sprintf "%sx%d" basename num)
9269 diff -Nur a/gcc/config/arm/neon-testgen.ml b/gcc/config/arm/neon-testgen.ml
9270 --- a/gcc/config/arm/neon-testgen.ml 2007-08-02 12:49:31.000000000 +0200
9271 +++ b/gcc/config/arm/neon-testgen.ml 2010-01-25 09:50:28.995687913 +0100
9272 @@ -51,8 +51,8 @@
9273 Printf.fprintf chan "/* This file was autogenerated by neon-testgen. */\n\n";
9274 Printf.fprintf chan "/* { dg-do assemble } */\n";
9275 Printf.fprintf chan "/* { dg-require-effective-target arm_neon_ok } */\n";
9276 - Printf.fprintf chan
9277 - "/* { dg-options \"-save-temps -O0 -mfpu=neon -mfloat-abi=softfp\" } */\n";
9278 + Printf.fprintf chan "/* { dg-options \"-save-temps -O0\" } */\n";
9279 + Printf.fprintf chan "/* { dg-add-options arm_neon } */\n";
9280 Printf.fprintf chan "\n#include \"arm_neon.h\"\n\n";
9281 Printf.fprintf chan "void test_%s (void)\n{\n" test_name
9282
9283 diff -Nur a/gcc/config/arm/netbsd-elf.h b/gcc/config/arm/netbsd-elf.h
9284 --- a/gcc/config/arm/netbsd-elf.h 2007-08-02 12:49:31.000000000 +0200
9285 +++ b/gcc/config/arm/netbsd-elf.h 2010-01-25 09:50:28.995687913 +0100
9286 @@ -153,5 +153,5 @@
9287 while (0)
9288
9289 #undef FPUTYPE_DEFAULT
9290 -#define FPUTYPE_DEFAULT FPUTYPE_VFP
9291 +#define FPUTYPE_DEFAULT "vfp"
9292
9293 diff -Nur a/gcc/config/arm/nocrt0.h b/gcc/config/arm/nocrt0.h
9294 --- a/gcc/config/arm/nocrt0.h 1970-01-01 01:00:00.000000000 +0100
9295 +++ b/gcc/config/arm/nocrt0.h 2010-01-25 09:50:28.995687913 +0100
9296 @@ -0,0 +1,25 @@
9297 +/* Definitions for generic libgloss based cofigs where crt0 is supplied by
9298 + the linker script.
9299 + Copyright (C) 2006 Free Software Foundation, Inc.
9300 +
9301 + This file is part of GCC.
9302 +
9303 + GCC is free software; you can redistribute it and/or modify it
9304 + under the terms of the GNU General Public License as published
9305 + by the Free Software Foundation; either version 3, or (at your
9306 + option) any later version.
9307 +
9308 + GCC is distributed in the hope that it will be useful, but WITHOUT
9309 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9310 + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
9311 + License for more details.
9312 +
9313 + You should have received a copy of the GNU General Public License
9314 + along with GCC; see the file COPYING3. If not see
9315 + <http://www.gnu.org/licenses/>. */
9316 +
9317 +#undef STARTFILE_SPEC
9318 +#define STARTFILE_SPEC " crti%O%s crtbegin%O%s"
9319 +
9320 +#undef LIB_SPEC
9321 +#define LIB_SPEC "-lc"
9322 diff -Nur a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md
9323 --- a/gcc/config/arm/predicates.md 2009-02-20 16:20:38.000000000 +0100
9324 +++ b/gcc/config/arm/predicates.md 2010-01-25 09:50:28.995687913 +0100
9325 @@ -73,6 +73,10 @@
9326 || REGNO_REG_CLASS (REGNO (op)) == FPA_REGS));
9327 })
9328
9329 +(define_special_predicate "subreg_lowpart_operator"
9330 + (and (match_code "subreg")
9331 + (match_test "subreg_lowpart_p (op)")))
9332 +
9333 ;; Reg, subreg(reg) or const_int.
9334 (define_predicate "reg_or_int_operand"
9335 (ior (match_code "const_int")
9336 @@ -168,6 +172,11 @@
9337 (and (match_code "plus,minus,ior,xor,and")
9338 (match_test "mode == GET_MODE (op)")))
9339
9340 +;; True for plus/minus operators
9341 +(define_special_predicate "plusminus_operator"
9342 + (and (match_code "plus,minus")
9343 + (match_test "mode == GET_MODE (op)")))
9344 +
9345 ;; True for logical binary operators.
9346 (define_special_predicate "logical_binary_operator"
9347 (and (match_code "ior,xor,and")
9348 @@ -295,6 +304,9 @@
9349 HOST_WIDE_INT i = 1, base = 0;
9350 rtx elt;
9351
9352 + if (low_irq_latency)
9353 + return false;
9354 +
9355 if (count <= 1
9356 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
9357 return false;
9358 @@ -352,6 +364,9 @@
9359 HOST_WIDE_INT i = 1, base = 0;
9360 rtx elt;
9361
9362 + if (low_irq_latency)
9363 + return false;
9364 +
9365 if (count <= 1
9366 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
9367 return false;
9368 diff -Nur a/gcc/config/arm/sfp-machine.h b/gcc/config/arm/sfp-machine.h
9369 --- a/gcc/config/arm/sfp-machine.h 2008-03-03 15:30:48.000000000 +0100
9370 +++ b/gcc/config/arm/sfp-machine.h 2010-01-25 09:50:28.995687913 +0100
9371 @@ -14,9 +14,11 @@
9372 #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
9373 #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
9374
9375 +#define _FP_NANFRAC_H ((_FP_QNANBIT_H << 1) - 1)
9376 #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
9377 #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
9378 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
9379 +#define _FP_NANSIGN_H 0
9380 #define _FP_NANSIGN_S 0
9381 #define _FP_NANSIGN_D 0
9382 #define _FP_NANSIGN_Q 0
9383 @@ -92,5 +94,7 @@
9384 #define __fixdfdi __aeabi_d2lz
9385 #define __fixunsdfdi __aeabi_d2ulz
9386 #define __floatdidf __aeabi_l2d
9387 +#define __extendhfsf2 __gnu_h2f_ieee
9388 +#define __truncsfhf2 __gnu_f2h_ieee
9389
9390 #endif /* __ARM_EABI__ */
9391 diff -Nur a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm
9392 --- a/gcc/config/arm/t-arm 2008-03-27 20:20:18.000000000 +0100
9393 +++ b/gcc/config/arm/t-arm 2010-01-25 09:50:28.995687913 +0100
9394 @@ -13,7 +13,9 @@
9395 $(srcdir)/config/arm/iwmmxt.md \
9396 $(srcdir)/config/arm/vfp.md \
9397 $(srcdir)/config/arm/neon.md \
9398 - $(srcdir)/config/arm/thumb2.md
9399 + $(srcdir)/config/arm/thumb2.md \
9400 + $(srcdir)/config/arm/marvell-f.md \
9401 + $(srcdir)/config/arm/hwdiv.md
9402
9403 s-config s-conditions s-flags s-codes s-constants s-emit s-recog s-preds \
9404 s-opinit s-extract s-peep s-attr s-attrtab s-output: $(MD_INCLUDES)
9405 diff -Nur a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf
9406 --- a/gcc/config/arm/t-arm-elf 2008-06-12 19:29:47.000000000 +0200
9407 +++ b/gcc/config/arm/t-arm-elf 2010-01-25 09:50:28.995687913 +0100
9408 @@ -24,10 +24,18 @@
9409 #MULTILIB_MATCHES += march?armv7=march?armv7-a
9410 #MULTILIB_MATCHES += march?armv7=march?armv7-r
9411 #MULTILIB_MATCHES += march?armv7=march?armv7-m
9412 +#MULTILIB_MATCHES += march?armv7=march?armv7e-m
9413 #MULTILIB_MATCHES += march?armv7=mcpu?cortex-a8
9414 #MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
9415 #MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
9416
9417 +# Not quite true. We can support hard-vfp calling in Thumb2, but how do we
9418 +# express that here? Also, we really need architecture v5e or later
9419 +# (mcrr etc).
9420 +MULTILIB_OPTIONS += mfloat-abi=hard
9421 +MULTILIB_DIRNAMES += fpu
9422 +MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
9423 +
9424 # MULTILIB_OPTIONS += mcpu=ep9312
9425 # MULTILIB_DIRNAMES += ep9312
9426 # MULTILIB_EXCEPTIONS += *mthumb/*mcpu=ep9312*
9427 diff -Nur a/gcc/config/arm/t-asa b/gcc/config/arm/t-asa
9428 --- a/gcc/config/arm/t-asa 1970-01-01 01:00:00.000000000 +0100
9429 +++ b/gcc/config/arm/t-asa 2010-01-25 09:50:28.995687913 +0100
9430 @@ -0,0 +1,45 @@
9431 +# Overrides for ASA
9432 +
9433 +# Here is the expected output from xgcc -print-multi-lib.
9434 +#
9435 +# .;@fno-omit-frame-pointer@mapcs-frame
9436 +# armv4t;@march=armv4t@fno-omit-frame-pointer@mapcs-frame
9437 +# armv6;@march=armv6@fno-omit-frame-pointer@mapcs-frame
9438 +# armv7a;@march=armv7-a@fno-omit-frame-pointer@mapcs-frame
9439 +# armv6f;@march=armv6@mfloat-abi=softfp@fno-omit-frame-pointer@mapcs-frame
9440 +# armv7af;@march=armv7-a@mfpu=neon@mfloat-abi=softfp@fno-omit-frame-pointer@mapcs-frame
9441 +# thumb2;@mthumb@march=armv7-a@fno-omit-frame-pointer@mapcs-frame
9442 +# thumb2f;@mthumb@march=armv7-a@mfpu=neon@mfloat-abi=softfp@fno-omit-frame-pointer@mapcs-frame
9443 +
9444 +MULTILIB_OPTIONS = mthumb march=armv4t/march=armv6/march=armv7-a mfpu=neon mfloat-abi=softfp
9445 +MULTILIB_DIRNAMES = thumb v4t v6 v7a neon softfp
9446 +MULTILIB_MATCHES =
9447 +
9448 +MULTILIB_EXTRA_OPTS = fno-omit-frame-pointer mapcs-frame
9449 +
9450 +MULTILIB_EXCEPTIONS = mthumb
9451 +MULTILIB_EXCEPTIONS += mfpu=neon*
9452 +MULTILIB_EXCEPTIONS += mfloat-abi=softfp
9453 +MULTILIB_EXCEPTIONS += *march=armv4t*/*mfpu=neon*
9454 +MULTILIB_EXCEPTIONS += *march=armv4t*/*mfloat-abi=softfp*
9455 +MULTILIB_EXCEPTIONS += march=armv6/*mfpu=neon*
9456 +MULTILIB_EXCEPTIONS += mthumb/mfpu=neon
9457 +MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=softfp
9458 +MULTILIB_EXCEPTIONS += mthumb/mfpu=neon*
9459 +MULTILIB_EXCEPTIONS += mthumb/march=armv6/mfpu=neon*
9460 +
9461 +MULTILIB_OSDIRNAMES = march.armv4t=!armv4t
9462 +MULTILIB_OSDIRNAMES += march.armv6=!armv6
9463 +MULTILIB_OSDIRNAMES += march.armv6/mfloat-abi.softfp=!armv6f
9464 +MULTILIB_OSDIRNAMES += march.armv7-a=!armv7a
9465 +MULTILIB_OSDIRNAMES += march.armv7-a/mfpu.neon/mfloat-abi.softfp=!armv7af
9466 +MULTILIB_OSDIRNAMES += mthumb/march.armv7-a=!thumb2
9467 +MULTILIB_OSDIRNAMES += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.softfp=!thumb2f
9468 +
9469 +MULTILIB_ALIASES = march?armv4t=mthumb/march?armv4t
9470 +MULTILIB_ALIASES += march?armv6=mthumb/march?armv6
9471 +MULTILIB_ALIASES += march?armv6/mfloat-abi?softfp=mthumb/march?armv6/mfloat-abi?softfp
9472 +MULTILIB_ALIASES += march?armv7-a/mfpu?neon/mfloat-abi?softfp=march?armv7-a/mfpu?neon
9473 +MULTILIB_ALIASES += march?armv7-a/mfpu?neon/mfloat-abi?softfp=march?armv7-a/mfloat-abi?softfp
9474 +MULTILIB_ALIASES += mthumb/march?armv7-a/mfpu?neon/mfloat-abi?softfp=mthumb/march?armv7-a/mfpu?neon
9475 +MULTILIB_ALIASES += mthumb/march?armv7-a/mfpu?neon/mfloat-abi?softfp=mthumb/march?armv7-a/mfloat-abi?softfp
9476 diff -Nur a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi
9477 --- a/gcc/config/arm/t-bpabi 2005-11-04 15:51:20.000000000 +0100
9478 +++ b/gcc/config/arm/t-bpabi 2010-01-25 09:50:28.995687913 +0100
9479 @@ -1,10 +1,13 @@
9480 # Add the bpabi.S functions.
9481 -LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod
9482 +LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod \
9483 + _aeabi_idiv0 _aeabi_ldiv0
9484
9485 # Add the BPABI C functions.
9486 LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \
9487 $(srcdir)/config/arm/unaligned-funcs.c
9488
9489 +LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
9490 +
9491 UNWIND_H = $(srcdir)/config/arm/unwind-arm.h
9492 LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \
9493 $(srcdir)/config/arm/libunwind.S \
9494 diff -Nur a/gcc/config/arm/t-cs-eabi b/gcc/config/arm/t-cs-eabi
9495 --- a/gcc/config/arm/t-cs-eabi 1970-01-01 01:00:00.000000000 +0100
9496 +++ b/gcc/config/arm/t-cs-eabi 2010-01-25 09:50:28.995687913 +0100
9497 @@ -0,0 +1,198 @@
9498 +# Multilibs for SourceryG++ arm-none-eabi
9499 +
9500 +MULTILIB_OPTIONS = mthumb
9501 +MULTILIB_DIRNAMES = t
9502 +MULTILIB_EXCEPTIONS =
9503 +MULTILIB_MATCHES =
9504 +MULTILIB_ALIASES =
9505 +
9506 +MULTILIB_OPTIONS += march=armv7/march=armv7-a/march=armv5te/march=armv6-m
9507 +MULTILIB_DIRNAMES += v7 v7a v5te v6m
9508 +MULTILIB_MATCHES += march?armv7-a=march?armv7a
9509 +MULTILIB_MATCHES += march?armv7=march?armv7r
9510 +MULTILIB_MATCHES += march?armv7=march?armv7m
9511 +MULTILIB_MATCHES += march?armv7=march?armv7-r
9512 +MULTILIB_MATCHES += march?armv7=march?armv7-m
9513 +MULTILIB_MATCHES += march?armv7=march?armv7e-m
9514 +MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a9
9515 +MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a8
9516 +MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a5
9517 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
9518 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4f
9519 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
9520 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m1
9521 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m0
9522 +MULTILIB_MATCHES += march?armv5te=march?armv6
9523 +MULTILIB_MATCHES += march?armv5te=march?armv6j
9524 +MULTILIB_MATCHES += march?armv5te=march?armv6k
9525 +MULTILIB_MATCHES += march?armv5te=march?armv6z
9526 +MULTILIB_MATCHES += march?armv5te=march?armv6zk
9527 +MULTILIB_MATCHES += march?armv5te=march?armv6t2
9528 +MULTILIB_MATCHES += march?armv5te=march?iwmmxt
9529 +MULTILIB_MATCHES += march?armv5te=march?iwmmxt2
9530 +MULTILIB_MATCHES += march?armv5te=mcpu?arm9e
9531 +MULTILIB_MATCHES += march?armv5te=mcpu?arm946e-s
9532 +MULTILIB_MATCHES += march?armv5te=mcpu?arm966e-s
9533 +MULTILIB_MATCHES += march?armv5te=mcpu?arm968e-s
9534 +MULTILIB_MATCHES += march?armv5te=mcpu?arm10e
9535 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1020e
9536 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1022e
9537 +MULTILIB_MATCHES += march?armv5te=mcpu?xscale
9538 +MULTILIB_MATCHES += march?armv5te=mcpu?iwmmxt
9539 +MULTILIB_MATCHES += march?armv5te=mcpu?iwmmxt2
9540 +MULTILIB_MATCHES += march?armv5te=mcpu?marvell-f
9541 +MULTILIB_MATCHES += march?armv5te=mcpu?arm926ej-s
9542 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1026ej-s
9543 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1136j-s
9544 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1136jf-s
9545 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1176jz-s
9546 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1176jzf-s
9547 +MULTILIB_MATCHES += march?armv5te=mcpu?mpcorenovfp
9548 +MULTILIB_MATCHES += march?armv5te=mcpu?mpcore
9549 +MULTILIB_MATCHES += march?armv5te=mcpu?arm1156t2-s
9550 +
9551 +MULTILIB_OPTIONS += mfloat-abi=softfp/mfloat-abi=hard
9552 +MULTILIB_DIRNAMES += softfp hard
9553 +MULTILIB_MATCHES += mfloat-abi?hard=mhard-float
9554 +
9555 +MULTILIB_OPTIONS += mfpu=neon
9556 +MULTILIB_DIRNAMES += neon
9557 +MULTILIB_EXCEPTIONS += mfpu=neon
9558 +MULTILIB_MATCHES += mfpu?neon=mfpu?neon-fp16
9559 +MULTILIB_MATCHES += mfpu?neon=mfpu?neon-vfpv4
9560 +
9561 +MULTILIB_ALIASES += mthumb=mthumb/mfpu?neon
9562 +MULTILIB_ALIASES += mthumb=mthumb/march?armv5te/mfpu?neon
9563 +MULTILIB_ALIASES += mbig-endian=mthumb/mfpu?neon/mbig-endian
9564 +#MULTILIB_ALIASES += mfloat-abi?softfp=mthumb/mfloat-abi?softfp/mfpu?neon
9565 +#MULTILIB_ALIASES += mfloat-abi?softfp=mfloat-abi?softfp/mfpu?neon
9566 +#MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=mfloat-abi?softfp/mfpu?neon/mbig-endian
9567 +#MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=mthumb/mfloat-abi?softfp/mfpu?neon/mbig-endian
9568 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7-a/mfpu?neon
9569 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7-a/mfpu?neon/mbig-endian
9570 +MULTILIB_ALIASES += march?armv7-a/mfloat-abi?softfp/mfpu?neon=mthumb/march?armv7-a/mfloat-abi?softfp/mfpu?neon
9571 +MULTILIB_ALIASES += march?armv7-a/mfloat-abi?hard/mfpu?neon=mthumb/march?armv7-a/mfloat-abi?hard/mfpu?neon
9572 +
9573 +MULTILIB_OPTIONS += mbig-endian
9574 +MULTILIB_DIRNAMES += be
9575 +MULTILIB_ALIASES += mbig-endian=mfpu?neon/mbig-endian
9576 +
9577 +# ARMv6-M does not have ARM mode.
9578 +MULTILIB_EXCEPTIONS += march=armv6-m
9579 +
9580 +# Some ARMv7 variants have ARM mode. Use the ARM libraries.
9581 +MULTILIB_EXCEPTIONS += march=armv7 march=armv7/*
9582 +MULTILIB_ALIASES += mbig-endian=march?armv7/mbig-endian
9583 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp=march?armv7/mfloat-abi?softfp
9584 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp=march?armv7/mfloat-abi?softfp/mfpu?neon
9585 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=march?armv7/mfloat-abi?softfp/mbig-endian
9586 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=march?armv7/mfloat-abi?softfp/mfpu?neon/mbig-endian
9587 +MULTILIB_ALIASES += mbig-endian=march?armv7/mfpu?neon/mbig-endian
9588 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7/mfloat-abi?softfp/mfpu?neon
9589 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7/mfpu?neon
9590 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7/mfpu?neon/mbig-endian
9591 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7/mfloat-abi?softfp/mfpu?neon/mbig-endian
9592 +
9593 +# ARMv7-A is specially useful used with VFPv3 (enabled by NEON). Rest of the cases behaves as ARMv7.
9594 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7-a
9595 +MULTILIB_ALIASES += mbig-endian=march?armv7-a/mbig-endian
9596 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=march?armv7-a/mfloat-abi?softfp/mbig-endian
9597 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=march?armv7-a/mfloat-abi?softfp/mfpu?neon/mbig-endian
9598 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7-a/mfloat-abi?softfp
9599 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7-a/mbig-endian
9600 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7-a/mfloat-abi?softfp/mbig-endian
9601 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7/mfloat-abi?softfp
9602 +MULTILIB_ALIASES += march?armv5te=march?armv7-a
9603 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp=march?armv7-a/mfloat-abi?softfp
9604 +MULTILIB_ALIASES += march?armv5te=march?armv7-a/mfpu?neon
9605 +MULTILIB_ALIASES += mbig-endian=march?armv7-a/mfpu?neon/mbig-endian
9606 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7-a/mfloat-abi?softfp/mfpu?neon/mbig-endian
9607 +
9608 +# ARMv5T thumb uses the ARMv5T ARM libraries (with or without VFP).
9609 +MULTILIB_ALIASES += mthumb=mthumb/march?armv5te
9610 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp=mthumb/march?armv5te/mfloat-abi?softfp
9611 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp=march?armv5te/mfloat-abi?softfp/mfpu?neon
9612 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp=mthumb/march?armv5te/mfloat-abi?softfp/mfpu?neon
9613 +MULTILIB_ALIASES += march?armv5te=march?armv5te/mfpu?neon
9614 +MULTILIB_ALIASES += mbig-endian=march?armv5te/mfpu?neon/mbig-endian
9615 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=march?armv5te/mfloat-abi?softfp/mfpu?neon/mbig-endian
9616 +MULTILIB_ALIASES += mbig-endian=mthumb/march?armv5te/mfpu?neon/mbig-endian
9617 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=mthumb/march?armv5te/mfloat-abi?softfp/mfpu?neon/mbig-endian
9618 +
9619 +# ARMv6-M and VFP are incompatible.
9620 +# FIXME: The compiler should probably error.
9621 +MULTILIB_EXCEPTIONS += *march=armv6-m/mfloat-abi=softfp
9622 +MULTILIB_ALIASES += mthumb/march?armv6-m=mthumb/march?armv6-m/mfpu?neon
9623 +MULTILIB_EXCEPTIONS += march=armv6-m*mfpu=neon
9624 +MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfloat-abi=softfp/mfpu=neon
9625 +
9626 +# ARMv4t VFP isn't really supported, so use the soft-float libraries.
9627 +MULTILIB_EXCEPTIONS += mfloat-abi?softfp
9628 +MULTILIB_EXCEPTIONS += mfloat-abi?softfp/mfpu?neon
9629 +MULTILIB_ALIASES += mthumb=mthumb/mfloat-abi?softfp
9630 +MULTILIB_ALIASES += mthumb=mthumb/mfloat-abi?softfp/mfpu?neon
9631 +
9632 +MULTILIB_ALIASES += mbig-endian=mfloat-abi?softfp/mbig-endian
9633 +MULTILIB_ALIASES += mbig-endian=mfloat-abi?softfp/mfpu?neon/mbig-endian
9634 +MULTILIB_ALIASES += mbig-endian=mthumb/mfloat-abi?softfp/mbig-endian
9635 +MULTILIB_ALIASES += mbig-endian=mthumb/mfloat-abi?softfp/mfpu?neon/mbig-endian
9636 +
9637 +# We don't have a big-endian ARMv6-M compatible multilibs.
9638 +MULTILIB_EXCEPTIONS += *march=armv6-m*mbig-endian
9639 +
9640 +# Use the generic libraries for big-endian ARMv5T
9641 +MULTILIB_ALIASES += mbig-endian=march?armv5te/mbig-endian
9642 +MULTILIB_ALIASES += mbig-endian=mfloat-abi?softfp/mbig-endian
9643 +MULTILIB_ALIASES += mbig-endian=mthumb/march?armv5te/mbig-endian
9644 +MULTILIB_ALIASES += march?armv5te/mfloat-abi?softfp/mbig-endian=mthumb/march?armv5te/mfloat-abi?softfp/mbig-endian
9645 +
9646 +# Use ARM libraries for big-endian Thumb.
9647 +MULTILIB_ALIASES += mbig-endian=mthumb/mbig-endian
9648 +
9649 +# Don't bother with big-endian Thumb-2 VFP. Use the soft-float libraries
9650 +# for now.
9651 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7/mfloat-abi?softfp/mbig-endian
9652 +
9653 +# The only -mfloat-abi=hard libraries provided are for little-endian
9654 +# v7-A NEON.
9655 +MULTILIB_EXCEPTIONS += mfloat-abi=hard*
9656 +MULTILIB_EXCEPTIONS += *march=armv5te*mfloat-abi=hard*
9657 +MULTILIB_EXCEPTIONS += *march=armv7/*mfloat-abi=hard*
9658 +MULTILIB_EXCEPTIONS += *march=armv6-m*mfloat-abi=hard*
9659 +MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=hard*
9660 +MULTILIB_EXCEPTIONS += *mfloat-abi=hard*mbig-endian
9661 +MULTILIB_EXCEPTIONS += *mfloat-abi=hard
9662 +
9663 +# FIXME: We need a sane way of doing this.
9664 +# This isn't really a multilib, it's a hack to add an extra option
9665 +# to the v7-m multilib.
9666 +MULTILIB_OPTIONS += mfix-cortex-m3-ldrd
9667 +MULTILIB_DIRNAMES += broken_ldrd
9668 +
9669 +MULTILIB_EXCEPTIONS += mfix-cortex-m3-ldrd
9670 +MULTILIB_EXCEPTIONS += mthumb/mfix-cortex-m3-ldrd
9671 +MULTILIB_EXCEPTIONS += *march=armv6-m*mfix-cortex-m3-ldrd
9672 +MULTILIB_EXCEPTIONS += *march=armv7-a*mfix-cortex-m3-ldrd
9673 +MULTILIB_EXCEPTIONS += *mcpu=*mfix-cortex-m3-ldrd
9674 +MULTILIB_EXCEPTIONS += *mbig-endian*mfix-cortex-m3-ldrd
9675 +MULTILIB_EXCEPTIONS += *mfloat-abi=softfp*mfix-cortex-m3-ldrd
9676 +MULTILIB_EXCEPTIONS += *march=armv5te*mfix-cortex-m3-ldrd
9677 +MULTILIB_EXCEPTIONS += *mfpu=neon*mfix-cortex-m3-ldrd
9678 +
9679 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7
9680 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7-a/mfix-cortex-m3-ldrd
9681 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7/mfpu?neon/mfix-cortex-m3-ldrd
9682 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7-a/mfpu?neon/mfix-cortex-m3-ldrd
9683 +
9684 +# As of at least 4.2, gcc passes the wrong -L options if some multilibs are
9685 +# omitted from MULTILIB_OSDIRNAMES
9686 +MULTILIB_OSDIRNAMES = mthumb=!thumb
9687 +MULTILIB_OSDIRNAMES += mbig-endian=!be
9688 +MULTILIB_OSDIRNAMES += march.armv5te=!armv5te
9689 +MULTILIB_OSDIRNAMES += march.armv5te/mfloat-abi.softfp=!vfp
9690 +MULTILIB_OSDIRNAMES += march.armv5te/mfloat-abi.softfp/mbig-endian=!vfp-be
9691 +MULTILIB_OSDIRNAMES += mthumb/march.armv7/mfix-cortex-m3-ldrd=!thumb2
9692 +MULTILIB_OSDIRNAMES += march.armv7-a/mfloat-abi.softfp/mfpu.neon=!armv7-a-neon
9693 +MULTILIB_OSDIRNAMES += march.armv7-a/mfloat-abi.hard/mfpu.neon=!armv7-a-hard
9694 +MULTILIB_OSDIRNAMES += mthumb/march.armv7/mbig-endian=!thumb2-be
9695 +MULTILIB_OSDIRNAMES += mthumb/march.armv6-m=!armv6-m
9696 diff -Nur a/gcc/config/arm/t-cs-eabi-lite b/gcc/config/arm/t-cs-eabi-lite
9697 --- a/gcc/config/arm/t-cs-eabi-lite 1970-01-01 01:00:00.000000000 +0100
9698 +++ b/gcc/config/arm/t-cs-eabi-lite 2010-01-25 09:50:28.995687913 +0100
9699 @@ -0,0 +1,47 @@
9700 +# We build 4 multilibs:
9701 +# ./ (default)
9702 +# thumb/ -mthumb
9703 +# thumb2/ -mthumb -march=armv7
9704 +# armv6-m/ -mthumb -march=armv6-m
9705 +
9706 +MULTILIB_OPTIONS = mthumb
9707 +MULTILIB_DIRNAMES = thumb
9708 +MULTILIB_EXCEPTIONS =
9709 +MULTILIB_MATCHES =
9710 +MULTILIB_ALIASES =
9711 +
9712 +MULTILIB_OPTIONS += march=armv7/march=armv6-m
9713 +MULTILIB_DIRNAMES += v7 v6-m
9714 +MULTILIB_EXCEPTIONS += march=armv7*
9715 +MULTILIB_MATCHES += march?armv7=march?armv7-a
9716 +MULTILIB_MATCHES += march?armv7=march?armv7-r
9717 +MULTILIB_MATCHES += march?armv7=march?armv7-m
9718 +MULTILIB_MATCHES += march?armv7=march?armv7e-m
9719 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a9
9720 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a8
9721 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a5
9722 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
9723 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4f
9724 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
9725 +
9726 +MULTILIB_EXCEPTIONS += march=armv6-m
9727 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m1
9728 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m0
9729 +
9730 +# FIXME: We need a sane way of doing this.
9731 +# This isn't really a multilib, it's a hack to add an extra option
9732 +# to the v7-m multilib.
9733 +MULTILIB_OPTIONS += mfix-cortex-m3-ldrd
9734 +MULTILIB_DIRNAMES += broken_ldrd
9735 +
9736 +MULTILIB_EXCEPTIONS += mfix-cortex-m3-ldrd
9737 +MULTILIB_EXCEPTIONS += mthumb/mfix-cortex-m3-ldrd
9738 +MULTILIB_EXCEPTIONS += *march=armv6-m*mfix-cortex-m3-ldrd
9739 +
9740 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7
9741 +
9742 +# As of at least 4.2, gcc passes the wrong -L options if some multilibs are
9743 +# omitted from MULTILIB_OSDIRNAMES
9744 +MULTILIB_OSDIRNAMES = mthumb=!thumb
9745 +MULTILIB_OSDIRNAMES += mthumb/march.armv7/mfix-cortex-m3-ldrd=!thumb2
9746 +MULTILIB_OSDIRNAMES += mthumb/march.armv6-m=!armv6-m
9747 diff -Nur a/gcc/config/arm/t-cs-linux b/gcc/config/arm/t-cs-linux
9748 --- a/gcc/config/arm/t-cs-linux 1970-01-01 01:00:00.000000000 +0100
9749 +++ b/gcc/config/arm/t-cs-linux 2010-01-25 09:50:28.995687913 +0100
9750 @@ -0,0 +1,112 @@
9751 +# Multilibs for SourceryG++ arm-none-linux-gnueabi
9752 +
9753 +MULTILIB_OPTIONS = mthumb
9754 +MULTILIB_DIRNAMES = t
9755 +MULTILIB_EXCEPTIONS =
9756 +MULTILIB_MATCHES =
9757 +MULTILIB_ALIASES =
9758 +
9759 +MULTILIB_OPTIONS += march=armv4t/march=armv7-a
9760 +MULTILIB_DIRNAMES += v4t v7a
9761 +
9762 +MULTILIB_MATCHES += march?armv7-a=march?armv7a
9763 +MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a9
9764 +MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a8
9765 +MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a5
9766 +MULTILIB_MATCHES += march?armv4t=march?ep9312
9767 +MULTILIB_MATCHES += march?armv4t=mcpu?arm7tdmi
9768 +MULTILIB_MATCHES += march?armv4t=mcpu?arm7tdmi-s
9769 +MULTILIB_MATCHES += march?armv4t=mcpu?arm710t
9770 +MULTILIB_MATCHES += march?armv4t=mcpu?arm720t
9771 +MULTILIB_MATCHES += march?armv4t=mcpu?arm740t
9772 +MULTILIB_MATCHES += march?armv4t=mcpu?arm9
9773 +MULTILIB_MATCHES += march?armv4t=mcpu?arm9tdmi
9774 +MULTILIB_MATCHES += march?armv4t=mcpu?arm920
9775 +MULTILIB_MATCHES += march?armv4t=mcpu?arm920t
9776 +MULTILIB_MATCHES += march?armv4t=mcpu?arm922t
9777 +MULTILIB_MATCHES += march?armv4t=mcpu?arm940t
9778 +MULTILIB_MATCHES += march?armv4t=mcpu?ep9312
9779 +MULTILIB_MATCHES += march?armv4t=march?armv5
9780 +MULTILIB_MATCHES += march?armv4t=march?armv5t
9781 +MULTILIB_MATCHES += march?armv4t=march?arm10tdmi
9782 +MULTILIB_MATCHES += march?armv4t=march?arm1020t
9783 +
9784 +MULTILIB_OPTIONS += mfloat-abi=softfp/mfloat-abi=hard
9785 +MULTILIB_DIRNAMES += softfp hard
9786 +MULTILIB_MATCHES += mfloat-abi?hard=mhard-float
9787 +
9788 +MULTILIB_OPTIONS += mfpu=neon
9789 +MULTILIB_DIRNAMES += neon
9790 +MULTILIB_EXCEPTIONS += mfpu=neon
9791 +MULTILIB_MATCHES += mfpu?neon=mfpu?neon-fp16
9792 +MULTILIB_MATCHES += mfpu?neon=mfpu?neon-vfpv4
9793 +MULTILIB_ALIASES += mfloat-abi?softfp=mfloat-abi?softfp/mfpu?neon
9794 +MULTILIB_ALIASES += mfloat-abi?softfp=mthumb/mfloat-abi?softfp/mfpu?neon
9795 +MULTILIB_ALIASES += march?armv7-a/mfloat-abi?hard/mfpu?neon=mthumb/march?armv7-a/mfloat-abi?hard/mfpu?neon
9796 +
9797 +MULTILIB_OPTIONS += mbig-endian
9798 +MULTILIB_DIRNAMES += be
9799 +MULTILIB_ALIASES += mbig-endian=mfpu?neon/mbig-endian
9800 +MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=mfloat-abi?softfp/mfpu?neon/mbig-endian
9801 +MULTILIB_ALIASES += mbig-endian=mthumb/mfpu?neon/mbig-endian
9802 +MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=mthumb/mfloat-abi?softfp/mfpu?neon/mbig-endian
9803 +
9804 +# Do not build Thumb libraries.
9805 +MULTILIB_EXCEPTIONS += mthumb
9806 +MULTILIB_EXCEPTIONS += mthumb/mfpu=neon
9807 +
9808 +# Use ARM libraries for ARMv4t Thumb and VFP.
9809 +MULTILIB_ALIASES += march?armv4t=mthumb/march?armv4t
9810 +MULTILIB_ALIASES += march?armv4t=march?armv4t/mfloat-abi?softfp
9811 +MULTILIB_ALIASES += march?armv4t=mthumb/march?armv4t/mfloat-abi?softfp
9812 +MULTILIB_ALIASES += march?armv4t=march?armv4t/mfpu?neon
9813 +MULTILIB_ALIASES += march?armv4t=march?armv4t/mfloat-abi?softfp/mfpu?neon
9814 +MULTILIB_ALIASES += march?armv4t=mthumb/march?armv4t/mfpu?neon
9815 +MULTILIB_ALIASES += march?armv4t=mthumb/march?armv4t/mfloat-abi?softfp/mfpu?neon
9816 +
9817 +# We do not support ARMv4t big-endian.
9818 +MULTILIB_EXCEPTIONS += *march=armv4t*mbig-endian
9819 +
9820 +# Behave ARMv7-A as ARMv7 for some cases.
9821 +MULTILIB_EXCEPTIONS += march=armv7-a
9822 +MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon
9823 +MULTILIB_ALIASES += mfloat-abi?softfp=march?armv7-a/mfloat-abi?softfp
9824 +MULTILIB_ALIASES += mbig-endian=march?armv7-a/mbig-endian
9825 +MULTILIB_ALIASES += mbig-endian=march?armv7-a/mfpu?neon/mbig-endian
9826 +MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=march?armv7-a/mfloat-abi?softfp/mbig-endian
9827 +MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=march?armv7-a/mfloat-abi?softfp/mfpu?neon/mbig-endian
9828 +MULTILIB_ALIASES += mthumb/march?armv7-a=mthumb/march?armv7-a/mfpu?neon
9829 +MULTILIB_ALIASES += mthumb/march?armv7-a/mbig-endian=mthumb/march?armv7-a/mfpu?neon/mbig-endian
9830 +MULTILIB_ALIASES += mthumb/march?armv7-a/mbig-endian=mthumb/march?armv7-a/mfloat-abi?softfp/mfpu?neon/mbig-endian
9831 +MULTILIB_ALIASES += mthumb/march?armv7-a=mthumb/march?armv7-a/mfloat-abi?softfp
9832 +
9833 +# Thumb-1 VFP isn't really a meaningful combination. Use the ARM VFP.
9834 +MULTILIB_ALIASES += mfloat-abi?softfp=mthumb/mfloat-abi?softfp
9835 +MULTILIB_ALIASES += mfloat-abi?softfp/mbig-endian=mthumb/mfloat-abi?softfp/mbig-endian
9836 +
9837 +# Use ARM libraries for big-endian Thumb.
9838 +MULTILIB_ALIASES += mbig-endian=mthumb/mbig-endian
9839 +
9840 +# Don't bother with big-endian Thumb-2 VFP. Use the soft-float libraries
9841 +# for now.
9842 +MULTILIB_ALIASES += mthumb/march?armv7-a/mbig-endian=mthumb/march?armv7-a/mfloat-abi?softfp/mbig-endian
9843 +
9844 +# The only -mfloat-abi=hard libraries provided are for little-endian
9845 +# v7-A NEON.
9846 +MULTILIB_EXCEPTIONS += mfloat-abi=hard*
9847 +MULTILIB_EXCEPTIONS += *march=armv4t*mfloat-abi=hard*
9848 +MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=hard*
9849 +MULTILIB_EXCEPTIONS += *mfloat-abi=hard*mbig-endian
9850 +MULTILIB_EXCEPTIONS += *mfloat-abi=hard
9851 +
9852 +# As of at least 4.2, gcc passes the wrong -L options if some multilibs are
9853 +# omitted from MULTILIB_OSDIRNAMES
9854 +MULTILIB_OSDIRNAMES = march.armv4t=!armv4t
9855 +MULTILIB_OSDIRNAMES += mbig-endian=!be
9856 +MULTILIB_OSDIRNAMES += mfloat-abi.softfp=!vfp
9857 +MULTILIB_OSDIRNAMES += mfloat-abi.softfp/mbig-endian=!vfp-be
9858 +MULTILIB_OSDIRNAMES += mthumb/march.armv7-a=!thumb2
9859 +MULTILIB_OSDIRNAMES += march.armv7-a/mfloat-abi.softfp/mfpu.neon=!armv7-a-neon
9860 +MULTILIB_OSDIRNAMES += mthumb/march.armv7-a/mfloat-abi.softfp/mfpu.neon=!thumb2-neon
9861 +MULTILIB_OSDIRNAMES += march.armv7-a/mfloat-abi.hard/mfpu.neon=!armv7-a-hard
9862 +MULTILIB_OSDIRNAMES += mthumb/march.armv7-a/mbig-endian=!thumb2-be
9863 diff -Nur a/gcc/config/arm/t-cs-linux-lite b/gcc/config/arm/t-cs-linux-lite
9864 --- a/gcc/config/arm/t-cs-linux-lite 1970-01-01 01:00:00.000000000 +0100
9865 +++ b/gcc/config/arm/t-cs-linux-lite 2010-01-25 09:50:28.995687913 +0100
9866 @@ -0,0 +1,48 @@
9867 +# We build 3 multilibs:
9868 +# ./ (default)
9869 +# armv4t/ -march=armv4t [-mthumb]
9870 +# thumb2/ -mthumb -march=armv7
9871 +MULTILIB_OPTIONS = mthumb
9872 +MULTILIB_DIRNAMES = thumb
9873 +MULTILIB_OPTIONS += march=armv4t/march=armv7
9874 +MULTILIB_DIRNAMES += v4t v7
9875 +MULTILIB_EXCEPTIONS += march=armv7
9876 +MULTILIB_EXCEPTIONS += mthumb
9877 +
9878 +MULTILIB_ALIASES = march?armv4t=mthumb/march?armv4t
9879 +
9880 +# As of at least 4.2, gcc passes the wrong -L options if some multilibs are
9881 +# omitted from MULTILIB_OSDIRNAMES
9882 +MULTILIB_OSDIRNAMES = march.armv4t=!armv4t
9883 +MULTILIB_OSDIRNAMES += mthumb/march.armv7=!thumb2
9884 +
9885 +MULTILIB_MATCHES += march?armv7=march?armv7a
9886 +MULTILIB_MATCHES += march?armv7=march?armv7r
9887 +MULTILIB_MATCHES += march?armv7=march?armv7m
9888 +MULTILIB_MATCHES += march?armv7=march?armv7-a
9889 +MULTILIB_MATCHES += march?armv7=march?armv7-r
9890 +MULTILIB_MATCHES += march?armv7=march?armv7-m
9891 +MULTILIB_MATCHES += march?armv7=march?armv7e-m
9892 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a9
9893 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a8
9894 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a5
9895 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
9896 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4f
9897 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
9898 +MULTILIB_MATCHES += march?armv4t=march?ep9312
9899 +MULTILIB_MATCHES += march?armv4t=mcpu?arm7tdmi
9900 +MULTILIB_MATCHES += march?armv4t=mcpu?arm7tdmi-s
9901 +MULTILIB_MATCHES += march?armv4t=mcpu?arm710t
9902 +MULTILIB_MATCHES += march?armv4t=mcpu?arm720t
9903 +MULTILIB_MATCHES += march?armv4t=mcpu?arm740t
9904 +MULTILIB_MATCHES += march?armv4t=mcpu?arm9
9905 +MULTILIB_MATCHES += march?armv4t=mcpu?arm9tdmi
9906 +MULTILIB_MATCHES += march?armv4t=mcpu?arm920
9907 +MULTILIB_MATCHES += march?armv4t=mcpu?arm920t
9908 +MULTILIB_MATCHES += march?armv4t=mcpu?arm922t
9909 +MULTILIB_MATCHES += march?armv4t=mcpu?arm940t
9910 +MULTILIB_MATCHES += march?armv4t=mcpu?ep9312
9911 +MULTILIB_MATCHES += march?armv4t=march?armv5
9912 +MULTILIB_MATCHES += march?armv4t=march?armv5t
9913 +MULTILIB_MATCHES += march?armv4t=march?arm10tdmi
9914 +MULTILIB_MATCHES += march?armv4t=march?arm1020t
9915 diff -Nur a/gcc/config/arm/t-cs-uclinux-eabi b/gcc/config/arm/t-cs-uclinux-eabi
9916 --- a/gcc/config/arm/t-cs-uclinux-eabi 1970-01-01 01:00:00.000000000 +0100
9917 +++ b/gcc/config/arm/t-cs-uclinux-eabi 2010-01-25 09:50:28.995687913 +0100
9918 @@ -0,0 +1,55 @@
9919 +# EABI uClinux multilib selection. Other setting are inherited from t-arm-elf
9920 +
9921 +# We build 3 multilibs:
9922 +# . (default)
9923 +# thumb2/ -mthumb -march=armv7 -mfix-cortex-m3-ldrd
9924 +# armv6-m/ -mthumb -march=armv6-m
9925 +
9926 +MULTILIB_OPTIONS = mthumb
9927 +MULTILIB_DIRNAMES = thumb
9928 +MULTILIB_EXCEPTIONS =
9929 +MULTILIB_MATCHES =
9930 +
9931 +MULTILIB_OPTIONS += march=armv7/march=armv6-m
9932 +MULTILIB_DIRNAMES += armv7 armv6-m
9933 +
9934 +MULTILIB_EXCEPTIONS += mthumb
9935 +
9936 +MULTILIB_EXCEPTIONS += march=armv7
9937 +MULTILIB_MATCHES += march?armv7=march?armv7a
9938 +MULTILIB_MATCHES += march?armv7=march?armv7r
9939 +MULTILIB_MATCHES += march?armv7=march?armv7m
9940 +MULTILIB_MATCHES += march?armv7=march?armv7-a
9941 +MULTILIB_MATCHES += march?armv7=march?armv7-r
9942 +MULTILIB_MATCHES += march?armv7=march?armv7-m
9943 +MULTILIB_MATCHES += march?armv7=march?armv7e-m
9944 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a9
9945 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a8
9946 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-a5
9947 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
9948 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4f
9949 +MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
9950 +
9951 +MULTILIB_EXCEPTIONS += march=armv6-m
9952 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m1
9953 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m0
9954 +
9955 +MULTILIB_ALIASES =
9956 +
9957 +# FIXME: We need a sane way of doing this.
9958 +# This isn't really a multilib, it's a hack to add an extra option
9959 +# to the v7-m multilib.
9960 +MULTILIB_OPTIONS += mfix-cortex-m3-ldrd
9961 +MULTILIB_DIRNAMES += broken_ldrd
9962 +
9963 +MULTILIB_EXCEPTIONS += mfix-cortex-m3-ldrd
9964 +MULTILIB_EXCEPTIONS += mthumb/mfix-cortex-m3-ldrd
9965 +MULTILIB_EXCEPTIONS += march=armv7/mfix-cortex-m3-ldrd
9966 +MULTILIB_EXCEPTIONS += *march=armv6-m*mfix-cortex-m3-ldrd
9967 +
9968 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7
9969 +
9970 +
9971 +MULTILIB_OSDIRNAMES = mthumb/march.armv7/mfix-cortex-m3-ldrd=!thumb2
9972 +MULTILIB_OSDIRNAMES += mthumb/march.armv6-m=!armv6-m
9973 +
9974 diff -Nur a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
9975 --- a/gcc/config/arm/thumb2.md 2008-11-21 00:00:00.000000000 +0100
9976 +++ b/gcc/config/arm/thumb2.md 2010-01-25 09:50:28.995687913 +0100
9977 @@ -24,6 +24,8 @@
9978 ;; changes made in armv5t as "thumb2". These are considered part
9979 ;; the 16-bit Thumb-1 instruction set.
9980
9981 +(include "hwdiv.md")
9982 +
9983 (define_insn "*thumb2_incscc"
9984 [(set (match_operand:SI 0 "s_register_operand" "=r,r")
9985 (plus:SI (match_operator:SI 2 "arm_comparison_operator"
9986 @@ -172,34 +174,6 @@
9987 (set_attr "length" "8")]
9988 )
9989
9990 -(define_insn "*thumb2_abssi2"
9991 - [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
9992 - (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))
9993 - (clobber (reg:CC CC_REGNUM))]
9994 - "TARGET_THUMB2"
9995 - "@
9996 - cmp\\t%0, #0\;it\tlt\;rsblt\\t%0, %0, #0
9997 - eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31"
9998 - [(set_attr "conds" "clob,*")
9999 - (set_attr "shift" "1")
10000 - ;; predicable can't be set based on the variant, so left as no
10001 - (set_attr "length" "10,8")]
10002 -)
10003 -
10004 -(define_insn "*thumb2_neg_abssi2"
10005 - [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
10006 - (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))))
10007 - (clobber (reg:CC CC_REGNUM))]
10008 - "TARGET_THUMB2"
10009 - "@
10010 - cmp\\t%0, #0\;it\\tgt\;rsbgt\\t%0, %0, #0
10011 - eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31"
10012 - [(set_attr "conds" "clob,*")
10013 - (set_attr "shift" "1")
10014 - ;; predicable can't be set based on the variant, so left as no
10015 - (set_attr "length" "10,8")]
10016 -)
10017 -
10018 (define_insn "*thumb2_movdi"
10019 [(set (match_operand:DI 0 "nonimmediate_di_operand" "=r, r, r, r, m")
10020 (match_operand:DI 1 "di_operand" "rDa,Db,Dc,mi,r"))]
10021 @@ -223,9 +197,14 @@
10022 (set_attr "neg_pool_range" "*,*,*,0,*")]
10023 )
10024
10025 +;; We have two alternatives here for memory loads (and similarly for stores)
10026 +;; to reflect the fact that the permissible constant pool ranges differ
10027 +;; between ldr instructions taking low regs and ldr instructions taking high
10028 +;; regs. The high register alternatives are not taken into account when
10029 +;; choosing register preferences in order to reflect their expense.
10030 (define_insn "*thumb2_movsi_insn"
10031 - [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m")
10032 - (match_operand:SI 1 "general_operand" "rk ,I,K,N,mi,rk"))]
10033 + [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,l,*hk,m,*m")
10034 + (match_operand:SI 1 "general_operand" "rk ,I,K,j,mi,*mi,l,*hk"))]
10035 "TARGET_THUMB2 && ! TARGET_IWMMXT
10036 && !(TARGET_HARD_FLOAT && TARGET_VFP)
10037 && ( register_operand (operands[0], SImode)
10038 @@ -236,11 +215,13 @@
10039 mvn%?\\t%0, #%B1
10040 movw%?\\t%0, %1
10041 ldr%?\\t%0, %1
10042 + ldr%?\\t%0, %1
10043 + str%?\\t%1, %0
10044 str%?\\t%1, %0"
10045 - [(set_attr "type" "*,*,*,*,load1,store1")
10046 + [(set_attr "type" "*,*,*,*,load1,load1,store1,store1")
10047 (set_attr "predicable" "yes")
10048 - (set_attr "pool_range" "*,*,*,*,4096,*")
10049 - (set_attr "neg_pool_range" "*,*,*,*,0,*")]
10050 + (set_attr "pool_range" "*,*,*,*,1020,4096,*,*")
10051 + (set_attr "neg_pool_range" "*,*,*,*,0,0,*,*")]
10052 )
10053
10054 ;; ??? We can probably do better with thumb2
10055 @@ -1128,27 +1109,7 @@
10056 return \"add%!\\t%0, %1, %2\";
10057 "
10058 [(set_attr "predicable" "yes")
10059 - (set_attr "length" "2")]
10060 -)
10061 -
10062 -(define_insn "divsi3"
10063 - [(set (match_operand:SI 0 "s_register_operand" "=r")
10064 - (div:SI (match_operand:SI 1 "s_register_operand" "r")
10065 - (match_operand:SI 2 "s_register_operand" "r")))]
10066 - "TARGET_THUMB2 && arm_arch_hwdiv"
10067 - "sdiv%?\t%0, %1, %2"
10068 - [(set_attr "predicable" "yes")
10069 - (set_attr "insn" "sdiv")]
10070 -)
10071 -
10072 -(define_insn "udivsi3"
10073 - [(set (match_operand:SI 0 "s_register_operand" "=r")
10074 - (udiv:SI (match_operand:SI 1 "s_register_operand" "r")
10075 - (match_operand:SI 2 "s_register_operand" "r")))]
10076 - "TARGET_THUMB2 && arm_arch_hwdiv"
10077 - "udiv%?\t%0, %1, %2"
10078 - [(set_attr "predicable" "yes")
10079 - (set_attr "insn" "udiv")]
10080 + (set_attr "length" "4")]
10081 )
10082
10083 (define_insn "*thumb2_subsi_short"
10084 @@ -1162,6 +1123,71 @@
10085 (set_attr "length" "2")]
10086 )
10087
10088 +;; 16-bit encodings of "muls" and "mul<c>". We only use these when
10089 +;; optimizing for size since "muls" is slow on all known
10090 +;; implementations and since "mul<c>" will be generated by
10091 +;; "*arm_mulsi3_v6" anyhow. The assembler will use a 16-bit encoding
10092 +;; for "mul<c>" whenever possible anyhow.
10093 +(define_peephole2
10094 + [(set (match_operand:SI 0 "low_register_operand" "")
10095 + (mult:SI (match_operand:SI 1 "low_register_operand" "")
10096 + (match_dup 0)))]
10097 + "TARGET_THUMB2 && optimize_size && peep2_regno_dead_p (0, CC_REGNUM)"
10098 + [(parallel
10099 + [(set (match_dup 0)
10100 + (mult:SI (match_dup 0) (match_dup 1)))
10101 + (clobber (reg:CC CC_REGNUM))])]
10102 + ""
10103 +)
10104 +
10105 +(define_peephole2
10106 + [(set (match_operand:SI 0 "low_register_operand" "")
10107 + (mult:SI (match_dup 0)
10108 + (match_operand:SI 1 "low_register_operand" "")))]
10109 + "TARGET_THUMB2 && optimize_size && peep2_regno_dead_p (0, CC_REGNUM)"
10110 + [(parallel
10111 + [(set (match_dup 0)
10112 + (mult:SI (match_dup 0) (match_dup 1)))
10113 + (clobber (reg:CC CC_REGNUM))])]
10114 + ""
10115 +)
10116 +
10117 +(define_insn "*thumb2_mulsi_short"
10118 + [(set (match_operand:SI 0 "low_register_operand" "=l")
10119 + (mult:SI (match_operand:SI 1 "low_register_operand" "%0")
10120 + (match_operand:SI 2 "low_register_operand" "l")))
10121 + (clobber (reg:CC CC_REGNUM))]
10122 + "TARGET_THUMB2 && optimize_size && reload_completed"
10123 + "mul%!\\t%0, %2, %0"
10124 + [(set_attr "predicable" "yes")
10125 + (set_attr "length" "2")
10126 + (set_attr "insn" "muls")])
10127 +
10128 +(define_insn "*thumb2_mulsi_short_compare0"
10129 + [(set (reg:CC_NOOV CC_REGNUM)
10130 + (compare:CC_NOOV
10131 + (mult:SI (match_operand:SI 1 "register_operand" "%0")
10132 + (match_operand:SI 2 "register_operand" "l"))
10133 + (const_int 0)))
10134 + (set (match_operand:SI 0 "register_operand" "=l")
10135 + (mult:SI (match_dup 1) (match_dup 2)))]
10136 + "TARGET_THUMB2 && optimize_size"
10137 + "muls\\t%0, %2, %0"
10138 + [(set_attr "length" "2")
10139 + (set_attr "insn" "muls")])
10140 +
10141 +(define_insn "*thumb2_mulsi_short_compare0_scratch"
10142 + [(set (reg:CC_NOOV CC_REGNUM)
10143 + (compare:CC_NOOV
10144 + (mult:SI (match_operand:SI 1 "register_operand" "%0")
10145 + (match_operand:SI 2 "register_operand" "l"))
10146 + (const_int 0)))
10147 + (clobber (match_scratch:SI 0 "=r"))]
10148 + "TARGET_THUMB2 && optimize_size"
10149 + "muls\\t%0, %2, %0"
10150 + [(set_attr "length" "2")
10151 + (set_attr "insn" "muls")])
10152 +
10153 (define_insn "*thumb2_cbz"
10154 [(set (pc) (if_then_else
10155 (eq (match_operand:SI 0 "s_register_operand" "l,?r")
10156 @@ -1171,7 +1197,7 @@
10157 (clobber (reg:CC CC_REGNUM))]
10158 "TARGET_THUMB2"
10159 "*
10160 - if (get_attr_length (insn) == 2 && which_alternative == 0)
10161 + if (get_attr_length (insn) == 2)
10162 return \"cbz\\t%0, %l1\";
10163 else
10164 return \"cmp\\t%0, #0\;beq\\t%l1\";
10165 @@ -1179,7 +1205,8 @@
10166 [(set (attr "length")
10167 (if_then_else
10168 (and (ge (minus (match_dup 1) (pc)) (const_int 2))
10169 - (le (minus (match_dup 1) (pc)) (const_int 128)))
10170 + (le (minus (match_dup 1) (pc)) (const_int 128))
10171 + (eq (symbol_ref ("which_alternative")) (const_int 0)))
10172 (const_int 2)
10173 (const_int 8)))]
10174 )
10175 @@ -1193,7 +1220,7 @@
10176 (clobber (reg:CC CC_REGNUM))]
10177 "TARGET_THUMB2"
10178 "*
10179 - if (get_attr_length (insn) == 2 && which_alternative == 0)
10180 + if (get_attr_length (insn) == 2)
10181 return \"cbnz\\t%0, %l1\";
10182 else
10183 return \"cmp\\t%0, #0\;bne\\t%l1\";
10184 @@ -1201,7 +1228,8 @@
10185 [(set (attr "length")
10186 (if_then_else
10187 (and (ge (minus (match_dup 1) (pc)) (const_int 2))
10188 - (le (minus (match_dup 1) (pc)) (const_int 128)))
10189 + (le (minus (match_dup 1) (pc)) (const_int 128))
10190 + (eq (symbol_ref ("which_alternative")) (const_int 0)))
10191 (const_int 2)
10192 (const_int 8)))]
10193 )
10194 diff -Nur a/gcc/config/arm/t-linux-eabi b/gcc/config/arm/t-linux-eabi
10195 --- a/gcc/config/arm/t-linux-eabi 2009-01-24 22:06:08.000000000 +0100
10196 +++ b/gcc/config/arm/t-linux-eabi 2010-01-25 09:50:28.995687913 +0100
10197 @@ -6,8 +6,8 @@
10198 MULTILIB_OPTIONS =
10199 MULTILIB_DIRNAMES =
10200
10201 -# Use a version of div0 which raises SIGFPE.
10202 -LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx
10203 +# Use a version of div0 which raises SIGFPE, and a special __clear_cache.
10204 +LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx _clear_cache
10205
10206 # Multilib the standard Linux files. Don't include crti.o or crtn.o,
10207 # which are provided by glibc.
10208 diff -Nur a/gcc/config/arm/t-montavista-linux b/gcc/config/arm/t-montavista-linux
10209 --- a/gcc/config/arm/t-montavista-linux 1970-01-01 01:00:00.000000000 +0100
10210 +++ b/gcc/config/arm/t-montavista-linux 2010-01-25 09:50:28.995687913 +0100
10211 @@ -0,0 +1,33 @@
10212 +# MontaVista GNU/Linux Configuration.
10213 +# Copyright (C) 2009
10214 +# Free Software Foundation, Inc.
10215 +#
10216 +# This file is part of GCC.
10217 +#
10218 +# GCC is free software; you can redistribute it and/or modify
10219 +# it under the terms of the GNU General Public License as published by
10220 +# the Free Software Foundation; either version 3, or (at your option)
10221 +# any later version.
10222 +#
10223 +# GCC is distributed in the hope that it will be useful,
10224 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
10225 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10226 +# GNU General Public License for more details.
10227 +#
10228 +# You should have received a copy of the GNU General Public License
10229 +# along with GCC; see the file COPYING3. If not see
10230 +# <http://www.gnu.org/licenses/>.
10231 +
10232 +MULTILIB_OPTIONS = tarmv6/tthumb2
10233 +MULTILIB_DIRNAMES = armv6 thumb2
10234 +
10235 +MULTILIB_EXCEPTIONS =
10236 +
10237 +MULTILIB_OSDIRNAMES =
10238 +
10239 +MULTILIB_ALIASES =
10240 +
10241 +MULTILIB_MATCHES =
10242 +
10243 +# These files must be built for each multilib.
10244 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
10245 diff -Nur a/gcc/config/arm/t-symbian b/gcc/config/arm/t-symbian
10246 --- a/gcc/config/arm/t-symbian 2008-06-12 19:29:47.000000000 +0200
10247 +++ b/gcc/config/arm/t-symbian 2010-01-25 09:50:28.995687913 +0100
10248 @@ -17,6 +17,9 @@
10249 LIB2ADDEH = $(srcdir)/unwind-c.c $(srcdir)/config/arm/pr-support.c
10250 LIB2ADDEHDEP = $(UNWIND_H)
10251
10252 +# Include half-float helpers.
10253 +LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
10254 +
10255 # Create a multilib for processors with VFP floating-point, and a
10256 # multilib for those without -- using the soft-float ABI in both
10257 # cases. Symbian OS object should be compiled with interworking
10258 diff -Nur a/gcc/config/arm/t-wrs-linux b/gcc/config/arm/t-wrs-linux
10259 --- a/gcc/config/arm/t-wrs-linux 1970-01-01 01:00:00.000000000 +0100
10260 +++ b/gcc/config/arm/t-wrs-linux 2010-01-25 09:50:28.995687913 +0100
10261 @@ -0,0 +1,43 @@
10262 +# Wind River GNU/Linux Configuration.
10263 +# Copyright (C) 2006, 2007, 2008
10264 +# Free Software Foundation, Inc.
10265 +#
10266 +# This file is part of GCC.
10267 +#
10268 +# GCC is free software; you can redistribute it and/or modify
10269 +# it under the terms of the GNU General Public License as published by
10270 +# the Free Software Foundation; either version 3, or (at your option)
10271 +# any later version.
10272 +#
10273 +# GCC is distributed in the hope that it will be useful,
10274 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
10275 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10276 +# GNU General Public License for more details.
10277 +#
10278 +# You should have received a copy of the GNU General Public License
10279 +# along with GCC; see the file COPYING3. If not see
10280 +# <http://www.gnu.org/licenses/>.
10281 +
10282 +MULTILIB_OPTIONS = muclibc
10283 +MULTILIB_OPTIONS += tarm926ej-s/tiwmmxt/txscale/tarm920t/tthumb2/tcortex-a8-be8
10284 +MULTILIB_OPTIONS += mfloat-abi=softfp
10285 +MULTILIB_DIRNAMES = uclibc
10286 +MULTILIB_DIRNAMES += tarm926ej-s tiwmmxt txscale tarm920t thumb2 cortex-a8-be8
10287 +MULTILIB_DIRNAMES += softfp
10288 +
10289 +MULTILIB_EXCEPTIONS = *muclibc*/*tarm920t*
10290 +MULTILIB_EXCEPTIONS += *muclibc*/*cortex-a8-be8*
10291 +
10292 +MULTILIB_EXCEPTIONS += *tiwmmxt*/*mfloat-abi=softfp*
10293 +MULTILIB_EXCEPTIONS += *txscale*/*mfloat-abi=softfp*
10294 +MULTILIB_EXCEPTIONS += *tarm920t*/*mfloat-abi=softfp*
10295 +MULTILIB_EXCEPTIONS += *thumb2*/*mfloat-abi=softfp*
10296 +
10297 +MULTILIB_MATCHES = tiwmmxt=tiwmmxt2
10298 +
10299 +MULTILIB_ALIASES = tcortex-a8-be8=tcortex-a8-be8/mfloat-abi?softfp
10300 +MULTILIB_OSDIRNAMES =
10301 +
10302 +# These files must be built for each multilib.
10303 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
10304 +
10305 diff -Nur a/gcc/config/arm/uclinux-eabi.h b/gcc/config/arm/uclinux-eabi.h
10306 --- a/gcc/config/arm/uclinux-eabi.h 2009-02-20 16:20:38.000000000 +0100
10307 +++ b/gcc/config/arm/uclinux-eabi.h 2010-01-25 09:50:28.995687913 +0100
10308 @@ -50,6 +50,10 @@
10309 #undef ARM_DEFAULT_ABI
10310 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
10311
10312 +#undef LINK_GCC_C_SEQUENCE_SPEC
10313 +#define LINK_GCC_C_SEQUENCE_SPEC \
10314 + "--start-group %G %L --end-group"
10315 +
10316 /* Clear the instruction cache from `beg' to `end'. This makes an
10317 inline system call to SYS_cacheflush. */
10318 #undef CLEAR_INSN_CACHE
10319 diff -Nur a/gcc/config/arm/unwind-arm.c b/gcc/config/arm/unwind-arm.c
10320 --- a/gcc/config/arm/unwind-arm.c 2009-04-10 01:23:07.000000000 +0200
10321 +++ b/gcc/config/arm/unwind-arm.c 2010-01-25 09:50:28.995687913 +0100
10322 @@ -1000,7 +1000,6 @@
10323 while (code != _URC_END_OF_STACK
10324 && code != _URC_FAILURE);
10325
10326 - finish:
10327 restore_non_core_regs (&saved_vrs);
10328 return code;
10329 }
10330 @@ -1168,6 +1167,9 @@
10331 {
10332 matched = (void *)(ucbp + 1);
10333 rtti = _Unwind_decode_target2 ((_uw) &data[i + 1]);
10334 + /* There is no way to encode an exception
10335 + specification for 'class X * &', so
10336 + always pass false for is_reference. */
10337 if (__cxa_type_match (ucbp, (type_info *) rtti, 0,
10338 &matched))
10339 break;
10340 @@ -1197,8 +1199,6 @@
10341 ucbp->barrier_cache.bitpattern[4] = (_uw) &data[1];
10342
10343 if (data[0] & uint32_highbit)
10344 - phase2_call_unexpected_after_unwind = 1;
10345 - else
10346 {
10347 data += rtti_count + 1;
10348 /* Setup for entry to the handler. */
10349 @@ -1208,6 +1208,8 @@
10350 _Unwind_SetGR (context, 0, (_uw) ucbp);
10351 return _URC_INSTALL_CONTEXT;
10352 }
10353 + else
10354 + phase2_call_unexpected_after_unwind = 1;
10355 }
10356 if (data[0] & uint32_highbit)
10357 data++;
10358 diff -Nur a/gcc/config/arm/unwind-arm.h b/gcc/config/arm/unwind-arm.h
10359 --- a/gcc/config/arm/unwind-arm.h 2009-04-10 01:23:07.000000000 +0200
10360 +++ b/gcc/config/arm/unwind-arm.h 2010-01-25 09:50:28.995687913 +0100
10361 @@ -229,9 +229,10 @@
10362 return 0;
10363
10364 #if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__)
10365 - /* Pc-relative indirect. */
10366 + /* Pc-relative indirect. Propagate the bottom 2 bits, which can
10367 + contain referenceness information in gnu unwinding tables. */
10368 tmp += ptr;
10369 - tmp = *(_Unwind_Word *) tmp;
10370 + tmp = *(_Unwind_Word *) (tmp & ~(_Unwind_Word)3) | (tmp & 3);
10371 #elif defined(__symbian__) || defined(__uClinux__)
10372 /* Absolute pointer. Nothing more to do. */
10373 #else
10374 diff -Nur a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md
10375 --- a/gcc/config/arm/vec-common.md 2007-08-22 22:32:18.000000000 +0200
10376 +++ b/gcc/config/arm/vec-common.md 2010-01-25 09:50:28.995687913 +0100
10377 @@ -38,6 +38,11 @@
10378 "TARGET_NEON
10379 || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
10380 {
10381 + if (can_create_pseudo_p ())
10382 + {
10383 + if (GET_CODE (operands[0]) != REG)
10384 + operands[1] = force_reg (<MODE>mode, operands[1]);
10385 + }
10386 })
10387
10388 ;; Vector arithmetic. Expanders are blank, then unnamed insns implement
10389 diff -Nur a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
10390 --- a/gcc/config/arm/vfp.md 2008-09-01 15:40:49.000000000 +0200
10391 +++ b/gcc/config/arm/vfp.md 2010-01-25 09:50:28.995687913 +0100
10392 @@ -51,7 +51,7 @@
10393 ;; problems because small constants get converted into adds.
10394 (define_insn "*arm_movsi_vfp"
10395 [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m ,*t,r,*t,*t, *Uv")
10396 - (match_operand:SI 1 "general_operand" "rk, I,K,N,mi,rk,r,*t,*t,*Uvi,*t"))]
10397 + (match_operand:SI 1 "general_operand" "rk, I,K,j,mi,rk,r,*t,*t,*Uvi,*t"))]
10398 "TARGET_ARM && TARGET_VFP && TARGET_HARD_FLOAT
10399 && ( s_register_operand (operands[0], SImode)
10400 || s_register_operand (operands[1], SImode))"
10401 @@ -82,13 +82,17 @@
10402 "
10403 [(set_attr "predicable" "yes")
10404 (set_attr "type" "*,*,*,*,load1,store1,r_2_f,f_2_r,fcpys,f_loads,f_stores")
10405 + (set_attr "neon_type" "*,*,*,*,*,*,neon_mcr,neon_mrc,neon_vmov,*,*")
10406 + (set_attr "insn" "mov,mov,mvn,mov,*,*,*,*,*,*,*")
10407 (set_attr "pool_range" "*,*,*,*,4096,*,*,*,*,1020,*")
10408 (set_attr "neg_pool_range" "*,*,*,*,4084,*,*,*,*,1008,*")]
10409 )
10410
10411 +;; See thumb2.md:thumb2_movsi_insn for an explanation of the split
10412 +;; high/low register alternatives for loads and stores here.
10413 (define_insn "*thumb2_movsi_vfp"
10414 - [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m,*t,r, *t,*t, *Uv")
10415 - (match_operand:SI 1 "general_operand" "rk, I,K,N,mi,rk,r,*t,*t,*Uvi,*t"))]
10416 + [(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,l,*hk,m,*m,*t,r, *t,*t, *Uv")
10417 + (match_operand:SI 1 "general_operand" "rk, I,K,j,mi,*mi,l,*hk,r,*t,*t,*Uvi,*t"))]
10418 "TARGET_THUMB2 && TARGET_VFP && TARGET_HARD_FLOAT
10419 && ( s_register_operand (operands[0], SImode)
10420 || s_register_operand (operands[1], SImode))"
10421 @@ -102,25 +106,29 @@
10422 case 3:
10423 return \"movw%?\\t%0, %1\";
10424 case 4:
10425 - return \"ldr%?\\t%0, %1\";
10426 case 5:
10427 - return \"str%?\\t%1, %0\";
10428 + return \"ldr%?\\t%0, %1\";
10429 case 6:
10430 - return \"fmsr%?\\t%0, %1\\t%@ int\";
10431 case 7:
10432 - return \"fmrs%?\\t%0, %1\\t%@ int\";
10433 + return \"str%?\\t%1, %0\";
10434 case 8:
10435 + return \"fmsr%?\\t%0, %1\\t%@ int\";
10436 + case 9:
10437 + return \"fmrs%?\\t%0, %1\\t%@ int\";
10438 + case 10:
10439 return \"fcpys%?\\t%0, %1\\t%@ int\";
10440 - case 9: case 10:
10441 + case 11: case 12:
10442 return output_move_vfp (operands);
10443 default:
10444 gcc_unreachable ();
10445 }
10446 "
10447 [(set_attr "predicable" "yes")
10448 - (set_attr "type" "*,*,*,*,load1,store1,r_2_f,f_2_r,fcpys,f_load,f_store")
10449 - (set_attr "pool_range" "*,*,*,*,4096,*,*,*,*,1020,*")
10450 - (set_attr "neg_pool_range" "*,*,*,*, 0,*,*,*,*,1008,*")]
10451 + (set_attr "type" "*,*,*,*,load1,load1,store1,store1,r_2_f,f_2_r,fcpys,f_load,f_store")
10452 + (set_attr "neon_type" "*,*,*,*,*,*,*,*,neon_mcr,neon_mrc,neon_vmov,*,*")
10453 + (set_attr "insn" "mov,mov,mvn,mov,*,*,*,*,*,*,*,*,*")
10454 + (set_attr "pool_range" "*,*,*,*,1020,4096,*,*,*,*,*,1020,*")
10455 + (set_attr "neg_pool_range" "*,*,*,*, 0, 0,*,*,*,*,*,1008,*")]
10456 )
10457
10458
10459 @@ -145,7 +153,10 @@
10460 case 4:
10461 return \"fmrrd%?\\t%Q0, %R0, %P1\\t%@ int\";
10462 case 5:
10463 - return \"fcpyd%?\\t%P0, %P1\\t%@ int\";
10464 + if (TARGET_VFP_SINGLE)
10465 + return \"fcpys%?\\t%0, %1\\t%@ int\;fcpys%?\\t%p0, %p1\\t%@ int\";
10466 + else
10467 + return \"fcpyd%?\\t%P0, %P1\\t%@ int\";
10468 case 6: case 7:
10469 return output_move_vfp (operands);
10470 default:
10471 @@ -153,7 +164,14 @@
10472 }
10473 "
10474 [(set_attr "type" "*,load2,store2,r_2_f,f_2_r,ffarithd,f_loadd,f_stored")
10475 - (set_attr "length" "8,8,8,4,4,4,4,4")
10476 + (set_attr "neon_type" "*,*,*,neon_mcr_2_mcrr,neon_mrrc,neon_vmov,*,*")
10477 + (set (attr "length") (cond [(eq_attr "alternative" "0,1,2") (const_int 8)
10478 + (eq_attr "alternative" "5")
10479 + (if_then_else
10480 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10481 + (const_int 8)
10482 + (const_int 4))]
10483 + (const_int 4)))
10484 (set_attr "pool_range" "*,1020,*,*,*,*,1020,*")
10485 (set_attr "neg_pool_range" "*,1008,*,*,*,*,1008,*")]
10486 )
10487 @@ -172,7 +190,10 @@
10488 case 4:
10489 return \"fmrrd%?\\t%Q0, %R0, %P1\\t%@ int\";
10490 case 5:
10491 - return \"fcpyd%?\\t%P0, %P1\\t%@ int\";
10492 + if (TARGET_VFP_SINGLE)
10493 + return \"fcpys%?\\t%0, %1\\t%@ int\;fcpys%?\\t%p0, %p1\\t%@ int\";
10494 + else
10495 + return \"fcpyd%?\\t%P0, %P1\\t%@ int\";
10496 case 6: case 7:
10497 return output_move_vfp (operands);
10498 default:
10499 @@ -180,11 +201,123 @@
10500 }
10501 "
10502 [(set_attr "type" "*,load2,store2,r_2_f,f_2_r,ffarithd,f_load,f_store")
10503 - (set_attr "length" "8,8,8,4,4,4,4,4")
10504 + (set_attr "neon_type" "*,*,*,neon_mcr_2_mcrr,neon_mrrc,neon_vmov,*,*")
10505 + (set (attr "length") (cond [(eq_attr "alternative" "0,1,2") (const_int 8)
10506 + (eq_attr "alternative" "5")
10507 + (if_then_else
10508 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10509 + (const_int 8)
10510 + (const_int 4))]
10511 + (const_int 4)))
10512 (set_attr "pool_range" "*,4096,*,*,*,*,1020,*")
10513 (set_attr "neg_pool_range" "*, 0,*,*,*,*,1008,*")]
10514 )
10515
10516 +;; HFmode moves
10517 +(define_insn "*movhf_vfp_neon"
10518 + [(set (match_operand:HF 0 "nonimmediate_operand" "= t,Um,r,m,t,r,t,r,r")
10519 + (match_operand:HF 1 "general_operand" " Um, t,m,r,t,r,r,t,F"))]
10520 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_NEON_FP16
10521 + && ( s_register_operand (operands[0], HFmode)
10522 + || s_register_operand (operands[1], HFmode))"
10523 + "*
10524 + switch (which_alternative)
10525 + {
10526 + case 0: /* S register from memory */
10527 + return \"vld1.16\\t{%z0}, %A1\";
10528 + case 1: /* memory from S register */
10529 + return \"vst1.16\\t{%z1}, %A0\";
10530 + case 2: /* ARM register from memory */
10531 + return \"ldrh\\t%0, %1\\t%@ __fp16\";
10532 + case 3: /* memory from ARM register */
10533 + return \"strh\\t%1, %0\\t%@ __fp16\";
10534 + case 4: /* S register from S register */
10535 + return \"fcpys\\t%0, %1\";
10536 + case 5: /* ARM register from ARM register */
10537 + return \"mov\\t%0, %1\\t%@ __fp16\";
10538 + case 6: /* S register from ARM register */
10539 + return \"fmsr\\t%0, %1\";
10540 + case 7: /* ARM register from S register */
10541 + return \"fmrs\\t%0, %1\";
10542 + case 8: /* ARM register from constant */
10543 + {
10544 + REAL_VALUE_TYPE r;
10545 + long bits;
10546 + rtx ops[4];
10547 +
10548 + REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
10549 + bits = real_to_target (NULL, &r, HFmode);
10550 + ops[0] = operands[0];
10551 + ops[1] = GEN_INT (bits);
10552 + ops[2] = GEN_INT (bits & 0xff00);
10553 + ops[3] = GEN_INT (bits & 0x00ff);
10554 +
10555 + if (arm_arch_thumb2)
10556 + output_asm_insn (\"movw\\t%0, %1\", ops);
10557 + else
10558 + output_asm_insn (\"mov\\t%0, %2\;orr\\t%0, %0, %3\", ops);
10559 + return \"\";
10560 + }
10561 + default:
10562 + gcc_unreachable ();
10563 + }
10564 + "
10565 + [(set_attr "conds" "unconditional")
10566 + (set_attr "type" "*,*,load1,store1,fcpys,*,r_2_f,f_2_r,*")
10567 + (set_attr "neon_type" "neon_vld1_1_2_regs,neon_vst1_1_2_regs_vst2_2_regs,*,*,*,*,*,*,*")
10568 + (set_attr "length" "4,4,4,4,4,4,4,4,8")]
10569 +)
10570 +
10571 +;; FP16 without element load/store instructions.
10572 +(define_insn "*movhf_vfp"
10573 + [(set (match_operand:HF 0 "nonimmediate_operand" "=r,m,t,r,t,r,r")
10574 + (match_operand:HF 1 "general_operand" " m,r,t,r,r,t,F"))]
10575 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_FP16 && !TARGET_NEON_FP16
10576 + && ( s_register_operand (operands[0], HFmode)
10577 + || s_register_operand (operands[1], HFmode))"
10578 + "*
10579 + switch (which_alternative)
10580 + {
10581 + case 0: /* ARM register from memory */
10582 + return \"ldrh\\t%0, %1\\t%@ __fp16\";
10583 + case 1: /* memory from ARM register */
10584 + return \"strh\\t%1, %0\\t%@ __fp16\";
10585 + case 2: /* S register from S register */
10586 + return \"fcpys\\t%0, %1\";
10587 + case 3: /* ARM register from ARM register */
10588 + return \"mov\\t%0, %1\\t%@ __fp16\";
10589 + case 4: /* S register from ARM register */
10590 + return \"fmsr\\t%0, %1\";
10591 + case 5: /* ARM register from S register */
10592 + return \"fmrs\\t%0, %1\";
10593 + case 6: /* ARM register from constant */
10594 + {
10595 + REAL_VALUE_TYPE r;
10596 + long bits;
10597 + rtx ops[4];
10598 +
10599 + REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
10600 + bits = real_to_target (NULL, &r, HFmode);
10601 + ops[0] = operands[0];
10602 + ops[1] = GEN_INT (bits);
10603 + ops[2] = GEN_INT (bits & 0xff00);
10604 + ops[3] = GEN_INT (bits & 0x00ff);
10605 +
10606 + if (arm_arch_thumb2)
10607 + output_asm_insn (\"movw\\t%0, %1\", ops);
10608 + else
10609 + output_asm_insn (\"mov\\t%0, %2\;orr\\t%0, %0, %3\", ops);
10610 + return \"\";
10611 + }
10612 + default:
10613 + gcc_unreachable ();
10614 + }
10615 + "
10616 + [(set_attr "conds" "unconditional")
10617 + (set_attr "type" "load1,store1,fcpys,*,r_2_f,f_2_r,*")
10618 + (set_attr "length" "4,4,4,4,4,4,8")]
10619 +)
10620 +
10621
10622 ;; SFmode moves
10623 ;; Disparage the w<->r cases because reloading an invalid address is
10624 @@ -222,6 +355,8 @@
10625 [(set_attr "predicable" "yes")
10626 (set_attr "type"
10627 "r_2_f,f_2_r,fconsts,f_loads,f_stores,load1,store1,fcpys,*")
10628 + (set_attr "neon_type" "neon_mcr,neon_mrc,*,*,*,*,*,neon_vmov,*")
10629 + (set_attr "insn" "*,*,*,*,*,*,*,*,mov")
10630 (set_attr "pool_range" "*,*,*,1020,*,4096,*,*,*")
10631 (set_attr "neg_pool_range" "*,*,*,1008,*,4080,*,*,*")]
10632 )
10633 @@ -258,6 +393,8 @@
10634 [(set_attr "predicable" "yes")
10635 (set_attr "type"
10636 "r_2_f,f_2_r,fconsts,f_load,f_store,load1,store1,fcpys,*")
10637 + (set_attr "neon_type" "neon_mcr,neon_mrc,*,*,*,*,*,neon_vmov,*")
10638 + (set_attr "insn" "*,*,*,*,*,*,*,*,mov")
10639 (set_attr "pool_range" "*,*,*,1020,*,4092,*,*,*")
10640 (set_attr "neg_pool_range" "*,*,*,1008,*,0,*,*,*")]
10641 )
10642 @@ -267,7 +404,7 @@
10643
10644 (define_insn "*movdf_vfp"
10645 [(set (match_operand:DF 0 "nonimmediate_soft_df_operand" "=w,?r,w ,r, m,w ,Uv,w,r")
10646 - (match_operand:DF 1 "soft_df_operand" " ?r,w,Dv,mF,r,UvF,w, w,r"))]
10647 + (match_operand:DF 1 "soft_df_operand" " ?r,w,Dy,mF,r,UvF,w, w,r"))]
10648 "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP
10649 && ( register_operand (operands[0], DFmode)
10650 || register_operand (operands[1], DFmode))"
10651 @@ -280,13 +417,17 @@
10652 case 1:
10653 return \"fmrrd%?\\t%Q0, %R0, %P1\";
10654 case 2:
10655 + gcc_assert (TARGET_VFP_DOUBLE);
10656 return \"fconstd%?\\t%P0, #%G1\";
10657 case 3: case 4:
10658 return output_move_double (operands);
10659 case 5: case 6:
10660 return output_move_vfp (operands);
10661 case 7:
10662 - return \"fcpyd%?\\t%P0, %P1\";
10663 + if (TARGET_VFP_SINGLE)
10664 + return \"fcpys%?\\t%0, %1\;fcpys%?\\t%p0, %p1\";
10665 + else
10666 + return \"fcpyd%?\\t%P0, %P1\";
10667 case 8:
10668 return \"#\";
10669 default:
10670 @@ -296,14 +437,21 @@
10671 "
10672 [(set_attr "type"
10673 "r_2_f,f_2_r,fconstd,f_loadd,f_stored,load2,store2,ffarithd,*")
10674 - (set_attr "length" "4,4,4,8,8,4,4,4,8")
10675 + (set_attr "neon_type" "neon_mcr_2_mcrr,neon_mrrc,*,*,*,*,*,neon_vmov,*")
10676 + (set (attr "length") (cond [(eq_attr "alternative" "3,4,8") (const_int 8)
10677 + (eq_attr "alternative" "7")
10678 + (if_then_else
10679 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10680 + (const_int 8)
10681 + (const_int 4))]
10682 + (const_int 4)))
10683 (set_attr "pool_range" "*,*,*,1020,*,1020,*,*,*")
10684 (set_attr "neg_pool_range" "*,*,*,1008,*,1008,*,*,*")]
10685 )
10686
10687 (define_insn "*thumb2_movdf_vfp"
10688 [(set (match_operand:DF 0 "nonimmediate_soft_df_operand" "=w,?r,w ,r, m,w ,Uv,w,r")
10689 - (match_operand:DF 1 "soft_df_operand" " ?r,w,Dv,mF,r,UvF,w, w,r"))]
10690 + (match_operand:DF 1 "soft_df_operand" " ?r,w,Dy,mF,r,UvF,w, w,r"))]
10691 "TARGET_THUMB2 && TARGET_HARD_FLOAT && TARGET_VFP"
10692 "*
10693 {
10694 @@ -314,13 +462,17 @@
10695 case 1:
10696 return \"fmrrd%?\\t%Q0, %R0, %P1\";
10697 case 2:
10698 + gcc_assert (TARGET_VFP_DOUBLE);
10699 return \"fconstd%?\\t%P0, #%G1\";
10700 case 3: case 4: case 8:
10701 return output_move_double (operands);
10702 case 5: case 6:
10703 return output_move_vfp (operands);
10704 case 7:
10705 - return \"fcpyd%?\\t%P0, %P1\";
10706 + if (TARGET_VFP_SINGLE)
10707 + return \"fcpys%?\\t%0, %1\;fcpys%?\\t%p0, %p1\";
10708 + else
10709 + return \"fcpyd%?\\t%P0, %P1\";
10710 default:
10711 abort ();
10712 }
10713 @@ -328,7 +480,14 @@
10714 "
10715 [(set_attr "type"
10716 "r_2_f,f_2_r,fconstd,load2,store2,f_load,f_store,ffarithd,*")
10717 - (set_attr "length" "4,4,4,8,8,4,4,4,8")
10718 + (set_attr "neon_type" "neon_mcr_2_mcrr,neon_mrrc,*,*,*,*,*,neon_vmov,*")
10719 + (set (attr "length") (cond [(eq_attr "alternative" "3,4,8") (const_int 8)
10720 + (eq_attr "alternative" "7")
10721 + (if_then_else
10722 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10723 + (const_int 8)
10724 + (const_int 4))]
10725 + (const_int 4)))
10726 (set_attr "pool_range" "*,*,*,4096,*,1020,*,*,*")
10727 (set_attr "neg_pool_range" "*,*,*,0,*,1008,*,*,*")]
10728 )
10729 @@ -356,7 +515,8 @@
10730 fmrs%D3\\t%0, %2\;fmrs%d3\\t%0, %1"
10731 [(set_attr "conds" "use")
10732 (set_attr "length" "4,4,8,4,4,8,4,4,8")
10733 - (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
10734 + (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
10735 + (set_attr "neon_type" "neon_vmov,neon_vmov,neon_vmov,neon_mcr,neon_mcr,neon_mcr,neon_mrc,neon_mrc,neon_mrc")]
10736 )
10737
10738 (define_insn "*thumb2_movsfcc_vfp"
10739 @@ -379,7 +539,8 @@
10740 ite\\t%D3\;fmrs%D3\\t%0, %2\;fmrs%d3\\t%0, %1"
10741 [(set_attr "conds" "use")
10742 (set_attr "length" "6,6,10,6,6,10,6,6,10")
10743 - (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
10744 + (set_attr "type" "fcpys,fcpys,fcpys,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
10745 + (set_attr "neon_type" "neon_vmov,neon_vmov,neon_vmov,neon_mcr,neon_mcr,neon_mcr,neon_mrc,neon_mrc,neon_mrc")]
10746 )
10747
10748 (define_insn "*movdfcc_vfp"
10749 @@ -389,7 +550,7 @@
10750 [(match_operand 4 "cc_register" "") (const_int 0)])
10751 (match_operand:DF 1 "s_register_operand" "0,w,w,0,?r,?r,0,w,w")
10752 (match_operand:DF 2 "s_register_operand" "w,0,w,?r,0,?r,w,0,w")))]
10753 - "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP"
10754 + "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10755 "@
10756 fcpyd%D3\\t%P0, %P2
10757 fcpyd%d3\\t%P0, %P1
10758 @@ -402,7 +563,8 @@
10759 fmrrd%D3\\t%Q0, %R0, %P2\;fmrrd%d3\\t%Q0, %R0, %P1"
10760 [(set_attr "conds" "use")
10761 (set_attr "length" "4,4,8,4,4,8,4,4,8")
10762 - (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
10763 + (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
10764 + (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")]
10765 )
10766
10767 (define_insn "*thumb2_movdfcc_vfp"
10768 @@ -412,7 +574,7 @@
10769 [(match_operand 4 "cc_register" "") (const_int 0)])
10770 (match_operand:DF 1 "s_register_operand" "0,w,w,0,?r,?r,0,w,w")
10771 (match_operand:DF 2 "s_register_operand" "w,0,w,?r,0,?r,w,0,w")))]
10772 - "TARGET_THUMB2 && TARGET_HARD_FLOAT && TARGET_VFP"
10773 + "TARGET_THUMB2 && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10774 "@
10775 it\\t%D3\;fcpyd%D3\\t%P0, %P2
10776 it\\t%d3\;fcpyd%d3\\t%P0, %P1
10777 @@ -425,7 +587,8 @@
10778 ite\\t%D3\;fmrrd%D3\\t%Q0, %R0, %P2\;fmrrd%d3\\t%Q0, %R0, %P1"
10779 [(set_attr "conds" "use")
10780 (set_attr "length" "6,6,10,6,6,10,6,6,10")
10781 - (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")]
10782 + (set_attr "type" "ffarithd,ffarithd,ffarithd,r_2_f,r_2_f,r_2_f,f_2_r,f_2_r,f_2_r")
10783 + (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")]
10784 )
10785
10786
10787 @@ -443,7 +606,7 @@
10788 (define_insn "*absdf2_vfp"
10789 [(set (match_operand:DF 0 "s_register_operand" "=w")
10790 (abs:DF (match_operand:DF 1 "s_register_operand" "w")))]
10791 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10792 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10793 "fabsd%?\\t%P0, %P1"
10794 [(set_attr "predicable" "yes")
10795 (set_attr "type" "ffarithd")]
10796 @@ -463,12 +626,12 @@
10797 (define_insn_and_split "*negdf2_vfp"
10798 [(set (match_operand:DF 0 "s_register_operand" "=w,?r,?r")
10799 (neg:DF (match_operand:DF 1 "s_register_operand" "w,0,r")))]
10800 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10801 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10802 "@
10803 fnegd%?\\t%P0, %P1
10804 #
10805 #"
10806 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP && reload_completed
10807 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE && reload_completed
10808 && arm_general_register_operand (operands[0], DFmode)"
10809 [(set (match_dup 0) (match_dup 1))]
10810 "
10811 @@ -523,7 +686,7 @@
10812 [(set (match_operand:DF 0 "s_register_operand" "=w")
10813 (plus:DF (match_operand:DF 1 "s_register_operand" "w")
10814 (match_operand:DF 2 "s_register_operand" "w")))]
10815 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10816 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10817 "faddd%?\\t%P0, %P1, %P2"
10818 [(set_attr "predicable" "yes")
10819 (set_attr "type" "faddd")]
10820 @@ -544,7 +707,7 @@
10821 [(set (match_operand:DF 0 "s_register_operand" "=w")
10822 (minus:DF (match_operand:DF 1 "s_register_operand" "w")
10823 (match_operand:DF 2 "s_register_operand" "w")))]
10824 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10825 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10826 "fsubd%?\\t%P0, %P1, %P2"
10827 [(set_attr "predicable" "yes")
10828 (set_attr "type" "faddd")]
10829 @@ -567,7 +730,7 @@
10830 [(set (match_operand:DF 0 "s_register_operand" "+w")
10831 (div:DF (match_operand:DF 1 "s_register_operand" "w")
10832 (match_operand:DF 2 "s_register_operand" "w")))]
10833 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10834 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10835 "fdivd%?\\t%P0, %P1, %P2"
10836 [(set_attr "predicable" "yes")
10837 (set_attr "type" "fdivd")]
10838 @@ -590,7 +753,7 @@
10839 [(set (match_operand:DF 0 "s_register_operand" "+w")
10840 (mult:DF (match_operand:DF 1 "s_register_operand" "w")
10841 (match_operand:DF 2 "s_register_operand" "w")))]
10842 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10843 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10844 "fmuld%?\\t%P0, %P1, %P2"
10845 [(set_attr "predicable" "yes")
10846 (set_attr "type" "fmuld")]
10847 @@ -611,7 +774,7 @@
10848 [(set (match_operand:DF 0 "s_register_operand" "+w")
10849 (mult:DF (neg:DF (match_operand:DF 1 "s_register_operand" "w"))
10850 (match_operand:DF 2 "s_register_operand" "w")))]
10851 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10852 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10853 "fnmuld%?\\t%P0, %P1, %P2"
10854 [(set_attr "predicable" "yes")
10855 (set_attr "type" "fmuld")]
10856 @@ -626,7 +789,8 @@
10857 (plus:SF (mult:SF (match_operand:SF 2 "s_register_operand" "t")
10858 (match_operand:SF 3 "s_register_operand" "t"))
10859 (match_operand:SF 1 "s_register_operand" "0")))]
10860 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10861 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP
10862 + && (!arm_tune_marvell_f || optimize_size)"
10863 "fmacs%?\\t%0, %2, %3"
10864 [(set_attr "predicable" "yes")
10865 (set_attr "type" "fmacs")]
10866 @@ -637,7 +801,8 @@
10867 (plus:DF (mult:DF (match_operand:DF 2 "s_register_operand" "w")
10868 (match_operand:DF 3 "s_register_operand" "w"))
10869 (match_operand:DF 1 "s_register_operand" "0")))]
10870 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10871 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE
10872 + && (!arm_tune_marvell_f || optimize_size)"
10873 "fmacd%?\\t%P0, %P2, %P3"
10874 [(set_attr "predicable" "yes")
10875 (set_attr "type" "fmacd")]
10876 @@ -649,7 +814,8 @@
10877 (minus:SF (mult:SF (match_operand:SF 2 "s_register_operand" "t")
10878 (match_operand:SF 3 "s_register_operand" "t"))
10879 (match_operand:SF 1 "s_register_operand" "0")))]
10880 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10881 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP
10882 + && (!arm_tune_marvell_f || optimize_size)"
10883 "fmscs%?\\t%0, %2, %3"
10884 [(set_attr "predicable" "yes")
10885 (set_attr "type" "fmacs")]
10886 @@ -660,7 +826,8 @@
10887 (minus:DF (mult:DF (match_operand:DF 2 "s_register_operand" "w")
10888 (match_operand:DF 3 "s_register_operand" "w"))
10889 (match_operand:DF 1 "s_register_operand" "0")))]
10890 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10891 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE
10892 + && (!arm_tune_marvell_f || optimize_size)"
10893 "fmscd%?\\t%P0, %P2, %P3"
10894 [(set_attr "predicable" "yes")
10895 (set_attr "type" "fmacd")]
10896 @@ -672,7 +839,8 @@
10897 (minus:SF (match_operand:SF 1 "s_register_operand" "0")
10898 (mult:SF (match_operand:SF 2 "s_register_operand" "t")
10899 (match_operand:SF 3 "s_register_operand" "t"))))]
10900 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10901 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP
10902 + && (!arm_tune_marvell_f || optimize_size)"
10903 "fnmacs%?\\t%0, %2, %3"
10904 [(set_attr "predicable" "yes")
10905 (set_attr "type" "fmacs")]
10906 @@ -683,7 +851,8 @@
10907 (minus:DF (match_operand:DF 1 "s_register_operand" "0")
10908 (mult:DF (match_operand:DF 2 "s_register_operand" "w")
10909 (match_operand:DF 3 "s_register_operand" "w"))))]
10910 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10911 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE
10912 + && (!arm_tune_marvell_f || optimize_size)"
10913 "fnmacd%?\\t%P0, %P2, %P3"
10914 [(set_attr "predicable" "yes")
10915 (set_attr "type" "fmacd")]
10916 @@ -697,7 +866,8 @@
10917 (neg:SF (match_operand:SF 2 "s_register_operand" "t"))
10918 (match_operand:SF 3 "s_register_operand" "t"))
10919 (match_operand:SF 1 "s_register_operand" "0")))]
10920 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10921 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP
10922 + && (!arm_tune_marvell_f || optimize_size)"
10923 "fnmscs%?\\t%0, %2, %3"
10924 [(set_attr "predicable" "yes")
10925 (set_attr "type" "fmacs")]
10926 @@ -709,7 +879,8 @@
10927 (neg:DF (match_operand:DF 2 "s_register_operand" "w"))
10928 (match_operand:DF 3 "s_register_operand" "w"))
10929 (match_operand:DF 1 "s_register_operand" "0")))]
10930 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10931 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE
10932 + && (!arm_tune_marvell_f || optimize_size)"
10933 "fnmscd%?\\t%P0, %P2, %P3"
10934 [(set_attr "predicable" "yes")
10935 (set_attr "type" "fmacd")]
10936 @@ -721,7 +892,7 @@
10937 (define_insn "*extendsfdf2_vfp"
10938 [(set (match_operand:DF 0 "s_register_operand" "=w")
10939 (float_extend:DF (match_operand:SF 1 "s_register_operand" "t")))]
10940 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10941 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10942 "fcvtds%?\\t%P0, %1"
10943 [(set_attr "predicable" "yes")
10944 (set_attr "type" "f_cvt")]
10945 @@ -730,12 +901,30 @@
10946 (define_insn "*truncdfsf2_vfp"
10947 [(set (match_operand:SF 0 "s_register_operand" "=t")
10948 (float_truncate:SF (match_operand:DF 1 "s_register_operand" "w")))]
10949 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10950 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10951 "fcvtsd%?\\t%0, %P1"
10952 [(set_attr "predicable" "yes")
10953 (set_attr "type" "f_cvt")]
10954 )
10955
10956 +(define_insn "extendhfsf2"
10957 + [(set (match_operand:SF 0 "s_register_operand" "=t")
10958 + (float_extend:SF (match_operand:HF 1 "s_register_operand" "t")))]
10959 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_FP16"
10960 + "vcvtb%?.f32.f16\\t%0, %1"
10961 + [(set_attr "predicable" "yes")
10962 + (set_attr "type" "f_cvt")]
10963 +)
10964 +
10965 +(define_insn "truncsfhf2"
10966 + [(set (match_operand:HF 0 "s_register_operand" "=t")
10967 + (float_truncate:HF (match_operand:SF 1 "s_register_operand" "t")))]
10968 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_FP16"
10969 + "vcvtb%?.f16.f32\\t%0, %1"
10970 + [(set_attr "predicable" "yes")
10971 + (set_attr "type" "f_cvt")]
10972 +)
10973 +
10974 (define_insn "*truncsisf2_vfp"
10975 [(set (match_operand:SI 0 "s_register_operand" "=t")
10976 (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" "t"))))]
10977 @@ -748,7 +937,7 @@
10978 (define_insn "*truncsidf2_vfp"
10979 [(set (match_operand:SI 0 "s_register_operand" "=t")
10980 (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" "w"))))]
10981 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10982 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10983 "ftosizd%?\\t%0, %P1"
10984 [(set_attr "predicable" "yes")
10985 (set_attr "type" "f_cvt")]
10986 @@ -767,7 +956,7 @@
10987 (define_insn "fixuns_truncdfsi2"
10988 [(set (match_operand:SI 0 "s_register_operand" "=t")
10989 (unsigned_fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" "t"))))]
10990 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
10991 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
10992 "ftouizd%?\\t%0, %P1"
10993 [(set_attr "predicable" "yes")
10994 (set_attr "type" "f_cvt")]
10995 @@ -786,7 +975,7 @@
10996 (define_insn "*floatsidf2_vfp"
10997 [(set (match_operand:DF 0 "s_register_operand" "=w")
10998 (float:DF (match_operand:SI 1 "s_register_operand" "t")))]
10999 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11000 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11001 "fsitod%?\\t%P0, %1"
11002 [(set_attr "predicable" "yes")
11003 (set_attr "type" "f_cvt")]
11004 @@ -805,7 +994,7 @@
11005 (define_insn "floatunssidf2"
11006 [(set (match_operand:DF 0 "s_register_operand" "=w")
11007 (unsigned_float:DF (match_operand:SI 1 "s_register_operand" "t")))]
11008 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11009 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11010 "fuitod%?\\t%P0, %1"
11011 [(set_attr "predicable" "yes")
11012 (set_attr "type" "f_cvt")]
11013 @@ -826,7 +1015,7 @@
11014 (define_insn "*sqrtdf2_vfp"
11015 [(set (match_operand:DF 0 "s_register_operand" "=w")
11016 (sqrt:DF (match_operand:DF 1 "s_register_operand" "w")))]
11017 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11018 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11019 "fsqrtd%?\\t%P0, %P1"
11020 [(set_attr "predicable" "yes")
11021 (set_attr "type" "fdivd")]
11022 @@ -878,9 +1067,9 @@
11023 [(set (reg:CCFP CC_REGNUM)
11024 (compare:CCFP (match_operand:DF 0 "s_register_operand" "w")
11025 (match_operand:DF 1 "vfp_compare_operand" "wG")))]
11026 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11027 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11028 "#"
11029 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11030 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11031 [(set (reg:CCFP VFPCC_REGNUM)
11032 (compare:CCFP (match_dup 0)
11033 (match_dup 1)))
11034 @@ -893,9 +1082,9 @@
11035 [(set (reg:CCFPE CC_REGNUM)
11036 (compare:CCFPE (match_operand:DF 0 "s_register_operand" "w")
11037 (match_operand:DF 1 "vfp_compare_operand" "wG")))]
11038 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11039 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11040 "#"
11041 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11042 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11043 [(set (reg:CCFPE VFPCC_REGNUM)
11044 (compare:CCFPE (match_dup 0)
11045 (match_dup 1)))
11046 @@ -935,7 +1124,7 @@
11047 [(set (reg:CCFP VFPCC_REGNUM)
11048 (compare:CCFP (match_operand:DF 0 "s_register_operand" "w,w")
11049 (match_operand:DF 1 "vfp_compare_operand" "w,G")))]
11050 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11051 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11052 "@
11053 fcmpd%?\\t%P0, %P1
11054 fcmpzd%?\\t%P0"
11055 @@ -947,7 +1136,7 @@
11056 [(set (reg:CCFPE VFPCC_REGNUM)
11057 (compare:CCFPE (match_operand:DF 0 "s_register_operand" "w,w")
11058 (match_operand:DF 1 "vfp_compare_operand" "w,G")))]
11059 - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP"
11060 + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE"
11061 "@
11062 fcmped%?\\t%P0, %P1
11063 fcmpezd%?\\t%P0"
11064 diff -Nur a/gcc/config/arm/vxworks.h b/gcc/config/arm/vxworks.h
11065 --- a/gcc/config/arm/vxworks.h 2009-02-20 16:20:38.000000000 +0100
11066 +++ b/gcc/config/arm/vxworks.h 2010-01-25 09:50:28.995687913 +0100
11067 @@ -97,7 +97,7 @@
11068 /* There is no default multilib. */
11069 #undef MULTILIB_DEFAULTS
11070
11071 -#define FPUTYPE_DEFAULT FPUTYPE_VFP
11072 +#define FPUTYPE_DEFAULT "vfp"
11073
11074 #undef FUNCTION_PROFILER
11075 #define FUNCTION_PROFILER VXWORKS_FUNCTION_PROFILER
11076 diff -Nur a/gcc/config/arm/wrs-linux.h b/gcc/config/arm/wrs-linux.h
11077 --- a/gcc/config/arm/wrs-linux.h 1970-01-01 01:00:00.000000000 +0100
11078 +++ b/gcc/config/arm/wrs-linux.h 2010-01-25 09:50:28.995687913 +0100
11079 @@ -0,0 +1,76 @@
11080 +/* Wind River GNU/Linux Configuration.
11081 + Copyright (C) 2006, 2007, 2008
11082 + Free Software Foundation, Inc.
11083 +
11084 +This file is part of GCC.
11085 +
11086 +GCC is free software; you can redistribute it and/or modify
11087 +it under the terms of the GNU General Public License as published by
11088 +the Free Software Foundation; either version 3, or (at your option)
11089 +any later version.
11090 +
11091 +GCC is distributed in the hope that it will be useful,
11092 +but WITHOUT ANY WARRANTY; without even the implied warranty of
11093 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11094 +GNU General Public License for more details.
11095 +
11096 +You should have received a copy of the GNU General Public License
11097 +along with GCC; see the file COPYING3. If not see
11098 +<http://www.gnu.org/licenses/>. */
11099 +
11100 +/* Use the ARM926EJ-S by default. */
11101 +#undef SUBTARGET_CPU_DEFAULT
11102 +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm926ejs
11103 +
11104 +/* Add a -tiwmmxt option for convenience in generating multilibs.
11105 + This option generates big-endian IWMMXT code. */
11106 +#undef CC1_SPEC
11107 +#define CC1_SPEC " \
11108 + %{tarm926ej-s: -mcpu=arm926ej-s ; \
11109 + tiwmmxt: -mcpu=iwmmxt ; \
11110 + tiwmmxt2: -mcpu=iwmmxt ; \
11111 + txscale: -mcpu=xscale -mbig-endian ; \
11112 + tarm920t: -mcpu=arm920t ; \
11113 + tthumb2: %{!mcpu=*:%{!march=*:-march=armv6t2}} -mthumb ; \
11114 + tcortex-a8-be8: -mcpu=cortex-a8 -mbig-endian -mfloat-abi=softfp \
11115 + -mfpu=neon } \
11116 + %{txscale:%{mfloat-abi=softfp:%eXScale VFP multilib not provided}} \
11117 + %{tarm920t:%{mfloat-abi=softfp:%eARM920T VFP multilib not provided}} \
11118 + %{profile:-p}"
11119 +
11120 +/* Since the ARM926EJ-S is the default processor, we do not need to
11121 + provide an explicit multilib for that processor. */
11122 +#undef MULTILIB_DEFAULTS
11123 +#define MULTILIB_DEFAULTS \
11124 + { "tarm926ej-s" }
11125 +
11126 +/* The GLIBC headers are in /usr/include, relative to the sysroot; the
11127 + uClibc headers are in /uclibc/usr/include. */
11128 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
11129 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
11130 + "%{muclibc:/uclibc}"
11131 +
11132 +/* Translate -tiwmmxt appropriately for the assembler. The -meabi=5
11133 + option is the relevant part of SUBTARGET_EXTRA_ASM_SPEC in bpabi.h. */
11134 +#undef SUBTARGET_EXTRA_ASM_SPEC
11135 +#define SUBTARGET_EXTRA_ASM_SPEC \
11136 + "%{tiwmmxt2:-mcpu=iwmmxt2} %{tiwmmxt:-mcpu=iwmmxt} %{txscale:-mcpu=xscale -EB} %{tcortex-a8-be8:-mcpu=cortex-a8 -EB} -meabi=5"
11137 +
11138 +/* Translate -tiwmmxt for the linker. */
11139 +#undef SUBTARGET_EXTRA_LINK_SPEC
11140 +#define SUBTARGET_EXTRA_LINK_SPEC \
11141 + " %{tiwmmxt:-m armelf_linux_eabi ; \
11142 + txscale:-m armelfb_linux_eabi ; \
11143 + tcortex-a8-be8:-m armelfb_linux_eabi %{!r:--be8} ; \
11144 + : -m armelf_linux_eabi}"
11145 +
11146 +/* The various C libraries each have their own subdirectory. */
11147 +#undef SYSROOT_SUFFIX_SPEC
11148 +#define SYSROOT_SUFFIX_SPEC \
11149 + "%{muclibc:/uclibc}%{tiwmmxt:/tiwmmxt ; \
11150 + tiwmmxt2:/tiwmmxt ; \
11151 + txscale:/txscale ; \
11152 + tarm920t:/tarm920t ; \
11153 + tthumb2:/thumb2 ; \
11154 + tcortex-a8-be8:/cortex-a8-be8}%{!tthumb2:%{!tcortex-a8-be8:%{mfloat-abi=softfp:/softfp}}}"
11155 +
11156 diff -Nur a/gcc/config/i386/atom.md b/gcc/config/i386/atom.md
11157 --- a/gcc/config/i386/atom.md 1970-01-01 01:00:00.000000000 +0100
11158 +++ b/gcc/config/i386/atom.md 2010-01-25 09:50:28.995687913 +0100
11159 @@ -0,0 +1,795 @@
11160 +;; Atom Scheduling
11161 +;; Copyright (C) 2009 Free Software Foundation, Inc.
11162 +;;
11163 +;; This file is part of GCC.
11164 +;;
11165 +;; GCC is free software; you can redistribute it and/or modify
11166 +;; it under the terms of the GNU General Public License as published by
11167 +;; the Free Software Foundation; either version 3, or (at your option)
11168 +;; any later version.
11169 +;;
11170 +;; GCC is distributed in the hope that it will be useful,
11171 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11172 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11173 +;; GNU General Public License for more details.
11174 +;;
11175 +;; You should have received a copy of the GNU General Public License
11176 +;; along with GCC; see the file COPYING3. If not see
11177 +;; <http://www.gnu.org/licenses/>.
11178 +;;
11179 +;; Atom is an in-order core with two integer pipelines.
11180 +
11181 +
11182 +(define_attr "atom_unit" "sishuf,simul,jeu,complex,other"
11183 + (const_string "other"))
11184 +
11185 +(define_attr "atom_sse_attr" "rcp,movdup,lfence,fence,prefetch,sqrt,mxcsr,other"
11186 + (const_string "other"))
11187 +
11188 +(define_automaton "atom")
11189 +
11190 +;; Atom has two ports: port 0 and port 1 connecting to all execution units
11191 +(define_cpu_unit "atom-port-0,atom-port-1" "atom")
11192 +
11193 +;; EU: Execution Unit
11194 +;; Atom EUs are connected by port 0 or port 1.
11195 +
11196 +(define_cpu_unit "atom-eu-0, atom-eu-1,
11197 + atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4"
11198 + "atom")
11199 +
11200 +;; Some EUs have duplicated copied and can be accessed via either
11201 +;; port 0 or port 1
11202 +;; (define_reservation "atom-port-either" "(atom-port-0 | atom-port-1)")
11203 +
11204 +;;; Some instructions is dual-pipe execution, need both ports
11205 +;;; Complex multi-op macro-instructoins need both ports and all EUs
11206 +(define_reservation "atom-port-dual" "(atom-port-0 + atom-port-1)")
11207 +(define_reservation "atom-all-eu" "(atom-eu-0 + atom-eu-1 +
11208 + atom-imul-1 + atom-imul-2 + atom-imul-3 +
11209 + atom-imul-4)")
11210 +
11211 +;;; Most of simple instructions have 1 cycle latency. Some of them
11212 +;;; issue in port 0, some in port 0 and some in either port.
11213 +(define_reservation "atom-simple-0" "(atom-port-0 + atom-eu-0)")
11214 +(define_reservation "atom-simple-1" "(atom-port-1 + atom-eu-1)")
11215 +(define_reservation "atom-simple-either" "(atom-simple-0 | atom-simple-1)")
11216 +
11217 +;;; Some insn issues in port 0 with 3 cycle latency and 1 cycle tput
11218 +(define_reservation "atom-eu-0-3-1" "(atom-port-0 + atom-eu-0, nothing*2)")
11219 +
11220 +;;; fmul insn can have 4 or 5 cycles latency
11221 +(define_reservation "atom-fmul-5c" "(atom-port-0 + atom-eu-0), nothing*4")
11222 +(define_reservation "atom-fmul-4c" "(atom-port-0 + atom-eu-0), nothing*3")
11223 +
11224 +;;; fadd can has 5 cycles latency depends on instruction forms
11225 +(define_reservation "atom-fadd-5c" "(atom-port-1 + atom-eu-1), nothing*5")
11226 +
11227 +;;; imul insn has 5 cycles latency
11228 +(define_reservation "atom-imul-32"
11229 + "atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4,
11230 + atom-port-0")
11231 +;;; imul instruction excludes other non-FP instructions.
11232 +(exclusion_set "atom-eu-0, atom-eu-1"
11233 + "atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4")
11234 +
11235 +;;; dual-execution instructions can have 1,2,4,5 cycles latency depends on
11236 +;;; instruction forms
11237 +(define_reservation "atom-dual-1c" "(atom-port-dual + atom-eu-0 + atom-eu-1)")
11238 +(define_reservation "atom-dual-2c"
11239 + "(atom-port-dual + atom-eu-0 + atom-eu-1, nothing)")
11240 +(define_reservation "atom-dual-5c"
11241 + "(atom-port-dual + atom-eu-0 + atom-eu-1, nothing*4)")
11242 +
11243 +;;; Complex macro-instruction has variants of latency, and uses both ports.
11244 +(define_reservation "atom-complex" "(atom-port-dual + atom-all-eu)")
11245 +
11246 +(define_insn_reservation "atom_other" 9
11247 + (and (eq_attr "cpu" "atom")
11248 + (and (eq_attr "type" "other")
11249 + (eq_attr "atom_unit" "!jeu")))
11250 + "atom-complex, atom-all-eu*8")
11251 +
11252 +;; return has type "other" with atom_unit "jeu"
11253 +(define_insn_reservation "atom_other_2" 1
11254 + (and (eq_attr "cpu" "atom")
11255 + (and (eq_attr "type" "other")
11256 + (eq_attr "atom_unit" "jeu")))
11257 + "atom-dual-1c")
11258 +
11259 +(define_insn_reservation "atom_multi" 9
11260 + (and (eq_attr "cpu" "atom")
11261 + (eq_attr "type" "multi"))
11262 + "atom-complex, atom-all-eu*8")
11263 +
11264 +;; Normal alu insns without carry
11265 +(define_insn_reservation "atom_alu" 1
11266 + (and (eq_attr "cpu" "atom")
11267 + (and (eq_attr "type" "alu")
11268 + (and (eq_attr "memory" "none")
11269 + (eq_attr "use_carry" "0"))))
11270 + "atom-simple-either")
11271 +
11272 +;; Normal alu insns without carry
11273 +(define_insn_reservation "atom_alu_mem" 1
11274 + (and (eq_attr "cpu" "atom")
11275 + (and (eq_attr "type" "alu")
11276 + (and (eq_attr "memory" "!none")
11277 + (eq_attr "use_carry" "0"))))
11278 + "atom-simple-either")
11279 +
11280 +;; Alu insn consuming CF, such as add/sbb
11281 +(define_insn_reservation "atom_alu_carry" 1
11282 + (and (eq_attr "cpu" "atom")
11283 + (and (eq_attr "type" "alu")
11284 + (and (eq_attr "memory" "none")
11285 + (eq_attr "use_carry" "1"))))
11286 + "atom-simple-either")
11287 +
11288 +;; Alu insn consuming CF, such as add/sbb
11289 +(define_insn_reservation "atom_alu_carry_mem" 1
11290 + (and (eq_attr "cpu" "atom")
11291 + (and (eq_attr "type" "alu")
11292 + (and (eq_attr "memory" "!none")
11293 + (eq_attr "use_carry" "1"))))
11294 + "atom-simple-either")
11295 +
11296 +(define_insn_reservation "atom_alu1" 1
11297 + (and (eq_attr "cpu" "atom")
11298 + (and (eq_attr "type" "alu1")
11299 + (eq_attr "memory" "none")))
11300 + "atom-simple-either")
11301 +
11302 +(define_insn_reservation "atom_alu1_mem" 1
11303 + (and (eq_attr "cpu" "atom")
11304 + (and (eq_attr "type" "alu1")
11305 + (eq_attr "memory" "!none")))
11306 + "atom-simple-either")
11307 +
11308 +(define_insn_reservation "atom_negnot" 1
11309 + (and (eq_attr "cpu" "atom")
11310 + (and (eq_attr "type" "negnot")
11311 + (eq_attr "memory" "none")))
11312 + "atom-simple-either")
11313 +
11314 +(define_insn_reservation "atom_negnot_mem" 1
11315 + (and (eq_attr "cpu" "atom")
11316 + (and (eq_attr "type" "negnot")
11317 + (eq_attr "memory" "!none")))
11318 + "atom-simple-either")
11319 +
11320 +(define_insn_reservation "atom_imov" 1
11321 + (and (eq_attr "cpu" "atom")
11322 + (and (eq_attr "type" "imov")
11323 + (eq_attr "memory" "none")))
11324 + "atom-simple-either")
11325 +
11326 +(define_insn_reservation "atom_imov_mem" 1
11327 + (and (eq_attr "cpu" "atom")
11328 + (and (eq_attr "type" "imov")
11329 + (eq_attr "memory" "!none")))
11330 + "atom-simple-either")
11331 +
11332 +;; 16<-16, 32<-32
11333 +(define_insn_reservation "atom_imovx" 1
11334 + (and (eq_attr "cpu" "atom")
11335 + (and (eq_attr "type" "imovx")
11336 + (and (eq_attr "memory" "none")
11337 + (ior (and (match_operand:HI 0 "register_operand")
11338 + (match_operand:HI 1 "general_operand"))
11339 + (and (match_operand:SI 0 "register_operand")
11340 + (match_operand:SI 1 "general_operand"))))))
11341 + "atom-simple-either")
11342 +
11343 +;; 16<-16, 32<-32, mem
11344 +(define_insn_reservation "atom_imovx_mem" 1
11345 + (and (eq_attr "cpu" "atom")
11346 + (and (eq_attr "type" "imovx")
11347 + (and (eq_attr "memory" "!none")
11348 + (ior (and (match_operand:HI 0 "register_operand")
11349 + (match_operand:HI 1 "general_operand"))
11350 + (and (match_operand:SI 0 "register_operand")
11351 + (match_operand:SI 1 "general_operand"))))))
11352 + "atom-simple-either")
11353 +
11354 +;; 32<-16, 32<-8, 64<-16, 64<-8, 64<-32, 8<-8
11355 +(define_insn_reservation "atom_imovx_2" 1
11356 + (and (eq_attr "cpu" "atom")
11357 + (and (eq_attr "type" "imovx")
11358 + (and (eq_attr "memory" "none")
11359 + (ior (match_operand:QI 0 "register_operand")
11360 + (ior (and (match_operand:SI 0 "register_operand")
11361 + (not (match_operand:SI 1 "general_operand")))
11362 + (match_operand:DI 0 "register_operand"))))))
11363 + "atom-simple-0")
11364 +
11365 +;; 32<-16, 32<-8, 64<-16, 64<-8, 64<-32, 8<-8, mem
11366 +(define_insn_reservation "atom_imovx_2_mem" 1
11367 + (and (eq_attr "cpu" "atom")
11368 + (and (eq_attr "type" "imovx")
11369 + (and (eq_attr "memory" "!none")
11370 + (ior (match_operand:QI 0 "register_operand")
11371 + (ior (and (match_operand:SI 0 "register_operand")
11372 + (not (match_operand:SI 1 "general_operand")))
11373 + (match_operand:DI 0 "register_operand"))))))
11374 + "atom-simple-0")
11375 +
11376 +;; 16<-8
11377 +(define_insn_reservation "atom_imovx_3" 3
11378 + (and (eq_attr "cpu" "atom")
11379 + (and (eq_attr "type" "imovx")
11380 + (and (match_operand:HI 0 "register_operand")
11381 + (match_operand:QI 1 "general_operand"))))
11382 + "atom-complex, atom-all-eu*2")
11383 +
11384 +(define_insn_reservation "atom_lea" 1
11385 + (and (eq_attr "cpu" "atom")
11386 + (and (eq_attr "type" "lea")
11387 + (eq_attr "mode" "!HI")))
11388 + "atom-simple-either")
11389 +
11390 +;; lea 16bit address is complex insn
11391 +(define_insn_reservation "atom_lea_2" 2
11392 + (and (eq_attr "cpu" "atom")
11393 + (and (eq_attr "type" "lea")
11394 + (eq_attr "mode" "HI")))
11395 + "atom-complex, atom-all-eu")
11396 +
11397 +(define_insn_reservation "atom_incdec" 1
11398 + (and (eq_attr "cpu" "atom")
11399 + (and (eq_attr "type" "incdec")
11400 + (eq_attr "memory" "none")))
11401 + "atom-simple-either")
11402 +
11403 +(define_insn_reservation "atom_incdec_mem" 1
11404 + (and (eq_attr "cpu" "atom")
11405 + (and (eq_attr "type" "incdec")
11406 + (eq_attr "memory" "!none")))
11407 + "atom-simple-either")
11408 +
11409 +;; simple shift instruction use SHIFT eu, none memory
11410 +(define_insn_reservation "atom_ishift" 1
11411 + (and (eq_attr "cpu" "atom")
11412 + (and (eq_attr "type" "ishift")
11413 + (and (eq_attr "memory" "none") (eq_attr "prefix_0f" "0"))))
11414 + "atom-simple-0")
11415 +
11416 +;; simple shift instruction use SHIFT eu, memory
11417 +(define_insn_reservation "atom_ishift_mem" 1
11418 + (and (eq_attr "cpu" "atom")
11419 + (and (eq_attr "type" "ishift")
11420 + (and (eq_attr "memory" "!none") (eq_attr "prefix_0f" "0"))))
11421 + "atom-simple-0")
11422 +
11423 +;; DF shift (prefixed with 0f) is complex insn with latency of 7 cycles
11424 +(define_insn_reservation "atom_ishift_3" 7
11425 + (and (eq_attr "cpu" "atom")
11426 + (and (eq_attr "type" "ishift")
11427 + (eq_attr "prefix_0f" "1")))
11428 + "atom-complex, atom-all-eu*6")
11429 +
11430 +(define_insn_reservation "atom_ishift1" 1
11431 + (and (eq_attr "cpu" "atom")
11432 + (and (eq_attr "type" "ishift1")
11433 + (eq_attr "memory" "none")))
11434 + "atom-simple-0")
11435 +
11436 +(define_insn_reservation "atom_ishift1_mem" 1
11437 + (and (eq_attr "cpu" "atom")
11438 + (and (eq_attr "type" "ishift1")
11439 + (eq_attr "memory" "!none")))
11440 + "atom-simple-0")
11441 +
11442 +(define_insn_reservation "atom_rotate" 1
11443 + (and (eq_attr "cpu" "atom")
11444 + (and (eq_attr "type" "rotate")
11445 + (eq_attr "memory" "none")))
11446 + "atom-simple-0")
11447 +
11448 +(define_insn_reservation "atom_rotate_mem" 1
11449 + (and (eq_attr "cpu" "atom")
11450 + (and (eq_attr "type" "rotate")
11451 + (eq_attr "memory" "!none")))
11452 + "atom-simple-0")
11453 +
11454 +(define_insn_reservation "atom_rotate1" 1
11455 + (and (eq_attr "cpu" "atom")
11456 + (and (eq_attr "type" "rotate1")
11457 + (eq_attr "memory" "none")))
11458 + "atom-simple-0")
11459 +
11460 +(define_insn_reservation "atom_rotate1_mem" 1
11461 + (and (eq_attr "cpu" "atom")
11462 + (and (eq_attr "type" "rotate1")
11463 + (eq_attr "memory" "!none")))
11464 + "atom-simple-0")
11465 +
11466 +(define_insn_reservation "atom_imul" 5
11467 + (and (eq_attr "cpu" "atom")
11468 + (and (eq_attr "type" "imul")
11469 + (and (eq_attr "memory" "none") (eq_attr "mode" "SI"))))
11470 + "atom-imul-32")
11471 +
11472 +(define_insn_reservation "atom_imul_mem" 5
11473 + (and (eq_attr "cpu" "atom")
11474 + (and (eq_attr "type" "imul")
11475 + (and (eq_attr "memory" "!none") (eq_attr "mode" "SI"))))
11476 + "atom-imul-32")
11477 +
11478 +;; latency set to 10 as common 64x64 imul
11479 +(define_insn_reservation "atom_imul_3" 10
11480 + (and (eq_attr "cpu" "atom")
11481 + (and (eq_attr "type" "imul")
11482 + (eq_attr "mode" "!SI")))
11483 + "atom-complex, atom-all-eu*9")
11484 +
11485 +(define_insn_reservation "atom_idiv" 65
11486 + (and (eq_attr "cpu" "atom")
11487 + (eq_attr "type" "idiv"))
11488 + "atom-complex, atom-all-eu*32, nothing*32")
11489 +
11490 +(define_insn_reservation "atom_icmp" 1
11491 + (and (eq_attr "cpu" "atom")
11492 + (and (eq_attr "type" "icmp")
11493 + (eq_attr "memory" "none")))
11494 + "atom-simple-either")
11495 +
11496 +(define_insn_reservation "atom_icmp_mem" 1
11497 + (and (eq_attr "cpu" "atom")
11498 + (and (eq_attr "type" "icmp")
11499 + (eq_attr "memory" "!none")))
11500 + "atom-simple-either")
11501 +
11502 +(define_insn_reservation "atom_test" 1
11503 + (and (eq_attr "cpu" "atom")
11504 + (and (eq_attr "type" "test")
11505 + (eq_attr "memory" "none")))
11506 + "atom-simple-either")
11507 +
11508 +(define_insn_reservation "atom_test_mem" 1
11509 + (and (eq_attr "cpu" "atom")
11510 + (and (eq_attr "type" "test")
11511 + (eq_attr "memory" "!none")))
11512 + "atom-simple-either")
11513 +
11514 +(define_insn_reservation "atom_ibr" 1
11515 + (and (eq_attr "cpu" "atom")
11516 + (and (eq_attr "type" "ibr")
11517 + (eq_attr "memory" "!load")))
11518 + "atom-simple-1")
11519 +
11520 +;; complex if jump target is from address
11521 +(define_insn_reservation "atom_ibr_2" 2
11522 + (and (eq_attr "cpu" "atom")
11523 + (and (eq_attr "type" "ibr")
11524 + (eq_attr "memory" "load")))
11525 + "atom-complex, atom-all-eu")
11526 +
11527 +(define_insn_reservation "atom_setcc" 1
11528 + (and (eq_attr "cpu" "atom")
11529 + (and (eq_attr "type" "setcc")
11530 + (eq_attr "memory" "!store")))
11531 + "atom-simple-either")
11532 +
11533 +;; 2 cycles complex if target is in memory
11534 +(define_insn_reservation "atom_setcc_2" 2
11535 + (and (eq_attr "cpu" "atom")
11536 + (and (eq_attr "type" "setcc")
11537 + (eq_attr "memory" "store")))
11538 + "atom-complex, atom-all-eu")
11539 +
11540 +(define_insn_reservation "atom_icmov" 1
11541 + (and (eq_attr "cpu" "atom")
11542 + (and (eq_attr "type" "icmov")
11543 + (eq_attr "memory" "none")))
11544 + "atom-simple-either")
11545 +
11546 +(define_insn_reservation "atom_icmov_mem" 1
11547 + (and (eq_attr "cpu" "atom")
11548 + (and (eq_attr "type" "icmov")
11549 + (eq_attr "memory" "!none")))
11550 + "atom-simple-either")
11551 +
11552 +;; UCODE if segreg, ignored
11553 +(define_insn_reservation "atom_push" 2
11554 + (and (eq_attr "cpu" "atom")
11555 + (eq_attr "type" "push"))
11556 + "atom-dual-2c")
11557 +
11558 +;; pop r64 is 1 cycle. UCODE if segreg, ignored
11559 +(define_insn_reservation "atom_pop" 1
11560 + (and (eq_attr "cpu" "atom")
11561 + (and (eq_attr "type" "pop")
11562 + (eq_attr "mode" "DI")))
11563 + "atom-dual-1c")
11564 +
11565 +;; pop non-r64 is 2 cycles. UCODE if segreg, ignored
11566 +(define_insn_reservation "atom_pop_2" 2
11567 + (and (eq_attr "cpu" "atom")
11568 + (and (eq_attr "type" "pop")
11569 + (eq_attr "mode" "!DI")))
11570 + "atom-dual-2c")
11571 +
11572 +;; UCODE if segreg, ignored
11573 +(define_insn_reservation "atom_call" 1
11574 + (and (eq_attr "cpu" "atom")
11575 + (eq_attr "type" "call"))
11576 + "atom-dual-1c")
11577 +
11578 +(define_insn_reservation "atom_callv" 1
11579 + (and (eq_attr "cpu" "atom")
11580 + (eq_attr "type" "callv"))
11581 + "atom-dual-1c")
11582 +
11583 +(define_insn_reservation "atom_leave" 3
11584 + (and (eq_attr "cpu" "atom")
11585 + (eq_attr "type" "leave"))
11586 + "atom-complex, atom-all-eu*2")
11587 +
11588 +(define_insn_reservation "atom_str" 3
11589 + (and (eq_attr "cpu" "atom")
11590 + (eq_attr "type" "str"))
11591 + "atom-complex, atom-all-eu*2")
11592 +
11593 +(define_insn_reservation "atom_sselog" 1
11594 + (and (eq_attr "cpu" "atom")
11595 + (and (eq_attr "type" "sselog")
11596 + (eq_attr "memory" "none")))
11597 + "atom-simple-either")
11598 +
11599 +(define_insn_reservation "atom_sselog_mem" 1
11600 + (and (eq_attr "cpu" "atom")
11601 + (and (eq_attr "type" "sselog")
11602 + (eq_attr "memory" "!none")))
11603 + "atom-simple-either")
11604 +
11605 +(define_insn_reservation "atom_sselog1" 1
11606 + (and (eq_attr "cpu" "atom")
11607 + (and (eq_attr "type" "sselog1")
11608 + (eq_attr "memory" "none")))
11609 + "atom-simple-0")
11610 +
11611 +(define_insn_reservation "atom_sselog1_mem" 1
11612 + (and (eq_attr "cpu" "atom")
11613 + (and (eq_attr "type" "sselog1")
11614 + (eq_attr "memory" "!none")))
11615 + "atom-simple-0")
11616 +
11617 +;; not pmad, not psad
11618 +(define_insn_reservation "atom_sseiadd" 1
11619 + (and (eq_attr "cpu" "atom")
11620 + (and (eq_attr "type" "sseiadd")
11621 + (and (not (match_operand:V2DI 0 "register_operand"))
11622 + (and (eq_attr "atom_unit" "!simul")
11623 + (eq_attr "atom_unit" "!complex")))))
11624 + "atom-simple-either")
11625 +
11626 +;; pmad, psad and 64
11627 +(define_insn_reservation "atom_sseiadd_2" 4
11628 + (and (eq_attr "cpu" "atom")
11629 + (and (eq_attr "type" "sseiadd")
11630 + (and (not (match_operand:V2DI 0 "register_operand"))
11631 + (and (eq_attr "atom_unit" "simul" )
11632 + (eq_attr "mode" "DI")))))
11633 + "atom-fmul-4c")
11634 +
11635 +;; pmad, psad and 128
11636 +(define_insn_reservation "atom_sseiadd_3" 5
11637 + (and (eq_attr "cpu" "atom")
11638 + (and (eq_attr "type" "sseiadd")
11639 + (and (not (match_operand:V2DI 0 "register_operand"))
11640 + (and (eq_attr "atom_unit" "simul" )
11641 + (eq_attr "mode" "TI")))))
11642 + "atom-fmul-5c")
11643 +
11644 +;; if paddq(64 bit op), phadd/phsub
11645 +(define_insn_reservation "atom_sseiadd_4" 6
11646 + (and (eq_attr "cpu" "atom")
11647 + (and (eq_attr "type" "sseiadd")
11648 + (ior (match_operand:V2DI 0 "register_operand")
11649 + (eq_attr "atom_unit" "complex"))))
11650 + "atom-complex, atom-all-eu*5")
11651 +
11652 +;; if immediate op.
11653 +(define_insn_reservation "atom_sseishft" 1
11654 + (and (eq_attr "cpu" "atom")
11655 + (and (eq_attr "type" "sseishft")
11656 + (and (eq_attr "atom_unit" "!sishuf")
11657 + (match_operand 2 "immediate_operand"))))
11658 + "atom-simple-either")
11659 +
11660 +;; if palignr or psrldq
11661 +(define_insn_reservation "atom_sseishft_2" 1
11662 + (and (eq_attr "cpu" "atom")
11663 + (and (eq_attr "type" "sseishft")
11664 + (and (eq_attr "atom_unit" "sishuf")
11665 + (match_operand 2 "immediate_operand"))))
11666 + "atom-simple-0")
11667 +
11668 +;; if reg/mem op
11669 +(define_insn_reservation "atom_sseishft_3" 2
11670 + (and (eq_attr "cpu" "atom")
11671 + (and (eq_attr "type" "sseishft")
11672 + (not (match_operand 2 "immediate_operand"))))
11673 + "atom-complex, atom-all-eu")
11674 +
11675 +(define_insn_reservation "atom_sseimul" 1
11676 + (and (eq_attr "cpu" "atom")
11677 + (eq_attr "type" "sseimul"))
11678 + "atom-simple-0")
11679 +
11680 +;; rcpss or rsqrtss
11681 +(define_insn_reservation "atom_sse" 4
11682 + (and (eq_attr "cpu" "atom")
11683 + (and (eq_attr "type" "sse")
11684 + (and (eq_attr "atom_sse_attr" "rcp") (eq_attr "mode" "SF"))))
11685 + "atom-fmul-4c")
11686 +
11687 +;; movshdup, movsldup. Suggest to type sseishft
11688 +(define_insn_reservation "atom_sse_2" 1
11689 + (and (eq_attr "cpu" "atom")
11690 + (and (eq_attr "type" "sse")
11691 + (eq_attr "atom_sse_attr" "movdup")))
11692 + "atom-simple-0")
11693 +
11694 +;; lfence
11695 +(define_insn_reservation "atom_sse_3" 1
11696 + (and (eq_attr "cpu" "atom")
11697 + (and (eq_attr "type" "sse")
11698 + (eq_attr "atom_sse_attr" "lfence")))
11699 + "atom-simple-either")
11700 +
11701 +;; sfence,clflush,mfence, prefetch
11702 +(define_insn_reservation "atom_sse_4" 1
11703 + (and (eq_attr "cpu" "atom")
11704 + (and (eq_attr "type" "sse")
11705 + (ior (eq_attr "atom_sse_attr" "fence")
11706 + (eq_attr "atom_sse_attr" "prefetch"))))
11707 + "atom-simple-0")
11708 +
11709 +;; rcpps, rsqrtss, sqrt, ldmxcsr
11710 +(define_insn_reservation "atom_sse_5" 7
11711 + (and (eq_attr "cpu" "atom")
11712 + (and (eq_attr "type" "sse")
11713 + (ior (ior (eq_attr "atom_sse_attr" "sqrt")
11714 + (eq_attr "atom_sse_attr" "mxcsr"))
11715 + (and (eq_attr "atom_sse_attr" "rcp")
11716 + (eq_attr "mode" "V4SF")))))
11717 + "atom-complex, atom-all-eu*6")
11718 +
11719 +;; xmm->xmm
11720 +(define_insn_reservation "atom_ssemov" 1
11721 + (and (eq_attr "cpu" "atom")
11722 + (and (eq_attr "type" "ssemov")
11723 + (and (match_operand 0 "register_operand" "xy") (match_operand 1 "register_operand" "xy"))))
11724 + "atom-simple-either")
11725 +
11726 +;; reg->xmm
11727 +(define_insn_reservation "atom_ssemov_2" 1
11728 + (and (eq_attr "cpu" "atom")
11729 + (and (eq_attr "type" "ssemov")
11730 + (and (match_operand 0 "register_operand" "xy") (match_operand 1 "register_operand" "r"))))
11731 + "atom-simple-0")
11732 +
11733 +;; xmm->reg
11734 +(define_insn_reservation "atom_ssemov_3" 3
11735 + (and (eq_attr "cpu" "atom")
11736 + (and (eq_attr "type" "ssemov")
11737 + (and (match_operand 0 "register_operand" "r") (match_operand 1 "register_operand" "xy"))))
11738 + "atom-eu-0-3-1")
11739 +
11740 +;; mov mem
11741 +(define_insn_reservation "atom_ssemov_4" 1
11742 + (and (eq_attr "cpu" "atom")
11743 + (and (eq_attr "type" "ssemov")
11744 + (and (eq_attr "movu" "0") (eq_attr "memory" "!none"))))
11745 + "atom-simple-0")
11746 +
11747 +;; movu mem
11748 +(define_insn_reservation "atom_ssemov_5" 2
11749 + (and (eq_attr "cpu" "atom")
11750 + (and (eq_attr "type" "ssemov")
11751 + (ior (eq_attr "movu" "1") (eq_attr "memory" "!none"))))
11752 + "atom-complex, atom-all-eu")
11753 +
11754 +;; no memory simple
11755 +(define_insn_reservation "atom_sseadd" 5
11756 + (and (eq_attr "cpu" "atom")
11757 + (and (eq_attr "type" "sseadd")
11758 + (and (eq_attr "memory" "none")
11759 + (and (eq_attr "mode" "!V2DF")
11760 + (eq_attr "atom_unit" "!complex")))))
11761 + "atom-fadd-5c")
11762 +
11763 +;; memory simple
11764 +(define_insn_reservation "atom_sseadd_mem" 5
11765 + (and (eq_attr "cpu" "atom")
11766 + (and (eq_attr "type" "sseadd")
11767 + (and (eq_attr "memory" "!none")
11768 + (and (eq_attr "mode" "!V2DF")
11769 + (eq_attr "atom_unit" "!complex")))))
11770 + "atom-dual-5c")
11771 +
11772 +;; maxps, minps, *pd, hadd, hsub
11773 +(define_insn_reservation "atom_sseadd_3" 8
11774 + (and (eq_attr "cpu" "atom")
11775 + (and (eq_attr "type" "sseadd")
11776 + (ior (eq_attr "mode" "V2DF") (eq_attr "atom_unit" "complex"))))
11777 + "atom-complex, atom-all-eu*7")
11778 +
11779 +;; Except dppd/dpps
11780 +(define_insn_reservation "atom_ssemul" 5
11781 + (and (eq_attr "cpu" "atom")
11782 + (and (eq_attr "type" "ssemul")
11783 + (eq_attr "mode" "!SF")))
11784 + "atom-fmul-5c")
11785 +
11786 +;; Except dppd/dpps, 4 cycle if mulss
11787 +(define_insn_reservation "atom_ssemul_2" 4
11788 + (and (eq_attr "cpu" "atom")
11789 + (and (eq_attr "type" "ssemul")
11790 + (eq_attr "mode" "SF")))
11791 + "atom-fmul-4c")
11792 +
11793 +(define_insn_reservation "atom_ssecmp" 1
11794 + (and (eq_attr "cpu" "atom")
11795 + (eq_attr "type" "ssecmp"))
11796 + "atom-simple-either")
11797 +
11798 +(define_insn_reservation "atom_ssecomi" 10
11799 + (and (eq_attr "cpu" "atom")
11800 + (eq_attr "type" "ssecomi"))
11801 + "atom-complex, atom-all-eu*9")
11802 +
11803 +;; no memory and cvtpi2ps, cvtps2pi, cvttps2pi
11804 +(define_insn_reservation "atom_ssecvt" 5
11805 + (and (eq_attr "cpu" "atom")
11806 + (and (eq_attr "type" "ssecvt")
11807 + (ior (and (match_operand:V2SI 0 "register_operand")
11808 + (match_operand:V4SF 1 "register_operand"))
11809 + (and (match_operand:V4SF 0 "register_operand")
11810 + (match_operand:V2SI 1 "register_operand")))))
11811 + "atom-fadd-5c")
11812 +
11813 +;; memory and cvtpi2ps, cvtps2pi, cvttps2pi
11814 +(define_insn_reservation "atom_ssecvt_2" 5
11815 + (and (eq_attr "cpu" "atom")
11816 + (and (eq_attr "type" "ssecvt")
11817 + (ior (and (match_operand:V2SI 0 "register_operand")
11818 + (match_operand:V4SF 1 "memory_operand"))
11819 + (and (match_operand:V4SF 0 "register_operand")
11820 + (match_operand:V2SI 1 "memory_operand")))))
11821 + "atom-dual-5c")
11822 +
11823 +;; otherwise. 7 cycles average for cvtss2sd
11824 +(define_insn_reservation "atom_ssecvt_3" 7
11825 + (and (eq_attr "cpu" "atom")
11826 + (and (eq_attr "type" "ssecvt")
11827 + (not (ior (and (match_operand:V2SI 0 "register_operand")
11828 + (match_operand:V4SF 1 "nonimmediate_operand"))
11829 + (and (match_operand:V4SF 0 "register_operand")
11830 + (match_operand:V2SI 1 "nonimmediate_operand"))))))
11831 + "atom-complex, atom-all-eu*6")
11832 +
11833 +;; memory and cvtsi2sd
11834 +(define_insn_reservation "atom_sseicvt" 5
11835 + (and (eq_attr "cpu" "atom")
11836 + (and (eq_attr "type" "sseicvt")
11837 + (and (match_operand:V2DF 0 "register_operand")
11838 + (match_operand:SI 1 "memory_operand"))))
11839 + "atom-dual-5c")
11840 +
11841 +;; otherwise. 8 cycles average for cvtsd2si
11842 +(define_insn_reservation "atom_sseicvt_2" 8
11843 + (and (eq_attr "cpu" "atom")
11844 + (and (eq_attr "type" "sseicvt")
11845 + (not (and (match_operand:V2DF 0 "register_operand")
11846 + (match_operand:SI 1 "memory_operand")))))
11847 + "atom-complex, atom-all-eu*7")
11848 +
11849 +(define_insn_reservation "atom_ssediv" 62
11850 + (and (eq_attr "cpu" "atom")
11851 + (eq_attr "type" "ssediv"))
11852 + "atom-complex, atom-all-eu*12, nothing*49")
11853 +
11854 +;; simple for fmov
11855 +(define_insn_reservation "atom_fmov" 1
11856 + (and (eq_attr "cpu" "atom")
11857 + (and (eq_attr "type" "fmov")
11858 + (eq_attr "memory" "none")))
11859 + "atom-simple-either")
11860 +
11861 +;; simple for fmov
11862 +(define_insn_reservation "atom_fmov_mem" 1
11863 + (and (eq_attr "cpu" "atom")
11864 + (and (eq_attr "type" "fmov")
11865 + (eq_attr "memory" "!none")))
11866 + "atom-simple-either")
11867 +
11868 +;; Define bypass here
11869 +
11870 +;; There will be no stall from lea to non-mem EX insns
11871 +(define_bypass 0 "atom_lea"
11872 + "atom_alu_carry,
11873 + atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx,
11874 + atom_incdec, atom_setcc, atom_icmov, atom_pop")
11875 +
11876 +(define_bypass 0 "atom_lea"
11877 + "atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem,
11878 + atom_imovx_mem, atom_imovx_2_mem,
11879 + atom_imov_mem, atom_icmov_mem, atom_fmov_mem"
11880 + "!ix86_agi_dependent")
11881 +
11882 +;; There will be 3 cycles stall from EX insns to AGAN insns LEA
11883 +(define_bypass 4 "atom_alu_carry,
11884 + atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx,
11885 + atom_incdec,atom_ishift,atom_ishift1,atom_rotate,
11886 + atom_rotate1, atom_setcc, atom_icmov, atom_pop,
11887 + atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem,
11888 + atom_imovx_mem, atom_imovx_2_mem,
11889 + atom_imov_mem, atom_icmov_mem, atom_fmov_mem"
11890 + "atom_lea")
11891 +
11892 +;; There will be 3 cycles stall from EX insns to insns need addr calculation
11893 +(define_bypass 4 "atom_alu_carry,
11894 + atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx,
11895 + atom_incdec,atom_ishift,atom_ishift1,atom_rotate,
11896 + atom_rotate1, atom_setcc, atom_icmov, atom_pop,
11897 + atom_imovx_mem, atom_imovx_2_mem,
11898 + atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem,
11899 + atom_imov_mem, atom_icmov_mem, atom_fmov_mem"
11900 + "atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem,
11901 + atom_negnot_mem, atom_imov_mem, atom_incdec_mem,
11902 + atom_imovx_mem, atom_imovx_2_mem,
11903 + atom_imul_mem, atom_icmp_mem,
11904 + atom_test_mem, atom_icmov_mem, atom_sselog_mem,
11905 + atom_sselog1_mem, atom_fmov_mem, atom_sseadd_mem,
11906 + atom_ishift_mem, atom_ishift1_mem,
11907 + atom_rotate_mem, atom_rotate1_mem"
11908 + "ix86_agi_dependent")
11909 +
11910 +;; Stall from imul to lea is 8 cycles.
11911 +(define_bypass 9 "atom_imul, atom_imul_mem" "atom_lea")
11912 +
11913 +;; Stall from imul to memory address is 8 cycles.
11914 +(define_bypass 9 "atom_imul, atom_imul_mem"
11915 + "atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem,
11916 + atom_negnot_mem, atom_imov_mem, atom_incdec_mem,
11917 + atom_ishift_mem, atom_ishift1_mem, atom_rotate_mem,
11918 + atom_rotate1_mem, atom_imul_mem, atom_icmp_mem,
11919 + atom_test_mem, atom_icmov_mem, atom_sselog_mem,
11920 + atom_sselog1_mem, atom_fmov_mem, atom_sseadd_mem"
11921 + "ix86_agi_dependent")
11922 +
11923 +;; There will be 0 cycle stall from cmp/test to jcc
11924 +
11925 +;; There will be 1 cycle stall from flag producer to cmov and adc/sbb
11926 +(define_bypass 2 "atom_icmp, atom_test, atom_alu, atom_alu_carry,
11927 + atom_alu1, atom_negnot, atom_incdec, atom_ishift,
11928 + atom_ishift1, atom_rotate, atom_rotate1"
11929 + "atom_icmov, atom_alu_carry")
11930 +
11931 +;; lea to shift count stall is 2 cycles
11932 +(define_bypass 3 "atom_lea"
11933 + "atom_ishift, atom_ishift1, atom_rotate, atom_rotate1,
11934 + atom_ishift_mem, atom_ishift1_mem,
11935 + atom_rotate_mem, atom_rotate1_mem"
11936 + "ix86_dep_by_shift_count")
11937 +
11938 +;; lea to shift source stall is 1 cycle
11939 +(define_bypass 2 "atom_lea"
11940 + "atom_ishift, atom_ishift1, atom_rotate, atom_rotate1"
11941 + "!ix86_dep_by_shift_count")
11942 +
11943 +;; non-lea to shift count stall is 1 cycle
11944 +(define_bypass 2 "atom_alu_carry,
11945 + atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx,
11946 + atom_incdec,atom_ishift,atom_ishift1,atom_rotate,
11947 + atom_rotate1, atom_setcc, atom_icmov, atom_pop,
11948 + atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem,
11949 + atom_imovx_mem, atom_imovx_2_mem,
11950 + atom_imov_mem, atom_icmov_mem, atom_fmov_mem"
11951 + "atom_ishift, atom_ishift1, atom_rotate, atom_rotate1,
11952 + atom_ishift_mem, atom_ishift1_mem,
11953 + atom_rotate_mem, atom_rotate1_mem"
11954 + "ix86_dep_by_shift_count")
11955 diff -Nur a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
11956 --- a/gcc/config/i386/cpuid.h 2009-04-10 01:23:07.000000000 +0200
11957 +++ b/gcc/config/i386/cpuid.h 2010-01-25 09:50:28.995687913 +0100
11958 @@ -29,6 +29,7 @@
11959 #define bit_CMPXCHG16B (1 << 13)
11960 #define bit_SSE4_1 (1 << 19)
11961 #define bit_SSE4_2 (1 << 20)
11962 +#define bit_MOVBE (1 << 22)
11963 #define bit_POPCNT (1 << 23)
11964 #define bit_AES (1 << 25)
11965 #define bit_XSAVE (1 << 26)
11966 diff -Nur a/gcc/config/i386/cs-linux.h b/gcc/config/i386/cs-linux.h
11967 --- a/gcc/config/i386/cs-linux.h 1970-01-01 01:00:00.000000000 +0100
11968 +++ b/gcc/config/i386/cs-linux.h 2010-01-25 09:50:28.995687913 +0100
11969 @@ -0,0 +1,41 @@
11970 +/* Sourcery G++ IA32 GNU/Linux Configuration.
11971 + Copyright (C) 2007
11972 + Free Software Foundation, Inc.
11973 +
11974 +This file is part of GCC.
11975 +
11976 +GCC is free software; you can redistribute it and/or modify
11977 +it under the terms of the GNU General Public License as published by
11978 +the Free Software Foundation; either version 3, or (at your option)
11979 +any later version.
11980 +
11981 +GCC is distributed in the hope that it will be useful,
11982 +but WITHOUT ANY WARRANTY; without even the implied warranty of
11983 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11984 +GNU General Public License for more details.
11985 +
11986 +You should have received a copy of the GNU General Public License
11987 +along with GCC; see the file COPYING3. If not see
11988 +<http://www.gnu.org/licenses/>. */
11989 +
11990 +/* This configuration may be used either with the system glibc (in
11991 + system32 and system64 subdirectories) or with the included glibc
11992 + (in the sgxx-glibc subdirectory). */
11993 +
11994 +#undef SYSROOT_SUFFIX_SPEC
11995 +#define SYSROOT_SUFFIX_SPEC \
11996 + "%{msgxx-glibc:/sgxx-glibc ; \
11997 + m64:/system64 ; \
11998 + mrhel3:/system64 ; \
11999 + mrh73:/system32-old ; \
12000 + :/system32}"
12001 +
12002 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
12003 +#define SYSROOT_HEADERS_SUFFIX_SPEC SYSROOT_SUFFIX_SPEC
12004 +
12005 +/* See mips/wrs-linux.h for details on this use of
12006 + STARTFILE_PREFIX_SPEC. */
12007 +#undef STARTFILE_PREFIX_SPEC
12008 +#define STARTFILE_PREFIX_SPEC \
12009 + "%{m64: /usr/local/lib64/ /lib64/ /usr/lib64/} \
12010 + %{!m64: /usr/local/lib/ /lib/ /usr/lib/}"
12011 diff -Nur a/gcc/config/i386/cs-linux-lite.h b/gcc/config/i386/cs-linux-lite.h
12012 --- a/gcc/config/i386/cs-linux-lite.h 1970-01-01 01:00:00.000000000 +0100
12013 +++ b/gcc/config/i386/cs-linux-lite.h 2010-01-25 09:50:28.995687913 +0100
12014 @@ -0,0 +1,31 @@
12015 +/* Sourcery G++ Lite IA32 GNU/Linux Configuration.
12016 + Copyright (C) 2009
12017 + Free Software Foundation, Inc.
12018 +
12019 +This file is part of GCC.
12020 +
12021 +GCC is free software; you can redistribute it and/or modify
12022 +it under the terms of the GNU General Public License as published by
12023 +the Free Software Foundation; either version 3, or (at your option)
12024 +any later version.
12025 +
12026 +GCC is distributed in the hope that it will be useful,
12027 +but WITHOUT ANY WARRANTY; without even the implied warranty of
12028 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12029 +GNU General Public License for more details.
12030 +
12031 +You should have received a copy of the GNU General Public License
12032 +along with GCC; see the file COPYING3. If not see
12033 +<http://www.gnu.org/licenses/>. */
12034 +
12035 +#undef SYSROOT_SUFFIX_SPEC
12036 +#define SYSROOT_SUFFIX_SPEC \
12037 + "%{march=atom:%{!m64:/atom} ; \
12038 + march=core2:%{m64:/core2}}"
12039 +
12040 +/* See mips/wrs-linux.h for details on this use of
12041 + STARTFILE_PREFIX_SPEC. */
12042 +#undef STARTFILE_PREFIX_SPEC
12043 +#define STARTFILE_PREFIX_SPEC \
12044 + "%{m64: /usr/local/lib64/ /lib64/ /usr/lib64/} \
12045 + %{!m64: /usr/local/lib/ /lib/ /usr/lib/}"
12046 diff -Nur a/gcc/config/i386/cs-linux.opt b/gcc/config/i386/cs-linux.opt
12047 --- a/gcc/config/i386/cs-linux.opt 1970-01-01 01:00:00.000000000 +0100
12048 +++ b/gcc/config/i386/cs-linux.opt 2010-01-25 09:50:28.995687913 +0100
12049 @@ -0,0 +1,11 @@
12050 +; Additional options for Sourcery G++.
12051 +
12052 +mrh73
12053 +Target Undocumented
12054 +
12055 +mrhel3
12056 +Target Undocumented
12057 +
12058 +msgxx-glibc
12059 +Target
12060 +Use included version of GLIBC
12061 diff -Nur a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
12062 --- a/gcc/config/i386/cygming.h 2009-07-12 17:56:41.000000000 +0200
12063 +++ b/gcc/config/i386/cygming.h 2010-01-25 09:50:28.995687913 +0100
12064 @@ -34,7 +34,7 @@
12065 #endif
12066
12067 #undef TARGET_64BIT_MS_ABI
12068 -#define TARGET_64BIT_MS_ABI (!cfun ? DEFAULT_ABI == MS_ABI : TARGET_64BIT && cfun->machine->call_abi == MS_ABI)
12069 +#define TARGET_64BIT_MS_ABI (!cfun ? ix86_abi == MS_ABI : TARGET_64BIT && cfun->machine->call_abi == MS_ABI)
12070
12071 #undef DEFAULT_ABI
12072 #define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
12073 @@ -203,7 +203,7 @@
12074 #define CHECK_STACK_LIMIT 4000
12075
12076 #undef STACK_BOUNDARY
12077 -#define STACK_BOUNDARY (DEFAULT_ABI == MS_ABI ? 128 : BITS_PER_WORD)
12078 +#define STACK_BOUNDARY (ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
12079
12080 /* By default, target has a 80387, uses IEEE compatible arithmetic,
12081 returns float values in the 387 and needs stack probes.
12082 diff -Nur a/gcc/config/i386/cygming.opt b/gcc/config/i386/cygming.opt
12083 --- a/gcc/config/i386/cygming.opt 2007-08-02 12:49:31.000000000 +0200
12084 +++ b/gcc/config/i386/cygming.opt 2010-01-25 09:50:28.995687913 +0100
12085 @@ -45,3 +45,7 @@
12086 mwindows
12087 Target
12088 Create GUI application
12089 +
12090 +mpe-aligned-commons
12091 +Target Var(use_pe_aligned_common) Init(HAVE_GAS_ALIGNED_COMM)
12092 +Use the GNU extension to the PE format for aligned common data
12093 diff -Nur a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
12094 --- a/gcc/config/i386/driver-i386.c 2009-05-27 16:54:00.000000000 +0200
12095 +++ b/gcc/config/i386/driver-i386.c 2010-01-25 09:50:29.005686600 +0100
12096 @@ -378,7 +378,7 @@
12097 /* Extended features */
12098 unsigned int has_lahf_lm = 0, has_sse4a = 0;
12099 unsigned int has_longmode = 0, has_3dnowp = 0, has_3dnow = 0;
12100 - unsigned int has_sse4_1 = 0, has_sse4_2 = 0;
12101 + unsigned int has_movbe = 0, has_sse4_1 = 0, has_sse4_2 = 0;
12102 unsigned int has_popcnt = 0, has_aes = 0, has_avx = 0;
12103 unsigned int has_pclmul = 0;
12104
12105 @@ -398,9 +398,22 @@
12106
12107 __cpuid (1, eax, ebx, ecx, edx);
12108
12109 - /* We don't care for extended family. */
12110 model = (eax >> 4) & 0x0f;
12111 family = (eax >> 8) & 0x0f;
12112 + if (vendor == SIG_INTEL)
12113 + {
12114 + unsigned int extended_model, extended_family;
12115 +
12116 + extended_model = (eax >> 12) & 0xf0;
12117 + extended_family = (eax >> 20) & 0xff;
12118 + if (family == 0x0f)
12119 + {
12120 + family += extended_family;
12121 + model += extended_model;
12122 + }
12123 + else if (family == 0x06)
12124 + model += extended_model;
12125 + }
12126
12127 has_sse3 = ecx & bit_SSE3;
12128 has_ssse3 = ecx & bit_SSSE3;
12129 @@ -408,6 +421,7 @@
12130 has_sse4_2 = ecx & bit_SSE4_2;
12131 has_avx = ecx & bit_AVX;
12132 has_cmpxchg16b = ecx & bit_CMPXCHG16B;
12133 + has_movbe = ecx & bit_MOVBE;
12134 has_popcnt = ecx & bit_POPCNT;
12135 has_aes = ecx & bit_AES;
12136 has_pclmul = ecx & bit_PCLMUL;
12137 @@ -505,8 +519,8 @@
12138 break;
12139 case PROCESSOR_PENTIUMPRO:
12140 if (has_longmode)
12141 - /* It is Core 2 Duo. */
12142 - cpu = "core2";
12143 + /* It is Core 2 or Atom. */
12144 + cpu = (model == 28) ? "atom" : "core2";
12145 else if (arch)
12146 {
12147 if (has_sse3)
12148 @@ -597,6 +611,8 @@
12149 options = concat (options, "-mcx16 ", NULL);
12150 if (has_lahf_lm)
12151 options = concat (options, "-msahf ", NULL);
12152 + if (has_movbe)
12153 + options = concat (options, "-mmovbe ", NULL);
12154 if (has_aes)
12155 options = concat (options, "-maes ", NULL);
12156 if (has_pclmul)
12157 diff -Nur a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
12158 --- a/gcc/config/i386/i386.c 2009-07-21 09:22:51.000000000 +0200
12159 +++ b/gcc/config/i386/i386.c 2010-01-25 09:50:29.005686600 +0100
12160 @@ -1036,6 +1036,79 @@
12161 1, /* cond_not_taken_branch_cost. */
12162 };
12163
12164 +static const
12165 +struct processor_costs atom_cost = {
12166 + COSTS_N_INSNS (1), /* cost of an add instruction */
12167 + COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
12168 + COSTS_N_INSNS (1), /* variable shift costs */
12169 + COSTS_N_INSNS (1), /* constant shift costs */
12170 + {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
12171 + COSTS_N_INSNS (4), /* HI */
12172 + COSTS_N_INSNS (3), /* SI */
12173 + COSTS_N_INSNS (4), /* DI */
12174 + COSTS_N_INSNS (2)}, /* other */
12175 + 0, /* cost of multiply per each bit set */
12176 + {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
12177 + COSTS_N_INSNS (26), /* HI */
12178 + COSTS_N_INSNS (42), /* SI */
12179 + COSTS_N_INSNS (74), /* DI */
12180 + COSTS_N_INSNS (74)}, /* other */
12181 + COSTS_N_INSNS (1), /* cost of movsx */
12182 + COSTS_N_INSNS (1), /* cost of movzx */
12183 + 8, /* "large" insn */
12184 + 17, /* MOVE_RATIO */
12185 + 2, /* cost for loading QImode using movzbl */
12186 + {4, 4, 4}, /* cost of loading integer registers
12187 + in QImode, HImode and SImode.
12188 + Relative to reg-reg move (2). */
12189 + {4, 4, 4}, /* cost of storing integer registers */
12190 + 4, /* cost of reg,reg fld/fst */
12191 + {12, 12, 12}, /* cost of loading fp registers
12192 + in SFmode, DFmode and XFmode */
12193 + {6, 6, 8}, /* cost of storing fp registers
12194 + in SFmode, DFmode and XFmode */
12195 + 2, /* cost of moving MMX register */
12196 + {8, 8}, /* cost of loading MMX registers
12197 + in SImode and DImode */
12198 + {8, 8}, /* cost of storing MMX registers
12199 + in SImode and DImode */
12200 + 2, /* cost of moving SSE register */
12201 + {8, 8, 8}, /* cost of loading SSE registers
12202 + in SImode, DImode and TImode */
12203 + {8, 8, 8}, /* cost of storing SSE registers
12204 + in SImode, DImode and TImode */
12205 + 5, /* MMX or SSE register to integer */
12206 + 32, /* size of l1 cache. */
12207 + 256, /* size of l2 cache. */
12208 + 64, /* size of prefetch block */
12209 + 6, /* number of parallel prefetches */
12210 + 3, /* Branch cost */
12211 + COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */
12212 + COSTS_N_INSNS (8), /* cost of FMUL instruction. */
12213 + COSTS_N_INSNS (20), /* cost of FDIV instruction. */
12214 + COSTS_N_INSNS (8), /* cost of FABS instruction. */
12215 + COSTS_N_INSNS (8), /* cost of FCHS instruction. */
12216 + COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
12217 + {{libcall, {{11, loop}, {-1, rep_prefix_4_byte}}},
12218 + {libcall, {{32, loop}, {64, rep_prefix_4_byte},
12219 + {8192, rep_prefix_8_byte}, {-1, libcall}}}},
12220 + {{libcall, {{8, loop}, {15, unrolled_loop},
12221 + {2048, rep_prefix_4_byte}, {-1, libcall}}},
12222 + {libcall, {{24, loop}, {32, unrolled_loop},
12223 + {8192, rep_prefix_8_byte}, {-1, libcall}}}},
12224 + 1, /* scalar_stmt_cost. */
12225 + 1, /* scalar load_cost. */
12226 + 1, /* scalar_store_cost. */
12227 + 1, /* vec_stmt_cost. */
12228 + 1, /* vec_to_scalar_cost. */
12229 + 1, /* scalar_to_vec_cost. */
12230 + 1, /* vec_align_load_cost. */
12231 + 2, /* vec_unalign_load_cost. */
12232 + 1, /* vec_store_cost. */
12233 + 3, /* cond_taken_branch_cost. */
12234 + 1, /* cond_not_taken_branch_cost. */
12235 +};
12236 +
12237 /* Generic64 should produce code tuned for Nocona and K8. */
12238 static const
12239 struct processor_costs generic64_cost = {
12240 @@ -1194,6 +1267,7 @@
12241 #define m_PENT4 (1<<PROCESSOR_PENTIUM4)
12242 #define m_NOCONA (1<<PROCESSOR_NOCONA)
12243 #define m_CORE2 (1<<PROCESSOR_CORE2)
12244 +#define m_ATOM (1<<PROCESSOR_ATOM)
12245
12246 #define m_GEODE (1<<PROCESSOR_GEODE)
12247 #define m_K6 (1<<PROCESSOR_K6)
12248 @@ -1231,10 +1305,11 @@
12249 m_486 | m_PENT,
12250
12251 /* X86_TUNE_UNROLL_STRLEN */
12252 - m_486 | m_PENT | m_PPRO | m_AMD_MULTIPLE | m_K6 | m_CORE2 | m_GENERIC,
12253 + m_486 | m_PENT | m_ATOM | m_PPRO | m_AMD_MULTIPLE | m_K6
12254 + | m_CORE2 | m_GENERIC,
12255
12256 /* X86_TUNE_DEEP_BRANCH_PREDICTION */
12257 - m_PPRO | m_K6_GEODE | m_AMD_MULTIPLE | m_PENT4 | m_GENERIC,
12258 + m_ATOM | m_PPRO | m_K6_GEODE | m_AMD_MULTIPLE | m_PENT4 | m_GENERIC,
12259
12260 /* X86_TUNE_BRANCH_PREDICTION_HINTS: Branch hints were put in P4 based
12261 on simulation result. But after P4 was made, no performance benefit
12262 @@ -1246,12 +1321,12 @@
12263 ~m_386,
12264
12265 /* X86_TUNE_USE_SAHF */
12266 - m_PPRO | m_K6_GEODE | m_K8 | m_AMDFAM10 | m_PENT4
12267 + m_ATOM | m_PPRO | m_K6_GEODE | m_K8 | m_AMDFAM10 | m_PENT4
12268 | m_NOCONA | m_CORE2 | m_GENERIC,
12269
12270 /* X86_TUNE_MOVX: Enable to zero extend integer registers to avoid
12271 partial dependencies. */
12272 - m_AMD_MULTIPLE | m_PPRO | m_PENT4 | m_NOCONA
12273 + m_AMD_MULTIPLE | m_ATOM | m_PPRO | m_PENT4 | m_NOCONA
12274 | m_CORE2 | m_GENERIC | m_GEODE /* m_386 | m_K6 */,
12275
12276 /* X86_TUNE_PARTIAL_REG_STALL: We probably ought to watch for partial
12277 @@ -1271,13 +1346,13 @@
12278 m_386 | m_486 | m_K6_GEODE,
12279
12280 /* X86_TUNE_USE_SIMODE_FIOP */
12281 - ~(m_PPRO | m_AMD_MULTIPLE | m_PENT | m_CORE2 | m_GENERIC),
12282 + ~(m_PPRO | m_AMD_MULTIPLE | m_PENT | m_ATOM | m_CORE2 | m_GENERIC),
12283
12284 /* X86_TUNE_USE_MOV0 */
12285 m_K6,
12286
12287 /* X86_TUNE_USE_CLTD */
12288 - ~(m_PENT | m_K6 | m_CORE2 | m_GENERIC),
12289 + ~(m_PENT | m_ATOM | m_K6 | m_CORE2 | m_GENERIC),
12290
12291 /* X86_TUNE_USE_XCHGB: Use xchgb %rh,%rl instead of rolw/rorw $8,rx. */
12292 m_PENT4,
12293 @@ -1292,8 +1367,8 @@
12294 ~(m_PENT | m_PPRO),
12295
12296 /* X86_TUNE_PROMOTE_QIMODE */
12297 - m_K6_GEODE | m_PENT | m_386 | m_486 | m_AMD_MULTIPLE | m_CORE2
12298 - | m_GENERIC /* | m_PENT4 ? */,
12299 + m_K6_GEODE | m_PENT | m_ATOM | m_386 | m_486 | m_AMD_MULTIPLE
12300 + | m_CORE2 | m_GENERIC /* | m_PENT4 ? */,
12301
12302 /* X86_TUNE_FAST_PREFIX */
12303 ~(m_PENT | m_486 | m_386),
12304 @@ -1317,26 +1392,28 @@
12305 m_PPRO,
12306
12307 /* X86_TUNE_ADD_ESP_4: Enable if add/sub is preferred over 1/2 push/pop. */
12308 - m_AMD_MULTIPLE | m_K6_GEODE | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12309 + m_ATOM | m_AMD_MULTIPLE | m_K6_GEODE | m_PENT4 | m_NOCONA
12310 + | m_CORE2 | m_GENERIC,
12311
12312 /* X86_TUNE_ADD_ESP_8 */
12313 - m_AMD_MULTIPLE | m_PPRO | m_K6_GEODE | m_386
12314 + m_AMD_MULTIPLE | m_ATOM | m_PPRO | m_K6_GEODE | m_386
12315 | m_486 | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12316
12317 /* X86_TUNE_SUB_ESP_4 */
12318 - m_AMD_MULTIPLE | m_PPRO | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12319 + m_AMD_MULTIPLE | m_ATOM | m_PPRO | m_PENT4 | m_NOCONA | m_CORE2
12320 + | m_GENERIC,
12321
12322 /* X86_TUNE_SUB_ESP_8 */
12323 - m_AMD_MULTIPLE | m_PPRO | m_386 | m_486
12324 + m_AMD_MULTIPLE | m_ATOM | m_PPRO | m_386 | m_486
12325 | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12326
12327 /* X86_TUNE_INTEGER_DFMODE_MOVES: Enable if integer moves are preferred
12328 for DFmode copies */
12329 - ~(m_AMD_MULTIPLE | m_PENT4 | m_NOCONA | m_PPRO | m_CORE2
12330 + ~(m_AMD_MULTIPLE | m_ATOM | m_PENT4 | m_NOCONA | m_PPRO | m_CORE2
12331 | m_GENERIC | m_GEODE),
12332
12333 /* X86_TUNE_PARTIAL_REG_DEPENDENCY */
12334 - m_AMD_MULTIPLE | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12335 + m_AMD_MULTIPLE | m_ATOM | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12336
12337 /* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: In the Generic model we have a
12338 conflict here in between PPro/Pentium4 based chips that thread 128bit
12339 @@ -1347,7 +1424,8 @@
12340 shows that disabling this option on P4 brings over 20% SPECfp regression,
12341 while enabling it on K8 brings roughly 2.4% regression that can be partly
12342 masked by careful scheduling of moves. */
12343 - m_PENT4 | m_NOCONA | m_PPRO | m_CORE2 | m_GENERIC | m_AMDFAM10,
12344 + m_ATOM | m_PENT4 | m_NOCONA | m_PPRO | m_CORE2 | m_GENERIC
12345 + | m_AMDFAM10,
12346
12347 /* X86_TUNE_SSE_UNALIGNED_MOVE_OPTIMAL */
12348 m_AMDFAM10,
12349 @@ -1365,13 +1443,13 @@
12350 m_PPRO | m_PENT4 | m_NOCONA,
12351
12352 /* X86_TUNE_MEMORY_MISMATCH_STALL */
12353 - m_AMD_MULTIPLE | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12354 + m_AMD_MULTIPLE | m_ATOM | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12355
12356 /* X86_TUNE_PROLOGUE_USING_MOVE */
12357 - m_ATHLON_K8 | m_PPRO | m_CORE2 | m_GENERIC,
12358 + m_ATHLON_K8 | m_ATOM | m_PPRO | m_CORE2 | m_GENERIC,
12359
12360 /* X86_TUNE_EPILOGUE_USING_MOVE */
12361 - m_ATHLON_K8 | m_PPRO | m_CORE2 | m_GENERIC,
12362 + m_ATHLON_K8 | m_ATOM | m_PPRO | m_CORE2 | m_GENERIC,
12363
12364 /* X86_TUNE_SHIFT1 */
12365 ~m_486,
12366 @@ -1380,29 +1458,32 @@
12367 m_AMD_MULTIPLE,
12368
12369 /* X86_TUNE_INTER_UNIT_MOVES */
12370 - ~(m_AMD_MULTIPLE | m_GENERIC),
12371 + ~(m_AMD_MULTIPLE | m_ATOM | m_GENERIC),
12372
12373 /* X86_TUNE_INTER_UNIT_CONVERSIONS */
12374 ~(m_AMDFAM10),
12375
12376 /* X86_TUNE_FOUR_JUMP_LIMIT: Some CPU cores are not able to predict more
12377 than 4 branch instructions in the 16 byte window. */
12378 - m_PPRO | m_AMD_MULTIPLE | m_PENT4 | m_NOCONA | m_CORE2 | m_GENERIC,
12379 + m_ATOM | m_PPRO | m_AMD_MULTIPLE | m_PENT4 | m_NOCONA | m_CORE2
12380 + | m_GENERIC,
12381
12382 /* X86_TUNE_SCHEDULE */
12383 - m_PPRO | m_AMD_MULTIPLE | m_K6_GEODE | m_PENT | m_CORE2 | m_GENERIC,
12384 + m_PPRO | m_AMD_MULTIPLE | m_K6_GEODE | m_PENT | m_ATOM | m_CORE2
12385 + | m_GENERIC,
12386
12387 /* X86_TUNE_USE_BT */
12388 - m_AMD_MULTIPLE | m_CORE2 | m_GENERIC,
12389 + m_AMD_MULTIPLE | m_ATOM | m_CORE2 | m_GENERIC,
12390
12391 /* X86_TUNE_USE_INCDEC */
12392 - ~(m_PENT4 | m_NOCONA | m_GENERIC),
12393 + ~(m_PENT4 | m_NOCONA | m_GENERIC | m_ATOM),
12394
12395 /* X86_TUNE_PAD_RETURNS */
12396 m_AMD_MULTIPLE | m_CORE2 | m_GENERIC,
12397
12398 /* X86_TUNE_EXT_80387_CONSTANTS */
12399 - m_K6_GEODE | m_ATHLON_K8 | m_PENT4 | m_NOCONA | m_PPRO | m_CORE2 | m_GENERIC,
12400 + m_K6_GEODE | m_ATHLON_K8 | m_ATOM | m_PENT4 | m_NOCONA | m_PPRO
12401 + | m_CORE2 | m_GENERIC,
12402
12403 /* X86_TUNE_SHORTEN_X87_SSE */
12404 ~m_K8,
12405 @@ -1447,6 +1528,10 @@
12406 with a subsequent conditional jump instruction into a single
12407 compare-and-branch uop. */
12408 m_CORE2,
12409 +
12410 + /* X86_TUNE_OPT_AGU: Optimize for Address Generation Unit. This flag
12411 + will impact LEA instruction selection. */
12412 + m_ATOM,
12413 };
12414
12415 /* Feature tests against the various architecture variations. */
12416 @@ -1472,10 +1557,11 @@
12417 };
12418
12419 static const unsigned int x86_accumulate_outgoing_args
12420 - = m_AMD_MULTIPLE | m_PENT4 | m_NOCONA | m_PPRO | m_CORE2 | m_GENERIC;
12421 + = m_AMD_MULTIPLE | m_ATOM | m_PENT4 | m_NOCONA | m_PPRO | m_CORE2
12422 + | m_GENERIC;
12423
12424 static const unsigned int x86_arch_always_fancy_math_387
12425 - = m_PENT | m_PPRO | m_AMD_MULTIPLE | m_PENT4
12426 + = m_PENT | m_ATOM | m_PPRO | m_AMD_MULTIPLE | m_PENT4
12427 | m_NOCONA | m_CORE2 | m_GENERIC;
12428
12429 static enum stringop_alg stringop_alg = no_stringop;
12430 @@ -1743,6 +1829,9 @@
12431 /* Alignment for incoming stack boundary in bits. */
12432 unsigned int ix86_incoming_stack_boundary;
12433
12434 +/* The abi used by target. */
12435 +enum calling_abi ix86_abi;
12436 +
12437 /* Values 1-5: see jump.c */
12438 int ix86_branch_cost;
12439
12440 @@ -1819,6 +1908,8 @@
12441 static bool ix86_can_inline_p (tree, tree);
12442 static void ix86_set_current_function (tree);
12443
12444 +static enum calling_abi ix86_function_abi (const_tree);
12445 +
12446 \f
12447 /* The svr4 ABI for the i386 says that records and unions are returned
12448 in memory. */
12449 @@ -1880,6 +1971,7 @@
12450 #define OPTION_MASK_ISA_POPCNT_SET OPTION_MASK_ISA_POPCNT
12451 #define OPTION_MASK_ISA_CX16_SET OPTION_MASK_ISA_CX16
12452 #define OPTION_MASK_ISA_SAHF_SET OPTION_MASK_ISA_SAHF
12453 +#define OPTION_MASK_ISA_MOVBE_SET OPTION_MASK_ISA_MOVBE
12454
12455 /* Define a set of ISAs which aren't available when a given ISA is
12456 disabled. MMX and SSE ISAs are handled separately. */
12457 @@ -1921,6 +2013,7 @@
12458 #define OPTION_MASK_ISA_POPCNT_UNSET OPTION_MASK_ISA_POPCNT
12459 #define OPTION_MASK_ISA_CX16_UNSET OPTION_MASK_ISA_CX16
12460 #define OPTION_MASK_ISA_SAHF_UNSET OPTION_MASK_ISA_SAHF
12461 +#define OPTION_MASK_ISA_MOVBE_UNSET OPTION_MASK_ISA_MOVBE
12462
12463 /* Vectorization library interface and handlers. */
12464 tree (*ix86_veclib_handler)(enum built_in_function, tree, tree) = NULL;
12465 @@ -1953,7 +2046,8 @@
12466 {&core2_cost, 16, 10, 16, 10, 16},
12467 {&generic32_cost, 16, 7, 16, 7, 16},
12468 {&generic64_cost, 16, 10, 16, 10, 16},
12469 - {&amdfam10_cost, 32, 24, 32, 7, 32}
12470 + {&amdfam10_cost, 32, 24, 32, 7, 32},
12471 + {&atom_cost, 16, 7, 16, 7, 16}
12472 };
12473
12474 static const char *const cpu_names[TARGET_CPU_DEFAULT_max] =
12475 @@ -1971,6 +2065,7 @@
12476 "prescott",
12477 "nocona",
12478 "core2",
12479 + "atom",
12480 "geode",
12481 "k6",
12482 "k6-2",
12483 @@ -2209,6 +2304,19 @@
12484 }
12485 return true;
12486
12487 + case OPT_mmovbe:
12488 + if (value)
12489 + {
12490 + ix86_isa_flags |= OPTION_MASK_ISA_MOVBE_SET;
12491 + ix86_isa_flags_explicit |= OPTION_MASK_ISA_MOVBE_SET;
12492 + }
12493 + else
12494 + {
12495 + ix86_isa_flags &= ~OPTION_MASK_ISA_MOVBE_UNSET;
12496 + ix86_isa_flags_explicit |= OPTION_MASK_ISA_MOVBE_UNSET;
12497 + }
12498 + return true;
12499 +
12500 case OPT_maes:
12501 if (value)
12502 {
12503 @@ -2271,6 +2379,7 @@
12504 { "-mmmx", OPTION_MASK_ISA_MMX },
12505 { "-mabm", OPTION_MASK_ISA_ABM },
12506 { "-mpopcnt", OPTION_MASK_ISA_POPCNT },
12507 + { "-mmovbe", OPTION_MASK_ISA_MOVBE },
12508 { "-maes", OPTION_MASK_ISA_AES },
12509 { "-mpclmul", OPTION_MASK_ISA_PCLMUL },
12510 };
12511 @@ -2487,7 +2596,8 @@
12512 PTA_AES = 1 << 17,
12513 PTA_PCLMUL = 1 << 18,
12514 PTA_AVX = 1 << 19,
12515 - PTA_FMA = 1 << 20
12516 + PTA_FMA = 1 << 20,
12517 + PTA_MOVBE = 1 << 21
12518 };
12519
12520 static struct pta
12521 @@ -2529,6 +2639,9 @@
12522 {"core2", PROCESSOR_CORE2, CPU_CORE2,
12523 PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
12524 | PTA_SSSE3 | PTA_CX16},
12525 + {"atom", PROCESSOR_ATOM, CPU_ATOM,
12526 + PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
12527 + | PTA_SSSE3 | PTA_CX16 | PTA_MOVBE},
12528 {"geode", PROCESSOR_GEODE, CPU_GEODE,
12529 PTA_MMX | PTA_3DNOW | PTA_3DNOW_A |PTA_PREFETCH_SSE},
12530 {"k6", PROCESSOR_K6, CPU_K6, PTA_MMX},
12531 @@ -2716,6 +2829,20 @@
12532 error ("bad value (%s) for %sarch=%s %s",
12533 ix86_arch_string, prefix, suffix, sw);
12534
12535 + /* Validate -mabi= value. */
12536 + if (ix86_abi_string)
12537 + {
12538 + if (strcmp (ix86_abi_string, "sysv") == 0)
12539 + ix86_abi = SYSV_ABI;
12540 + else if (strcmp (ix86_abi_string, "ms") == 0)
12541 + ix86_abi = MS_ABI;
12542 + else
12543 + error ("unknown ABI (%s) for %sabi=%s %s",
12544 + ix86_abi_string, prefix, suffix, sw);
12545 + }
12546 + else
12547 + ix86_abi = DEFAULT_ABI;
12548 +
12549 if (ix86_cmodel_string != 0)
12550 {
12551 if (!strcmp (ix86_cmodel_string, "small"))
12552 @@ -2828,6 +2955,9 @@
12553 if (!(TARGET_64BIT && (processor_alias_table[i].flags & PTA_NO_SAHF))
12554 && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_SAHF))
12555 ix86_isa_flags |= OPTION_MASK_ISA_SAHF;
12556 + if (processor_alias_table[i].flags & PTA_MOVBE
12557 + && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_MOVBE))
12558 + ix86_isa_flags |= OPTION_MASK_ISA_MOVBE;
12559 if (processor_alias_table[i].flags & PTA_AES
12560 && !(ix86_isa_flags_explicit & OPTION_MASK_ISA_AES))
12561 ix86_isa_flags |= OPTION_MASK_ISA_AES;
12562 @@ -4592,14 +4722,14 @@
12563 default ABI. */
12564
12565 /* RAX is used as hidden argument to va_arg functions. */
12566 - if (DEFAULT_ABI == SYSV_ABI && regno == AX_REG)
12567 + if (ix86_abi == SYSV_ABI && regno == AX_REG)
12568 return true;
12569
12570 - if (DEFAULT_ABI == MS_ABI)
12571 + if (ix86_abi == MS_ABI)
12572 parm_regs = x86_64_ms_abi_int_parameter_registers;
12573 else
12574 parm_regs = x86_64_int_parameter_registers;
12575 - for (i = 0; i < (DEFAULT_ABI == MS_ABI ? X64_REGPARM_MAX
12576 + for (i = 0; i < (ix86_abi == MS_ABI ? X64_REGPARM_MAX
12577 : X86_64_REGPARM_MAX); i++)
12578 if (regno == parm_regs[i])
12579 return true;
12580 @@ -4627,7 +4757,7 @@
12581 int
12582 ix86_reg_parm_stack_space (const_tree fndecl)
12583 {
12584 - int call_abi = SYSV_ABI;
12585 + enum calling_abi call_abi = SYSV_ABI;
12586 if (fndecl != NULL_TREE && TREE_CODE (fndecl) == FUNCTION_DECL)
12587 call_abi = ix86_function_abi (fndecl);
12588 else
12589 @@ -4639,37 +4769,39 @@
12590
12591 /* Returns value SYSV_ABI, MS_ABI dependent on fntype, specifying the
12592 call abi used. */
12593 -int
12594 +enum calling_abi
12595 ix86_function_type_abi (const_tree fntype)
12596 {
12597 if (TARGET_64BIT && fntype != NULL)
12598 {
12599 - int abi;
12600 - if (DEFAULT_ABI == SYSV_ABI)
12601 - abi = lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)) ? MS_ABI : SYSV_ABI;
12602 - else
12603 - abi = lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)) ? SYSV_ABI : MS_ABI;
12604 -
12605 + enum calling_abi abi = ix86_abi;
12606 + if (abi == SYSV_ABI)
12607 + {
12608 + if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
12609 + abi = MS_ABI;
12610 + }
12611 + else if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
12612 + abi = SYSV_ABI;
12613 return abi;
12614 }
12615 - return DEFAULT_ABI;
12616 + return ix86_abi;
12617 }
12618
12619 -int
12620 +static enum calling_abi
12621 ix86_function_abi (const_tree fndecl)
12622 {
12623 if (! fndecl)
12624 - return DEFAULT_ABI;
12625 + return ix86_abi;
12626 return ix86_function_type_abi (TREE_TYPE (fndecl));
12627 }
12628
12629 /* Returns value SYSV_ABI, MS_ABI dependent on cfun, specifying the
12630 call abi used. */
12631 -int
12632 +enum calling_abi
12633 ix86_cfun_abi (void)
12634 {
12635 if (! cfun || ! TARGET_64BIT)
12636 - return DEFAULT_ABI;
12637 + return ix86_abi;
12638 return cfun->machine->call_abi;
12639 }
12640
12641 @@ -4683,7 +4815,7 @@
12642 ix86_call_abi_override (const_tree fndecl)
12643 {
12644 if (fndecl == NULL_TREE)
12645 - cfun->machine->call_abi = DEFAULT_ABI;
12646 + cfun->machine->call_abi = ix86_abi;
12647 else
12648 cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl));
12649 }
12650 @@ -4724,8 +4856,8 @@
12651 cum->nregs = ix86_regparm;
12652 if (TARGET_64BIT)
12653 {
12654 - if (cum->call_abi != DEFAULT_ABI)
12655 - cum->nregs = DEFAULT_ABI != SYSV_ABI ? X86_64_REGPARM_MAX
12656 + if (cum->call_abi != ix86_abi)
12657 + cum->nregs = ix86_abi != SYSV_ABI ? X86_64_REGPARM_MAX
12658 : X64_REGPARM_MAX;
12659 }
12660 if (TARGET_SSE)
12661 @@ -4733,8 +4865,8 @@
12662 cum->sse_nregs = SSE_REGPARM_MAX;
12663 if (TARGET_64BIT)
12664 {
12665 - if (cum->call_abi != DEFAULT_ABI)
12666 - cum->sse_nregs = DEFAULT_ABI != SYSV_ABI ? X86_64_SSE_REGPARM_MAX
12667 + if (cum->call_abi != ix86_abi)
12668 + cum->sse_nregs = ix86_abi != SYSV_ABI ? X86_64_SSE_REGPARM_MAX
12669 : X64_SSE_REGPARM_MAX;
12670 }
12671 }
12672 @@ -5700,7 +5832,7 @@
12673 if (type)
12674 mode = type_natural_mode (type, NULL);
12675
12676 - if (TARGET_64BIT && (cum ? cum->call_abi : DEFAULT_ABI) == MS_ABI)
12677 + if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
12678 function_arg_advance_ms_64 (cum, bytes, words);
12679 else if (TARGET_64BIT)
12680 function_arg_advance_64 (cum, mode, type, words, named);
12681 @@ -5846,9 +5978,9 @@
12682 if (mode == VOIDmode)
12683 return GEN_INT (cum->maybe_vaarg
12684 ? (cum->sse_nregs < 0
12685 - ? (cum->call_abi == DEFAULT_ABI
12686 + ? (cum->call_abi == ix86_abi
12687 ? SSE_REGPARM_MAX
12688 - : (DEFAULT_ABI != SYSV_ABI ? X86_64_SSE_REGPARM_MAX
12689 + : (ix86_abi != SYSV_ABI ? X86_64_SSE_REGPARM_MAX
12690 : X64_SSE_REGPARM_MAX))
12691 : cum->sse_regno)
12692 : -1);
12693 @@ -5942,7 +6074,7 @@
12694 if (type && TREE_CODE (type) == VECTOR_TYPE)
12695 mode = type_natural_mode (type, cum);
12696
12697 - if (TARGET_64BIT && (cum ? cum->call_abi : DEFAULT_ABI) == MS_ABI)
12698 + if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
12699 return function_arg_ms_64 (cum, mode, omode, named, bytes);
12700 else if (TARGET_64BIT)
12701 return function_arg_64 (cum, mode, omode, type, named);
12702 @@ -5962,7 +6094,7 @@
12703 const_tree type, bool named ATTRIBUTE_UNUSED)
12704 {
12705 /* See Windows x64 Software Convention. */
12706 - if (TARGET_64BIT && (cum ? cum->call_abi : DEFAULT_ABI) == MS_ABI)
12707 + if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
12708 {
12709 int msize = (int) GET_MODE_SIZE (mode);
12710 if (type)
12711 @@ -6102,7 +6234,7 @@
12712 /* TODO: The function should depend on current function ABI but
12713 builtins.c would need updating then. Therefore we use the
12714 default ABI. */
12715 - if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
12716 + if (TARGET_64BIT && ix86_abi == MS_ABI)
12717 return false;
12718 return TARGET_FLOAT_RETURNS_IN_80387;
12719
12720 @@ -6498,13 +6630,13 @@
12721 static tree
12722 ix86_build_builtin_va_list (void)
12723 {
12724 - tree ret = ix86_build_builtin_va_list_abi (DEFAULT_ABI);
12725 + tree ret = ix86_build_builtin_va_list_abi (ix86_abi);
12726
12727 /* Initialize abi specific va_list builtin types. */
12728 if (TARGET_64BIT)
12729 {
12730 tree t;
12731 - if (DEFAULT_ABI == MS_ABI)
12732 + if (ix86_abi == MS_ABI)
12733 {
12734 t = ix86_build_builtin_va_list_abi (SYSV_ABI);
12735 if (TREE_CODE (t) != RECORD_TYPE)
12736 @@ -6518,7 +6650,7 @@
12737 t = build_variant_type_copy (t);
12738 sysv_va_list_type_node = t;
12739 }
12740 - if (DEFAULT_ABI != MS_ABI)
12741 + if (ix86_abi != MS_ABI)
12742 {
12743 t = ix86_build_builtin_va_list_abi (MS_ABI);
12744 if (TREE_CODE (t) != RECORD_TYPE)
12745 @@ -6551,8 +6683,8 @@
12746 int i;
12747 int regparm = ix86_regparm;
12748
12749 - if (cum->call_abi != DEFAULT_ABI)
12750 - regparm = DEFAULT_ABI != SYSV_ABI ? X86_64_REGPARM_MAX : X64_REGPARM_MAX;
12751 + if (cum->call_abi != ix86_abi)
12752 + regparm = ix86_abi != SYSV_ABI ? X86_64_REGPARM_MAX : X64_REGPARM_MAX;
12753
12754 /* GPR size of varargs save area. */
12755 if (cfun->va_list_gpr_size)
12756 @@ -6705,7 +6837,7 @@
12757 return true;
12758 canonic = ix86_canonical_va_list_type (type);
12759 return (canonic == ms_va_list_type_node
12760 - || (DEFAULT_ABI == MS_ABI && canonic == va_list_type_node));
12761 + || (ix86_abi == MS_ABI && canonic == va_list_type_node));
12762 }
12763
12764 /* Implement va_start. */
12765 @@ -12987,6 +13119,316 @@
12766 emit_move_insn (operands[0], dst);
12767 }
12768
12769 +#define LEA_SEARCH_THRESHOLD 12
12770 +
12771 +/* Search backward for non-agu definition of register number REGNO1
12772 + or register number REGNO2 in INSN's basic block until
12773 + 1. Pass LEA_SEARCH_THRESHOLD instructions, or
12774 + 2. Reach BB boundary, or
12775 + 3. Reach agu definition.
12776 + Returns the distance between the non-agu definition point and INSN.
12777 + If no definition point, returns -1. */
12778 +
12779 +static int
12780 +distance_non_agu_define (unsigned int regno1, unsigned int regno2,
12781 + rtx insn)
12782 +{
12783 + basic_block bb = BLOCK_FOR_INSN (insn);
12784 + int distance = 0;
12785 + df_ref *def_rec;
12786 + enum attr_type insn_type;
12787 +
12788 + if (insn != BB_HEAD (bb))
12789 + {
12790 + rtx prev = PREV_INSN (insn);
12791 + while (prev && distance < LEA_SEARCH_THRESHOLD)
12792 + {
12793 + if (INSN_P (prev))
12794 + {
12795 + distance++;
12796 + for (def_rec = DF_INSN_DEFS (prev); *def_rec; def_rec++)
12797 + if (DF_REF_TYPE (*def_rec) == DF_REF_REG_DEF
12798 + && !DF_REF_IS_ARTIFICIAL (*def_rec)
12799 + && (regno1 == DF_REF_REGNO (*def_rec)
12800 + || regno2 == DF_REF_REGNO (*def_rec)))
12801 + {
12802 + insn_type = get_attr_type (prev);
12803 + if (insn_type != TYPE_LEA)
12804 + goto done;
12805 + }
12806 + }
12807 + if (prev == BB_HEAD (bb))
12808 + break;
12809 + prev = PREV_INSN (prev);
12810 + }
12811 + }
12812 +
12813 + if (distance < LEA_SEARCH_THRESHOLD)
12814 + {
12815 + edge e;
12816 + edge_iterator ei;
12817 + bool simple_loop = false;
12818 +
12819 + FOR_EACH_EDGE (e, ei, bb->preds)
12820 + if (e->src == bb)
12821 + {
12822 + simple_loop = true;
12823 + break;
12824 + }
12825 +
12826 + if (simple_loop)
12827 + {
12828 + rtx prev = BB_END (bb);
12829 + while (prev
12830 + && prev != insn
12831 + && distance < LEA_SEARCH_THRESHOLD)
12832 + {
12833 + if (INSN_P (prev))
12834 + {
12835 + distance++;
12836 + for (def_rec = DF_INSN_DEFS (prev); *def_rec; def_rec++)
12837 + if (DF_REF_TYPE (*def_rec) == DF_REF_REG_DEF
12838 + && !DF_REF_IS_ARTIFICIAL (*def_rec)
12839 + && (regno1 == DF_REF_REGNO (*def_rec)
12840 + || regno2 == DF_REF_REGNO (*def_rec)))
12841 + {
12842 + insn_type = get_attr_type (prev);
12843 + if (insn_type != TYPE_LEA)
12844 + goto done;
12845 + }
12846 + }
12847 + prev = PREV_INSN (prev);
12848 + }
12849 + }
12850 + }
12851 +
12852 + distance = -1;
12853 +
12854 +done:
12855 + /* get_attr_type may modify recog data. We want to make sure
12856 + that recog data is valid for instruction INSN, on which
12857 + distance_non_agu_define is called. INSN is unchanged here. */
12858 + extract_insn_cached (insn);
12859 + return distance;
12860 +}
12861 +
12862 +/* Return the distance between INSN and the next insn that uses
12863 + register number REGNO0 in memory address. Return -1 if no such
12864 + a use is found within LEA_SEARCH_THRESHOLD or REGNO0 is set. */
12865 +
12866 +static int
12867 +distance_agu_use (unsigned int regno0, rtx insn)
12868 +{
12869 + basic_block bb = BLOCK_FOR_INSN (insn);
12870 + int distance = 0;
12871 + df_ref *def_rec;
12872 + df_ref *use_rec;
12873 +
12874 + if (insn != BB_END (bb))
12875 + {
12876 + rtx next = NEXT_INSN (insn);
12877 + while (next && distance < LEA_SEARCH_THRESHOLD)
12878 + {
12879 + if (INSN_P (next))
12880 + {
12881 + distance++;
12882 +
12883 + for (use_rec = DF_INSN_USES (next); *use_rec; use_rec++)
12884 + if ((DF_REF_TYPE (*use_rec) == DF_REF_REG_MEM_LOAD
12885 + || DF_REF_TYPE (*use_rec) == DF_REF_REG_MEM_STORE)
12886 + && regno0 == DF_REF_REGNO (*use_rec))
12887 + {
12888 + /* Return DISTANCE if OP0 is used in memory
12889 + address in NEXT. */
12890 + return distance;
12891 + }
12892 +
12893 + for (def_rec = DF_INSN_DEFS (next); *def_rec; def_rec++)
12894 + if (DF_REF_TYPE (*def_rec) == DF_REF_REG_DEF
12895 + && !DF_REF_IS_ARTIFICIAL (*def_rec)
12896 + && regno0 == DF_REF_REGNO (*def_rec))
12897 + {
12898 + /* Return -1 if OP0 is set in NEXT. */
12899 + return -1;
12900 + }
12901 + }
12902 + if (next == BB_END (bb))
12903 + break;
12904 + next = NEXT_INSN (next);
12905 + }
12906 + }
12907 +
12908 + if (distance < LEA_SEARCH_THRESHOLD)
12909 + {
12910 + edge e;
12911 + edge_iterator ei;
12912 + bool simple_loop = false;
12913 +
12914 + FOR_EACH_EDGE (e, ei, bb->succs)
12915 + if (e->dest == bb)
12916 + {
12917 + simple_loop = true;
12918 + break;
12919 + }
12920 +
12921 + if (simple_loop)
12922 + {
12923 + rtx next = BB_HEAD (bb);
12924 + while (next
12925 + && next != insn
12926 + && distance < LEA_SEARCH_THRESHOLD)
12927 + {
12928 + if (INSN_P (next))
12929 + {
12930 + distance++;
12931 +
12932 + for (use_rec = DF_INSN_USES (next); *use_rec; use_rec++)
12933 + if ((DF_REF_TYPE (*use_rec) == DF_REF_REG_MEM_LOAD
12934 + || DF_REF_TYPE (*use_rec) == DF_REF_REG_MEM_STORE)
12935 + && regno0 == DF_REF_REGNO (*use_rec))
12936 + {
12937 + /* Return DISTANCE if OP0 is used in memory
12938 + address in NEXT. */
12939 + return distance;
12940 + }
12941 +
12942 + for (def_rec = DF_INSN_DEFS (next); *def_rec; def_rec++)
12943 + if (DF_REF_TYPE (*def_rec) == DF_REF_REG_DEF
12944 + && !DF_REF_IS_ARTIFICIAL (*def_rec)
12945 + && regno0 == DF_REF_REGNO (*def_rec))
12946 + {
12947 + /* Return -1 if OP0 is set in NEXT. */
12948 + return -1;
12949 + }
12950 +
12951 + }
12952 + next = NEXT_INSN (next);
12953 + }
12954 + }
12955 + }
12956 +
12957 + return -1;
12958 +}
12959 +
12960 +/* Define this macro to tune LEA priority vs ADD, it take effect when
12961 + there is a dilemma of choicing LEA or ADD
12962 + Negative value: ADD is more preferred than LEA
12963 + Zero: Netrual
12964 + Positive value: LEA is more preferred than ADD*/
12965 +#define IX86_LEA_PRIORITY 2
12966 +
12967 +/* Return true if it is ok to optimize an ADD operation to LEA
12968 + operation to avoid flag register consumation. For the processors
12969 + like ATOM, if the destination register of LEA holds an actual
12970 + address which will be used soon, LEA is better and otherwise ADD
12971 + is better. */
12972 +
12973 +bool
12974 +ix86_lea_for_add_ok (enum rtx_code code ATTRIBUTE_UNUSED,
12975 + rtx insn, rtx operands[])
12976 +{
12977 + unsigned int regno0 = true_regnum (operands[0]);
12978 + unsigned int regno1 = true_regnum (operands[1]);
12979 + unsigned int regno2;
12980 +
12981 + if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun))
12982 + return regno0 != regno1;
12983 +
12984 + regno2 = true_regnum (operands[2]);
12985 +
12986 + /* If a = b + c, (a!=b && a!=c), must use lea form. */
12987 + if (regno0 != regno1 && regno0 != regno2)
12988 + return true;
12989 + else
12990 + {
12991 + int dist_define, dist_use;
12992 + dist_define = distance_non_agu_define (regno1, regno2, insn);
12993 + if (dist_define <= 0)
12994 + return true;
12995 +
12996 + /* If this insn has both backward non-agu dependence and forward
12997 + agu dependence, the one with short distance take effect. */
12998 + dist_use = distance_agu_use (regno0, insn);
12999 + if (dist_use <= 0
13000 + || (dist_define + IX86_LEA_PRIORITY) < dist_use)
13001 + return false;
13002 +
13003 + return true;
13004 + }
13005 +}
13006 +
13007 +/* Return true if destination reg of SET_BODY is shift count of
13008 + USE_BODY. */
13009 +
13010 +static bool
13011 +ix86_dep_by_shift_count_body (const_rtx set_body, const_rtx use_body)
13012 +{
13013 + rtx set_dest;
13014 + rtx shift_rtx;
13015 + int i;
13016 +
13017 + /* Retrieve destination of SET_BODY. */
13018 + switch (GET_CODE (set_body))
13019 + {
13020 + case SET:
13021 + set_dest = SET_DEST (set_body);
13022 + if (!set_dest || !REG_P (set_dest))
13023 + return false;
13024 + break;
13025 + case PARALLEL:
13026 + for (i = XVECLEN (set_body, 0) - 1; i >= 0; i--)
13027 + if (ix86_dep_by_shift_count_body (XVECEXP (set_body, 0, i),
13028 + use_body))
13029 + return true;
13030 + default:
13031 + return false;
13032 + break;
13033 + }
13034 +
13035 + /* Retrieve shift count of USE_BODY. */
13036 + switch (GET_CODE (use_body))
13037 + {
13038 + case SET:
13039 + shift_rtx = XEXP (use_body, 1);
13040 + break;
13041 + case PARALLEL:
13042 + for (i = XVECLEN (use_body, 0) - 1; i >= 0; i--)
13043 + if (ix86_dep_by_shift_count_body (set_body,
13044 + XVECEXP (use_body, 0, i)))
13045 + return true;
13046 + default:
13047 + return false;
13048 + break;
13049 + }
13050 +
13051 + if (shift_rtx
13052 + && (GET_CODE (shift_rtx) == ASHIFT
13053 + || GET_CODE (shift_rtx) == LSHIFTRT
13054 + || GET_CODE (shift_rtx) == ASHIFTRT
13055 + || GET_CODE (shift_rtx) == ROTATE
13056 + || GET_CODE (shift_rtx) == ROTATERT))
13057 + {
13058 + rtx shift_count = XEXP (shift_rtx, 1);
13059 +
13060 + /* Return true if shift count is dest of SET_BODY. */
13061 + if (REG_P (shift_count)
13062 + && true_regnum (set_dest) == true_regnum (shift_count))
13063 + return true;
13064 + }
13065 +
13066 + return false;
13067 +}
13068 +
13069 +/* Return true if destination reg of SET_INSN is shift count of
13070 + USE_INSN. */
13071 +
13072 +bool
13073 +ix86_dep_by_shift_count (const_rtx set_insn, const_rtx use_insn)
13074 +{
13075 + return ix86_dep_by_shift_count_body (PATTERN (set_insn),
13076 + PATTERN (use_insn));
13077 +}
13078 +
13079 /* Return TRUE or FALSE depending on whether the unary operator meets the
13080 appropriate constraints. */
13081
13082 @@ -18838,7 +19280,7 @@
13083 f = GGC_CNEW (struct machine_function);
13084 f->use_fast_prologue_epilogue_nregs = -1;
13085 f->tls_descriptor_call_expanded_p = 0;
13086 - f->call_abi = DEFAULT_ABI;
13087 + f->call_abi = ix86_abi;
13088
13089 return f;
13090 }
13091 @@ -19099,6 +19541,7 @@
13092 switch (ix86_tune)
13093 {
13094 case PROCESSOR_PENTIUM:
13095 + case PROCESSOR_ATOM:
13096 case PROCESSOR_K6:
13097 return 2;
13098
13099 @@ -19165,41 +19608,21 @@
13100 return 1;
13101 }
13102
13103 -/* A subroutine of ix86_adjust_cost -- return true iff INSN has a memory
13104 - address with operands set by DEP_INSN. */
13105 +/* Return true iff USE_INSN has a memory address with operands set by
13106 + SET_INSN. */
13107
13108 -static int
13109 -ix86_agi_dependent (rtx insn, rtx dep_insn, enum attr_type insn_type)
13110 +bool
13111 +ix86_agi_dependent (rtx set_insn, rtx use_insn)
13112 {
13113 - rtx addr;
13114 -
13115 - if (insn_type == TYPE_LEA
13116 - && TARGET_PENTIUM)
13117 - {
13118 - addr = PATTERN (insn);
13119 -
13120 - if (GET_CODE (addr) == PARALLEL)
13121 - addr = XVECEXP (addr, 0, 0);
13122 -
13123 - gcc_assert (GET_CODE (addr) == SET);
13124 -
13125 - addr = SET_SRC (addr);
13126 - }
13127 - else
13128 - {
13129 - int i;
13130 - extract_insn_cached (insn);
13131 - for (i = recog_data.n_operands - 1; i >= 0; --i)
13132 - if (MEM_P (recog_data.operand[i]))
13133 - {
13134 - addr = XEXP (recog_data.operand[i], 0);
13135 - goto found;
13136 - }
13137 - return 0;
13138 - found:;
13139 - }
13140 -
13141 - return modified_in_p (addr, dep_insn);
13142 + int i;
13143 + extract_insn_cached (use_insn);
13144 + for (i = recog_data.n_operands - 1; i >= 0; --i)
13145 + if (MEM_P (recog_data.operand[i]))
13146 + {
13147 + rtx addr = XEXP (recog_data.operand[i], 0);
13148 + return modified_in_p (addr, set_insn) != 0;
13149 + }
13150 + return false;
13151 }
13152
13153 static int
13154 @@ -19227,7 +19650,20 @@
13155 {
13156 case PROCESSOR_PENTIUM:
13157 /* Address Generation Interlock adds a cycle of latency. */
13158 - if (ix86_agi_dependent (insn, dep_insn, insn_type))
13159 + if (insn_type == TYPE_LEA)
13160 + {
13161 + rtx addr = PATTERN (insn);
13162 +
13163 + if (GET_CODE (addr) == PARALLEL)
13164 + addr = XVECEXP (addr, 0, 0);
13165 +
13166 + gcc_assert (GET_CODE (addr) == SET);
13167 +
13168 + addr = SET_SRC (addr);
13169 + if (modified_in_p (addr, dep_insn))
13170 + cost += 1;
13171 + }
13172 + else if (ix86_agi_dependent (dep_insn, insn))
13173 cost += 1;
13174
13175 /* ??? Compares pair with jump/setcc. */
13176 @@ -19237,7 +19673,7 @@
13177 /* Floating point stores require value to be ready one cycle earlier. */
13178 if (insn_type == TYPE_FMOV
13179 && get_attr_memory (insn) == MEMORY_STORE
13180 - && !ix86_agi_dependent (insn, dep_insn, insn_type))
13181 + && !ix86_agi_dependent (dep_insn, insn))
13182 cost += 1;
13183 break;
13184
13185 @@ -19260,7 +19696,7 @@
13186 in parallel with previous instruction in case
13187 previous instruction is not needed to compute the address. */
13188 if ((memory == MEMORY_LOAD || memory == MEMORY_BOTH)
13189 - && !ix86_agi_dependent (insn, dep_insn, insn_type))
13190 + && !ix86_agi_dependent (dep_insn, insn))
13191 {
13192 /* Claim moves to take one cycle, as core can issue one load
13193 at time and the next load can start cycle later. */
13194 @@ -19289,7 +19725,7 @@
13195 in parallel with previous instruction in case
13196 previous instruction is not needed to compute the address. */
13197 if ((memory == MEMORY_LOAD || memory == MEMORY_BOTH)
13198 - && !ix86_agi_dependent (insn, dep_insn, insn_type))
13199 + && !ix86_agi_dependent (dep_insn, insn))
13200 {
13201 /* Claim moves to take one cycle, as core can issue one load
13202 at time and the next load can start cycle later. */
13203 @@ -19306,6 +19742,7 @@
13204 case PROCESSOR_ATHLON:
13205 case PROCESSOR_K8:
13206 case PROCESSOR_AMDFAM10:
13207 + case PROCESSOR_ATOM:
13208 case PROCESSOR_GENERIC32:
13209 case PROCESSOR_GENERIC64:
13210 memory = get_attr_memory (insn);
13211 @@ -19314,7 +19751,7 @@
13212 in parallel with previous instruction in case
13213 previous instruction is not needed to compute the address. */
13214 if ((memory == MEMORY_LOAD || memory == MEMORY_BOTH)
13215 - && !ix86_agi_dependent (insn, dep_insn, insn_type))
13216 + && !ix86_agi_dependent (dep_insn, insn))
13217 {
13218 enum attr_unit unit = get_attr_unit (insn);
13219 int loadcost = 3;
13220 @@ -29594,14 +30031,11 @@
13221 tree
13222 ix86_fn_abi_va_list (tree fndecl)
13223 {
13224 - int abi;
13225 -
13226 if (!TARGET_64BIT)
13227 return va_list_type_node;
13228 gcc_assert (fndecl != NULL_TREE);
13229 - abi = ix86_function_abi ((const_tree) fndecl);
13230
13231 - if (abi == MS_ABI)
13232 + if (ix86_function_abi ((const_tree) fndecl) == MS_ABI)
13233 return ms_va_list_type_node;
13234 else
13235 return sysv_va_list_type_node;
13236 diff -Nur a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
13237 --- a/gcc/config/i386/i386-c.c 2008-08-31 01:50:40.000000000 +0200
13238 +++ b/gcc/config/i386/i386-c.c 2010-01-25 09:50:29.005686600 +0100
13239 @@ -119,6 +119,10 @@
13240 def_or_undef (parse_in, "__core2");
13241 def_or_undef (parse_in, "__core2__");
13242 break;
13243 + case PROCESSOR_ATOM:
13244 + def_or_undef (parse_in, "__atom");
13245 + def_or_undef (parse_in, "__atom__");
13246 + break;
13247 /* use PROCESSOR_max to not set/unset the arch macro. */
13248 case PROCESSOR_max:
13249 break;
13250 @@ -187,6 +191,9 @@
13251 case PROCESSOR_CORE2:
13252 def_or_undef (parse_in, "__tune_core2__");
13253 break;
13254 + case PROCESSOR_ATOM:
13255 + def_or_undef (parse_in, "__tune_atom__");
13256 + break;
13257 case PROCESSOR_GENERIC32:
13258 case PROCESSOR_GENERIC64:
13259 break;
13260 diff -Nur a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
13261 --- a/gcc/config/i386/i386.h 2009-07-11 21:06:26.000000000 +0200
13262 +++ b/gcc/config/i386/i386.h 2010-01-25 09:50:29.005686600 +0100
13263 @@ -59,6 +59,7 @@
13264 #define TARGET_ABM OPTION_ISA_ABM
13265 #define TARGET_POPCNT OPTION_ISA_POPCNT
13266 #define TARGET_SAHF OPTION_ISA_SAHF
13267 +#define TARGET_MOVBE OPTION_ISA_MOVBE
13268 #define TARGET_AES OPTION_ISA_AES
13269 #define TARGET_PCLMUL OPTION_ISA_PCLMUL
13270 #define TARGET_CMPXCHG16B OPTION_ISA_CX16
13271 @@ -236,6 +237,7 @@
13272 #define TARGET_GENERIC64 (ix86_tune == PROCESSOR_GENERIC64)
13273 #define TARGET_GENERIC (TARGET_GENERIC32 || TARGET_GENERIC64)
13274 #define TARGET_AMDFAM10 (ix86_tune == PROCESSOR_AMDFAM10)
13275 +#define TARGET_ATOM (ix86_tune == PROCESSOR_ATOM)
13276
13277 /* Feature tests against the various tunings. */
13278 enum ix86_tune_indices {
13279 @@ -300,6 +302,7 @@
13280 X86_TUNE_USE_VECTOR_FP_CONVERTS,
13281 X86_TUNE_USE_VECTOR_CONVERTS,
13282 X86_TUNE_FUSE_CMP_AND_BRANCH,
13283 + X86_TUNE_OPT_AGU,
13284
13285 X86_TUNE_LAST
13286 };
13287 @@ -387,6 +390,7 @@
13288 ix86_tune_features[X86_TUNE_USE_VECTOR_CONVERTS]
13289 #define TARGET_FUSE_CMP_AND_BRANCH \
13290 ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH]
13291 +#define TARGET_OPT_AGU ix86_tune_features[X86_TUNE_OPT_AGU]
13292
13293 /* Feature tests against the various architecture variations. */
13294 enum ix86_arch_indices {
13295 @@ -470,7 +474,10 @@
13296 MS_ABI = 1
13297 };
13298
13299 -/* The default abi form used by target. */
13300 +/* The abi used by target. */
13301 +extern enum calling_abi ix86_abi;
13302 +
13303 +/* The default abi used by target. */
13304 #define DEFAULT_ABI SYSV_ABI
13305
13306 /* Subtargets may reset this to 1 in order to enable 96-bit long double
13307 @@ -569,6 +576,7 @@
13308 TARGET_CPU_DEFAULT_prescott,
13309 TARGET_CPU_DEFAULT_nocona,
13310 TARGET_CPU_DEFAULT_core2,
13311 + TARGET_CPU_DEFAULT_atom,
13312
13313 TARGET_CPU_DEFAULT_geode,
13314 TARGET_CPU_DEFAULT_k6,
13315 @@ -658,7 +666,7 @@
13316
13317 /* Boundary (in *bits*) on which stack pointer should be aligned. */
13318 #define STACK_BOUNDARY \
13319 - (TARGET_64BIT && DEFAULT_ABI == MS_ABI ? 128 : BITS_PER_WORD)
13320 + (TARGET_64BIT && ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
13321
13322 /* Stack boundary of the main function guaranteed by OS. */
13323 #define MAIN_STACK_BOUNDARY (TARGET_64BIT ? 128 : 32)
13324 @@ -1584,7 +1592,7 @@
13325 int maybe_vaarg; /* true for calls to possibly vardic fncts. */
13326 int float_in_sse; /* 1 if in 32-bit mode SFmode (2 for DFmode) should
13327 be passed in SSE registers. Otherwise 0. */
13328 - int call_abi; /* Set to SYSV_ABI for sysv abi. Otherwise
13329 + enum calling_abi call_abi; /* Set to SYSV_ABI for sysv abi. Otherwise
13330 MS_ABI for ms abi. */
13331 } CUMULATIVE_ARGS;
13332
13333 @@ -2230,6 +2238,7 @@
13334 PROCESSOR_GENERIC32,
13335 PROCESSOR_GENERIC64,
13336 PROCESSOR_AMDFAM10,
13337 + PROCESSOR_ATOM,
13338 PROCESSOR_max
13339 };
13340
13341 @@ -2403,7 +2412,7 @@
13342 int tls_descriptor_call_expanded_p;
13343 /* This value is used for amd64 targets and specifies the current abi
13344 to be used. MS_ABI means ms abi. Otherwise SYSV_ABI means sysv abi. */
13345 - int call_abi;
13346 + enum calling_abi call_abi;
13347 };
13348
13349 #define ix86_stack_locals (cfun->machine->stack_locals)
13350 diff -Nur a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
13351 --- a/gcc/config/i386/i386.md 2009-07-08 18:59:15.000000000 +0200
13352 +++ b/gcc/config/i386/i386.md 2010-01-25 09:50:29.015687523 +0100
13353 @@ -316,7 +316,7 @@
13354
13355 \f
13356 ;; Processor type.
13357 -(define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,
13358 +(define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,atom,
13359 generic64,amdfam10"
13360 (const (symbol_ref "ix86_schedule")))
13361
13362 @@ -612,6 +612,12 @@
13363 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
13364 (const_string "any"))
13365
13366 +;; Define attribute to classify add/sub insns that consumes carry flag (CF)
13367 +(define_attr "use_carry" "0,1" (const_string "0"))
13368 +
13369 +;; Define attribute to indicate unaligned ssemov insns
13370 +(define_attr "movu" "0,1" (const_string "0"))
13371 +
13372 ;; Describe a user's asm statement.
13373 (define_asm_attributes
13374 [(set_attr "length" "128")
13375 @@ -727,6 +733,7 @@
13376 (include "k6.md")
13377 (include "athlon.md")
13378 (include "geode.md")
13379 +(include "atom.md")
13380
13381 \f
13382 ;; Operand and operator predicates and constraints
13383 @@ -5790,6 +5797,7 @@
13384 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
13385 "adc{q}\t{%2, %0|%0, %2}"
13386 [(set_attr "type" "alu")
13387 + (set_attr "use_carry" "1")
13388 (set_attr "pent_pair" "pu")
13389 (set_attr "mode" "DI")])
13390
13391 @@ -5864,6 +5872,7 @@
13392 "ix86_binary_operator_ok (PLUS, QImode, operands)"
13393 "adc{b}\t{%2, %0|%0, %2}"
13394 [(set_attr "type" "alu")
13395 + (set_attr "use_carry" "1")
13396 (set_attr "pent_pair" "pu")
13397 (set_attr "mode" "QI")])
13398
13399 @@ -5876,6 +5885,7 @@
13400 "ix86_binary_operator_ok (PLUS, HImode, operands)"
13401 "adc{w}\t{%2, %0|%0, %2}"
13402 [(set_attr "type" "alu")
13403 + (set_attr "use_carry" "1")
13404 (set_attr "pent_pair" "pu")
13405 (set_attr "mode" "HI")])
13406
13407 @@ -5888,6 +5898,7 @@
13408 "ix86_binary_operator_ok (PLUS, SImode, operands)"
13409 "adc{l}\t{%2, %0|%0, %2}"
13410 [(set_attr "type" "alu")
13411 + (set_attr "use_carry" "1")
13412 (set_attr "pent_pair" "pu")
13413 (set_attr "mode" "SI")])
13414
13415 @@ -5901,6 +5912,7 @@
13416 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
13417 "adc{l}\t{%2, %k0|%k0, %2}"
13418 [(set_attr "type" "alu")
13419 + (set_attr "use_carry" "1")
13420 (set_attr "pent_pair" "pu")
13421 (set_attr "mode" "SI")])
13422
13423 @@ -6130,9 +6142,9 @@
13424 (set_attr "mode" "SI")])
13425
13426 (define_insn "*adddi_1_rex64"
13427 - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r")
13428 - (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,r")
13429 - (match_operand:DI 2 "x86_64_general_operand" "rme,re,le")))
13430 + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r,r")
13431 + (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,r,r")
13432 + (match_operand:DI 2 "x86_64_general_operand" "rme,re,0,le")))
13433 (clobber (reg:CC FLAGS_REG))]
13434 "TARGET_64BIT && ix86_binary_operator_ok (PLUS, DImode, operands)"
13435 {
13436 @@ -6153,6 +6165,10 @@
13437 }
13438
13439 default:
13440 + /* Use add as much as possible to replace lea for AGU optimization. */
13441 + if (which_alternative == 2 && TARGET_OPT_AGU)
13442 + return "add{q}\t{%1, %0|%0, %1}";
13443 +
13444 gcc_assert (rtx_equal_p (operands[0], operands[1]));
13445
13446 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
13447 @@ -6171,8 +6187,11 @@
13448 }
13449 }
13450 [(set (attr "type")
13451 - (cond [(eq_attr "alternative" "2")
13452 + (cond [(and (eq_attr "alternative" "2")
13453 + (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0)))
13454 (const_string "lea")
13455 + (eq_attr "alternative" "3")
13456 + (const_string "lea")
13457 ; Current assemblers are broken and do not allow @GOTOFF in
13458 ; ought but a memory context.
13459 (match_operand:DI 2 "pic_symbolic_operand" "")
13460 @@ -6189,8 +6208,8 @@
13461 (plus:DI (match_operand:DI 1 "register_operand" "")
13462 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
13463 (clobber (reg:CC FLAGS_REG))]
13464 - "TARGET_64BIT && reload_completed
13465 - && true_regnum (operands[0]) != true_regnum (operands[1])"
13466 + "TARGET_64BIT && reload_completed
13467 + && ix86_lea_for_add_ok (PLUS, insn, operands)"
13468 [(set (match_dup 0)
13469 (plus:DI (match_dup 1)
13470 (match_dup 2)))]
13471 @@ -6394,9 +6413,9 @@
13472
13473
13474 (define_insn "*addsi_1"
13475 - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r")
13476 - (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r")
13477 - (match_operand:SI 2 "general_operand" "g,ri,li")))
13478 + [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r,r")
13479 + (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r,r")
13480 + (match_operand:SI 2 "general_operand" "g,ri,0,li")))
13481 (clobber (reg:CC FLAGS_REG))]
13482 "ix86_binary_operator_ok (PLUS, SImode, operands)"
13483 {
13484 @@ -6417,6 +6436,10 @@
13485 }
13486
13487 default:
13488 + /* Use add as much as possible to replace lea for AGU optimization. */
13489 + if (which_alternative == 2 && TARGET_OPT_AGU)
13490 + return "add{l}\t{%1, %0|%0, %1}";
13491 +
13492 gcc_assert (rtx_equal_p (operands[0], operands[1]));
13493
13494 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
13495 @@ -6433,7 +6456,10 @@
13496 }
13497 }
13498 [(set (attr "type")
13499 - (cond [(eq_attr "alternative" "2")
13500 + (cond [(and (eq_attr "alternative" "2")
13501 + (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0)))
13502 + (const_string "lea")
13503 + (eq_attr "alternative" "3")
13504 (const_string "lea")
13505 ; Current assemblers are broken and do not allow @GOTOFF in
13506 ; ought but a memory context.
13507 @@ -6451,8 +6477,7 @@
13508 (plus (match_operand 1 "register_operand" "")
13509 (match_operand 2 "nonmemory_operand" "")))
13510 (clobber (reg:CC FLAGS_REG))]
13511 - "reload_completed
13512 - && true_regnum (operands[0]) != true_regnum (operands[1])"
13513 + "reload_completed && ix86_lea_for_add_ok (PLUS, insn, operands)"
13514 [(const_int 0)]
13515 {
13516 rtx pat;
13517 @@ -7553,6 +7578,7 @@
13518 "TARGET_64BIT && ix86_binary_operator_ok (MINUS, DImode, operands)"
13519 "sbb{q}\t{%2, %0|%0, %2}"
13520 [(set_attr "type" "alu")
13521 + (set_attr "use_carry" "1")
13522 (set_attr "pent_pair" "pu")
13523 (set_attr "mode" "DI")])
13524
13525 @@ -7601,6 +7627,7 @@
13526 "ix86_binary_operator_ok (MINUS, QImode, operands)"
13527 "sbb{b}\t{%2, %0|%0, %2}"
13528 [(set_attr "type" "alu")
13529 + (set_attr "use_carry" "1")
13530 (set_attr "pent_pair" "pu")
13531 (set_attr "mode" "QI")])
13532
13533 @@ -7613,6 +7640,7 @@
13534 "ix86_binary_operator_ok (MINUS, HImode, operands)"
13535 "sbb{w}\t{%2, %0|%0, %2}"
13536 [(set_attr "type" "alu")
13537 + (set_attr "use_carry" "1")
13538 (set_attr "pent_pair" "pu")
13539 (set_attr "mode" "HI")])
13540
13541 @@ -7625,6 +7653,7 @@
13542 "ix86_binary_operator_ok (MINUS, SImode, operands)"
13543 "sbb{l}\t{%2, %0|%0, %2}"
13544 [(set_attr "type" "alu")
13545 + (set_attr "use_carry" "1")
13546 (set_attr "pent_pair" "pu")
13547 (set_attr "mode" "SI")])
13548
13549 @@ -15155,7 +15184,7 @@
13550 ? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
13551 operands[0], const0_rtx,
13552 GEN_INT ((TARGET_64BIT
13553 - ? (DEFAULT_ABI == SYSV_ABI
13554 + ? (ix86_abi == SYSV_ABI
13555 ? X86_64_SSE_REGPARM_MAX
13556 : X64_SSE_REGPARM_MAX)
13557 : X86_32_SSE_REGPARM_MAX)
13558 @@ -15235,6 +15264,7 @@
13559 "reload_completed"
13560 "ret"
13561 [(set_attr "length" "1")
13562 + (set_attr "atom_unit" "jeu")
13563 (set_attr "length_immediate" "0")
13564 (set_attr "modrm" "0")])
13565
13566 @@ -15247,6 +15277,7 @@
13567 "reload_completed"
13568 "rep\;ret"
13569 [(set_attr "length" "1")
13570 + (set_attr "atom_unit" "jeu")
13571 (set_attr "length_immediate" "0")
13572 (set_attr "prefix_rep" "1")
13573 (set_attr "modrm" "0")])
13574 @@ -15257,6 +15288,7 @@
13575 "reload_completed"
13576 "ret\t%0"
13577 [(set_attr "length" "3")
13578 + (set_attr "atom_unit" "jeu")
13579 (set_attr "length_immediate" "2")
13580 (set_attr "modrm" "0")])
13581
13582 @@ -15610,7 +15642,7 @@
13583 (bswap:SI (match_operand:SI 1 "register_operand" "")))]
13584 ""
13585 {
13586 - if (!TARGET_BSWAP)
13587 + if (!(TARGET_BSWAP || TARGET_MOVBE))
13588 {
13589 rtx x = operands[0];
13590
13591 @@ -15622,6 +15654,21 @@
13592 }
13593 })
13594
13595 +(define_insn "*bswapsi_movbe"
13596 + [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m")
13597 + (bswap:SI (match_operand:SI 1 "nonimmediate_operand" "0,m,r")))]
13598 + "TARGET_MOVBE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13599 + "@
13600 + bswap\t%0
13601 + movbe\t{%1, %0|%0, %1}
13602 + movbe\t{%1, %0|%0, %1}"
13603 + [(set_attr "type" "*,imov,imov")
13604 + (set_attr "modrm" "*,1,1")
13605 + (set_attr "prefix_0f" "1")
13606 + (set_attr "prefix_extra" "*,1,1")
13607 + (set_attr "length" "2,*,*")
13608 + (set_attr "mode" "SI")])
13609 +
13610 (define_insn "*bswapsi_1"
13611 [(set (match_operand:SI 0 "register_operand" "=r")
13612 (bswap:SI (match_operand:SI 1 "register_operand" "0")))]
13613 @@ -15650,7 +15697,29 @@
13614 [(set_attr "length" "4")
13615 (set_attr "mode" "HI")])
13616
13617 -(define_insn "bswapdi2"
13618 +(define_expand "bswapdi2"
13619 + [(set (match_operand:DI 0 "register_operand" "")
13620 + (bswap:DI (match_operand:DI 1 "register_operand" "")))]
13621 + "TARGET_64BIT"
13622 + "")
13623 +
13624 +(define_insn "*bswapdi_movbe"
13625 + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m")
13626 + (bswap:DI (match_operand:DI 1 "nonimmediate_operand" "0,m,r")))]
13627 + "TARGET_64BIT && TARGET_MOVBE
13628 + && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13629 + "@
13630 + bswap\t%0
13631 + movbe\t{%1, %0|%0, %1}
13632 + movbe\t{%1, %0|%0, %1}"
13633 + [(set_attr "type" "*,imov,imov")
13634 + (set_attr "modrm" "*,1,1")
13635 + (set_attr "prefix_0f" "1")
13636 + (set_attr "prefix_extra" "*,1,1")
13637 + (set_attr "length" "3,*,*")
13638 + (set_attr "mode" "DI")])
13639 +
13640 +(define_insn "*bswapdi_1"
13641 [(set (match_operand:DI 0 "register_operand" "=r")
13642 (bswap:DI (match_operand:DI 1 "register_operand" "0")))]
13643 "TARGET_64BIT"
13644 @@ -16378,6 +16447,7 @@
13645 "TARGET_SSE_MATH"
13646 "%vrcpss\t{%1, %d0|%d0, %1}"
13647 [(set_attr "type" "sse")
13648 + (set_attr "atom_sse_attr" "rcp")
13649 (set_attr "prefix" "maybe_vex")
13650 (set_attr "mode" "SF")])
13651
13652 @@ -16729,6 +16799,7 @@
13653 "TARGET_SSE_MATH"
13654 "%vrsqrtss\t{%1, %d0|%d0, %1}"
13655 [(set_attr "type" "sse")
13656 + (set_attr "atom_sse_attr" "rcp")
13657 (set_attr "prefix" "maybe_vex")
13658 (set_attr "mode" "SF")])
13659
13660 @@ -16749,6 +16820,7 @@
13661 "SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH"
13662 "%vsqrts<ssemodefsuffix>\t{%1, %d0|%d0, %1}"
13663 [(set_attr "type" "sse")
13664 + (set_attr "atom_sse_attr" "sqrt")
13665 (set_attr "prefix" "maybe_vex")
13666 (set_attr "mode" "<MODE>")
13667 (set_attr "athlon_decode" "*")
13668 @@ -19802,6 +19874,7 @@
13669 ; Since we don't have the proper number of operands for an alu insn,
13670 ; fill in all the blanks.
13671 [(set_attr "type" "alu")
13672 + (set_attr "use_carry" "1")
13673 (set_attr "pent_pair" "pu")
13674 (set_attr "memory" "none")
13675 (set_attr "imm_disp" "false")
13676 @@ -19817,6 +19890,7 @@
13677 ""
13678 "sbb{q}\t%0, %0"
13679 [(set_attr "type" "alu")
13680 + (set_attr "use_carry" "1")
13681 (set_attr "pent_pair" "pu")
13682 (set_attr "memory" "none")
13683 (set_attr "imm_disp" "false")
13684 @@ -19860,6 +19934,7 @@
13685 ; Since we don't have the proper number of operands for an alu insn,
13686 ; fill in all the blanks.
13687 [(set_attr "type" "alu")
13688 + (set_attr "use_carry" "1")
13689 (set_attr "pent_pair" "pu")
13690 (set_attr "memory" "none")
13691 (set_attr "imm_disp" "false")
13692 @@ -19875,6 +19950,7 @@
13693 ""
13694 "sbb{l}\t%0, %0"
13695 [(set_attr "type" "alu")
13696 + (set_attr "use_carry" "1")
13697 (set_attr "pent_pair" "pu")
13698 (set_attr "memory" "none")
13699 (set_attr "imm_disp" "false")
13700 @@ -20207,7 +20283,8 @@
13701 }
13702 }
13703 [(set (attr "type")
13704 - (cond [(eq_attr "alternative" "0")
13705 + (cond [(and (eq_attr "alternative" "0")
13706 + (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0)))
13707 (const_string "alu")
13708 (match_operand:SI 2 "const0_operand" "")
13709 (const_string "imov")
13710 @@ -20250,7 +20327,8 @@
13711 }
13712 }
13713 [(set (attr "type")
13714 - (cond [(eq_attr "alternative" "0")
13715 + (cond [(and (eq_attr "alternative" "0")
13716 + (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0)))
13717 (const_string "alu")
13718 (match_operand:DI 2 "const0_operand" "")
13719 (const_string "imov")
13720 @@ -21734,6 +21812,7 @@
13721 return patterns[locality];
13722 }
13723 [(set_attr "type" "sse")
13724 + (set_attr "atom_sse_attr" "prefetch")
13725 (set_attr "memory" "none")])
13726
13727 (define_insn "*prefetch_sse_rex"
13728 @@ -21752,6 +21831,7 @@
13729 return patterns[locality];
13730 }
13731 [(set_attr "type" "sse")
13732 + (set_attr "atom_sse_attr" "prefetch")
13733 (set_attr "memory" "none")])
13734
13735 (define_insn "*prefetch_3dnow"
13736 diff -Nur a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
13737 --- a/gcc/config/i386/i386.opt 2009-02-20 16:20:38.000000000 +0100
13738 +++ b/gcc/config/i386/i386.opt 2010-01-25 09:50:29.015687523 +0100
13739 @@ -228,6 +228,10 @@
13740 Target RejectNegative Joined Var(ix86_tune_string)
13741 Schedule code for given CPU
13742
13743 +mabi=
13744 +Target RejectNegative Joined Var(ix86_abi_string)
13745 +Generate code that conforms to the given ABI
13746 +
13747 mveclibabi=
13748 Target RejectNegative Joined Var(ix86_veclibabi_string)
13749 Vector library ABI to use
13750 @@ -335,6 +339,10 @@
13751 Target Report Mask(ISA_SAHF) Var(ix86_isa_flags) VarExists Save
13752 Support code generation of sahf instruction in 64bit x86-64 code.
13753
13754 +mmovbe
13755 +Target Report Mask(ISA_MOVBE) Var(ix86_isa_flags) VarExists Save
13756 +Support code generation of movbe instruction.
13757 +
13758 maes
13759 Target Report Mask(ISA_AES) Var(ix86_isa_flags) VarExists Save
13760 Support AES built-in functions and code generation
13761 diff -Nur a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
13762 --- a/gcc/config/i386/i386-protos.h 2009-07-11 21:06:26.000000000 +0200
13763 +++ b/gcc/config/i386/i386-protos.h 2010-01-25 09:50:29.015687523 +0100
13764 @@ -86,6 +86,9 @@
13765 extern void ix86_expand_binary_operator (enum rtx_code,
13766 enum machine_mode, rtx[]);
13767 extern int ix86_binary_operator_ok (enum rtx_code, enum machine_mode, rtx[]);
13768 +extern bool ix86_lea_for_add_ok (enum rtx_code, rtx, rtx[]);
13769 +extern bool ix86_dep_by_shift_count (const_rtx set_insn, const_rtx use_insn);
13770 +extern bool ix86_agi_dependent (rtx set_insn, rtx use_insn);
13771 extern void ix86_expand_unary_operator (enum rtx_code, enum machine_mode,
13772 rtx[]);
13773 extern rtx ix86_build_const_vector (enum machine_mode, bool, rtx);
13774 @@ -140,9 +143,8 @@
13775 extern bool ix86_sol10_return_in_memory (const_tree,const_tree);
13776 extern rtx ix86_force_to_memory (enum machine_mode, rtx);
13777 extern void ix86_free_from_memory (enum machine_mode);
13778 -extern int ix86_cfun_abi (void);
13779 -extern int ix86_function_abi (const_tree);
13780 -extern int ix86_function_type_abi (const_tree);
13781 +extern enum calling_abi ix86_cfun_abi (void);
13782 +extern enum calling_abi ix86_function_type_abi (const_tree);
13783 extern void ix86_call_abi_override (const_tree);
13784 extern tree ix86_fn_abi_va_list (tree);
13785 extern tree ix86_canonical_va_list_type (tree);
13786 diff -Nur a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
13787 --- a/gcc/config/i386/mingw32.h 2009-02-20 16:20:38.000000000 +0100
13788 +++ b/gcc/config/i386/mingw32.h 2010-01-25 09:50:29.015687523 +0100
13789 @@ -38,7 +38,7 @@
13790 builtin_define_std ("WINNT"); \
13791 builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
13792 TYPE_PRECISION (intmax_type_node));\
13793 - if (TARGET_64BIT && DEFAULT_ABI == MS_ABI) \
13794 + if (TARGET_64BIT && ix86_abi == MS_ABI) \
13795 { \
13796 builtin_define ("__MINGW64__"); \
13797 builtin_define_std ("WIN64"); \
13798 diff -Nur a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
13799 --- a/gcc/config/i386/sse.md 2009-05-06 15:20:41.000000000 +0200
13800 +++ b/gcc/config/i386/sse.md 2010-01-25 09:50:29.015687523 +0100
13801 @@ -338,6 +338,7 @@
13802 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13803 "vmovup<avxmodesuffixf2c>\t{%1, %0|%0, %1}"
13804 [(set_attr "type" "ssemov")
13805 + (set_attr "movu" "1")
13806 (set_attr "prefix" "vex")
13807 (set_attr "mode" "<MODE>")])
13808
13809 @@ -363,6 +364,7 @@
13810 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13811 "movup<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
13812 [(set_attr "type" "ssemov")
13813 + (set_attr "movu" "1")
13814 (set_attr "mode" "<MODE>")])
13815
13816 (define_insn "avx_movdqu<avxmodesuffix>"
13817 @@ -373,6 +375,7 @@
13818 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13819 "vmovdqu\t{%1, %0|%0, %1}"
13820 [(set_attr "type" "ssemov")
13821 + (set_attr "movu" "1")
13822 (set_attr "prefix" "vex")
13823 (set_attr "mode" "<avxvecmode>")])
13824
13825 @@ -383,6 +386,7 @@
13826 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13827 "movdqu\t{%1, %0|%0, %1}"
13828 [(set_attr "type" "ssemov")
13829 + (set_attr "movu" "1")
13830 (set_attr "prefix_data16" "1")
13831 (set_attr "mode" "TI")])
13832
13833 @@ -424,7 +428,7 @@
13834 UNSPEC_MOVNT))]
13835 "TARGET_SSE2"
13836 "movntdq\t{%1, %0|%0, %1}"
13837 - [(set_attr "type" "ssecvt")
13838 + [(set_attr "type" "ssemov")
13839 (set_attr "prefix_data16" "1")
13840 (set_attr "mode" "TI")])
13841
13842 @@ -434,7 +438,7 @@
13843 UNSPEC_MOVNT))]
13844 "TARGET_SSE2"
13845 "movnti\t{%1, %0|%0, %1}"
13846 - [(set_attr "type" "ssecvt")
13847 + [(set_attr "type" "ssemov")
13848 (set_attr "mode" "V2DF")])
13849
13850 (define_insn "avx_lddqu<avxmodesuffix>"
13851 @@ -445,6 +449,7 @@
13852 "TARGET_AVX"
13853 "vlddqu\t{%1, %0|%0, %1}"
13854 [(set_attr "type" "ssecvt")
13855 + (set_attr "movu" "1")
13856 (set_attr "prefix" "vex")
13857 (set_attr "mode" "<avxvecmode>")])
13858
13859 @@ -454,7 +459,8 @@
13860 UNSPEC_LDDQU))]
13861 "TARGET_SSE3"
13862 "lddqu\t{%1, %0|%0, %1}"
13863 - [(set_attr "type" "ssecvt")
13864 + [(set_attr "type" "ssemov")
13865 + (set_attr "movu" "1")
13866 (set_attr "prefix_rep" "1")
13867 (set_attr "mode" "TI")])
13868
13869 @@ -761,6 +767,7 @@
13870 "TARGET_SSE"
13871 "%vrcpps\t{%1, %0|%0, %1}"
13872 [(set_attr "type" "sse")
13873 + (set_attr "atom_sse_attr" "rcp")
13874 (set_attr "prefix" "maybe_vex")
13875 (set_attr "mode" "V4SF")])
13876
13877 @@ -787,6 +794,7 @@
13878 "TARGET_SSE"
13879 "rcpss\t{%1, %0|%0, %1}"
13880 [(set_attr "type" "sse")
13881 + (set_attr "atom_sse_attr" "rcp")
13882 (set_attr "mode" "SF")])
13883
13884 (define_expand "sqrtv8sf2"
13885 @@ -832,6 +840,7 @@
13886 "TARGET_SSE"
13887 "%vsqrtps\t{%1, %0|%0, %1}"
13888 [(set_attr "type" "sse")
13889 + (set_attr "atom_sse_attr" "sqrt")
13890 (set_attr "prefix" "maybe_vex")
13891 (set_attr "mode" "V4SF")])
13892
13893 @@ -876,6 +885,7 @@
13894 "SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
13895 "sqrts<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
13896 [(set_attr "type" "sse")
13897 + (set_attr "atom_sse_attr" "sqrt")
13898 (set_attr "mode" "<ssescalarmode>")])
13899
13900 (define_expand "rsqrtv8sf2"
13901 @@ -1039,7 +1049,7 @@
13902 (const_int 1)))]
13903 "SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
13904 "<maxminfprefix>s<ssemodesuffixf2c>\t{%2, %0|%0, %2}"
13905 - [(set_attr "type" "sse")
13906 + [(set_attr "type" "sseadd")
13907 (set_attr "mode" "<ssescalarmode>")])
13908
13909 ;; These versions of the min/max patterns implement exactly the operations
13910 @@ -1175,6 +1185,7 @@
13911 "TARGET_SSE3"
13912 "addsubpd\t{%2, %0|%0, %2}"
13913 [(set_attr "type" "sseadd")
13914 + (set_attr "atom_unit" "complex")
13915 (set_attr "mode" "V2DF")])
13916
13917 (define_insn "avx_h<plusminus_insn>v4df3"
13918 @@ -1298,6 +1309,7 @@
13919 "TARGET_SSE3"
13920 "h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}"
13921 [(set_attr "type" "sseadd")
13922 + (set_attr "atom_unit" "complex")
13923 (set_attr "prefix_rep" "1")
13924 (set_attr "mode" "V4SF")])
13925
13926 @@ -5066,6 +5078,7 @@
13927 "TARGET_SSE2 && ix86_binary_operator_ok (MULT, V8HImode, operands)"
13928 "pmaddwd\t{%2, %0|%0, %2}"
13929 [(set_attr "type" "sseiadd")
13930 + (set_attr "atom_unit" "simul")
13931 (set_attr "prefix_data16" "1")
13932 (set_attr "mode" "TI")])
13933
13934 @@ -7025,6 +7038,7 @@
13935 movq\t{%H1, %0|%0, %H1}
13936 mov{q}\t{%H1, %0|%0, %H1}"
13937 [(set_attr "type" "ssemov,sseishft,ssemov,imov")
13938 + (set_attr "atom_unit" "*,sishuf,*,*")
13939 (set_attr "memory" "*,none,*,*")
13940 (set_attr "mode" "V2SF,TI,TI,DI")])
13941
13942 @@ -7057,6 +7071,7 @@
13943 psrldq\t{$8, %0|%0, 8}
13944 movq\t{%H1, %0|%0, %H1}"
13945 [(set_attr "type" "ssemov,sseishft,ssemov")
13946 + (set_attr "atom_unit" "*,sishuf,*")
13947 (set_attr "memory" "*,none,*")
13948 (set_attr "mode" "V2SF,TI,TI")])
13949
13950 @@ -7614,6 +7629,7 @@
13951 "TARGET_SSE2"
13952 "psadbw\t{%2, %0|%0, %2}"
13953 [(set_attr "type" "sseiadd")
13954 + (set_attr "atom_unit" "simul")
13955 (set_attr "prefix_data16" "1")
13956 (set_attr "mode" "TI")])
13957
13958 @@ -7635,7 +7651,7 @@
13959 UNSPEC_MOVMSK))]
13960 "SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
13961 "%vmovmskp<ssemodesuffixf2c>\t{%1, %0|%0, %1}"
13962 - [(set_attr "type" "ssecvt")
13963 + [(set_attr "type" "ssemov")
13964 (set_attr "prefix" "maybe_vex")
13965 (set_attr "mode" "<MODE>")])
13966
13967 @@ -7645,7 +7661,7 @@
13968 UNSPEC_MOVMSK))]
13969 "TARGET_SSE2"
13970 "%vpmovmskb\t{%1, %0|%0, %1}"
13971 - [(set_attr "type" "ssecvt")
13972 + [(set_attr "type" "ssemov")
13973 (set_attr "prefix_data16" "1")
13974 (set_attr "prefix" "maybe_vex")
13975 (set_attr "mode" "SI")])
13976 @@ -7668,7 +7684,7 @@
13977 "TARGET_SSE2 && !TARGET_64BIT"
13978 ;; @@@ check ordering of operands in intel/nonintel syntax
13979 "%vmaskmovdqu\t{%2, %1|%1, %2}"
13980 - [(set_attr "type" "ssecvt")
13981 + [(set_attr "type" "ssemov")
13982 (set_attr "prefix_data16" "1")
13983 (set_attr "prefix" "maybe_vex")
13984 (set_attr "mode" "TI")])
13985 @@ -7682,7 +7698,7 @@
13986 "TARGET_SSE2 && TARGET_64BIT"
13987 ;; @@@ check ordering of operands in intel/nonintel syntax
13988 "%vmaskmovdqu\t{%2, %1|%1, %2}"
13989 - [(set_attr "type" "ssecvt")
13990 + [(set_attr "type" "ssemov")
13991 (set_attr "prefix_data16" "1")
13992 (set_attr "prefix" "maybe_vex")
13993 (set_attr "mode" "TI")])
13994 @@ -7693,6 +7709,7 @@
13995 "TARGET_SSE"
13996 "%vldmxcsr\t%0"
13997 [(set_attr "type" "sse")
13998 + (set_attr "atom_sse_attr" "mxcsr")
13999 (set_attr "prefix" "maybe_vex")
14000 (set_attr "memory" "load")])
14001
14002 @@ -7702,6 +7719,7 @@
14003 "TARGET_SSE"
14004 "%vstmxcsr\t%0"
14005 [(set_attr "type" "sse")
14006 + (set_attr "atom_sse_attr" "mxcsr")
14007 (set_attr "prefix" "maybe_vex")
14008 (set_attr "memory" "store")])
14009
14010 @@ -7720,6 +7738,7 @@
14011 "TARGET_SSE || TARGET_3DNOW_A"
14012 "sfence"
14013 [(set_attr "type" "sse")
14014 + (set_attr "atom_sse_attr" "fence")
14015 (set_attr "memory" "unknown")])
14016
14017 (define_insn "sse2_clflush"
14018 @@ -7728,6 +7747,7 @@
14019 "TARGET_SSE2"
14020 "clflush\t%a0"
14021 [(set_attr "type" "sse")
14022 + (set_attr "atom_sse_attr" "fence")
14023 (set_attr "memory" "unknown")])
14024
14025 (define_expand "sse2_mfence"
14026 @@ -7745,6 +7765,7 @@
14027 "TARGET_64BIT || TARGET_SSE2"
14028 "mfence"
14029 [(set_attr "type" "sse")
14030 + (set_attr "atom_sse_attr" "fence")
14031 (set_attr "memory" "unknown")])
14032
14033 (define_expand "sse2_lfence"
14034 @@ -7762,6 +7783,7 @@
14035 "TARGET_SSE2"
14036 "lfence"
14037 [(set_attr "type" "sse")
14038 + (set_attr "atom_sse_attr" "lfence")
14039 (set_attr "memory" "unknown")])
14040
14041 (define_insn "sse3_mwait"
14042 @@ -7885,6 +7907,7 @@
14043 "TARGET_SSSE3"
14044 "phaddw\t{%2, %0|%0, %2}"
14045 [(set_attr "type" "sseiadd")
14046 + (set_attr "atom_unit" "complex")
14047 (set_attr "prefix_data16" "1")
14048 (set_attr "prefix_extra" "1")
14049 (set_attr "mode" "TI")])
14050 @@ -7913,6 +7936,7 @@
14051 "TARGET_SSSE3"
14052 "phaddw\t{%2, %0|%0, %2}"
14053 [(set_attr "type" "sseiadd")
14054 + (set_attr "atom_unit" "complex")
14055 (set_attr "prefix_extra" "1")
14056 (set_attr "mode" "DI")])
14057
14058 @@ -7967,6 +7991,7 @@
14059 "TARGET_SSSE3"
14060 "phaddd\t{%2, %0|%0, %2}"
14061 [(set_attr "type" "sseiadd")
14062 + (set_attr "atom_unit" "complex")
14063 (set_attr "prefix_data16" "1")
14064 (set_attr "prefix_extra" "1")
14065 (set_attr "mode" "TI")])
14066 @@ -7987,6 +8012,7 @@
14067 "TARGET_SSSE3"
14068 "phaddd\t{%2, %0|%0, %2}"
14069 [(set_attr "type" "sseiadd")
14070 + (set_attr "atom_unit" "complex")
14071 (set_attr "prefix_extra" "1")
14072 (set_attr "mode" "DI")])
14073
14074 @@ -8073,6 +8099,7 @@
14075 "TARGET_SSSE3"
14076 "phaddsw\t{%2, %0|%0, %2}"
14077 [(set_attr "type" "sseiadd")
14078 + (set_attr "atom_unit" "complex")
14079 (set_attr "prefix_data16" "1")
14080 (set_attr "prefix_extra" "1")
14081 (set_attr "mode" "TI")])
14082 @@ -8101,6 +8128,7 @@
14083 "TARGET_SSSE3"
14084 "phaddsw\t{%2, %0|%0, %2}"
14085 [(set_attr "type" "sseiadd")
14086 + (set_attr "atom_unit" "complex")
14087 (set_attr "prefix_extra" "1")
14088 (set_attr "mode" "DI")])
14089
14090 @@ -8187,6 +8215,7 @@
14091 "TARGET_SSSE3"
14092 "phsubw\t{%2, %0|%0, %2}"
14093 [(set_attr "type" "sseiadd")
14094 + (set_attr "atom_unit" "complex")
14095 (set_attr "prefix_data16" "1")
14096 (set_attr "prefix_extra" "1")
14097 (set_attr "mode" "TI")])
14098 @@ -8215,6 +8244,7 @@
14099 "TARGET_SSSE3"
14100 "phsubw\t{%2, %0|%0, %2}"
14101 [(set_attr "type" "sseiadd")
14102 + (set_attr "atom_unit" "complex")
14103 (set_attr "prefix_extra" "1")
14104 (set_attr "mode" "DI")])
14105
14106 @@ -8269,6 +8299,7 @@
14107 "TARGET_SSSE3"
14108 "phsubd\t{%2, %0|%0, %2}"
14109 [(set_attr "type" "sseiadd")
14110 + (set_attr "atom_unit" "complex")
14111 (set_attr "prefix_data16" "1")
14112 (set_attr "prefix_extra" "1")
14113 (set_attr "mode" "TI")])
14114 @@ -8289,6 +8320,7 @@
14115 "TARGET_SSSE3"
14116 "phsubd\t{%2, %0|%0, %2}"
14117 [(set_attr "type" "sseiadd")
14118 + (set_attr "atom_unit" "complex")
14119 (set_attr "prefix_extra" "1")
14120 (set_attr "mode" "DI")])
14121
14122 @@ -8375,6 +8407,7 @@
14123 "TARGET_SSSE3"
14124 "phsubsw\t{%2, %0|%0, %2}"
14125 [(set_attr "type" "sseiadd")
14126 + (set_attr "atom_unit" "complex")
14127 (set_attr "prefix_data16" "1")
14128 (set_attr "prefix_extra" "1")
14129 (set_attr "mode" "TI")])
14130 @@ -8403,6 +8436,7 @@
14131 "TARGET_SSSE3"
14132 "phsubsw\t{%2, %0|%0, %2}"
14133 [(set_attr "type" "sseiadd")
14134 + (set_attr "atom_unit" "complex")
14135 (set_attr "prefix_extra" "1")
14136 (set_attr "mode" "DI")])
14137
14138 @@ -8509,6 +8543,7 @@
14139 "TARGET_SSSE3"
14140 "pmaddubsw\t{%2, %0|%0, %2}"
14141 [(set_attr "type" "sseiadd")
14142 + (set_attr "atom_unit" "simul")
14143 (set_attr "prefix_data16" "1")
14144 (set_attr "prefix_extra" "1")
14145 (set_attr "mode" "TI")])
14146 @@ -8547,6 +8582,7 @@
14147 "TARGET_SSSE3"
14148 "pmaddubsw\t{%2, %0|%0, %2}"
14149 [(set_attr "type" "sseiadd")
14150 + (set_attr "atom_unit" "simul")
14151 (set_attr "prefix_extra" "1")
14152 (set_attr "mode" "DI")])
14153
14154 @@ -8754,6 +8790,7 @@
14155 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14156 }
14157 [(set_attr "type" "sseishft")
14158 + (set_attr "atom_unit" "sishuf")
14159 (set_attr "prefix_data16" "1")
14160 (set_attr "prefix_extra" "1")
14161 (set_attr "mode" "TI")])
14162 @@ -8770,6 +8807,7 @@
14163 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14164 }
14165 [(set_attr "type" "sseishft")
14166 + (set_attr "atom_unit" "sishuf")
14167 (set_attr "prefix_extra" "1")
14168 (set_attr "mode" "DI")])
14169
14170 @@ -8956,7 +8994,7 @@
14171 UNSPEC_MOVNTDQA))]
14172 "TARGET_SSE4_1"
14173 "%vmovntdqa\t{%1, %0|%0, %1}"
14174 - [(set_attr "type" "ssecvt")
14175 + [(set_attr "type" "ssemov")
14176 (set_attr "prefix_extra" "1")
14177 (set_attr "prefix" "maybe_vex")
14178 (set_attr "mode" "TI")])
14179 diff -Nur a/gcc/config/i386/t-cs-linux b/gcc/config/i386/t-cs-linux
14180 --- a/gcc/config/i386/t-cs-linux 1970-01-01 01:00:00.000000000 +0100
14181 +++ b/gcc/config/i386/t-cs-linux 2010-01-25 09:50:29.015687523 +0100
14182 @@ -0,0 +1,25 @@
14183 +# Sourcery G++ IA32 GNU/Linux Configuration.
14184 +# Copyright (C) 2007
14185 +# Free Software Foundation, Inc.
14186 +#
14187 +# This file is part of GCC.
14188 +#
14189 +# GCC is free software; you can redistribute it and/or modify
14190 +# it under the terms of the GNU General Public License as published by
14191 +# the Free Software Foundation; either version 3, or (at your option)
14192 +# any later version.
14193 +#
14194 +# GCC is distributed in the hope that it will be useful,
14195 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
14196 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14197 +# GNU General Public License for more details.
14198 +#
14199 +# You should have received a copy of the GNU General Public License
14200 +# along with GCC; see the file COPYING3. If not see
14201 +# <http://www.gnu.org/licenses/>.
14202 +
14203 +MULTILIB_OPTIONS = m64/m32 msgxx-glibc/mrh73/mrhel3
14204 +MULTILIB_DIRNAMES = 64 32 sgxx-glibc rh73 rhel3
14205 +MULTILIB_OSDIRNAMES = ../lib64 ../lib sgxx-glibc rh73 rhel3
14206 +MULTILIB_EXCEPTIONS = m64/mrh73 m64/mrhel3
14207 +
14208 diff -Nur a/gcc/config/i386/t-cs-linux-lite b/gcc/config/i386/t-cs-linux-lite
14209 --- a/gcc/config/i386/t-cs-linux-lite 1970-01-01 01:00:00.000000000 +0100
14210 +++ b/gcc/config/i386/t-cs-linux-lite 2010-01-25 09:50:29.015687523 +0100
14211 @@ -0,0 +1,26 @@
14212 +# Sourcery G++ Lite IA32 GNU/Linux Configuration.
14213 +# Copyright (C) 2009
14214 +# Free Software Foundation, Inc.
14215 +#
14216 +# This file is part of GCC.
14217 +#
14218 +# GCC is free software; you can redistribute it and/or modify
14219 +# it under the terms of the GNU General Public License as published by
14220 +# the Free Software Foundation; either version 3, or (at your option)
14221 +# any later version.
14222 +#
14223 +# GCC is distributed in the hope that it will be useful,
14224 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
14225 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14226 +# GNU General Public License for more details.
14227 +#
14228 +# You should have received a copy of the GNU General Public License
14229 +# along with GCC; see the file COPYING3. If not see
14230 +# <http://www.gnu.org/licenses/>.
14231 +
14232 +MULTILIB_OPTIONS = m64 march=atom/march=core2
14233 +MULTILIB_DIRNAMES = 64 atom core2
14234 +MULTILIB_EXCEPTIONS = m64/march=atom march=core2
14235 +MULTILIB_ALIASES = m64=m64/march?atom
14236 +MULTILIB_OSDIRNAMES = m64=../lib64 march.atom=atom m64/march.core2=../lib64/core2
14237 +
14238 diff -Nur a/gcc/config/i386/t-wrs-linux b/gcc/config/i386/t-wrs-linux
14239 --- a/gcc/config/i386/t-wrs-linux 1970-01-01 01:00:00.000000000 +0100
14240 +++ b/gcc/config/i386/t-wrs-linux 2010-01-25 09:50:29.015687523 +0100
14241 @@ -0,0 +1,24 @@
14242 +# Wind River GNU/Linux Configuration.
14243 +# Copyright (C) 2009
14244 +# Free Software Foundation, Inc.
14245 +#
14246 +# This file is part of GCC.
14247 +#
14248 +# GCC is free software; you can redistribute it and/or modify
14249 +# it under the terms of the GNU General Public License as published by
14250 +# the Free Software Foundation; either version 3, or (at your option)
14251 +# any later version.
14252 +#
14253 +# GCC is distributed in the hope that it will be useful,
14254 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
14255 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14256 +# GNU General Public License for more details.
14257 +#
14258 +# You should have received a copy of the GNU General Public License
14259 +# along with GCC; see the file COPYING3. If not see
14260 +# <http://www.gnu.org/licenses/>.
14261 +
14262 +MULTILIB_OPTIONS = m64/m32 msystem-glibc
14263 +MULTILIB_DIRNAMES = 64 32 system-glibc
14264 +MULTILIB_OSDIRNAMES = ../lib64 ../lib system-glibc
14265 +MULTILIB_EXCEPTIONS = m64/msystem-glibc
14266 diff -Nur a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
14267 --- a/gcc/config/i386/winnt.c 2009-02-21 04:21:44.000000000 +0100
14268 +++ b/gcc/config/i386/winnt.c 2010-01-25 09:50:29.015687523 +0100
14269 @@ -499,8 +499,11 @@
14270 {
14271 HOST_WIDE_INT rounded;
14272
14273 - /* Compute as in assemble_noswitch_variable, since we don't actually
14274 - support aligned common. */
14275 + /* Compute as in assemble_noswitch_variable, since we don't have
14276 + support for aligned common on older binutils. We must also
14277 + avoid emitting a common symbol of size zero, as this is the
14278 + overloaded representation that indicates an undefined external
14279 + symbol in the PE object file format. */
14280 rounded = size ? size : 1;
14281 rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;
14282 rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
14283 @@ -510,9 +513,13 @@
14284
14285 fprintf (stream, "\t.comm\t");
14286 assemble_name (stream, name);
14287 - fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC "\t" ASM_COMMENT_START
14288 - " " HOST_WIDE_INT_PRINT_DEC "\n",
14289 - rounded, size);
14290 + if (use_pe_aligned_common)
14291 + fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC ", %d\n",
14292 + size ? size : (HOST_WIDE_INT) 1,
14293 + exact_log2 (align) - exact_log2 (CHAR_BIT));
14294 + else
14295 + fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC "\t" ASM_COMMENT_START
14296 + " " HOST_WIDE_INT_PRINT_DEC "\n", rounded, size);
14297 }
14298 \f
14299 /* The Microsoft linker requires that every function be marked as
14300 diff -Nur a/gcc/config/i386/wrs-linux.h b/gcc/config/i386/wrs-linux.h
14301 --- a/gcc/config/i386/wrs-linux.h 1970-01-01 01:00:00.000000000 +0100
14302 +++ b/gcc/config/i386/wrs-linux.h 2010-01-25 09:50:29.015687523 +0100
14303 @@ -0,0 +1,33 @@
14304 +/* Wind River IA32 GNU/Linux Configuration.
14305 + Copyright (C) 2009
14306 + Free Software Foundation, Inc.
14307 +
14308 +This file is part of GCC.
14309 +
14310 +GCC is free software; you can redistribute it and/or modify
14311 +it under the terms of the GNU General Public License as published by
14312 +the Free Software Foundation; either version 3, or (at your option)
14313 +any later version.
14314 +
14315 +GCC is distributed in the hope that it will be useful,
14316 +but WITHOUT ANY WARRANTY; without even the implied warranty of
14317 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14318 +GNU General Public License for more details.
14319 +
14320 +You should have received a copy of the GNU General Public License
14321 +along with GCC; see the file COPYING3. If not see
14322 +<http://www.gnu.org/licenses/>. */
14323 +
14324 +#undef SYSROOT_SUFFIX_SPEC
14325 +#define SYSROOT_SUFFIX_SPEC \
14326 + "%{msystem-glibc:/system-glibc}"
14327 +
14328 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
14329 +#define SYSROOT_HEADERS_SUFFIX_SPEC SYSROOT_SUFFIX_SPEC
14330 +
14331 +/* See mips/wrs-linux.h for details on this use of
14332 + STARTFILE_PREFIX_SPEC. */
14333 +#undef STARTFILE_PREFIX_SPEC
14334 +#define STARTFILE_PREFIX_SPEC \
14335 + "%{m64: /usr/local/lib64/ /lib64/ /usr/lib64/} \
14336 + %{!m64: /usr/local/lib/ /lib/ /usr/lib/}"
14337 diff -Nur a/gcc/config/i386/wrs-linux.opt b/gcc/config/i386/wrs-linux.opt
14338 --- a/gcc/config/i386/wrs-linux.opt 1970-01-01 01:00:00.000000000 +0100
14339 +++ b/gcc/config/i386/wrs-linux.opt 2010-01-25 09:50:29.015687523 +0100
14340 @@ -0,0 +1,5 @@
14341 +; Additional options for Wind River Linux Sourcery G++.
14342 +
14343 +msystem-glibc
14344 +Target
14345 +Use system version of GLIBC
14346 diff -Nur a/gcc/config/m68k/constraints.md b/gcc/config/m68k/constraints.md
14347 --- a/gcc/config/m68k/constraints.md 2007-09-11 15:56:30.000000000 +0200
14348 +++ b/gcc/config/m68k/constraints.md 2010-01-25 09:50:29.015687523 +0100
14349 @@ -124,6 +124,11 @@
14350 (and (match_code "const_int")
14351 (match_test "ival < -0x8000 || ival > 0x7FFF")))
14352
14353 +(define_constraint "Cu"
14354 + "16-bit offset for wrapped symbols"
14355 + (and (match_code "const")
14356 + (match_test "m68k_unwrap_symbol (op, false) != op")))
14357 +
14358 (define_constraint "CQ"
14359 "Integers valid for mvq."
14360 (and (match_code "const_int")
14361 diff -Nur a/gcc/config/m68k/lb1sf68.asm b/gcc/config/m68k/lb1sf68.asm
14362 --- a/gcc/config/m68k/lb1sf68.asm 2009-04-10 01:23:07.000000000 +0200
14363 +++ b/gcc/config/m68k/lb1sf68.asm 2010-01-25 09:50:29.015687523 +0100
14364 @@ -163,6 +163,8 @@
14365 #if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
14366 lea \addr-.-8,a0
14367 jsr pc@(a0)
14368 +#elif defined (__mcfisab__) || defined (__mcfisac__)
14369 + bsr.l \addr
14370 #else
14371 bsr \addr
14372 #endif
14373 @@ -202,6 +204,8 @@
14374 #if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
14375 lea \addr-.-8,a0
14376 jsr pc@(a0)
14377 +#elif defined (__mcfisab__) || defined (__mcfisac__)
14378 + bsr.l \addr
14379 #else
14380 bsr \addr
14381 #endif
14382 diff -Nur a/gcc/config/m68k/linux-unwind.h b/gcc/config/m68k/linux-unwind.h
14383 --- a/gcc/config/m68k/linux-unwind.h 2009-04-10 01:23:07.000000000 +0200
14384 +++ b/gcc/config/m68k/linux-unwind.h 2010-01-25 09:50:29.015687523 +0100
14385 @@ -77,9 +77,15 @@
14386 fs->regs.reg[9].how = REG_SAVED_OFFSET;
14387 fs->regs.reg[9].loc.offset = (long) &sc->sc_a1 - cfa;
14388
14389 +#ifdef __uClinux__
14390 + fs->regs.reg[13].how = REG_SAVED_OFFSET;
14391 + fs->regs.reg[13].loc.offset = (long) &sc->sc_a5 - cfa;
14392 +#endif
14393 +
14394 fs->regs.reg[24].how = REG_SAVED_OFFSET;
14395 fs->regs.reg[24].loc.offset = (long) &sc->sc_pc - cfa;
14396
14397 +#if defined __mcffpu__ && !defined __uClinux__
14398 if (*(int *) sc->sc_fpstate)
14399 {
14400 int *fpregs = (int *) sc->sc_fpregs;
14401 @@ -89,11 +95,19 @@
14402 fs->regs.reg[17].how = REG_SAVED_OFFSET;
14403 fs->regs.reg[17].loc.offset = (long) &fpregs[M68K_FP_SIZE/4] - cfa;
14404 }
14405 +#elif defined __mcffpu__
14406 +# error Implement this when uClinux kernel is ported to an FPU architecture
14407 +#endif
14408 }
14409 #ifdef __mcoldfire__
14410 /* move.l #__NR_rt_sigreturn,%d0; trap #0 */
14411 - else if (pc[0] == 0x203c && pc[1] == 0x0000 &&
14412 - pc[2] == 0x00ad && pc[3] == 0x4e40)
14413 + else if ((pc[0] == 0x203c && pc[1] == 0x0000 &&
14414 + pc[2] == 0x00ad && pc[3] == 0x4e40) ||
14415 + /* Don't ask me why, this is just what some kernels do:
14416 + moveq #-__NR_rt_sigreturn,%d0; andil 0xff,%d0; trap #0;
14417 + Sigh... */
14418 + (pc[0] == 0x70ad && pc[1] == 0x0280 && pc[2] == 0x0000 &&
14419 + pc[3] == 0x00ff && pc[4] == 0x4e40 && pc[5] == 0x0000))
14420 #else
14421 /* moveq #~__NR_rt_sigreturn,%d0; not.b %d0; trap #0 */
14422 else if (pc[0] == 0x7052 && pc[1] == 0x4600 && pc[2] == 0x4e40)
14423 diff -Nur a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
14424 --- a/gcc/config/m68k/m68k.c 2008-11-19 17:24:10.000000000 +0100
14425 +++ b/gcc/config/m68k/m68k.c 2010-01-25 09:50:29.015687523 +0100
14426 @@ -46,6 +46,7 @@
14427 /* ??? Need to add a dependency between m68k.o and sched-int.h. */
14428 #include "sched-int.h"
14429 #include "insn-codes.h"
14430 +#include "ggc.h"
14431
14432 enum reg_class regno_reg_class[] =
14433 {
14434 @@ -146,10 +147,12 @@
14435 static void m68k_compute_frame_layout (void);
14436 static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
14437 static bool m68k_ok_for_sibcall_p (tree, tree);
14438 +static bool m68k_tls_symbol_p (rtx);
14439 static bool m68k_rtx_costs (rtx, int, int, int *, bool);
14440 #if M68K_HONOR_TARGET_STRICT_ALIGNMENT
14441 static bool m68k_return_in_memory (const_tree, const_tree);
14442 #endif
14443 +static void m68k_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
14444 \f
14445
14446 /* Specify the identification number of the library being built */
14447 @@ -252,6 +255,14 @@
14448 #define TARGET_RETURN_IN_MEMORY m68k_return_in_memory
14449 #endif
14450
14451 +#ifdef HAVE_AS_TLS
14452 +#undef TARGET_HAVE_TLS
14453 +#define TARGET_HAVE_TLS (true)
14454 +
14455 +#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
14456 +#define TARGET_ASM_OUTPUT_DWARF_DTPREL m68k_output_dwarf_dtprel
14457 +#endif
14458 +
14459 static const struct attribute_spec m68k_attribute_table[] =
14460 {
14461 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
14462 @@ -1150,8 +1161,7 @@
14463 current_frame.reg_mask, true, true));
14464 }
14465
14466 - if (flag_pic
14467 - && !TARGET_SEP_DATA
14468 + if (!TARGET_SEP_DATA
14469 && crtl->uses_pic_offset_table)
14470 insn = emit_insn (gen_load_got (pic_offset_table_rtx));
14471 }
14472 @@ -1425,6 +1435,86 @@
14473 return replace_equiv_address (x, gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM));
14474 }
14475
14476 +/* Convert X to a legitimate address and return it if successful. Otherwise
14477 + return X.
14478 +
14479 + For the 68000, we handle X+REG by loading X into a register R and
14480 + using R+REG. R will go in an address reg and indexing will be used.
14481 + However, if REG is a broken-out memory address or multiplication,
14482 + nothing needs to be done because REG can certainly go in an address reg. */
14483 +
14484 +rtx
14485 +m68k_legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
14486 +{
14487 + if (m68k_tls_symbol_p (x))
14488 + return m68k_legitimize_tls_address (x);
14489 +
14490 + if (GET_CODE (x) == PLUS)
14491 + {
14492 + int ch = (x) != (oldx);
14493 + int copied = 0;
14494 +
14495 +#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
14496 +
14497 + if (GET_CODE (XEXP (x, 0)) == MULT)
14498 + {
14499 + COPY_ONCE (x);
14500 + XEXP (x, 0) = force_operand (XEXP (x, 0), 0);
14501 + }
14502 + if (GET_CODE (XEXP (x, 1)) == MULT)
14503 + {
14504 + COPY_ONCE (x);
14505 + XEXP (x, 1) = force_operand (XEXP (x, 1), 0);
14506 + }
14507 + if (ch)
14508 + {
14509 + if (GET_CODE (XEXP (x, 1)) == REG
14510 + && GET_CODE (XEXP (x, 0)) == REG)
14511 + {
14512 + if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT)
14513 + {
14514 + COPY_ONCE (x);
14515 + x = force_operand (x, 0);
14516 + }
14517 + return x;
14518 + }
14519 + if (memory_address_p (mode, x))
14520 + return x;
14521 + }
14522 + if (GET_CODE (XEXP (x, 0)) == REG
14523 + || (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND
14524 + && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
14525 + && GET_MODE (XEXP (XEXP (x, 0), 0)) == HImode))
14526 + {
14527 + rtx temp = gen_reg_rtx (Pmode);
14528 + rtx val = force_operand (XEXP (x, 1), 0);
14529 + emit_move_insn (temp, val);
14530 + COPY_ONCE (x);
14531 + XEXP (x, 1) = temp;
14532 + if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT
14533 + && GET_CODE (XEXP (x, 0)) == REG)
14534 + x = force_operand (x, 0);
14535 + }
14536 + else if (GET_CODE (XEXP (x, 1)) == REG
14537 + || (GET_CODE (XEXP (x, 1)) == SIGN_EXTEND
14538 + && GET_CODE (XEXP (XEXP (x, 1), 0)) == REG
14539 + && GET_MODE (XEXP (XEXP (x, 1), 0)) == HImode))
14540 + {
14541 + rtx temp = gen_reg_rtx (Pmode);
14542 + rtx val = force_operand (XEXP (x, 0), 0);
14543 + emit_move_insn (temp, val);
14544 + COPY_ONCE (x);
14545 + XEXP (x, 0) = temp;
14546 + if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT
14547 + && GET_CODE (XEXP (x, 1)) == REG)
14548 + x = force_operand (x, 0);
14549 + }
14550 + }
14551 +
14552 + return x;
14553 +}
14554 +
14555 +
14556 /* Output a dbCC; jCC sequence. Note we do not handle the
14557 floating point version of this sequence (Fdbcc). We also
14558 do not handle alternative conditions when CC_NO_OVERFLOW is
14559 @@ -1713,15 +1803,16 @@
14560 whether we need strict checking. */
14561
14562 bool
14563 -m68k_legitimate_index_reg_p (rtx x, bool strict_p)
14564 +m68k_legitimate_index_reg_p (enum machine_mode mode, rtx x, bool strict_p)
14565 {
14566 if (!strict_p && GET_CODE (x) == SUBREG)
14567 x = SUBREG_REG (x);
14568
14569 return (REG_P (x)
14570 && (strict_p
14571 - ? REGNO_OK_FOR_INDEX_P (REGNO (x))
14572 - : REGNO_OK_FOR_INDEX_NONSTRICT_P (REGNO (x))));
14573 + ? REGNO_MODE_OK_FOR_INDEX_P (REGNO (x), mode)
14574 + : (MODE_OK_FOR_INDEX_P (mode)
14575 + && REGNO_OK_FOR_INDEX_NONSTRICT_P (REGNO (x)))));
14576 }
14577
14578 /* Return true if X is a legitimate index expression for a (d8,An,Xn) or
14579 @@ -1729,7 +1820,8 @@
14580 ADDRESS if so. STRICT_P says whether we need strict checking. */
14581
14582 static bool
14583 -m68k_decompose_index (rtx x, bool strict_p, struct m68k_address *address)
14584 +m68k_decompose_index (enum machine_mode mode, rtx x, bool strict_p,
14585 + struct m68k_address *address)
14586 {
14587 int scale;
14588
14589 @@ -1753,7 +1845,7 @@
14590 && GET_MODE (XEXP (x, 0)) == HImode)
14591 x = XEXP (x, 0);
14592
14593 - if (m68k_legitimate_index_reg_p (x, strict_p))
14594 + if (m68k_legitimate_index_reg_p (mode, x, strict_p))
14595 {
14596 address->scale = scale;
14597 address->index = x;
14598 @@ -1777,7 +1869,7 @@
14599 && !offset_within_block_p (base, INTVAL (offset)))
14600 return true;
14601 }
14602 - return false;
14603 + return m68k_tls_reference_p (x, false);
14604 }
14605
14606 /* Return true if X is a legitimate constant address that can reach
14607 @@ -1805,7 +1897,7 @@
14608 return false;
14609 }
14610
14611 - return true;
14612 + return !m68k_tls_reference_p (x, false);
14613 }
14614
14615 /* Return true if X is a LABEL_REF for a jump table. Assume that unplaced
14616 @@ -1872,15 +1964,17 @@
14617 /* Check for GOT loads. These are (bd,An,Xn) addresses if
14618 TARGET_68020 && flag_pic == 2, otherwise they are (d16,An)
14619 addresses. */
14620 - if (flag_pic
14621 - && GET_CODE (x) == PLUS
14622 - && XEXP (x, 0) == pic_offset_table_rtx
14623 - && (GET_CODE (XEXP (x, 1)) == SYMBOL_REF
14624 - || GET_CODE (XEXP (x, 1)) == LABEL_REF))
14625 + if (GET_CODE (x) == PLUS
14626 + && XEXP (x, 0) == pic_offset_table_rtx)
14627 {
14628 - address->base = XEXP (x, 0);
14629 - address->offset = XEXP (x, 1);
14630 - return true;
14631 + /* As we are processing a PLUS, do not unwrap RELOC32 symbols --
14632 + they are invalid in this context. */
14633 + if (m68k_unwrap_symbol (XEXP (x, 1), false) != XEXP (x, 1))
14634 + {
14635 + address->base = XEXP (x, 0);
14636 + address->offset = XEXP (x, 1);
14637 + return true;
14638 + }
14639 }
14640
14641 /* The ColdFire FPU only accepts addressing modes 2-5. */
14642 @@ -1905,7 +1999,7 @@
14643 accesses to unplaced labels in other cases. */
14644 if (GET_CODE (x) == PLUS
14645 && m68k_jump_table_ref_p (XEXP (x, 1))
14646 - && m68k_decompose_index (XEXP (x, 0), strict_p, address))
14647 + && m68k_decompose_index (mode, XEXP (x, 0), strict_p, address))
14648 {
14649 address->offset = XEXP (x, 1);
14650 return true;
14651 @@ -1937,7 +2031,7 @@
14652 worse code. */
14653 if (address->offset
14654 && symbolic_operand (address->offset, VOIDmode)
14655 - && m68k_decompose_index (x, strict_p, address))
14656 + && m68k_decompose_index (mode, x, strict_p, address))
14657 return true;
14658 }
14659 else
14660 @@ -1956,14 +2050,14 @@
14661 if (GET_CODE (x) == PLUS)
14662 {
14663 if (m68k_legitimate_base_reg_p (XEXP (x, 0), strict_p)
14664 - && m68k_decompose_index (XEXP (x, 1), strict_p, address))
14665 + && m68k_decompose_index (mode, XEXP (x, 1), strict_p, address))
14666 {
14667 address->base = XEXP (x, 0);
14668 return true;
14669 }
14670
14671 if (m68k_legitimate_base_reg_p (XEXP (x, 1), strict_p)
14672 - && m68k_decompose_index (XEXP (x, 0), strict_p, address))
14673 + && m68k_decompose_index (mode, XEXP (x, 0), strict_p, address))
14674 {
14675 address->base = XEXP (x, 1);
14676 return true;
14677 @@ -2025,6 +2119,243 @@
14678 && !address.index);
14679 }
14680
14681 +/* Return GOT pointer. */
14682 +
14683 +static rtx
14684 +m68k_get_gp (void)
14685 +{
14686 + if (pic_offset_table_rtx == NULL_RTX)
14687 + pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_REG);
14688 +
14689 + crtl->uses_pic_offset_table = 1;
14690 +
14691 + return pic_offset_table_rtx;
14692 +}
14693 +
14694 +/* M68K relocations, used to distinguish GOT and TLS relocations in UNSPEC
14695 + wrappers. */
14696 +enum m68k_reloc { RELOC_GOT, RELOC_TLSGD, RELOC_TLSLDM, RELOC_TLSLDO,
14697 + RELOC_TLSIE, RELOC_TLSLE };
14698 +
14699 +#define TLS_RELOC_P(RELOC) ((RELOC) != RELOC_GOT)
14700 +
14701 +/* Wrap symbol X into unspec representing relocation RELOC.
14702 + BASE_REG - register that should be added to the result.
14703 + TEMP_REG - if non-null, temporary register. */
14704 +
14705 +static rtx
14706 +m68k_wrap_symbol (rtx x, enum m68k_reloc reloc, rtx base_reg, rtx temp_reg)
14707 +{
14708 + bool use_x_p;
14709 +
14710 + use_x_p = (base_reg == pic_offset_table_rtx) ? TARGET_XGOT : TARGET_XTLS;
14711 +
14712 + if (TARGET_COLDFIRE && use_x_p)
14713 + /* When compiling with -mx{got, tls} switch the code will look like this:
14714 +
14715 + move.l <X>@<RELOC>,<TEMP_REG>
14716 + add.l <BASE_REG>,<TEMP_REG> */
14717 + {
14718 + /* Wrap X in UNSPEC_??? to tip m68k_output_addr_const_extra
14719 + to put @RELOC after reference. */
14720 + x = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, x, GEN_INT (reloc)),
14721 + UNSPEC_RELOC32);
14722 + x = gen_rtx_CONST (Pmode, x);
14723 +
14724 + if (temp_reg == NULL)
14725 + {
14726 + gcc_assert (can_create_pseudo_p ());
14727 + temp_reg = gen_reg_rtx (Pmode);
14728 + }
14729 +
14730 + emit_move_insn (temp_reg, x);
14731 + emit_insn (gen_addsi3 (temp_reg, temp_reg, base_reg));
14732 + x = temp_reg;
14733 + }
14734 + else
14735 + {
14736 + x = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, x, GEN_INT (reloc)),
14737 + UNSPEC_RELOC16);
14738 + x = gen_rtx_CONST (Pmode, x);
14739 +
14740 + x = gen_rtx_PLUS (Pmode, base_reg, x);
14741 + }
14742 +
14743 + return x;
14744 +}
14745 +
14746 +/* Helper for m68k_unwrap_symbol.
14747 + Also, if unwrapping was successful (that is if (ORIG != <return value>)),
14748 + sets *RELOC_PTR to relocation type for the symbol. */
14749 +
14750 +static rtx
14751 +m68k_unwrap_symbol_1 (rtx orig, bool unwrap_reloc32_p,
14752 + enum m68k_reloc *reloc_ptr)
14753 +{
14754 + if (GET_CODE (orig) == CONST)
14755 + {
14756 + rtx x;
14757 + enum m68k_reloc dummy;
14758 +
14759 + x = XEXP (orig, 0);
14760 +
14761 + if (reloc_ptr == NULL)
14762 + reloc_ptr = &dummy;
14763 +
14764 + /* Handle an addend. */
14765 + if ((GET_CODE (x) == PLUS || GET_CODE (x) == MINUS)
14766 + && CONST_INT_P (XEXP (x, 1)))
14767 + x = XEXP (x, 0);
14768 +
14769 + if (GET_CODE (x) == UNSPEC)
14770 + {
14771 + switch (XINT (x, 1))
14772 + {
14773 + case UNSPEC_RELOC16:
14774 + orig = XVECEXP (x, 0, 0);
14775 + *reloc_ptr = (enum m68k_reloc) INTVAL (XVECEXP (x, 0, 1));
14776 + break;
14777 +
14778 + case UNSPEC_RELOC32:
14779 + if (unwrap_reloc32_p)
14780 + {
14781 + orig = XVECEXP (x, 0, 0);
14782 + *reloc_ptr = (enum m68k_reloc) INTVAL (XVECEXP (x, 0, 1));
14783 + }
14784 + break;
14785 +
14786 + default:
14787 + break;
14788 + }
14789 + }
14790 + }
14791 +
14792 + return orig;
14793 +}
14794 +
14795 +/* Unwrap symbol from UNSPEC_RELOC16 and, if unwrap_reloc32_p,
14796 + UNSPEC_RELOC32 wrappers. */
14797 +
14798 +rtx
14799 +m68k_unwrap_symbol (rtx orig, bool unwrap_reloc32_p)
14800 +{
14801 + return m68k_unwrap_symbol_1 (orig, unwrap_reloc32_p, NULL);
14802 +}
14803 +
14804 +/* Helper for m68k_final_prescan_insn. */
14805 +
14806 +static int
14807 +m68k_final_prescan_insn_1 (rtx *x_ptr, void *data ATTRIBUTE_UNUSED)
14808 +{
14809 + rtx x = *x_ptr;
14810 +
14811 + if (m68k_unwrap_symbol (x, true) != x)
14812 + /* For rationale of the below, see comment in m68k_final_prescan_insn. */
14813 + {
14814 + rtx plus;
14815 +
14816 + gcc_assert (GET_CODE (x) == CONST);
14817 + plus = XEXP (x, 0);
14818 +
14819 + if (GET_CODE (plus) == PLUS || GET_CODE (plus) == MINUS)
14820 + {
14821 + rtx unspec;
14822 + rtx addend;
14823 +
14824 + unspec = XEXP (plus, 0);
14825 + gcc_assert (GET_CODE (unspec) == UNSPEC);
14826 + addend = XEXP (plus, 1);
14827 + gcc_assert (CONST_INT_P (addend));
14828 +
14829 + /* We now have all the pieces, rearrange them. */
14830 +
14831 + /* Move symbol to plus. */
14832 + XEXP (plus, 0) = XVECEXP (unspec, 0, 0);
14833 +
14834 + /* Move plus inside unspec. */
14835 + XVECEXP (unspec, 0, 0) = plus;
14836 +
14837 + /* Move unspec to top level of const. */
14838 + XEXP (x, 0) = unspec;
14839 + }
14840 +
14841 + return -1;
14842 + }
14843 +
14844 + return 0;
14845 +}
14846 +
14847 +/* Prescan insn before outputing assembler for it. */
14848 +
14849 +void
14850 +m68k_final_prescan_insn (rtx insn ATTRIBUTE_UNUSED,
14851 + rtx *operands, int n_operands)
14852 +{
14853 + int i;
14854 +
14855 + /* Combine and, possibly, other optimizations may do good job
14856 + converting
14857 + (const (unspec [(symbol)]))
14858 + into
14859 + (const (plus (unspec [(symbol)])
14860 + (const_int N))).
14861 + The problem with this is emitting @TLS or @GOT decorations.
14862 + The decoration is emitted when processing (unspec), so the
14863 + result would be "#symbol@TLSLE+N" instead of "#symbol+N@TLSLE".
14864 +
14865 + It seems that the easiest solution to this is to convert such
14866 + operands to
14867 + (const (unspec [(plus (symbol)
14868 + (const_int N))])).
14869 + Note, that the top level of operand remains intact, so we don't have
14870 + to patch up anything outside of the operand. */
14871 +
14872 + for (i = 0; i < n_operands; ++i)
14873 + {
14874 + rtx op;
14875 +
14876 + op = operands[i];
14877 +
14878 + for_each_rtx (&op, m68k_final_prescan_insn_1, NULL);
14879 + }
14880 +}
14881 +
14882 +/* Move X to a register and add REG_EQUAL note pointing to ORIG.
14883 + If REG is non-null, use it; generate new pseudo otherwise. */
14884 +
14885 +static rtx
14886 +m68k_move_to_reg (rtx x, rtx orig, rtx reg)
14887 +{
14888 + rtx insn;
14889 +
14890 + if (reg == NULL_RTX)
14891 + {
14892 + gcc_assert (can_create_pseudo_p ());
14893 + reg = gen_reg_rtx (Pmode);
14894 + }
14895 +
14896 + insn = emit_move_insn (reg, x);
14897 + /* Put a REG_EQUAL note on this insn, so that it can be optimized
14898 + by loop. */
14899 + set_unique_reg_note (insn, REG_EQUAL, orig);
14900 +
14901 + return reg;
14902 +}
14903 +
14904 +/* Does the same as m68k_wrap_symbol, but returns a memory reference to
14905 + GOT slot. */
14906 +
14907 +static rtx
14908 +m68k_wrap_symbol_into_got_ref (rtx x, enum m68k_reloc reloc, rtx temp_reg)
14909 +{
14910 + x = m68k_wrap_symbol (x, reloc, m68k_get_gp (), temp_reg);
14911 +
14912 + x = gen_rtx_MEM (Pmode, x);
14913 + MEM_READONLY_P (x) = 1;
14914 +
14915 + return x;
14916 +}
14917 +
14918 /* Legitimize PIC addresses. If the address is already
14919 position-independent, we return ORIG. Newly generated
14920 position-independent addresses go to REG. If we need more
14921 @@ -2076,42 +2407,15 @@
14922 {
14923 gcc_assert (reg);
14924
14925 - if (TARGET_COLDFIRE && TARGET_XGOT)
14926 - /* When compiling with -mxgot switch the code for the above
14927 - example will look like this:
14928 -
14929 - movel a5, a0
14930 - addl _foo@GOT, a0
14931 - movel a0@, a0
14932 - movel #12345, a0@ */
14933 - {
14934 - rtx pic_offset;
14935 -
14936 - /* Wrap ORIG in UNSPEC_GOTOFF to tip m68k_output_addr_const_extra
14937 - to put @GOT after reference. */
14938 - pic_offset = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig),
14939 - UNSPEC_GOTOFF);
14940 - pic_offset = gen_rtx_CONST (Pmode, pic_offset);
14941 - emit_move_insn (reg, pic_offset);
14942 - emit_insn (gen_addsi3 (reg, reg, pic_offset_table_rtx));
14943 - pic_ref = gen_rtx_MEM (Pmode, reg);
14944 - }
14945 - else
14946 - pic_ref = gen_rtx_MEM (Pmode,
14947 - gen_rtx_PLUS (Pmode,
14948 - pic_offset_table_rtx, orig));
14949 - crtl->uses_pic_offset_table = 1;
14950 - MEM_READONLY_P (pic_ref) = 1;
14951 - emit_move_insn (reg, pic_ref);
14952 - return reg;
14953 + pic_ref = m68k_wrap_symbol_into_got_ref (orig, RELOC_GOT, reg);
14954 + pic_ref = m68k_move_to_reg (pic_ref, orig, reg);
14955 }
14956 else if (GET_CODE (orig) == CONST)
14957 {
14958 rtx base;
14959
14960 /* Make sure this has not already been legitimized. */
14961 - if (GET_CODE (XEXP (orig, 0)) == PLUS
14962 - && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
14963 + if (m68k_unwrap_symbol (orig, true) != orig)
14964 return orig;
14965
14966 gcc_assert (reg);
14967 @@ -2124,13 +2428,257 @@
14968 base == reg ? 0 : reg);
14969
14970 if (GET_CODE (orig) == CONST_INT)
14971 - return plus_constant (base, INTVAL (orig));
14972 - pic_ref = gen_rtx_PLUS (Pmode, base, orig);
14973 - /* Likewise, should we set special REG_NOTEs here? */
14974 + pic_ref = plus_constant (base, INTVAL (orig));
14975 + else
14976 + pic_ref = gen_rtx_PLUS (Pmode, base, orig);
14977 }
14978 +
14979 return pic_ref;
14980 }
14981
14982 +/* The __tls_get_addr symbol. */
14983 +static GTY(()) rtx m68k_tls_get_addr;
14984 +
14985 +/* Return SYMBOL_REF for __tls_get_addr. */
14986 +
14987 +static rtx
14988 +m68k_get_tls_get_addr (void)
14989 +{
14990 + if (m68k_tls_get_addr == NULL_RTX)
14991 + m68k_tls_get_addr = init_one_libfunc ("__tls_get_addr");
14992 +
14993 + return m68k_tls_get_addr;
14994 +}
14995 +
14996 +/* Return libcall result in A0 instead of usual D0. */
14997 +static bool m68k_libcall_value_in_a0_p = false;
14998 +
14999 +/* Emit instruction sequence that calls __tls_get_addr. X is
15000 + the TLS symbol we are referencing and RELOC is the symbol type to use
15001 + (either TLSGD or TLSLDM). EQV is the REG_EQUAL note for the sequence
15002 + emitted. A pseudo register with result of __tls_get_addr call is
15003 + returned. */
15004 +
15005 +static rtx
15006 +m68k_call_tls_get_addr (rtx x, rtx eqv, enum m68k_reloc reloc)
15007 +{
15008 + rtx a0;
15009 + rtx insns;
15010 + rtx dest;
15011 +
15012 + /* Emit the call sequence. */
15013 + start_sequence ();
15014 +
15015 + /* FIXME: Unfortunately, emit_library_call_value does not
15016 + consider (plus (%a5) (const (unspec))) to be a good enough
15017 + operand for push, so it forces it into a register. The bad
15018 + thing about this is that combiner, due to copy propagation and other
15019 + optimizations, sometimes can not later fix this. As a consequence,
15020 + additional register may be allocated resulting in a spill.
15021 + For reference, see args processing loops in
15022 + calls.c:emit_library_call_value_1.
15023 + For testcase, see gcc.target/m68k/tls-{gd, ld}.c */
15024 + x = m68k_wrap_symbol (x, reloc, m68k_get_gp (), NULL_RTX);
15025 +
15026 + /* __tls_get_addr() is not a libcall, but emitting a libcall_value
15027 + is the simpliest way of generating a call. The difference between
15028 + __tls_get_addr() and libcall is that the result is returned in D0
15029 + instead of A0. To workaround this, we use m68k_libcall_value_in_a0_p
15030 + which temporarily switches returning the result to A0. */
15031 +
15032 + m68k_libcall_value_in_a0_p = true;
15033 + a0 = emit_library_call_value (m68k_get_tls_get_addr (), NULL_RTX, LCT_PURE,
15034 + Pmode, 1, x, Pmode);
15035 + m68k_libcall_value_in_a0_p = false;
15036 +
15037 + insns = get_insns ();
15038 + end_sequence ();
15039 +
15040 + gcc_assert (can_create_pseudo_p ());
15041 + dest = gen_reg_rtx (Pmode);
15042 + emit_libcall_block (insns, dest, a0, eqv);
15043 +
15044 + return dest;
15045 +}
15046 +
15047 +/* The __tls_get_addr symbol. */
15048 +static GTY(()) rtx m68k_read_tp;
15049 +
15050 +/* Return SYMBOL_REF for __m68k_read_tp. */
15051 +
15052 +static rtx
15053 +m68k_get_m68k_read_tp (void)
15054 +{
15055 + if (m68k_read_tp == NULL_RTX)
15056 + m68k_read_tp = init_one_libfunc ("__m68k_read_tp");
15057 +
15058 + return m68k_read_tp;
15059 +}
15060 +
15061 +/* Emit instruction sequence that calls __m68k_read_tp.
15062 + A pseudo register with result of __m68k_read_tp call is returned. */
15063 +
15064 +static rtx
15065 +m68k_call_m68k_read_tp (void)
15066 +{
15067 + rtx a0;
15068 + rtx eqv;
15069 + rtx insns;
15070 + rtx dest;
15071 +
15072 + start_sequence ();
15073 +
15074 + /* __m68k_read_tp() is not a libcall, but emitting a libcall_value
15075 + is the simpliest way of generating a call. The difference between
15076 + __m68k_read_tp() and libcall is that the result is returned in D0
15077 + instead of A0. To workaround this, we use m68k_libcall_value_in_a0_p
15078 + which temporarily switches returning the result to A0. */
15079 +
15080 + /* Emit the call sequence. */
15081 + m68k_libcall_value_in_a0_p = true;
15082 + a0 = emit_library_call_value (m68k_get_m68k_read_tp (), NULL_RTX, LCT_PURE,
15083 + Pmode, 0);
15084 + m68k_libcall_value_in_a0_p = false;
15085 + insns = get_insns ();
15086 + end_sequence ();
15087 +
15088 + /* Attach a unique REG_EQUIV, to allow the RTL optimizers to
15089 + share the m68k_read_tp result with other IE/LE model accesses. */
15090 + eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const1_rtx), UNSPEC_RELOC32);
15091 +
15092 + gcc_assert (can_create_pseudo_p ());
15093 + dest = gen_reg_rtx (Pmode);
15094 + emit_libcall_block (insns, dest, a0, eqv);
15095 +
15096 + return dest;
15097 +}
15098 +
15099 +/* Return a legitimized address for accessing TLS SYMBOL_REF X.
15100 + For explanations on instructions sequences see TLS/NPTL ABI for m68k and
15101 + ColdFire. */
15102 +
15103 +rtx
15104 +m68k_legitimize_tls_address (rtx orig)
15105 +{
15106 + switch (SYMBOL_REF_TLS_MODEL (orig))
15107 + {
15108 + case TLS_MODEL_GLOBAL_DYNAMIC:
15109 + orig = m68k_call_tls_get_addr (orig, orig, RELOC_TLSGD);
15110 + break;
15111 +
15112 + case TLS_MODEL_LOCAL_DYNAMIC:
15113 + {
15114 + rtx eqv;
15115 + rtx a0;
15116 + rtx x;
15117 +
15118 + /* Attach a unique REG_EQUIV, to allow the RTL optimizers to
15119 + share the LDM result with other LD model accesses. */
15120 + eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
15121 + UNSPEC_RELOC32);
15122 +
15123 + a0 = m68k_call_tls_get_addr (orig, eqv, RELOC_TLSLDM);
15124 +
15125 + x = m68k_wrap_symbol (orig, RELOC_TLSLDO, a0, NULL_RTX);
15126 +
15127 + if (can_create_pseudo_p ())
15128 + x = m68k_move_to_reg (x, orig, NULL_RTX);
15129 +
15130 + orig = x;
15131 + break;
15132 + }
15133 +
15134 + case TLS_MODEL_INITIAL_EXEC:
15135 + {
15136 + rtx a0;
15137 + rtx x;
15138 +
15139 + a0 = m68k_call_m68k_read_tp ();
15140 +
15141 + x = m68k_wrap_symbol_into_got_ref (orig, RELOC_TLSIE, NULL_RTX);
15142 + x = gen_rtx_PLUS (Pmode, x, a0);
15143 +
15144 + if (can_create_pseudo_p ())
15145 + x = m68k_move_to_reg (x, orig, NULL_RTX);
15146 +
15147 + orig = x;
15148 + break;
15149 + }
15150 +
15151 + case TLS_MODEL_LOCAL_EXEC:
15152 + {
15153 + rtx a0;
15154 + rtx x;
15155 +
15156 + a0 = m68k_call_m68k_read_tp ();
15157 +
15158 + x = m68k_wrap_symbol (orig, RELOC_TLSLE, a0, NULL_RTX);
15159 +
15160 + if (can_create_pseudo_p ())
15161 + x = m68k_move_to_reg (x, orig, NULL_RTX);
15162 +
15163 + orig = x;
15164 + break;
15165 + }
15166 +
15167 + default:
15168 + gcc_unreachable ();
15169 + }
15170 +
15171 + return orig;
15172 +}
15173 +
15174 +/* Return true if X is a TLS symbol. */
15175 +
15176 +static bool
15177 +m68k_tls_symbol_p (rtx x)
15178 +{
15179 + if (!TARGET_HAVE_TLS)
15180 + return false;
15181 +
15182 + if (GET_CODE (x) != SYMBOL_REF)
15183 + return false;
15184 +
15185 + return SYMBOL_REF_TLS_MODEL (x) != 0;
15186 +}
15187 +
15188 +/* Helper for m68k_tls_referenced_p. */
15189 +
15190 +static int
15191 +m68k_tls_reference_p_1 (rtx *x_ptr, void *data ATTRIBUTE_UNUSED)
15192 +{
15193 + /* Note: this is not the same as m68k_tls_symbol_p. */
15194 + if (GET_CODE (*x_ptr) == SYMBOL_REF)
15195 + return SYMBOL_REF_TLS_MODEL (*x_ptr) != 0 ? 1 : 0;
15196 +
15197 + /* Don't recurse into legitimate TLS references. */
15198 + if (m68k_tls_reference_p (*x_ptr, true))
15199 + return -1;
15200 +
15201 + return 0;
15202 +}
15203 +
15204 +/* If !LEGITIMATE_P, return true if X is a TLS symbol reference,
15205 + though illegitimate one.
15206 + If LEGITIMATE_P, return true if X is a legitimate TLS symbol reference. */
15207 +
15208 +bool
15209 +m68k_tls_reference_p (rtx x, bool legitimate_p)
15210 +{
15211 + if (!TARGET_HAVE_TLS)
15212 + return false;
15213 +
15214 + if (!legitimate_p)
15215 + return for_each_rtx (&x, m68k_tls_reference_p_1, NULL) == 1 ? true : false;
15216 + else
15217 + {
15218 + enum m68k_reloc reloc = RELOC_GOT;
15219 +
15220 + return (m68k_unwrap_symbol_1 (x, true, &reloc) != x
15221 + && TLS_RELOC_P (reloc));
15222 + }
15223 +}
15224 +
15225 \f
15226
15227 #define USE_MOVQ(i) ((unsigned) ((i) + 128) <= 255)
15228 @@ -3918,18 +4466,92 @@
15229 }
15230 }
15231
15232 +/* Return string for TLS relocation RELOC. */
15233 +
15234 +static const char *
15235 +m68k_get_reloc_decoration (enum m68k_reloc reloc)
15236 +{
15237 + /* To my knowledge, !MOTOROLA assemblers don't support TLS. */
15238 + gcc_assert (MOTOROLA || reloc == RELOC_GOT);
15239 +
15240 + switch (reloc)
15241 + {
15242 + case RELOC_GOT:
15243 + if (MOTOROLA)
15244 + {
15245 + if (flag_pic == 1 && TARGET_68020)
15246 + return "@GOT.w";
15247 + else
15248 + return "@GOT";
15249 + }
15250 + else
15251 + {
15252 + if (TARGET_68020)
15253 + {
15254 + switch (flag_pic)
15255 + {
15256 + case 1:
15257 + return ":w";
15258 + case 2:
15259 + return ":l";
15260 + default:
15261 + return "";
15262 + }
15263 + }
15264 + }
15265 +
15266 + case RELOC_TLSGD:
15267 + return "@TLSGD";
15268 +
15269 + case RELOC_TLSLDM:
15270 + return "@TLSLDM";
15271 +
15272 + case RELOC_TLSLDO:
15273 + return "@TLSLDO";
15274 +
15275 + case RELOC_TLSIE:
15276 + return "@TLSIE";
15277 +
15278 + case RELOC_TLSLE:
15279 + return "@TLSLE";
15280 +
15281 + default:
15282 + gcc_unreachable ();
15283 + }
15284 +}
15285 +
15286 /* m68k implementation of OUTPUT_ADDR_CONST_EXTRA. */
15287
15288 bool
15289 m68k_output_addr_const_extra (FILE *file, rtx x)
15290 {
15291 - if (GET_CODE (x) != UNSPEC || XINT (x, 1) != UNSPEC_GOTOFF)
15292 - return false;
15293 + if (GET_CODE (x) == UNSPEC)
15294 + {
15295 + switch (XINT (x, 1))
15296 + {
15297 + case UNSPEC_RELOC16:
15298 + case UNSPEC_RELOC32:
15299 + output_addr_const (file, XVECEXP (x, 0, 0));
15300 + fputs (m68k_get_reloc_decoration (INTVAL (XVECEXP (x, 0, 1))), file);
15301 + return true;
15302
15303 - output_addr_const (file, XVECEXP (x, 0, 0));
15304 - /* ??? What is the non-MOTOROLA syntax? */
15305 - fputs ("@GOT", file);
15306 - return true;
15307 + default:
15308 + break;
15309 + }
15310 + }
15311 +
15312 + return false;
15313 +}
15314 +
15315 +/* M68K implementation of TARGET_ASM_OUTPUT_DWARF_DTPREL. */
15316 +
15317 +static void
15318 +m68k_output_dwarf_dtprel (FILE *file, int size, rtx x)
15319 +{
15320 + gcc_assert (size == 4);
15321 + fputs ("\t.long\t", file);
15322 + output_addr_const (file, x);
15323 + fputs ("@TLSLDO+0x8000", file);
15324 }
15325
15326 \f
15327 @@ -4019,15 +4641,8 @@
15328 else
15329 {
15330 if (address.offset)
15331 - {
15332 - output_addr_const (file, address.offset);
15333 - if (flag_pic && address.base == pic_offset_table_rtx)
15334 - {
15335 - fprintf (file, "@GOT");
15336 - if (flag_pic == 1 && TARGET_68020)
15337 - fprintf (file, ".w");
15338 - }
15339 - }
15340 + output_addr_const (file, address.offset);
15341 +
15342 putc ('(', file);
15343 if (address.base)
15344 fputs (M68K_REGNAME (REGNO (address.base)), file);
15345 @@ -4060,19 +4675,7 @@
15346 fputs (M68K_REGNAME (REGNO (address.base)), file);
15347 fprintf (file, "@(");
15348 if (address.offset)
15349 - {
15350 - output_addr_const (file, address.offset);
15351 - if (address.base == pic_offset_table_rtx && TARGET_68020)
15352 - switch (flag_pic)
15353 - {
15354 - case 1:
15355 - fprintf (file, ":w"); break;
15356 - case 2:
15357 - fprintf (file, ":l"); break;
15358 - default:
15359 - break;
15360 - }
15361 - }
15362 + output_addr_const (file, address.offset);
15363 }
15364 /* Print the ",index" component, if any. */
15365 if (address.index)
15366 @@ -4580,7 +5183,8 @@
15367 default:
15368 break;
15369 }
15370 - return gen_rtx_REG (mode, D0_REG);
15371 +
15372 + return gen_rtx_REG (mode, m68k_libcall_value_in_a0_p ? A0_REG : D0_REG);
15373 }
15374
15375 rtx
15376 @@ -4846,9 +5450,8 @@
15377 return OP_TYPE_IMM_L;
15378
15379 default:
15380 - if (GET_CODE (op) == SYMBOL_REF)
15381 - /* ??? Just a guess. Probably we can guess better using length
15382 - attribute of the instructions. */
15383 + if (symbolic_operand (m68k_unwrap_symbol (op, false), VOIDmode))
15384 + /* Just a guess. */
15385 return OP_TYPE_IMM_W;
15386
15387 return OP_TYPE_IMM_L;
15388 @@ -5793,3 +6396,5 @@
15389 return 0;
15390 }
15391 }
15392 +
15393 +#include "gt-m68k.h"
15394 diff -Nur a/gcc/config/m68k/m68k-devices.def b/gcc/config/m68k/m68k-devices.def
15395 --- a/gcc/config/m68k/m68k-devices.def 2009-02-20 16:20:38.000000000 +0100
15396 +++ b/gcc/config/m68k/m68k-devices.def 2010-01-25 09:50:29.025687257 +0100
15397 @@ -72,8 +72,8 @@
15398 /* 680x0 series processors. */
15399 M68K_DEVICE ("68000", m68000, "68000", "68000", 68000, isa_00, 0)
15400 M68K_DEVICE ("68010", m68010, "68010", "68000", 68010, isa_10, 0)
15401 -M68K_DEVICE ("68020", m68020, "68020", "68020", 68020, isa_20, FL_MMU)
15402 -M68K_DEVICE ("68030", m68030, "68030", "68020", 68030, isa_20, FL_MMU)
15403 +M68K_DEVICE ("68020", m68020, "68020", "68020", 68020, isa_20, FL_MMU | FL_UCLINUX)
15404 +M68K_DEVICE ("68030", m68030, "68030", "68020", 68030, isa_20, FL_MMU | FL_UCLINUX)
15405 M68K_DEVICE ("68040", m68040, "68040", "68040", 68040, isa_40, FL_MMU)
15406 M68K_DEVICE ("68060", m68060, "68060", "68060", 68060, isa_40, FL_MMU)
15407 M68K_DEVICE ("68302", m68302, "68302", "68000", 68000, isa_00, FL_MMU)
15408 @@ -81,7 +81,13 @@
15409 M68K_DEVICE ("cpu32", cpu32, "cpu32", "cpu32", cpu32, isa_cpu32, FL_MMU)
15410
15411 /* ColdFire CFV1 processor. */
15412 -M68K_DEVICE ("51qe", mcf51qe, "51qe", "51qe", cfv1, isa_c, FL_CF_USP)
15413 +/* For historical reasons, the 51 multilib is named 51qe. */
15414 +M68K_DEVICE ("51", mcf51, "51", "51qe", cfv1, isa_c, FL_CF_USP)
15415 +M68K_DEVICE ("51ac", mcf51ac, "51", "51qe", cfv1, isa_c, FL_CF_USP)
15416 +M68K_DEVICE ("51cn", mcf51cn, "51", "51qe", cfv1, isa_c, FL_CF_USP)
15417 +M68K_DEVICE ("51em", mcf51em, "51", "51qe", cfv1, isa_c, FL_CF_USP | FL_CF_MAC)
15418 +M68K_DEVICE ("51jm", mcf51jm, "51", "51qe", cfv1, isa_c, FL_CF_USP)
15419 +M68K_DEVICE ("51qe", mcf51qe, "51", "51qe", cfv1, isa_c, FL_CF_USP)
15420
15421 /* ColdFire CFV2 processors. */
15422 M68K_DEVICE ("5202", mcf5202, "5206", "5206", cfv2, isa_a, 0)
15423 @@ -97,6 +103,7 @@
15424 M68K_DEVICE ("5213", mcf5213, "5213", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_MAC)
15425 M68K_DEVICE ("5214", mcf5214, "5216", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15426 M68K_DEVICE ("5216", mcf5216, "5216", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15427 +M68K_DEVICE ("5221x", mcf5221x, "5221x", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_MAC)
15428 M68K_DEVICE ("52221", mcf52221, "52223", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_MAC)
15429 M68K_DEVICE ("52223", mcf52223, "52223", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_MAC)
15430 M68K_DEVICE ("52230", mcf52230, "52235", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15431 @@ -107,6 +114,14 @@
15432 M68K_DEVICE ("52235", mcf52235, "52235", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15433 M68K_DEVICE ("5224", mcf5224, "5225", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_MAC)
15434 M68K_DEVICE ("5225", mcf5225, "5225", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_MAC)
15435 +M68K_DEVICE ("52252", mcf52252, "52259", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15436 +M68K_DEVICE ("52254", mcf52254, "52259", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15437 +M68K_DEVICE ("52255", mcf52255, "52259", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15438 +M68K_DEVICE ("52256", mcf52256, "52259", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15439 +M68K_DEVICE ("52258", mcf52258, "52259", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15440 +M68K_DEVICE ("52259", mcf52259, "52259", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15441 +M68K_DEVICE ("52274", mcf52274, "52277", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15442 +M68K_DEVICE ("52277", mcf52277, "52277", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15443 M68K_DEVICE ("5232", mcf5232, "5235", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15444 M68K_DEVICE ("5233", mcf5233, "5235", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15445 M68K_DEVICE ("5234", mcf5234, "5235", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15446 @@ -126,6 +141,13 @@
15447 M68K_DEVICE ("528x", mcf528x, "5282", "5208", cfv2, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15448
15449 /* CFV3 processors. */
15450 +M68K_DEVICE ("53011", mcf53011, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15451 +M68K_DEVICE ("53012", mcf53012, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15452 +M68K_DEVICE ("53013", mcf53013, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15453 +M68K_DEVICE ("53014", mcf53014, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15454 +M68K_DEVICE ("53015", mcf53015, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15455 +M68K_DEVICE ("53016", mcf53016, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15456 +M68K_DEVICE ("53017", mcf53017, "53017", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15457 M68K_DEVICE ("5307", mcf5307, "5307", "5307", cfv3, isa_a, FL_CF_HWDIV | FL_CF_MAC)
15458 M68K_DEVICE ("5327", mcf5327, "5329", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15459 M68K_DEVICE ("5328", mcf5328, "5329", "5329", cfv3, isa_aplus, FL_CF_HWDIV | FL_CF_EMAC)
15460 @@ -137,12 +159,17 @@
15461
15462 /* CFV4/CFV4e processors. */
15463 M68K_DEVICE ("5407", mcf5407, "5407", "5407", cfv4, isa_b, FL_CF_MAC)
15464 -M68K_DEVICE ("54450", mcf54450, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU)
15465 -M68K_DEVICE ("54451", mcf54451, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU)
15466 -M68K_DEVICE ("54452", mcf54452, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU)
15467 -M68K_DEVICE ("54453", mcf54453, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU)
15468 -M68K_DEVICE ("54454", mcf54454, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU)
15469 -M68K_DEVICE ("54455", mcf54455, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU)
15470 +M68K_DEVICE ("54410", mcf54410, "54418", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15471 +M68K_DEVICE ("54415", mcf54415, "54418", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15472 +M68K_DEVICE ("54416", mcf54416, "54418", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15473 +M68K_DEVICE ("54417", mcf54417, "54418", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15474 +M68K_DEVICE ("54418", mcf54418, "54418", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15475 +M68K_DEVICE ("54450", mcf54450, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15476 +M68K_DEVICE ("54451", mcf54451, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15477 +M68K_DEVICE ("54452", mcf54452, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15478 +M68K_DEVICE ("54453", mcf54453, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15479 +M68K_DEVICE ("54454", mcf54454, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15480 +M68K_DEVICE ("54455", mcf54455, "54455", "54455", cfv4, isa_c, FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
15481 M68K_DEVICE ("5470", mcf5470, "5475", "5475", cfv4e, isa_b, FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
15482 M68K_DEVICE ("5471", mcf5471, "5475", "5475", cfv4e, isa_b, FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
15483 M68K_DEVICE ("5472", mcf5472, "5475", "5475", cfv4e, isa_b, FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
15484 diff -Nur a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
15485 --- a/gcc/config/m68k/m68k.h 2008-11-19 12:23:28.000000000 +0100
15486 +++ b/gcc/config/m68k/m68k.h 2010-01-25 09:50:29.025687257 +0100
15487 @@ -232,6 +232,7 @@
15488 #define FL_ISA_C (1 << 16)
15489 #define FL_FIDOA (1 << 17)
15490 #define FL_MMU 0 /* Used by multilib machinery. */
15491 +#define FL_UCLINUX 0 /* Used by multilib machinery. */
15492
15493 #define TARGET_68010 ((m68k_cpu_flags & FL_ISA_68010) != 0)
15494 #define TARGET_68020 ((m68k_cpu_flags & FL_ISA_68020) != 0)
15495 @@ -501,7 +502,8 @@
15496
15497 extern enum reg_class regno_reg_class[];
15498 #define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)])
15499 -#define INDEX_REG_CLASS GENERAL_REGS
15500 +#define MODE_INDEX_REG_CLASS(MODE) \
15501 + (MODE_OK_FOR_INDEX_P (MODE) ? GENERAL_REGS : NO_REGS)
15502 #define BASE_REG_CLASS ADDR_REGS
15503
15504 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
15505 @@ -644,7 +646,7 @@
15506 (though the operand list is empty). */
15507 #define TRANSFER_FROM_TRAMPOLINE \
15508 void \
15509 -__transfer_from_trampoline () \
15510 +__transfer_from_trampoline (void) \
15511 { \
15512 register char *a0 asm (M68K_STATIC_CHAIN_REG_NAME); \
15513 asm (GLOBAL_ASM_OP "___trampoline"); \
15514 @@ -675,6 +677,10 @@
15515 #define HAVE_POST_INCREMENT 1
15516 #define HAVE_PRE_DECREMENT 1
15517
15518 +/* Return true if addresses of mode MODE can have an index register. */
15519 +#define MODE_OK_FOR_INDEX_P(MODE) \
15520 + (!TARGET_COLDFIRE_FPU || GET_MODE_CLASS (MODE) != MODE_FLOAT)
15521 +
15522 /* Macros to check register numbers against specific register classes. */
15523
15524 /* True for data registers, D0 through D7. */
15525 @@ -689,9 +695,10 @@
15526 /* True for floating point registers, FP0 through FP7. */
15527 #define FP_REGNO_P(REGNO) IN_RANGE (REGNO, 16, 23)
15528
15529 -#define REGNO_OK_FOR_INDEX_P(REGNO) \
15530 - (INT_REGNO_P (REGNO) \
15531 - || INT_REGNO_P (reg_renumber[REGNO]))
15532 +#define REGNO_MODE_OK_FOR_INDEX_P(REGNO, MODE) \
15533 + (MODE_OK_FOR_INDEX_P (MODE) \
15534 + && (INT_REGNO_P (REGNO) \
15535 + || INT_REGNO_P (reg_renumber[REGNO])))
15536
15537 #define REGNO_OK_FOR_BASE_P(REGNO) \
15538 (ADDRESS_REGNO_P (REGNO) \
15539 @@ -751,13 +758,14 @@
15540
15541 #define LEGITIMATE_PIC_OPERAND_P(X) \
15542 (!symbolic_operand (X, VOIDmode) \
15543 - || (TARGET_PCREL && REG_STRICT_P))
15544 + || (TARGET_PCREL && REG_STRICT_P) \
15545 + || m68k_tls_reference_p (X, true))
15546
15547 #define REG_OK_FOR_BASE_P(X) \
15548 m68k_legitimate_base_reg_p (X, REG_STRICT_P)
15549
15550 -#define REG_OK_FOR_INDEX_P(X) \
15551 - m68k_legitimate_index_reg_p (X, REG_STRICT_P)
15552 +#define REG_MODE_OK_FOR_INDEX_P(X, MODE) \
15553 + m68k_legitimate_index_reg_p (MODE, X, REG_STRICT_P)
15554
15555 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
15556 do \
15557 @@ -770,52 +778,19 @@
15558 /* This address is OK as it stands. */
15559 #define PIC_CASE_VECTOR_ADDRESS(index) index
15560 \f
15561 -/* For the 68000, we handle X+REG by loading X into a register R and
15562 - using R+REG. R will go in an address reg and indexing will be used.
15563 - However, if REG is a broken-out memory address or multiplication,
15564 - nothing needs to be done because REG can certainly go in an address reg. */
15565 -#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
15566 -#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
15567 -{ register int ch = (X) != (OLDX); \
15568 - if (GET_CODE (X) == PLUS) \
15569 - { int copied = 0; \
15570 - if (GET_CODE (XEXP (X, 0)) == MULT) \
15571 - { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
15572 - if (GET_CODE (XEXP (X, 1)) == MULT) \
15573 - { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
15574 - if (ch && GET_CODE (XEXP (X, 1)) == REG \
15575 - && GET_CODE (XEXP (X, 0)) == REG) \
15576 - { if (TARGET_COLDFIRE_FPU \
15577 - && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
15578 - { COPY_ONCE (X); X = force_operand (X, 0);} \
15579 - goto WIN; } \
15580 - if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
15581 - if (GET_CODE (XEXP (X, 0)) == REG \
15582 - || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
15583 - && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
15584 - && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
15585 - { register rtx temp = gen_reg_rtx (Pmode); \
15586 - register rtx val = force_operand (XEXP (X, 1), 0); \
15587 - emit_move_insn (temp, val); \
15588 - COPY_ONCE (X); \
15589 - XEXP (X, 1) = temp; \
15590 - if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
15591 - && GET_CODE (XEXP (X, 0)) == REG) \
15592 - X = force_operand (X, 0); \
15593 - goto WIN; } \
15594 - else if (GET_CODE (XEXP (X, 1)) == REG \
15595 - || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
15596 - && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
15597 - && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
15598 - { register rtx temp = gen_reg_rtx (Pmode); \
15599 - register rtx val = force_operand (XEXP (X, 0), 0); \
15600 - emit_move_insn (temp, val); \
15601 - COPY_ONCE (X); \
15602 - XEXP (X, 0) = temp; \
15603 - if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
15604 - && GET_CODE (XEXP (X, 1)) == REG) \
15605 - X = force_operand (X, 0); \
15606 - goto WIN; }}}
15607 +#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
15608 +do { \
15609 + rtx __x; \
15610 + \
15611 + __x = m68k_legitimize_address (X, OLDX, MODE); \
15612 + if (__x != NULL_RTX) \
15613 + { \
15614 + X = __x; \
15615 + \
15616 + if (memory_address_p (MODE, X)) \
15617 + goto WIN; \
15618 + } \
15619 +} while (0)
15620
15621 /* On the 68000, only predecrement and postincrement address depend thus
15622 (the amount of decrement or increment being the length of the operand).
15623 @@ -1028,6 +1003,9 @@
15624 assemble_name ((FILE), (NAME)), \
15625 fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
15626
15627 +#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
15628 + m68k_final_prescan_insn (INSN, OPVEC, NOPERANDS)
15629 +
15630 /* On the 68000, we use several CODE characters:
15631 '.' for dot needed in Motorola-style opcode names.
15632 '-' for an operand pushing on the stack:
15633 diff -Nur a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
15634 --- a/gcc/config/m68k/m68k.md 2009-02-20 16:20:38.000000000 +0100
15635 +++ b/gcc/config/m68k/m68k.md 2010-01-25 09:50:29.025687257 +0100
15636 @@ -116,7 +116,8 @@
15637 (UNSPEC_GOT 3)
15638 (UNSPEC_IB 4)
15639 (UNSPEC_TIE 5)
15640 - (UNSPEC_GOTOFF 6)
15641 + (UNSPEC_RELOC16 6)
15642 + (UNSPEC_RELOC32 7)
15643 ])
15644
15645 ;; UNSPEC_VOLATILE usage:
15646 @@ -414,7 +415,7 @@
15647
15648 (define_insn "tst<mode>_cf"
15649 [(set (cc0)
15650 - (match_operand:FP 0 "general_operand" "f<FP:dreg><Q>U"))]
15651 + (match_operand:FP 0 "general_operand" "f<FP:dreg>m"))]
15652 "TARGET_COLDFIRE_FPU"
15653 {
15654 cc_status.flags = CC_IN_68881;
15655 @@ -570,8 +571,8 @@
15656
15657 (define_insn "*cmp<mode>_cf"
15658 [(set (cc0)
15659 - (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg><Q>U")
15660 - (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg><Q>U,f")))]
15661 + (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg>m")
15662 + (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg>m,f")))]
15663 "TARGET_COLDFIRE_FPU
15664 && (register_operand (operands[0], <MODE>mode)
15665 || register_operand (operands[1], <MODE>mode))"
15666 @@ -779,7 +780,41 @@
15667 {
15668 rtx tmp, base, offset;
15669
15670 - if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
15671 + /* Recognize the case where operand[1] is a reference to thread-local
15672 + data and load its address to a register. */
15673 + if (!TARGET_PCREL && m68k_tls_reference_p (operands[1], false))
15674 + {
15675 + rtx tmp = operands[1];
15676 + rtx addend = NULL;
15677 +
15678 + if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS)
15679 + {
15680 + addend = XEXP (XEXP (tmp, 0), 1);
15681 + tmp = XEXP (XEXP (tmp, 0), 0);
15682 + }
15683 +
15684 + gcc_assert (GET_CODE (tmp) == SYMBOL_REF);
15685 + gcc_assert (SYMBOL_REF_TLS_MODEL (tmp) != 0);
15686 +
15687 + tmp = m68k_legitimize_tls_address (tmp);
15688 +
15689 + if (addend)
15690 + {
15691 + if (!REG_P (tmp))
15692 + {
15693 + rtx reg;
15694 +
15695 + reg = gen_reg_rtx (Pmode);
15696 + emit_move_insn (reg, tmp);
15697 + tmp = reg;
15698 + }
15699 +
15700 + tmp = gen_rtx_PLUS (SImode, tmp, addend);
15701 + }
15702 +
15703 + operands[1] = tmp;
15704 + }
15705 + else if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
15706 {
15707 /* The source is an address which requires PIC relocation.
15708 Call legitimize_pic_address with the source, mode, and a relocation
15709 @@ -1070,10 +1105,8 @@
15710 ;; SFmode MEMs are restricted to modes 2-4 if TARGET_COLDFIRE_FPU.
15711 ;; The move instructions can handle all combinations.
15712 (define_insn "movsf_cf_hard"
15713 - [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
15714 -,m")
15715 - (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
15716 -,f"))]
15717 + [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,f, f,rm,f,r<Q>,f,m")
15718 + (match_operand:SF 1 "general_operand" " f, rm,f,rm,F,F, m,f"))]
15719 "TARGET_COLDFIRE_FPU"
15720 {
15721 if (which_alternative == 4 || which_alternative == 5) {
15722 @@ -1215,8 +1248,8 @@
15723 })
15724
15725 (define_insn "movdf_cf_hard"
15726 - [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
15727 - (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
15728 + [(set (match_operand:DF 0 "nonimmediate_operand" "=f, m,r,f,r,r,m,f")
15729 + (match_operand:DF 1 "general_operand" " fm,f,f,r,r,m,r,E"))]
15730 "TARGET_COLDFIRE_FPU"
15731 {
15732 rtx xoperands[3];
15733 @@ -1857,7 +1890,7 @@
15734 (define_insn "extendsfdf2_cf"
15735 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
15736 (float_extend:DF
15737 - (match_operand:SF 1 "general_operand" "f,<Q>U")))]
15738 + (match_operand:SF 1 "general_operand" "f,m")))]
15739 "TARGET_COLDFIRE_FPU"
15740 {
15741 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
15742 @@ -1897,9 +1930,9 @@
15743 })
15744
15745 (define_insn "truncdfsf2_cf"
15746 - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
15747 + [(set (match_operand:SF 0 "nonimmediate_operand" "=f,dm")
15748 (float_truncate:SF
15749 - (match_operand:DF 1 "general_operand" "<Q>U,f")))]
15750 + (match_operand:DF 1 "general_operand" "m,f")))]
15751 "TARGET_COLDFIRE_FPU"
15752 "@
15753 fsmove%.d %1,%0
15754 @@ -2045,7 +2078,7 @@
15755
15756 (define_insn "ftrunc<mode>2_cf"
15757 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
15758 - (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
15759 + (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
15760 "TARGET_COLDFIRE_FPU"
15761 {
15762 if (FP_REG_P (operands[1]))
15763 @@ -2338,9 +2371,9 @@
15764 "* return output_addsi3 (operands);")
15765
15766 (define_insn_and_split "*addsi3_5200"
15767 - [(set (match_operand:SI 0 "nonimmediate_operand" "=mr,mr,a,m,r, ?a, ?a,?a,?a")
15768 - (plus:SI (match_operand:SI 1 "general_operand" "%0, 0, 0,0,0, a, a, r, a")
15769 - (match_operand:SI 2 "general_src_operand" " I, L, J,d,mrKi,Cj, r, a, J")))]
15770 + [(set (match_operand:SI 0 "nonimmediate_operand" "=mr,mr,a, m,r, ?a, ?a,?a,?a")
15771 + (plus:SI (match_operand:SI 1 "general_operand" "%0, 0, 0, 0,0, a, a, r, a")
15772 + (match_operand:SI 2 "general_src_operand" " I, L, JCu,d,mrKi,Cj, r, a, JCu")))]
15773 "TARGET_COLDFIRE"
15774 {
15775 switch (which_alternative)
15776 @@ -2382,9 +2415,9 @@
15777 (plus:SI (match_dup 0)
15778 (match_dup 1)))]
15779 ""
15780 - [(set_attr "type" "aluq_l,aluq_l,lea,alu_l,alu_l,*,lea,lea,lea")
15781 - (set_attr "opy" "2,2,*,2,2,*,*,*,*")
15782 - (set_attr "opy_type" "*,*,mem5,*,*,*,mem6,mem6,mem5")])
15783 + [(set_attr "type" "aluq_l,aluq_l,lea, alu_l,alu_l,*,lea, lea, lea")
15784 + (set_attr "opy" "2, 2, *, 2, 2, *,*, *, *")
15785 + (set_attr "opy_type" "*, *, mem5,*, *, *,mem6,mem6,mem5")])
15786
15787 (define_insn ""
15788 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
15789 @@ -2666,7 +2699,7 @@
15790 (define_insn "add<mode>3_cf"
15791 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
15792 (plus:FP (match_operand:FP 1 "general_operand" "%0")
15793 - (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
15794 + (match_operand:FP 2 "general_operand" "f<FP:dreg>m")))]
15795 "TARGET_COLDFIRE_FPU"
15796 {
15797 if (FP_REG_P (operands[2]))
15798 @@ -2889,7 +2922,7 @@
15799 (define_insn "sub<mode>3_cf"
15800 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
15801 (minus:FP (match_operand:FP 1 "general_operand" "0")
15802 - (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
15803 + (match_operand:FP 2 "general_operand" "f<FP:dreg>m")))]
15804 "TARGET_COLDFIRE_FPU"
15805 {
15806 if (FP_REG_P (operands[2]))
15807 @@ -3245,7 +3278,7 @@
15808 (define_insn "fmul<mode>3_cf"
15809 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
15810 (mult:FP (match_operand:FP 1 "general_operand" "%0")
15811 - (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
15812 + (match_operand:FP 2 "general_operand" "fm<FP:dreg>")))]
15813 "TARGET_COLDFIRE_FPU"
15814 {
15815 if (FP_REG_P (operands[2]))
15816 @@ -3315,7 +3348,7 @@
15817 (define_insn "div<mode>3_cf"
15818 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
15819 (div:FP (match_operand:FP 1 "general_operand" "0")
15820 - (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
15821 + (match_operand:FP 2 "general_operand" "fm<FP:dreg>")))]
15822 "TARGET_COLDFIRE_FPU"
15823 {
15824 if (FP_REG_P (operands[2]))
15825 @@ -4163,7 +4196,7 @@
15826
15827 (define_insn "neg<mode>2_cf"
15828 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
15829 - (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
15830 + (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m,0")))]
15831 "TARGET_COLDFIRE_FPU"
15832 {
15833 if (DATA_REG_P (operands[0]))
15834 @@ -4197,7 +4230,7 @@
15835
15836 (define_insn "sqrt<mode>2_cf"
15837 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
15838 - (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
15839 + (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
15840 "TARGET_COLDFIRE_FPU"
15841 {
15842 if (FP_REG_P (operands[1]))
15843 @@ -4316,7 +4349,7 @@
15844
15845 (define_insn "abs<mode>2_cf"
15846 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
15847 - (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
15848 + (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m,0")))]
15849 "TARGET_COLDFIRE_FPU"
15850 {
15851 if (DATA_REG_P (operands[0]))
15852 diff -Nur a/gcc/config/m68k/m68k.opt b/gcc/config/m68k/m68k.opt
15853 --- a/gcc/config/m68k/m68k.opt 2009-02-20 16:20:38.000000000 +0100
15854 +++ b/gcc/config/m68k/m68k.opt 2010-01-25 09:50:29.025687257 +0100
15855 @@ -182,3 +182,7 @@
15856 mxgot
15857 Target Report Mask(XGOT)
15858 Support more than 8192 GOT entries on ColdFire
15859 +
15860 +mxtls
15861 +Target Report Mask(XTLS)
15862 +Support TLS segment larger than 64K
15863 diff -Nur a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h
15864 --- a/gcc/config/m68k/m68k-protos.h 2009-02-20 16:20:38.000000000 +0100
15865 +++ b/gcc/config/m68k/m68k-protos.h 2010-01-25 09:50:29.025687257 +0100
15866 @@ -54,19 +54,27 @@
15867 extern bool m68k_output_addr_const_extra (FILE *, rtx);
15868 extern void notice_update_cc (rtx, rtx);
15869 extern bool m68k_legitimate_base_reg_p (rtx, bool);
15870 -extern bool m68k_legitimate_index_reg_p (rtx, bool);
15871 +extern bool m68k_legitimate_index_reg_p (enum machine_mode, rtx, bool);
15872 extern bool m68k_illegitimate_symbolic_constant_p (rtx);
15873 extern bool m68k_legitimate_address_p (enum machine_mode, rtx, bool);
15874 extern bool m68k_matches_q_p (rtx);
15875 extern bool m68k_matches_u_p (rtx);
15876 extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
15877 +extern rtx m68k_legitimize_tls_address (rtx);
15878 +extern bool m68k_tls_reference_p (rtx, bool);
15879 +extern rtx m68k_legitimize_address (rtx, rtx, enum machine_mode);
15880 extern int valid_dbcc_comparison_p_2 (rtx, enum machine_mode);
15881 extern rtx m68k_libcall_value (enum machine_mode);
15882 extern rtx m68k_function_value (const_tree, const_tree);
15883 extern int emit_move_sequence (rtx *, enum machine_mode, rtx);
15884 extern bool m68k_movem_pattern_p (rtx, rtx, HOST_WIDE_INT, bool);
15885 extern const char *m68k_output_movem (rtx *, rtx, HOST_WIDE_INT, bool);
15886 +extern void m68k_final_prescan_insn (rtx, rtx *, int);
15887
15888 +/* Functions from m68k.c used in constraints.md. */
15889 +extern rtx m68k_unwrap_symbol (rtx, bool);
15890 +
15891 +/* Functions from m68k.c used in genattrtab. */
15892 #ifdef HAVE_ATTR_cpu
15893 extern enum attr_cpu m68k_sched_cpu;
15894 extern enum attr_mac m68k_sched_mac;
15895 diff -Nur a/gcc/config/m68k/predicates.md b/gcc/config/m68k/predicates.md
15896 --- a/gcc/config/m68k/predicates.md 2007-09-24 23:00:22.000000000 +0200
15897 +++ b/gcc/config/m68k/predicates.md 2010-01-25 09:50:29.025687257 +0100
15898 @@ -130,7 +130,9 @@
15899 (match_code "sign_extend,zero_extend"))
15900
15901 ;; Returns true if OP is either a symbol reference or a sum of a
15902 -;; symbol reference and a constant.
15903 +;; symbol reference and a constant. This predicate is for "raw"
15904 +;; symbol references not yet processed by legitimize*_address,
15905 +;; hence we do not handle UNSPEC_{XGOT, TLS, XTLS} here.
15906
15907 (define_predicate "symbolic_operand"
15908 (match_code "symbol_ref,label_ref,const")
15909 diff -Nur a/gcc/config/m68k/t-uclinux b/gcc/config/m68k/t-uclinux
15910 --- a/gcc/config/m68k/t-uclinux 2008-04-03 08:12:27.000000000 +0200
15911 +++ b/gcc/config/m68k/t-uclinux 2010-01-25 09:50:29.025687257 +0100
15912 @@ -1,8 +1,8 @@
15913 # crti and crtn are provided by uClibc.
15914 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
15915
15916 -# Only include multilibs for the 68020 and for CPUs without an MMU.
15917 -M68K_MLIB_CPU += && (MLIB == "68020" || !match(FLAGS, "FL_MMU"))
15918 +# Include multilibs for CPUs without an MMU or with FL_UCLINUX
15919 +M68K_MLIB_CPU += && (!match(FLAGS, "FL_MMU") || match(FLAGS, "FL_UCLINUX"))
15920
15921 # Add multilibs for execute-in-place and shared-library code.
15922 M68K_MLIB_OPTIONS += msep-data/mid-shared-library
15923 diff -Nur a/gcc/config/mips/74k.md b/gcc/config/mips/74k.md
15924 --- a/gcc/config/mips/74k.md 2007-08-02 12:49:31.000000000 +0200
15925 +++ b/gcc/config/mips/74k.md 2010-01-25 09:50:29.025687257 +0100
15926 @@ -118,8 +118,7 @@
15927 ;; stores
15928 (define_insn_reservation "r74k_int_store" 1
15929 (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
15930 - (and (eq_attr "type" "store")
15931 - (eq_attr "mode" "!unknown")))
15932 + (eq_attr "type" "store"))
15933 "r74k_agen")
15934
15935
15936 @@ -145,33 +144,123 @@
15937 ;; load->load base: 4 cycles
15938 ;; load->store base: 4 cycles
15939 (define_bypass 4 "r74k_int_load" "r74k_int_load")
15940 -(define_bypass 4 "r74k_int_load" "r74k_int_store" "!store_data_bypass_p")
15941 +(define_bypass 4 "r74k_int_load" "r74k_int_store" "!mips_store_data_bypass_p")
15942
15943 ;; logical/move/slt/signext->next use : 1 cycles (Default)
15944 ;; logical/move/slt/signext->load base: 2 cycles
15945 ;; logical/move/slt/signext->store base: 2 cycles
15946 (define_bypass 2 "r74k_int_logical" "r74k_int_load")
15947 -(define_bypass 2 "r74k_int_logical" "r74k_int_store" "!store_data_bypass_p")
15948 +(define_bypass 2 "r74k_int_logical" "r74k_int_store"
15949 + "!mips_store_data_bypass_p")
15950
15951 ;; arith->next use : 2 cycles (Default)
15952 ;; arith->load base: 3 cycles
15953 ;; arith->store base: 3 cycles
15954 (define_bypass 3 "r74k_int_arith" "r74k_int_load")
15955 -(define_bypass 3 "r74k_int_arith" "r74k_int_store" "!store_data_bypass_p")
15956 +(define_bypass 3 "r74k_int_arith" "r74k_int_store" "!mips_store_data_bypass_p")
15957
15958 ;; cmove->next use : 4 cycles (Default)
15959 ;; cmove->load base: 5 cycles
15960 ;; cmove->store base: 5 cycles
15961 (define_bypass 5 "r74k_int_cmove" "r74k_int_load")
15962 -(define_bypass 5 "r74k_int_cmove" "r74k_int_store" "!store_data_bypass_p")
15963 +(define_bypass 5 "r74k_int_cmove" "r74k_int_store"
15964 + "!mips_store_data_bypass_p")
15965
15966 ;; mult/madd/msub->int_mfhilo : 4 cycles (default)
15967 ;; mult->madd/msub : 1 cycles
15968 ;; madd/msub->madd/msub : 1 cycles
15969 -(define_bypass 1 "r74k_int_mult,r74k_int_mul3" "r74k_int_madd"
15970 - "mips_linked_madd_p")
15971 -(define_bypass 1 "r74k_int_madd" "r74k_int_madd"
15972 - "mips_linked_madd_p")
15973 +(define_bypass 1 "r74k_int_mult" "r74k_int_madd")
15974 +(define_bypass 1 "r74k_int_madd" "r74k_int_madd")
15975 +
15976 +(define_bypass 1 "r74k_int_mul3" "r74k_int_madd"
15977 + "mips_mult_madd_chain_bypass_p")
15978 +
15979 +
15980 +;; --------------------------------------------------------------
15981 +;; DSP instructins
15982 +;; --------------------------------------------------------------
15983 +
15984 +;; Non-saturating insn have the same latency as normal ALU operations,
15985 +(define_insn_reservation "r74k_dsp_alu" 2
15986 + (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
15987 + (eq_attr "type" "dspalu"))
15988 + "r74k_alu")
15989 +
15990 +;; Saturating insn takes an extra cycle.
15991 +(define_insn_reservation "r74k_dsp_alu_sat" 3
15992 + (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
15993 + (eq_attr "type" "dspalusat"))
15994 + "r74k_alu")
15995 +
15996 +;; dpaq_s, dpau, dpsq_s, dpsu, maq_s, mulsaq
15997 +;; - delivers result to hi/lo in 6 cycle (bypass at M4)
15998 +(define_insn_reservation "r74k_dsp_mac" 6
15999 + (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
16000 + (eq_attr "type" "dspmac"))
16001 + "r74k_alu+r74k_mul")
16002 +
16003 +;; dpaq_sa, dpsq_sa, maq_sa
16004 +;; - delivers result to hi/lo in 7 cycle (bypass at WB)
16005 +(define_insn_reservation "r74k_dsp_mac_sat" 7
16006 + (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
16007 + (eq_attr "type" "dspmacsat"))
16008 + "r74k_alu+r74k_mul")
16009 +
16010 +;; extp, extpdp, extpdpv, extpv, extr, extrv
16011 +;; - same latency as "mul"
16012 +(define_insn_reservation "r74k_dsp_acc_ext" 7
16013 + (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
16014 + (eq_attr "type" "accext"))
16015 + "r74k_alu+r74k_mul")
16016 +
16017 +;; mthlip, shilo, shilov
16018 +;; - same latency as "mul"
16019 +(define_insn_reservation "r74k_dsp_acc_mod" 7
16020 + (and (eq_attr "cpu" "74kc,74kf2_1,74kf1_1,74kf3_2")
16021 + (eq_attr "type" "accmod"))
16022 + "r74k_alu+r74k_mul")
16023 +
16024 +;; dspalu ->load/store base
16025 +;; dspalusat->load/store base
16026 +;; - we should never see these in real life.
16027 +
16028 +;; dsp_mac->dsp_mac : 1 cycles (repeat rate of 1)
16029 +;; dsp_mac->dsp_mac_sat : 1 cycles (repeat rate of 1)
16030 +(define_bypass 1 "r74k_dsp_mac" "r74k_dsp_mac")
16031 +(define_bypass 1 "r74k_dsp_mac" "r74k_dsp_mac_sat")
16032 +
16033 +;; dsp_mac_sat->dsp_mac_sat : 2 cycles (repeat rate of 2)
16034 +;; dsp_mac_sat->dsp_mac : 2 cycles (repeat rate of 2)
16035 +(define_bypass 2 "r74k_dsp_mac_sat" "r74k_dsp_mac_sat")
16036 +(define_bypass 2 "r74k_dsp_mac_sat" "r74k_dsp_mac")
16037 +
16038 +(define_bypass 1 "r74k_int_mult" "r74k_dsp_mac")
16039 +(define_bypass 1 "r74k_int_mult" "r74k_dsp_mac_sat")
16040 +
16041 +;; Before reload, all multiplier is registered as imul3 (which has a long
16042 +;; latency). We temporary jig the latency such that the macc groups
16043 +;; are scheduled closely together during the first scheduler pass.
16044 +(define_bypass 1 "r74k_int_mul3" "r74k_dsp_mac"
16045 + "mips_mult_madd_chain_bypass_p")
16046 +(define_bypass 1 "r74k_int_mul3" "r74k_dsp_mac_sat"
16047 + "mips_mult_madd_chain_bypass_p")
16048 +
16049 +;; Assuming the following is true (bypass at M4)
16050 +;; AP AF AM MB M1 M2 M3 M4 WB GR GC
16051 +;; AP AF AM MB M1 M2 M3 M4 WB GR GC
16052 +;; dsp_mac->dsp_acc_ext : 4 cycles
16053 +;; dsp_mac->dsp_acc_mod : 4 cycles
16054 +(define_bypass 4 "r74k_dsp_mac" "r74k_dsp_acc_ext")
16055 +(define_bypass 4 "r74k_dsp_mac" "r74k_dsp_acc_mod")
16056 +
16057 +;; Assuming the following is true (bypass at WB)
16058 +;; AP AF AM MB M1 M2 M3 M4 WB GR GC
16059 +;; AP AF AM MB M1 M2 M3 M4 WB GR GC
16060 +;; dsp_mac_sat->dsp_acc_ext : 5 cycles
16061 +;; dsp_mac_sat->dsp_acc_mod : 5 cycles
16062 +(define_bypass 5 "r74k_dsp_mac_sat" "r74k_dsp_acc_ext")
16063 +(define_bypass 5 "r74k_dsp_mac_sat" "r74k_dsp_acc_mod")
16064 +
16065
16066 ;; --------------------------------------------------------------
16067 ;; Floating Point Instructions
16068 diff -Nur a/gcc/config/mips/crtfastmath.c b/gcc/config/mips/crtfastmath.c
16069 --- a/gcc/config/mips/crtfastmath.c 1970-01-01 01:00:00.000000000 +0100
16070 +++ b/gcc/config/mips/crtfastmath.c 2010-01-25 09:50:29.025687257 +0100
16071 @@ -0,0 +1,53 @@
16072 +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
16073 +
16074 + This file is part of GCC.
16075 +
16076 + GCC is free software; you can redistribute it and/or modify it
16077 + under the terms of the GNU General Public License as published by
16078 + the Free Software Foundation; either version 3, or (at your option)
16079 + any later version.
16080 +
16081 + GCC is distributed in the hope that it will be useful, but WITHOUT
16082 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16083 + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16084 + License for more details.
16085 +
16086 + Under Section 7 of GPL version 3, you are granted additional
16087 + permissions described in the GCC Runtime Library Exception, version
16088 + 3.1, as published by the Free Software Foundation.
16089 +
16090 + You should have received a copy of the GNU General Public License
16091 + and a copy of the GCC Runtime Library Exception along with this
16092 + program; see the files COPYING3 and COPYING.RUNTIME respectively.
16093 + If not, see <http://www.gnu.org/licenses/>. */
16094 +
16095 +#ifdef __mips_hard_float
16096 +
16097 +/* flush denormalized numbers to zero */
16098 +#define _FPU_FLUSH_TZ 0x1000000
16099 +
16100 +/* rounding control */
16101 +#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
16102 +#define _FPU_RC_ZERO 0x1
16103 +#define _FPU_RC_UP 0x2
16104 +#define _FPU_RC_DOWN 0x3
16105 +
16106 +/* enable interrupts for IEEE exceptions */
16107 +#define _FPU_IEEE 0x00000F80
16108 +
16109 +/* Macros for accessing the hardware control word. */
16110 +#define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw))
16111 +#define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw))
16112 +
16113 +static void __attribute__((constructor))
16114 +set_fast_math (void)
16115 +{
16116 + unsigned int fcr;
16117 +
16118 + /* fastmath: flush to zero, round to nearest, ieee exceptions disabled */
16119 + fcr = _FPU_FLUSH_TZ | _FPU_RC_NEAREST;
16120 +
16121 + _FPU_SETCW(fcr);
16122 +}
16123 +
16124 +#endif /* __mips_hard_float */
16125 diff -Nur a/gcc/config/mips/cs-sgxx-linux.h b/gcc/config/mips/cs-sgxx-linux.h
16126 --- a/gcc/config/mips/cs-sgxx-linux.h 1970-01-01 01:00:00.000000000 +0100
16127 +++ b/gcc/config/mips/cs-sgxx-linux.h 2010-01-25 09:50:29.025687257 +0100
16128 @@ -0,0 +1,44 @@
16129 +/* MIPS SourceryG++ GNU/Linux Configuration.
16130 + Copyright (C) 2008
16131 + Free Software Foundation, Inc.
16132 +
16133 +This file is part of GCC.
16134 +
16135 +GCC is free software; you can redistribute it and/or modify
16136 +it under the terms of the GNU General Public License as published by
16137 +the Free Software Foundation; either version 3, or (at your option)
16138 +any later version.
16139 +
16140 +GCC is distributed in the hope that it will be useful,
16141 +but WITHOUT ANY WARRANTY; without even the implied warranty of
16142 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16143 +GNU General Public License for more details.
16144 +
16145 +You should have received a copy of the GNU General Public License
16146 +along with GCC; see the file COPYING3. If not see
16147 +<http://www.gnu.org/licenses/>. */
16148 +
16149 +/* We do not need to provide an explicit big-endian multilib. */
16150 +#undef MULTILIB_DEFAULTS
16151 +#define MULTILIB_DEFAULTS \
16152 + { "EB" }
16153 +
16154 +/* The various C libraries each have their own subdirectory. */
16155 +#undef SYSROOT_SUFFIX_SPEC
16156 +#define SYSROOT_SUFFIX_SPEC \
16157 +"%{muclibc:/uclibc}\
16158 +%{mips2|mips3|mips4|march=mips2|march=mips3|march=mips4|march=r6000|\
16159 +march=r4000|march=vr4100|march=vr4111|march=vr4120|march=vr4130|\
16160 +march=vr4300|march=r4400|march=r4600|march=orion|march=r4650|\
16161 +march=loongson2e|march=loongson2f|march=r8000|march=r10000|\
16162 +march=r12000|march=r14000|march=r16000|\
16163 +march=vr5000|march=vr5400|march=vr5500|march=rm7000|\
16164 +march=rm9000:/mips2;\
16165 +mips32|march=mips32|march=4kc|march=4km|march=4kp|march=4ksc|\
16166 +mips64|march=mips64|march=5kc|march=5kf|march=20kc|march=sb1|march=sb1a|\
16167 +march=sr71000|march=xlr:/mips32}\
16168 +%{msoft-float:/soft-float}%{mel|EL:/el}"
16169 +
16170 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
16171 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
16172 + "%{muclibc:/uclibc}"
16173 diff -Nur a/gcc/config/mips/cs-sgxxlite-linux.h b/gcc/config/mips/cs-sgxxlite-linux.h
16174 --- a/gcc/config/mips/cs-sgxxlite-linux.h 1970-01-01 01:00:00.000000000 +0100
16175 +++ b/gcc/config/mips/cs-sgxxlite-linux.h 2010-01-25 09:50:29.025687257 +0100
16176 @@ -0,0 +1,33 @@
16177 +/* MIPS SourceryG++ GNU/Linux Configuration.
16178 + Copyright (C) 2008
16179 + Free Software Foundation, Inc.
16180 +
16181 +This file is part of GCC.
16182 +
16183 +GCC is free software; you can redistribute it and/or modify
16184 +it under the terms of the GNU General Public License as published by
16185 +the Free Software Foundation; either version 3, or (at your option)
16186 +any later version.
16187 +
16188 +GCC is distributed in the hope that it will be useful,
16189 +but WITHOUT ANY WARRANTY; without even the implied warranty of
16190 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16191 +GNU General Public License for more details.
16192 +
16193 +You should have received a copy of the GNU General Public License
16194 +along with GCC; see the file COPYING3. If not see
16195 +<http://www.gnu.org/licenses/>. */
16196 +
16197 +/* We do not need to provide an explicit big-endian multilib. */
16198 +#undef MULTILIB_DEFAULTS
16199 +#define MULTILIB_DEFAULTS \
16200 + { "EB" }
16201 +
16202 +/* The various C libraries each have their own subdirectory. */
16203 +#undef SYSROOT_SUFFIX_SPEC
16204 +#define SYSROOT_SUFFIX_SPEC \
16205 +"%{muclibc:/uclibc}%{msoft-float:/soft-float}%{mel|EL:/el}"
16206 +
16207 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
16208 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
16209 + "%{muclibc:/uclibc}"
16210 diff -Nur a/gcc/config/mips/linux64.h b/gcc/config/mips/linux64.h
16211 --- a/gcc/config/mips/linux64.h 2009-02-20 16:20:38.000000000 +0100
16212 +++ b/gcc/config/mips/linux64.h 2010-01-25 09:50:29.025687257 +0100
16213 @@ -69,3 +69,9 @@
16214 ieee_quad_format is the default, but let's put this here to make
16215 sure nobody thinks we just forgot to set it to something else. */
16216 #define MIPS_TFMODE_FORMAT mips_quad_format
16217 +
16218 +/* Similar to standard Linux, but adding -ffast-math support. */
16219 +#undef ENDFILE_SPEC
16220 +#define ENDFILE_SPEC \
16221 + "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
16222 + %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
16223 diff -Nur a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
16224 --- a/gcc/config/mips/linux.h 2009-02-20 16:20:38.000000000 +0100
16225 +++ b/gcc/config/mips/linux.h 2010-01-25 09:50:29.025687257 +0100
16226 @@ -147,3 +147,17 @@
16227 #define DRIVER_SELF_SPECS \
16228 BASE_DRIVER_SELF_SPECS, \
16229 LINUX_DRIVER_SELF_SPECS
16230 +
16231 +/* Similar to standard Linux, but adding -ffast-math support. */
16232 +#undef ENDFILE_SPEC
16233 +#define ENDFILE_SPEC \
16234 + "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
16235 + %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
16236 +
16237 +#undef SUBTARGET_OVERRIDE_OPTIONS
16238 +#define SUBTARGET_OVERRIDE_OPTIONS \
16239 +do { \
16240 + /* __thread_support is not supported by uClibc. */ \
16241 + if (linux_uclibc) \
16242 + targetm.have_tls = 0; \
16243 +} while (0)
16244 diff -Nur a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
16245 --- a/gcc/config/mips/mips.c 2009-03-02 21:26:22.000000000 +0100
16246 +++ b/gcc/config/mips/mips.c 2010-01-25 09:50:29.025687257 +0100
16247 @@ -261,18 +261,29 @@
16248 /* Likewise FPR X. */
16249 unsigned int fmask;
16250
16251 - /* The number of GPRs and FPRs saved. */
16252 + /* Likewise doubleword accumulator X ($acX). */
16253 + unsigned int acc_mask;
16254 +
16255 + /* The number of GPRs, FPRs, doubleword accumulators and COP0
16256 + registers saved. */
16257 unsigned int num_gp;
16258 unsigned int num_fp;
16259 + unsigned int num_acc;
16260 + unsigned int num_cop0_regs;
16261
16262 - /* The offset of the topmost GPR and FPR save slots from the top of
16263 - the frame, or zero if no such slots are needed. */
16264 + /* The offset of the topmost GPR, FPR, accumulator and COP0-register
16265 + save slots from the top of the frame, or zero if no such slots are
16266 + needed. */
16267 HOST_WIDE_INT gp_save_offset;
16268 HOST_WIDE_INT fp_save_offset;
16269 + HOST_WIDE_INT acc_save_offset;
16270 + HOST_WIDE_INT cop0_save_offset;
16271
16272 /* Likewise, but giving offsets from the bottom of the frame. */
16273 HOST_WIDE_INT gp_sp_offset;
16274 HOST_WIDE_INT fp_sp_offset;
16275 + HOST_WIDE_INT acc_sp_offset;
16276 + HOST_WIDE_INT cop0_sp_offset;
16277
16278 /* The offset of arg_pointer_rtx from frame_pointer_rtx. */
16279 HOST_WIDE_INT arg_pointer_offset;
16280 @@ -310,6 +321,20 @@
16281 /* True if we have emitted an instruction to initialize
16282 mips16_gp_pseudo_rtx. */
16283 bool initialized_mips16_gp_pseudo_p;
16284 +
16285 + /* True if this is an interrupt handler. */
16286 + bool interrupt_handler_p;
16287 +
16288 + /* True if this is an interrupt handler that uses shadow registers. */
16289 + bool use_shadow_register_set_p;
16290 +
16291 + /* True if this is an interrupt handler that should keep interrupts
16292 + masked. */
16293 + bool keep_interrupts_masked_p;
16294 +
16295 + /* True if this is an interrupt handler that should use DERET
16296 + instead of ERET. */
16297 + bool use_debug_exception_return_p;
16298 };
16299
16300 /* Information about a single argument. */
16301 @@ -542,9 +567,16 @@
16302 ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS
16303 };
16304
16305 +#ifdef CVMX_SHARED_BSS_FLAGS
16306 +static tree octeon_handle_cvmx_shared_attribute (tree *, tree, tree, int, bool *);
16307 +#endif
16308 +
16309 /* The value of TARGET_ATTRIBUTE_TABLE. */
16310 const struct attribute_spec mips_attribute_table[] = {
16311 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
16312 +#ifdef CVMX_SHARED_BSS_FLAGS
16313 + { "cvmx_shared", 0, 0, true, false, false, octeon_handle_cvmx_shared_attribute },
16314 +#endif
16315 { "long_call", 0, 0, false, true, true, NULL },
16316 { "far", 0, 0, false, true, true, NULL },
16317 { "near", 0, 0, false, true, true, NULL },
16318 @@ -554,6 +586,11 @@
16319 code generation but don't carry other semantics. */
16320 { "mips16", 0, 0, true, false, false, NULL },
16321 { "nomips16", 0, 0, true, false, false, NULL },
16322 + /* Allow functions to be specified as interrupt handlers */
16323 + { "interrupt", 0, 0, false, true, true, NULL },
16324 + { "use_shadow_register_set", 0, 0, false, true, true, NULL },
16325 + { "keep_interrupts_masked", 0, 0, false, true, true, NULL },
16326 + { "use_debug_exception_return", 0, 0, false, true, true, NULL },
16327 { NULL, 0, 0, false, false, false, NULL }
16328 };
16329 \f
16330 @@ -659,6 +696,11 @@
16331 { "74kx", PROCESSOR_74KF1_1, 33, 0 },
16332 { "74kf3_2", PROCESSOR_74KF3_2, 33, 0 },
16333
16334 + { "1004kc", PROCESSOR_24KC, 33, 0 }, /* 1004K with MT/DSP. */
16335 + { "1004kf2_1", PROCESSOR_24KF2_1, 33, 0 },
16336 + { "1004kf", PROCESSOR_24KF2_1, 33, 0 },
16337 + { "1004kf1_1", PROCESSOR_24KF1_1, 33, 0 },
16338 +
16339 /* MIPS64 processors. */
16340 { "5kc", PROCESSOR_5KC, 64, 0 },
16341 { "5kf", PROCESSOR_5KF, 64, 0 },
16342 @@ -1064,13 +1106,7 @@
16343 DEFAULT_COSTS
16344 },
16345 { /* XLR */
16346 - /* Need to replace first five with the costs of calling the appropriate
16347 - libgcc routine. */
16348 - COSTS_N_INSNS (256), /* fp_add */
16349 - COSTS_N_INSNS (256), /* fp_mult_sf */
16350 - COSTS_N_INSNS (256), /* fp_mult_df */
16351 - COSTS_N_INSNS (256), /* fp_div_sf */
16352 - COSTS_N_INSNS (256), /* fp_div_df */
16353 + SOFT_FP_COSTS,
16354 COSTS_N_INSNS (8), /* int_mult_si */
16355 COSTS_N_INSNS (8), /* int_mult_di */
16356 COSTS_N_INSNS (72), /* int_div_si */
16357 @@ -1172,6 +1208,42 @@
16358 return lookup_attribute ("nomips16", DECL_ATTRIBUTES (decl)) != NULL;
16359 }
16360
16361 +/* Check if the interrupt attribute is set for a function. */
16362 +
16363 +static bool
16364 +mips_interrupt_type_p (tree type)
16365 +{
16366 + return lookup_attribute ("interrupt", TYPE_ATTRIBUTES (type)) != NULL;
16367 +}
16368 +
16369 +/* Check if the attribute to use shadow register set is set for a function. */
16370 +
16371 +static bool
16372 +mips_use_shadow_register_set_p (tree type)
16373 +{
16374 + return lookup_attribute ("use_shadow_register_set",
16375 + TYPE_ATTRIBUTES (type)) != NULL;
16376 +}
16377 +
16378 +/* Check if the attribute to keep interrupts masked is set for a function. */
16379 +
16380 +static bool
16381 +mips_keep_interrupts_masked_p (tree type)
16382 +{
16383 + return lookup_attribute ("keep_interrupts_masked",
16384 + TYPE_ATTRIBUTES (type)) != NULL;
16385 +}
16386 +
16387 +/* Check if the attribute to use debug exception return is set for
16388 + a function. */
16389 +
16390 +static bool
16391 +mips_use_debug_exception_return_p (tree type)
16392 +{
16393 + return lookup_attribute ("use_debug_exception_return",
16394 + TYPE_ATTRIBUTES (type)) != NULL;
16395 +}
16396 +
16397 /* Return true if function DECL is a MIPS16 function. Return the ambient
16398 setting if DECL is null. */
16399
16400 @@ -2795,7 +2867,7 @@
16401 mips_legitimize_address (rtx *xloc, enum machine_mode mode)
16402 {
16403 rtx base, addr;
16404 - HOST_WIDE_INT offset;
16405 + HOST_WIDE_INT intval, high, offset;
16406
16407 if (mips_tls_symbol_p (*xloc))
16408 {
16409 @@ -2820,6 +2892,32 @@
16410 *xloc = mips_force_address (addr, mode);
16411 return true;
16412 }
16413 +
16414 + /* Handle references to constant addresses by loading the high part
16415 + into a register and using an offset for the low part. */
16416 + if (GET_CODE (base) == CONST_INT)
16417 + {
16418 + intval = INTVAL (base);
16419 + high = trunc_int_for_mode (CONST_HIGH_PART (intval), Pmode);
16420 + offset = CONST_LOW_PART (intval);
16421 + /* Ignore cases in which a positive address would be accessed by a
16422 + negative offset from a negative address. The required wraparound
16423 + does not occur for 32-bit addresses on 64-bit targets, and it is
16424 + very unlikely that such an access would occur in real code anyway.
16425 +
16426 + If the low offset is not legitimate for MODE, prefer to load
16427 + the constant normally, instead of using mips_force_address on
16428 + the legitimized address. The latter option would cause us to
16429 + use (D)ADDIU unconditionally, but LUI/ORI is more efficient
16430 + than LUI/ADDIU on some targets. */
16431 + if ((intval < 0 || high > 0)
16432 + && mips_valid_offset_p (GEN_INT (offset), mode))
16433 + {
16434 + base = mips_force_temporary (NULL, GEN_INT (high));
16435 + *xloc = plus_constant (base, offset);
16436 + return true;
16437 + }
16438 + }
16439 return false;
16440 }
16441
16442 @@ -6188,6 +6286,11 @@
16443 if (!TARGET_SIBCALLS)
16444 return false;
16445
16446 + /* Interrupt handlers need special epilogue code and therefore can't
16447 + use sibcalls. */
16448 + if (mips_interrupt_type_p (TREE_TYPE (current_function_decl)))
16449 + return false;
16450 +
16451 /* We can't do a sibcall if the called function is a MIPS16 function
16452 because there is no direct "jx" instruction equivalent to "jalx" to
16453 switch the ISA mode. We only care about cases where the sibling
16454 @@ -6608,6 +6711,15 @@
16455 if (!mips_get_unaligned_mem (&src, width, bitpos, &left, &right))
16456 return false;
16457
16458 + if (ISA_HAS_UL_US)
16459 + {
16460 + if (GET_MODE (dest) == DImode)
16461 + emit_insn (gen_mov_uld (dest, src, left));
16462 + else
16463 + emit_insn (gen_mov_ulw (dest, src, left));
16464 + return true;
16465 + }
16466 +
16467 temp = gen_reg_rtx (GET_MODE (dest));
16468 if (GET_MODE (dest) == DImode)
16469 {
16470 @@ -6642,6 +6754,16 @@
16471
16472 mode = mode_for_size (width, MODE_INT, 0);
16473 src = gen_lowpart (mode, src);
16474 +
16475 + if (ISA_HAS_UL_US)
16476 + {
16477 + if (GET_MODE (src) == DImode)
16478 + emit_insn (gen_mov_usd (dest, src, left));
16479 + else
16480 + emit_insn (gen_mov_usw (dest, src, left));
16481 + return true;
16482 + }
16483 +
16484 if (mode == DImode)
16485 {
16486 emit_insn (gen_mov_sdl (dest, src, left));
16487 @@ -7229,7 +7351,11 @@
16488 || (letter == 'L' && TARGET_BIG_ENDIAN)
16489 || letter == 'D')
16490 regno++;
16491 - fprintf (file, "%s", reg_names[regno]);
16492 + /* We need to print $0 .. $31 for COP0 registers. */
16493 + if (COP0_REG_P (regno))
16494 + fprintf (file, "$%s", &reg_names[regno][4]);
16495 + else
16496 + fprintf (file, "%s", reg_names[regno]);
16497 }
16498 break;
16499
16500 @@ -7369,6 +7495,12 @@
16501 if (TARGET_ABICALLS || TARGET_VXWORKS_RTP)
16502 return false;
16503
16504 +#ifdef CVMX_SHARED_BSS_FLAGS
16505 + if (TARGET_OCTEON && TREE_CODE (decl) == VAR_DECL
16506 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (decl)))
16507 + return false;
16508 +#endif
16509 +
16510 if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl) != 0)
16511 {
16512 const char *name;
16513 @@ -7595,6 +7727,37 @@
16514 return NULL_RTX;
16515 }
16516
16517 +/* DSP ALU can bypass data with no delays for the following pairs. */
16518 +enum insn_code dspalu_bypass_table[][2] =
16519 +{
16520 + {CODE_FOR_mips_addsc, CODE_FOR_mips_addwc},
16521 + {CODE_FOR_mips_cmpu_eq_qb, CODE_FOR_mips_pick_qb},
16522 + {CODE_FOR_mips_cmpu_lt_qb, CODE_FOR_mips_pick_qb},
16523 + {CODE_FOR_mips_cmpu_le_qb, CODE_FOR_mips_pick_qb},
16524 + {CODE_FOR_mips_cmp_eq_ph, CODE_FOR_mips_pick_ph},
16525 + {CODE_FOR_mips_cmp_lt_ph, CODE_FOR_mips_pick_ph},
16526 + {CODE_FOR_mips_cmp_le_ph, CODE_FOR_mips_pick_ph},
16527 + {CODE_FOR_mips_wrdsp, CODE_FOR_mips_insv}
16528 +};
16529 +
16530 +int
16531 +mips_dspalu_bypass_p (rtx out_insn, rtx in_insn)
16532 +{
16533 + int i;
16534 + int num_bypass = (sizeof (dspalu_bypass_table)
16535 + / (2 * sizeof (enum insn_code)));
16536 + enum insn_code out_icode = INSN_CODE (out_insn);
16537 + enum insn_code in_icode = INSN_CODE (in_insn);
16538 +
16539 + for (i = 0; i < num_bypass; i++)
16540 + {
16541 + if (out_icode == dspalu_bypass_table[i][0]
16542 + && in_icode == dspalu_bypass_table[i][1])
16543 + return true;
16544 + }
16545 +
16546 + return false;
16547 +}
16548 /* Implement ASM_OUTPUT_ASCII. */
16549
16550 void
16551 @@ -7819,11 +7982,19 @@
16552 "\t.previous\n", TARGET_LONG64 ? 64 : 32);
16553
16554 #ifdef HAVE_AS_GNU_ATTRIBUTE
16555 +#ifdef TARGET_MIPS_SDEMTK
16556 + fprintf (asm_out_file, "\t.gnu_attribute 4, %d\n",
16557 + (!TARGET_NO_FLOAT
16558 + ? (TARGET_HARD_FLOAT
16559 + ? (TARGET_DOUBLE_FLOAT
16560 + ? ((!TARGET_64BIT && TARGET_FLOAT64) ? 4 : 1) : 2) : 3) : 0));
16561 +#else
16562 fprintf (asm_out_file, "\t.gnu_attribute 4, %d\n",
16563 (TARGET_HARD_FLOAT_ABI
16564 ? (TARGET_DOUBLE_FLOAT
16565 ? ((!TARGET_64BIT && TARGET_FLOAT64) ? 4 : 1) : 2) : 3));
16566 #endif
16567 +#endif
16568 }
16569
16570 /* If TARGET_ABICALLS, tell GAS to generate -KPIC code. */
16571 @@ -8436,12 +8607,53 @@
16572 return GLOBAL_POINTER_REGNUM;
16573 }
16574
16575 +/* Return true if REGNO is a register that is ordinarily call-clobbered
16576 + but must nevertheless be preserved by an interrupt handler. */
16577 +
16578 +static bool
16579 +mips_interrupt_extra_call_saved_reg_p (unsigned int regno)
16580 +{
16581 + if (MD_REG_P (regno))
16582 + return true;
16583 +
16584 + if (TARGET_DSP && DSP_ACC_REG_P (regno))
16585 + return true;
16586 +
16587 + if (GP_REG_P (regno) && !cfun->machine->use_shadow_register_set_p)
16588 + {
16589 + /* $0 is hard-wired. */
16590 + if (regno == GP_REG_FIRST)
16591 + return false;
16592 +
16593 + /* The interrupt handler can treat kernel registers as
16594 + scratch registers. */
16595 + if (KERNEL_REG_P (regno))
16596 + return false;
16597 +
16598 + /* The function will return the stack pointer to its original value
16599 + anyway. */
16600 + if (regno == STACK_POINTER_REGNUM)
16601 + return false;
16602 +
16603 + /* Otherwise, return true for registers that aren't ordinarily
16604 + call-clobbered. */
16605 + return call_really_used_regs[regno];
16606 + }
16607 +
16608 + return false;
16609 +}
16610 +
16611 /* Return true if the current function should treat register REGNO
16612 as call-saved. */
16613
16614 static bool
16615 mips_cfun_call_saved_reg_p (unsigned int regno)
16616 {
16617 + /* Interrupt handlers need to save extra registers. */
16618 + if (cfun->machine->interrupt_handler_p
16619 + && mips_interrupt_extra_call_saved_reg_p (regno))
16620 + return true;
16621 +
16622 /* call_insns preserve $28 unless they explicitly say otherwise,
16623 so call_really_used_regs[] treats $28 as call-saved. However,
16624 we want the ABI property rather than the default call_insn
16625 @@ -8490,6 +8702,13 @@
16626 if (regno == GP_REG_FIRST + 31 && mips16_cfun_returns_in_fpr_p ())
16627 return true;
16628
16629 + /* If REGNO is ordinarily call-clobbered, we must assume that any
16630 + called function could modify it. */
16631 + if (cfun->machine->interrupt_handler_p
16632 + && !current_function_is_leaf
16633 + && mips_interrupt_extra_call_saved_reg_p (regno))
16634 + return true;
16635 +
16636 return false;
16637 }
16638
16639 @@ -8545,6 +8764,14 @@
16640 C | callee-allocated save area |
16641 | for register varargs |
16642 | |
16643 + +-------------------------------+ <-- frame_pointer_rtx
16644 + | | + cop0_sp_offset
16645 + | COP0 reg save area | + UNITS_PER_WORD
16646 + | |
16647 + +-------------------------------+ <-- frame_pointer_rtx + acc_sp_offset
16648 + | | + UNITS_PER_WORD
16649 + | accumulator save area |
16650 + | |
16651 +-------------------------------+ <-- frame_pointer_rtx + fp_sp_offset
16652 | | + UNITS_PER_HWFPVALUE
16653 | FPR save area |
16654 @@ -8588,6 +8815,28 @@
16655 HOST_WIDE_INT offset, size;
16656 unsigned int regno, i;
16657
16658 + /* Set this function's interrupt properties. */
16659 + if (mips_interrupt_type_p (TREE_TYPE (current_function_decl)))
16660 + {
16661 + if (!ISA_MIPS32R2)
16662 + error ("the %<interrupt%> attribute requires a MIPS32r2 processor");
16663 + else if (TARGET_HARD_FLOAT)
16664 + error ("the %<interrupt%> attribute requires %<-msoft-float%>");
16665 + else if (TARGET_MIPS16)
16666 + error ("interrupt handlers cannot be MIPS16 functions");
16667 + else
16668 + {
16669 + cfun->machine->interrupt_handler_p = true;
16670 + cfun->machine->use_shadow_register_set_p =
16671 + mips_use_shadow_register_set_p (TREE_TYPE (current_function_decl));
16672 + cfun->machine->keep_interrupts_masked_p =
16673 + mips_keep_interrupts_masked_p (TREE_TYPE (current_function_decl));
16674 + cfun->machine->use_debug_exception_return_p =
16675 + mips_use_debug_exception_return_p (TREE_TYPE
16676 + (current_function_decl));
16677 + }
16678 + }
16679 +
16680 frame = &cfun->machine->frame;
16681 memset (frame, 0, sizeof (*frame));
16682 size = get_frame_size ();
16683 @@ -8657,7 +8906,7 @@
16684 }
16685
16686 /* Find out which FPRs we need to save. This loop must iterate over
16687 - the same space as its companion in mips_for_each_saved_reg. */
16688 + the same space as its companion in mips_for_each_saved_gpr_and_fpr. */
16689 if (TARGET_HARD_FLOAT)
16690 for (regno = FP_REG_FIRST; regno <= FP_REG_LAST; regno += MAX_FPRS_PER_FMT)
16691 if (mips_save_reg_p (regno))
16692 @@ -8673,6 +8922,47 @@
16693 frame->fp_sp_offset = offset - UNITS_PER_HWFPVALUE;
16694 }
16695
16696 + /* Add in space for the interrupt context information. */
16697 + if (cfun->machine->interrupt_handler_p)
16698 + {
16699 + /* Check HI/LO. */
16700 + if (mips_save_reg_p (LO_REGNUM) || mips_save_reg_p (HI_REGNUM))
16701 + {
16702 + frame->num_acc++;
16703 + frame->acc_mask |= (1 << 0);
16704 + }
16705 +
16706 + /* Check accumulators 1, 2, 3. */
16707 + for (i = DSP_ACC_REG_FIRST; i <= DSP_ACC_REG_LAST; i += 2)
16708 + if (mips_save_reg_p (i) || mips_save_reg_p (i + 1))
16709 + {
16710 + frame->num_acc++;
16711 + frame->acc_mask |= 1 << (((i - DSP_ACC_REG_FIRST) / 2) + 1);
16712 + }
16713 +
16714 + /* All interrupt context functions need space to preserve STATUS. */
16715 + frame->num_cop0_regs++;
16716 +
16717 + /* If we don't keep interrupts masked, we need to save EPC. */
16718 + if (!cfun->machine->keep_interrupts_masked_p)
16719 + frame->num_cop0_regs++;
16720 + }
16721 +
16722 + /* Move above the accumulator save area. */
16723 + if (frame->num_acc > 0)
16724 + {
16725 + /* Each accumulator needs 2 words. */
16726 + offset += frame->num_acc * 2 * UNITS_PER_WORD;
16727 + frame->acc_sp_offset = offset - UNITS_PER_WORD;
16728 + }
16729 +
16730 + /* Move above the COP0 register save area. */
16731 + if (frame->num_cop0_regs > 0)
16732 + {
16733 + offset += frame->num_cop0_regs * UNITS_PER_WORD;
16734 + frame->cop0_sp_offset = offset - UNITS_PER_WORD;
16735 + }
16736 +
16737 /* Move above the callee-allocated varargs save area. */
16738 offset += MIPS_STACK_ALIGN (cfun->machine->varargs_size);
16739 frame->arg_pointer_offset = offset;
16740 @@ -8686,6 +8976,10 @@
16741 frame->gp_save_offset = frame->gp_sp_offset - offset;
16742 if (frame->fp_sp_offset > 0)
16743 frame->fp_save_offset = frame->fp_sp_offset - offset;
16744 + if (frame->acc_sp_offset > 0)
16745 + frame->acc_save_offset = frame->acc_sp_offset - offset;
16746 + if (frame->num_cop0_regs > 0)
16747 + frame->cop0_save_offset = frame->cop0_sp_offset - offset;
16748
16749 /* MIPS16 code offsets the frame pointer by the size of the outgoing
16750 arguments. This tends to increase the chances of using unextended
16751 @@ -8882,12 +9176,41 @@
16752 fn (gen_rtx_REG (mode, regno), mem);
16753 }
16754
16755 +/* Call FN for each accumlator that is saved by the current function.
16756 + SP_OFFSET is the offset of the current stack pointer from the start
16757 + of the frame. */
16758 +
16759 +static void
16760 +mips_for_each_saved_acc (HOST_WIDE_INT sp_offset, mips_save_restore_fn fn)
16761 +{
16762 + HOST_WIDE_INT offset;
16763 + int regno;
16764 +
16765 + offset = cfun->machine->frame.acc_sp_offset - sp_offset;
16766 + if (BITSET_P (cfun->machine->frame.acc_mask, 0))
16767 + {
16768 + mips_save_restore_reg (word_mode, LO_REGNUM, offset, fn);
16769 + offset -= UNITS_PER_WORD;
16770 + mips_save_restore_reg (word_mode, HI_REGNUM, offset, fn);
16771 + offset -= UNITS_PER_WORD;
16772 + }
16773 +
16774 + for (regno = DSP_ACC_REG_FIRST; regno <= DSP_ACC_REG_LAST; regno++)
16775 + if (BITSET_P (cfun->machine->frame.acc_mask,
16776 + ((regno - DSP_ACC_REG_FIRST) / 2) + 1))
16777 + {
16778 + mips_save_restore_reg (word_mode, regno, offset, fn);
16779 + offset -= UNITS_PER_WORD;
16780 + }
16781 +}
16782 +
16783 /* Call FN for each register that is saved by the current function.
16784 SP_OFFSET is the offset of the current stack pointer from the start
16785 of the frame. */
16786
16787 static void
16788 -mips_for_each_saved_reg (HOST_WIDE_INT sp_offset, mips_save_restore_fn fn)
16789 +mips_for_each_saved_gpr_and_fpr (HOST_WIDE_INT sp_offset,
16790 + mips_save_restore_fn fn)
16791 {
16792 enum machine_mode fpr_mode;
16793 HOST_WIDE_INT offset;
16794 @@ -9075,13 +9398,24 @@
16795 }
16796 else
16797 {
16798 - if (TARGET_MIPS16
16799 - && REGNO (reg) != GP_REG_FIRST + 31
16800 - && !M16_REG_P (REGNO (reg)))
16801 - {
16802 - /* Save a non-MIPS16 register by moving it through a temporary.
16803 - We don't need to do this for $31 since there's a special
16804 - instruction for it. */
16805 + if (REGNO (reg) == HI_REGNUM)
16806 + {
16807 + if (TARGET_64BIT)
16808 + emit_insn (gen_mfhidi_ti (MIPS_PROLOGUE_TEMP (DImode),
16809 + gen_rtx_REG (TImode, MD_REG_FIRST)));
16810 + else
16811 + emit_insn (gen_mfhisi_di (MIPS_PROLOGUE_TEMP (SImode),
16812 + gen_rtx_REG (DImode, MD_REG_FIRST)));
16813 + mips_emit_move (mem, MIPS_PROLOGUE_TEMP (GET_MODE (reg)));
16814 + }
16815 + else if ((TARGET_MIPS16
16816 + && REGNO (reg) != GP_REG_FIRST + 31
16817 + && !M16_REG_P (REGNO (reg)))
16818 + || ACC_REG_P (REGNO (reg)))
16819 + {
16820 + /* If the register has no direct store instruction, move it
16821 + through a temporary. Note that there's a special MIPS16
16822 + instruction to save $31. */
16823 mips_emit_move (MIPS_PROLOGUE_TEMP (GET_MODE (reg)), reg);
16824 mips_emit_move (mem, MIPS_PROLOGUE_TEMP (GET_MODE (reg)));
16825 }
16826 @@ -9153,6 +9487,14 @@
16827 emit_insn (gen_loadgp_blockage ());
16828 }
16829
16830 +/* A for_each_rtx callback. Stop the search if *X is a kernel register. */
16831 +
16832 +static int
16833 +mips_kernel_reg_p (rtx *x, void *data ATTRIBUTE_UNUSED)
16834 +{
16835 + return GET_CODE (*x) == REG && KERNEL_REG_P (REGNO (*x));
16836 +}
16837 +
16838 /* Expand the "prologue" pattern. */
16839
16840 void
16841 @@ -9172,7 +9514,8 @@
16842 /* Save the registers. Allocate up to MIPS_MAX_FIRST_STACK_STEP
16843 bytes beforehand; this is enough to cover the register save area
16844 without going out of range. */
16845 - if ((frame->mask | frame->fmask) != 0)
16846 + if (((frame->mask | frame->fmask | frame->acc_mask) != 0)
16847 + || frame->num_cop0_regs > 0)
16848 {
16849 HOST_WIDE_INT step1;
16850
16851 @@ -9203,12 +9546,97 @@
16852 }
16853 else
16854 {
16855 - insn = gen_add3_insn (stack_pointer_rtx,
16856 - stack_pointer_rtx,
16857 - GEN_INT (-step1));
16858 - RTX_FRAME_RELATED_P (emit_insn (insn)) = 1;
16859 - size -= step1;
16860 - mips_for_each_saved_reg (size, mips_save_reg);
16861 + if (cfun->machine->interrupt_handler_p)
16862 + {
16863 + HOST_WIDE_INT offset;
16864 + rtx mem;
16865 +
16866 + /* If this interrupt is using a shadow register set, we need to
16867 + get the stack pointer from the previous register set. */
16868 + if (cfun->machine->use_shadow_register_set_p)
16869 + emit_insn (gen_mips_rdpgpr (stack_pointer_rtx,
16870 + stack_pointer_rtx));
16871 +
16872 + if (!cfun->machine->keep_interrupts_masked_p)
16873 + {
16874 + /* Move from COP0 Cause to K0. */
16875 + emit_insn (gen_cop0_move (gen_rtx_REG (SImode, K0_REG_NUM),
16876 + gen_rtx_REG (SImode,
16877 + COP0_CAUSE_REG_NUM)));
16878 + /* Move from COP0 EPC to K1. */
16879 + emit_insn (gen_cop0_move (gen_rtx_REG (SImode, K1_REG_NUM),
16880 + gen_rtx_REG (SImode,
16881 + COP0_EPC_REG_NUM)));
16882 + }
16883 +
16884 + /* Allocate the first part of the frame. */
16885 + insn = gen_add3_insn (stack_pointer_rtx, stack_pointer_rtx,
16886 + GEN_INT (-step1));
16887 + RTX_FRAME_RELATED_P (emit_insn (insn)) = 1;
16888 + size -= step1;
16889 +
16890 + /* Start at the uppermost location for saving. */
16891 + offset = frame->cop0_sp_offset - size;
16892 + if (!cfun->machine->keep_interrupts_masked_p)
16893 + {
16894 + /* Push EPC into its stack slot. */
16895 + mem = gen_frame_mem (word_mode,
16896 + plus_constant (stack_pointer_rtx,
16897 + offset));
16898 + mips_emit_move (mem, gen_rtx_REG (word_mode, K1_REG_NUM));
16899 + offset -= UNITS_PER_WORD;
16900 + }
16901 +
16902 + /* Move from COP0 Status to K1. */
16903 + emit_insn (gen_cop0_move (gen_rtx_REG (SImode, K1_REG_NUM),
16904 + gen_rtx_REG (SImode,
16905 + COP0_STATUS_REG_NUM)));
16906 +
16907 + /* Right justify the RIPL in k0. */
16908 + if (!cfun->machine->keep_interrupts_masked_p)
16909 + emit_insn (gen_lshrsi3 (gen_rtx_REG (SImode, K0_REG_NUM),
16910 + gen_rtx_REG (SImode, K0_REG_NUM),
16911 + GEN_INT (CAUSE_IPL)));
16912 +
16913 + /* Push Status into its stack slot. */
16914 + mem = gen_frame_mem (word_mode,
16915 + plus_constant (stack_pointer_rtx, offset));
16916 + mips_emit_move (mem, gen_rtx_REG (word_mode, K1_REG_NUM));
16917 + offset -= UNITS_PER_WORD;
16918 +
16919 + /* Insert the RIPL into our copy of SR (k1) as the new IPL. */
16920 + if (!cfun->machine->keep_interrupts_masked_p)
16921 + emit_insn (gen_insvsi (gen_rtx_REG (SImode, K1_REG_NUM),
16922 + GEN_INT (6),
16923 + GEN_INT (SR_IPL),
16924 + gen_rtx_REG (SImode, K0_REG_NUM)));
16925 +
16926 + if (!cfun->machine->keep_interrupts_masked_p)
16927 + /* Enable interrupts by clearing the KSU ERL and EXL bits.
16928 + IE is already the correct value, so we don't have to do
16929 + anything explicit. */
16930 + emit_insn (gen_insvsi (gen_rtx_REG (SImode, K1_REG_NUM),
16931 + GEN_INT (4),
16932 + GEN_INT (SR_EXL),
16933 + gen_rtx_REG (SImode, GP_REG_FIRST)));
16934 + else
16935 + /* Disable interrupts by clearing the KSU, ERL, EXL,
16936 + and IE bits. */
16937 + emit_insn (gen_insvsi (gen_rtx_REG (SImode, K1_REG_NUM),
16938 + GEN_INT (5),
16939 + GEN_INT (SR_IE),
16940 + gen_rtx_REG (SImode, GP_REG_FIRST)));
16941 + }
16942 + else
16943 + {
16944 + insn = gen_add3_insn (stack_pointer_rtx,
16945 + stack_pointer_rtx,
16946 + GEN_INT (-step1));
16947 + RTX_FRAME_RELATED_P (emit_insn (insn)) = 1;
16948 + size -= step1;
16949 + }
16950 + mips_for_each_saved_acc (size, mips_save_reg);
16951 + mips_for_each_saved_gpr_and_fpr (size, mips_save_reg);
16952 }
16953 }
16954
16955 @@ -9293,6 +9721,20 @@
16956 pic_offset_table_rtx);
16957 }
16958
16959 + /* We need to search back to the last use of K0 or K1. */
16960 + if (cfun->machine->interrupt_handler_p)
16961 + {
16962 + for (insn = get_last_insn (); insn != NULL_RTX; insn = PREV_INSN (insn))
16963 + if (INSN_P (insn)
16964 + && for_each_rtx (&PATTERN (insn), mips_kernel_reg_p, NULL))
16965 + break;
16966 + /* Emit a move from K1 to COP0 Status after insn. */
16967 + gcc_assert (insn != NULL_RTX);
16968 + emit_insn_after (gen_cop0_move (gen_rtx_REG (SImode, COP0_STATUS_REG_NUM),
16969 + gen_rtx_REG (SImode, K1_REG_NUM)),
16970 + insn);
16971 + }
16972 +
16973 /* If we are profiling, make sure no instructions are scheduled before
16974 the call to mcount. */
16975 if (crtl->profile)
16976 @@ -9309,7 +9751,20 @@
16977 if (TARGET_MIPS16 && REGNO (reg) == GP_REG_FIRST + 31)
16978 reg = gen_rtx_REG (GET_MODE (reg), GP_REG_FIRST + 7);
16979
16980 - if (TARGET_MIPS16 && !M16_REG_P (REGNO (reg)))
16981 + if (REGNO (reg) == HI_REGNUM)
16982 + {
16983 + mips_emit_move (MIPS_EPILOGUE_TEMP (GET_MODE (reg)), mem);
16984 + if (TARGET_64BIT)
16985 + emit_insn (gen_mthisi_di (gen_rtx_REG (TImode, MD_REG_FIRST),
16986 + MIPS_EPILOGUE_TEMP (DImode),
16987 + gen_rtx_REG (DImode, LO_REGNUM)));
16988 + else
16989 + emit_insn (gen_mthisi_di (gen_rtx_REG (DImode, MD_REG_FIRST),
16990 + MIPS_EPILOGUE_TEMP (SImode),
16991 + gen_rtx_REG (SImode, LO_REGNUM)));
16992 + }
16993 + else if ((TARGET_MIPS16 && !M16_REG_P (REGNO (reg)))
16994 + || ACC_REG_P (REGNO (reg)))
16995 {
16996 /* Can't restore directly; move through a temporary. */
16997 mips_emit_move (MIPS_EPILOGUE_TEMP (GET_MODE (reg)), mem);
16998 @@ -9345,7 +9800,7 @@
16999 {
17000 const struct mips_frame_info *frame;
17001 HOST_WIDE_INT step1, step2;
17002 - rtx base, target;
17003 + rtx base, target, insn;
17004
17005 if (!sibcall_p && mips_can_use_return_insn ())
17006 {
17007 @@ -9378,7 +9833,8 @@
17008
17009 /* If we need to restore registers, deallocate as much stack as
17010 possible in the second step without going out of range. */
17011 - if ((frame->mask | frame->fmask) != 0)
17012 + if ((frame->mask | frame->fmask | frame->acc_mask) != 0
17013 + || frame->num_cop0_regs > 0)
17014 {
17015 step2 = MIN (step1, MIPS_MAX_FIRST_STACK_STEP);
17016 step1 -= step2;
17017 @@ -9440,13 +9896,53 @@
17018 else
17019 {
17020 /* Restore the registers. */
17021 - mips_for_each_saved_reg (frame->total_size - step2, mips_restore_reg);
17022 + mips_for_each_saved_acc (frame->total_size - step2, mips_restore_reg);
17023 + mips_for_each_saved_gpr_and_fpr (frame->total_size - step2,
17024 + mips_restore_reg);
17025
17026 - /* Deallocate the final bit of the frame. */
17027 - if (step2 > 0)
17028 - emit_insn (gen_add3_insn (stack_pointer_rtx,
17029 - stack_pointer_rtx,
17030 - GEN_INT (step2)));
17031 + if (cfun->machine->interrupt_handler_p)
17032 + {
17033 + HOST_WIDE_INT offset;
17034 + rtx mem;
17035 +
17036 + offset = frame->cop0_sp_offset - (frame->total_size - step2);
17037 + if (!cfun->machine->keep_interrupts_masked_p)
17038 + {
17039 + /* Restore the original EPC. */
17040 + mem = gen_frame_mem (word_mode,
17041 + plus_constant (stack_pointer_rtx, offset));
17042 + mips_emit_move (gen_rtx_REG (word_mode, K0_REG_NUM), mem);
17043 + offset -= UNITS_PER_WORD;
17044 +
17045 + /* Move to COP0 EPC. */
17046 + emit_insn (gen_cop0_move (gen_rtx_REG (SImode, COP0_EPC_REG_NUM),
17047 + gen_rtx_REG (SImode, K0_REG_NUM)));
17048 + }
17049 +
17050 + /* Restore the original Status. */
17051 + mem = gen_frame_mem (word_mode,
17052 + plus_constant (stack_pointer_rtx, offset));
17053 + mips_emit_move (gen_rtx_REG (word_mode, K0_REG_NUM), mem);
17054 + offset -= UNITS_PER_WORD;
17055 +
17056 + /* If we don't use shoadow register set, we need to update SP. */
17057 + if (!cfun->machine->use_shadow_register_set_p && step2 > 0)
17058 + emit_insn (gen_add3_insn (stack_pointer_rtx,
17059 + stack_pointer_rtx,
17060 + GEN_INT (step2)));
17061 +
17062 + /* Move to COP0 Status. */
17063 + emit_insn (gen_cop0_move (gen_rtx_REG (SImode, COP0_STATUS_REG_NUM),
17064 + gen_rtx_REG (SImode, K0_REG_NUM)));
17065 + }
17066 + else
17067 + {
17068 + /* Deallocate the final bit of the frame. */
17069 + if (step2 > 0)
17070 + emit_insn (gen_add3_insn (stack_pointer_rtx,
17071 + stack_pointer_rtx,
17072 + GEN_INT (step2)));
17073 + }
17074 }
17075
17076 /* Add in the __builtin_eh_return stack adjustment. We need to
17077 @@ -9469,18 +9965,44 @@
17078
17079 if (!sibcall_p)
17080 {
17081 - unsigned int regno;
17082 -
17083 - /* When generating MIPS16 code, the normal mips_for_each_saved_reg
17084 - path will restore the return address into $7 rather than $31. */
17085 - if (TARGET_MIPS16
17086 - && !GENERATE_MIPS16E_SAVE_RESTORE
17087 - && BITSET_P (frame->mask, 31))
17088 - regno = GP_REG_FIRST + 7;
17089 - else
17090 - regno = GP_REG_FIRST + 31;
17091 mips_expand_before_return ();
17092 - emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, regno)));
17093 + if (cfun->machine->interrupt_handler_p)
17094 + {
17095 + /* Interrupt handlers generate eret or deret. */
17096 + if (cfun->machine->use_debug_exception_return_p)
17097 + emit_jump_insn (gen_mips_deret ());
17098 + else
17099 + emit_jump_insn (gen_mips_eret ());
17100 + }
17101 + else
17102 + {
17103 + unsigned int regno;
17104 +
17105 + /* When generating MIPS16 code, the normal
17106 + mips_for_each_saved_gpr_and_fpr path will restore the return
17107 + address into $7 rather than $31. */
17108 + if (TARGET_MIPS16
17109 + && !GENERATE_MIPS16E_SAVE_RESTORE
17110 + && BITSET_P (frame->mask, 31))
17111 + regno = GP_REG_FIRST + 7;
17112 + else
17113 + regno = GP_REG_FIRST + 31;
17114 + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, regno)));
17115 + }
17116 + }
17117 +
17118 + /* Search from the beginning to the first use of K0 or K1. */
17119 + if (cfun->machine->interrupt_handler_p
17120 + && !cfun->machine->keep_interrupts_masked_p)
17121 + {
17122 + for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn))
17123 + if (INSN_P (insn)
17124 + && for_each_rtx (&PATTERN(insn), mips_kernel_reg_p, NULL))
17125 + break;
17126 + gcc_assert (insn != NULL_RTX);
17127 + /* Insert disable interrupts before the first use of K0 or K1. */
17128 + emit_insn_before (gen_mips_di (), insn);
17129 + emit_insn_before (gen_mips_ehb (), insn);
17130 }
17131 }
17132 \f
17133 @@ -9491,6 +10013,10 @@
17134 bool
17135 mips_can_use_return_insn (void)
17136 {
17137 + /* Interrupt handlers need to go through the epilogue. */
17138 + if (cfun->machine->interrupt_handler_p)
17139 + return false;
17140 +
17141 if (!reload_completed)
17142 return false;
17143
17144 @@ -10422,10 +10948,15 @@
17145 s = "bnez\t%2,1f\n\tbreak\t7\n1:";
17146 }
17147 else if (GENERATE_DIVIDE_TRAPS)
17148 - {
17149 - output_asm_insn (s, operands);
17150 - s = "teq\t%2,%.,7";
17151 - }
17152 + {
17153 + if (TUNE_74K)
17154 + output_asm_insn ("teq\t%2,%.,7", operands);
17155 + else
17156 + {
17157 + output_asm_insn (s, operands);
17158 + s = "teq\t%2,%.,7";
17159 + }
17160 + }
17161 else
17162 {
17163 output_asm_insn ("%(bne\t%2,%.,1f", operands);
17164 @@ -10737,7 +11268,17 @@
17165 ready[pos2] = temp;
17166 }
17167 }
17168 -\f
17169 +
17170 +int
17171 +mips_mult_madd_chain_bypass_p (rtx out_insn ATTRIBUTE_UNUSED,
17172 + rtx in_insn ATTRIBUTE_UNUSED)
17173 +{
17174 + if (reload_completed)
17175 + return false;
17176 + else
17177 + return true;
17178 +}
17179 +
17180 /* Used by TUNE_MACC_CHAINS to record the last scheduled instruction
17181 that may clobber hi or lo. */
17182 static rtx mips_macc_chains_last_hilo;
17183 @@ -13910,6 +14451,14 @@
17184 long as any indirect jumps use $25. */
17185 flag_pic = 1;
17186
17187 + /* For SDE, switch on ABICALLS mode if -fpic or -fpie were used, and the
17188 + user hasn't explicitly disabled these modes. */
17189 + if (TARGET_MIPS_SDE
17190 + && (flag_pic || flag_pie) && !TARGET_ABICALLS
17191 + && !((target_flags_explicit & MASK_ABICALLS))
17192 + && mips_abi != ABI_EABI)
17193 + target_flags |= MASK_ABICALLS;
17194 +
17195 /* -mvr4130-align is a "speed over size" optimization: it usually produces
17196 faster code, but at the expense of more nops. Enable it at -O3 and
17197 above. */
17198 @@ -13984,26 +14533,46 @@
17199 if (TARGET_DSPR2)
17200 target_flags |= MASK_DSP;
17201
17202 - /* .eh_frame addresses should be the same width as a C pointer.
17203 - Most MIPS ABIs support only one pointer size, so the assembler
17204 - will usually know exactly how big an .eh_frame address is.
17205 -
17206 - Unfortunately, this is not true of the 64-bit EABI. The ABI was
17207 - originally defined to use 64-bit pointers (i.e. it is LP64), and
17208 - this is still the default mode. However, we also support an n32-like
17209 - ILP32 mode, which is selected by -mlong32. The problem is that the
17210 - assembler has traditionally not had an -mlong option, so it has
17211 - traditionally not known whether we're using the ILP32 or LP64 form.
17212 -
17213 - As it happens, gas versions up to and including 2.19 use _32-bit_
17214 - addresses for EABI64 .cfi_* directives. This is wrong for the
17215 - default LP64 mode, so we can't use the directives by default.
17216 - Moreover, since gas's current behavior is at odds with gcc's
17217 - default behavior, it seems unwise to rely on future versions
17218 - of gas behaving the same way. We therefore avoid using .cfi
17219 - directives for -mlong32 as well. */
17220 - if (mips_abi == ABI_EABI && TARGET_64BIT)
17221 - flag_dwarf2_cfi_asm = 0;
17222 + /* Use the traditional method of generating .eh_frames.
17223 + We need this for two reasons:
17224 +
17225 + - .eh_frame addresses should be the same width as a C pointer.
17226 + Most MIPS ABIs support only one pointer size, so the assembler
17227 + will usually know exactly how big an .eh_frame address is.
17228 +
17229 + Unfortunately, this is not true of the 64-bit EABI. The ABI was
17230 + originally defined to use 64-bit pointers (i.e. it is LP64), and
17231 + this is still the default mode. However, we also support an n32-like
17232 + ILP32 mode, which is selected by -mlong32. The problem is that the
17233 + assembler has traditionally not had an -mlong option, so it has
17234 + traditionally not known whether we're using the ILP32 or LP64 form.
17235 +
17236 + As it happens, gas versions up to and including 2.19 use _32-bit_
17237 + addresses for EABI64 .cfi_* directives. This is wrong for the
17238 + default LP64 mode, so we can't use the directives by default.
17239 + Moreover, since gas's current behavior is at odds with gcc's
17240 + default behavior, it seems unwise to rely on future versions
17241 + of gas behaving the same way. We therefore avoid using .cfi
17242 + directives for -mlong32 as well.
17243 +
17244 + - .cfi* directives generate read-only .eh_frame sections.
17245 + However, MIPS has traditionally not allowed directives like:
17246 +
17247 + .long x-.
17248 +
17249 + in cases where "x" is in a different section, or is not defined
17250 + in the same assembly file. We have therefore traditionally
17251 + used absolute addresses and a writable .eh_frame instead.
17252 +
17253 + The linker is able to convert most of these absolute addresses
17254 + into PC-relative form where doing so is necessary to avoid
17255 + relocations. However, until 2.21, it wasn't able to do this
17256 + for indirect encodings or personality routines.
17257 +
17258 + GNU ld 2.21 and GCC 4.5 have support for read-only .eh_frames,
17259 + but for the time being, we should stick to the approach used
17260 + in 4.3 and earlier. */
17261 + flag_dwarf2_cfi_asm = 0;
17262
17263 mips_init_print_operand_punct ();
17264
17265 @@ -14242,6 +14811,178 @@
17266 reg_alloc_order[24] = 0;
17267 }
17268 }
17269 +
17270 +/* Implement EPILOGUE_USES. */
17271 +
17272 +bool
17273 +mips_epilogue_uses (unsigned int regno)
17274 +{
17275 + /* Say that the epilogue uses the return address register. Note that
17276 + in the case of sibcalls, the values "used by the epilogue" are
17277 + considered live at the start of the called function. */
17278 + if (regno == 31)
17279 + return true;
17280 +
17281 + /* If using a GOT, say that the epilogue also uses GOT_VERSION_REGNUM.
17282 + See the comment above load_call<mode> for details. */
17283 + if (TARGET_USE_GOT && (regno) == GOT_VERSION_REGNUM)
17284 + return true;
17285 +
17286 + /* An interrupt handler must preserve some registers that are
17287 + ordinarily call-clobbered. */
17288 + if (cfun->machine->interrupt_handler_p
17289 + && mips_interrupt_extra_call_saved_reg_p (regno))
17290 + return true;
17291 +
17292 + return false;
17293 +}
17294 +\f
17295 +#ifdef CVMX_SHARED_BSS_FLAGS
17296 +/* Handle a "cvmx_shared" attribute; arguments as in
17297 + struct attribute_spec.handler. */
17298 +
17299 +static tree
17300 +octeon_handle_cvmx_shared_attribute (tree *node, tree name,
17301 + tree args ATTRIBUTE_UNUSED,
17302 + int flags ATTRIBUTE_UNUSED,
17303 + bool *no_add_attrs)
17304 +{
17305 + if (TREE_CODE (*node) != VAR_DECL)
17306 + {
17307 + warning (OPT_Wattributes, "%qs attribute only applies to variables",
17308 + IDENTIFIER_POINTER (name));
17309 + *no_add_attrs = true;
17310 + }
17311 +
17312 + return NULL_TREE;
17313 +}
17314 +\f
17315 +/* Switch to the appropriate section for output of DECL.
17316 + DECL is either a `VAR_DECL' node or a constant of some sort.
17317 + RELOC indicates whether forming the initial value of DECL requires
17318 + link-time relocations. */
17319 +
17320 +static section *
17321 +octeon_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
17322 +{
17323 + if (decl && TREE_CODE (decl) == VAR_DECL
17324 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (decl)))
17325 + {
17326 + const char *sname = NULL;
17327 + unsigned int flags = SECTION_WRITE;
17328 +
17329 + switch (categorize_decl_for_section (decl, reloc))
17330 + {
17331 + case SECCAT_DATA:
17332 + case SECCAT_SDATA:
17333 + case SECCAT_RODATA:
17334 + case SECCAT_SRODATA:
17335 + case SECCAT_RODATA_MERGE_STR:
17336 + case SECCAT_RODATA_MERGE_STR_INIT:
17337 + case SECCAT_RODATA_MERGE_CONST:
17338 + case SECCAT_DATA_REL:
17339 + case SECCAT_DATA_REL_LOCAL:
17340 + case SECCAT_DATA_REL_RO:
17341 + case SECCAT_DATA_REL_RO_LOCAL:
17342 + sname = ".cvmx_shared";
17343 + break;
17344 + case SECCAT_BSS:
17345 + case SECCAT_SBSS:
17346 + sname = ".cvmx_shared_bss";
17347 + flags |= SECTION_BSS;
17348 + break;
17349 + case SECCAT_TEXT:
17350 + case SECCAT_TDATA:
17351 + case SECCAT_TBSS:
17352 + break;
17353 + }
17354 + if (sname)
17355 + {
17356 + return get_section (sname, flags, decl);
17357 + }
17358 + }
17359 + return default_elf_select_section (decl, reloc, align);
17360 +}
17361 +\f
17362 +/* Build up a unique section name, expressed as a
17363 + STRING_CST node, and assign it to DECL_SECTION_NAME (decl).
17364 + RELOC indicates whether the initial value of EXP requires
17365 + link-time relocations. */
17366 +
17367 +static void
17368 +octeon_unique_section (tree decl, int reloc)
17369 +{
17370 + if (decl && TREE_CODE (decl) == VAR_DECL
17371 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (decl)))
17372 + {
17373 + const char *sname = NULL;
17374 +
17375 + if (! DECL_ONE_ONLY (decl))
17376 + {
17377 + section *sect;
17378 + sect = octeon_select_section (decl, reloc, DECL_ALIGN (decl));
17379 + DECL_SECTION_NAME (decl) = build_string (strlen (sect->named.name),
17380 + sect->named.name);
17381 + return;
17382 + }
17383 +
17384 + switch (categorize_decl_for_section (decl, reloc))
17385 + {
17386 + case SECCAT_BSS:
17387 + case SECCAT_SBSS:
17388 + sname = ".cvmx_shared_bss.linkonce.";
17389 + break;
17390 + case SECCAT_SDATA:
17391 + case SECCAT_DATA:
17392 + case SECCAT_DATA_REL:
17393 + case SECCAT_DATA_REL_LOCAL:
17394 + case SECCAT_DATA_REL_RO:
17395 + case SECCAT_DATA_REL_RO_LOCAL:
17396 + case SECCAT_RODATA:
17397 + case SECCAT_SRODATA:
17398 + case SECCAT_RODATA_MERGE_STR:
17399 + case SECCAT_RODATA_MERGE_STR_INIT:
17400 + case SECCAT_RODATA_MERGE_CONST:
17401 + sname = ".cvmx_shared.linkonce.";
17402 + break;
17403 + case SECCAT_TEXT:
17404 + case SECCAT_TDATA:
17405 + case SECCAT_TBSS:
17406 + break;
17407 + }
17408 + if (sname)
17409 + {
17410 + const char *name;
17411 + size_t plen, nlen;
17412 + char *string;
17413 + plen = strlen (sname);
17414 +
17415 + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
17416 + name = targetm.strip_name_encoding (name);
17417 + nlen = strlen (name);
17418 +
17419 + string = alloca (plen + nlen + 1);
17420 + memcpy (string, sname, plen);
17421 + memcpy (string + plen, name, nlen + 1);
17422 + DECL_SECTION_NAME (decl) = build_string (nlen + plen, string);
17423 + return;
17424 + }
17425 + }
17426 + default_unique_section (decl, reloc);
17427 +}
17428 +\f
17429 +/* Emit an uninitialized cvmx_shared variable. */
17430 +void
17431 +octeon_output_shared_variable (FILE *stream, tree decl, const char *name,
17432 + unsigned HOST_WIDE_INT size, int align)
17433 +{
17434 + switch_to_section (get_section (".cvmx_shared_bss", CVMX_SHARED_BSS_FLAGS,
17435 + NULL_TREE));
17436 + ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT));
17437 + ASM_DECLARE_OBJECT_NAME (stream, name, decl);
17438 + ASM_OUTPUT_SKIP (stream, size != 0 ? size : 1);
17439 +}
17440 +#endif
17441 \f
17442 /* Initialize the GCC target structure. */
17443 #undef TARGET_ASM_ALIGNED_HI_OP
17444 diff -Nur a/gcc/config/mips/mips-dsp.md b/gcc/config/mips/mips-dsp.md
17445 --- a/gcc/config/mips/mips-dsp.md 2008-12-21 22:43:51.000000000 +0100
17446 +++ b/gcc/config/mips/mips-dsp.md 2010-01-25 09:50:29.025687257 +0100
17447 @@ -42,9 +42,9 @@
17448 (match_operand:DSPV 2 "register_operand" "d")))
17449 (set (reg:CCDSP CCDSP_OU_REGNUM)
17450 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDQ))])]
17451 - ""
17452 + "ISA_HAS_DSP"
17453 "add<DSPV:dspfmt1>.<DSPV:dspfmt2>\t%0,%1,%2"
17454 - [(set_attr "type" "arith")
17455 + [(set_attr "type" "dspalu")
17456 (set_attr "mode" "SI")])
17457
17458 (define_insn "mips_add<DSP:dspfmt1>_s_<DSP:dspfmt2>"
17459 @@ -55,9 +55,9 @@
17460 UNSPEC_ADDQ_S))
17461 (set (reg:CCDSP CCDSP_OU_REGNUM)
17462 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDQ_S))])]
17463 - ""
17464 + "ISA_HAS_DSP"
17465 "add<DSP:dspfmt1>_s.<DSP:dspfmt2>\t%0,%1,%2"
17466 - [(set_attr "type" "arith")
17467 + [(set_attr "type" "dspalusat")
17468 (set_attr "mode" "SI")])
17469
17470 ;; SUBQ*
17471 @@ -70,7 +70,7 @@
17472 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBQ))])]
17473 "ISA_HAS_DSP"
17474 "sub<DSPV:dspfmt1>.<DSPV:dspfmt2>\t%0,%1,%2"
17475 - [(set_attr "type" "arith")
17476 + [(set_attr "type" "dspalu")
17477 (set_attr "mode" "SI")])
17478
17479 (define_insn "mips_sub<DSP:dspfmt1>_s_<DSP:dspfmt2>"
17480 @@ -83,7 +83,7 @@
17481 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBQ_S))])]
17482 "ISA_HAS_DSP"
17483 "sub<DSP:dspfmt1>_s.<DSP:dspfmt2>\t%0,%1,%2"
17484 - [(set_attr "type" "arith")
17485 + [(set_attr "type" "dspalusat")
17486 (set_attr "mode" "SI")])
17487
17488 ;; ADDSC
17489 @@ -97,7 +97,7 @@
17490 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDSC))])]
17491 "ISA_HAS_DSP"
17492 "addsc\t%0,%1,%2"
17493 - [(set_attr "type" "arith")
17494 + [(set_attr "type" "dspalu")
17495 (set_attr "mode" "SI")])
17496
17497 ;; ADDWC
17498 @@ -112,7 +112,7 @@
17499 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDWC))])]
17500 "ISA_HAS_DSP"
17501 "addwc\t%0,%1,%2"
17502 - [(set_attr "type" "arith")
17503 + [(set_attr "type" "dspalu")
17504 (set_attr "mode" "SI")])
17505
17506 ;; MODSUB
17507 @@ -123,7 +123,7 @@
17508 UNSPEC_MODSUB))]
17509 "ISA_HAS_DSP"
17510 "modsub\t%0,%1,%2"
17511 - [(set_attr "type" "arith")
17512 + [(set_attr "type" "dspalu")
17513 (set_attr "mode" "SI")])
17514
17515 ;; RADDU*
17516 @@ -133,7 +133,7 @@
17517 UNSPEC_RADDU_W_QB))]
17518 "ISA_HAS_DSP"
17519 "raddu.w.qb\t%0,%1"
17520 - [(set_attr "type" "arith")
17521 + [(set_attr "type" "dspalu")
17522 (set_attr "mode" "SI")])
17523
17524 ;; ABSQ*
17525 @@ -146,7 +146,7 @@
17526 (unspec:CCDSP [(match_dup 1)] UNSPEC_ABSQ_S))])]
17527 "ISA_HAS_DSP"
17528 "absq_s.<DSPQ:dspfmt2>\t%0,%1"
17529 - [(set_attr "type" "arith")
17530 + [(set_attr "type" "dspalusat")
17531 (set_attr "mode" "SI")])
17532
17533 ;; PRECRQ*
17534 @@ -157,7 +157,7 @@
17535 UNSPEC_PRECRQ_QB_PH))]
17536 "ISA_HAS_DSP"
17537 "precrq.qb.ph\t%0,%1,%2"
17538 - [(set_attr "type" "arith")
17539 + [(set_attr "type" "dspalu")
17540 (set_attr "mode" "SI")])
17541
17542 (define_insn "mips_precrq_ph_w"
17543 @@ -167,7 +167,7 @@
17544 UNSPEC_PRECRQ_PH_W))]
17545 "ISA_HAS_DSP"
17546 "precrq.ph.w\t%0,%1,%2"
17547 - [(set_attr "type" "arith")
17548 + [(set_attr "type" "dspalu")
17549 (set_attr "mode" "SI")])
17550
17551 (define_insn "mips_precrq_rs_ph_w"
17552 @@ -181,7 +181,7 @@
17553 UNSPEC_PRECRQ_RS_PH_W))])]
17554 "ISA_HAS_DSP"
17555 "precrq_rs.ph.w\t%0,%1,%2"
17556 - [(set_attr "type" "arith")
17557 + [(set_attr "type" "dspalu")
17558 (set_attr "mode" "SI")])
17559
17560 ;; PRECRQU*
17561 @@ -196,7 +196,7 @@
17562 UNSPEC_PRECRQU_S_QB_PH))])]
17563 "ISA_HAS_DSP"
17564 "precrqu_s.qb.ph\t%0,%1,%2"
17565 - [(set_attr "type" "arith")
17566 + [(set_attr "type" "dspalusat")
17567 (set_attr "mode" "SI")])
17568
17569 ;; PRECEQ*
17570 @@ -206,7 +206,7 @@
17571 UNSPEC_PRECEQ_W_PHL))]
17572 "ISA_HAS_DSP"
17573 "preceq.w.phl\t%0,%1"
17574 - [(set_attr "type" "arith")
17575 + [(set_attr "type" "dspalu")
17576 (set_attr "mode" "SI")])
17577
17578 (define_insn "mips_preceq_w_phr"
17579 @@ -215,7 +215,7 @@
17580 UNSPEC_PRECEQ_W_PHR))]
17581 "ISA_HAS_DSP"
17582 "preceq.w.phr\t%0,%1"
17583 - [(set_attr "type" "arith")
17584 + [(set_attr "type" "dspalu")
17585 (set_attr "mode" "SI")])
17586
17587 ;; PRECEQU*
17588 @@ -225,7 +225,7 @@
17589 UNSPEC_PRECEQU_PH_QBL))]
17590 "ISA_HAS_DSP"
17591 "precequ.ph.qbl\t%0,%1"
17592 - [(set_attr "type" "arith")
17593 + [(set_attr "type" "dspalu")
17594 (set_attr "mode" "SI")])
17595
17596 (define_insn "mips_precequ_ph_qbr"
17597 @@ -234,7 +234,7 @@
17598 UNSPEC_PRECEQU_PH_QBR))]
17599 "ISA_HAS_DSP"
17600 "precequ.ph.qbr\t%0,%1"
17601 - [(set_attr "type" "arith")
17602 + [(set_attr "type" "dspalu")
17603 (set_attr "mode" "SI")])
17604
17605 (define_insn "mips_precequ_ph_qbla"
17606 @@ -243,7 +243,7 @@
17607 UNSPEC_PRECEQU_PH_QBLA))]
17608 "ISA_HAS_DSP"
17609 "precequ.ph.qbla\t%0,%1"
17610 - [(set_attr "type" "arith")
17611 + [(set_attr "type" "dspalu")
17612 (set_attr "mode" "SI")])
17613
17614 (define_insn "mips_precequ_ph_qbra"
17615 @@ -252,7 +252,7 @@
17616 UNSPEC_PRECEQU_PH_QBRA))]
17617 "ISA_HAS_DSP"
17618 "precequ.ph.qbra\t%0,%1"
17619 - [(set_attr "type" "arith")
17620 + [(set_attr "type" "dspalu")
17621 (set_attr "mode" "SI")])
17622
17623 ;; PRECEU*
17624 @@ -262,7 +262,7 @@
17625 UNSPEC_PRECEU_PH_QBL))]
17626 "ISA_HAS_DSP"
17627 "preceu.ph.qbl\t%0,%1"
17628 - [(set_attr "type" "arith")
17629 + [(set_attr "type" "dspalu")
17630 (set_attr "mode" "SI")])
17631
17632 (define_insn "mips_preceu_ph_qbr"
17633 @@ -271,7 +271,7 @@
17634 UNSPEC_PRECEU_PH_QBR))]
17635 "ISA_HAS_DSP"
17636 "preceu.ph.qbr\t%0,%1"
17637 - [(set_attr "type" "arith")
17638 + [(set_attr "type" "dspalu")
17639 (set_attr "mode" "SI")])
17640
17641 (define_insn "mips_preceu_ph_qbla"
17642 @@ -280,7 +280,7 @@
17643 UNSPEC_PRECEU_PH_QBLA))]
17644 "ISA_HAS_DSP"
17645 "preceu.ph.qbla\t%0,%1"
17646 - [(set_attr "type" "arith")
17647 + [(set_attr "type" "dspalu")
17648 (set_attr "mode" "SI")])
17649
17650 (define_insn "mips_preceu_ph_qbra"
17651 @@ -289,7 +289,7 @@
17652 UNSPEC_PRECEU_PH_QBRA))]
17653 "ISA_HAS_DSP"
17654 "preceu.ph.qbra\t%0,%1"
17655 - [(set_attr "type" "arith")
17656 + [(set_attr "type" "dspalu")
17657 (set_attr "mode" "SI")])
17658
17659 ;; Table 2-2. MIPS DSP ASE Instructions: Shift
17660 @@ -313,7 +313,7 @@
17661 }
17662 return "shllv.<DSPV:dspfmt2>\t%0,%1,%2";
17663 }
17664 - [(set_attr "type" "shift")
17665 + [(set_attr "type" "dspalu")
17666 (set_attr "mode" "SI")])
17667
17668 (define_insn "mips_shll_s_<DSPQ:dspfmt2>"
17669 @@ -335,7 +335,7 @@
17670 }
17671 return "shllv_s.<DSPQ:dspfmt2>\t%0,%1,%2";
17672 }
17673 - [(set_attr "type" "shift")
17674 + [(set_attr "type" "dspalusat")
17675 (set_attr "mode" "SI")])
17676
17677 ;; SHRL*
17678 @@ -354,7 +354,7 @@
17679 }
17680 return "shrlv.qb\t%0,%1,%2";
17681 }
17682 - [(set_attr "type" "shift")
17683 + [(set_attr "type" "dspalu")
17684 (set_attr "mode" "SI")])
17685
17686 ;; SHRA*
17687 @@ -373,7 +373,7 @@
17688 }
17689 return "shrav.ph\t%0,%1,%2";
17690 }
17691 - [(set_attr "type" "shift")
17692 + [(set_attr "type" "dspalu")
17693 (set_attr "mode" "SI")])
17694
17695 (define_insn "mips_shra_r_<DSPQ:dspfmt2>"
17696 @@ -392,7 +392,7 @@
17697 }
17698 return "shrav_r.<DSPQ:dspfmt2>\t%0,%1,%2";
17699 }
17700 - [(set_attr "type" "shift")
17701 + [(set_attr "type" "dspalu")
17702 (set_attr "mode" "SI")])
17703
17704 ;; Table 2-3. MIPS DSP ASE Instructions: Multiply
17705 @@ -478,7 +478,7 @@
17706 UNSPEC_DPAU_H_QBL))]
17707 "ISA_HAS_DSP && !TARGET_64BIT"
17708 "dpau.h.qbl\t%q0,%2,%3"
17709 - [(set_attr "type" "imadd")
17710 + [(set_attr "type" "dspmac")
17711 (set_attr "mode" "SI")])
17712
17713 (define_insn "mips_dpau_h_qbr"
17714 @@ -489,7 +489,7 @@
17715 UNSPEC_DPAU_H_QBR))]
17716 "ISA_HAS_DSP && !TARGET_64BIT"
17717 "dpau.h.qbr\t%q0,%2,%3"
17718 - [(set_attr "type" "imadd")
17719 + [(set_attr "type" "dspmac")
17720 (set_attr "mode" "SI")])
17721
17722 ;; DPSU*
17723 @@ -501,7 +501,7 @@
17724 UNSPEC_DPSU_H_QBL))]
17725 "ISA_HAS_DSP && !TARGET_64BIT"
17726 "dpsu.h.qbl\t%q0,%2,%3"
17727 - [(set_attr "type" "imadd")
17728 + [(set_attr "type" "dspmac")
17729 (set_attr "mode" "SI")])
17730
17731 (define_insn "mips_dpsu_h_qbr"
17732 @@ -512,7 +512,7 @@
17733 UNSPEC_DPSU_H_QBR))]
17734 "ISA_HAS_DSP && !TARGET_64BIT"
17735 "dpsu.h.qbr\t%q0,%2,%3"
17736 - [(set_attr "type" "imadd")
17737 + [(set_attr "type" "dspmac")
17738 (set_attr "mode" "SI")])
17739
17740 ;; DPAQ*
17741 @@ -528,7 +528,7 @@
17742 UNSPEC_DPAQ_S_W_PH))])]
17743 "ISA_HAS_DSP && !TARGET_64BIT"
17744 "dpaq_s.w.ph\t%q0,%2,%3"
17745 - [(set_attr "type" "imadd")
17746 + [(set_attr "type" "dspmac")
17747 (set_attr "mode" "SI")])
17748
17749 ;; DPSQ*
17750 @@ -544,7 +544,7 @@
17751 UNSPEC_DPSQ_S_W_PH))])]
17752 "ISA_HAS_DSP && !TARGET_64BIT"
17753 "dpsq_s.w.ph\t%q0,%2,%3"
17754 - [(set_attr "type" "imadd")
17755 + [(set_attr "type" "dspmac")
17756 (set_attr "mode" "SI")])
17757
17758 ;; MULSAQ*
17759 @@ -560,7 +560,7 @@
17760 UNSPEC_MULSAQ_S_W_PH))])]
17761 "ISA_HAS_DSP && !TARGET_64BIT"
17762 "mulsaq_s.w.ph\t%q0,%2,%3"
17763 - [(set_attr "type" "imadd")
17764 + [(set_attr "type" "dspmac")
17765 (set_attr "mode" "SI")])
17766
17767 ;; DPAQ*
17768 @@ -576,7 +576,7 @@
17769 UNSPEC_DPAQ_SA_L_W))])]
17770 "ISA_HAS_DSP && !TARGET_64BIT"
17771 "dpaq_sa.l.w\t%q0,%2,%3"
17772 - [(set_attr "type" "imadd")
17773 + [(set_attr "type" "dspmacsat")
17774 (set_attr "mode" "SI")])
17775
17776 ;; DPSQ*
17777 @@ -592,7 +592,7 @@
17778 UNSPEC_DPSQ_SA_L_W))])]
17779 "ISA_HAS_DSP && !TARGET_64BIT"
17780 "dpsq_sa.l.w\t%q0,%2,%3"
17781 - [(set_attr "type" "imadd")
17782 + [(set_attr "type" "dspmacsat")
17783 (set_attr "mode" "SI")])
17784
17785 ;; MAQ*
17786 @@ -608,7 +608,7 @@
17787 UNSPEC_MAQ_S_W_PHL))])]
17788 "ISA_HAS_DSP && !TARGET_64BIT"
17789 "maq_s.w.phl\t%q0,%2,%3"
17790 - [(set_attr "type" "imadd")
17791 + [(set_attr "type" "dspmac")
17792 (set_attr "mode" "SI")])
17793
17794 (define_insn "mips_maq_s_w_phr"
17795 @@ -623,7 +623,7 @@
17796 UNSPEC_MAQ_S_W_PHR))])]
17797 "ISA_HAS_DSP && !TARGET_64BIT"
17798 "maq_s.w.phr\t%q0,%2,%3"
17799 - [(set_attr "type" "imadd")
17800 + [(set_attr "type" "dspmac")
17801 (set_attr "mode" "SI")])
17802
17803 ;; MAQ_SA*
17804 @@ -639,7 +639,7 @@
17805 UNSPEC_MAQ_SA_W_PHL))])]
17806 "ISA_HAS_DSP && !TARGET_64BIT"
17807 "maq_sa.w.phl\t%q0,%2,%3"
17808 - [(set_attr "type" "imadd")
17809 + [(set_attr "type" "dspmacsat")
17810 (set_attr "mode" "SI")])
17811
17812 (define_insn "mips_maq_sa_w_phr"
17813 @@ -654,7 +654,7 @@
17814 UNSPEC_MAQ_SA_W_PHR))])]
17815 "ISA_HAS_DSP && !TARGET_64BIT"
17816 "maq_sa.w.phr\t%q0,%2,%3"
17817 - [(set_attr "type" "imadd")
17818 + [(set_attr "type" "dspmacsat")
17819 (set_attr "mode" "SI")])
17820
17821 ;; Table 2-4. MIPS DSP ASE Instructions: General Bit/Manipulation
17822 @@ -665,7 +665,7 @@
17823 UNSPEC_BITREV))]
17824 "ISA_HAS_DSP"
17825 "bitrev\t%0,%1"
17826 - [(set_attr "type" "arith")
17827 + [(set_attr "type" "dspalu")
17828 (set_attr "mode" "SI")])
17829
17830 ;; INSV
17831 @@ -678,7 +678,7 @@
17832 UNSPEC_INSV))]
17833 "ISA_HAS_DSP"
17834 "insv\t%0,%2"
17835 - [(set_attr "type" "arith")
17836 + [(set_attr "type" "dspalu")
17837 (set_attr "mode" "SI")])
17838
17839 ;; REPL*
17840 @@ -696,7 +696,7 @@
17841 }
17842 return "replv.qb\t%0,%1";
17843 }
17844 - [(set_attr "type" "arith")
17845 + [(set_attr "type" "dspalu")
17846 (set_attr "mode" "SI")])
17847
17848 (define_insn "mips_repl_ph"
17849 @@ -707,7 +707,7 @@
17850 "@
17851 repl.ph\t%0,%1
17852 replv.ph\t%0,%1"
17853 - [(set_attr "type" "arith")
17854 + [(set_attr "type" "dspalu")
17855 (set_attr "mode" "SI")])
17856
17857 ;; Table 2-5. MIPS DSP ASE Instructions: Compare-Pick
17858 @@ -720,7 +720,7 @@
17859 UNSPEC_CMP_EQ))]
17860 "ISA_HAS_DSP"
17861 "cmp<DSPV:dspfmt1_1>.eq.<DSPV:dspfmt2>\t%0,%1"
17862 - [(set_attr "type" "arith")
17863 + [(set_attr "type" "dspalu")
17864 (set_attr "mode" "SI")])
17865
17866 (define_insn "mips_cmp<DSPV:dspfmt1_1>_lt_<DSPV:dspfmt2>"
17867 @@ -731,7 +731,7 @@
17868 UNSPEC_CMP_LT))]
17869 "ISA_HAS_DSP"
17870 "cmp<DSPV:dspfmt1_1>.lt.<DSPV:dspfmt2>\t%0,%1"
17871 - [(set_attr "type" "arith")
17872 + [(set_attr "type" "dspalu")
17873 (set_attr "mode" "SI")])
17874
17875 (define_insn "mips_cmp<DSPV:dspfmt1_1>_le_<DSPV:dspfmt2>"
17876 @@ -742,7 +742,7 @@
17877 UNSPEC_CMP_LE))]
17878 "ISA_HAS_DSP"
17879 "cmp<DSPV:dspfmt1_1>.le.<DSPV:dspfmt2>\t%0,%1"
17880 - [(set_attr "type" "arith")
17881 + [(set_attr "type" "dspalu")
17882 (set_attr "mode" "SI")])
17883
17884 (define_insn "mips_cmpgu_eq_qb"
17885 @@ -752,7 +752,7 @@
17886 UNSPEC_CMPGU_EQ_QB))]
17887 "ISA_HAS_DSP"
17888 "cmpgu.eq.qb\t%0,%1,%2"
17889 - [(set_attr "type" "arith")
17890 + [(set_attr "type" "dspalu")
17891 (set_attr "mode" "SI")])
17892
17893 (define_insn "mips_cmpgu_lt_qb"
17894 @@ -762,7 +762,7 @@
17895 UNSPEC_CMPGU_LT_QB))]
17896 "ISA_HAS_DSP"
17897 "cmpgu.lt.qb\t%0,%1,%2"
17898 - [(set_attr "type" "arith")
17899 + [(set_attr "type" "dspalu")
17900 (set_attr "mode" "SI")])
17901
17902 (define_insn "mips_cmpgu_le_qb"
17903 @@ -772,7 +772,7 @@
17904 UNSPEC_CMPGU_LE_QB))]
17905 "ISA_HAS_DSP"
17906 "cmpgu.le.qb\t%0,%1,%2"
17907 - [(set_attr "type" "arith")
17908 + [(set_attr "type" "dspalu")
17909 (set_attr "mode" "SI")])
17910
17911 ;; PICK*
17912 @@ -784,7 +784,7 @@
17913 UNSPEC_PICK))]
17914 "ISA_HAS_DSP"
17915 "pick.<DSPV:dspfmt2>\t%0,%1,%2"
17916 - [(set_attr "type" "arith")
17917 + [(set_attr "type" "dspalu")
17918 (set_attr "mode" "SI")])
17919
17920 ;; PACKRL*
17921 @@ -795,7 +795,7 @@
17922 UNSPEC_PACKRL_PH))]
17923 "ISA_HAS_DSP"
17924 "packrl.ph\t%0,%1,%2"
17925 - [(set_attr "type" "arith")
17926 + [(set_attr "type" "dspalu")
17927 (set_attr "mode" "SI")])
17928
17929 ;; Table 2-6. MIPS DSP ASE Instructions: Accumulator and DSPControl Access
17930 @@ -818,7 +818,7 @@
17931 }
17932 return "extrv.w\t%0,%q1,%2";
17933 }
17934 - [(set_attr "type" "mfhilo")
17935 + [(set_attr "type" "accext")
17936 (set_attr "mode" "SI")])
17937
17938 (define_insn "mips_extr_r_w"
17939 @@ -839,7 +839,7 @@
17940 }
17941 return "extrv_r.w\t%0,%q1,%2";
17942 }
17943 - [(set_attr "type" "mfhilo")
17944 + [(set_attr "type" "accext")
17945 (set_attr "mode" "SI")])
17946
17947 (define_insn "mips_extr_rs_w"
17948 @@ -860,7 +860,7 @@
17949 }
17950 return "extrv_rs.w\t%0,%q1,%2";
17951 }
17952 - [(set_attr "type" "mfhilo")
17953 + [(set_attr "type" "accext")
17954 (set_attr "mode" "SI")])
17955
17956 ;; EXTR*_S.H
17957 @@ -882,7 +882,7 @@
17958 }
17959 return "extrv_s.h\t%0,%q1,%2";
17960 }
17961 - [(set_attr "type" "mfhilo")
17962 + [(set_attr "type" "accext")
17963 (set_attr "mode" "SI")])
17964
17965 ;; EXTP*
17966 @@ -905,7 +905,7 @@
17967 }
17968 return "extpv\t%0,%q1,%2";
17969 }
17970 - [(set_attr "type" "mfhilo")
17971 + [(set_attr "type" "accext")
17972 (set_attr "mode" "SI")])
17973
17974 (define_insn "mips_extpdp"
17975 @@ -930,7 +930,7 @@
17976 }
17977 return "extpdpv\t%0,%q1,%2";
17978 }
17979 - [(set_attr "type" "mfhilo")
17980 + [(set_attr "type" "accext")
17981 (set_attr "mode" "SI")])
17982
17983 ;; SHILO*
17984 @@ -949,7 +949,7 @@
17985 }
17986 return "shilov\t%q0,%2";
17987 }
17988 - [(set_attr "type" "mfhilo")
17989 + [(set_attr "type" "accmod")
17990 (set_attr "mode" "SI")])
17991
17992 ;; MTHLIP*
17993 @@ -965,7 +965,7 @@
17994 (reg:CCDSP CCDSP_PO_REGNUM)] UNSPEC_MTHLIP))])]
17995 "ISA_HAS_DSP && !TARGET_64BIT"
17996 "mthlip\t%2,%q0"
17997 - [(set_attr "type" "mfhilo")
17998 + [(set_attr "type" "accmod")
17999 (set_attr "mode" "SI")])
18000
18001 ;; WRDSP
18002 @@ -987,7 +987,7 @@
18003 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))])]
18004 "ISA_HAS_DSP"
18005 "wrdsp\t%0,%1"
18006 - [(set_attr "type" "arith")
18007 + [(set_attr "type" "dspalu")
18008 (set_attr "mode" "SI")])
18009
18010 ;; RDDSP
18011 @@ -1003,7 +1003,7 @@
18012 UNSPEC_RDDSP))]
18013 "ISA_HAS_DSP"
18014 "rddsp\t%0,%1"
18015 - [(set_attr "type" "arith")
18016 + [(set_attr "type" "dspalu")
18017 (set_attr "mode" "SI")])
18018
18019 ;; Table 2-7. MIPS DSP ASE Instructions: Indexed-Load
18020 diff -Nur a/gcc/config/mips/mips-dspr2.md b/gcc/config/mips/mips-dspr2.md
18021 --- a/gcc/config/mips/mips-dspr2.md 2007-09-23 11:24:21.000000000 +0200
18022 +++ b/gcc/config/mips/mips-dspr2.md 2010-01-25 09:50:29.025687257 +0100
18023 @@ -9,7 +9,7 @@
18024 (unspec:CCDSP [(match_dup 1)] UNSPEC_ABSQ_S_QB))])]
18025 "ISA_HAS_DSPR2"
18026 "absq_s.qb\t%0,%z1"
18027 - [(set_attr "type" "arith")
18028 + [(set_attr "type" "dspalusat")
18029 (set_attr "mode" "SI")])
18030
18031 (define_insn "mips_addu_ph"
18032 @@ -21,7 +21,7 @@
18033 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDU_PH))])]
18034 "ISA_HAS_DSPR2"
18035 "addu.ph\t%0,%z1,%z2"
18036 - [(set_attr "type" "arith")
18037 + [(set_attr "type" "dspalu")
18038 (set_attr "mode" "SI")])
18039
18040 (define_insn "mips_addu_s_ph"
18041 @@ -34,7 +34,7 @@
18042 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDU_S_PH))])]
18043 "ISA_HAS_DSPR2"
18044 "addu_s.ph\t%0,%z1,%z2"
18045 - [(set_attr "type" "arith")
18046 + [(set_attr "type" "dspalusat")
18047 (set_attr "mode" "SI")])
18048
18049 (define_insn "mips_adduh_qb"
18050 @@ -44,7 +44,7 @@
18051 UNSPEC_ADDUH_QB))]
18052 "ISA_HAS_DSPR2"
18053 "adduh.qb\t%0,%z1,%z2"
18054 - [(set_attr "type" "arith")
18055 + [(set_attr "type" "dspalu")
18056 (set_attr "mode" "SI")])
18057
18058 (define_insn "mips_adduh_r_qb"
18059 @@ -54,7 +54,7 @@
18060 UNSPEC_ADDUH_R_QB))]
18061 "ISA_HAS_DSPR2"
18062 "adduh_r.qb\t%0,%z1,%z2"
18063 - [(set_attr "type" "arith")
18064 + [(set_attr "type" "dspalusat")
18065 (set_attr "mode" "SI")])
18066
18067 (define_insn "mips_append"
18068 @@ -69,7 +69,7 @@
18069 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
18070 return "append\t%0,%z2,%3";
18071 }
18072 - [(set_attr "type" "arith")
18073 + [(set_attr "type" "dspalu")
18074 (set_attr "mode" "SI")])
18075
18076 (define_insn "mips_balign"
18077 @@ -84,7 +84,7 @@
18078 operands[2] = GEN_INT (INTVAL (operands[2]) & 3);
18079 return "balign\t%0,%z2,%3";
18080 }
18081 - [(set_attr "type" "arith")
18082 + [(set_attr "type" "dspalu")
18083 (set_attr "mode" "SI")])
18084
18085 (define_insn "mips_cmpgdu_eq_qb"
18086 @@ -99,7 +99,7 @@
18087 UNSPEC_CMPGDU_EQ_QB))])]
18088 "ISA_HAS_DSPR2"
18089 "cmpgdu.eq.qb\t%0,%z1,%z2"
18090 - [(set_attr "type" "arith")
18091 + [(set_attr "type" "dspalu")
18092 (set_attr "mode" "SI")])
18093
18094 (define_insn "mips_cmpgdu_lt_qb"
18095 @@ -114,7 +114,7 @@
18096 UNSPEC_CMPGDU_LT_QB))])]
18097 "ISA_HAS_DSPR2"
18098 "cmpgdu.lt.qb\t%0,%z1,%z2"
18099 - [(set_attr "type" "arith")
18100 + [(set_attr "type" "dspalu")
18101 (set_attr "mode" "SI")])
18102
18103 (define_insn "mips_cmpgdu_le_qb"
18104 @@ -129,7 +129,7 @@
18105 UNSPEC_CMPGDU_LE_QB))])]
18106 "ISA_HAS_DSPR2"
18107 "cmpgdu.le.qb\t%0,%z1,%z2"
18108 - [(set_attr "type" "arith")
18109 + [(set_attr "type" "dspalu")
18110 (set_attr "mode" "SI")])
18111
18112 (define_insn "mips_dpa_w_ph"
18113 @@ -140,7 +140,7 @@
18114 UNSPEC_DPA_W_PH))]
18115 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18116 "dpa.w.ph\t%q0,%z2,%z3"
18117 - [(set_attr "type" "imadd")
18118 + [(set_attr "type" "dspmac")
18119 (set_attr "mode" "SI")])
18120
18121 (define_insn "mips_dps_w_ph"
18122 @@ -151,7 +151,7 @@
18123 UNSPEC_DPS_W_PH))]
18124 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18125 "dps.w.ph\t%q0,%z2,%z3"
18126 - [(set_attr "type" "imadd")
18127 + [(set_attr "type" "dspmac")
18128 (set_attr "mode" "SI")])
18129
18130 (define_expand "mips_madd<u>"
18131 @@ -247,7 +247,7 @@
18132 UNSPEC_MULSA_W_PH))]
18133 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18134 "mulsa.w.ph\t%q0,%z2,%z3"
18135 - [(set_attr "type" "imadd")
18136 + [(set_attr "type" "dspmac")
18137 (set_attr "mode" "SI")])
18138
18139 (define_insn "mips_mult"
18140 @@ -277,7 +277,7 @@
18141 UNSPEC_PRECR_QB_PH))]
18142 "ISA_HAS_DSPR2"
18143 "precr.qb.ph\t%0,%z1,%z2"
18144 - [(set_attr "type" "arith")
18145 + [(set_attr "type" "dspalu")
18146 (set_attr "mode" "SI")])
18147
18148 (define_insn "mips_precr_sra_ph_w"
18149 @@ -292,7 +292,7 @@
18150 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
18151 return "precr_sra.ph.w\t%0,%z2,%3";
18152 }
18153 - [(set_attr "type" "arith")
18154 + [(set_attr "type" "dspalu")
18155 (set_attr "mode" "SI")])
18156
18157 (define_insn "mips_precr_sra_r_ph_w"
18158 @@ -307,7 +307,7 @@
18159 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
18160 return "precr_sra_r.ph.w\t%0,%z2,%3";
18161 }
18162 - [(set_attr "type" "arith")
18163 + [(set_attr "type" "dspalu")
18164 (set_attr "mode" "SI")])
18165
18166 (define_insn "mips_prepend"
18167 @@ -322,7 +322,7 @@
18168 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
18169 return "prepend\t%0,%z2,%3";
18170 }
18171 - [(set_attr "type" "arith")
18172 + [(set_attr "type" "dspalu")
18173 (set_attr "mode" "SI")])
18174
18175 (define_insn "mips_shra_qb"
18176 @@ -340,7 +340,7 @@
18177 }
18178 return "shrav.qb\t%0,%z1,%2";
18179 }
18180 - [(set_attr "type" "shift")
18181 + [(set_attr "type" "dspalu")
18182 (set_attr "mode" "SI")])
18183
18184
18185 @@ -359,7 +359,7 @@
18186 }
18187 return "shrav_r.qb\t%0,%z1,%2";
18188 }
18189 - [(set_attr "type" "shift")
18190 + [(set_attr "type" "dspalu")
18191 (set_attr "mode" "SI")])
18192
18193 (define_insn "mips_shrl_ph"
18194 @@ -377,7 +377,7 @@
18195 }
18196 return "shrlv.ph\t%0,%z1,%2";
18197 }
18198 - [(set_attr "type" "shift")
18199 + [(set_attr "type" "dspalu")
18200 (set_attr "mode" "SI")])
18201
18202 (define_insn "mips_subu_ph"
18203 @@ -390,7 +390,7 @@
18204 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBU_PH))])]
18205 "ISA_HAS_DSPR2"
18206 "subu.ph\t%0,%z1,%z2"
18207 - [(set_attr "type" "arith")
18208 + [(set_attr "type" "dspalu")
18209 (set_attr "mode" "SI")])
18210
18211 (define_insn "mips_subu_s_ph"
18212 @@ -403,7 +403,7 @@
18213 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBU_S_PH))])]
18214 "ISA_HAS_DSPR2"
18215 "subu_s.ph\t%0,%z1,%z2"
18216 - [(set_attr "type" "arith")
18217 + [(set_attr "type" "dspalusat")
18218 (set_attr "mode" "SI")])
18219
18220 (define_insn "mips_subuh_qb"
18221 @@ -413,7 +413,7 @@
18222 UNSPEC_SUBUH_QB))]
18223 "ISA_HAS_DSPR2"
18224 "subuh.qb\t%0,%z1,%z2"
18225 - [(set_attr "type" "arith")
18226 + [(set_attr "type" "dspalu")
18227 (set_attr "mode" "SI")])
18228
18229 (define_insn "mips_subuh_r_qb"
18230 @@ -423,7 +423,7 @@
18231 UNSPEC_SUBUH_R_QB))]
18232 "ISA_HAS_DSPR2"
18233 "subuh_r.qb\t%0,%z1,%z2"
18234 - [(set_attr "type" "arith")
18235 + [(set_attr "type" "dspalu")
18236 (set_attr "mode" "SI")])
18237
18238 (define_insn "mips_addqh_ph"
18239 @@ -433,7 +433,7 @@
18240 UNSPEC_ADDQH_PH))]
18241 "ISA_HAS_DSPR2"
18242 "addqh.ph\t%0,%z1,%z2"
18243 - [(set_attr "type" "arith")
18244 + [(set_attr "type" "dspalu")
18245 (set_attr "mode" "SI")])
18246
18247 (define_insn "mips_addqh_r_ph"
18248 @@ -443,7 +443,7 @@
18249 UNSPEC_ADDQH_R_PH))]
18250 "ISA_HAS_DSPR2"
18251 "addqh_r.ph\t%0,%z1,%z2"
18252 - [(set_attr "type" "arith")
18253 + [(set_attr "type" "dspalu")
18254 (set_attr "mode" "SI")])
18255
18256 (define_insn "mips_addqh_w"
18257 @@ -453,7 +453,7 @@
18258 UNSPEC_ADDQH_W))]
18259 "ISA_HAS_DSPR2"
18260 "addqh.w\t%0,%z1,%z2"
18261 - [(set_attr "type" "arith")
18262 + [(set_attr "type" "dspalu")
18263 (set_attr "mode" "SI")])
18264
18265 (define_insn "mips_addqh_r_w"
18266 @@ -463,7 +463,7 @@
18267 UNSPEC_ADDQH_R_W))]
18268 "ISA_HAS_DSPR2"
18269 "addqh_r.w\t%0,%z1,%z2"
18270 - [(set_attr "type" "arith")
18271 + [(set_attr "type" "dspalu")
18272 (set_attr "mode" "SI")])
18273
18274 (define_insn "mips_subqh_ph"
18275 @@ -473,7 +473,7 @@
18276 UNSPEC_SUBQH_PH))]
18277 "ISA_HAS_DSPR2"
18278 "subqh.ph\t%0,%z1,%z2"
18279 - [(set_attr "type" "arith")
18280 + [(set_attr "type" "dspalu")
18281 (set_attr "mode" "SI")])
18282
18283 (define_insn "mips_subqh_r_ph"
18284 @@ -483,7 +483,7 @@
18285 UNSPEC_SUBQH_R_PH))]
18286 "ISA_HAS_DSPR2"
18287 "subqh_r.ph\t%0,%z1,%z2"
18288 - [(set_attr "type" "arith")
18289 + [(set_attr "type" "dspalu")
18290 (set_attr "mode" "SI")])
18291
18292 (define_insn "mips_subqh_w"
18293 @@ -493,7 +493,7 @@
18294 UNSPEC_SUBQH_W))]
18295 "ISA_HAS_DSPR2"
18296 "subqh.w\t%0,%z1,%z2"
18297 - [(set_attr "type" "arith")
18298 + [(set_attr "type" "dspalu")
18299 (set_attr "mode" "SI")])
18300
18301 (define_insn "mips_subqh_r_w"
18302 @@ -503,7 +503,7 @@
18303 UNSPEC_SUBQH_R_W))]
18304 "ISA_HAS_DSPR2"
18305 "subqh_r.w\t%0,%z1,%z2"
18306 - [(set_attr "type" "arith")
18307 + [(set_attr "type" "dspalu")
18308 (set_attr "mode" "SI")])
18309
18310 (define_insn "mips_dpax_w_ph"
18311 @@ -514,7 +514,7 @@
18312 UNSPEC_DPAX_W_PH))]
18313 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18314 "dpax.w.ph\t%q0,%z2,%z3"
18315 - [(set_attr "type" "imadd")
18316 + [(set_attr "type" "dspmac")
18317 (set_attr "mode" "SI")])
18318
18319 (define_insn "mips_dpsx_w_ph"
18320 @@ -525,7 +525,7 @@
18321 UNSPEC_DPSX_W_PH))]
18322 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18323 "dpsx.w.ph\t%q0,%z2,%z3"
18324 - [(set_attr "type" "imadd")
18325 + [(set_attr "type" "dspmac")
18326 (set_attr "mode" "SI")])
18327
18328 (define_insn "mips_dpaqx_s_w_ph"
18329 @@ -540,7 +540,7 @@
18330 UNSPEC_DPAQX_S_W_PH))])]
18331 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18332 "dpaqx_s.w.ph\t%q0,%z2,%z3"
18333 - [(set_attr "type" "imadd")
18334 + [(set_attr "type" "dspmac")
18335 (set_attr "mode" "SI")])
18336
18337 (define_insn "mips_dpaqx_sa_w_ph"
18338 @@ -555,7 +555,7 @@
18339 UNSPEC_DPAQX_SA_W_PH))])]
18340 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18341 "dpaqx_sa.w.ph\t%q0,%z2,%z3"
18342 - [(set_attr "type" "imadd")
18343 + [(set_attr "type" "dspmacsat")
18344 (set_attr "mode" "SI")])
18345
18346 (define_insn "mips_dpsqx_s_w_ph"
18347 @@ -570,7 +570,7 @@
18348 UNSPEC_DPSQX_S_W_PH))])]
18349 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18350 "dpsqx_s.w.ph\t%q0,%z2,%z3"
18351 - [(set_attr "type" "imadd")
18352 + [(set_attr "type" "dspmac")
18353 (set_attr "mode" "SI")])
18354
18355 (define_insn "mips_dpsqx_sa_w_ph"
18356 @@ -585,5 +585,43 @@
18357 UNSPEC_DPSQX_SA_W_PH))])]
18358 "ISA_HAS_DSPR2 && !TARGET_64BIT"
18359 "dpsqx_sa.w.ph\t%q0,%z2,%z3"
18360 - [(set_attr "type" "imadd")
18361 + [(set_attr "type" "dspmacsat")
18362 + (set_attr "mode" "SI")])
18363 +
18364 +;; Convert mtlo $ac[1-3],$0 => mult $ac[1-3],$0,$0
18365 +;; mthi $ac[1-3],$0
18366 +(define_peephole2
18367 + [(set (match_operand:SI 0 "register_operand" "")
18368 + (const_int 0))
18369 + (set (match_operand:SI 1 "register_operand" "")
18370 + (const_int 0))]
18371 + "ISA_HAS_DSPR2
18372 + && !TARGET_MIPS16
18373 + && !TARGET_64BIT
18374 + && (((true_regnum (operands[0]) == AC1LO_REGNUM
18375 + && true_regnum (operands[1]) == AC1HI_REGNUM)
18376 + || (true_regnum (operands[0]) == AC1HI_REGNUM
18377 + && true_regnum (operands[1]) == AC1LO_REGNUM))
18378 + || ((true_regnum (operands[0]) == AC2LO_REGNUM
18379 + && true_regnum (operands[1]) == AC2HI_REGNUM)
18380 + || (true_regnum (operands[0]) == AC2HI_REGNUM
18381 + && true_regnum (operands[1]) == AC2LO_REGNUM))
18382 + || ((true_regnum (operands[0]) == AC3LO_REGNUM
18383 + && true_regnum (operands[1]) == AC3HI_REGNUM)
18384 + || (true_regnum (operands[0]) == AC3HI_REGNUM
18385 + && true_regnum (operands[1]) == AC3LO_REGNUM)))"
18386 + [(parallel [(set (match_dup 0) (const_int 0))
18387 + (set (match_dup 1) (const_int 0))])]
18388 +)
18389 +
18390 +(define_insn "*mips_acc_init"
18391 + [(parallel [(set (match_operand:SI 0 "register_operand" "=a")
18392 + (const_int 0))
18393 + (set (match_operand:SI 1 "register_operand" "=a")
18394 + (const_int 0))])]
18395 + "ISA_HAS_DSPR2
18396 + && !TARGET_MIPS16
18397 + && !TARGET_64BIT"
18398 + "mult\t%q0,$0,$0\t\t# Clear ACC HI/LO"
18399 + [(set_attr "type" "imul")
18400 (set_attr "mode" "SI")])
18401 diff -Nur a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
18402 --- a/gcc/config/mips/mips.h 2009-02-20 16:20:38.000000000 +0100
18403 +++ b/gcc/config/mips/mips.h 2010-01-25 09:50:29.025687257 +0100
18404 @@ -342,6 +342,9 @@
18405 #define TARGET_IRIX 0
18406 #define TARGET_IRIX6 0
18407
18408 +/* SDE specific stuff. */
18409 +#define TARGET_MIPS_SDE 0
18410 +
18411 /* Define preprocessor macros for the -march and -mtune options.
18412 PREFIX is either _MIPS_ARCH or _MIPS_TUNE, INFO is the selected
18413 processor. If INFO's canonical name is "foo", define PREFIX to
18414 @@ -708,8 +711,9 @@
18415 |march=r10000|march=r12000|march=r14000|march=r16000:-mips4} \
18416 %{march=mips32|march=4kc|march=4km|march=4kp|march=4ksc:-mips32} \
18417 %{march=mips32r2|march=m4k|march=4ke*|march=4ksd|march=24k* \
18418 - |march=34k*|march=74k*: -mips32r2} \
18419 - %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000: -mips64} \
18420 + |march=34k*|march=74k*|march=1004k*: -mips32r2} \
18421 + %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000 \
18422 + |march=xlr: -mips64} \
18423 %{march=mips64r2|march=octeon: -mips64r2} \
18424 %{!march=*: -" MULTILIB_ISA_DEFAULT "}}"
18425
18426 @@ -720,7 +724,8 @@
18427 #define MIPS_ARCH_FLOAT_SPEC \
18428 "%{mhard-float|msoft-float|march=mips*:; \
18429 march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
18430 - |march=34kc|march=74kc|march=5kc|march=octeon: -msoft-float; \
18431 + |march=34kc|march=74kc|march=1004kc|march=5kc \
18432 + |march=octeon|march=xlr: -msoft-float; \
18433 march=*: -mhard-float}"
18434
18435 /* A spec condition that matches 32-bit options. It only works if
18436 @@ -731,8 +736,9 @@
18437
18438 /* Support for a compile-time default CPU, et cetera. The rules are:
18439 --with-arch is ignored if -march is specified or a -mips is specified
18440 - (other than -mips16).
18441 - --with-tune is ignored if -mtune is specified.
18442 + (other than -mips16); likewise --with-arch-32 and --with-arch-64.
18443 + --with-tune is ignored if -mtune is specified; likewise
18444 + --with-tune-32 and --with-tune-64.
18445 --with-abi is ignored if -mabi is specified.
18446 --with-float is ignored if -mhard-float or -msoft-float are
18447 specified.
18448 @@ -740,7 +746,11 @@
18449 specified. */
18450 #define OPTION_DEFAULT_SPECS \
18451 {"arch", "%{" MIPS_ARCH_OPTION_SPEC ":;: -march=%(VALUE)}" }, \
18452 + {"arch_32", "%{!mabi=*|mabi=32:%{" MIPS_ARCH_OPTION_SPEC ":;: -march=%(VALUE)}}" }, \
18453 + {"arch_64", "%{mabi=n32|mabi=64:%{" MIPS_ARCH_OPTION_SPEC ":;: -march=%(VALUE)}}" }, \
18454 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
18455 + {"tune_32", "%{!mabi=*|mabi=32:%{!mtune=*:-mtune=%(VALUE)}}" }, \
18456 + {"tune_64", "%{mabi=n32|mabi=64:%{!mtune=*:-mtune=%(VALUE)}}" }, \
18457 {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \
18458 {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \
18459 {"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \
18460 @@ -750,7 +760,7 @@
18461
18462 /* A spec that infers the -mdsp setting from an -march argument. */
18463 #define BASE_DRIVER_SELF_SPECS \
18464 - "%{!mno-dsp:%{march=24ke*|march=34k*|march=74k*: -mdsp}}"
18465 + "%{!mno-dsp:%{march=24ke*|march=34k*|march=74k*|march=1004k*: -mdsp}}"
18466
18467 #define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS
18468
18469 @@ -1038,6 +1048,11 @@
18470 /* ISA includes the bbit* instructions. */
18471 #define ISA_HAS_BBIT (TARGET_OCTEON && !TARGET_MIPS16)
18472
18473 +/* ISA has single-instruction unaligned load/store support. */
18474 +#define ISA_HAS_UL_US (TARGET_OCTEON \
18475 + && TARGET_OCTEON_UNALIGNED \
18476 + && !TARGET_MIPS16)
18477 +
18478 /* ISA includes the cins instruction. */
18479 #define ISA_HAS_CINS (TARGET_OCTEON && !TARGET_MIPS16)
18480
18481 @@ -1055,6 +1070,7 @@
18482
18483 /* The CACHE instruction is available. */
18484 #define ISA_HAS_CACHE (TARGET_CACHE_BUILTIN && !TARGET_MIPS16)
18485 +
18486 \f
18487 /* Add -G xx support. */
18488
18489 @@ -1152,6 +1168,7 @@
18490 %{mshared} %{mno-shared} \
18491 %{msym32} %{mno-sym32} \
18492 %{mtune=*} %{v} \
18493 +%{mocteon-useun} %{mno-octeon-useun} \
18494 %(subtarget_asm_spec)"
18495
18496 /* Extra switches sometimes passed to the linker. */
18497 @@ -1622,6 +1639,9 @@
18498 #define GP_REG_LAST 31
18499 #define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1)
18500 #define GP_DBX_FIRST 0
18501 +#define K0_REG_NUM (GP_REG_FIRST + 26)
18502 +#define K1_REG_NUM (GP_REG_FIRST + 27)
18503 +#define KERNEL_REG_P(REGNO) (IN_RANGE (REGNO, K0_REG_NUM, K1_REG_NUM))
18504
18505 #define FP_REG_FIRST 32
18506 #define FP_REG_LAST 63
18507 @@ -1649,6 +1669,10 @@
18508 #define COP0_REG_LAST 111
18509 #define COP0_REG_NUM (COP0_REG_LAST - COP0_REG_FIRST + 1)
18510
18511 +#define COP0_STATUS_REG_NUM (COP0_REG_FIRST + 12)
18512 +#define COP0_CAUSE_REG_NUM (COP0_REG_FIRST + 13)
18513 +#define COP0_EPC_REG_NUM (COP0_REG_FIRST + 14)
18514 +
18515 #define COP2_REG_FIRST 112
18516 #define COP2_REG_LAST 143
18517 #define COP2_REG_NUM (COP2_REG_LAST - COP2_REG_FIRST + 1)
18518 @@ -1666,6 +1690,29 @@
18519 #define AT_REGNUM (GP_REG_FIRST + 1)
18520 #define HI_REGNUM (TARGET_BIG_ENDIAN ? MD_REG_FIRST : MD_REG_FIRST + 1)
18521 #define LO_REGNUM (TARGET_BIG_ENDIAN ? MD_REG_FIRST + 1 : MD_REG_FIRST)
18522 +#define AC1HI_REGNUM (TARGET_BIG_ENDIAN \
18523 + ? DSP_ACC_REG_FIRST : DSP_ACC_REG_FIRST + 1)
18524 +#define AC1LO_REGNUM (TARGET_BIG_ENDIAN \
18525 + ? DSP_ACC_REG_FIRST + 1 : DSP_ACC_REG_FIRST)
18526 +#define AC2HI_REGNUM (TARGET_BIG_ENDIAN \
18527 + ? DSP_ACC_REG_FIRST + 2 : DSP_ACC_REG_FIRST + 3)
18528 +#define AC2LO_REGNUM (TARGET_BIG_ENDIAN \
18529 + ? DSP_ACC_REG_FIRST + 3 : DSP_ACC_REG_FIRST + 2)
18530 +#define AC3HI_REGNUM (TARGET_BIG_ENDIAN \
18531 + ? DSP_ACC_REG_FIRST + 4 : DSP_ACC_REG_FIRST + 5)
18532 +#define AC3LO_REGNUM (TARGET_BIG_ENDIAN \
18533 + ? DSP_ACC_REG_FIRST + 5 : DSP_ACC_REG_FIRST + 4)
18534 +
18535 +/* A few bitfield locations for the coprocessor registers. */
18536 +/* Request Interrupt Priority Level is from bit 10 to bit 15 of
18537 + the cause register for the EIC interrupt mode. */
18538 +#define CAUSE_IPL 10
18539 +/* Interrupt Priority Level is from bit 10 to bit 15 of the status register. */
18540 +#define SR_IPL 10
18541 +/* Exception Level is at bit 1 of the status register. */
18542 +#define SR_EXL 1
18543 +/* Interrupt Enable is at bit 0 of the status register. */
18544 +#define SR_IE 0
18545
18546 /* FPSW_REGNUM is the single condition code used if !ISA_HAS_8CC.
18547 If ISA_HAS_8CC, it should not be used, and an arbitrary ST_REG
18548 @@ -1754,11 +1801,18 @@
18549 incoming arguments, the static chain pointer, or the frame pointer.
18550 The epilogue temporary mustn't conflict with the return registers,
18551 the PIC call register ($25), the frame pointer, the EH stack adjustment,
18552 - or the EH data registers. */
18553 + or the EH data registers.
18554 +
18555 + If we're generating interrupt handlers, we use K0 as a temporary register
18556 + in prologue/epilogue code. */
18557
18558 #define MIPS16_PIC_TEMP_REGNUM (GP_REG_FIRST + 2)
18559 -#define MIPS_PROLOGUE_TEMP_REGNUM (GP_REG_FIRST + 3)
18560 -#define MIPS_EPILOGUE_TEMP_REGNUM (GP_REG_FIRST + (TARGET_MIPS16 ? 6 : 8))
18561 +#define MIPS_PROLOGUE_TEMP_REGNUM \
18562 + (cfun->machine->interrupt_handler_p ? K0_REG_NUM : GP_REG_FIRST + 3)
18563 +#define MIPS_EPILOGUE_TEMP_REGNUM \
18564 + (cfun->machine->interrupt_handler_p \
18565 + ? K0_REG_NUM \
18566 + : GP_REG_FIRST + (TARGET_MIPS16 ? 6 : 8))
18567
18568 #define MIPS16_PIC_TEMP gen_rtx_REG (Pmode, MIPS16_PIC_TEMP_REGNUM)
18569 #define MIPS_PROLOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_PROLOGUE_TEMP_REGNUM)
18570 @@ -2284,14 +2338,7 @@
18571 (mips_abi == ABI_EABI && UNITS_PER_FPVALUE >= UNITS_PER_DOUBLE)
18572
18573 \f
18574 -/* Say that the epilogue uses the return address register. Note that
18575 - in the case of sibcalls, the values "used by the epilogue" are
18576 - considered live at the start of the called function.
18577 -
18578 - If using a GOT, say that the epilogue also uses GOT_VERSION_REGNUM.
18579 - See the comment above load_call<mode> for details. */
18580 -#define EPILOGUE_USES(REGNO) \
18581 - ((REGNO) == 31 || (TARGET_USE_GOT && (REGNO) == GOT_VERSION_REGNUM))
18582 +#define EPILOGUE_USES(REGNO) mips_epilogue_uses (REGNO)
18583
18584 /* Treat LOC as a byte offset from the stack pointer and round it up
18585 to the next fully-aligned offset. */
18586 diff -Nur a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
18587 --- a/gcc/config/mips/mips.md 2009-02-20 16:20:38.000000000 +0100
18588 +++ b/gcc/config/mips/mips.md 2010-01-25 09:50:29.035686224 +0100
18589 @@ -67,7 +67,16 @@
18590 (UNSPEC_SET_GOT_VERSION 46)
18591 (UNSPEC_UPDATE_GOT_VERSION 47)
18592 (UNSPEC_COPYGP 48)
18593 + (UNSPEC_ERET 49)
18594 + (UNSPEC_DERET 50)
18595 + (UNSPEC_DI 51)
18596 + (UNSPEC_EHB 52)
18597 + (UNSPEC_RDPGPR 53)
18598 + (UNSPEC_COP0 54)
18599
18600 + (UNSPEC_UNALIGNED_LOAD 60)
18601 + (UNSPEC_UNALIGNED_STORE 61)
18602 +
18603 (UNSPEC_ADDRESS_FIRST 100)
18604
18605 (TLS_GET_TP_REGNUM 3)
18606 @@ -372,6 +381,12 @@
18607 ;; frsqrt floating point reciprocal square root
18608 ;; frsqrt1 floating point reciprocal square root step1
18609 ;; frsqrt2 floating point reciprocal square root step2
18610 +;; dspmac DSP MAC instructions not saturating the accumulator
18611 +;; dspmacsat DSP MAC instructions that saturate the accumulator
18612 +;; accext DSP accumulator extract instructions
18613 +;; accmod DSP accumulator modify instructions
18614 +;; dspalu DSP ALU instructions not saturating the result
18615 +;; dspalusat DSP ALU instructions that saturate the result
18616 ;; multi multiword sequence (or user asm statements)
18617 ;; nop no operation
18618 ;; ghost an instruction that produces no real code
18619 @@ -380,7 +395,7 @@
18620 prefetch,prefetchx,condmove,mtc,mfc,mthilo,mfhilo,const,arith,logical,
18621 shift,slt,signext,clz,pop,trap,imul,imul3,imul3nc,imadd,idiv,idiv3,move,
18622 fmove,fadd,fmul,fmadd,fdiv,frdiv,frdiv1,frdiv2,fabs,fneg,fcmp,fcvt,fsqrt,
18623 - frsqrt,frsqrt1,frsqrt2,multi,nop,ghost"
18624 + frsqrt,frsqrt1,frsqrt2,dspmac,dspmacsat,accext,accmod,dspalu,dspalusat,multi,nop,ghost"
18625 (cond [(eq_attr "jal" "!unset") (const_string "call")
18626 (eq_attr "got" "load") (const_string "load")
18627
18628 @@ -3565,7 +3580,9 @@
18629 (unspec:GPR [(match_operand:BLK 1 "memory_operand" "m")
18630 (match_operand:QI 2 "memory_operand" "m")]
18631 UNSPEC_LOAD_LEFT))]
18632 - "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
18633 + "!TARGET_MIPS16
18634 + && !ISA_HAS_UL_US
18635 + && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
18636 "<load>l\t%0,%2"
18637 [(set_attr "move_type" "load")
18638 (set_attr "mode" "<MODE>")])
18639 @@ -3576,7 +3593,9 @@
18640 (match_operand:QI 2 "memory_operand" "m")
18641 (match_operand:GPR 3 "register_operand" "0")]
18642 UNSPEC_LOAD_RIGHT))]
18643 - "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
18644 + "!TARGET_MIPS16
18645 + && !ISA_HAS_UL_US
18646 + && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
18647 "<load>r\t%0,%2"
18648 [(set_attr "move_type" "load")
18649 (set_attr "mode" "<MODE>")])
18650 @@ -3586,7 +3605,9 @@
18651 (unspec:BLK [(match_operand:GPR 1 "reg_or_0_operand" "dJ")
18652 (match_operand:QI 2 "memory_operand" "m")]
18653 UNSPEC_STORE_LEFT))]
18654 - "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[0])"
18655 + "!TARGET_MIPS16
18656 + && !ISA_HAS_UL_US
18657 + && mips_mem_fits_mode_p (<MODE>mode, operands[0])"
18658 "<store>l\t%z1,%2"
18659 [(set_attr "move_type" "store")
18660 (set_attr "mode" "<MODE>")])
18661 @@ -3602,6 +3623,28 @@
18662 [(set_attr "move_type" "store")
18663 (set_attr "mode" "<MODE>")])
18664
18665 +;; Unaligned load and store patterns.
18666 +
18667 +(define_insn "mov_u<load>"
18668 + [(set (match_operand:GPR 0 "register_operand" "=d")
18669 + (unspec:GPR [(match_operand:BLK 1 "memory_operand" "m")
18670 + (match_operand:QI 2 "memory_operand" "m")]
18671 + UNSPEC_UNALIGNED_LOAD))]
18672 + "ISA_HAS_UL_US && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
18673 + "u<load>\t%0,%2"
18674 + [(set_attr "type" "load")
18675 + (set_attr "mode" "<MODE>")])
18676 +
18677 +(define_insn "mov_u<store>"
18678 + [(set (match_operand:BLK 0 "memory_operand" "=m")
18679 + (unspec:BLK [(match_operand:GPR 1 "reg_or_0_operand" "dJ")
18680 + (match_operand:QI 2 "memory_operand" "m")]
18681 + UNSPEC_UNALIGNED_STORE))]
18682 + "ISA_HAS_UL_US && mips_mem_fits_mode_p (<MODE>mode, operands[0])"
18683 + "u<store>\t%z1,%2"
18684 + [(set_attr "type" "store")
18685 + (set_attr "mode" "<MODE>")])
18686 +
18687 ;; An instruction to calculate the high part of a 64-bit SYMBOL_ABSOLUTE.
18688 ;; The required value is:
18689 ;;
18690 @@ -5472,6 +5515,26 @@
18691 return "%*b\t%l0%/";
18692 else
18693 {
18694 + if (final_sequence && (mips_abi == ABI_32 || mips_abi == ABI_O64))
18695 + {
18696 + /* If the delay slot contains a $gp restore, we need to
18697 + do that first, because we need it for the load
18698 + label. Other ABIs do not have caller-save $gp. */
18699 + rtx next = NEXT_INSN (insn);
18700 + if (INSN_P (next) && !INSN_DELETED_P (next))
18701 + {
18702 + rtx pat = PATTERN (next);
18703 + if (GET_CODE (pat) == SET
18704 + && REG_P (SET_DEST (pat))
18705 + && REGNO (SET_DEST (pat)) == PIC_OFFSET_TABLE_REGNUM)
18706 + {
18707 + rtx ops[2];
18708 + ops[0] = SET_DEST (pat);
18709 + ops[1] = SET_SRC (pat);
18710 + output_asm_insn (mips_output_move (ops[0], ops[1]), ops);
18711 + }
18712 + }
18713 + }
18714 output_asm_insn (mips_output_load_label (), operands);
18715 return "%*jr\t%@%/%]";
18716 }
18717 @@ -5490,7 +5553,13 @@
18718 (lt (abs (minus (match_dup 0)
18719 (plus (pc) (const_int 4))))
18720 (const_int 131072)))
18721 - (const_int 4) (const_int 16)))])
18722 + (const_int 4)
18723 + (if_then_else
18724 + ;; for these two ABIs we may need to move a restore of $gp
18725 + (ior (eq (symbol_ref "mips_abi") (symbol_ref "ABI_32"))
18726 + (eq (symbol_ref "mips_abi") (symbol_ref "ABI_O64")))
18727 + (const_int 20)
18728 + (const_int 16))))])
18729
18730 ;; We need a different insn for the mips16, because a mips16 branch
18731 ;; does not have a delay slot.
18732 @@ -5679,6 +5748,60 @@
18733 [(set_attr "type" "jump")
18734 (set_attr "mode" "none")])
18735
18736 +;; Exception return.
18737 +(define_insn "mips_eret"
18738 + [(return)
18739 + (unspec_volatile [(const_int 0)] UNSPEC_ERET)]
18740 + ""
18741 + "eret"
18742 + [(set_attr "type" "trap")
18743 + (set_attr "mode" "none")])
18744 +
18745 +;; Debug exception return.
18746 +(define_insn "mips_deret"
18747 + [(return)
18748 + (unspec_volatile [(const_int 0)] UNSPEC_DERET)]
18749 + ""
18750 + "deret"
18751 + [(set_attr "type" "trap")
18752 + (set_attr "mode" "none")])
18753 +
18754 +;; Disable interrupts.
18755 +(define_insn "mips_di"
18756 + [(unspec_volatile [(const_int 0)] UNSPEC_DI)]
18757 + ""
18758 + "di"
18759 + [(set_attr "type" "trap")
18760 + (set_attr "mode" "none")])
18761 +
18762 +;; Execution hazard barrier.
18763 +(define_insn "mips_ehb"
18764 + [(unspec_volatile [(const_int 0)] UNSPEC_EHB)]
18765 + ""
18766 + "ehb"
18767 + [(set_attr "type" "trap")
18768 + (set_attr "mode" "none")])
18769 +
18770 +;; Read GPR from previous shadow register set.
18771 +(define_insn "mips_rdpgpr"
18772 + [(set (match_operand:SI 0 "register_operand" "=d")
18773 + (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "d")]
18774 + UNSPEC_RDPGPR))]
18775 + ""
18776 + "rdpgpr\t%0,%1"
18777 + [(set_attr "type" "move")
18778 + (set_attr "mode" "SI")])
18779 +
18780 +;; Move involving COP0 registers.
18781 +(define_insn "cop0_move"
18782 + [(set (match_operand:SI 0 "register_operand" "=B,d")
18783 + (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "d,B")]
18784 + UNSPEC_COP0))]
18785 + ""
18786 +{ return mips_output_move (operands[0], operands[1]); }
18787 + [(set_attr "type" "mtc,mfc")
18788 + (set_attr "mode" "SI")])
18789 +
18790 ;; This is used in compiling the unwind routines.
18791 (define_expand "eh_return"
18792 [(use (match_operand 0 "general_operand"))]
18793 diff -Nur a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
18794 --- a/gcc/config/mips/mips.opt 2009-02-20 16:20:38.000000000 +0100
18795 +++ b/gcc/config/mips/mips.opt 2010-01-25 09:50:29.035686224 +0100
18796 @@ -184,6 +184,10 @@
18797 Target Report RejectNegative Mask(MIPS16)
18798 Generate MIPS16 code
18799
18800 +mips16e
18801 +Target Report RejectNegative Mask(MIPS16) MaskExists
18802 +Deprecated; alias for -mips16
18803 +
18804 mips3d
18805 Target Report RejectNegative Mask(MIPS3D)
18806 Use MIPS-3D instructions
18807 @@ -236,6 +240,10 @@
18808 Target Report RejectNegative InverseMask(MIPS3D)
18809 Do not use MIPS-3D instructions
18810
18811 +mocteon-useun
18812 +Target Report Mask(OCTEON_UNALIGNED)
18813 +Use Octeon-specific unaligned loads/stores for 32/64-bit data
18814 +
18815 mpaired-single
18816 Target Report Mask(PAIRED_SINGLE_FLOAT)
18817 Use paired-single floating-point instructions
18818 diff -Nur a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
18819 --- a/gcc/config/mips/mips-protos.h 2009-02-20 16:20:38.000000000 +0100
18820 +++ b/gcc/config/mips/mips-protos.h 2010-01-25 09:50:29.035686224 +0100
18821 @@ -261,6 +261,8 @@
18822 extern void mips_output_external (FILE *, tree, const char *);
18823 extern void mips_output_filename (FILE *, const char *);
18824 extern void mips_output_ascii (FILE *, const char *, size_t);
18825 +extern void octeon_output_shared_variable (FILE *, tree, const char *,
18826 + unsigned HOST_WIDE_INT, int);
18827 extern void mips_output_aligned_decl_common (FILE *, tree, const char *,
18828 unsigned HOST_WIDE_INT,
18829 unsigned int);
18830 @@ -307,6 +309,8 @@
18831 extern bool mips_linked_madd_p (rtx, rtx);
18832 extern bool mips_store_data_bypass_p (rtx, rtx);
18833 extern rtx mips_prefetch_cookie (rtx, rtx);
18834 +extern int mips_mult_madd_chain_bypass_p (rtx, rtx);
18835 +extern int mips_dspalu_bypass_p (rtx, rtx);
18836
18837 extern void irix_asm_output_align (FILE *, unsigned);
18838 extern const char *current_section_name (void);
18839 @@ -332,4 +336,6 @@
18840
18841 extern void mips_expand_vector_init (rtx, rtx);
18842
18843 +extern bool mips_epilogue_uses (unsigned int);
18844 +
18845 #endif /* ! GCC_MIPS_PROTOS_H */
18846 diff -Nur a/gcc/config/mips/montavista-linux.h b/gcc/config/mips/montavista-linux.h
18847 --- a/gcc/config/mips/montavista-linux.h 1970-01-01 01:00:00.000000000 +0100
18848 +++ b/gcc/config/mips/montavista-linux.h 2010-01-25 09:50:29.035686224 +0100
18849 @@ -0,0 +1,54 @@
18850 +/* MontaVista GNU/Linux Configuration.
18851 + Copyright (C) 2009
18852 + Free Software Foundation, Inc.
18853 +
18854 +This file is part of GCC.
18855 +
18856 +GCC is free software; you can redistribute it and/or modify
18857 +it under the terms of the GNU General Public License as published by
18858 +the Free Software Foundation; either version 3, or (at your option)
18859 +any later version.
18860 +
18861 +GCC is distributed in the hope that it will be useful,
18862 +but WITHOUT ANY WARRANTY; without even the implied warranty of
18863 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18864 +GNU General Public License for more details.
18865 +
18866 +You should have received a copy of the GNU General Public License
18867 +along with GCC; see the file COPYING3. If not see
18868 +<http://www.gnu.org/licenses/>. */
18869 +
18870 +/* Override linux64.h to default to O32. */
18871 +#undef SUBTARGET_SELF_SPECS
18872 +#define SUBTARGET_SELF_SPECS \
18873 +NO_SHARED_SPECS, \
18874 +"%{!EB:%{!EL:%(endian_spec)}}", \
18875 +"%{!mabi=*: -mabi=32}"
18876 +
18877 +/* We do not need to provide an explicit big-endian multilib. */
18878 +#undef MULTILIB_DEFAULTS
18879 +#define MULTILIB_DEFAULTS \
18880 + { "meb", "mabi=32" }
18881 +
18882 +/* The various C libraries each have their own subdirectory. */
18883 +#undef SYSROOT_SUFFIX_SPEC
18884 +#define SYSROOT_SUFFIX_SPEC \
18885 + "%{mel:%{msoft-float:/mel/soft-float ; \
18886 + :/mel} ; \
18887 + msoft-float:/soft-float}"
18888 +
18889 +/* MULTILIB_OSDIRNAMES provides directory names used in two ways:
18890 + relative to $target/lib/ in the GCC installation, and relative to
18891 + lib/ and usr/lib/ in a sysroot. For the latter, we want names such
18892 + as plain ../lib64, but these cannot be used outside the sysroot
18893 + because different multilibs would be mapped to the same directory.
18894 + Directories are searched both with and without the multilib suffix,
18895 + so it suffices if the directory without the suffix is correct
18896 + within the sysroot while the directory with the suffix doesn't
18897 + exist. We use STARTFILE_PREFIX_SPEC to achieve the desired
18898 + effect. */
18899 +#undef STARTFILE_PREFIX_SPEC
18900 +#define STARTFILE_PREFIX_SPEC \
18901 + "%{mabi=32: /usr/local/lib/ /lib/ /usr/lib/} \
18902 + %{mabi=n32: /usr/local/lib32/ /lib32/ /usr/lib32/} \
18903 + %{mabi=64: /usr/local/lib64/ /lib64/ /usr/lib64/}"
18904 diff -Nur a/gcc/config/mips/octeon-elf.h b/gcc/config/mips/octeon-elf.h
18905 --- a/gcc/config/mips/octeon-elf.h 1970-01-01 01:00:00.000000000 +0100
18906 +++ b/gcc/config/mips/octeon-elf.h 2010-01-25 09:50:29.035686224 +0100
18907 @@ -0,0 +1,98 @@
18908 +/* Macros for mips*-octeon-elf target.
18909 + Copyright (C) 2004, 2005, 2006 Cavium Networks.
18910 +
18911 +This file is part of GCC.
18912 +
18913 +GCC is free software; you can redistribute it and/or modify
18914 +it under the terms of the GNU General Public License as published by
18915 +the Free Software Foundation; either version 2, or (at your option)
18916 +any later version.
18917 +
18918 +GCC is distributed in the hope that it will be useful,
18919 +but WITHOUT ANY WARRANTY; without even the implied warranty of
18920 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18921 +GNU General Public License for more details.
18922 +
18923 +You should have received a copy of the GNU General Public License
18924 +along with GCC; see the file COPYING. If not, write to
18925 +the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18926 +Boston, MA 02110-1301, USA. */
18927 +
18928 +/* Add MASK_SOFT_FLOAT and MASK_OCTEON_UNALIGNED. */
18929 +
18930 +#undef TARGET_DEFAULT
18931 +#define TARGET_DEFAULT (MASK_SOFT_FLOAT_ABI | MASK_OCTEON_UNALIGNED)
18932 +
18933 +/* Forward -m*octeon-useun. */
18934 +
18935 +#undef SUBTARGET_ASM_SPEC
18936 +#define SUBTARGET_ASM_SPEC "%{mno-octeon-useun} %{!mno-octeon-useun:-mocteon-useun}"
18937 +
18938 +/* Enable backtrace including on machine exceptions by default. */
18939 +
18940 +#undef SUBTARGET_CC1_SPEC
18941 +#define SUBTARGET_CC1_SPEC "%{!fno-asynchronous-unwind-tables:-fasynchronous-unwind-tables}"
18942 +
18943 +/* Without ASM_PREFERRED_EH_DATA_FORMAT, output_call_frame_info emits
18944 + pointer-sized addresses for FDE addresses. For 64-bit targets, it does
18945 + it without properly "switching over" to 64-bit as described in the DWARF3
18946 + spec. GDB can fall back on .eh_frames and misinterpret FDE addresses.
18947 + Instead let's be explicit and use augmentation to describe the encoding if
18948 + pointer size is 64. */
18949 +
18950 +#undef ASM_PREFERRED_EH_DATA_FORMAT
18951 +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
18952 + ((CODE) == 1 && POINTER_SIZE == 64 \
18953 + ? (ABI_HAS_64BIT_SYMBOLS ? DW_EH_PE_udata8 : DW_EH_PE_udata4) \
18954 + : DW_EH_PE_absptr)
18955 +
18956 +/* Link to libc library. */
18957 +
18958 +#undef LIB_SPEC
18959 +#define LIB_SPEC "-lc"
18960 +
18961 +/* Link to startup file. */
18962 +
18963 +#undef STARTFILE_SPEC
18964 +#define STARTFILE_SPEC "crti%O%s crtbegin%O%s crt0%O%s"
18965 +
18966 +/* Default our test-only n64 configuration to -G0 since that is what
18967 + the kernel uses. */
18968 +
18969 +#undef SUBTARGET_SELF_SPECS
18970 +#define SUBTARGET_SELF_SPECS \
18971 +"%{mabi=64:%{!G*: -G0}}"
18972 +
18973 +/* Pass linker emulation mode for N32. */
18974 +
18975 +#undef LINK_SPEC
18976 +#define LINK_SPEC "\
18977 +%(endian_spec) \
18978 +%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
18979 +%{mips64r2} %{bestGnum} %{shared} %{non_shared} \
18980 +%{mabi=n32:-melf32e%{!EL:b}%{EL:l}octeonn32} \
18981 +%{mabi=64:-melf64e%{!EL:b}%{EL:l}octeon}"
18982 +
18983 +/* Override because of N32. */
18984 +
18985 +#undef LOCAL_LABEL_PREFIX
18986 +#define LOCAL_LABEL_PREFIX ((mips_abi == ABI_N32) ? "." : "$")
18987 +
18988 +/* Append the core number to the GCOV filename FN. */
18989 +
18990 +#define GCOV_TARGET_SUFFIX_LENGTH 2
18991 +#define ADD_GCOV_TARGET_SUFFIX(FN) \
18992 +do \
18993 + { \
18994 + char *fn = FN; \
18995 + int core; \
18996 + char s[3]; \
18997 + \
18998 + asm ("rdhwr %0, $0" : "=r"(core)); \
18999 + sprintf (s, "%d", core); \
19000 + strcat (fn, s); \
19001 + } \
19002 +while (0)
19003 +
19004 +/* Code to unwind through the exception frame. */
19005 +#define MD_UNWIND_SUPPORT "config/mips/octeon-elf-unwind.h"
19006 diff -Nur a/gcc/config/mips/octeon-elf-unwind.h b/gcc/config/mips/octeon-elf-unwind.h
19007 --- a/gcc/config/mips/octeon-elf-unwind.h 1970-01-01 01:00:00.000000000 +0100
19008 +++ b/gcc/config/mips/octeon-elf-unwind.h 2010-01-25 09:50:29.035686224 +0100
19009 @@ -0,0 +1,57 @@
19010 +/* Stack unwinding support through the first exception frame.
19011 + Copyright (C) 2007 Cavium Networks.
19012 +
19013 +This file is part of GCC.
19014 +
19015 +GCC is free software; you can redistribute it and/or modify
19016 +it under the terms of the GNU General Public License as published by
19017 +the Free Software Foundation; either version 2, or (at your option)
19018 +any later version.
19019 +
19020 +GCC is distributed in the hope that it will be useful,
19021 +but WITHOUT ANY WARRANTY; without even the implied warranty of
19022 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19023 +GNU General Public License for more details.
19024 +
19025 +You should have received a copy of the GNU General Public License
19026 +along with GCC; see the file COPYING. If not, write to
19027 +the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19028 +Boston, MA 02110-1301, USA. */
19029 +
19030 +#define MD_FALLBACK_FRAME_STATE_FOR octeon_elf_fallback_frame_state
19031 +
19032 +/* Check whether this is the cvmx_interrupt_stage2 frame. If the
19033 + function call was dispatched via k0 assume we are in
19034 + cvmx_interrupt_stage2. In this case the sp in point to the saved
19035 + register array. */
19036 +
19037 +static _Unwind_Reason_Code
19038 +octeon_elf_fallback_frame_state (struct _Unwind_Context *context,
19039 + _Unwind_FrameState *fs)
19040 +{
19041 + unsigned i;
19042 + unsigned *pc = context->ra;
19043 +
19044 + /* Look for "jalr k0". */
19045 + if (pc[-2] != 0x0340f809)
19046 + return _URC_END_OF_STACK;
19047 +
19048 + for (i = 0; i < 32; i++)
19049 + {
19050 + fs->regs.reg[i].how = REG_SAVED_OFFSET;
19051 + fs->regs.reg[i].loc.offset = 8 * i;
19052 + }
19053 +
19054 + /* Keep the next frame's sp. This way we have a CFA that points
19055 + exactly to the register array. */
19056 + fs->regs.cfa_how = CFA_REG_OFFSET;
19057 + fs->regs.cfa_reg = STACK_POINTER_REGNUM;
19058 + fs->regs.cfa_offset = 0;
19059 +
19060 + /* DEPC is saved as the 35. register. */
19061 + fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_OFFSET;
19062 + fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset = 8 * 35;
19063 + fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
19064 +
19065 + return _URC_NO_REASON;
19066 +}
19067 diff -Nur a/gcc/config/mips/octeon.h b/gcc/config/mips/octeon.h
19068 --- a/gcc/config/mips/octeon.h 1970-01-01 01:00:00.000000000 +0100
19069 +++ b/gcc/config/mips/octeon.h 2010-01-25 09:50:29.035686224 +0100
19070 @@ -0,0 +1,68 @@
19071 +/* Macros for mips*-octeon-* target.
19072 + Copyright (C) 2004, 2005, 2006 Cavium Networks.
19073 +
19074 +This file is part of GCC.
19075 +
19076 +GCC is free software; you can redistribute it and/or modify
19077 +it under the terms of the GNU General Public License as published by
19078 +the Free Software Foundation; either version 2, or (at your option)
19079 +any later version.
19080 +
19081 +GCC is distributed in the hope that it will be useful,
19082 +but WITHOUT ANY WARRANTY; without even the implied warranty of
19083 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19084 +GNU General Public License for more details.
19085 +
19086 +You should have received a copy of the GNU General Public License
19087 +along with GCC; see the file COPYING. If not, write to
19088 +the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19089 +Boston, MA 02110-1301, USA. */
19090 +
19091 +#define CVMX_SHARED_BSS_FLAGS (SECTION_WRITE | SECTION_BSS)
19092 +
19093 +#undef TARGET_ASM_SELECT_SECTION
19094 +#define TARGET_ASM_SELECT_SECTION octeon_select_section
19095 +
19096 +#undef TARGET_ASM_UNIQUE_SECTION
19097 +#define TARGET_ASM_UNIQUE_SECTION octeon_unique_section
19098 +
19099 +/* Implement ASM_OUTPUT_ALIGNED_DECL_LOCAL. This differs from the
19100 + generic version only in the use of cvmx_shared attribute. */
19101 +
19102 +#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
19103 +#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
19104 + do \
19105 + { \
19106 + if ((DECL) && TREE_CODE ((DECL)) == VAR_DECL \
19107 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (DECL))) \
19108 + { \
19109 + fprintf ((STREAM), "%s", LOCAL_ASM_OP); \
19110 + assemble_name ((STREAM), (NAME)); \
19111 + fprintf ((STREAM), "\n"); \
19112 + octeon_output_shared_variable ((STREAM), (DECL), (NAME), \
19113 + (SIZE), (ALIGN)); \
19114 + } \
19115 + else \
19116 + ASM_OUTPUT_ALIGNED_LOCAL (STREAM, NAME, SIZE, ALIGN); \
19117 + } \
19118 + while (0)
19119 +
19120 +\f
19121 +/* Implement ASM_OUTPUT_ALIGNED_DECL_COMMON. This differs from the mips
19122 + version only in the use of cvmx_shared attribute. */
19123 +
19124 +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
19125 +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
19126 + { \
19127 + if (TREE_CODE ((DECL)) == VAR_DECL \
19128 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES ((DECL)))) \
19129 + { \
19130 + if (TREE_PUBLIC ((DECL)) && DECL_NAME ((DECL))) \
19131 + targetm.asm_out.globalize_label (asm_out_file, (NAME)); \
19132 + octeon_output_shared_variable ((STREAM), (DECL), (NAME), \
19133 + (SIZE), (ALIGN)); \
19134 + } \
19135 + else \
19136 + mips_output_aligned_decl_common ((STREAM), (DECL), (NAME), (SIZE), \
19137 + (ALIGN)); \
19138 + }
19139 diff -Nur a/gcc/config/mips/predicates.md b/gcc/config/mips/predicates.md
19140 --- a/gcc/config/mips/predicates.md 2009-02-20 16:20:38.000000000 +0100
19141 +++ b/gcc/config/mips/predicates.md 2010-01-25 09:50:29.035686224 +0100
19142 @@ -211,6 +211,20 @@
19143 }
19144 })
19145
19146 +(define_predicate "mask_low_and_shift_operator"
19147 + (and (match_code "and")
19148 + (match_test "GET_CODE (XEXP (op, 0)) == ASHIFT
19149 + && GET_CODE (XEXP (op, 1)) == CONST_INT
19150 + && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT"))
19151 +{
19152 + int len;
19153 +
19154 + len = mask_low_and_shift_len (GET_MODE (op),
19155 + INTVAL (XEXP (XEXP (op, 0), 1)),
19156 + INTVAL (XEXP (op, 1)));
19157 + return 0 < len && len <= 32;
19158 +})
19159 +
19160 (define_predicate "consttable_operand"
19161 (match_test "CONSTANT_P (op)"))
19162
19163 diff -Nur a/gcc/config/mips/sde.h b/gcc/config/mips/sde.h
19164 --- a/gcc/config/mips/sde.h 2009-02-20 16:20:38.000000000 +0100
19165 +++ b/gcc/config/mips/sde.h 2010-01-25 09:50:29.035686224 +0100
19166 @@ -19,6 +19,9 @@
19167 along with GCC; see the file COPYING3. If not see
19168 <http://www.gnu.org/licenses/>. */
19169
19170 +#undef TARGET_MIPS_SDE
19171 +#define TARGET_MIPS_SDE 1
19172 +
19173 #undef DRIVER_SELF_SPECS
19174 #define DRIVER_SELF_SPECS \
19175 /* Make sure a -mips option is present. This helps us to pick \
19176 @@ -90,7 +93,8 @@
19177
19178 /* Use $5 as a temporary for both MIPS16 and non-MIPS16. */
19179 #undef MIPS_EPILOGUE_TEMP_REGNUM
19180 -#define MIPS_EPILOGUE_TEMP_REGNUM (GP_REG_FIRST + 5)
19181 +#define MIPS_EPILOGUE_TEMP_REGNUM \
19182 + (cfun->machine->interrupt_handler_p ? K0_REG_NUM : GP_REG_FIRST + 5)
19183
19184 /* Using long will always be right for size_t and ptrdiff_t, since
19185 sizeof(long) must equal sizeof(void *), following from the setting
19186 diff -Nur a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h
19187 --- a/gcc/config/mips/sdemtk.h 2009-02-20 16:20:38.000000000 +0100
19188 +++ b/gcc/config/mips/sdemtk.h 2010-01-25 09:50:29.035686224 +0100
19189 @@ -19,6 +19,8 @@
19190 along with GCC; see the file COPYING3. If not see
19191 <http://www.gnu.org/licenses/>. */
19192
19193 +#define TARGET_MIPS_SDEMTK 1
19194 +
19195 #define TARGET_OS_CPP_BUILTINS() \
19196 do \
19197 { \
19198 @@ -113,3 +115,12 @@
19199 /* ...nor does the call sequence preserve $31. */
19200 #undef MIPS_SAVE_REG_FOR_PROFILING_P
19201 #define MIPS_SAVE_REG_FOR_PROFILING_P(REGNO) ((REGNO) == GP_REG_FIRST + 31)
19202 +
19203 +/* From mips.h, with mno-float option added. */
19204 +
19205 +#undef MIPS_ARCH_FLOAT_SPEC
19206 +#define MIPS_ARCH_FLOAT_SPEC \
19207 + "%{mhard-float|msoft-float|mno-float|march=mips*:; \
19208 + march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
19209 + |march=34kc|march=74kc|march=1004kc|march=5kc|march=octeon|march=xlr: -msoft-float; \
19210 + march=*: -mhard-float}"
19211 diff -Nur a/gcc/config/mips/t-crtfm b/gcc/config/mips/t-crtfm
19212 --- a/gcc/config/mips/t-crtfm 1970-01-01 01:00:00.000000000 +0100
19213 +++ b/gcc/config/mips/t-crtfm 2010-01-25 09:50:29.035686224 +0100
19214 @@ -0,0 +1,9 @@
19215 +
19216 +EXTRA_MULTILIB_PARTS += crtfastmath.o
19217 +
19218 +EXTRA_PARTS += crtfastmath.o
19219 +
19220 +$(T)crtfastmath.o: $(srcdir)/config/mips/crtfastmath.c $(GCC_PASSES)
19221 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
19222 + -c -o $(T)crtfastmath.o $(srcdir)/config/mips/crtfastmath.c
19223 +
19224 diff -Nur a/gcc/config/mips/t-montavista-elf b/gcc/config/mips/t-montavista-elf
19225 --- a/gcc/config/mips/t-montavista-elf 1970-01-01 01:00:00.000000000 +0100
19226 +++ b/gcc/config/mips/t-montavista-elf 2010-01-25 09:50:29.035686224 +0100
19227 @@ -0,0 +1,22 @@
19228 +# MontaVista ELF Configuration.
19229 +# Copyright (C) 2009
19230 +# Free Software Foundation, Inc.
19231 +#
19232 +# This file is part of GCC.
19233 +#
19234 +# GCC is free software; you can redistribute it and/or modify
19235 +# it under the terms of the GNU General Public License as published by
19236 +# the Free Software Foundation; either version 3, or (at your option)
19237 +# any later version.
19238 +#
19239 +# GCC is distributed in the hope that it will be useful,
19240 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
19241 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19242 +# GNU General Public License for more details.
19243 +#
19244 +# You should have received a copy of the GNU General Public License
19245 +# along with GCC; see the file COPYING3. If not see
19246 +# <http://www.gnu.org/licenses/>.
19247 +
19248 +MULTILIB_OPTIONS =
19249 +MULTILIB_DIRNAMES =
19250 diff -Nur a/gcc/config/mips/t-montavista-linux b/gcc/config/mips/t-montavista-linux
19251 --- a/gcc/config/mips/t-montavista-linux 1970-01-01 01:00:00.000000000 +0100
19252 +++ b/gcc/config/mips/t-montavista-linux 2010-01-25 09:50:29.035686224 +0100
19253 @@ -0,0 +1,43 @@
19254 +# MontaVista GNU/Linux Configuration.
19255 +# Copyright (C) 2009
19256 +# Free Software Foundation, Inc.
19257 +#
19258 +# This file is part of GCC.
19259 +#
19260 +# GCC is free software; you can redistribute it and/or modify
19261 +# it under the terms of the GNU General Public License as published by
19262 +# the Free Software Foundation; either version 3, or (at your option)
19263 +# any later version.
19264 +#
19265 +# GCC is distributed in the hope that it will be useful,
19266 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
19267 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19268 +# GNU General Public License for more details.
19269 +#
19270 +# You should have received a copy of the GNU General Public License
19271 +# along with GCC; see the file COPYING3. If not see
19272 +# <http://www.gnu.org/licenses/>.
19273 +
19274 +# Build big-endian and little-endian support libraries.
19275 +MULTILIB_OPTIONS = mel msoft-float march=octeon mabi=n32/mabi=64
19276 +MULTILIB_DIRNAMES = mel soft-float octeon n32 64
19277 +MULTILIB_EXCEPTIONS = *mel*/*mabi=n32* *mel*/*mabi=64*
19278 +MULTILIB_EXCEPTIONS += *mel*/*march=octeon* march=octeon march=octeon/mabi=n32
19279 +MULTILIB_EXCEPTIONS += march=octeon/mabi=64 msoft-float/march=octeon
19280 +
19281 +# These files must be built for each multilib.
19282 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
19283 +
19284 +# See comment in montavista-linux.h on STARTFILE_PREFIX_SPEC for how the real
19285 +# directories used in the sysroots are determined. These directories
19286 +# are specified so that (a) they are distinct and (b) removing the
19287 +# components that form part of the sysroot suffix leaves the real
19288 +# directory within the sysroot.
19289 +MULTILIB_OSDIRNAMES = msoft-float/mabi.n32=../lib32/soft-float
19290 +MULTILIB_OSDIRNAMES += msoft-float/mabi.64=../lib64/soft-float
19291 +MULTILIB_OSDIRNAMES += msoft-float/march.octeon/mabi.n32=../lib32/soft-float/octeon
19292 +MULTILIB_OSDIRNAMES += msoft-float/march.octeon/mabi.64=../lib64/soft-float/octeon
19293 +MULTILIB_OSDIRNAMES += mel/msoft-float=!mel/soft-float
19294 +MULTILIB_OSDIRNAMES += msoft-float=!soft-float
19295 +MULTILIB_OSDIRNAMES += mabi.64=../lib64
19296 +MULTILIB_OSDIRNAMES += mabi.n32=../lib32
19297 diff -Nur a/gcc/config/mips/t-octeon-elf b/gcc/config/mips/t-octeon-elf
19298 --- a/gcc/config/mips/t-octeon-elf 1970-01-01 01:00:00.000000000 +0100
19299 +++ b/gcc/config/mips/t-octeon-elf 2010-01-25 09:50:29.035686224 +0100
19300 @@ -0,0 +1,41 @@
19301 +# Don't let CTOR_LIST end up in sdata section.
19302 +
19303 +CRTSTUFF_T_CFLAGS = -G 0 -fno-asynchronous-unwind-tables
19304 +
19305 +# Assemble startup files.
19306 +
19307 +$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
19308 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
19309 + -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
19310 +
19311 +$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
19312 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
19313 + -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
19314 +
19315 +# N32 uses TFmode for long double.
19316 +
19317 +TPBIT = tp-bit.c
19318 +
19319 +tp-bit.c: $(srcdir)/config/fp-bit.c
19320 + echo '#ifdef __MIPSEL__' > tp-bit.c
19321 + echo '# define FLOAT_BIT_ORDER_MISMATCH' >> tp-bit.c
19322 + echo '#endif' >> tp-bit.c
19323 + echo '#if __LDBL_MANT_DIG__ == 113' >> tp-bit.c
19324 + echo '#define QUIET_NAN_NEGATED' >> tp-bit.c
19325 + echo '# define TFLOAT' >> tp-bit.c
19326 + cat $(srcdir)/config/fp-bit.c >> tp-bit.c
19327 + echo '#endif' >> tp-bit.c
19328 +
19329 +# We must build libgcc2.a with -G 0, in case the user wants to link
19330 +# without the $gp register.
19331 +
19332 +TARGET_LIBGCC2_CFLAGS = -G 0
19333 +
19334 +# Build both ABIs.
19335 +
19336 +MULTILIB_OPTIONS = mabi=n32/mabi=eabi/mabi=64
19337 +MULTILIB_DIRNAMES = n32 eabi n64
19338 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o
19339 +
19340 +LIBGCC = stmp-multilib
19341 +INSTALL_LIBGCC = install-multilib
19342 diff -Nur a/gcc/config/mips/t-sgxx-linux b/gcc/config/mips/t-sgxx-linux
19343 --- a/gcc/config/mips/t-sgxx-linux 1970-01-01 01:00:00.000000000 +0100
19344 +++ b/gcc/config/mips/t-sgxx-linux 2010-01-25 09:50:29.035686224 +0100
19345 @@ -0,0 +1,13 @@
19346 +MULTILIB_OPTIONS = muclibc march=mips2/march=mips32 msoft-float EL/EB
19347 +MULTILIB_DIRNAMES = uclibc mips2 mips32 soft-float el eb
19348 +MULTILIB_MATCHES := EL=mel EB=meb \
19349 + march?mips2=mips2 march?mips2=mips3 march?mips2=mips4 \
19350 + $(foreach cpu,mips3 mips4 r6000 r4000 vr4100 vr4111 vr4120 vr4130 vr4300 \
19351 + r4400 r4600 orion r4650 loongson2e loongson2f r8000 r10000 \
19352 + r12000 r14000 r16000 vr5000 vr5400 vr5500 rm7000 \
19353 + rm9000,march?mips2=march?$(cpu)) \
19354 + march?mips32=mips32 march?mips32=mips64 \
19355 + $(foreach cpu,4kc 4km 4kp 4ksc mips64 5kc 5kf 20kc sb1 sb1a sr71000 \
19356 + xlr,march?mips32=march?$(cpu))
19357 +MULTILIB_EXCEPTIONS = *muclibc*/*march?mips2* *muclibc*/*march?mips32*
19358 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
19359 diff -Nur a/gcc/config/mips/t-sgxxlite-linux b/gcc/config/mips/t-sgxxlite-linux
19360 --- a/gcc/config/mips/t-sgxxlite-linux 1970-01-01 01:00:00.000000000 +0100
19361 +++ b/gcc/config/mips/t-sgxxlite-linux 2010-01-25 09:50:29.035686224 +0100
19362 @@ -0,0 +1,5 @@
19363 +MULTILIB_OPTIONS = muclibc msoft-float EL/EB
19364 +MULTILIB_DIRNAMES = uclibc soft-float el eb
19365 +MULTILIB_MATCHES := EL=mel EB=meb
19366 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
19367 +
19368 diff -Nur a/gcc/config/mips/t-sgxx-sde b/gcc/config/mips/t-sgxx-sde
19369 --- a/gcc/config/mips/t-sgxx-sde 1970-01-01 01:00:00.000000000 +0100
19370 +++ b/gcc/config/mips/t-sgxx-sde 2010-01-25 09:50:29.035686224 +0100
19371 @@ -0,0 +1,15 @@
19372 +# SourceryG++ overrides for SDE builds
19373 +
19374 +# We must build libgcc2.a with -G 0, in case the user wants to link
19375 +# without the $gp register. Use -fno-optimize-sibling-calls in case
19376 +# we have a mixed mips16/non-mips16 environment where a plain "jump"
19377 +# instuction won't work across the divide (no jx instruction).
19378 +# Compile libraries with -mcode-xonly, so that they are link-compatible
19379 +# with both -mcode-readable=pcrel and -mcode-readable=yes.
19380 +TARGET_LIBGCC2_CFLAGS = -G 0 -fno-optimize-sibling-calls -mcode-xonly
19381 +
19382 +MULTILIB_OPTIONS = EL/EB mips16 mfp64/msoft-float/mno-float mcode-readable=no
19383 +MULTILIB_DIRNAMES = el eb mips16 fp64 sof nof spram
19384 +MULTILIB_MATCHES = EL=mel EB=meb mips16=mips16e
19385 +MULTILIB_EXCLUSIONS = mcode-readable=no/!mips16
19386 +MULTILIB_EXCEPTIONS =
19387 diff -Nur a/gcc/config/mips/t-wrs-linux b/gcc/config/mips/t-wrs-linux
19388 --- a/gcc/config/mips/t-wrs-linux 1970-01-01 01:00:00.000000000 +0100
19389 +++ b/gcc/config/mips/t-wrs-linux 2010-01-25 09:50:29.035686224 +0100
19390 @@ -0,0 +1,55 @@
19391 +# Wind River GNU/Linux Configuration.
19392 +# Copyright (C) 2006, 2007
19393 +# Free Software Foundation, Inc.
19394 +#
19395 +# This file is part of GCC.
19396 +#
19397 +# GCC is free software; you can redistribute it and/or modify
19398 +# it under the terms of the GNU General Public License as published by
19399 +# the Free Software Foundation; either version 3, or (at your option)
19400 +# any later version.
19401 +#
19402 +# GCC is distributed in the hope that it will be useful,
19403 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
19404 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19405 +# GNU General Public License for more details.
19406 +#
19407 +# You should have received a copy of the GNU General Public License
19408 +# along with GCC; see the file COPYING3. If not see
19409 +# <http://www.gnu.org/licenses/>.
19410 +
19411 +# Build big-endian and little-endian support libraries.
19412 +MULTILIB_OPTIONS = muclibc mel mhard-float march=octeon/march=vr5500 mabi=n32/mabi=64
19413 +MULTILIB_DIRNAMES = uclibc mel hard-float octeon vr5500 n32 64
19414 +MULTILIB_EXCEPTIONS = *muclibc*/*mhard-float*
19415 +MULTILIB_EXCEPTIONS += *muclibc*/*mabi=n32*
19416 +MULTILIB_EXCEPTIONS += *muclibc*/*mabi=64*
19417 +MULTILIB_EXCEPTIONS += *muclibc*/*march=vr5500*
19418 +MULTILIB_EXCEPTIONS += *mel*/*march=vr5500*
19419 +MULTILIB_EXCEPTIONS += march=vr5500*
19420 +MULTILIB_EXCEPTIONS += mhard-float/march=vr5500/*
19421 +MULTILIB_EXCEPTIONS += */march=octeon*
19422 +MULTILIB_EXCEPTIONS += march=octeon march=octeon/mabi=32
19423 +MULTILIB_EXCEPTIONS += mel/mabi=n32 mel/mabi=64
19424 +MULTILIB_EXCEPTIONS += mabi=n32
19425 +# These files must be built for each multilib.
19426 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
19427 +
19428 +# See comment in wrs-linux.h on STARTFILE_PREFIX_SPEC for how the real
19429 +# directories used in the sysroots are determined. These directories
19430 +# are specified so that (a) they are distinct and (b) removing the
19431 +# components that form part of the sysroot suffix leaves the real
19432 +# directory within the sysroot.
19433 +MULTILIB_OSDIRNAMES = mel/mhard-float/mabi.n32=../lib32/mel/hard-float
19434 +MULTILIB_OSDIRNAMES += mel/mhard-float/mabi.64=../lib64/mel/hard-float
19435 +MULTILIB_OSDIRNAMES += mhard-float/mabi.n32=../lib32/hard-float
19436 +MULTILIB_OSDIRNAMES += mhard-float/mabi.64=../lib64/hard-float
19437 +MULTILIB_OSDIRNAMES += mel/mhard-float=!mel/hard-float
19438 +MULTILIB_OSDIRNAMES += mhard-float/march.vr5500=!hard-float/vr5500
19439 +MULTILIB_OSDIRNAMES += mhard-float=!hard-float
19440 +MULTILIB_OSDIRNAMES += mabi.64=../lib64
19441 +MULTILIB_OSDIRNAMES += march.octeon/mabi.n32=../lib32/octeon
19442 +MULTILIB_OSDIRNAMES += march.octeon/mabi.64=../lib64/octeon
19443 +MULTILIB_OSDIRNAMES += muclibc/mel=!uclibc/mel
19444 +MULTILIB_OSDIRNAMES += muclibc=!uclibc
19445 +
19446 diff -Nur a/gcc/config/mips/wrs-linux.h b/gcc/config/mips/wrs-linux.h
19447 --- a/gcc/config/mips/wrs-linux.h 1970-01-01 01:00:00.000000000 +0100
19448 +++ b/gcc/config/mips/wrs-linux.h 2010-01-25 09:50:29.035686224 +0100
19449 @@ -0,0 +1,65 @@
19450 +/* Wind River GNU/Linux Configuration.
19451 + Copyright (C) 2006, 2007
19452 + Free Software Foundation, Inc.
19453 +
19454 +This file is part of GCC.
19455 +
19456 +GCC is free software; you can redistribute it and/or modify
19457 +it under the terms of the GNU General Public License as published by
19458 +the Free Software Foundation; either version 3, or (at your option)
19459 +any later version.
19460 +
19461 +GCC is distributed in the hope that it will be useful,
19462 +but WITHOUT ANY WARRANTY; without even the implied warranty of
19463 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19464 +GNU General Public License for more details.
19465 +
19466 +You should have received a copy of the GNU General Public License
19467 +along with GCC; see the file COPYING3. If not see
19468 +<http://www.gnu.org/licenses/>. */
19469 +
19470 +/* Override linux64.h to default to O32. */
19471 +#undef DRIVER_SELF_SPECS
19472 +#define DRIVER_SELF_SPECS \
19473 + BASE_DRIVER_SELF_SPECS, \
19474 + LINUX_DRIVER_SELF_SPECS \
19475 + " %{!EB:%{!EL:%(endian_spec)}}" \
19476 + " %{!mabi=*: -mabi=32}"
19477 +
19478 +/* We do not need to provide an explicit big-endian multilib. */
19479 +#undef MULTILIB_DEFAULTS
19480 +#define MULTILIB_DEFAULTS \
19481 + { "meb", "mabi=32" }
19482 +
19483 +/* The GLIBC headers are in /usr/include, relative to the sysroot; the
19484 + uClibc headers are in /uclibc/usr/include. */
19485 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
19486 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
19487 + "%{muclibc:/uclibc}"
19488 +
19489 +/* The various C libraries each have their own subdirectory. */
19490 +#undef SYSROOT_SUFFIX_SPEC
19491 +#define SYSROOT_SUFFIX_SPEC \
19492 + "%{muclibc:%{mel:/uclibc/mel ; \
19493 + :/uclibc} ; \
19494 + mel:%{mhard-float:/mel/hard-float ; \
19495 + :/mel} ; \
19496 + march=octeon:/octeon ; \
19497 + march=vr5500:%{mhard-float:/hard-float/vr5500} ; \
19498 + mhard-float:/hard-float}"
19499 +
19500 +/* MULTILIB_OSDIRNAMES provides directory names used in two ways:
19501 + relative to $target/lib/ in the GCC installation, and relative to
19502 + lib/ and usr/lib/ in a sysroot. For the latter, we want names such
19503 + as plain ../lib64, but these cannot be used outside the sysroot
19504 + because different multilibs would be mapped to the same directory.
19505 + Directories are searched both with and without the multilib suffix,
19506 + so it suffices if the directory without the suffix is correct
19507 + within the sysroot while the directory with the suffix doesn't
19508 + exist. We use STARTFILE_PREFIX_SPEC to achieve the desired
19509 + effect. */
19510 +#undef STARTFILE_PREFIX_SPEC
19511 +#define STARTFILE_PREFIX_SPEC \
19512 + "%{mabi=32: /usr/local/lib/ /lib/ /usr/lib/} \
19513 + %{mabi=n32: /usr/local/lib32/ /lib32/ /usr/lib32/} \
19514 + %{mabi=64: /usr/local/lib64/ /lib64/ /usr/lib64/}"
19515 diff -Nur a/gcc/config/mips/xlr.md b/gcc/config/mips/xlr.md
19516 --- a/gcc/config/mips/xlr.md 2008-06-06 16:24:57.000000000 +0200
19517 +++ b/gcc/config/mips/xlr.md 2010-01-25 09:50:29.035686224 +0100
19518 @@ -1,5 +1,5 @@
19519 ;; DFA-based pipeline description for the XLR.
19520 -;; Copyright (C) 2008 Free Software Foundation, Inc.
19521 +;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
19522 ;;
19523 ;; xlr.md Machine Description for the RMI XLR Microprocessor
19524 ;; This file is part of GCC.
19525 @@ -31,7 +31,7 @@
19526 ;; Integer arithmetic instructions.
19527 (define_insn_reservation "ir_xlr_alu" 1
19528 (and (eq_attr "cpu" "xlr")
19529 - (eq_attr "type" "arith,shift,clz,const,unknown,multi,nop,trap"))
19530 + (eq_attr "type" "move,arith,shift,clz,logical,signext,const,unknown,multi,nop,trap"))
19531 "xlr_main_pipe")
19532
19533 ;; Integer arithmetic instructions.
19534 diff -Nur a/gcc/config/print-sysroot-suffix.sh b/gcc/config/print-sysroot-suffix.sh
19535 --- a/gcc/config/print-sysroot-suffix.sh 1970-01-01 01:00:00.000000000 +0100
19536 +++ b/gcc/config/print-sysroot-suffix.sh 2010-01-25 09:50:29.035686224 +0100
19537 @@ -0,0 +1,154 @@
19538 +#! /bin/sh
19539 +# Script to generate SYSROOT_SUFFIX_SPEC equivalent to MULTILIB_OSDIRNAMES
19540 +# Arguments are MULTILIB_OSDIRNAMES, MULTILIB_OPTIONS, MULTILIB_MATCHES
19541 +# and MULTILIB_ALIASES.
19542 +
19543 +# Copyright (C) 2009 Free Software Foundation, Inc.
19544 +
19545 +# This file is part of GCC.
19546 +
19547 +# GCC is free software; you can redistribute it and/or modify it under
19548 +# the terms of the GNU General Public License as published by the Free
19549 +# Software Foundation; either version 3, or (at your option) any later
19550 +# version.
19551 +
19552 +# GCC is distributed in the hope that it will be useful, but WITHOUT
19553 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19554 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19555 +# for more details.
19556 +
19557 +# You should have received a copy of the GNU General Public License
19558 +# along with GCC; see the file COPYING3. If not see
19559 +# <http://www.gnu.org/licenses/>.
19560 +
19561 +# This shell script produces a header file fragment that defines
19562 +# SYSROOT_SUFFIX_SPEC. It assumes that the sysroots will have the same
19563 +# structure and names used by the multilibs.
19564 +
19565 +# Invocation:
19566 +# print-sysroot-suffix.sh \
19567 +# MULTILIB_OSDIRNAMES \
19568 +# MULTILIB_OPTIONS \
19569 +# MULTILIB_MATCHES \
19570 +# > t-sysroot-suffix.h
19571 +
19572 +# The three options exactly correspond to the variables of the same
19573 +# names defined in the tmake_file fragments.
19574 +
19575 +# Example:
19576 +# sh ./gcc/config/print-sysroot-suffix.sh "a=A" "a b/c/d" ""
19577 +# =>
19578 +# #undef SYSROOT_SUFFIX_SPEC
19579 +# #define SYSROOT_SUFFIX_SPEC "" \
19580 +# "%{a:" \
19581 +# "%{b:A/b/;" \
19582 +# "c:A/c/;" \
19583 +# "d:A/d/;" \
19584 +# ":A/};" \
19585 +# ":}"
19586 +
19587 +# The script uses temporary subscripts in order to permit a recursive
19588 +# algorithm without the use of functions.
19589 +
19590 +set -e
19591 +
19592 +dirnames="$1"
19593 +options="$2"
19594 +matches="$3"
19595 +aliases="$4"
19596 +
19597 +cat > print-sysroot-suffix3.sh <<\EOF
19598 +#! /bin/sh
19599 +# Print all the multilib matches for this option
19600 +result="$1"
19601 +EOF
19602 +for x in $matches; do
19603 + l=`echo $x | sed -e 's/=.*$//' -e 's/?/=/g'`
19604 + r=`echo $x | sed -e 's/^.*=//' -e 's/?/=/g'`
19605 + echo "[ \"\$1\" = \"$l\" ] && result=\"\$result|$r\"" >> print-sysroot-suffix3.sh
19606 +done
19607 +echo 'echo $result' >> print-sysroot-suffix3.sh
19608 +chmod +x print-sysroot-suffix3.sh
19609 +
19610 +cat > print-sysroot-suffix2.sh <<\EOF
19611 +#! /bin/sh
19612 +# Recursive script to enumerate all multilib combinations, match against
19613 +# multilib directories and output a spec string of the result.
19614 +# Will fold identical trees.
19615 +
19616 +padding="$1"
19617 +optstring="$2"
19618 +shift 2
19619 +n="\" \\
19620 +$padding\""
19621 +if [ $# = 0 ]; then
19622 + case $optstring in
19623 +EOF
19624 +for x in $aliases; do
19625 + l=`echo $x | sed -e 's/=.*$//' -e 's/?/=/g'`
19626 + r=`echo $x | sed -e 's/^.*=//' -e 's/?/=/g'`
19627 + echo "/$r/) optstring=\"/$l/\" ;;" >> print-sysroot-suffix2.sh
19628 +done
19629 +echo " esac" >> print-sysroot-suffix2.sh
19630 +
19631 +pat=
19632 +for x in $dirnames; do
19633 + p=`echo $x | sed -e 's,=!,/$=/,'`
19634 + pat="$pat -e 's=^//$p='"
19635 +done
19636 +echo ' optstring=`echo "/$optstring" | sed '"$pat\`" >> print-sysroot-suffix2.sh
19637 +cat >> print-sysroot-suffix2.sh <<\EOF
19638 + case $optstring in
19639 + //*)
19640 + ;;
19641 + *)
19642 + echo "$optstring"
19643 + ;;
19644 + esac
19645 +else
19646 + thisopt="$1"
19647 + shift
19648 + bit=
19649 + lastcond=
19650 + result=
19651 + for x in `echo "$thisopt" | sed -e 's,/, ,g'`; do
19652 + case $x in
19653 +EOF
19654 +for x in `echo "$options" | sed -e 's,/, ,g'`; do
19655 + match=`./print-sysroot-suffix3.sh "$x"`
19656 + echo "$x) optmatch=\"$match\" ;;" >> print-sysroot-suffix2.sh
19657 +done
19658 +cat >> print-sysroot-suffix2.sh <<\EOF
19659 + esac
19660 + bit=`"$0" "$padding " "$optstring$x/" "$@"`
19661 + if [ -z "$lastopt" ]; then
19662 + lastopt="$optmatch"
19663 + else
19664 + if [ "$lastbit" = "$bit" ]; then
19665 + lastopt="$lastopt|$optmatch"
19666 + else
19667 + result="$result$lastopt:$lastbit;$n"
19668 + lastopt="$optmatch"
19669 + fi
19670 + fi
19671 + lastbit="$bit"
19672 + done
19673 + bit=`"$0" "$padding " "$optstring" "$@"`
19674 + if [ "$bit" = "$lastbit" ]; then
19675 + if [ -z "$result" ]; then
19676 + echo "$bit"
19677 + else
19678 + echo "$n%{$result:$bit}"
19679 + fi
19680 + else
19681 + echo "$n%{$result$lastopt:$lastbit;$n:$bit}"
19682 + fi
19683 +fi
19684 +EOF
19685 +
19686 +chmod +x ./print-sysroot-suffix2.sh
19687 +result=`./print-sysroot-suffix2.sh "" "/" $options`
19688 +echo "#undef SYSROOT_SUFFIX_SPEC"
19689 +echo "#define SYSROOT_SUFFIX_SPEC \"$result\""
19690 +rm print-sysroot-suffix2.sh
19691 +rm print-sysroot-suffix3.sh
19692 diff -Nur a/gcc/config/rs6000/e500mc.h b/gcc/config/rs6000/e500mc.h
19693 --- a/gcc/config/rs6000/e500mc.h 1970-01-01 01:00:00.000000000 +0100
19694 +++ b/gcc/config/rs6000/e500mc.h 2010-01-25 09:50:29.035686224 +0100
19695 @@ -0,0 +1,46 @@
19696 +/* Core target definitions for GNU compiler
19697 + for IBM RS/6000 PowerPC targeted to embedded ELF systems.
19698 + Copyright (C) 1995, 1996, 2000, 2003, 2004, 2007 Free Software Foundation, Inc.
19699 + Contributed by Cygnus Support.
19700 +
19701 + This file is part of GCC.
19702 +
19703 + GCC is free software; you can redistribute it and/or modify it
19704 + under the terms of the GNU General Public License as published
19705 + by the Free Software Foundation; either version 3, or (at your
19706 + option) any later version.
19707 +
19708 + GCC is distributed in the hope that it will be useful, but WITHOUT
19709 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19710 + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19711 + License for more details.
19712 +
19713 + You should have received a copy of the GNU General Public License
19714 + along with GCC; see the file COPYING3. If not see
19715 + <http://www.gnu.org/licenses/>. */
19716 +
19717 +/* Add -meabi to target flags. */
19718 +#undef TARGET_DEFAULT
19719 +#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
19720 +
19721 +#undef TARGET_VERSION
19722 +#define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded)");
19723 +
19724 +#undef TARGET_OS_CPP_BUILTINS
19725 +#define TARGET_OS_CPP_BUILTINS() \
19726 + do \
19727 + { \
19728 + builtin_define_std ("PPC"); \
19729 + builtin_define ("__embedded__"); \
19730 + builtin_assert ("system=embedded"); \
19731 + builtin_assert ("cpu=powerpc"); \
19732 + builtin_assert ("machine=powerpc"); \
19733 + TARGET_OS_SYSV_CPP_BUILTINS (); \
19734 + } \
19735 + while (0)
19736 +
19737 +#undef CC1_EXTRA_SPEC
19738 +#define CC1_EXTRA_SPEC "-maix-struct-return"
19739 +
19740 +#undef ASM_DEFAULT_SPEC
19741 +#define ASM_DEFAULT_SPEC "-mppc%{m64:64} -me500mc"
19742 diff -Nur a/gcc/config/rs6000/eabi.asm b/gcc/config/rs6000/eabi.asm
19743 --- a/gcc/config/rs6000/eabi.asm 2009-04-10 01:23:07.000000000 +0200
19744 +++ b/gcc/config/rs6000/eabi.asm 2010-01-25 09:50:29.035686224 +0100
19745 @@ -230,7 +230,7 @@
19746 r11 has the address of .LCTOC1 in it.
19747 r12 has the value to add to each pointer
19748 r13 .. r31 are unchanged */
19749 -
19750 +#ifdef _RELOCATABLE
19751 FUNC_START(__eabi_convert)
19752 cmplw 1,3,4 /* any pointers to convert? */
19753 subf 5,3,4 /* calculate number of words to convert */
19754 @@ -285,5 +285,5 @@
19755 blr
19756
19757 FUNC_END(__eabi_uconvert)
19758 -
19759 +#endif
19760 #endif
19761 diff -Nur a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm
19762 --- a/gcc/config/rs6000/eabi-ci.asm 2009-04-10 01:23:07.000000000 +0200
19763 +++ b/gcc/config/rs6000/eabi-ci.asm 2010-01-25 09:50:29.035686224 +0100
19764 @@ -98,6 +98,7 @@
19765 /* Head of __init function used for static constructors. */
19766 .section ".init","ax"
19767 .align 2
19768 +FUNC_START(_init)
19769 FUNC_START(__init)
19770 stwu 1,-16(1)
19771 mflr 0
19772 @@ -106,6 +107,7 @@
19773 /* Head of __fini function used for static destructors. */
19774 .section ".fini","ax"
19775 .align 2
19776 +FUNC_START(_fini)
19777 FUNC_START(__fini)
19778 stwu 1,-16(1)
19779 mflr 0
19780 diff -Nur a/gcc/config/rs6000/eabi.h b/gcc/config/rs6000/eabi.h
19781 --- a/gcc/config/rs6000/eabi.h 2007-08-02 12:49:31.000000000 +0200
19782 +++ b/gcc/config/rs6000/eabi.h 2010-01-25 09:50:29.035686224 +0100
19783 @@ -23,10 +23,6 @@
19784 #undef TARGET_DEFAULT
19785 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
19786
19787 -/* Invoke an initializer function to set up the GOT. */
19788 -#define NAME__MAIN "__eabi"
19789 -#define INVOKE__main
19790 -
19791 #undef TARGET_VERSION
19792 #define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded)");
19793
19794 @@ -42,3 +38,20 @@
19795 TARGET_OS_SYSV_CPP_BUILTINS (); \
19796 } \
19797 while (0)
19798 +
19799 +/* Add -te500v1 and -te500v2 options for convenience in generating
19800 + multilibs. */
19801 +#undef CC1_EXTRA_SPEC
19802 +#define CC1_EXTRA_SPEC \
19803 + "%{te500v1: -mcpu=8540 -mfloat-gprs=single -mspe=yes -mabi=spe} " \
19804 + "%{te500v2: -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe} " \
19805 + "%{te600: -mcpu=7400 -maltivec -mabi=altivec}" \
19806 + "%{te500mc: -mcpu=e500mc -maix-struct-return}"
19807 +
19808 +#undef ASM_DEFAULT_SPEC
19809 +#define ASM_DEFAULT_SPEC \
19810 + "%{te500v1:-mppc -mspe -me500 ; \
19811 + te500v2:-mppc -mspe -me500 ; \
19812 + te600:-mppc -maltivec ; \
19813 + te500mc:-mppc -me500mc ; \
19814 + :-mppc%{m64:64}}"
19815 diff -Nur a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
19816 --- a/gcc/config/rs6000/linux.h 2007-08-02 12:49:31.000000000 +0200
19817 +++ b/gcc/config/rs6000/linux.h 2010-01-25 09:50:29.035686224 +0100
19818 @@ -128,3 +128,29 @@
19819 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
19820 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
19821 #endif
19822 +
19823 +/* Add -te500v1 and -te500v2 options for convenience in generating
19824 + multilibs. */
19825 +#undef CC1_EXTRA_SPEC
19826 +#define CC1_EXTRA_SPEC \
19827 + "%{te500v1: -mcpu=8540 -mfloat-gprs=single -mspe=yes -mabi=spe} " \
19828 + "%{te500v2: -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe} " \
19829 + "%{te600: -mcpu=7400 -maltivec -mabi=altivec}" \
19830 + "%{te500mc: -mcpu=e500mc}"
19831 +
19832 +#undef ASM_DEFAULT_SPEC
19833 +#define ASM_DEFAULT_SPEC \
19834 + "%{te500v1:-mppc -mspe -me500 ; \
19835 + te500v2:-mppc -mspe -me500 ; \
19836 + te600:-mppc -maltivec ; \
19837 + te500mc:-me500mc ; \
19838 + :-mppc%{m64:64}}"
19839 +
19840 +/* The various C libraries each have their own subdirectory. */
19841 +#undef SYSROOT_SUFFIX_SPEC
19842 +#define SYSROOT_SUFFIX_SPEC \
19843 + "%{msoft-float:/nof ; \
19844 + te600:/te600 ; \
19845 + te500v1:/te500v1 ; \
19846 + te500v2:/te500v2 ; \
19847 + te500mc:/te500mc}"
19848 diff -Nur a/gcc/config/rs6000/montavista-linux.h b/gcc/config/rs6000/montavista-linux.h
19849 --- a/gcc/config/rs6000/montavista-linux.h 1970-01-01 01:00:00.000000000 +0100
19850 +++ b/gcc/config/rs6000/montavista-linux.h 2010-01-25 09:50:29.035686224 +0100
19851 @@ -0,0 +1,41 @@
19852 +/* MontaVista GNU/Linux Configuration.
19853 + Copyright (C) 2009
19854 + Free Software Foundation, Inc.
19855 +
19856 +This file is part of GCC.
19857 +
19858 +GCC is free software; you can redistribute it and/or modify
19859 +it under the terms of the GNU General Public License as published by
19860 +the Free Software Foundation; either version 3, or (at your option)
19861 +any later version.
19862 +
19863 +GCC is distributed in the hope that it will be useful,
19864 +but WITHOUT ANY WARRANTY; without even the implied warranty of
19865 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19866 +GNU General Public License for more details.
19867 +
19868 +You should have received a copy of the GNU General Public License
19869 +along with GCC; see the file COPYING3. If not see
19870 +<http://www.gnu.org/licenses/>. */
19871 +
19872 +/* Add -te500v2 option for convenience in generating multilibs. */
19873 +#undef CC1_EXTRA_SPEC
19874 +#define CC1_EXTRA_SPEC \
19875 + "%{te500v2: -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe} " \
19876 + "%{te600: -mcpu=7400 -maltivec -mabi=altivec}" \
19877 + "%{te500mc: -mcpu=e500mc}"
19878 +
19879 +#undef ASM_DEFAULT_SPEC
19880 +#define ASM_DEFAULT_SPEC \
19881 + "%{te500v2:-mppc -mspe -me500 ; \
19882 + te600:-mppc -maltivec ; \
19883 + te500mc:-me500mc ; \
19884 + :-mppc}"
19885 +
19886 +/* The various C libraries each have their own subdirectory. */
19887 +#undef SYSROOT_SUFFIX_SPEC
19888 +#define SYSROOT_SUFFIX_SPEC \
19889 + "%{msoft-float:/soft-float ; \
19890 + te600:/te600 ; \
19891 + te500v2:/te500v2 ; \
19892 + te500mc:/te500mc}"
19893 diff -Nur a/gcc/config/rs6000/option-defaults.h b/gcc/config/rs6000/option-defaults.h
19894 --- a/gcc/config/rs6000/option-defaults.h 1970-01-01 01:00:00.000000000 +0100
19895 +++ b/gcc/config/rs6000/option-defaults.h 2010-01-25 09:50:29.035686224 +0100
19896 @@ -0,0 +1,64 @@
19897 +/* Definitions of default options for config/rs6000 configurations.
19898 + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
19899 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
19900 + Free Software Foundation, Inc.
19901 +
19902 + This file is part of GCC.
19903 +
19904 + GCC is free software; you can redistribute it and/or modify it
19905 + under the terms of the GNU General Public License as published
19906 + by the Free Software Foundation; either version 3, or (at your
19907 + option) any later version.
19908 +
19909 + GCC is distributed in the hope that it will be useful, but WITHOUT
19910 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19911 + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19912 + License for more details.
19913 +
19914 + Under Section 7 of GPL version 3, you are granted additional
19915 + permissions described in the GCC Runtime Library Exception, version
19916 + 3.1, as published by the Free Software Foundation.
19917 +
19918 + You should have received a copy of the GNU General Public License and
19919 + a copy of the GCC Runtime Library Exception along with this program;
19920 + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
19921 + <http://www.gnu.org/licenses/>. */
19922 +
19923 +/* This header needs to be included after any other headers affecting
19924 + TARGET_DEFAULT. */
19925 +
19926 +#if TARGET_AIX
19927 +#define OPT_64 "maix64"
19928 +#define OPT_32 "maix32"
19929 +#else
19930 +#define OPT_64 "m64"
19931 +#define OPT_32 "m32"
19932 +#endif
19933 +
19934 +#ifndef MASK_64BIT
19935 +#define MASK_64BIT 0
19936 +#endif
19937 +
19938 +#if TARGET_DEFAULT & MASK_64BIT
19939 +#define OPT_ARCH64 "!"OPT_32
19940 +#define OPT_ARCH32 OPT_32
19941 +#else
19942 +#define OPT_ARCH64 OPT_64
19943 +#define OPT_ARCH32 "!"OPT_64
19944 +#endif
19945 +
19946 +/* Support for a compile-time default CPU, et cetera. The rules are:
19947 + --with-cpu is ignored if -mcpu is specified; likewise --with-cpu-32
19948 + and --with-cpu-64.
19949 + --with-tune is ignored if -mtune is specified; likewise --with-tune-32
19950 + and --with-tune-64.
19951 + --with-float is ignored if -mhard-float or -msoft-float are
19952 + specified. */
19953 +#define OPTION_DEFAULT_SPECS \
19954 + {"cpu", "%{mcpu=*|te500mc|te500v1|te500v2|te600:;:-mcpu=%(VALUE)}" }, \
19955 + {"cpu_32", "%{" OPT_ARCH32 ":%{mcpu=*|te500mc|te500v1|te500v2|te600:;:-mcpu=%(VALUE)}}" }, \
19956 + {"cpu_64", "%{" OPT_ARCH64 ":%{mcpu=*|te500mc|te500v1|te500v2|te600:;:-mcpu=%(VALUE)}}" }, \
19957 + {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
19958 + {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \
19959 + {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \
19960 + {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }
19961 diff -Nur a/gcc/config/rs6000/paired.md b/gcc/config/rs6000/paired.md
19962 --- a/gcc/config/rs6000/paired.md 2009-04-10 01:23:07.000000000 +0200
19963 +++ b/gcc/config/rs6000/paired.md 2010-01-25 09:50:29.035686224 +0100
19964 @@ -27,7 +27,7 @@
19965 (UNSPEC_EXTODD_V2SF 333)
19966 ])
19967
19968 -(define_insn "negv2sf2"
19969 +(define_insn "paired_negv2sf2"
19970 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
19971 (neg:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")))]
19972 "TARGET_PAIRED_FLOAT"
19973 @@ -41,7 +41,7 @@
19974 "ps_rsqrte %0,%1"
19975 [(set_attr "type" "fp")])
19976
19977 -(define_insn "absv2sf2"
19978 +(define_insn "paired_absv2sf2"
19979 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
19980 (abs:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")))]
19981 "TARGET_PAIRED_FLOAT"
19982 @@ -55,7 +55,7 @@
19983 "ps_nabs %0,%1"
19984 [(set_attr "type" "fp")])
19985
19986 -(define_insn "addv2sf3"
19987 +(define_insn "paired_addv2sf3"
19988 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
19989 (plus:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
19990 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
19991 @@ -63,7 +63,7 @@
19992 "ps_add %0,%1,%2"
19993 [(set_attr "type" "fp")])
19994
19995 -(define_insn "subv2sf3"
19996 +(define_insn "paired_subv2sf3"
19997 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
19998 (minus:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
19999 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
20000 @@ -71,7 +71,7 @@
20001 "ps_sub %0,%1,%2"
20002 [(set_attr "type" "fp")])
20003
20004 -(define_insn "mulv2sf3"
20005 +(define_insn "paired_mulv2sf3"
20006 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
20007 (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
20008 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
20009 @@ -86,7 +86,7 @@
20010 "ps_res %0,%1"
20011 [(set_attr "type" "fp")])
20012
20013 -(define_insn "divv2sf3"
20014 +(define_insn "paired_divv2sf3"
20015 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
20016 (div:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
20017 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
20018 diff -Nur a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
20019 --- a/gcc/config/rs6000/rs6000.c 2009-03-17 21:18:21.000000000 +0100
20020 +++ b/gcc/config/rs6000/rs6000.c 2010-01-25 09:50:29.035686224 +0100
20021 @@ -919,6 +919,7 @@
20022 static bool rs6000_is_opaque_type (const_tree);
20023 static rtx rs6000_dwarf_register_span (rtx);
20024 static void rs6000_init_dwarf_reg_sizes_extra (tree);
20025 +static int rs6000_commutative_operand_precedence (const_rtx, int);
20026 static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
20027 static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
20028 static rtx rs6000_tls_get_addr (void);
20029 @@ -1194,6 +1195,10 @@
20030 #undef TARGET_VECTOR_OPAQUE_P
20031 #define TARGET_VECTOR_OPAQUE_P rs6000_is_opaque_type
20032
20033 +#undef TARGET_COMMUTATIVE_OPERAND_PRECEDENCE
20034 +#define TARGET_COMMUTATIVE_OPERAND_PRECEDENCE \
20035 + rs6000_commutative_operand_precedence
20036 +
20037 #undef TARGET_DWARF_REGISTER_SPAN
20038 #define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span
20039
20040 @@ -4682,16 +4687,19 @@
20041 if (TARGET_ALTIVEC)
20042 global_regs[VSCR_REGNO] = 1;
20043
20044 - if (TARGET_ALTIVEC_ABI)
20045 - {
20046 - for (i = FIRST_ALTIVEC_REGNO; i < FIRST_ALTIVEC_REGNO + 20; ++i)
20047 - call_used_regs[i] = call_really_used_regs[i] = 1;
20048 + /* If we are not using the AltiVec ABI, pretend that the normally
20049 + call-saved registers are also call-used. We could use them
20050 + normally if we saved and restored them in the prologue; that
20051 + would require using the alignment padding around the register
20052 + save area, and some care with unwinding information. */
20053 + if (! TARGET_ALTIVEC_ABI)
20054 + for (i = FIRST_ALTIVEC_REGNO + 20; i <= LAST_ALTIVEC_REGNO; ++i)
20055 + call_used_regs[i] = call_really_used_regs[i] = 1;
20056
20057 - /* AIX reserves VR20:31 in non-extended ABI mode. */
20058 - if (TARGET_XCOFF)
20059 - for (i = FIRST_ALTIVEC_REGNO + 20; i < FIRST_ALTIVEC_REGNO + 32; ++i)
20060 - fixed_regs[i] = call_used_regs[i] = call_really_used_regs[i] = 1;
20061 - }
20062 + if (TARGET_ALTIVEC_ABI && TARGET_XCOFF)
20063 + /* AIX reserves VR20:31 in non-extended ABI mode. */
20064 + for (i = FIRST_ALTIVEC_REGNO + 20; i < FIRST_ALTIVEC_REGNO + 32; ++i)
20065 + fixed_regs[i] = call_used_regs[i] = call_really_used_regs[i] = 1;
20066 }
20067 \f
20068 /* Try to output insns to set TARGET equal to the constant C if it can
20069 @@ -7507,10 +7515,10 @@
20070 { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sums", ALTIVEC_BUILTIN_VEC_SUMS },
20071 { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_xor", ALTIVEC_BUILTIN_VEC_XOR },
20072
20073 - { 0, CODE_FOR_divv2sf3, "__builtin_paired_divv2sf3", PAIRED_BUILTIN_DIVV2SF3 },
20074 - { 0, CODE_FOR_addv2sf3, "__builtin_paired_addv2sf3", PAIRED_BUILTIN_ADDV2SF3 },
20075 - { 0, CODE_FOR_subv2sf3, "__builtin_paired_subv2sf3", PAIRED_BUILTIN_SUBV2SF3 },
20076 - { 0, CODE_FOR_mulv2sf3, "__builtin_paired_mulv2sf3", PAIRED_BUILTIN_MULV2SF3 },
20077 + { 0, CODE_FOR_paired_divv2sf3, "__builtin_paired_divv2sf3", PAIRED_BUILTIN_DIVV2SF3 },
20078 + { 0, CODE_FOR_paired_addv2sf3, "__builtin_paired_addv2sf3", PAIRED_BUILTIN_ADDV2SF3 },
20079 + { 0, CODE_FOR_paired_subv2sf3, "__builtin_paired_subv2sf3", PAIRED_BUILTIN_SUBV2SF3 },
20080 + { 0, CODE_FOR_paired_mulv2sf3, "__builtin_paired_mulv2sf3", PAIRED_BUILTIN_MULV2SF3 },
20081 { 0, CODE_FOR_paired_muls0, "__builtin_paired_muls0", PAIRED_BUILTIN_MULS0 },
20082 { 0, CODE_FOR_paired_muls1, "__builtin_paired_muls1", PAIRED_BUILTIN_MULS1 },
20083 { 0, CODE_FOR_paired_merge00, "__builtin_paired_merge00", PAIRED_BUILTIN_MERGE00 },
20084 @@ -7519,10 +7527,10 @@
20085 { 0, CODE_FOR_paired_merge11, "__builtin_paired_merge11", PAIRED_BUILTIN_MERGE11 },
20086
20087 /* Place holder, leave as first spe builtin. */
20088 - { 0, CODE_FOR_spe_evaddw, "__builtin_spe_evaddw", SPE_BUILTIN_EVADDW },
20089 - { 0, CODE_FOR_spe_evand, "__builtin_spe_evand", SPE_BUILTIN_EVAND },
20090 + { 0, CODE_FOR_addv2si3, "__builtin_spe_evaddw", SPE_BUILTIN_EVADDW },
20091 + { 0, CODE_FOR_andv2si3, "__builtin_spe_evand", SPE_BUILTIN_EVAND },
20092 { 0, CODE_FOR_spe_evandc, "__builtin_spe_evandc", SPE_BUILTIN_EVANDC },
20093 - { 0, CODE_FOR_spe_evdivws, "__builtin_spe_evdivws", SPE_BUILTIN_EVDIVWS },
20094 + { 0, CODE_FOR_divv2si3, "__builtin_spe_evdivws", SPE_BUILTIN_EVDIVWS },
20095 { 0, CODE_FOR_spe_evdivwu, "__builtin_spe_evdivwu", SPE_BUILTIN_EVDIVWU },
20096 { 0, CODE_FOR_spe_eveqv, "__builtin_spe_eveqv", SPE_BUILTIN_EVEQV },
20097 { 0, CODE_FOR_spe_evfsadd, "__builtin_spe_evfsadd", SPE_BUILTIN_EVFSADD },
20098 @@ -7798,7 +7806,7 @@
20099
20100 /* The SPE unary builtins must start with SPE_BUILTIN_EVABS and
20101 end with SPE_BUILTIN_EVSUBFUSIAAW. */
20102 - { 0, CODE_FOR_spe_evabs, "__builtin_spe_evabs", SPE_BUILTIN_EVABS },
20103 + { 0, CODE_FOR_absv2si2, "__builtin_spe_evabs", SPE_BUILTIN_EVABS },
20104 { 0, CODE_FOR_spe_evaddsmiaaw, "__builtin_spe_evaddsmiaaw", SPE_BUILTIN_EVADDSMIAAW },
20105 { 0, CODE_FOR_spe_evaddssiaaw, "__builtin_spe_evaddssiaaw", SPE_BUILTIN_EVADDSSIAAW },
20106 { 0, CODE_FOR_spe_evaddumiaaw, "__builtin_spe_evaddumiaaw", SPE_BUILTIN_EVADDUMIAAW },
20107 @@ -7830,9 +7838,9 @@
20108 /* Place-holder. Leave as last unary SPE builtin. */
20109 { 0, CODE_FOR_spe_evsubfusiaaw, "__builtin_spe_evsubfusiaaw", SPE_BUILTIN_EVSUBFUSIAAW },
20110
20111 - { 0, CODE_FOR_absv2sf2, "__builtin_paired_absv2sf2", PAIRED_BUILTIN_ABSV2SF2 },
20112 + { 0, CODE_FOR_paired_absv2sf2, "__builtin_paired_absv2sf2", PAIRED_BUILTIN_ABSV2SF2 },
20113 { 0, CODE_FOR_nabsv2sf2, "__builtin_paired_nabsv2sf2", PAIRED_BUILTIN_NABSV2SF2 },
20114 - { 0, CODE_FOR_negv2sf2, "__builtin_paired_negv2sf2", PAIRED_BUILTIN_NEGV2SF2 },
20115 + { 0, CODE_FOR_paired_negv2sf2, "__builtin_paired_negv2sf2", PAIRED_BUILTIN_NEGV2SF2 },
20116 { 0, CODE_FOR_sqrtv2sf2, "__builtin_paired_sqrtv2sf2", PAIRED_BUILTIN_SQRTV2SF2 },
20117 { 0, CODE_FOR_resv2sf2, "__builtin_paired_resv2sf2", PAIRED_BUILTIN_RESV2SF2 }
20118 };
20119 @@ -9370,6 +9378,8 @@
20120 static void
20121 rs6000_init_builtins (void)
20122 {
20123 + tree tdecl;
20124 +
20125 V2SI_type_node = build_vector_type (intSI_type_node, 2);
20126 V2SF_type_node = build_vector_type (float_type_node, 2);
20127 V4HI_type_node = build_vector_type (intHI_type_node, 4);
20128 @@ -9407,60 +9417,75 @@
20129 float_type_internal_node = float_type_node;
20130 void_type_internal_node = void_type_node;
20131
20132 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20133 - get_identifier ("__bool char"),
20134 - bool_char_type_node));
20135 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20136 - get_identifier ("__bool short"),
20137 - bool_short_type_node));
20138 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20139 - get_identifier ("__bool int"),
20140 - bool_int_type_node));
20141 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20142 - get_identifier ("__pixel"),
20143 - pixel_type_node));
20144 + tdecl = build_decl (TYPE_DECL, get_identifier ("__bool char"),
20145 + bool_char_type_node);
20146 + TYPE_NAME (bool_char_type_node) = tdecl;
20147 + (*lang_hooks.decls.pushdecl) (tdecl);
20148 + tdecl = build_decl (TYPE_DECL, get_identifier ("__bool short"),
20149 + bool_short_type_node);
20150 + TYPE_NAME (bool_short_type_node) = tdecl;
20151 + (*lang_hooks.decls.pushdecl) (tdecl);
20152 + tdecl = build_decl (TYPE_DECL, get_identifier ("__bool int"),
20153 + bool_int_type_node);
20154 + TYPE_NAME (bool_int_type_node) = tdecl;
20155 + (*lang_hooks.decls.pushdecl) (tdecl);
20156 + tdecl = build_decl (TYPE_DECL, get_identifier ("__pixel"),
20157 + pixel_type_node);
20158 + TYPE_NAME (pixel_type_node) = tdecl;
20159 + (*lang_hooks.decls.pushdecl) (tdecl);
20160
20161 bool_V16QI_type_node = build_vector_type (bool_char_type_node, 16);
20162 bool_V8HI_type_node = build_vector_type (bool_short_type_node, 8);
20163 bool_V4SI_type_node = build_vector_type (bool_int_type_node, 4);
20164 pixel_V8HI_type_node = build_vector_type (pixel_type_node, 8);
20165
20166 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20167 - get_identifier ("__vector unsigned char"),
20168 - unsigned_V16QI_type_node));
20169 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20170 - get_identifier ("__vector signed char"),
20171 - V16QI_type_node));
20172 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20173 - get_identifier ("__vector __bool char"),
20174 - bool_V16QI_type_node));
20175 -
20176 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20177 - get_identifier ("__vector unsigned short"),
20178 - unsigned_V8HI_type_node));
20179 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20180 - get_identifier ("__vector signed short"),
20181 - V8HI_type_node));
20182 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20183 - get_identifier ("__vector __bool short"),
20184 - bool_V8HI_type_node));
20185 -
20186 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20187 - get_identifier ("__vector unsigned int"),
20188 - unsigned_V4SI_type_node));
20189 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20190 - get_identifier ("__vector signed int"),
20191 - V4SI_type_node));
20192 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20193 - get_identifier ("__vector __bool int"),
20194 - bool_V4SI_type_node));
20195 -
20196 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20197 - get_identifier ("__vector float"),
20198 - V4SF_type_node));
20199 - (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
20200 - get_identifier ("__vector __pixel"),
20201 - pixel_V8HI_type_node));
20202 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector unsigned char"),
20203 + unsigned_V16QI_type_node);
20204 + TYPE_NAME (unsigned_V16QI_type_node) = tdecl;
20205 + (*lang_hooks.decls.pushdecl) (tdecl);
20206 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector signed char"),
20207 + V16QI_type_node);
20208 + TYPE_NAME (V16QI_type_node) = tdecl;
20209 + (*lang_hooks.decls.pushdecl) (tdecl);
20210 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector __bool char"),
20211 + bool_V16QI_type_node);
20212 + TYPE_NAME ( bool_V16QI_type_node) = tdecl;
20213 + (*lang_hooks.decls.pushdecl) (tdecl);
20214 +
20215 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector unsigned short"),
20216 + unsigned_V8HI_type_node);
20217 + TYPE_NAME (unsigned_V8HI_type_node) = tdecl;
20218 + (*lang_hooks.decls.pushdecl) (tdecl);
20219 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector signed short"),
20220 + V8HI_type_node);
20221 + TYPE_NAME (V8HI_type_node) = tdecl;
20222 + (*lang_hooks.decls.pushdecl) (tdecl);
20223 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector __bool short"),
20224 + bool_V8HI_type_node);
20225 + TYPE_NAME (bool_V8HI_type_node) = tdecl;
20226 + (*lang_hooks.decls.pushdecl) (tdecl);
20227 +
20228 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector unsigned int"),
20229 + unsigned_V4SI_type_node);
20230 + TYPE_NAME (unsigned_V4SI_type_node) = tdecl;
20231 + (*lang_hooks.decls.pushdecl) (tdecl);
20232 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector signed int"),
20233 + V4SI_type_node);
20234 + TYPE_NAME (V4SI_type_node) = tdecl;
20235 + (*lang_hooks.decls.pushdecl) (tdecl);
20236 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector __bool int"),
20237 + bool_V4SI_type_node);
20238 + TYPE_NAME (bool_V4SI_type_node) = tdecl;
20239 + (*lang_hooks.decls.pushdecl) (tdecl);
20240 +
20241 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector float"),
20242 + V4SF_type_node);
20243 + TYPE_NAME (V4SF_type_node) = tdecl;
20244 + (*lang_hooks.decls.pushdecl) (tdecl);
20245 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector __pixel"),
20246 + pixel_V8HI_type_node);
20247 + TYPE_NAME (pixel_V8HI_type_node) = tdecl;
20248 + (*lang_hooks.decls.pushdecl) (tdecl);
20249
20250 if (TARGET_PAIRED_FLOAT)
20251 paired_init_builtins ();
20252 @@ -15843,7 +15868,7 @@
20253 no_global_regs_above (int first, bool gpr)
20254 {
20255 int i;
20256 - for (i = first; i < gpr ? 32 : 64 ; i++)
20257 + for (i = first; i < (gpr ? 32 : 64); i++)
20258 if (global_regs[i])
20259 return false;
20260 return true;
20261 @@ -15869,11 +15894,11 @@
20262 int regno = gpr ? info->first_gp_reg_save : (info->first_fp_reg_save - 32);
20263 rtx sym;
20264 int select = ((savep ? 1 : 0) << 2
20265 - | (gpr
20266 + | (TARGET_SPE_ABI
20267 /* On the SPE, we never have any FPRs, but we do have
20268 32/64-bit versions of the routines. */
20269 - ? (TARGET_SPE_ABI && info->spe_64bit_regs_used ? 1 : 0)
20270 - : 0) << 1
20271 + ? (info->spe_64bit_regs_used ? 1 : 0)
20272 + : (gpr ? 1 : 0)) << 1
20273 | (exitp ? 1: 0));
20274
20275 /* Don't generate bogus routine names. */
20276 @@ -15908,6 +15933,7 @@
20277
20278 sym = savres_routine_syms[regno-FIRST_SAVRES_REGISTER][select]
20279 = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
20280 + SYMBOL_REF_FLAGS (sym) |= SYMBOL_FLAG_FUNCTION;
20281 }
20282
20283 return sym;
20284 @@ -16098,6 +16124,14 @@
20285 savres_gprs_inline = savres_gprs_inline || using_multiple_p;
20286 }
20287
20288 + /* Code intended for use in shared libraries cannot be reliably linked
20289 + with out-of-line prologues and epilogues. */
20290 + if (flag_pic)
20291 + {
20292 + savres_gprs_inline = 1;
20293 + savres_fprs_inline = 1;
20294 + }
20295 +
20296 return (using_multiple_p
20297 | (savres_fprs_inline << 1)
20298 | (savres_gprs_inline << 2));
20299 @@ -16122,7 +16156,7 @@
20300 int using_store_multiple;
20301 int using_static_chain_p = (cfun->static_chain_decl != NULL_TREE
20302 && df_regs_ever_live_p (STATIC_CHAIN_REGNUM)
20303 - && !call_used_regs[STATIC_CHAIN_REGNUM]);
20304 + && call_used_regs[STATIC_CHAIN_REGNUM]);
20305 HOST_WIDE_INT sp_offset = 0;
20306
20307 if (TARGET_FIX_AND_CONTINUE)
20308 @@ -16924,8 +16958,9 @@
20309 || (cfun->calls_alloca
20310 && !frame_pointer_needed));
20311 restore_lr = (info->lr_save_p
20312 - && restoring_GPRs_inline
20313 - && restoring_FPRs_inline);
20314 + && (restoring_GPRs_inline
20315 + || (restoring_FPRs_inline
20316 + && info->first_fp_reg_save < 64)));
20317
20318 if (WORLD_SAVE_P (info))
20319 {
20320 @@ -17197,7 +17232,7 @@
20321
20322 /* Get the old lr if we saved it. If we are restoring registers
20323 out-of-line, then the out-of-line routines can do this for us. */
20324 - if (restore_lr)
20325 + if (restore_lr && restoring_GPRs_inline)
20326 {
20327 rtx mem = gen_frame_mem_offset (Pmode, frame_reg_rtx,
20328 info->lr_save_offset + sp_offset);
20329 @@ -17216,7 +17251,7 @@
20330 }
20331
20332 /* Set LR here to try to overlap restores below. */
20333 - if (restore_lr)
20334 + if (restore_lr && restoring_GPRs_inline)
20335 emit_move_insn (gen_rtx_REG (Pmode, LR_REGNO),
20336 gen_rtx_REG (Pmode, 0));
20337
20338 @@ -17396,6 +17431,18 @@
20339 }
20340 }
20341
20342 + if (restore_lr && !restoring_GPRs_inline)
20343 + {
20344 + rtx mem = gen_frame_mem_offset (Pmode, frame_reg_rtx,
20345 + info->lr_save_offset + sp_offset);
20346 +
20347 + emit_move_insn (gen_rtx_REG (Pmode, 0), mem);
20348 + }
20349 +
20350 + if (restore_lr && !restoring_GPRs_inline)
20351 + emit_move_insn (gen_rtx_REG (Pmode, LR_REGNO),
20352 + gen_rtx_REG (Pmode, 0));
20353 +
20354 /* Restore fpr's if we need to do it without calling a function. */
20355 if (restoring_FPRs_inline)
20356 for (i = 0; i < 64 - info->first_fp_reg_save; i++)
20357 @@ -22163,6 +22210,30 @@
20358 return 4 + rs6000_register_move_cost (mode, rclass, GENERAL_REGS);
20359 }
20360
20361 +/* Return a value indicating whether OP, an operand of a commutative
20362 + operation, is preferred as the first or second operand. The higher
20363 + the value, the stronger the preference for being the first operand.
20364 + We use negative values to indicate a preference for the first operand
20365 + and positive values for the second operand.
20366 + VALUE is the default precedence for OP; see rtlanal.c:
20367 + commutative_operand_precendece. */
20368 +
20369 +static int
20370 +rs6000_commutative_operand_precedence (const_rtx op, int value)
20371 +{
20372 + /* Prefer pointer objects over non pointer objects.
20373 + For rationale see PR28690. */
20374 + if (GET_RTX_CLASS (GET_CODE (op)) == RTX_OBJ
20375 + && ((REG_P (op) && REG_POINTER (op))
20376 + || (MEM_P (op) && MEM_POINTER (op))))
20377 + /* value = -1 */;
20378 + else
20379 + /* value = -2 */
20380 + --value;
20381 +
20382 + return value;
20383 +}
20384 +
20385 /* Returns a code for a target-specific builtin that implements
20386 reciprocal of the function, or NULL_TREE if not available. */
20387
20388 @@ -22686,12 +22757,16 @@
20389 static rtx
20390 rs6000_dwarf_register_span (rtx reg)
20391 {
20392 - unsigned regno;
20393 + rtx parts[8];
20394 + int i, words;
20395 + unsigned regno = REGNO (reg);
20396 + enum machine_mode mode = GET_MODE (reg);
20397
20398 if (TARGET_SPE
20399 + && regno < 32
20400 && (SPE_VECTOR_MODE (GET_MODE (reg))
20401 - || (TARGET_E500_DOUBLE
20402 - && (GET_MODE (reg) == DFmode || GET_MODE (reg) == DDmode))))
20403 + || (TARGET_E500_DOUBLE && FLOAT_MODE_P (mode)
20404 + && mode != SFmode && mode != SDmode && mode != SCmode)))
20405 ;
20406 else
20407 return NULL_RTX;
20408 @@ -22701,15 +22776,23 @@
20409 /* The duality of the SPE register size wreaks all kinds of havoc.
20410 This is a way of distinguishing r0 in 32-bits from r0 in
20411 64-bits. */
20412 - return
20413 - gen_rtx_PARALLEL (VOIDmode,
20414 - BYTES_BIG_ENDIAN
20415 - ? gen_rtvec (2,
20416 - gen_rtx_REG (SImode, regno + 1200),
20417 - gen_rtx_REG (SImode, regno))
20418 - : gen_rtvec (2,
20419 - gen_rtx_REG (SImode, regno),
20420 - gen_rtx_REG (SImode, regno + 1200)));
20421 + words = (GET_MODE_SIZE (mode) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD;
20422 + gcc_assert (words <= 4);
20423 + for (i = 0; i < words; i++, regno++)
20424 + {
20425 + if (BYTES_BIG_ENDIAN)
20426 + {
20427 + parts[2 * i] = gen_rtx_REG (SImode, regno + 1200);
20428 + parts[2 * i + 1] = gen_rtx_REG (SImode, regno);
20429 + }
20430 + else
20431 + {
20432 + parts[2 * i] = gen_rtx_REG (SImode, regno);
20433 + parts[2 * i + 1] = gen_rtx_REG (SImode, regno + 1200);
20434 + }
20435 + }
20436 +
20437 + return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (words * 2, parts));
20438 }
20439
20440 /* Fill in sizes for SPE register high parts in table used by unwinder. */
20441 diff -Nur a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
20442 --- a/gcc/config/rs6000/rs6000.h 2009-04-10 01:23:07.000000000 +0200
20443 +++ b/gcc/config/rs6000/rs6000.h 2010-01-25 09:50:29.045688403 +0100
20444 @@ -368,16 +368,6 @@
20445 previous_group
20446 };
20447
20448 -/* Support for a compile-time default CPU, et cetera. The rules are:
20449 - --with-cpu is ignored if -mcpu is specified.
20450 - --with-tune is ignored if -mtune is specified.
20451 - --with-float is ignored if -mhard-float or -msoft-float are
20452 - specified. */
20453 -#define OPTION_DEFAULT_SPECS \
20454 - {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }, \
20455 - {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
20456 - {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }
20457 -
20458 /* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
20459 struct rs6000_cpu_select
20460 {
20461 @@ -794,8 +784,8 @@
20462 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20463 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, \
20464 /* AltiVec registers. */ \
20465 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20466 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20467 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
20468 + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20469 1, 1 \
20470 , 1, 1, 1 \
20471 }
20472 @@ -813,8 +803,8 @@
20473 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20474 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, \
20475 /* AltiVec registers. */ \
20476 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20477 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20478 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
20479 + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
20480 0, 0 \
20481 , 0, 0, 0 \
20482 }
20483 diff -Nur a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
20484 --- a/gcc/config/rs6000/rs6000.md 2009-04-01 18:22:17.000000000 +0200
20485 +++ b/gcc/config/rs6000/rs6000.md 2010-01-25 09:50:29.045688403 +0100
20486 @@ -14703,9 +14703,9 @@
20487 [(match_parallel 0 "any_parallel_operand"
20488 [(clobber (reg:P 65))
20489 (use (match_operand:P 1 "symbol_ref_operand" "s"))
20490 - (use (match_operand:P 2 "gpc_reg_operand" "r"))
20491 - (set (match_operand:P 3 "memory_operand" "=m")
20492 - (match_operand:P 4 "gpc_reg_operand" "r"))])]
20493 + (use (reg:P 11))
20494 + (set (match_operand:P 2 "memory_operand" "=m")
20495 + (match_operand:P 3 "gpc_reg_operand" "r"))])]
20496 ""
20497 "bl %z1"
20498 [(set_attr "type" "branch")
20499 @@ -14715,9 +14715,9 @@
20500 [(match_parallel 0 "any_parallel_operand"
20501 [(clobber (reg:P 65))
20502 (use (match_operand:P 1 "symbol_ref_operand" "s"))
20503 - (use (match_operand:P 2 "gpc_reg_operand" "r"))
20504 - (set (match_operand:DF 3 "memory_operand" "=m")
20505 - (match_operand:DF 4 "gpc_reg_operand" "f"))])]
20506 + (use (reg:P 11))
20507 + (set (match_operand:DF 2 "memory_operand" "=m")
20508 + (match_operand:DF 3 "gpc_reg_operand" "f"))])]
20509 ""
20510 "bl %z1"
20511 [(set_attr "type" "branch")
20512 @@ -14810,9 +14810,9 @@
20513 [(match_parallel 0 "any_parallel_operand"
20514 [(clobber (match_operand:P 1 "register_operand" "=l"))
20515 (use (match_operand:P 2 "symbol_ref_operand" "s"))
20516 - (use (match_operand:P 3 "gpc_reg_operand" "r"))
20517 - (set (match_operand:P 4 "gpc_reg_operand" "=r")
20518 - (match_operand:P 5 "memory_operand" "m"))])]
20519 + (use (reg:P 11))
20520 + (set (match_operand:P 3 "gpc_reg_operand" "=r")
20521 + (match_operand:P 4 "memory_operand" "m"))])]
20522 ""
20523 "bl %z2"
20524 [(set_attr "type" "branch")
20525 @@ -14823,9 +14823,9 @@
20526 [(return)
20527 (clobber (match_operand:P 1 "register_operand" "=l"))
20528 (use (match_operand:P 2 "symbol_ref_operand" "s"))
20529 - (use (match_operand:P 3 "gpc_reg_operand" "r"))
20530 - (set (match_operand:P 4 "gpc_reg_operand" "=r")
20531 - (match_operand:P 5 "memory_operand" "m"))])]
20532 + (use (reg:P 11))
20533 + (set (match_operand:P 3 "gpc_reg_operand" "=r")
20534 + (match_operand:P 4 "memory_operand" "m"))])]
20535 ""
20536 "b %z2"
20537 [(set_attr "type" "branch")
20538 @@ -14836,9 +14836,9 @@
20539 [(return)
20540 (clobber (match_operand:P 1 "register_operand" "=l"))
20541 (use (match_operand:P 2 "symbol_ref_operand" "s"))
20542 - (use (match_operand:P 3 "gpc_reg_operand" "r"))
20543 - (set (match_operand:DF 4 "gpc_reg_operand" "=f")
20544 - (match_operand:DF 5 "memory_operand" "m"))])]
20545 + (use (reg:P 11))
20546 + (set (match_operand:DF 3 "gpc_reg_operand" "=f")
20547 + (match_operand:DF 4 "memory_operand" "m"))])]
20548 ""
20549 "b %z2"
20550 [(set_attr "type" "branch")
20551 @@ -14889,6 +14889,120 @@
20552 }"
20553 [(set_attr "type" "load")])
20554 \f
20555 +;;; Expanders for vector insn patterns shared between the SPE and TARGET_PAIRED systems.
20556 +
20557 +(define_expand "absv2sf2"
20558 + [(set (match_operand:V2SF 0 "gpc_reg_operand" "")
20559 + (abs:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "")))]
20560 + "TARGET_PAIRED_FLOAT || TARGET_SPE"
20561 + "
20562 +{
20563 + if (TARGET_SPE)
20564 + {
20565 + /* We need to make a note that we clobber SPEFSCR. */
20566 + emit_insn (gen_rtx_SET (VOIDmode, operands[0],
20567 + gen_rtx_ABS (V2SFmode, operands[1])));
20568 + emit_insn (gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, SPEFSCR_REGNO)));
20569 + DONE;
20570 + }
20571 +}")
20572 +
20573 +(define_expand "negv2sf2"
20574 + [(set (match_operand:V2SF 0 "gpc_reg_operand" "")
20575 + (neg:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "")))]
20576 + "TARGET_PAIRED_FLOAT || TARGET_SPE"
20577 + "
20578 +{
20579 + if (TARGET_SPE)
20580 + {
20581 + /* We need to make a note that we clobber SPEFSCR. */
20582 + emit_insn (gen_rtx_SET (VOIDmode, operands[0],
20583 + gen_rtx_NEG (V2SFmode, operands[1])));
20584 + emit_insn (gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, SPEFSCR_REGNO)));
20585 + DONE;
20586 + }
20587 +}")
20588 +
20589 +(define_expand "addv2sf3"
20590 + [(set (match_operand:V2SF 0 "gpc_reg_operand" "")
20591 + (plus:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "")
20592 + (match_operand:V2SF 2 "gpc_reg_operand" "")))]
20593 + "TARGET_PAIRED_FLOAT || TARGET_SPE"
20594 + "
20595 +{
20596 + if (TARGET_SPE)
20597 + {
20598 + /* We need to make a note that we clobber SPEFSCR. */
20599 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
20600 +
20601 + XVECEXP (par, 0, 0) = gen_rtx_SET (VOIDmode, operands[0],
20602 + gen_rtx_PLUS (V2SFmode, operands[1], operands[2]));
20603 + XVECEXP (par, 0, 1) = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, SPEFSCR_REGNO));
20604 + emit_insn (par);
20605 + DONE;
20606 + }
20607 +}")
20608 +
20609 +(define_expand "subv2sf3"
20610 + [(set (match_operand:V2SF 0 "gpc_reg_operand" "")
20611 + (minus:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "")
20612 + (match_operand:V2SF 2 "gpc_reg_operand" "")))]
20613 + "TARGET_PAIRED_FLOAT || TARGET_SPE"
20614 + "
20615 +{
20616 + if (TARGET_SPE)
20617 + {
20618 + /* We need to make a note that we clobber SPEFSCR. */
20619 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
20620 +
20621 + XVECEXP (par, 0, 0) = gen_rtx_SET (VOIDmode, operands[0],
20622 + gen_rtx_MINUS (V2SFmode, operands[1], operands[2]));
20623 + XVECEXP (par, 0, 1) = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, SPEFSCR_REGNO));
20624 + emit_insn (par);
20625 + DONE;
20626 + }
20627 +}")
20628 +
20629 +(define_expand "mulv2sf3"
20630 + [(set (match_operand:V2SF 0 "gpc_reg_operand" "")
20631 + (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "")
20632 + (match_operand:V2SF 2 "gpc_reg_operand" "")))]
20633 + "TARGET_PAIRED_FLOAT || TARGET_SPE"
20634 + "
20635 +{
20636 + if (TARGET_SPE)
20637 + {
20638 + /* We need to make a note that we clobber SPEFSCR. */
20639 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
20640 +
20641 + XVECEXP (par, 0, 0) = gen_rtx_SET (VOIDmode, operands[0],
20642 + gen_rtx_MULT (V2SFmode, operands[1], operands[2]));
20643 + XVECEXP (par, 0, 1) = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, SPEFSCR_REGNO));
20644 + emit_insn (par);
20645 + DONE;
20646 + }
20647 +}")
20648 +
20649 +(define_expand "divv2sf3"
20650 + [(set (match_operand:V2SF 0 "gpc_reg_operand" "")
20651 + (div:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "")
20652 + (match_operand:V2SF 2 "gpc_reg_operand" "")))]
20653 + "TARGET_PAIRED_FLOAT || TARGET_SPE"
20654 + "
20655 +{
20656 + if (TARGET_SPE)
20657 + {
20658 + /* We need to make a note that we clobber SPEFSCR. */
20659 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
20660 +
20661 + XVECEXP (par, 0, 0) = gen_rtx_SET (VOIDmode, operands[0],
20662 + gen_rtx_DIV (V2SFmode, operands[1], operands[2]));
20663 + XVECEXP (par, 0, 1) = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, SPEFSCR_REGNO));
20664 + emit_insn (par);
20665 + DONE;
20666 + }
20667 +}")
20668 +\f
20669
20670 (include "sync.md")
20671 (include "altivec.md")
20672 diff -Nur a/gcc/config/rs6000/spe.md b/gcc/config/rs6000/spe.md
20673 --- a/gcc/config/rs6000/spe.md 2009-02-20 16:20:38.000000000 +0100
20674 +++ b/gcc/config/rs6000/spe.md 2010-01-25 09:50:29.045688403 +0100
20675 @@ -164,7 +164,7 @@
20676
20677 ;; SPE SIMD instructions
20678
20679 -(define_insn "spe_evabs"
20680 +(define_insn "absv2si2"
20681 [(set (match_operand:V2SI 0 "gpc_reg_operand" "=r")
20682 (abs:V2SI (match_operand:V2SI 1 "gpc_reg_operand" "r")))]
20683 "TARGET_SPE"
20684 @@ -181,7 +181,7 @@
20685 [(set_attr "type" "vecsimple")
20686 (set_attr "length" "4")])
20687
20688 -(define_insn "spe_evand"
20689 +(define_insn "andv2si3"
20690 [(set (match_operand:V2SI 0 "gpc_reg_operand" "=r")
20691 (and:V2SI (match_operand:V2SI 1 "gpc_reg_operand" "r")
20692 (match_operand:V2SI 2 "gpc_reg_operand" "r")))]
20693 @@ -1898,7 +1898,7 @@
20694 [(set_attr "type" "veccomplex")
20695 (set_attr "length" "4")])
20696
20697 -(define_insn "spe_evaddw"
20698 +(define_insn "addv2si3"
20699 [(set (match_operand:V2SI 0 "gpc_reg_operand" "=r")
20700 (plus:V2SI (match_operand:V2SI 1 "gpc_reg_operand" "r")
20701 (match_operand:V2SI 2 "gpc_reg_operand" "r")))]
20702 @@ -2028,7 +2028,7 @@
20703 [(set_attr "type" "veccomplex")
20704 (set_attr "length" "4")])
20705
20706 -(define_insn "spe_evdivws"
20707 +(define_insn "divv2si3"
20708 [(set (match_operand:V2SI 0 "gpc_reg_operand" "=r")
20709 (div:V2SI (match_operand:V2SI 1 "gpc_reg_operand" "r")
20710 (match_operand:V2SI 2 "gpc_reg_operand" "r")))
20711 @@ -3156,9 +3156,9 @@
20712 [(match_parallel 0 "any_parallel_operand"
20713 [(clobber (reg:P 65))
20714 (use (match_operand:P 1 "symbol_ref_operand" "s"))
20715 - (use (match_operand:P 2 "gpc_reg_operand" "r"))
20716 - (set (match_operand:V2SI 3 "memory_operand" "=m")
20717 - (match_operand:V2SI 4 "gpc_reg_operand" "r"))])]
20718 + (use (reg:P 11))
20719 + (set (match_operand:V2SI 2 "memory_operand" "=m")
20720 + (match_operand:V2SI 3 "gpc_reg_operand" "r"))])]
20721 "TARGET_SPE_ABI"
20722 "bl %z1"
20723 [(set_attr "type" "branch")
20724 @@ -3168,9 +3168,9 @@
20725 [(match_parallel 0 "any_parallel_operand"
20726 [(clobber (reg:P 65))
20727 (use (match_operand:P 1 "symbol_ref_operand" "s"))
20728 - (use (match_operand:P 2 "gpc_reg_operand" "r"))
20729 - (set (match_operand:V2SI 3 "gpc_reg_operand" "=r")
20730 - (match_operand:V2SI 4 "memory_operand" "m"))])]
20731 + (use (reg:P 11))
20732 + (set (match_operand:V2SI 2 "gpc_reg_operand" "=r")
20733 + (match_operand:V2SI 3 "memory_operand" "m"))])]
20734 "TARGET_SPE_ABI"
20735 "bl %z1"
20736 [(set_attr "type" "branch")
20737 @@ -3181,9 +3181,9 @@
20738 [(return)
20739 (clobber (reg:P 65))
20740 (use (match_operand:P 1 "symbol_ref_operand" "s"))
20741 - (use (match_operand:P 2 "gpc_reg_operand" "r"))
20742 - (set (match_operand:V2SI 3 "gpc_reg_operand" "=r")
20743 - (match_operand:V2SI 4 "memory_operand" "m"))])]
20744 + (use (reg:P 11))
20745 + (set (match_operand:V2SI 2 "gpc_reg_operand" "=r")
20746 + (match_operand:V2SI 3 "memory_operand" "m"))])]
20747 "TARGET_SPE_ABI"
20748 "b %z1"
20749 [(set_attr "type" "branch")
20750 diff -Nur a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
20751 --- a/gcc/config/rs6000/sysv4.h 2009-04-10 01:23:07.000000000 +0200
20752 +++ b/gcc/config/rs6000/sysv4.h 2010-01-25 09:50:29.045688403 +0100
20753 @@ -619,6 +619,9 @@
20754 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
20755 #endif
20756
20757 +#undef CC1_EXTRA_SPEC
20758 +#define CC1_EXTRA_SPEC ""
20759 +
20760 /* Pass -G xxx to the compiler and set correct endian mode. */
20761 #define CC1_SPEC "%{G*} %(cc1_cpu) \
20762 %{mlittle|mlittle-endian: %(cc1_endian_little); \
20763 @@ -643,7 +646,7 @@
20764 %{msdata: -msdata=default} \
20765 %{mno-sdata: -msdata=none} \
20766 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
20767 -%{profile: -p}"
20768 +%{profile: -p}" CC1_EXTRA_SPEC
20769
20770 /* Don't put -Y P,<path> for cross compilers. */
20771 #ifndef CROSS_DIRECTORY_STRUCTURE
20772 @@ -843,15 +846,15 @@
20773 #define CPP_OS_MVME_SPEC ""
20774
20775 /* PowerPC simulator based on netbsd system calls support. */
20776 -#define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
20777 +#define LIB_SIM_SPEC LIB_DEFAULT_SPEC
20778
20779 -#define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
20780 +#define STARTFILE_SIM_SPEC "ecrti.o%s crtbegin.o%s"
20781
20782 -#define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
20783 +#define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s -Tsim-hosted.ld"
20784
20785 #define LINK_START_SIM_SPEC ""
20786
20787 -#define LINK_OS_SIM_SPEC "-m elf32ppcsim"
20788 +#define LINK_OS_SIM_SPEC ""
20789
20790 #define CPP_OS_SIM_SPEC ""
20791
20792 diff -Nur a/gcc/config/rs6000/t-cs-eabi b/gcc/config/rs6000/t-cs-eabi
20793 --- a/gcc/config/rs6000/t-cs-eabi 1970-01-01 01:00:00.000000000 +0100
20794 +++ b/gcc/config/rs6000/t-cs-eabi 2010-01-25 09:50:29.045688403 +0100
20795 @@ -0,0 +1,17 @@
20796 +# Multilibs for powerpc embedded ELF targets.
20797 +
20798 +MULTILIB_OPTIONS = te500v1/te500v2/te600/te500mc \
20799 + msoft-float
20800 +
20801 +MULTILIB_DIRNAMES = te500v1 te500v2 te600 te500mc \
20802 + nof
20803 +
20804 +MULTILIB_EXCEPTIONS = *te600*/*msoft-float* \
20805 + *te500v1*/*msoft-float* \
20806 + *te500v2*/*msoft-float* \
20807 + *te500mc*/*msoft-float*
20808 +
20809 +MULTILIB_EXTRA_OPTS = mno-eabi mstrict-align
20810 +
20811 +MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} \
20812 + ${MULTILIB_MATCHES_ENDIAN}
20813 diff -Nur a/gcc/config/rs6000/t-cs-eabi-lite b/gcc/config/rs6000/t-cs-eabi-lite
20814 --- a/gcc/config/rs6000/t-cs-eabi-lite 1970-01-01 01:00:00.000000000 +0100
20815 +++ b/gcc/config/rs6000/t-cs-eabi-lite 2010-01-25 09:50:29.045688403 +0100
20816 @@ -0,0 +1,16 @@
20817 +# Multilibs for powerpc embedded ELF targets.
20818 +
20819 +MULTILIB_OPTIONS = te500v1/te500v2/te600 \
20820 + msoft-float
20821 +
20822 +MULTILIB_DIRNAMES = te500v1 te500v2 te600 \
20823 + nof
20824 +
20825 +MULTILIB_EXCEPTIONS = *te600*/*msoft-float* \
20826 + *te500v1*/*msoft-float* \
20827 + *te500v2*/*msoft-float*
20828 +
20829 +MULTILIB_EXTRA_OPTS = mno-eabi mstrict-align
20830 +
20831 +MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} \
20832 + ${MULTILIB_MATCHES_ENDIAN}
20833 diff -Nur a/gcc/config/rs6000/t-cs-linux b/gcc/config/rs6000/t-cs-linux
20834 --- a/gcc/config/rs6000/t-cs-linux 1970-01-01 01:00:00.000000000 +0100
20835 +++ b/gcc/config/rs6000/t-cs-linux 2010-01-25 09:50:29.045688403 +0100
20836 @@ -0,0 +1,12 @@
20837 +# Multilibs for powerpc-linux-gnu targets.
20838 +
20839 +MULTILIB_OPTIONS = te500v1/te500v2/te600/te500mc \
20840 + msoft-float
20841 +
20842 +MULTILIB_DIRNAMES = te500v1 te500v2 te600 te500mc \
20843 + nof
20844 +
20845 +MULTILIB_EXCEPTIONS = *te600*/*msoft-float* \
20846 + *te500v1*/*msoft-float* \
20847 + *te500v2*/*msoft-float* \
20848 + *te500mc*/*msoft-float*
20849 diff -Nur a/gcc/config/rs6000/t-montavista-linux b/gcc/config/rs6000/t-montavista-linux
20850 --- a/gcc/config/rs6000/t-montavista-linux 1970-01-01 01:00:00.000000000 +0100
20851 +++ b/gcc/config/rs6000/t-montavista-linux 2010-01-25 09:50:29.045688403 +0100
20852 @@ -0,0 +1,26 @@
20853 +# MontaVista GNU/Linux Configuration.
20854 +# Copyright (C) 2009
20855 +# Free Software Foundation, Inc.
20856 +#
20857 +# This file is part of GCC.
20858 +#
20859 +# GCC is free software; you can redistribute it and/or modify
20860 +# it under the terms of the GNU General Public License as published by
20861 +# the Free Software Foundation; either version 3, or (at your option)
20862 +# any later version.
20863 +#
20864 +# GCC is distributed in the hope that it will be useful,
20865 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
20866 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20867 +# GNU General Public License for more details.
20868 +#
20869 +# You should have received a copy of the GNU General Public License
20870 +# along with GCC; see the file COPYING3. If not see
20871 +# <http://www.gnu.org/licenses/>.
20872 +
20873 +# Build hard-float, soft-float, E500mc, E500v2 and E600
20874 +# libraries.
20875 +MULTILIB_OPTIONS = msoft-float/te500mc/te500v2/te600
20876 +MULTILIB_DIRNAMES = soft-float te500mc te500v2 te600
20877 +MULTILIB_EXCEPTIONS =
20878 +MULTILIB_OSDIRNAMES = msoft-float=!soft-float
20879 diff -Nur a/gcc/config/rs6000/t-ppccomm b/gcc/config/rs6000/t-ppccomm
20880 --- a/gcc/config/rs6000/t-ppccomm 2008-06-26 22:12:41.000000000 +0200
20881 +++ b/gcc/config/rs6000/t-ppccomm 2010-01-25 09:50:29.045688403 +0100
20882 @@ -3,10 +3,23 @@
20883 LIB2FUNCS_EXTRA += tramp.S $(srcdir)/config/rs6000/darwin-ldouble.c
20884
20885 # These can't end up in shared libgcc
20886 -LIB2FUNCS_STATIC_EXTRA = eabi.S
20887 -
20888 -eabi.S: $(srcdir)/config/rs6000/eabi.asm
20889 - cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
20890 +LIB2FUNCS_STATIC_EXTRA = \
20891 + crtsavfpr.S crtresfpr.S \
20892 + crtsavgpr.S crtresgpr.S \
20893 + crtresxfpr.S crtresxgpr.S \
20894 + e500crtres32gpr.S \
20895 + e500crtres64gpr.S \
20896 + e500crtres64gprctr.S \
20897 + e500crtrest32gpr.S \
20898 + e500crtrest64gpr.S \
20899 + e500crtresx32gpr.S \
20900 + e500crtresx64gpr.S \
20901 + e500crtsav32gpr.S \
20902 + e500crtsav64gpr.S \
20903 + e500crtsav64gprctr.S \
20904 + e500crtsavg32gpr.S \
20905 + e500crtsavg64gpr.S \
20906 + e500crtsavg64gprctr.S
20907
20908 tramp.S: $(srcdir)/config/rs6000/tramp.asm
20909 cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
20910 @@ -36,6 +49,63 @@
20911 ncrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
20912 cat $(srcdir)/config/rs6000/sol-cn.asm >ncrtn.S
20913
20914 +crtsavfpr.S: $(srcdir)/config/rs6000/crtsavfpr.asm
20915 + cat $(srcdir)/config/rs6000/crtsavfpr.asm >crtsavfpr.S
20916 +
20917 +crtresfpr.S: $(srcdir)/config/rs6000/crtresfpr.asm
20918 + cat $(srcdir)/config/rs6000/crtresfpr.asm >crtresfpr.S
20919 +
20920 +crtsavgpr.S: $(srcdir)/config/rs6000/crtsavgpr.asm
20921 + cat $(srcdir)/config/rs6000/crtsavgpr.asm >crtsavgpr.S
20922 +
20923 +crtresgpr.S: $(srcdir)/config/rs6000/crtresgpr.asm
20924 + cat $(srcdir)/config/rs6000/crtresgpr.asm >crtresgpr.S
20925 +
20926 +crtresxfpr.S: $(srcdir)/config/rs6000/crtresxfpr.asm
20927 + cat $(srcdir)/config/rs6000/crtresxfpr.asm >crtresxfpr.S
20928 +
20929 +crtresxgpr.S: $(srcdir)/config/rs6000/crtresxgpr.asm
20930 + cat $(srcdir)/config/rs6000/crtresxgpr.asm >crtresxgpr.S
20931 +
20932 +e500crtres32gpr.S: $(srcdir)/config/rs6000/e500crtres32gpr.asm
20933 + cat $(srcdir)/config/rs6000/e500crtres32gpr.asm >e500crtres32gpr.S
20934 +
20935 +e500crtres64gpr.S: $(srcdir)/config/rs6000/e500crtres64gpr.asm
20936 + cat $(srcdir)/config/rs6000/e500crtres64gpr.asm >e500crtres64gpr.S
20937 +
20938 +e500crtres64gprctr.S: $(srcdir)/config/rs6000/e500crtres64gprctr.asm
20939 + cat $(srcdir)/config/rs6000/e500crtres64gprctr.asm >e500crtres64gprctr.S
20940 +
20941 +e500crtrest32gpr.S: $(srcdir)/config/rs6000/e500crtrest32gpr.asm
20942 + cat $(srcdir)/config/rs6000/e500crtrest32gpr.asm >e500crtrest32gpr.S
20943 +
20944 +e500crtrest64gpr.S: $(srcdir)/config/rs6000/e500crtrest64gpr.asm
20945 + cat $(srcdir)/config/rs6000/e500crtrest64gpr.asm >e500crtrest64gpr.S
20946 +
20947 +e500crtresx32gpr.S: $(srcdir)/config/rs6000/e500crtresx32gpr.asm
20948 + cat $(srcdir)/config/rs6000/e500crtresx32gpr.asm >e500crtresx32gpr.S
20949 +
20950 +e500crtresx64gpr.S: $(srcdir)/config/rs6000/e500crtresx64gpr.asm
20951 + cat $(srcdir)/config/rs6000/e500crtresx64gpr.asm >e500crtresx64gpr.S
20952 +
20953 +e500crtsav32gpr.S: $(srcdir)/config/rs6000/e500crtsav32gpr.asm
20954 + cat $(srcdir)/config/rs6000/e500crtsav32gpr.asm >e500crtsav32gpr.S
20955 +
20956 +e500crtsav64gpr.S: $(srcdir)/config/rs6000/e500crtsav64gpr.asm
20957 + cat $(srcdir)/config/rs6000/e500crtsav64gpr.asm >e500crtsav64gpr.S
20958 +
20959 +e500crtsav64gprctr.S: $(srcdir)/config/rs6000/e500crtsav64gprctr.asm
20960 + cat $(srcdir)/config/rs6000/e500crtsav64gprctr.asm >e500crtsav64gprctr.S
20961 +
20962 +e500crtsavg32gpr.S: $(srcdir)/config/rs6000/e500crtsavg32gpr.asm
20963 + cat $(srcdir)/config/rs6000/e500crtsavg32gpr.asm >e500crtsavg32gpr.S
20964 +
20965 +e500crtsavg64gpr.S: $(srcdir)/config/rs6000/e500crtsavg64gpr.asm
20966 + cat $(srcdir)/config/rs6000/e500crtsavg64gpr.asm >e500crtsavg64gpr.S
20967 +
20968 +e500crtsavg64gprctr.S: $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm
20969 + cat $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm >e500crtsavg64gprctr.S
20970 +
20971 # Build multiple copies of ?crt{i,n}.o, one for each target switch.
20972 $(T)ecrti$(objext): ecrti.S
20973 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrti.S -o $(T)ecrti$(objext)
20974 @@ -49,6 +119,63 @@
20975 $(T)ncrtn$(objext): ncrtn.S
20976 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ncrtn.S -o $(T)ncrtn$(objext)
20977
20978 +$(T)crtsavfpr$(objext): crtsavfpr.S
20979 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavfpr.S -o $(T)crtsavfpr$(objext)
20980 +
20981 +$(T)crtresfpr$(objext): crtresfpr.S
20982 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresfpr.S -o $(T)crtresfpr$(objext)
20983 +
20984 +$(T)crtsavgpr$(objext): crtsavgpr.S
20985 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavgpr.S -o $(T)crtsavgpr$(objext)
20986 +
20987 +$(T)crtresgpr$(objext): crtresgpr.S
20988 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresgpr.S -o $(T)crtresgpr$(objext)
20989 +
20990 +$(T)crtresxfpr$(objext): crtresxfpr.S
20991 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxfpr.S -o $(T)crtresxfpr$(objext)
20992 +
20993 +$(T)crtresxgpr$(objext): crtresxgpr.S
20994 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxgpr.S -o $(T)crtresxgpr$(objext)
20995 +
20996 +$(T)e500crtres32gpr$(objext): e500crtres32gpr.S
20997 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres32gpr.S -o $(T)e500crtres32gpr$(objext)
20998 +
20999 +$(T)e500crtres64gpr$(objext): e500crtres64gpr.S
21000 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gpr.S -o $(T)e500crtres64gpr$(objext)
21001 +
21002 +$(T)e500crtres64gprctr$(objext): e500crtres64gprctr.S
21003 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gprctr.S -o $(T)e500crtres64gprctr$(objext)
21004 +
21005 +$(T)e500crtrest32gpr$(objext): e500crtrest32gpr.S
21006 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest32gpr.S -o $(T)e500crtrest32gpr$(objext)
21007 +
21008 +$(T)e500crtrest64gpr$(objext): e500crtrest64gpr.S
21009 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest64gpr.S -o $(T)e500crtrest64gpr$(objext)
21010 +
21011 +$(T)e500crtresx32gpr$(objext): e500crtresx32gpr.S
21012 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx32gpr.S -o $(T)e500crtresx32gpr$(objext)
21013 +
21014 +$(T)e500crtresx64gpr$(objext): e500crtresx64gpr.S
21015 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx64gpr.S -o $(T)e500crtresx64gpr$(objext)
21016 +
21017 +$(T)e500crtsav32gpr$(objext): e500crtsav32gpr.S
21018 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav32gpr.S -o $(T)e500crtsav32gpr$(objext)
21019 +
21020 +$(T)e500crtsav64gpr$(objext): e500crtsav64gpr.S
21021 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gpr.S -o $(T)e500crtsav64gpr$(objext)
21022 +
21023 +$(T)e500crtsav64gprctr$(objext): e500crtsav64gprctr.S
21024 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gprctr.S -o $(T)e500crtsav64gprctr$(objext)
21025 +
21026 +$(T)e500crtsavg32gpr$(objext): e500crtsavg32gpr.S
21027 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg32gpr.S -o $(T)e500crtsavg32gpr$(objext)
21028 +
21029 +$(T)e500crtsavg64gpr$(objext): e500crtsavg64gpr.S
21030 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gpr.S -o $(T)e500crtsavg64gpr$(objext)
21031 +
21032 +$(T)e500crtsavg64gprctr$(objext): e500crtsavg64gprctr.S
21033 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gprctr.S -o $(T)e500crtsavg64gprctr$(objext)
21034 +
21035 # It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata.
21036 CRTSTUFF_T_CFLAGS = -msdata=none
21037 # Make sure crt*.o are built with -fPIC even if configured with
21038 diff -Nur a/gcc/config/rs6000/t-ppc-e500mc b/gcc/config/rs6000/t-ppc-e500mc
21039 --- a/gcc/config/rs6000/t-ppc-e500mc 1970-01-01 01:00:00.000000000 +0100
21040 +++ b/gcc/config/rs6000/t-ppc-e500mc 2010-01-25 09:50:29.045688403 +0100
21041 @@ -0,0 +1,12 @@
21042 +# Multilibs for powerpc embedded ELF targets.
21043 +
21044 +MULTILIB_OPTIONS =
21045 +
21046 +MULTILIB_DIRNAMES =
21047 +
21048 +MULTILIB_EXCEPTIONS =
21049 +
21050 +MULTILIB_EXTRA_OPTS = mno-eabi mstrict-align
21051 +
21052 +MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} \
21053 + ${MULTILIB_MATCHES_ENDIAN}
21054 diff -Nur a/gcc/config/rs6000/t-wrs-linux b/gcc/config/rs6000/t-wrs-linux
21055 --- a/gcc/config/rs6000/t-wrs-linux 1970-01-01 01:00:00.000000000 +0100
21056 +++ b/gcc/config/rs6000/t-wrs-linux 2010-01-25 09:50:29.045688403 +0100
21057 @@ -0,0 +1,30 @@
21058 +# Wind River GNU/Linux Configuration.
21059 +# Copyright (C) 2006, 2007
21060 +# Free Software Foundation, Inc.
21061 +#
21062 +# This file is part of GCC.
21063 +#
21064 +# GCC is free software; you can redistribute it and/or modify
21065 +# it under the terms of the GNU General Public License as published by
21066 +# the Free Software Foundation; either version 3, or (at your option)
21067 +# any later version.
21068 +#
21069 +# GCC is distributed in the hope that it will be useful,
21070 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
21071 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21072 +# GNU General Public License for more details.
21073 +#
21074 +# You should have received a copy of the GNU General Public License
21075 +# along with GCC; see the file COPYING3. If not see
21076 +# <http://www.gnu.org/licenses/>.
21077 +
21078 +# Build hard-float (32-bit and 64-bit), soft-float, E500v1 and E500v2
21079 +# libraries.
21080 +MULTILIB_OPTIONS = muclibc m64 msoft-float te500v1 te500v2
21081 +MULTILIB_DIRNAMES = uclibc 64 soft-float te500v1 te500v2
21082 +MULTILIB_EXCEPTIONS = *muclibc*/*m64* *muclibc*/*msoft-float*
21083 +MULTILIB_EXCEPTIONS += *muclibc*/*te500v1* *muclibc*/*te500v2*
21084 +MULTILIB_EXCEPTIONS += *m64*/*msoft-float* *m64*/*te500v1* *m64*/*te500v2*
21085 +MULTILIB_EXCEPTIONS += *msoft-float*/*te500v1* *msoft-float*/*te500v2*
21086 +MULTILIB_EXCEPTIONS += *te500v1*/*te500v2*
21087 +MULTILIB_OSDIRNAMES = muclibc=!uclibc m64=../lib64 msoft-float=!soft-float
21088 diff -Nur a/gcc/config/rs6000/wrs-linux.h b/gcc/config/rs6000/wrs-linux.h
21089 --- a/gcc/config/rs6000/wrs-linux.h 1970-01-01 01:00:00.000000000 +0100
21090 +++ b/gcc/config/rs6000/wrs-linux.h 2010-01-25 09:50:29.045688403 +0100
21091 @@ -0,0 +1,44 @@
21092 +/* Wind River GNU/Linux Configuration.
21093 + Copyright (C) 2006, 2007
21094 + Free Software Foundation, Inc.
21095 +
21096 +This file is part of GCC.
21097 +
21098 +GCC is free software; you can redistribute it and/or modify
21099 +it under the terms of the GNU General Public License as published by
21100 +the Free Software Foundation; either version 3, or (at your option)
21101 +any later version.
21102 +
21103 +GCC is distributed in the hope that it will be useful,
21104 +but WITHOUT ANY WARRANTY; without even the implied warranty of
21105 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21106 +GNU General Public License for more details.
21107 +
21108 +You should have received a copy of the GNU General Public License
21109 +along with GCC; see the file COPYING3. If not see
21110 +<http://www.gnu.org/licenses/>. */
21111 +
21112 +/* Add -te500v1 and -te500v2 options for convenience in generating
21113 + multilibs. */
21114 +#undef CC1_EXTRA_SPEC
21115 +#define CC1_EXTRA_SPEC "%{te500v1: -mcpu=8540 -mfloat-gprs=single -mspe=yes -mabi=spe} %{te500v2: -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe}"
21116 +
21117 +#undef ASM_DEFAULT_SPEC
21118 +#define ASM_DEFAULT_SPEC \
21119 + "%{te500v1:-mppc -mspe -me500 ; \
21120 + te500v2:-mppc -mspe -me500 ; \
21121 + :-mppc%{m64:64}}"
21122 +
21123 +/* The GLIBC headers are in /usr/include, relative to the sysroot; the
21124 + uClibc headers are in /uclibc/usr/include. */
21125 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
21126 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
21127 + "%{muclibc:/uclibc}"
21128 +
21129 +/* The various C libraries each have their own subdirectory. */
21130 +#undef SYSROOT_SUFFIX_SPEC
21131 +#define SYSROOT_SUFFIX_SPEC \
21132 + "%{muclibc:/uclibc ; \
21133 + msoft-float:/soft-float ; \
21134 + te500v1:/te500v1 ; \
21135 + te500v2:/te500v2}"
21136 diff -Nur a/gcc/config/sh/cs-sgxxlite-linux.h b/gcc/config/sh/cs-sgxxlite-linux.h
21137 --- a/gcc/config/sh/cs-sgxxlite-linux.h 1970-01-01 01:00:00.000000000 +0100
21138 +++ b/gcc/config/sh/cs-sgxxlite-linux.h 2010-01-25 09:50:29.045688403 +0100
21139 @@ -0,0 +1,31 @@
21140 +/* SH SourceryG++ GNU/Linux Configuration.
21141 + Copyright (C) 2008
21142 + Free Software Foundation, Inc.
21143 +
21144 +This file is part of GCC.
21145 +
21146 +GCC is free software; you can redistribute it and/or modify
21147 +it under the terms of the GNU General Public License as published by
21148 +the Free Software Foundation; either version 3, or (at your option)
21149 +any later version.
21150 +
21151 +GCC is distributed in the hope that it will be useful,
21152 +but WITHOUT ANY WARRANTY; without even the implied warranty of
21153 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21154 +GNU General Public License for more details.
21155 +
21156 +You should have received a copy of the GNU General Public License
21157 +along with GCC; see the file COPYING3. If not see
21158 +<http://www.gnu.org/licenses/>. */
21159 +
21160 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
21161 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
21162 + "%{muclibc:/uclibc}"
21163 +
21164 +#undef SUBTARGET_OVERRIDE_OPTIONS
21165 +#define SUBTARGET_OVERRIDE_OPTIONS \
21166 +do { \
21167 + /* __thread_support is not supported by uClibc. */ \
21168 + if (linux_uclibc) \
21169 + targetm.have_tls = 0; \
21170 +} while (0)
21171 diff -Nur a/gcc/config/sh/cs-sgxxlite-linux.opt b/gcc/config/sh/cs-sgxxlite-linux.opt
21172 --- a/gcc/config/sh/cs-sgxxlite-linux.opt 1970-01-01 01:00:00.000000000 +0100
21173 +++ b/gcc/config/sh/cs-sgxxlite-linux.opt 2010-01-25 09:50:29.045688403 +0100
21174 @@ -0,0 +1,23 @@
21175 +; Options for SH SourceryG++ GNU/Linux
21176 +
21177 +; Copyright (C) 2009 Free Software Foundation, Inc.
21178 +;
21179 +; This file is part of GCC.
21180 +;
21181 +; GCC is free software; you can redistribute it and/or modify it under
21182 +; the terms of the GNU General Public License as published by the Free
21183 +; Software Foundation; either version 3, or (at your option) any later
21184 +; version.
21185 +;
21186 +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
21187 +; WARRANTY; without even the implied warranty of MERCHANTABILITY or
21188 +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21189 +; for more details.
21190 +;
21191 +; You should have received a copy of the GNU General Public License
21192 +; along with GCC; see the file COPYING3. If not see
21193 +; <http://www.gnu.org/licenses/>.
21194 +
21195 +muclibc
21196 +Target RejectNegative Var(building_for_uclibc)
21197 +Building with -muclibc
21198 diff -Nur a/gcc/config/sh/lib1funcs.asm b/gcc/config/sh/lib1funcs.asm
21199 --- a/gcc/config/sh/lib1funcs.asm 2009-04-10 01:23:07.000000000 +0200
21200 +++ b/gcc/config/sh/lib1funcs.asm 2010-01-25 09:50:29.045688403 +0100
21201 @@ -2080,8 +2080,9 @@
21202 GLOBAL(ic_invalidate):
21203 ocbwb @r4
21204 synco
21205 - rts
21206 icbi @r4
21207 + rts
21208 + nop
21209 ENDFUNC(GLOBAL(ic_invalidate))
21210 #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__))
21211 /* For system code, we use ic_invalidate_line_i, but user code
21212 @@ -2147,8 +2148,10 @@
21213 GLOBAL(ic_invalidate_array):
21214 add r1,r4
21215 synco
21216 - rts
21217 icbi @r4
21218 + rts
21219 + nop
21220 + .align 2
21221 .long 0
21222 ENDFUNC(GLOBAL(ic_invalidate_array))
21223 #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || (defined(__SH4_NOFPU__) && !defined(__SH5__))
21224 diff -Nur a/gcc/config/sh/linux-unwind.h b/gcc/config/sh/linux-unwind.h
21225 --- a/gcc/config/sh/linux-unwind.h 2009-04-10 01:23:07.000000000 +0200
21226 +++ b/gcc/config/sh/linux-unwind.h 2010-01-25 09:50:29.045688403 +0100
21227 @@ -24,7 +24,10 @@
21228
21229
21230 /* Do code reading to identify a signal frame, and set the frame
21231 - state data appropriately. See unwind-dw2.c for the structs. */
21232 + state data appropriately. See unwind-dw2.c for the structs.
21233 + Don't use this at all if inhibit_libc is used. */
21234 +
21235 +#ifndef inhibit_libc
21236
21237 #include <signal.h>
21238 #include <sys/ucontext.h>
21239 @@ -248,3 +251,5 @@
21240 return _URC_NO_REASON;
21241 }
21242 #endif /* defined (__SH5__) */
21243 +
21244 +#endif /* inhibit_libc */
21245 diff -Nur a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
21246 --- a/gcc/config/sh/sh.h 2008-11-14 12:46:55.000000000 +0100
21247 +++ b/gcc/config/sh/sh.h 2010-01-25 09:50:29.045688403 +0100
21248 @@ -712,8 +712,9 @@
21249 /* Never run scheduling before reload, since that can \
21250 break global alloc, and generates slower code anyway due \
21251 to the pressure on R0. */ \
21252 - /* Enable sched1 for SH4; ready queue will be reordered by \
21253 - the target hooks when pressure is high. We can not do this for \
21254 + /* Enable sched1 for SH4 if the user explicitly requests. \
21255 + When sched1 is enabled, the ready queue will be reordered by \
21256 + the target hooks if pressure is high. We can not do this for \
21257 PIC, SH3 and lower as they give spill failures for R0. */ \
21258 if (!TARGET_HARD_SH4 || flag_pic) \
21259 flag_schedule_insns = 0; \
21260 @@ -728,6 +729,8 @@
21261 warning (0, "ignoring -fschedule-insns because of exception handling bug"); \
21262 flag_schedule_insns = 0; \
21263 } \
21264 + else if (flag_schedule_insns == 2) \
21265 + flag_schedule_insns = 0; \
21266 } \
21267 \
21268 if (align_loops == 0) \
21269 diff -Nur a/gcc/config/sh/t-1e b/gcc/config/sh/t-1e
21270 --- a/gcc/config/sh/t-1e 2004-06-21 20:18:40.000000000 +0200
21271 +++ b/gcc/config/sh/t-1e 1970-01-01 01:00:00.000000000 +0100
21272 @@ -1 +0,0 @@
21273 -MULTILIB_ENDIAN =
21274 diff -Nur a/gcc/config/sh/t-linux b/gcc/config/sh/t-linux
21275 --- a/gcc/config/sh/t-linux 2007-01-09 11:50:23.000000000 +0100
21276 +++ b/gcc/config/sh/t-linux 2010-01-25 09:50:29.075687537 +0100
21277 @@ -4,6 +4,5 @@
21278
21279 MULTILIB_DIRNAMES=
21280 MULTILIB_MATCHES =
21281 -MULTILIB_EXCEPTIONS=
21282
21283 EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
21284 diff -Nur a/gcc/config/sh/t-mlib-sh1 b/gcc/config/sh/t-mlib-sh1
21285 --- a/gcc/config/sh/t-mlib-sh1 2004-06-21 20:18:40.000000000 +0200
21286 +++ b/gcc/config/sh/t-mlib-sh1 1970-01-01 01:00:00.000000000 +0100
21287 @@ -1 +0,0 @@
21288 -ML_sh1=m1/
21289 diff -Nur a/gcc/config/sh/t-mlib-sh2 b/gcc/config/sh/t-mlib-sh2
21290 --- a/gcc/config/sh/t-mlib-sh2 2004-06-21 20:18:40.000000000 +0200
21291 +++ b/gcc/config/sh/t-mlib-sh2 1970-01-01 01:00:00.000000000 +0100
21292 @@ -1 +0,0 @@
21293 -ML_sh2=m2/
21294 diff -Nur a/gcc/config/sh/t-mlib-sh2a b/gcc/config/sh/t-mlib-sh2a
21295 --- a/gcc/config/sh/t-mlib-sh2a 2004-07-29 08:10:03.000000000 +0200
21296 +++ b/gcc/config/sh/t-mlib-sh2a 1970-01-01 01:00:00.000000000 +0100
21297 @@ -1 +0,0 @@
21298 -ML_sh2a=m2a/
21299 diff -Nur a/gcc/config/sh/t-mlib-sh2a-nofpu b/gcc/config/sh/t-mlib-sh2a-nofpu
21300 --- a/gcc/config/sh/t-mlib-sh2a-nofpu 2004-07-29 08:10:03.000000000 +0200
21301 +++ b/gcc/config/sh/t-mlib-sh2a-nofpu 1970-01-01 01:00:00.000000000 +0100
21302 @@ -1 +0,0 @@
21303 -ML_sh2a_nofpu=m2a-nofpu/
21304 diff -Nur a/gcc/config/sh/t-mlib-sh2a-single b/gcc/config/sh/t-mlib-sh2a-single
21305 --- a/gcc/config/sh/t-mlib-sh2a-single 2004-07-29 08:10:03.000000000 +0200
21306 +++ b/gcc/config/sh/t-mlib-sh2a-single 1970-01-01 01:00:00.000000000 +0100
21307 @@ -1 +0,0 @@
21308 -ML_sh2a_single=m2a-single/
21309 diff -Nur a/gcc/config/sh/t-mlib-sh2a-single-only b/gcc/config/sh/t-mlib-sh2a-single-only
21310 --- a/gcc/config/sh/t-mlib-sh2a-single-only 2004-07-29 08:10:03.000000000 +0200
21311 +++ b/gcc/config/sh/t-mlib-sh2a-single-only 1970-01-01 01:00:00.000000000 +0100
21312 @@ -1 +0,0 @@
21313 -ML_sh2a_single_only=m2a-single-only/
21314 diff -Nur a/gcc/config/sh/t-mlib-sh2e b/gcc/config/sh/t-mlib-sh2e
21315 --- a/gcc/config/sh/t-mlib-sh2e 2004-06-21 20:18:40.000000000 +0200
21316 +++ b/gcc/config/sh/t-mlib-sh2e 1970-01-01 01:00:00.000000000 +0100
21317 @@ -1 +0,0 @@
21318 -ML_sh2e=m2e/
21319 diff -Nur a/gcc/config/sh/t-mlib-sh3 b/gcc/config/sh/t-mlib-sh3
21320 --- a/gcc/config/sh/t-mlib-sh3 2004-06-21 20:18:40.000000000 +0200
21321 +++ b/gcc/config/sh/t-mlib-sh3 1970-01-01 01:00:00.000000000 +0100
21322 @@ -1 +0,0 @@
21323 -ML_sh3=m3/
21324 diff -Nur a/gcc/config/sh/t-mlib-sh3e b/gcc/config/sh/t-mlib-sh3e
21325 --- a/gcc/config/sh/t-mlib-sh3e 2004-06-21 20:18:40.000000000 +0200
21326 +++ b/gcc/config/sh/t-mlib-sh3e 1970-01-01 01:00:00.000000000 +0100
21327 @@ -1 +0,0 @@
21328 -ML_sh3e=m3e/
21329 diff -Nur a/gcc/config/sh/t-mlib-sh4 b/gcc/config/sh/t-mlib-sh4
21330 --- a/gcc/config/sh/t-mlib-sh4 2004-06-21 20:18:40.000000000 +0200
21331 +++ b/gcc/config/sh/t-mlib-sh4 1970-01-01 01:00:00.000000000 +0100
21332 @@ -1 +0,0 @@
21333 -ML_sh4=m4/
21334 diff -Nur a/gcc/config/sh/t-mlib-sh4a b/gcc/config/sh/t-mlib-sh4a
21335 --- a/gcc/config/sh/t-mlib-sh4a 2004-07-28 11:13:58.000000000 +0200
21336 +++ b/gcc/config/sh/t-mlib-sh4a 1970-01-01 01:00:00.000000000 +0100
21337 @@ -1 +0,0 @@
21338 -ML_sh4a=m4a/
21339 diff -Nur a/gcc/config/sh/t-mlib-sh4al b/gcc/config/sh/t-mlib-sh4al
21340 --- a/gcc/config/sh/t-mlib-sh4al 2004-07-28 11:13:58.000000000 +0200
21341 +++ b/gcc/config/sh/t-mlib-sh4al 1970-01-01 01:00:00.000000000 +0100
21342 @@ -1 +0,0 @@
21343 -ML_sh4al=m4al/
21344 diff -Nur a/gcc/config/sh/t-mlib-sh4a-nofpu b/gcc/config/sh/t-mlib-sh4a-nofpu
21345 --- a/gcc/config/sh/t-mlib-sh4a-nofpu 2004-07-28 11:13:58.000000000 +0200
21346 +++ b/gcc/config/sh/t-mlib-sh4a-nofpu 1970-01-01 01:00:00.000000000 +0100
21347 @@ -1 +0,0 @@
21348 -ML_sh4a_nofpu=m4a-nofpu/
21349 diff -Nur a/gcc/config/sh/t-mlib-sh4a-single b/gcc/config/sh/t-mlib-sh4a-single
21350 --- a/gcc/config/sh/t-mlib-sh4a-single 2004-07-28 11:13:58.000000000 +0200
21351 +++ b/gcc/config/sh/t-mlib-sh4a-single 1970-01-01 01:00:00.000000000 +0100
21352 @@ -1 +0,0 @@
21353 -ML_sh4a_single=m4a-single/
21354 diff -Nur a/gcc/config/sh/t-mlib-sh4a-single-only b/gcc/config/sh/t-mlib-sh4a-single-only
21355 --- a/gcc/config/sh/t-mlib-sh4a-single-only 2004-07-28 11:13:58.000000000 +0200
21356 +++ b/gcc/config/sh/t-mlib-sh4a-single-only 1970-01-01 01:00:00.000000000 +0100
21357 @@ -1 +0,0 @@
21358 -ML_sh4a_single_only=m4a-single-only/
21359 diff -Nur a/gcc/config/sh/t-mlib-sh4-nofpu b/gcc/config/sh/t-mlib-sh4-nofpu
21360 --- a/gcc/config/sh/t-mlib-sh4-nofpu 2004-06-21 20:18:40.000000000 +0200
21361 +++ b/gcc/config/sh/t-mlib-sh4-nofpu 1970-01-01 01:00:00.000000000 +0100
21362 @@ -1 +0,0 @@
21363 -ML_sh4_nofpu=m4-nofpu/
21364 diff -Nur a/gcc/config/sh/t-mlib-sh4-single b/gcc/config/sh/t-mlib-sh4-single
21365 --- a/gcc/config/sh/t-mlib-sh4-single 2004-06-21 20:18:40.000000000 +0200
21366 +++ b/gcc/config/sh/t-mlib-sh4-single 1970-01-01 01:00:00.000000000 +0100
21367 @@ -1 +0,0 @@
21368 -ML_sh4_single=m4-single/
21369 diff -Nur a/gcc/config/sh/t-mlib-sh4-single-only b/gcc/config/sh/t-mlib-sh4-single-only
21370 --- a/gcc/config/sh/t-mlib-sh4-single-only 2004-06-21 20:18:40.000000000 +0200
21371 +++ b/gcc/config/sh/t-mlib-sh4-single-only 1970-01-01 01:00:00.000000000 +0100
21372 @@ -1 +0,0 @@
21373 -ML_sh4_single_only=m4-single-only/
21374 diff -Nur a/gcc/config/sh/t-mlib-sh5-32media b/gcc/config/sh/t-mlib-sh5-32media
21375 --- a/gcc/config/sh/t-mlib-sh5-32media 2004-06-21 20:18:40.000000000 +0200
21376 +++ b/gcc/config/sh/t-mlib-sh5-32media 1970-01-01 01:00:00.000000000 +0100
21377 @@ -1 +0,0 @@
21378 -ML_sh5_32media=m5-32media/
21379 diff -Nur a/gcc/config/sh/t-mlib-sh5-32media-nofpu b/gcc/config/sh/t-mlib-sh5-32media-nofpu
21380 --- a/gcc/config/sh/t-mlib-sh5-32media-nofpu 2004-06-21 20:18:40.000000000 +0200
21381 +++ b/gcc/config/sh/t-mlib-sh5-32media-nofpu 1970-01-01 01:00:00.000000000 +0100
21382 @@ -1 +0,0 @@
21383 -ML_sh5_32media_nofpu=m5-32media-nofpu/
21384 diff -Nur a/gcc/config/sh/t-mlib-sh5-64media b/gcc/config/sh/t-mlib-sh5-64media
21385 --- a/gcc/config/sh/t-mlib-sh5-64media 2004-06-21 20:18:40.000000000 +0200
21386 +++ b/gcc/config/sh/t-mlib-sh5-64media 1970-01-01 01:00:00.000000000 +0100
21387 @@ -1 +0,0 @@
21388 -ML_sh5_64media=m5-64media/
21389 diff -Nur a/gcc/config/sh/t-mlib-sh5-64media-nofpu b/gcc/config/sh/t-mlib-sh5-64media-nofpu
21390 --- a/gcc/config/sh/t-mlib-sh5-64media-nofpu 2004-06-21 20:18:40.000000000 +0200
21391 +++ b/gcc/config/sh/t-mlib-sh5-64media-nofpu 1970-01-01 01:00:00.000000000 +0100
21392 @@ -1 +0,0 @@
21393 -ML_sh5_64media_nofpu=m5-64media-nofpu/
21394 diff -Nur a/gcc/config/sh/t-mlib-sh5-compact b/gcc/config/sh/t-mlib-sh5-compact
21395 --- a/gcc/config/sh/t-mlib-sh5-compact 2004-06-21 20:18:40.000000000 +0200
21396 +++ b/gcc/config/sh/t-mlib-sh5-compact 1970-01-01 01:00:00.000000000 +0100
21397 @@ -1 +0,0 @@
21398 -ML_sh5_compact=m5-compact/
21399 diff -Nur a/gcc/config/sh/t-mlib-sh5-compact-nofpu b/gcc/config/sh/t-mlib-sh5-compact-nofpu
21400 --- a/gcc/config/sh/t-mlib-sh5-compact-nofpu 2004-06-21 20:18:40.000000000 +0200
21401 +++ b/gcc/config/sh/t-mlib-sh5-compact-nofpu 1970-01-01 01:00:00.000000000 +0100
21402 @@ -1 +0,0 @@
21403 -ML_sh5_compact_nofpu=m5-compact-nofpu/
21404 diff -Nur a/gcc/config/sh/t-sgxxlite-linux b/gcc/config/sh/t-sgxxlite-linux
21405 --- a/gcc/config/sh/t-sgxxlite-linux 1970-01-01 01:00:00.000000000 +0100
21406 +++ b/gcc/config/sh/t-sgxxlite-linux 2010-01-25 09:50:29.075687537 +0100
21407 @@ -0,0 +1,3 @@
21408 +MULTILIB_OPTIONS += muclibc
21409 +MULTILIB_OSDIRNAMES += muclibc=!uclibc m4al/muclibc=!m4al/uclibc mb/muclibc=!mb/uclibc
21410 +MULTILIB_EXCEPTIONS += mb/m4al/muclibc
21411 diff -Nur a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
21412 --- a/gcc/config/sh/t-sh 2008-10-25 00:10:52.000000000 +0200
21413 +++ b/gcc/config/sh/t-sh 2010-01-25 09:50:29.075687537 +0100
21414 @@ -27,10 +27,10 @@
21415 echo '#endif' >> fp-bit.c
21416 cat $(srcdir)/config/fp-bit.c >> fp-bit.c
21417
21418 -MULTILIB_ENDIAN = ml/mb
21419 -MULTILIB_CPUS= $(ML_sh1)$(ML_sh2a)$(ML_sh2a_nofpu)$(ML_sh2a_single_only)$(ML_sh2a_single)$(ML_sh2e)$(ML_sh2)$(ML_sh3e)$(ML_sh3)$(ML_sh4_nofpu)$(ML_sh4_single_only)$(ML_sh4_single)$(ML_sh4)$(ML_sh4a_nofpu)$(ML_sh4a_single_only)$(ML_sh4a_single)$(ML_sh4a)$(ML_sh5_32media)$(ML_sh5_32media_nofpu)$(ML_sh5_compact)$(ML_sh5_compact_nofpu)$(ML_sh5_64media)$(ML_sh5_64media_nofpu)
21420 +DEFAULT_ENDIAN = $(word 1,$(TM_ENDIAN_CONFIG))
21421 +OTHER_ENDIAN = $(word 2,$(TM_ENDIAN_CONFIG))
21422
21423 -MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) $(MULTILIB_CPUS:/=)
21424 +MULTILIB_OPTIONS= $(OTHER_ENDIAN) $(TM_MULTILIB_CONFIG)
21425 MULTILIB_DIRNAMES=
21426
21427 # The separate entries for m2a-nofpu and m2a-single-only with
21428 @@ -58,7 +58,34 @@
21429 done)
21430
21431 # SH1 only supports big endian.
21432 -MULTILIB_EXCEPTIONS = ml/m1 ml/m2a*
21433 +MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
21434 +
21435 +MULTILIB_OSDIRNAMES = \
21436 + $(OTHER_ENDIAN)=!$(OTHER_ENDIAN) \
21437 + m1=!m1 $(OTHER_ENDIAN)/m1=!$(OTHER_ENDIAN)/m1 \
21438 + m2a=!m2a $(OTHER_ENDIAN)/m2a=!$(OTHER_ENDIAN)/m2a \
21439 + m2a-nofpu=!m2a-nofpu $(OTHER_ENDIAN)/m2a-nofpu=!$(OTHER_ENDIAN)/m2a-nofpu \
21440 + m2a-single-only=!m2a-single-only $(OTHER_ENDIAN)/m2a-single-only=!$(OTHER_ENDIAN)/m2a-single-only \
21441 + m2a-single=!m2a-single $(OTHER_ENDIAN)/m2a-single=!$(OTHER_ENDIAN)/m2a-single \
21442 + m2e=!m2e $(OTHER_ENDIAN)/m2e=!$(OTHER_ENDIAN)/m2e \
21443 + m2=!m2 $(OTHER_ENDIAN)/m2=!$(OTHER_ENDIAN)/m2 \
21444 + m3e=!m3e $(OTHER_ENDIAN)/m3e=!$(OTHER_ENDIAN)/m3e \
21445 + m3=!m3 $(OTHER_ENDIAN)/m3=!$(OTHER_ENDIAN)/m3 \
21446 + m4-nofpu=!m4-nofpu $(OTHER_ENDIAN)/m4-nofpu=!$(OTHER_ENDIAN)/m4-nofpu \
21447 + m4-single-only=!m4-single-only $(OTHER_ENDIAN)/m4-single-only=!$(OTHER_ENDIAN)/m4-single-only \
21448 + m4-single=!m4-single $(OTHER_ENDIAN)/m4-single=!$(OTHER_ENDIAN)/m4-single \
21449 + m4=!m4 $(OTHER_ENDIAN)/m4=!$(OTHER_ENDIAN)/m4 \
21450 + m4a-nofpu=!m4a-nofpu $(OTHER_ENDIAN)/m4a-nofpu=!$(OTHER_ENDIAN)/m4a-nofpu \
21451 + m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
21452 + m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
21453 + m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
21454 + m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
21455 + m5-32media=!m5-32media $(OTHER_ENDIAN)/m5-32media=!$(OTHER_ENDIAN)/m5-32media \
21456 + m5-32media-nofpu=!m5-32media-nofpu $(OTHER_ENDIAN)/m5-32media-nofpu=!$(OTHER_ENDIAN)/m5-32media-nofpu \
21457 + m5-compact=!m5-compact $(OTHER_ENDIAN)/m5-compact=!$(OTHER_ENDIAN)/m5-compact \
21458 + m5-compact-nofpu=!m5-compact-nofpu $(OTHER_ENDIAN)/m5-compact-nofpu=!$(OTHER_ENDIAN)/m5-compact-nofpu \
21459 + m5-64media=!m5-64media $(OTHER_ENDIAN)/m5-64media=!$(OTHER_ENDIAN)/m5-64media \
21460 + m5-64media-nofpu=!m5-64media-nofpu $(OTHER_ENDIAN)/m5-64media-nofpu=!$(OTHER_ENDIAN)/m5-64media-nofpu
21461
21462 LIBGCC = stmp-multilib
21463 INSTALL_LIBGCC = install-multilib
21464 diff -Nur a/gcc/config/sol2.h b/gcc/config/sol2.h
21465 --- a/gcc/config/sol2.h 2008-09-09 18:17:37.000000000 +0200
21466 +++ b/gcc/config/sol2.h 2010-01-25 09:50:29.075687537 +0100
21467 @@ -123,12 +123,12 @@
21468 %{YP,*} \
21469 %{R*} \
21470 %{compat-bsd: \
21471 - %{!YP,*:%{p|pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
21472 - %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
21473 - -R /usr/ucblib} \
21474 + %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
21475 + %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \
21476 + -R %R/usr/ucblib} \
21477 %{!compat-bsd: \
21478 - %{!YP,*:%{p|pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
21479 - %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}"
21480 + %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
21481 + %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib}}}}"
21482
21483 #undef LINK_ARCH32_SPEC
21484 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
21485 diff -Nur a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
21486 --- a/gcc/config/sparc/linux64.h 2009-02-20 16:20:38.000000000 +0100
21487 +++ b/gcc/config/sparc/linux64.h 2010-01-25 09:50:29.075687537 +0100
21488 @@ -40,10 +40,15 @@
21489 in a Medium/Low code model environment. */
21490
21491 #undef TARGET_DEFAULT
21492 +#ifdef BIARCH_32BIT_DEFAULT
21493 +#define TARGET_DEFAULT \
21494 + (MASK_APP_REGS + MASK_FPU)
21495 +#else
21496 #define TARGET_DEFAULT \
21497 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
21498 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
21499 #endif
21500 +#endif
21501
21502 /* This must be v9a not just v9 because by default we enable
21503 -mvis. */
21504 diff -Nur a/gcc/config/sparc/sol2-bi.h b/gcc/config/sparc/sol2-bi.h
21505 --- a/gcc/config/sparc/sol2-bi.h 2007-10-19 06:29:38.000000000 +0200
21506 +++ b/gcc/config/sparc/sol2-bi.h 2010-01-25 09:50:29.075687537 +0100
21507 @@ -172,12 +172,12 @@
21508 %{YP,*} \
21509 %{R*} \
21510 %{compat-bsd: \
21511 - %{!YP,*:%{p|pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
21512 - %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
21513 - -R /usr/ucblib/sparcv9} \
21514 + %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
21515 + %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9}}} \
21516 + -R %R/usr/ucblib/sparcv9} \
21517 %{!compat-bsd: \
21518 - %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
21519 - %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
21520 + %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
21521 + %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9}}}}"
21522
21523 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
21524
21525 diff -Nur a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
21526 --- a/gcc/config/sparc/sparc.c 2009-02-20 16:20:38.000000000 +0100
21527 +++ b/gcc/config/sparc/sparc.c 2010-01-25 09:50:29.075687537 +0100
21528 @@ -6120,7 +6120,7 @@
21529 sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
21530 {
21531 const char *qpfunc;
21532 - rtx slot0, slot1, result, tem, tem2;
21533 + rtx slot0, slot1, result, tem, tem2, libfunc;
21534 enum machine_mode mode;
21535 enum rtx_code new_comparison;
21536
21537 @@ -6183,7 +6183,8 @@
21538 emit_move_insn (slot1, y);
21539 }
21540
21541 - emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), LCT_NORMAL,
21542 + libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
21543 + emit_library_call (libfunc, LCT_NORMAL,
21544 DImode, 2,
21545 XEXP (slot0, 0), Pmode,
21546 XEXP (slot1, 0), Pmode);
21547 @@ -6191,7 +6192,8 @@
21548 }
21549 else
21550 {
21551 - emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), LCT_NORMAL,
21552 + libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
21553 + emit_library_call (libfunc, LCT_NORMAL,
21554 SImode, 2,
21555 x, TFmode, y, TFmode);
21556 mode = SImode;
21557 @@ -6202,7 +6204,7 @@
21558 register so reload doesn't clobber the value if it needs
21559 the return register for a spill reg. */
21560 result = gen_reg_rtx (mode);
21561 - emit_move_insn (result, hard_libcall_value (mode));
21562 + emit_move_insn (result, hard_libcall_value (mode, libfunc));
21563
21564 switch (comparison)
21565 {
21566 diff -Nur a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
21567 --- a/gcc/config/spu/spu.h 2009-04-24 00:50:16.000000000 +0200
21568 +++ b/gcc/config/spu/spu.h 2010-01-25 09:50:29.085687411 +0100
21569 @@ -270,7 +270,8 @@
21570
21571 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LINK_REGISTER_REGNUM)
21572
21573 -#define ARG_POINTER_CFA_OFFSET(FNDECL) (-STACK_POINTER_OFFSET)
21574 +#define ARG_POINTER_CFA_OFFSET(FNDECL) \
21575 + (crtl->args.pretend_args_size - STACK_POINTER_OFFSET)
21576
21577 \f
21578 /* Stack Checking */
21579 diff -Nur a/gcc/config/t-eglibc b/gcc/config/t-eglibc
21580 --- a/gcc/config/t-eglibc 1970-01-01 01:00:00.000000000 +0100
21581 +++ b/gcc/config/t-eglibc 2010-01-25 09:50:29.085687411 +0100
21582 @@ -0,0 +1,25 @@
21583 +# multilibs -*- mode:Makefile -*-
21584 +
21585 +MULTILIB_EXCEPTIONS :=
21586 +MULTILIB_MATCHES :=
21587 +MULTILIB_ALIASES :=
21588 +
21589 +# For all items in EGLIBC_CONFIGS except for the last one
21590 +# do $1. For the last one do $2. The items are separated with ",".
21591 +EGLIBC_AWK = $(shell echo $(EGLIBC_CONFIGS) | $(AWK) \
21592 + '{ \
21593 + N=split ($$0, configs, ","); \
21594 + for (i = 1; i < N; ++i) $1; \
21595 + $2; \
21596 + }')
21597 +
21598 +MULTILIB_OPTIONS := $(call EGLIBC_AWK, \
21599 + printf ("feglibc=%s/", configs[i]), \
21600 + printf ("feglibc=%s\n", configs[i]))
21601 +MULTILIB_DIRNAMES := $(call EGLIBC_AWK, \
21602 + printf ("%s ", configs[i]), \
21603 + printf ("%s\n", configs[i]))
21604 +MULTILIB_OSDIRNAMES := $(call EGLIBC_AWK, \
21605 + printf ("feglibc.%s=!%s ", configs[i], configs[i]), \
21606 + printf ("feglibc.%s=!%s\n", configs[i], configs[i]))
21607 +
21608 diff -Nur a/gcc/config/t-sysroot-suffix b/gcc/config/t-sysroot-suffix
21609 --- a/gcc/config/t-sysroot-suffix 1970-01-01 01:00:00.000000000 +0100
21610 +++ b/gcc/config/t-sysroot-suffix 2010-01-25 09:50:29.085687411 +0100
21611 @@ -0,0 +1,7 @@
21612 +# Generate SYSROOT_SUFFIX_SPEC from MULTILIB_OSDIRNAMES
21613 +
21614 +sysroot-suffix.h: $(srcdir)/config/print-sysroot-suffix.sh
21615 + $(SHELL) $(srcdir)/config/print-sysroot-suffix.sh \
21616 + "$(MULTILIB_OSDIRNAMES)" "$(MULTILIB_OPTIONS)" \
21617 + "$(MULTILIB_MATCHES)" "$(MULTILIB_ALIASES)" > tmp-sysroot-suffix.h
21618 + mv tmp-sysroot-suffix.h $@
21619 diff -Nur a/gcc/config/vx-common.h b/gcc/config/vx-common.h
21620 --- a/gcc/config/vx-common.h 2009-02-20 16:20:38.000000000 +0100
21621 +++ b/gcc/config/vx-common.h 2010-01-25 09:50:29.085687411 +0100
21622 @@ -92,3 +92,6 @@
21623 /* We occasionally need to distinguish between the VxWorks variants. */
21624 #define VXWORKS_KIND_NORMAL 1
21625 #define VXWORKS_KIND_AE 2
21626 +
21627 +/* Enable get_feature license checking. */
21628 +#define TARGET_FLEXLM
21629 diff -Nur a/gcc/config.gcc b/gcc/config.gcc
21630 --- a/gcc/config.gcc 2009-04-17 13:58:41.000000000 +0200
21631 +++ b/gcc/config.gcc 2010-01-25 09:50:29.085687411 +0100
21632 @@ -721,6 +721,28 @@
21633 need_64bit_hwint=yes
21634 # The EABI requires the use of __cxa_atexit.
21635 default_use_cxa_atexit=yes
21636 + case ${target} in
21637 + arm-wrs-linux-gnueabi)
21638 + tm_file="$tm_file arm/wrs-linux.h"
21639 + tmake_file="$tmake_file arm/t-wrs-linux"
21640 + tm_defines="$tm_defines TARGET_FLEXLM"
21641 + ;;
21642 + arm-montavista*-linux-gnueabi)
21643 + tm_file="$tm_file arm/montavista-linux.h"
21644 + tmake_file="$tmake_file arm/t-montavista-linux"
21645 + ;;
21646 + *)
21647 + if test x$enable_extra_asa_multilibs = xyes; then
21648 + tmake_file="${tmake_file} arm/t-asa"
21649 + elif test x$enable_extra_sgxx_multilibs = xyes; then
21650 + tmake_file="${tmake_file} arm/t-cs-linux"
21651 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21652 + tmake_file="${tmake_file} arm/t-cs-linux-lite"
21653 + fi
21654 + tm_file="$tm_file ./sysroot-suffix.h"
21655 + tmake_file="$tmake_file t-sysroot-suffix"
21656 + ;;
21657 + esac
21658 ;;
21659 *)
21660 tmake_file="$tmake_file arm/t-linux"
21661 @@ -742,6 +764,13 @@
21662 need_64bit_hwint=yes
21663 # The EABI requires the use of __cxa_atexit.
21664 default_use_cxa_atexit=yes
21665 + if test x$enable_extra_sgxx_multilibs = xyes; then
21666 + tmake_file="${tmake_file} arm/t-cs-uclinux-eabi"
21667 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21668 + tmake_file="${tmake_file} arm/t-cs-uclinux-eabi"
21669 + fi
21670 + tm_file="$tm_file ./sysroot-suffix.h"
21671 + tmake_file="$tmake_file t-sysroot-suffix"
21672 esac
21673 tm_file="$tm_file arm/aout.h arm/arm.h"
21674 tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
21675 @@ -762,8 +791,14 @@
21676 case ${target} in
21677 arm*-*-eabi*)
21678 tm_file="$tm_file arm/eabi.h"
21679 + tm_file="${tm_file} arm/nocrt0.h"
21680 tmake_file="${tmake_file} arm/t-bpabi"
21681 extra_options="${extra_options} arm/eabi.opt"
21682 + if test x$enable_extra_sgxx_multilibs = xyes; then
21683 + tmake_file="${tmake_file} arm/t-cs-eabi"
21684 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21685 + tmake_file="${tmake_file} arm/t-cs-eabi-lite"
21686 + fi
21687 ;;
21688 arm*-*-symbianelf*)
21689 tm_file="${tm_file} arm/symbian.h"
21690 @@ -1088,7 +1123,7 @@
21691 tmake_file="${tmake_file} i386/t-linux64"
21692 need_64bit_hwint=yes
21693 case X"${with_cpu}" in
21694 - Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
21695 + Xgeneric|Xatom|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
21696 ;;
21697 X)
21698 if test x$with_cpu_64 = x; then
21699 @@ -1097,13 +1132,29 @@
21700 ;;
21701 *)
21702 echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
21703 - echo "generic core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2
21704 + echo "generic atom core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2
21705 exit 1
21706 ;;
21707 esac
21708 else
21709 tm_file="${tm_file} i386/linux.h"
21710 fi
21711 + case ${target} in
21712 + *-wrs-linux*)
21713 + tm_file="$tm_file i386/wrs-linux.h"
21714 + tmake_file="$tmake_file i386/t-wrs-linux"
21715 + extra_options="${extra_options} i386/wrs-linux.opt"
21716 + tm_defines="${tm_defines} TARGET_FLEXLM"
21717 + ;;
21718 + esac
21719 + if test x$enable_extra_sgxx_multilibs = xyes; then
21720 + tm_file="${tm_file} i386/cs-linux.h"
21721 + tmake_file="${tmake_file} i386/t-cs-linux"
21722 + extra_options="${extra_options} i386/cs-linux.opt"
21723 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21724 + tm_file="${tm_file} i386/cs-linux-lite.h"
21725 + tmake_file="${tmake_file} i386/t-cs-linux-lite"
21726 + fi
21727 ;;
21728 i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} i386/linux.h knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
21729 i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} i386/linux.h kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
21730 @@ -1202,7 +1253,7 @@
21731 # libgcc/configure.ac instead.
21732 need_64bit_hwint=yes
21733 case X"${with_cpu}" in
21734 - Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
21735 + Xgeneric|Xatom|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
21736 ;;
21737 X)
21738 if test x$with_cpu_64 = x; then
21739 @@ -1211,7 +1262,7 @@
21740 ;;
21741 *)
21742 echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
21743 - echo "generic core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2
21744 + echo "generic atom core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2
21745 exit 1
21746 ;;
21747 esac
21748 @@ -1566,6 +1617,7 @@
21749 tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
21750 ;;
21751 esac
21752 + tmake_file="$tmake_file mips/t-crtfm"
21753 gnu_ld=yes
21754 gas=yes
21755 test x$with_llsc != x || with_llsc=yes
21756 @@ -1579,8 +1631,28 @@
21757 ;;
21758 mipsisa32*)
21759 tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32"
21760 + ;;
21761 + mips-wrs-linux-gnu)
21762 + tmake_file="$tmake_file mips/t-linux64 mips/t-wrs-linux"
21763 + tm_file="$tm_file mips/linux64.h mips/octeon.h mips/wrs-linux.h"
21764 + tm_defines="$tm_defines TARGET_FLEXLM"
21765 + ;;
21766 + mips-montavista*-linux-gnu)
21767 + tmake_file="$tmake_file mips/t-linux64 mips/t-montavista-linux"
21768 + tm_file="$tm_file mips/linux64.h mips/octeon.h mips/montavista-linux.h"
21769 + ;;
21770 + *)
21771 + if test x$enable_extra_sgxx_multilibs = xyes; then
21772 + tmake_file="$tmake_file mips/t-sgxx-linux"
21773 + tm_file="$tm_file mips/cs-sgxx-linux.h"
21774 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21775 + tmake_file="$tmake_file mips/t-sgxxlite-linux"
21776 + tm_file="$tm_file mips/cs-sgxxlite-linux.h"
21777 + fi
21778 + ;;
21779 esac
21780 test x$with_llsc != x || with_llsc=yes
21781 + tmake_file="$tmake_file mips/t-crtfm"
21782 ;;
21783 mips*-*-openbsd*)
21784 tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_OBJECT OBSD_HAS_CORRECT_SPECS"
21785 @@ -1625,6 +1697,25 @@
21786 tm_defines="MIPS_ISA_DEFAULT=64 MIPS_ABI_DEFAULT=ABI_N32"
21787 ;;
21788 esac
21789 + if [ "$enable_sgxx_sde_multilibs" = "yes" ]; then
21790 + tm_file="$tm_file mips/sdemtk.h"
21791 + extra_options="$extra_options mips/sdemtk.opt"
21792 + tmake_file="$tmake_file mips/t-sgxx-sde"
21793 + # SourceryG++ is configured --with-arch=mips32r2.
21794 + tm_defines="MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32"
21795 + fi
21796 + ;;
21797 +mips64octeon*-wrs-elf*)
21798 + tm_file="elfos.h ${tm_file} mips/elf.h mips/octeon.h mips/octeon-elf.h"
21799 + tmake_file=mips/t-octeon-elf
21800 + tm_defines="MIPS_ABI_DEFAULT=ABI_EABI MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\" TARGET_FLEXLM"
21801 + default_use_cxa_atexit=no
21802 + ;;
21803 +mips64octeon*-montavista-elf*)
21804 + tm_file="elfos.h ${tm_file} mips/elf.h mips/octeon.h mips/octeon-elf.h"
21805 + tmake_file="mips/t-octeon-elf mips/t-montavista-elf"
21806 + tm_defines="MIPS_ABI_DEFAULT=ABI_EABI MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
21807 + default_use_cxa_atexit=no
21808 ;;
21809 mipsisa32-*-elf* | mipsisa32el-*-elf* | \
21810 mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \
21811 @@ -1796,6 +1887,10 @@
21812 tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h"
21813 extra_options="${extra_options} rs6000/sysv4.opt"
21814 tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
21815 + if test x$enable_powerpc_e500mc_elf = xyes; then
21816 + tm_file="${tm_file} rs6000/e500mc.h"
21817 + tmake_file="${tmake_file} rs6000/t-ppc-e500mc"
21818 + fi
21819 ;;
21820 powerpc-*-eabialtivec*)
21821 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h"
21822 @@ -1811,6 +1906,11 @@
21823 tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h"
21824 extra_options="${extra_options} rs6000/sysv4.opt"
21825 tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
21826 + if test x$enable_extra_sgxx_multilibs = xyes; then
21827 + tmake_file="${tmake_file} rs6000/t-cs-eabi"
21828 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21829 + tmake_file="${tmake_file} rs6000/t-cs-eabi-lite"
21830 + fi
21831 ;;
21832 powerpc-*-rtems*)
21833 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/rtems.h rtems.h"
21834 @@ -1853,6 +1953,26 @@
21835 if test x${enable_secureplt} = xyes; then
21836 tm_file="rs6000/secureplt.h ${tm_file}"
21837 fi
21838 + case ${target} in
21839 + powerpc-wrs-linux-gnu)
21840 + tm_file="$tm_file rs6000/wrs-linux.h rs6000/e500.h"
21841 + tmake_file="$tmake_file rs6000/t-wrs-linux"
21842 + tm_defines="$tm_defines TARGET_FLEXLM"
21843 + ;;
21844 + powerpc-montavista*-linux-gnu)
21845 + tm_file="$tm_file rs6000/montavista-linux.h"
21846 + tmake_file="$tmake_file rs6000/t-montavista-linux"
21847 + ;;
21848 + *)
21849 + if test x$enable_extra_sgxx_multilibs = xyes; then
21850 + tm_file="${tm_file} rs6000/e500.h"
21851 + tmake_file="$tmake_file rs6000/t-cs-linux"
21852 + elif test x$enable_extra_sgxxlite_multilibs = xyes; then
21853 + tm_file="${tm_file} rs6000/e500.h"
21854 + tmake_file="$tmake_file rs6000/t-cs-linux"
21855 + fi
21856 + ;;
21857 + esac
21858 ;;
21859 powerpc-*-gnu-gnualtivec*)
21860 tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h rs6000/gnu.h"
21861 @@ -2009,9 +2129,14 @@
21862 *) with_endian=big,little ;;
21863 esac
21864 fi
21865 + # TM_ENDIAN_CONFIG is used by t-sh to determine multilibs.
21866 + # First word : the default endian.
21867 + # Second word: the secondary endian (optional).
21868 case ${with_endian} in
21869 - big|little) tmake_file="${tmake_file} sh/t-1e" ;;
21870 - big,little|little,big) ;;
21871 + big) TM_ENDIAN_CONFIG=mb ;;
21872 + little) TM_ENDIAN_CONFIG=ml ;;
21873 + big,little) TM_ENDIAN_CONFIG="mb ml" ;;
21874 + little,big) TM_ENDIAN_CONFIG="ml mb" ;;
21875 *) echo "with_endian=${with_endian} not supported."; exit 1 ;;
21876 esac
21877 case ${with_endian} in
21878 @@ -2118,7 +2243,7 @@
21879 *) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
21880 esac
21881 sh_multilibs=${with_multilib_list}
21882 - if test x${sh_multilibs} = x ; then
21883 + if test "$sh_multilibs" = "default" ; then
21884 case ${target} in
21885 sh64-superh-linux* | \
21886 sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
21887 @@ -2134,28 +2259,43 @@
21888 fi
21889 target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
21890 tm_defines=${tm_defines}' SH_MULTILIB_CPU_DEFAULT=\"'`echo $sh_cpu_default|sed s/sh/m/`'\"'
21891 - sh_multilibs=`echo $sh_multilibs,$sh_cpu_default | sed -e 's/[ ,/][ ,]*/ /g' -e 's/ $//' -e 's/^m/sh/' -e 's/ m/ sh/g' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz-`
21892 + tm_defines="$tm_defines SUPPORT_`echo $sh_cpu_default | sed 's/^m/sh/' | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1"
21893 + sh_multilibs=`echo $sh_multilibs | sed -e 's/,/ /g' -e 's/^sh/m/i' -e 's/ sh/ m/gi' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz-`
21894 for sh_multilib in ${sh_multilibs}; do
21895 case ${sh_multilib} in
21896 - sh1 | sh2 | sh2e | sh3 | sh3e | \
21897 - sh4 | sh4-single | sh4-single-only | sh4-nofpu | sh4-300 |\
21898 - sh4a | sh4a-single | sh4a-single-only | sh4a-nofpu | sh4al | \
21899 - sh2a | sh2a-single | sh2a-single-only | sh2a-nofpu | \
21900 - sh5-64media | sh5-64media-nofpu | \
21901 - sh5-32media | sh5-32media-nofpu | \
21902 - sh5-compact | sh5-compact-nofpu)
21903 - tmake_file="${tmake_file} sh/t-mlib-${sh_multilib}"
21904 - tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1"
21905 - ;;
21906 + m1 | m2 | m2e | m3 | m3e | \
21907 + m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
21908 + m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
21909 + m2a | m2a-single | m2a-single-only | m2a-nofpu | \
21910 + m5-64media | m5-64media-nofpu | \
21911 + m5-32media | m5-32media-nofpu | \
21912 + m5-compact | m5-compact-nofpu)
21913 + # TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
21914 + # It is passed to MULTIILIB_OPTIONS verbatim.
21915 + TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
21916 + tm_defines="$tm_defines SUPPORT_`echo $sh_multilib | sed 's/^m/sh/' | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1"
21917 + ;;
21918 + \!*) # TM_MULTILIB_EXCEPTIONS_CONFIG is used by t-sh
21919 + # It is passed the MULTILIB_EXCEPTIONS verbatim.
21920 + TM_MULTILIB_EXCEPTIONS_CONFIG="${TM_MULTILIB_EXCEPTIONS_CONFIG} `echo $sh_multilib | sed 's/^!//'`" ;;
21921 *)
21922 echo "with_multilib_list=${sh_multilib} not supported."
21923 exit 1
21924 ;;
21925 esac
21926 done
21927 + TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
21928 if test x${enable_incomplete_targets} = xyes ; then
21929 tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1"
21930 fi
21931 + if test x$enable_extra_sgxxlite_multilibs = xyes \
21932 + || test x$enable_extra_sgxx_multilibs = xyes; then
21933 + # SG++ and Lite do not differ, as yet, so use the Lite files for both
21934 + tm_file="$tm_file sh/cs-sgxxlite-linux.h"
21935 + tmake_file="$tmake_file sh/t-sgxxlite-linux"
21936 + fi
21937 + tm_file="$tm_file ./sysroot-suffix.h"
21938 + tmake_file="$tmake_file t-sysroot-suffix"
21939 ;;
21940 sh-*-rtems*)
21941 tmake_file="sh/t-sh sh/t-elf t-rtems sh/t-rtems"
21942 @@ -2194,6 +2334,11 @@
21943 tm_file="${tm_file} sparc/linux.h"
21944 fi
21945 tmake_file="${tmake_file} sparc/t-crtfm"
21946 + case ${target} in
21947 + sparc-wrs-linux-gnu)
21948 + tm_defines="$tm_defines BIARCH_32BIT_DEFAULT TARGET_FLEXLM"
21949 + ;;
21950 + esac
21951 ;;
21952 sparc-*-rtems*)
21953 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h"
21954 @@ -2420,6 +2565,8 @@
21955 i[34567]86-*-* | x86_64-*-*)
21956 tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
21957 ;;
21958 +powerpc*-*-* | rs6000-*-*)
21959 + tm_file="${tm_file} rs6000/option-defaults.h"
21960 esac
21961
21962 # Support for --with-cpu and related options (and a few unrelated options,
21963 @@ -2646,8 +2793,8 @@
21964 | armv[23456] | armv2a | armv3m | armv4t | armv5t \
21965 | armv5te | armv6j |armv6k | armv6z | armv6zk | armv6-m \
21966 | armv7 | armv7-a | armv7-r | armv7-m \
21967 - | iwmmxt | ep9312)
21968 - # OK
21969 + | iwmmxt | ep9312 | marvell-f )
21970 + # OK
21971 ;;
21972 *)
21973 echo "Unknown arch used in --with-arch=$with_arch" 1>&2
21974 @@ -2668,7 +2815,10 @@
21975
21976 case "$with_fpu" in
21977 "" \
21978 - | fpa | fpe2 | fpe3 | maverick | vfp | vfp3 | neon )
21979 + | fpa | fpe2 | fpe3 | maverick \
21980 + | vfp | vfp3 | vfpv3 | vfpv3-fp16 | vfpv3-d16 \
21981 + | vfpv3-d16-fp16 | vfpv4 | vfpv4-d16 | fpv4-sp-d16 \
21982 + | neon | neon-fp16 | neon-vfpv4 )
21983 # OK
21984 ;;
21985 *)
21986 @@ -2805,7 +2955,7 @@
21987 esac
21988 # OK
21989 ;;
21990 - "" | amdfam10 | barcelona | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic)
21991 + "" | amdfam10 | barcelona | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | atom | generic)
21992 # OK
21993 ;;
21994 *)
21995 @@ -2817,7 +2967,7 @@
21996 ;;
21997
21998 mips*-*-*)
21999 - supported_defaults="abi arch float tune divide llsc mips-plt"
22000 + supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64 divide llsc mips-plt"
22001
22002 case ${with_float} in
22003 "" | soft | hard)
22004 @@ -2882,12 +3032,20 @@
22005 ;;
22006
22007 powerpc*-*-* | rs6000-*-*)
22008 - supported_defaults="cpu float tune"
22009 + supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
22010
22011 - for which in cpu tune; do
22012 + for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
22013 eval "val=\$with_$which"
22014 case ${val} in
22015 default32 | default64)
22016 + case $which in
22017 + cpu | tune)
22018 + ;;
22019 + *)
22020 + echo "$val only valid for --with-cpu and --with-tune." 1>&2
22021 + exit 1
22022 + ;;
22023 + esac
22024 with_which="with_$which"
22025 eval $with_which=
22026 ;;
22027 @@ -3133,6 +3291,22 @@
22028 ;;
22029 esac
22030
22031 +case ${target} in
22032 + *-eglibc-*-*)
22033 + tmake_file="${tmake_file} t-eglibc"
22034 +
22035 + case ${target} in
22036 + arm-*)
22037 + # ARM already includes below.
22038 + ;;
22039 + *)
22040 + tmake_file="${tmake_file} t-sysroot-suffix"
22041 + tm_file="${tm_file} ./sysroot-suffix.h"
22042 + ;;
22043 + esac
22044 + ;;
22045 +esac
22046 +
22047 t=
22048 all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc mips-plt"
22049 for option in $all_defaults
22050 diff -Nur a/gcc/config.in b/gcc/config.in
22051 --- a/gcc/config.in 2009-07-22 09:43:59.000000000 +0200
22052 +++ b/gcc/config.in 2010-01-25 09:50:29.085687411 +0100
22053 @@ -12,6 +12,18 @@
22054 #endif
22055
22056
22057 +/* Required license feature */
22058 +#ifndef USED_FOR_TARGET
22059 +#undef CSL_LICENSE_FEATURE
22060 +#endif
22061 +
22062 +
22063 +/* Required license version */
22064 +#ifndef USED_FOR_TARGET
22065 +#undef CSL_LICENSE_VERSION
22066 +#endif
22067 +
22068 +
22069 /* Define to enable the use of a default assembler. */
22070 #ifndef USED_FOR_TARGET
22071 #undef DEFAULT_ASSEMBLER
22072 @@ -108,6 +120,12 @@
22073 #endif
22074
22075
22076 +/* Define to warn for use of native system header directories */
22077 +#ifndef USED_FOR_TARGET
22078 +#undef ENABLE_POISON_SYSTEM_DIRECTORIES
22079 +#endif
22080 +
22081 +
22082 /* Define if you want all operations on RTL (the basic data structure of the
22083 optimizer and back end) to be checked for dynamic type safety at runtime.
22084 This is quite expensive. */
22085 @@ -821,6 +839,13 @@
22086 #endif
22087
22088
22089 +/* Define if your assembler supports specifying the alignment of objects
22090 + allocated using the GAS .comm command. */
22091 +#ifndef USED_FOR_TARGET
22092 +#undef HAVE_GAS_ALIGNED_COMM
22093 +#endif
22094 +
22095 +
22096 /* Define if your assembler supports .balign and .p2align. */
22097 #ifndef USED_FOR_TARGET
22098 #undef HAVE_GAS_BALIGN_AND_P2ALIGN
22099 diff -Nur a/gcc/configure b/gcc/configure
22100 --- a/gcc/configure 2009-03-24 18:46:03.000000000 +0100
22101 +++ b/gcc/configure 2010-01-25 09:50:29.085687411 +0100
22102 @@ -458,7 +458,7 @@
22103 # include <unistd.h>
22104 #endif"
22105
22106 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS'
22107 +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical licensedir build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR EGLIBC_CONFIGS CONFIGURE_SPECS onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC STMP_FIXPROTO collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file TM_ENDIAN_CONFIG TM_MULTILIB_CONFIG TM_MULTILIB_EXCEPTIONS_CONFIG extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS'
22108 ac_subst_files='language_hooks'
22109 ac_pwd=`pwd`
22110
22111 @@ -1084,10 +1084,17 @@
22112 --enable-version-specific-runtime-libs
22113 specify that runtime libraries should be
22114 installed in a compiler-specific directory
22115 + --enable-poison-system-directories
22116 + warn for use of native system header directories
22117
22118 Optional Packages:
22119 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
22120 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
22121 + --with-csl-license-version=VERSION
22122 + Use VERSION to communicate with the license manager
22123 + --with-license the path to the installed license component
22124 + --with-csl-license-feature=FEATURE
22125 + Use FEATURE to communicate with the license manager
22126 --with-build-libsubdir=DIR Directory where to find libraries for build system
22127 --with-local-prefix=DIR specifies directory to put local include
22128 --with-gxx-include-dir=DIR
22129 @@ -1105,8 +1112,12 @@
22130 --with-build-sysroot=sysroot
22131 use sysroot as the system root during the build
22132 --with-sysroot=DIR Search for usr/lib, usr/include, et al, within DIR.
22133 + --with-eglibc-configs=CONFIGS
22134 + build multilibs for these EGLIBC configurations
22135 + --with-specs=SPECS add SPECS to driver command-line processing
22136 --with-pkgversion=PKG Use PKG in the version string in place of "GCC"
22137 --with-bugurl=URL Direct users to URL to report a bug
22138 + --with-multilib-list Select multilibs (SH only)
22139 --with-gnu-ld assume the C compiler uses GNU ld default=no
22140 --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
22141 --without-libiconv-prefix don't search for libiconv in includedir and libdir
22142 @@ -1724,6 +1735,73 @@
22143
22144
22145
22146 +
22147 +
22148 +# Check whether --with-csl-license-version or --without-csl-license-version was given.
22149 +if test "${with_csl_license_version+set}" = set; then
22150 + withval="$with_csl_license_version"
22151 + case "$withval" in
22152 + (yes) { { echo "$as_me:$LINENO: error: license version not specified" >&5
22153 +echo "$as_me: error: license version not specified" >&2;}
22154 + { (exit 1); exit 1; }; } ;;
22155 + (no) CSL_LICENSE_VERSION="" ;;
22156 + (*) CSL_LICENSE_VERSION="$withval" ;;
22157 + esac
22158 +else
22159 + CSL_LICENSE_VERSION=""
22160 +
22161 +fi;
22162 + if test x"$CSL_LICENSE_VERSION" != x; then
22163 +
22164 +cat >>confdefs.h <<_ACEOF
22165 +#define CSL_LICENSE_VERSION "$CSL_LICENSE_VERSION"
22166 +_ACEOF
22167 +
22168 + fi
22169 +
22170 +
22171 +
22172 +# Check whether --with-license or --without-license was given.
22173 +if test "${with_license+set}" = set; then
22174 + withval="$with_license"
22175 + case "$withval" in
22176 + (yes) { { echo "$as_me:$LINENO: error: license not specified" >&5
22177 +echo "$as_me: error: license not specified" >&2;}
22178 + { (exit 1); exit 1; }; } ;;
22179 + (no) with_license= ;;
22180 + (*) ;;
22181 + esac
22182 +else
22183 + with_license=
22184 +fi;
22185 + licensedir=$with_license
22186 +
22187 +
22188 +
22189 +
22190 +# Check whether --with-csl-license-feature or --without-csl-license-feature was given.
22191 +if test "${with_csl_license_feature+set}" = set; then
22192 + withval="$with_csl_license_feature"
22193 + case "$withval" in
22194 + (yes) { { echo "$as_me:$LINENO: error: license feature not specified" >&5
22195 +echo "$as_me: error: license feature not specified" >&2;}
22196 + { (exit 1); exit 1; }; } ;;
22197 + (no) CSL_LICENSE_FEATURE="" ;;
22198 + (*) CSL_LICENSE_FEATURE="$withval" ;;
22199 + esac
22200 +else
22201 + CSL_LICENSE_FEATURE=""
22202 +
22203 +fi;
22204 + if test x"$CSL_LICENSE_FEATURE" != x; then
22205 +
22206 +cat >>confdefs.h <<_ACEOF
22207 +#define CSL_LICENSE_FEATURE "$CSL_LICENSE_FEATURE"
22208 +_ACEOF
22209 +
22210 + fi
22211 +
22212 +
22213 # Determine the target- and build-specific subdirectories
22214
22215 # post-stage1 host modules use a different CC_FOR_BUILD so, in order to
22216 @@ -8042,6 +8120,28 @@
22217
22218
22219
22220 +
22221 +# Check whether --with-eglibc-configs or --without-eglibc-configs was given.
22222 +if test "${with_eglibc_configs+set}" = set; then
22223 + withval="$with_eglibc_configs"
22224 + EGLIBC_CONFIGS=$withval
22225 +else
22226 + EGLIBC_CONFIGS=
22227 +
22228 +fi;
22229 +
22230 +
22231 +
22232 +# Check whether --with-specs or --without-specs was given.
22233 +if test "${with_specs+set}" = set; then
22234 + withval="$with_specs"
22235 + CONFIGURE_SPECS=$withval
22236 +else
22237 + CONFIGURE_SPECS=
22238 +
22239 +fi;
22240 +
22241 +
22242 # Build with intermodule optimisations
22243 # Check whether --enable-intermodule or --disable-intermodule was given.
22244 if test "${enable_intermodule+set}" = set; then
22245 @@ -8137,6 +8237,15 @@
22246
22247
22248
22249 +
22250 +# Check whether --with-multilib-list or --without-multilib-list was given.
22251 +if test "${with_multilib_list+set}" = set; then
22252 + withval="$with_multilib_list"
22253 + :
22254 +else
22255 + with_multilib_list=default
22256 +fi;
22257 +
22258 # -------------------------
22259 # Checks for other programs
22260 # -------------------------
22261 @@ -14509,13 +14618,13 @@
22262 else
22263 lt_cv_nm_interface="BSD nm"
22264 echo "int some_variable = 0;" > conftest.$ac_ext
22265 - (eval echo "\"\$as_me:14512: $ac_compile\"" >&5)
22266 + (eval echo "\"\$as_me:14621: $ac_compile\"" >&5)
22267 (eval "$ac_compile" 2>conftest.err)
22268 cat conftest.err >&5
22269 - (eval echo "\"\$as_me:14515: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
22270 + (eval echo "\"\$as_me:14624: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
22271 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
22272 cat conftest.err >&5
22273 - (eval echo "\"\$as_me:14518: output\"" >&5)
22274 + (eval echo "\"\$as_me:14627: output\"" >&5)
22275 cat conftest.out >&5
22276 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
22277 lt_cv_nm_interface="MS dumpbin"
22278 @@ -15672,7 +15781,7 @@
22279 ;;
22280 *-*-irix6*)
22281 # Find out which ABI we are using.
22282 - echo '#line 15675 "configure"' > conftest.$ac_ext
22283 + echo '#line 15784 "configure"' > conftest.$ac_ext
22284 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
22285 (eval $ac_compile) 2>&5
22286 ac_status=$?
22287 @@ -16971,11 +17080,11 @@
22288 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
22289 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
22290 -e 's:$: $lt_compiler_flag:'`
22291 - (eval echo "\"\$as_me:16974: $lt_compile\"" >&5)
22292 + (eval echo "\"\$as_me:17083: $lt_compile\"" >&5)
22293 (eval "$lt_compile" 2>conftest.err)
22294 ac_status=$?
22295 cat conftest.err >&5
22296 - echo "$as_me:16978: \$? = $ac_status" >&5
22297 + echo "$as_me:17087: \$? = $ac_status" >&5
22298 if (exit $ac_status) && test -s "$ac_outfile"; then
22299 # The compiler can only warn and ignore the option if not recognized
22300 # So say no if there are warnings other than the usual output.
22301 @@ -17310,11 +17419,11 @@
22302 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
22303 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
22304 -e 's:$: $lt_compiler_flag:'`
22305 - (eval echo "\"\$as_me:17313: $lt_compile\"" >&5)
22306 + (eval echo "\"\$as_me:17422: $lt_compile\"" >&5)
22307 (eval "$lt_compile" 2>conftest.err)
22308 ac_status=$?
22309 cat conftest.err >&5
22310 - echo "$as_me:17317: \$? = $ac_status" >&5
22311 + echo "$as_me:17426: \$? = $ac_status" >&5
22312 if (exit $ac_status) && test -s "$ac_outfile"; then
22313 # The compiler can only warn and ignore the option if not recognized
22314 # So say no if there are warnings other than the usual output.
22315 @@ -17415,11 +17524,11 @@
22316 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
22317 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
22318 -e 's:$: $lt_compiler_flag:'`
22319 - (eval echo "\"\$as_me:17418: $lt_compile\"" >&5)
22320 + (eval echo "\"\$as_me:17527: $lt_compile\"" >&5)
22321 (eval "$lt_compile" 2>out/conftest.err)
22322 ac_status=$?
22323 cat out/conftest.err >&5
22324 - echo "$as_me:17422: \$? = $ac_status" >&5
22325 + echo "$as_me:17531: \$? = $ac_status" >&5
22326 if (exit $ac_status) && test -s out/conftest2.$ac_objext
22327 then
22328 # The compiler can only warn and ignore the option if not recognized
22329 @@ -17470,11 +17579,11 @@
22330 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
22331 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
22332 -e 's:$: $lt_compiler_flag:'`
22333 - (eval echo "\"\$as_me:17473: $lt_compile\"" >&5)
22334 + (eval echo "\"\$as_me:17582: $lt_compile\"" >&5)
22335 (eval "$lt_compile" 2>out/conftest.err)
22336 ac_status=$?
22337 cat out/conftest.err >&5
22338 - echo "$as_me:17477: \$? = $ac_status" >&5
22339 + echo "$as_me:17586: \$? = $ac_status" >&5
22340 if (exit $ac_status) && test -s out/conftest2.$ac_objext
22341 then
22342 # The compiler can only warn and ignore the option if not recognized
22343 @@ -20282,7 +20391,7 @@
22344 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
22345 lt_status=$lt_dlunknown
22346 cat > conftest.$ac_ext <<_LT_EOF
22347 -#line 20285 "configure"
22348 +#line 20394 "configure"
22349 #include "confdefs.h"
22350
22351 #if HAVE_DLFCN_H
22352 @@ -20378,7 +20487,7 @@
22353 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
22354 lt_status=$lt_dlunknown
22355 cat > conftest.$ac_ext <<_LT_EOF
22356 -#line 20381 "configure"
22357 +#line 20490 "configure"
22358 #include "confdefs.h"
22359
22360 #if HAVE_DLFCN_H
22361 @@ -22108,6 +22217,22 @@
22362 tls_first_minor=16
22363 tls_as_opt='-32 --fatal-warnings'
22364 ;;
22365 + m68k-*-*)
22366 + conftest_s='
22367 + .section .tdata,"awT",@progbits
22368 +x:
22369 + .word 2
22370 + .text
22371 +foo:
22372 + move.l x@TLSGD(%a5),%a0
22373 + move.l x@TLSLDM(%a5),%a0
22374 + move.l x@TLSLDO(%a5),%a0
22375 + move.l x@TLSIE(%a5),%a0
22376 + move.l x@TLSLE(%a5),%a0'
22377 + tls_first_major=2
22378 + tls_first_minor=19
22379 + tls_as_opt='--fatal-warnings'
22380 + ;;
22381 powerpc-*-*)
22382 conftest_s='
22383 .section ".tdata","awT",@progbits
22384 @@ -22739,6 +22864,44 @@
22385 i[34567]86-*-* | x86_64-*-*)
22386 case $target_os in
22387 cygwin* | pe | mingw32*)
22388 + # Recent binutils allows the three-operand form of ".comm" on PE. This
22389 + # definition is used unconditionally to initialise the default state of
22390 + # the target option variable that governs usage of the feature.
22391 + echo "$as_me:$LINENO: checking assembler for .comm with alignment" >&5
22392 +echo $ECHO_N "checking assembler for .comm with alignment... $ECHO_C" >&6
22393 +if test "${gcc_cv_as_comm_has_align+set}" = set; then
22394 + echo $ECHO_N "(cached) $ECHO_C" >&6
22395 +else
22396 + gcc_cv_as_comm_has_align=no
22397 + if test $in_tree_gas = yes; then
22398 + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 52`
22399 + then gcc_cv_as_comm_has_align=yes
22400 +fi
22401 + elif test x$gcc_cv_as != x; then
22402 + echo '.comm foo,1,32' > conftest.s
22403 + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
22404 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22405 + (eval $ac_try) 2>&5
22406 + ac_status=$?
22407 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
22408 + (exit $ac_status); }; }
22409 + then
22410 + gcc_cv_as_comm_has_align=yes
22411 + else
22412 + echo "configure: failed program was" >&5
22413 + cat conftest.s >&5
22414 + fi
22415 + rm -f conftest.o conftest.s
22416 + fi
22417 +fi
22418 +echo "$as_me:$LINENO: result: $gcc_cv_as_comm_has_align" >&5
22419 +echo "${ECHO_T}$gcc_cv_as_comm_has_align" >&6
22420 +
22421 +
22422 +cat >>confdefs.h <<_ACEOF
22423 +#define HAVE_GAS_ALIGNED_COMM `if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`
22424 +_ACEOF
22425 +
22426 # Used for DWARF 2 in PE
22427 echo "$as_me:$LINENO: checking assembler for .secrel32 relocs" >&5
22428 echo $ECHO_N "checking assembler for .secrel32 relocs... $ECHO_C" >&6
22429 @@ -24711,6 +24874,21 @@
22430 fi;
22431
22432
22433 +# Check whether --enable-poison-system-directories or --disable-poison-system-directories was given.
22434 +if test "${enable_poison_system_directories+set}" = set; then
22435 + enableval="$enable_poison_system_directories"
22436 +
22437 +else
22438 + enable_poison_system_directories=no
22439 +fi;
22440 +if test "x${enable_poison_system_directories}" = "xyes"; then
22441 +
22442 +cat >>confdefs.h <<\_ACEOF
22443 +#define ENABLE_POISON_SYSTEM_DIRECTORIES 1
22444 +_ACEOF
22445 +
22446 +fi
22447 +
22448 # Substitute configuration variables
22449
22450
22451 @@ -25451,6 +25629,7 @@
22452 s,@target_vendor@,$target_vendor,;t t
22453 s,@target_os@,$target_os,;t t
22454 s,@target_noncanonical@,$target_noncanonical,;t t
22455 +s,@licensedir@,$licensedir,;t t
22456 s,@build_libsubdir@,$build_libsubdir,;t t
22457 s,@build_subdir@,$build_subdir,;t t
22458 s,@host_subdir@,$host_subdir,;t t
22459 @@ -25487,6 +25666,8 @@
22460 s,@TARGET_SYSTEM_ROOT@,$TARGET_SYSTEM_ROOT,;t t
22461 s,@TARGET_SYSTEM_ROOT_DEFINE@,$TARGET_SYSTEM_ROOT_DEFINE,;t t
22462 s,@CROSS_SYSTEM_HEADER_DIR@,$CROSS_SYSTEM_HEADER_DIR,;t t
22463 +s,@EGLIBC_CONFIGS@,$EGLIBC_CONFIGS,;t t
22464 +s,@CONFIGURE_SPECS@,$CONFIGURE_SPECS,;t t
22465 s,@onestep@,$onestep,;t t
22466 s,@PKGVERSION@,$PKGVERSION,;t t
22467 s,@REPORT_BUGS_TO@,$REPORT_BUGS_TO,;t t
22468 @@ -25606,6 +25787,9 @@
22469 s,@cpp_install_dir@,$cpp_install_dir,;t t
22470 s,@xmake_file@,$xmake_file,;t t
22471 s,@tmake_file@,$tmake_file,;t t
22472 +s,@TM_ENDIAN_CONFIG@,$TM_ENDIAN_CONFIG,;t t
22473 +s,@TM_MULTILIB_CONFIG@,$TM_MULTILIB_CONFIG,;t t
22474 +s,@TM_MULTILIB_EXCEPTIONS_CONFIG@,$TM_MULTILIB_EXCEPTIONS_CONFIG,;t t
22475 s,@extra_gcc_objs@,$extra_gcc_objs,;t t
22476 s,@extra_headers_list@,$extra_headers_list,;t t
22477 s,@extra_objs@,$extra_objs,;t t
22478 diff -Nur a/gcc/configure.ac b/gcc/configure.ac
22479 --- a/gcc/configure.ac 2009-03-24 18:46:03.000000000 +0100
22480 +++ b/gcc/configure.ac 2010-01-25 09:50:29.085687411 +0100
22481 @@ -39,6 +39,10 @@
22482 # Determine the noncanonical target name, for directory use.
22483 ACX_NONCANONICAL_TARGET
22484
22485 +CSL_AC_LICENSE_VERSION
22486 +CSL_AC_LICENSE
22487 +CSL_AC_LICENSE_FEATURE
22488 +
22489 # Determine the target- and build-specific subdirectories
22490 GCC_TOPLEV_SUBDIRS
22491
22492 @@ -770,6 +774,22 @@
22493 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
22494 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
22495
22496 +AC_ARG_WITH(eglibc-configs,
22497 + [AS_HELP_STRING([--with-eglibc-configs=CONFIGS],
22498 + [build multilibs for these EGLIBC configurations])],
22499 + [EGLIBC_CONFIGS=$withval],
22500 + [EGLIBC_CONFIGS=]
22501 +)
22502 +AC_SUBST(EGLIBC_CONFIGS)
22503 +
22504 +AC_ARG_WITH(specs,
22505 + [AS_HELP_STRING([--with-specs=SPECS],
22506 + [add SPECS to driver command-line processing])],
22507 + [CONFIGURE_SPECS=$withval],
22508 + [CONFIGURE_SPECS=]
22509 +)
22510 +AC_SUBST(CONFIGURE_SPECS)
22511 +
22512 # Build with intermodule optimisations
22513 AC_ARG_ENABLE(intermodule,
22514 [ --enable-intermodule build the compiler in one step],
22515 @@ -810,6 +830,11 @@
22516 AC_SUBST(docdir)
22517 AC_SUBST(htmldir)
22518
22519 +AC_ARG_WITH(multilib-list,
22520 +[ --with-multilib-list Select multilibs (SH only)],
22521 +:,
22522 +with_multilib_list=default)
22523 +
22524 # -------------------------
22525 # Checks for other programs
22526 # -------------------------
22527 @@ -2576,6 +2601,22 @@
22528 tls_first_minor=16
22529 tls_as_opt='-32 --fatal-warnings'
22530 ;;
22531 + m68k-*-*)
22532 + conftest_s='
22533 + .section .tdata,"awT",@progbits
22534 +x:
22535 + .word 2
22536 + .text
22537 +foo:
22538 + move.l x@TLSGD(%a5),%a0
22539 + move.l x@TLSLDM(%a5),%a0
22540 + move.l x@TLSLDO(%a5),%a0
22541 + move.l x@TLSIE(%a5),%a0
22542 + move.l x@TLSLE(%a5),%a0'
22543 + tls_first_major=2
22544 + tls_first_minor=19
22545 + tls_as_opt='--fatal-warnings'
22546 + ;;
22547 powerpc-*-*)
22548 conftest_s='
22549 .section ".tdata","awT",@progbits
22550 @@ -2944,6 +2985,15 @@
22551 changequote([,])dnl
22552 case $target_os in
22553 cygwin* | pe | mingw32*)
22554 + # Recent binutils allows the three-operand form of ".comm" on PE. This
22555 + # definition is used unconditionally to initialise the default state of
22556 + # the target option variable that governs usage of the feature.
22557 + gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align,
22558 + [2,19,52],,[.comm foo,1,32])
22559 + AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM,
22560 + [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`],
22561 + [Define if your assembler supports specifying the alignment
22562 + of objects allocated using the GAS .comm command.])
22563 # Used for DWARF 2 in PE
22564 gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
22565 gcc_cv_as_ix86_pe_secrel32,
22566 @@ -3891,6 +3941,16 @@
22567 htmldir='$(docdir)')
22568 AC_SUBST(htmldir)
22569
22570 +AC_ARG_ENABLE([poison-system-directories],
22571 + AS_HELP_STRING([--enable-poison-system-directories],
22572 + [warn for use of native system header directories]),,
22573 + [enable_poison_system_directories=no])
22574 +if test "x${enable_poison_system_directories}" = "xyes"; then
22575 + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
22576 + [1],
22577 + [Define to warn for use of native system header directories])
22578 +fi
22579 +
22580 # Substitute configuration variables
22581 AC_SUBST(subdirs)
22582 AC_SUBST(srcdir)
22583 @@ -3910,6 +3970,9 @@
22584 AC_SUBST(cpp_install_dir)
22585 AC_SUBST(xmake_file)
22586 AC_SUBST(tmake_file)
22587 +AC_SUBST(TM_ENDIAN_CONFIG)
22588 +AC_SUBST(TM_MULTILIB_CONFIG)
22589 +AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
22590 AC_SUBST(extra_gcc_objs)
22591 AC_SUBST(extra_headers_list)
22592 AC_SUBST(extra_objs)
22593 diff -Nur a/gcc/c.opt b/gcc/c.opt
22594 --- a/gcc/c.opt 2009-03-18 22:14:53.000000000 +0100
22595 +++ b/gcc/c.opt 2010-01-25 09:50:29.085687411 +0100
22596 @@ -716,6 +716,10 @@
22597 C ObjC C++ ObjC++
22598 Treat the input file as already preprocessed
22599
22600 +fremove-local-statics
22601 +C C++ Var(flag_remove_local_statics) Optimization
22602 +Convert function-local static variables to automatic variables when it is safe to do so
22603 +
22604 freplace-objc-classes
22605 ObjC ObjC++
22606 Used in Fix-and-Continue mode to indicate that object files may be swapped in at runtime
22607 diff -Nur a/gcc/c-opts.c b/gcc/c-opts.c
22608 --- a/gcc/c-opts.c 2009-02-18 03:16:03.000000000 +0100
22609 +++ b/gcc/c-opts.c 2010-01-25 09:50:29.095687705 +0100
22610 @@ -40,6 +40,7 @@
22611 #include "mkdeps.h"
22612 #include "target.h"
22613 #include "tm_p.h"
22614 +#include "c-tree.h" /* For c_cpp_error. */
22615
22616 #ifndef DOLLARS_IN_IDENTIFIERS
22617 # define DOLLARS_IN_IDENTIFIERS true
22618 @@ -201,6 +202,7 @@
22619 {
22620 static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
22621 unsigned int i, result;
22622 + struct cpp_callbacks *cb;
22623
22624 /* This is conditionalized only because that is the way the front
22625 ends used to do it. Maybe this should be unconditional? */
22626 @@ -216,6 +218,8 @@
22627
22628 parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
22629 ident_hash, line_table);
22630 + cb = cpp_get_callbacks (parse_in);
22631 + cb->error = c_cpp_error;
22632
22633 cpp_opts = cpp_get_options (parse_in);
22634 cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
22635 @@ -333,12 +337,12 @@
22636 or environment var dependency generation is used. */
22637 cpp_opts->deps.style = (code == OPT_M ? DEPS_SYSTEM: DEPS_USER);
22638 flag_no_output = 1;
22639 - cpp_opts->inhibit_warnings = 1;
22640 break;
22641
22642 case OPT_MD:
22643 case OPT_MMD:
22644 cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM: DEPS_USER);
22645 + cpp_opts->deps.need_preprocessor_output = true;
22646 deps_file = arg;
22647 break;
22648
22649 @@ -444,7 +448,6 @@
22650 break;
22651
22652 case OPT_Werror:
22653 - cpp_opts->warnings_are_errors = value;
22654 global_dc->warning_as_error_requested = value;
22655 break;
22656
22657 @@ -503,10 +506,6 @@
22658 warn_strict_null_sentinel = value;
22659 break;
22660
22661 - case OPT_Wsystem_headers:
22662 - cpp_opts->warn_system_headers = value;
22663 - break;
22664 -
22665 case OPT_Wtraditional:
22666 cpp_opts->warn_traditional = value;
22667 break;
22668 @@ -895,8 +894,6 @@
22669 c_common_post_options, so that a subsequent -Wno-endif-labels
22670 is not overridden. */
22671 case OPT_pedantic_errors:
22672 - cpp_opts->pedantic_errors = 1;
22673 - /* Fall through. */
22674 case OPT_pedantic:
22675 cpp_opts->pedantic = 1;
22676 cpp_opts->warn_endif_labels = 1;
22677 @@ -971,10 +968,6 @@
22678 flag_undef = 1;
22679 break;
22680
22681 - case OPT_w:
22682 - cpp_opts->inhibit_warnings = 1;
22683 - break;
22684 -
22685 case OPT_v:
22686 verbose = true;
22687 break;
22688 @@ -1159,10 +1152,6 @@
22689
22690 input_location = UNKNOWN_LOCATION;
22691
22692 - /* If an error has occurred in cpplib, note it so we fail
22693 - immediately. */
22694 - errorcount += cpp_errors (parse_in);
22695 -
22696 *pfilename = this_input_filename
22697 = cpp_read_main_file (parse_in, in_fnames[0]);
22698 /* Don't do any compilation or preprocessing if there is no input file. */
22699 @@ -1274,7 +1263,8 @@
22700 {
22701 FILE *deps_stream = NULL;
22702
22703 - if (cpp_opts->deps.style != DEPS_NONE)
22704 + /* Don't write the deps file if there are errors. */
22705 + if (cpp_opts->deps.style != DEPS_NONE && errorcount == 0)
22706 {
22707 /* If -M or -MM was seen without -MF, default output to the
22708 output stream. */
22709 @@ -1290,7 +1280,7 @@
22710
22711 /* For performance, avoid tearing down cpplib's internal structures
22712 with cpp_destroy (). */
22713 - errorcount += cpp_finish (parse_in, deps_stream);
22714 + cpp_finish (parse_in, deps_stream);
22715
22716 if (deps_stream && deps_stream != out_stream
22717 && (ferror (deps_stream) || fclose (deps_stream)))
22718 diff -Nur a/gcc/cp/class.c b/gcc/cp/class.c
22719 --- a/gcc/cp/class.c 2009-06-24 19:02:03.000000000 +0200
22720 +++ b/gcc/cp/class.c 2010-01-25 09:50:29.095687705 +0100
22721 @@ -6136,7 +6136,7 @@
22722 if (flags & tf_error)
22723 {
22724 error ("no matches converting function %qD to type %q#T",
22725 - DECL_NAME (OVL_FUNCTION (overload)),
22726 + DECL_NAME (OVL_CURRENT (overload)),
22727 target_type);
22728
22729 /* print_candidates expects a chain with the functions in
22730 @@ -6299,13 +6299,8 @@
22731 dependent on overload resolution. */
22732 gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
22733 || TREE_CODE (rhs) == COMPONENT_REF
22734 - || TREE_CODE (rhs) == COMPOUND_EXPR
22735 - || really_overloaded_fn (rhs));
22736 -
22737 - /* We don't overwrite rhs if it is an overloaded function.
22738 - Copying it would destroy the tree link. */
22739 - if (TREE_CODE (rhs) != OVERLOAD)
22740 - rhs = copy_node (rhs);
22741 + || really_overloaded_fn (rhs)
22742 + || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL));
22743
22744 /* This should really only be used when attempting to distinguish
22745 what sort of a pointer to function we have. For now, any
22746 @@ -6357,19 +6352,6 @@
22747 /*explicit_targs=*/NULL_TREE,
22748 access_path);
22749
22750 - case COMPOUND_EXPR:
22751 - TREE_OPERAND (rhs, 0)
22752 - = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
22753 - if (TREE_OPERAND (rhs, 0) == error_mark_node)
22754 - return error_mark_node;
22755 - TREE_OPERAND (rhs, 1)
22756 - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
22757 - if (TREE_OPERAND (rhs, 1) == error_mark_node)
22758 - return error_mark_node;
22759 -
22760 - TREE_TYPE (rhs) = lhstype;
22761 - return rhs;
22762 -
22763 case ADDR_EXPR:
22764 {
22765 if (PTRMEM_OK_P (rhs))
22766 diff -Nur a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
22767 --- a/gcc/cp/cp-tree.h 2009-07-13 08:06:27.000000000 +0200
22768 +++ b/gcc/cp/cp-tree.h 2010-01-25 09:50:29.095687705 +0100
22769 @@ -43,9 +43,6 @@
22770 #else
22771 #define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
22772 #endif
22773 -extern void cp_cpp_error (cpp_reader *, int,
22774 - const char *, va_list *)
22775 - ATTRIBUTE_GCC_CXXDIAG(3,0);
22776 #ifdef GCC_TOPLEV_H
22777 #error \
22778 In order for the format checking to accept the C++ front end diagnostic \
22779 diff -Nur a/gcc/cp/cvt.c b/gcc/cp/cvt.c
22780 --- a/gcc/cp/cvt.c 2009-04-23 13:13:57.000000000 +0200
22781 +++ b/gcc/cp/cvt.c 2010-01-25 09:50:29.095687705 +0100
22782 @@ -581,6 +581,7 @@
22783 tree e = expr;
22784 enum tree_code code = TREE_CODE (type);
22785 const char *invalid_conv_diag;
22786 + tree e1;
22787
22788 if (error_operand_p (e) || type == error_mark_node)
22789 return error_mark_node;
22790 @@ -629,6 +630,10 @@
22791 }
22792 }
22793
22794 + e1 = targetm.convert_to_type (type, e);
22795 + if (e1)
22796 + return e1;
22797 +
22798 if (code == VOID_TYPE && (convtype & CONV_STATIC))
22799 {
22800 e = convert_to_void (e, /*implicit=*/NULL, tf_warning_or_error);
22801 @@ -1231,11 +1236,18 @@
22802 tree
22803 type_promotes_to (tree type)
22804 {
22805 + tree promoted_type;
22806 +
22807 if (type == error_mark_node)
22808 return error_mark_node;
22809
22810 type = TYPE_MAIN_VARIANT (type);
22811
22812 + /* Check for promotions of target-defined types first. */
22813 + promoted_type = targetm.promoted_type (type);
22814 + if (promoted_type)
22815 + return promoted_type;
22816 +
22817 /* bool always promotes to int (not unsigned), even if it's the same
22818 size. */
22819 if (type == boolean_type_node)
22820 diff -Nur a/gcc/cp/decl2.c b/gcc/cp/decl2.c
22821 --- a/gcc/cp/decl2.c 2009-06-09 20:20:29.000000000 +0200
22822 +++ b/gcc/cp/decl2.c 2010-01-25 09:50:29.095687705 +0100
22823 @@ -1717,6 +1717,10 @@
22824 || (DECL_ASSEMBLER_NAME_SET_P (decl)
22825 && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
22826 return true;
22827 + /* Functions marked "dllexport" must be emitted so that they are
22828 + visible to other DLLs. */
22829 + if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
22830 + return true;
22831 /* Otherwise, DECL does not need to be emitted -- yet. A subsequent
22832 reference to DECL might cause it to be emitted later. */
22833 return false;
22834 @@ -3802,6 +3806,15 @@
22835 }
22836
22837 TREE_USED (decl) = 1;
22838 + if (current_function_decl != NULL_TREE
22839 + && (TREE_CODE (decl) == VAR_DECL
22840 + || TREE_CODE (decl) == PARM_DECL
22841 + || TREE_CODE (decl) == FUNCTION_DECL))
22842 + {
22843 + tree context = decl_function_context (decl);
22844 + if (context != NULL_TREE && context != current_function_decl)
22845 + DECL_NONLOCAL (decl) = 1;
22846 + }
22847 if (DECL_CLONED_FUNCTION_P (decl))
22848 TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
22849 if (TREE_CODE (decl) == FUNCTION_DECL
22850 diff -Nur a/gcc/cp/decl.c b/gcc/cp/decl.c
22851 --- a/gcc/cp/decl.c 2009-07-08 00:08:01.000000000 +0200
22852 +++ b/gcc/cp/decl.c 2010-01-25 09:50:29.095687705 +0100
22853 @@ -4515,7 +4515,7 @@
22854
22855 cp_apply_type_quals_to_decl (cp_type_quals (TREE_TYPE (decl)), decl);
22856
22857 - layout_decl (decl, 0);
22858 + relayout_decl (decl);
22859 }
22860 }
22861
22862 @@ -7620,6 +7620,7 @@
22863 bool parameter_pack_p = declarator? declarator->parameter_pack_p : false;
22864 bool set_no_warning = false;
22865 bool template_type_arg = false;
22866 + const char *errmsg;
22867
22868 signed_p = declspecs->specs[(int)ds_signed];
22869 unsigned_p = declspecs->specs[(int)ds_unsigned];
22870 @@ -8299,6 +8300,12 @@
22871 type_quals = TYPE_UNQUALIFIED;
22872 set_no_warning = true;
22873 }
22874 + errmsg = targetm.invalid_return_type (type);
22875 + if (errmsg)
22876 + {
22877 + error (errmsg);
22878 + type = integer_type_node;
22879 + }
22880
22881 /* Error about some types functions can't return. */
22882
22883 @@ -8841,8 +8848,13 @@
22884
22885 /* Replace the anonymous name with the real name everywhere. */
22886 for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
22887 - if (TYPE_NAME (t) == oldname)
22888 - TYPE_NAME (t) = decl;
22889 + {
22890 + if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
22891 + {
22892 + debug_hooks->set_name (t, decl);
22893 + TYPE_NAME (t) = decl;
22894 + }
22895 + }
22896
22897 if (TYPE_LANG_SPECIFIC (type))
22898 TYPE_WAS_ANONYMOUS (type) = 1;
22899 @@ -9679,6 +9691,7 @@
22900 tree type = NULL_TREE;
22901 tree init = TREE_PURPOSE (parm);
22902 tree decl = TREE_VALUE (parm);
22903 + const char *errmsg;
22904
22905 if (parm == void_list_node)
22906 break;
22907 @@ -9712,6 +9725,14 @@
22908 init = NULL_TREE;
22909 }
22910
22911 + if (type != error_mark_node
22912 + && (errmsg = targetm.invalid_parameter_type (type)))
22913 + {
22914 + error (errmsg);
22915 + type = error_mark_node;
22916 + TREE_TYPE (decl) = error_mark_node;
22917 + }
22918 +
22919 if (type != error_mark_node)
22920 {
22921 if (deprecated_state != DEPRECATED_SUPPRESS)
22922 diff -Nur a/gcc/cp/error.c b/gcc/cp/error.c
22923 --- a/gcc/cp/error.c 2009-07-11 00:31:34.000000000 +0200
22924 +++ b/gcc/cp/error.c 2010-01-25 09:50:29.095687705 +0100
22925 @@ -2667,39 +2667,6 @@
22926 #undef next_int
22927 }
22928 \f
22929 -/* Callback from cpp_error for PFILE to print diagnostics arising from
22930 - interpreting strings. The diagnostic is of type LEVEL; MSG is the
22931 - translated message and AP the arguments. */
22932 -
22933 -void
22934 -cp_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
22935 - const char *msg, va_list *ap)
22936 -{
22937 - diagnostic_info diagnostic;
22938 - diagnostic_t dlevel;
22939 - switch (level)
22940 - {
22941 - case CPP_DL_WARNING:
22942 - case CPP_DL_WARNING_SYSHDR:
22943 - dlevel = DK_WARNING;
22944 - break;
22945 - case CPP_DL_PEDWARN:
22946 - dlevel = DK_PEDWARN;
22947 - break;
22948 - case CPP_DL_ERROR:
22949 - dlevel = DK_ERROR;
22950 - break;
22951 - case CPP_DL_ICE:
22952 - dlevel = DK_ICE;
22953 - break;
22954 - default:
22955 - gcc_unreachable ();
22956 - }
22957 - diagnostic_set_info_translated (&diagnostic, msg, ap,
22958 - input_location, dlevel);
22959 - report_diagnostic (&diagnostic);
22960 -}
22961 -
22962 /* Warn about the use of C++0x features when appropriate. */
22963 void
22964 maybe_warn_cpp0x (const char* str)
22965 diff -Nur a/gcc/cp/except.c b/gcc/cp/except.c
22966 --- a/gcc/cp/except.c 2008-08-18 13:17:52.000000000 +0200
22967 +++ b/gcc/cp/except.c 2010-01-25 09:50:29.095687705 +0100
22968 @@ -146,14 +146,26 @@
22969 static tree
22970 build_eh_type_type (tree type)
22971 {
22972 - tree exp = eh_type_info (type);
22973 + bool is_ref = TREE_CODE (type) == REFERENCE_TYPE;
22974 + tree exp;
22975 +
22976 + if (is_ref)
22977 + type = TREE_TYPE (type);
22978 +
22979 + exp = eh_type_info (type);
22980
22981 if (!exp)
22982 return NULL;
22983
22984 mark_used (exp);
22985
22986 - return convert (ptr_type_node, build_address (exp));
22987 + exp = build_address (exp);
22988 +
22989 + if (is_ref)
22990 + exp = targetm.cxx.ttype_ref_encode (exp);
22991 +
22992 + exp = convert (ptr_type_node, exp);
22993 + return exp;
22994 }
22995
22996 tree
22997 @@ -495,6 +507,16 @@
22998 initialize_handler_parm (decl, exp);
22999 }
23000
23001 + /* Preserve the reference type on the exception, as this affects
23002 + derived-to-base conversions in catch matching. Only do this when
23003 + the ABI supports it, as originally this case was (incorrectly)
23004 + treated just as catching a pointer-to-class by value. */
23005 + if (targetm.cxx.ttype_ref_encode
23006 + && decl && TREE_CODE (type) == POINTER_TYPE
23007 + && CLASS_TYPE_P (TREE_TYPE (type))
23008 + && TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE)
23009 + type = build_reference_type (type);
23010 +
23011 return type;
23012 }
23013
23014 @@ -538,10 +560,20 @@
23015 raw_raises && TREE_VALUE (raw_raises);
23016 raw_raises = TREE_CHAIN (raw_raises))
23017 {
23018 - tree type = prepare_eh_type (TREE_VALUE (raw_raises));
23019 + tree orig_type = TREE_VALUE (raw_raises);
23020 + tree type = prepare_eh_type (orig_type);
23021 tree tinfo = eh_type_info (type);
23022
23023 mark_used (tinfo);
23024 + /* Preserve the reference type on the exception, as this affects
23025 + derived-to-base conversions in catch matching. Only do this when
23026 + the ABI supports it, as originally this case was (incorrectly)
23027 + treated just as catching a pointer-to-class by value. */
23028 + if (targetm.cxx.ttype_ref_encode
23029 + && TREE_CODE (orig_type) == REFERENCE_TYPE
23030 + && TREE_CODE (type) == POINTER_TYPE
23031 + && CLASS_TYPE_P (TREE_TYPE (type)))
23032 + type = build_reference_type (type);
23033 raises = tree_cons (NULL_TREE, type, raises);
23034 }
23035
23036 @@ -956,24 +988,40 @@
23037 static int
23038 can_convert_eh (tree to, tree from)
23039 {
23040 - to = non_reference (to);
23041 - from = non_reference (from);
23042 + bool to_ref = TREE_CODE (to) == REFERENCE_TYPE;
23043 + int depth = to_ref;
23044 + bool outer_const = true;
23045
23046 - if (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE)
23047 + if (to_ref)
23048 + to = TREE_TYPE (to);
23049 + from = non_reference (from);
23050 +
23051 + while (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE)
23052 {
23053 + unsigned to_quals, from_quals;
23054 +
23055 + depth++;
23056 +
23057 to = TREE_TYPE (to);
23058 from = TREE_TYPE (from);
23059 + to_quals = TYPE_QUALS (to);
23060 + from_quals = TYPE_QUALS (from);
23061
23062 - if (! at_least_as_qualified_p (to, from))
23063 + if ((from_quals & ~to_quals)
23064 + || (!outer_const && to_quals & ~from_quals))
23065 return 0;
23066 -
23067 - if (TREE_CODE (to) == VOID_TYPE)
23068 - return 1;
23069 -
23070 - /* Else fall through. */
23071 +
23072 + if (!(to_quals & TYPE_QUAL_CONST))
23073 + outer_const = false;
23074 }
23075
23076 - if (CLASS_TYPE_P (to) && CLASS_TYPE_P (from)
23077 + if (same_type_ignoring_top_level_qualifiers_p (from, to))
23078 + return 1;
23079 +
23080 + if (depth == to_ref + 1 && TREE_CODE (to) == VOID_TYPE)
23081 + return 1;
23082 +
23083 + if (depth < 2 && CLASS_TYPE_P (to) && CLASS_TYPE_P (from)
23084 && PUBLICLY_UNIQUELY_DERIVED_P (to, from))
23085 return 1;
23086
23087 diff -Nur a/gcc/cp/parser.c b/gcc/cp/parser.c
23088 --- a/gcc/cp/parser.c 2009-06-09 06:23:00.000000000 +0200
23089 +++ b/gcc/cp/parser.c 2010-01-25 09:50:29.105687718 +0100
23090 @@ -309,8 +309,7 @@
23091
23092 /* Subsequent preprocessor diagnostics should use compiler
23093 diagnostic functions to get the compiler source location. */
23094 - cpp_get_options (parse_in)->client_diagnostic = true;
23095 - cpp_get_callbacks (parse_in)->error = cp_cpp_error;
23096 + done_lexing = true;
23097
23098 gcc_assert (lexer->next_token->type != CPP_PURGED);
23099 return lexer;
23100 diff -Nur a/gcc/cp/rtti.c b/gcc/cp/rtti.c
23101 --- a/gcc/cp/rtti.c 2008-09-23 16:55:14.000000000 +0200
23102 +++ b/gcc/cp/rtti.c 2010-01-25 09:50:29.105687718 +0100
23103 @@ -393,6 +393,7 @@
23104 return d;
23105 }
23106
23107 + gcc_assert (TREE_CODE (type) != REFERENCE_TYPE);
23108 name = mangle_typeinfo_for_type (type);
23109
23110 d = IDENTIFIER_GLOBAL_VALUE (name);
23111 diff -Nur a/gcc/cp/semantics.c b/gcc/cp/semantics.c
23112 --- a/gcc/cp/semantics.c 2009-07-14 20:35:13.000000000 +0200
23113 +++ b/gcc/cp/semantics.c 2010-01-25 09:50:29.105687718 +0100
23114 @@ -1120,7 +1120,11 @@
23115 type = expand_start_catch_block (decl);
23116 HANDLER_TYPE (handler) = type;
23117 if (!processing_template_decl && type)
23118 - mark_used (eh_type_info (type));
23119 + {
23120 + if (TREE_CODE (type) == REFERENCE_TYPE)
23121 + type = TREE_TYPE (type);
23122 + mark_used (eh_type_info (type));
23123 + }
23124 }
23125
23126 /* Finish a handler, which may be given by HANDLER. The BLOCKs are
23127 @@ -3243,8 +3247,10 @@
23128
23129 /* If the user wants us to keep all inline functions, then mark
23130 this function as needed so that finish_file will make sure to
23131 - output it later. */
23132 - if (flag_keep_inline_functions && DECL_DECLARED_INLINE_P (fn))
23133 + output it later. Similarly, all dllexport'd functions must
23134 + be emitted; there may be callers in other DLLs. */
23135 + if ((flag_keep_inline_functions && DECL_DECLARED_INLINE_P (fn))
23136 + || lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn)))
23137 mark_needed (fn);
23138 }
23139
23140 diff -Nur a/gcc/cp/typeck.c b/gcc/cp/typeck.c
23141 --- a/gcc/cp/typeck.c 2009-07-13 08:06:27.000000000 +0200
23142 +++ b/gcc/cp/typeck.c 2010-01-25 09:50:29.105687718 +0100
23143 @@ -1707,10 +1707,14 @@
23144 tree
23145 default_conversion (tree exp)
23146 {
23147 + /* Check for target-specific promotions. */
23148 + tree promoted_type = targetm.promoted_type (TREE_TYPE (exp));
23149 + if (promoted_type)
23150 + exp = cp_convert (promoted_type, exp);
23151 /* Perform the integral promotions first so that bitfield
23152 expressions (which may promote to "int", even if the bitfield is
23153 declared "unsigned") are promoted correctly. */
23154 - if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (exp)))
23155 + else if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (exp)))
23156 exp = perform_integral_promotions (exp);
23157 /* Perform the other conversions. */
23158 exp = decay_conversion (exp);
23159 @@ -3389,6 +3393,25 @@
23160 return error_mark_node;
23161 }
23162
23163 + /* Issue warnings about peculiar, but valid, uses of NULL. */
23164 + if ((orig_op0 == null_node || orig_op1 == null_node)
23165 + /* It's reasonable to use pointer values as operands of &&
23166 + and ||, so NULL is no exception. */
23167 + && code != TRUTH_ANDIF_EXPR && code != TRUTH_ORIF_EXPR
23168 + && ( /* Both are NULL (or 0) and the operation was not a
23169 + comparison or a pointer subtraction. */
23170 + (null_ptr_cst_p (orig_op0) && null_ptr_cst_p (orig_op1)
23171 + && code != EQ_EXPR && code != NE_EXPR && code != MINUS_EXPR)
23172 + /* Or if one of OP0 or OP1 is neither a pointer nor NULL. */
23173 + || (!null_ptr_cst_p (orig_op0)
23174 + && !TYPE_PTR_P (type0) && !TYPE_PTR_TO_MEMBER_P (type0))
23175 + || (!null_ptr_cst_p (orig_op1)
23176 + && !TYPE_PTR_P (type1) && !TYPE_PTR_TO_MEMBER_P (type1)))
23177 + && (complain & tf_warning))
23178 + /* Some sort of arithmetic operation involving NULL was
23179 + performed. */
23180 + warning (OPT_Wpointer_arith, "NULL used in arithmetic");
23181 +
23182 switch (code)
23183 {
23184 case MINUS_EXPR:
23185 @@ -3979,25 +4002,6 @@
23186 }
23187 }
23188
23189 - /* Issue warnings about peculiar, but valid, uses of NULL. */
23190 - if ((orig_op0 == null_node || orig_op1 == null_node)
23191 - /* It's reasonable to use pointer values as operands of &&
23192 - and ||, so NULL is no exception. */
23193 - && code != TRUTH_ANDIF_EXPR && code != TRUTH_ORIF_EXPR
23194 - && ( /* Both are NULL (or 0) and the operation was not a comparison. */
23195 - (null_ptr_cst_p (orig_op0) && null_ptr_cst_p (orig_op1)
23196 - && code != EQ_EXPR && code != NE_EXPR)
23197 - /* Or if one of OP0 or OP1 is neither a pointer nor NULL. */
23198 - || (!null_ptr_cst_p (orig_op0) && TREE_CODE (TREE_TYPE (op0)) != POINTER_TYPE)
23199 - || (!null_ptr_cst_p (orig_op1) && TREE_CODE (TREE_TYPE (op1)) != POINTER_TYPE))
23200 - && (complain & tf_warning))
23201 - /* Some sort of arithmetic operation involving NULL was
23202 - performed. Note that pointer-difference and pointer-addition
23203 - have already been handled above, and so we don't end up here in
23204 - that case. */
23205 - warning (OPT_Wpointer_arith, "NULL used in arithmetic");
23206 -
23207 -
23208 /* If CONVERTED is zero, both args will be converted to type RESULT_TYPE.
23209 Then the expression will be built.
23210 It will be given type FINAL_TYPE if that is nonzero;
23211 @@ -5024,6 +5028,12 @@
23212 return rhs;
23213 }
23214
23215 + if (type_unknown_p (rhs))
23216 + {
23217 + error ("no context to resolve type of %qE", rhs);
23218 + return error_mark_node;
23219 + }
23220 +
23221 return build2 (COMPOUND_EXPR, TREE_TYPE (rhs), lhs, rhs);
23222 }
23223
23224 diff -Nur a/gcc/c-ppoutput.c b/gcc/c-ppoutput.c
23225 --- a/gcc/c-ppoutput.c 2008-09-23 19:47:32.000000000 +0200
23226 +++ b/gcc/c-ppoutput.c 2010-01-25 09:50:29.105687718 +0100
23227 @@ -521,6 +521,7 @@
23228
23229 if (map != NULL)
23230 {
23231 + input_location = map->start_location;
23232 if (print.first_time)
23233 {
23234 /* Avoid printing foo.i when the main file is foo.c. */
23235 diff -Nur a/gcc/cse.c b/gcc/cse.c
23236 --- a/gcc/cse.c 2009-04-27 13:55:13.000000000 +0200
23237 +++ b/gcc/cse.c 2010-01-25 09:50:29.105687718 +0100
23238 @@ -5754,6 +5754,11 @@
23239 validate_change (object, &XEXP (x, i),
23240 cse_process_notes (XEXP (x, i), object, changed), 0);
23241
23242 + /* Rebuild a PLUS expression in canonical form if the first operand
23243 + ends up as a constant. */
23244 + if (code == PLUS && GET_CODE (XEXP (x, 0)) == CONST_INT)
23245 + return plus_constant (XEXP(x, 1), INTVAL (XEXP (x, 0)));
23246 +
23247 return x;
23248 }
23249
23250 diff -Nur a/gcc/c-tree.h b/gcc/c-tree.h
23251 --- a/gcc/c-tree.h 2009-02-20 16:20:38.000000000 +0100
23252 +++ b/gcc/c-tree.h 2010-01-25 09:50:29.105687718 +0100
23253 @@ -647,4 +647,8 @@
23254 extern void pedwarn_c90 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(3,4);
23255 extern void pedwarn_c99 (location_t, int opt, const char *, ...) ATTRIBUTE_GCC_CDIAG(3,4);
23256
23257 +extern bool c_cpp_error (cpp_reader *, int, location_t, unsigned int,
23258 + const char *, va_list *)
23259 + ATTRIBUTE_GCC_CDIAG(5,0);
23260 +
23261 #endif /* ! GCC_C_TREE_H */
23262 diff -Nur a/gcc/c-typeck.c b/gcc/c-typeck.c
23263 --- a/gcc/c-typeck.c 2009-04-08 13:59:36.000000000 +0200
23264 +++ b/gcc/c-typeck.c 2010-01-25 09:50:29.105687718 +0100
23265 @@ -1765,6 +1765,7 @@
23266 tree orig_exp;
23267 tree type = TREE_TYPE (exp);
23268 enum tree_code code = TREE_CODE (type);
23269 + tree promoted_type;
23270
23271 /* Functions and arrays have been converted during parsing. */
23272 gcc_assert (code != FUNCTION_TYPE);
23273 @@ -1801,6 +1802,10 @@
23274 if (exp == error_mark_node)
23275 return error_mark_node;
23276
23277 + promoted_type = targetm.promoted_type (type);
23278 + if (promoted_type)
23279 + return convert (promoted_type, exp);
23280 +
23281 if (INTEGRAL_TYPE_P (type))
23282 return perform_integral_promotions (exp);
23283
23284 diff -Nur a/gcc/dbxout.c b/gcc/dbxout.c
23285 --- a/gcc/dbxout.c 2009-07-07 22:46:41.000000000 +0200
23286 +++ b/gcc/dbxout.c 2010-01-25 09:50:29.115687383 +0100
23287 @@ -376,6 +376,7 @@
23288 dbxout_handle_pch, /* handle_pch */
23289 debug_nothing_rtx, /* var_location */
23290 debug_nothing_void, /* switch_text_section */
23291 + debug_nothing_tree_tree, /* set_name */
23292 0 /* start_end_main_source_file */
23293 };
23294 #endif /* DBX_DEBUGGING_INFO */
23295 @@ -408,6 +409,7 @@
23296 dbxout_handle_pch, /* handle_pch */
23297 debug_nothing_rtx, /* var_location */
23298 debug_nothing_void, /* switch_text_section */
23299 + debug_nothing_tree_tree, /* set_name */
23300 0 /* start_end_main_source_file */
23301 };
23302 #endif /* XCOFF_DEBUGGING_INFO */
23303 diff -Nur a/gcc/debug.c b/gcc/debug.c
23304 --- a/gcc/debug.c 2009-02-20 16:20:38.000000000 +0100
23305 +++ b/gcc/debug.c 2010-01-25 09:50:29.115687383 +0100
23306 @@ -50,6 +50,7 @@
23307 debug_nothing_int, /* handle_pch */
23308 debug_nothing_rtx, /* var_location */
23309 debug_nothing_void, /* switch_text_section */
23310 + debug_nothing_tree_tree, /* set_name */
23311 0 /* start_end_main_source_file */
23312 };
23313
23314 @@ -67,6 +68,12 @@
23315 }
23316
23317 void
23318 +debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED,
23319 + tree t2 ATTRIBUTE_UNUSED)
23320 +{
23321 +}
23322 +
23323 +void
23324 debug_nothing_tree_tree_tree_bool (tree t1 ATTRIBUTE_UNUSED,
23325 tree t2 ATTRIBUTE_UNUSED,
23326 tree t3 ATTRIBUTE_UNUSED,
23327 diff -Nur a/gcc/debug.h b/gcc/debug.h
23328 --- a/gcc/debug.h 2009-02-20 16:20:38.000000000 +0100
23329 +++ b/gcc/debug.h 2010-01-25 09:50:29.115687383 +0100
23330 @@ -126,6 +126,10 @@
23331 text sections. */
23332 void (* switch_text_section) (void);
23333
23334 + /* Called from grokdeclarator. Replaces the anonymous name with the
23335 + type name. */
23336 + void (* set_name) (tree, tree);
23337 +
23338 /* This is 1 if the debug writer wants to see start and end commands for the
23339 main source files, and 0 otherwise. */
23340 int start_end_main_source_file;
23341 @@ -140,6 +144,7 @@
23342 extern void debug_nothing_int (unsigned int);
23343 extern void debug_nothing_int_int (unsigned int, unsigned int);
23344 extern void debug_nothing_tree (tree);
23345 +extern void debug_nothing_tree_tree (tree, tree);
23346 extern void debug_nothing_tree_int (tree, int);
23347 extern void debug_nothing_tree_tree_tree_bool (tree, tree, tree, bool);
23348 extern bool debug_true_const_tree (const_tree);
23349 diff -Nur a/gcc/defaults.h b/gcc/defaults.h
23350 --- a/gcc/defaults.h 2009-07-11 21:06:26.000000000 +0200
23351 +++ b/gcc/defaults.h 2010-01-25 09:50:29.115687383 +0100
23352 @@ -902,7 +902,8 @@
23353
23354 /* On most machines, the CFA coincides with the first incoming parm. */
23355 #ifndef ARG_POINTER_CFA_OFFSET
23356 -#define ARG_POINTER_CFA_OFFSET(FNDECL) FIRST_PARM_OFFSET (FNDECL)
23357 +#define ARG_POINTER_CFA_OFFSET(FNDECL) \
23358 + (FIRST_PARM_OFFSET (FNDECL) + crtl->args.pretend_args_size)
23359 #endif
23360
23361 /* On most machines, we use the CFA as DW_AT_frame_base. */
23362 diff -Nur a/gcc/diagnostic.c b/gcc/diagnostic.c
23363 --- a/gcc/diagnostic.c 2008-09-03 03:00:04.000000000 +0200
23364 +++ b/gcc/diagnostic.c 2010-01-25 09:50:29.115687383 +0100
23365 @@ -126,6 +126,7 @@
23366 diagnostic->message.args_ptr = args;
23367 diagnostic->message.format_spec = msg;
23368 diagnostic->location = location;
23369 + diagnostic->override_column = 0;
23370 diagnostic->kind = kind;
23371 diagnostic->option_index = 0;
23372 }
23373 @@ -153,6 +154,8 @@
23374 };
23375 const char *text = _(diagnostic_kind_text[diagnostic->kind]);
23376 expanded_location s = expand_location (diagnostic->location);
23377 + if (diagnostic->override_column)
23378 + s.column = diagnostic->override_column;
23379 gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
23380
23381 return
23382 diff -Nur a/gcc/diagnostic.h b/gcc/diagnostic.h
23383 --- a/gcc/diagnostic.h 2008-08-09 01:57:19.000000000 +0200
23384 +++ b/gcc/diagnostic.h 2010-01-25 09:50:29.115687383 +0100
23385 @@ -41,6 +41,7 @@
23386 {
23387 text_info message;
23388 location_t location;
23389 + unsigned int override_column;
23390 /* TREE_BLOCK if the diagnostic is to be reported in some inline
23391 function inlined into other function, otherwise NULL. */
23392 tree abstract_origin;
23393 @@ -185,6 +186,10 @@
23394
23395 #define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D)
23396
23397 +/* Override the column number to be used for reporting a
23398 + diagnostic. */
23399 +#define diagnostic_override_column(DI, COL) (DI)->override_column = (COL)
23400 +
23401 /* Diagnostic related functions. */
23402 extern void diagnostic_initialize (diagnostic_context *);
23403 extern void diagnostic_report_current_module (diagnostic_context *);
23404 diff -Nur a/gcc/dwarf2out.c b/gcc/dwarf2out.c
23405 --- a/gcc/dwarf2out.c 2009-06-03 19:32:45.000000000 +0200
23406 +++ b/gcc/dwarf2out.c 2010-01-25 09:50:29.115687383 +0100
23407 @@ -2474,6 +2474,12 @@
23408 insn = PATTERN (insn);
23409
23410 dwarf2out_frame_debug_expr (insn, label);
23411 +
23412 + /* Check again. A parallel can save and update the same register.
23413 + We could probably check just once, here, but this is safer than
23414 + removing the check above. */
23415 + if (clobbers_queued_reg_save (insn))
23416 + flush_queued_reg_saves ();
23417 }
23418
23419 #endif
23420 @@ -4598,6 +4604,7 @@
23421 static void dwarf2out_abstract_function (tree);
23422 static void dwarf2out_var_location (rtx);
23423 static void dwarf2out_begin_function (tree);
23424 +static void dwarf2out_set_name (tree, tree);
23425
23426 /* The debug hooks structure. */
23427
23428 @@ -4631,6 +4638,7 @@
23429 debug_nothing_int, /* handle_pch */
23430 dwarf2out_var_location,
23431 dwarf2out_switch_text_section,
23432 + dwarf2out_set_name,
23433 1 /* start_end_main_source_file */
23434 };
23435 #endif
23436 @@ -5975,12 +5983,9 @@
23437 (const char *)x2) == 0;
23438 }
23439
23440 -/* Add a string attribute value to a DIE. */
23441 -
23442 -static inline void
23443 -add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
23444 +static struct indirect_string_node *
23445 +find_AT_string (const char *str)
23446 {
23447 - dw_attr_node attr;
23448 struct indirect_string_node *node;
23449 void **slot;
23450
23451 @@ -6001,6 +6006,18 @@
23452 node = (struct indirect_string_node *) *slot;
23453
23454 node->refcount++;
23455 + return node;
23456 +}
23457 +
23458 +/* Add a string attribute value to a DIE. */
23459 +
23460 +static inline void
23461 +add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
23462 +{
23463 + dw_attr_node attr;
23464 + struct indirect_string_node *node;
23465 +
23466 + node = find_AT_string (str);
23467
23468 attr.dw_attr = attr_kind;
23469 attr.dw_attr_val.val_class = dw_val_class_str;
23470 @@ -6637,6 +6654,8 @@
23471 static inline var_loc_list *
23472 lookup_decl_loc (const_tree decl)
23473 {
23474 + if (!decl_loc_table)
23475 + return NULL;
23476 return (var_loc_list *)
23477 htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
23478 }
23479 @@ -13471,6 +13490,7 @@
23480 tree save_fn;
23481 tree context;
23482 int was_abstract = DECL_ABSTRACT (decl);
23483 + htab_t old_decl_loc_table;
23484
23485 /* Make sure we have the actual abstract inline, not a clone. */
23486 decl = DECL_ORIGIN (decl);
23487 @@ -13480,6 +13500,12 @@
23488 /* We've already generated the abstract instance. */
23489 return;
23490
23491 + /* We can be called while recursively when seeing block defining inlined subroutine
23492 + DIE. Be sure to not clobber the outer location table nor use it or we would
23493 + get locations in abstract instantces. */
23494 + old_decl_loc_table = decl_loc_table;
23495 + decl_loc_table = NULL;
23496 +
23497 /* Be sure we've emitted the in-class declaration DIE (if any) first, so
23498 we don't get confused by DECL_ABSTRACT. */
23499 if (debug_info_level > DINFO_LEVEL_TERSE)
23500 @@ -13501,6 +13527,7 @@
23501 set_decl_abstract_flags (decl, 0);
23502
23503 current_function_decl = save_fn;
23504 + decl_loc_table = old_decl_loc_table;
23505 pop_cfun ();
23506 }
23507
23508 @@ -15796,6 +15823,31 @@
23509 return fd->emitted_number;
23510 }
23511
23512 +/* Replace DW_AT_name for the decl with name. */
23513 +
23514 +static void
23515 +dwarf2out_set_name (tree decl, tree name)
23516 +{
23517 + dw_die_ref die;
23518 + dw_attr_ref attr;
23519 +
23520 + die = TYPE_SYMTAB_DIE (decl);
23521 + if (!die)
23522 + return;
23523 +
23524 + attr = get_AT (die, DW_AT_name);
23525 + if (attr)
23526 + {
23527 + struct indirect_string_node *node;
23528 +
23529 + node = find_AT_string (dwarf2_name (name, 0));
23530 + /* replace the string. */
23531 + attr->dw_attr_val.v.val_str = node;
23532 + }
23533 +
23534 + else
23535 + add_name_attribute (die, dwarf2_name (name, 0));
23536 +}
23537 /* Called by the final INSN scan whenever we see a var location. We
23538 use it to drop labels in the right places, and throw the location in
23539 our lookup table. */
23540 diff -Nur a/gcc/except.c b/gcc/except.c
23541 --- a/gcc/except.c 2009-03-07 17:02:30.000000000 +0100
23542 +++ b/gcc/except.c 2010-01-25 09:50:29.115687383 +0100
23543 @@ -3567,6 +3567,12 @@
23544 paths below go through assemble_integer, which would take
23545 care of this for us. */
23546 STRIP_NOPS (type);
23547 + if (TREE_CODE (type) == POINTER_PLUS_EXPR)
23548 + {
23549 + gcc_assert (TREE_CODE (TREE_OPERAND (type, 1)) == INTEGER_CST);
23550 + type = TREE_OPERAND (type, 0);
23551 + STRIP_NOPS (type);
23552 + }
23553 if (TREE_CODE (type) == ADDR_EXPR)
23554 {
23555 type = TREE_OPERAND (type, 0);
23556 diff -Nur a/gcc/explow.c b/gcc/explow.c
23557 --- a/gcc/explow.c 2009-02-20 16:20:38.000000000 +0100
23558 +++ b/gcc/explow.c 2010-01-25 09:50:29.115687383 +0100
23559 @@ -1491,9 +1491,9 @@
23560 in which a scalar value of mode MODE was returned by a library call. */
23561
23562 rtx
23563 -hard_libcall_value (enum machine_mode mode)
23564 +hard_libcall_value (enum machine_mode mode, rtx fun)
23565 {
23566 - return LIBCALL_VALUE (mode);
23567 + return targetm.calls.libcall_value (mode, fun);
23568 }
23569
23570 /* Look up the tree code for a given rtx code
23571 diff -Nur a/gcc/expmed.c b/gcc/expmed.c
23572 --- a/gcc/expmed.c 2009-01-16 19:56:47.000000000 +0100
23573 +++ b/gcc/expmed.c 2010-01-25 09:50:29.115687383 +0100
23574 @@ -103,7 +103,8 @@
23575 static int neg_cost[2][NUM_MACHINE_MODES];
23576 static int shift_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
23577 static int shiftadd_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
23578 -static int shiftsub_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
23579 +static int shiftsub0_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
23580 +static int shiftsub1_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
23581 static int mul_cost[2][NUM_MACHINE_MODES];
23582 static int sdiv_cost[2][NUM_MACHINE_MODES];
23583 static int udiv_cost[2][NUM_MACHINE_MODES];
23584 @@ -130,7 +131,8 @@
23585 struct rtx_def shift; rtunion shift_fld1;
23586 struct rtx_def shift_mult; rtunion shift_mult_fld1;
23587 struct rtx_def shift_add; rtunion shift_add_fld1;
23588 - struct rtx_def shift_sub; rtunion shift_sub_fld1;
23589 + struct rtx_def shift_sub0; rtunion shift_sub0_fld1;
23590 + struct rtx_def shift_sub1; rtunion shift_sub1_fld1;
23591 } all;
23592
23593 rtx pow2[MAX_BITS_PER_WORD];
23594 @@ -201,9 +203,13 @@
23595 XEXP (&all.shift_add, 0) = &all.shift_mult;
23596 XEXP (&all.shift_add, 1) = &all.reg;
23597
23598 - PUT_CODE (&all.shift_sub, MINUS);
23599 - XEXP (&all.shift_sub, 0) = &all.shift_mult;
23600 - XEXP (&all.shift_sub, 1) = &all.reg;
23601 + PUT_CODE (&all.shift_sub0, MINUS);
23602 + XEXP (&all.shift_sub0, 0) = &all.shift_mult;
23603 + XEXP (&all.shift_sub0, 1) = &all.reg;
23604 +
23605 + PUT_CODE (&all.shift_sub1, MINUS);
23606 + XEXP (&all.shift_sub1, 0) = &all.reg;
23607 + XEXP (&all.shift_sub1, 1) = &all.shift_mult;
23608
23609 for (speed = 0; speed < 2; speed++)
23610 {
23611 @@ -226,7 +232,8 @@
23612 PUT_MODE (&all.shift, mode);
23613 PUT_MODE (&all.shift_mult, mode);
23614 PUT_MODE (&all.shift_add, mode);
23615 - PUT_MODE (&all.shift_sub, mode);
23616 + PUT_MODE (&all.shift_sub0, mode);
23617 + PUT_MODE (&all.shift_sub1, mode);
23618
23619 add_cost[speed][mode] = rtx_cost (&all.plus, SET, speed);
23620 neg_cost[speed][mode] = rtx_cost (&all.neg, SET, speed);
23621 @@ -254,8 +261,8 @@
23622 }
23623
23624 shift_cost[speed][mode][0] = 0;
23625 - shiftadd_cost[speed][mode][0] = shiftsub_cost[speed][mode][0]
23626 - = add_cost[speed][mode];
23627 + shiftadd_cost[speed][mode][0] = shiftsub0_cost[speed][mode][0]
23628 + = shiftsub1_cost[speed][mode][0] = add_cost[speed][mode];
23629
23630 n = MIN (MAX_BITS_PER_WORD, GET_MODE_BITSIZE (mode));
23631 for (m = 1; m < n; m++)
23632 @@ -265,7 +272,8 @@
23633
23634 shift_cost[speed][mode][m] = rtx_cost (&all.shift, SET, speed);
23635 shiftadd_cost[speed][mode][m] = rtx_cost (&all.shift_add, SET, speed);
23636 - shiftsub_cost[speed][mode][m] = rtx_cost (&all.shift_sub, SET, speed);
23637 + shiftsub0_cost[speed][mode][m] = rtx_cost (&all.shift_sub0, SET, speed);
23638 + shiftsub1_cost[speed][mode][m] = rtx_cost (&all.shift_sub1, SET, speed);
23639 }
23640 }
23641 }
23642 @@ -2397,6 +2405,7 @@
23643 struct mult_cost best_cost;
23644 struct mult_cost new_limit;
23645 int op_cost, op_latency;
23646 + unsigned HOST_WIDE_INT orig_t = t;
23647 unsigned HOST_WIDE_INT q;
23648 int maxm = MIN (BITS_PER_WORD, GET_MODE_BITSIZE (mode));
23649 int hash_index;
23650 @@ -2542,6 +2551,38 @@
23651 best_alg->log[best_alg->ops] = m;
23652 best_alg->op[best_alg->ops] = alg_shift;
23653 }
23654 +
23655 + /* See if treating ORIG_T as a signed number yields a better
23656 + sequence. Try this sequence only for a negative ORIG_T
23657 + as it would be useless for a non-negative ORIG_T. */
23658 + if ((HOST_WIDE_INT) orig_t < 0)
23659 + {
23660 + /* Shift ORIG_T as follows because a right shift of a
23661 + negative-valued signed type is implementation
23662 + defined. */
23663 + q = ~(~orig_t >> m);
23664 + /* The function expand_shift will choose between a shift
23665 + and a sequence of additions, so the observed cost is
23666 + given as MIN (m * add_cost[speed][mode],
23667 + shift_cost[speed][mode][m]). */
23668 + op_cost = m * add_cost[speed][mode];
23669 + if (shift_cost[speed][mode][m] < op_cost)
23670 + op_cost = shift_cost[speed][mode][m];
23671 + new_limit.cost = best_cost.cost - op_cost;
23672 + new_limit.latency = best_cost.latency - op_cost;
23673 + synth_mult (alg_in, q, &new_limit, mode);
23674 +
23675 + alg_in->cost.cost += op_cost;
23676 + alg_in->cost.latency += op_cost;
23677 + if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
23678 + {
23679 + struct algorithm *x;
23680 + best_cost = alg_in->cost;
23681 + x = alg_in, alg_in = best_alg, best_alg = x;
23682 + best_alg->log[best_alg->ops] = m;
23683 + best_alg->op[best_alg->ops] = alg_shift;
23684 + }
23685 + }
23686 }
23687 if (cache_hit)
23688 goto done;
23689 @@ -2604,6 +2645,29 @@
23690 best_alg->op[best_alg->ops] = alg_add_t_m2;
23691 }
23692 }
23693 +
23694 + /* We may be able to calculate a * -7, a * -15, a * -31, etc
23695 + quickly with a - a * n for some appropriate constant n. */
23696 + m = exact_log2 (-orig_t + 1);
23697 + if (m >= 0 && m < maxm)
23698 + {
23699 + op_cost = shiftsub1_cost[speed][mode][m];
23700 + new_limit.cost = best_cost.cost - op_cost;
23701 + new_limit.latency = best_cost.latency - op_cost;
23702 + synth_mult (alg_in, (unsigned HOST_WIDE_INT) (-orig_t + 1) >> m, &new_limit, mode);
23703 +
23704 + alg_in->cost.cost += op_cost;
23705 + alg_in->cost.latency += op_cost;
23706 + if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
23707 + {
23708 + struct algorithm *x;
23709 + best_cost = alg_in->cost;
23710 + x = alg_in, alg_in = best_alg, best_alg = x;
23711 + best_alg->log[best_alg->ops] = m;
23712 + best_alg->op[best_alg->ops] = alg_sub_t_m2;
23713 + }
23714 + }
23715 +
23716 if (cache_hit)
23717 goto done;
23718 }
23719 @@ -2673,9 +2737,9 @@
23720 hardware the shift may be executed concurrently with the
23721 earlier steps in the algorithm. */
23722 op_cost = add_cost[speed][mode] + shift_cost[speed][mode][m];
23723 - if (shiftsub_cost[speed][mode][m] < op_cost)
23724 + if (shiftsub0_cost[speed][mode][m] < op_cost)
23725 {
23726 - op_cost = shiftsub_cost[speed][mode][m];
23727 + op_cost = shiftsub0_cost[speed][mode][m];
23728 op_latency = op_cost;
23729 }
23730 else
23731 @@ -2738,7 +2802,7 @@
23732 m = exact_log2 (q);
23733 if (m >= 0 && m < maxm)
23734 {
23735 - op_cost = shiftsub_cost[speed][mode][m];
23736 + op_cost = shiftsub0_cost[speed][mode][m];
23737 new_limit.cost = best_cost.cost - op_cost;
23738 new_limit.latency = best_cost.latency - op_cost;
23739 synth_mult (alg_in, (t + 1) >> m, &new_limit, mode);
23740 diff -Nur a/gcc/expr.c b/gcc/expr.c
23741 --- a/gcc/expr.c 2009-06-16 16:28:47.000000000 +0200
23742 +++ b/gcc/expr.c 2010-01-25 09:50:29.115687383 +0100
23743 @@ -4391,6 +4391,29 @@
23744
23745 /* Compute FROM and store the value in the rtx we got. */
23746
23747 + if (TREE_CODE (to) == MISALIGNED_INDIRECT_REF)
23748 + {
23749 + rtx insn;
23750 + rtx from_rtx;
23751 + enum insn_code icode;
23752 + enum machine_mode mode = GET_MODE (to_rtx);
23753 +
23754 + icode = optab_handler (movmisalign_optab, mode)->insn_code;
23755 + gcc_assert (icode != CODE_FOR_nothing);
23756 +
23757 + from_rtx = expand_expr (from, NULL_RTX, mode, EXPAND_NORMAL);
23758 + insn = GEN_FCN (icode) (to_rtx, from_rtx);
23759 + /* If that failed then force the source into a reg and try again. */
23760 + if (!insn)
23761 + {
23762 + from_rtx = copy_to_mode_reg(mode, from_rtx);
23763 + insn = GEN_FCN (icode) (to_rtx, from_rtx);
23764 + gcc_assert(insn);
23765 + }
23766 + emit_insn (insn);
23767 + return;
23768 + }
23769 +
23770 push_temp_slots ();
23771 result = store_expr (from, to_rtx, 0, nontemporal);
23772 preserve_temp_slots (result);
23773 @@ -7291,6 +7314,19 @@
23774 decl_rtl = DECL_RTL (exp);
23775 gcc_assert (decl_rtl);
23776 decl_rtl = copy_rtx (decl_rtl);
23777 + /* Record writes to register variables. */
23778 + if (modifier == EXPAND_WRITE && REG_P(decl_rtl)
23779 + && REGNO(decl_rtl) < FIRST_PSEUDO_REGISTER)
23780 + {
23781 + int i = REGNO(decl_rtl);
23782 + int nregs = hard_regno_nregs[i][GET_MODE(decl_rtl)];
23783 + while (nregs)
23784 + {
23785 + SET_HARD_REG_BIT(crtl->asm_clobbers, i);
23786 + i++;
23787 + nregs--;
23788 + }
23789 + }
23790
23791 /* Ensure variable marked as used even if it doesn't go through
23792 a parser. If it hasn't be used yet, write out an external
23793 @@ -7538,14 +7574,15 @@
23794
23795 /* Resolve the misalignment now, so that we don't have to remember
23796 to resolve it later. Of course, this only works for reads. */
23797 - /* ??? When we get around to supporting writes, we'll have to handle
23798 - this in store_expr directly. The vectorizer isn't generating
23799 - those yet, however. */
23800 if (code == MISALIGNED_INDIRECT_REF)
23801 {
23802 int icode;
23803 rtx reg, insn;
23804
23805 + /* For writes produce a MEM, and expand_assignment will DTRT. */
23806 + if (modifier == EXPAND_WRITE)
23807 + return temp;
23808 +
23809 gcc_assert (modifier == EXPAND_NORMAL
23810 || modifier == EXPAND_STACK_PARM);
23811
23812 diff -Nur a/gcc/expr.h b/gcc/expr.h
23813 --- a/gcc/expr.h 2009-03-17 18:46:23.000000000 +0100
23814 +++ b/gcc/expr.h 2010-01-25 09:50:29.125687117 +0100
23815 @@ -757,7 +757,7 @@
23816
23817 /* Return an rtx that refers to the value returned by a library call
23818 in its original home. This becomes invalid if any more code is emitted. */
23819 -extern rtx hard_libcall_value (enum machine_mode);
23820 +extern rtx hard_libcall_value (enum machine_mode, rtx);
23821
23822 /* Return the mode desired by operand N of a particular bitfield
23823 insert/extract insn, or MAX_MACHINE_MODE if no such insn is
23824 diff -Nur a/gcc/final.c b/gcc/final.c
23825 --- a/gcc/final.c 2008-12-10 09:46:40.000000000 +0100
23826 +++ b/gcc/final.c 2010-01-25 09:50:29.125687117 +0100
23827 @@ -891,6 +891,7 @@
23828 if (LABEL_P (insn))
23829 {
23830 rtx next;
23831 + bool next_is_jumptable;
23832
23833 /* Merge in alignments computed by compute_alignments. */
23834 log = LABEL_TO_ALIGNMENT (insn);
23835 @@ -900,31 +901,30 @@
23836 max_skip = LABEL_TO_MAX_SKIP (insn);
23837 }
23838
23839 - log = LABEL_ALIGN (insn);
23840 - if (max_log < log)
23841 + next = next_nonnote_insn (insn);
23842 + next_is_jumptable = next && JUMP_TABLE_DATA_P (next);
23843 + if (!next_is_jumptable)
23844 {
23845 - max_log = log;
23846 - max_skip = LABEL_ALIGN_MAX_SKIP;
23847 + log = LABEL_ALIGN (insn);
23848 + if (max_log < log)
23849 + {
23850 + max_log = log;
23851 + max_skip = LABEL_ALIGN_MAX_SKIP;
23852 + }
23853 }
23854 - next = next_nonnote_insn (insn);
23855 /* ADDR_VECs only take room if read-only data goes into the text
23856 section. */
23857 - if (JUMP_TABLES_IN_TEXT_SECTION
23858 - || readonly_data_section == text_section)
23859 - if (next && JUMP_P (next))
23860 - {
23861 - rtx nextbody = PATTERN (next);
23862 - if (GET_CODE (nextbody) == ADDR_VEC
23863 - || GET_CODE (nextbody) == ADDR_DIFF_VEC)
23864 - {
23865 - log = ADDR_VEC_ALIGN (next);
23866 - if (max_log < log)
23867 - {
23868 - max_log = log;
23869 - max_skip = LABEL_ALIGN_MAX_SKIP;
23870 - }
23871 - }
23872 - }
23873 + if ((JUMP_TABLES_IN_TEXT_SECTION
23874 + || readonly_data_section == text_section)
23875 + && next_is_jumptable)
23876 + {
23877 + log = ADDR_VEC_ALIGN (next);
23878 + if (max_log < log)
23879 + {
23880 + max_log = log;
23881 + max_skip = LABEL_ALIGN_MAX_SKIP;
23882 + }
23883 + }
23884 LABEL_TO_ALIGNMENT (insn) = max_log;
23885 LABEL_TO_MAX_SKIP (insn) = max_skip;
23886 max_log = 0;
23887 @@ -2013,48 +2013,41 @@
23888 app_disable ();
23889
23890 next = next_nonnote_insn (insn);
23891 - if (next != 0 && JUMP_P (next))
23892 + /* If this label is followed by a jump-table, make sure we put
23893 + the label in the read-only section. Also possibly write the
23894 + label and jump table together. */
23895 + if (next != 0 && JUMP_TABLE_DATA_P (next))
23896 {
23897 - rtx nextbody = PATTERN (next);
23898 -
23899 - /* If this label is followed by a jump-table,
23900 - make sure we put the label in the read-only section. Also
23901 - possibly write the label and jump table together. */
23902 -
23903 - if (GET_CODE (nextbody) == ADDR_VEC
23904 - || GET_CODE (nextbody) == ADDR_DIFF_VEC)
23905 - {
23906 #if defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC)
23907 - /* In this case, the case vector is being moved by the
23908 - target, so don't output the label at all. Leave that
23909 - to the back end macros. */
23910 + /* In this case, the case vector is being moved by the
23911 + target, so don't output the label at all. Leave that
23912 + to the back end macros. */
23913 #else
23914 - if (! JUMP_TABLES_IN_TEXT_SECTION)
23915 - {
23916 - int log_align;
23917 + if (! JUMP_TABLES_IN_TEXT_SECTION)
23918 + {
23919 + int log_align;
23920
23921 - switch_to_section (targetm.asm_out.function_rodata_section
23922 - (current_function_decl));
23923 + switch_to_section (targetm.asm_out.function_rodata_section
23924 + (current_function_decl));
23925
23926 #ifdef ADDR_VEC_ALIGN
23927 - log_align = ADDR_VEC_ALIGN (next);
23928 + log_align = ADDR_VEC_ALIGN (next);
23929 #else
23930 - log_align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
23931 + log_align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
23932 #endif
23933 - ASM_OUTPUT_ALIGN (file, log_align);
23934 - }
23935 - else
23936 - switch_to_section (current_function_section ());
23937 + ASM_OUTPUT_ALIGN (file, log_align);
23938 + }
23939 + else
23940 + switch_to_section (current_function_section ());
23941
23942 #ifdef ASM_OUTPUT_CASE_LABEL
23943 - ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
23944 - next);
23945 + ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
23946 + next);
23947 #else
23948 - targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
23949 + targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
23950 #endif
23951 #endif
23952 - break;
23953 - }
23954 + break;
23955 }
23956 if (LABEL_ALT_ENTRY_P (insn))
23957 output_alternate_entry_point (file, insn);
23958 diff -Nur a/gcc/fold-const.c b/gcc/fold-const.c
23959 --- a/gcc/fold-const.c 2009-07-15 13:23:22.000000000 +0200
23960 +++ b/gcc/fold-const.c 2010-01-25 09:50:29.125687117 +0100
23961 @@ -2289,7 +2289,24 @@
23962 real_convert (&value, TYPE_MODE (type), &TREE_REAL_CST (arg1));
23963 t = build_real (type, value);
23964
23965 - TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
23966 + /* If converting an infinity or NAN to a representation that doesn't
23967 + have one, set the overflow bit so that we can produce some kind of
23968 + error message at the appropriate point if necessary. It's not the
23969 + most user-friendly message, but it's better than nothing. */
23970 + if (REAL_VALUE_ISINF (TREE_REAL_CST (arg1))
23971 + && !MODE_HAS_INFINITIES (TYPE_MODE (type)))
23972 + TREE_OVERFLOW (t) = 1;
23973 + else if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))
23974 + && !MODE_HAS_NANS (TYPE_MODE (type)))
23975 + TREE_OVERFLOW (t) = 1;
23976 + /* Regular overflow, conversion produced an infinity in a mode that
23977 + can't represent them. */
23978 + else if (!MODE_HAS_INFINITIES (TYPE_MODE (type))
23979 + && REAL_VALUE_ISINF (value)
23980 + && !REAL_VALUE_ISINF (TREE_REAL_CST (arg1)))
23981 + TREE_OVERFLOW (t) = 1;
23982 + else
23983 + TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
23984 return t;
23985 }
23986
23987 diff -Nur a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
23988 --- a/gcc/fortran/cpp.c 2008-12-09 20:25:55.000000000 +0100
23989 +++ b/gcc/fortran/cpp.c 2010-01-25 09:50:29.125687117 +0100
23990 @@ -137,6 +137,9 @@
23991 static void cb_ident (cpp_reader *, source_location, const cpp_string *);
23992 static void cb_used_define (cpp_reader *, source_location, cpp_hashnode *);
23993 static void cb_used_undef (cpp_reader *, source_location, cpp_hashnode *);
23994 +static bool cb_cpp_error (cpp_reader *, int, location_t, unsigned int,
23995 + const char *, va_list *)
23996 + ATTRIBUTE_GCC_DIAG(5,0);
23997 void pp_dir_change (cpp_reader *, const char *);
23998
23999 static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
24000 @@ -452,7 +455,6 @@
24001 cpp_option->cplusplus_comments = 0;
24002
24003 cpp_option->pedantic = pedantic;
24004 - cpp_option->inhibit_warnings = inhibit_warnings;
24005
24006 cpp_option->dollars_in_ident = gfc_option.flag_dollar_ok;
24007 cpp_option->discard_comments = gfc_cpp_option.discard_comments;
24008 @@ -465,9 +467,6 @@
24009
24010 cpp_post_options (cpp_in);
24011
24012 - /* If an error has occurred in cpplib, note it so we fail immediately. */
24013 - errorcount += cpp_errors (cpp_in);
24014 -
24015 gfc_cpp_register_include_paths ();
24016 }
24017
24018 @@ -482,6 +481,7 @@
24019 cb->line_change = cb_line_change;
24020 cb->ident = cb_ident;
24021 cb->def_pragma = cb_def_pragma;
24022 + cb->error = cb_cpp_error;
24023
24024 if (gfc_cpp_option.dump_includes)
24025 cb->include = cb_include;
24026 @@ -961,6 +961,57 @@
24027 cpp_define_queue = q;
24028 }
24029
24030 +/* Callback from cpp_error for PFILE to print diagnostics from the
24031 + preprocessor. The diagnostic is of type LEVEL, at location
24032 + LOCATION, with column number possibly overridden by COLUMN_OVERRIDE
24033 + if not zero; MSG is the translated message and AP the arguments.
24034 + Returns true if a diagnostic was emitted, false otherwise. */
24035 +
24036 +static bool
24037 +cb_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
24038 + location_t location, unsigned int column_override,
24039 + const char *msg, va_list *ap)
24040 +{
24041 + diagnostic_info diagnostic;
24042 + diagnostic_t dlevel;
24043 + int save_warn_system_headers = warn_system_headers;
24044 + bool ret;
24045 +
24046 + switch (level)
24047 + {
24048 + case CPP_DL_WARNING_SYSHDR:
24049 + warn_system_headers = 1;
24050 + /* Fall through. */
24051 + case CPP_DL_WARNING:
24052 + dlevel = DK_WARNING;
24053 + break;
24054 + case CPP_DL_PEDWARN:
24055 + dlevel = DK_PEDWARN;
24056 + break;
24057 + case CPP_DL_ERROR:
24058 + dlevel = DK_ERROR;
24059 + break;
24060 + case CPP_DL_ICE:
24061 + dlevel = DK_ICE;
24062 + break;
24063 + case CPP_DL_NOTE:
24064 + dlevel = DK_NOTE;
24065 + break;
24066 + case CPP_DL_FATAL:
24067 + dlevel = DK_FATAL;
24068 + break;
24069 + default:
24070 + gcc_unreachable ();
24071 + }
24072 + diagnostic_set_info_translated (&diagnostic, msg, ap,
24073 + location, dlevel);
24074 + if (column_override)
24075 + diagnostic_override_column (&diagnostic, column_override);
24076 + ret = report_diagnostic (&diagnostic);
24077 + if (level == CPP_DL_WARNING_SYSHDR)
24078 + warn_system_headers = save_warn_system_headers;
24079 + return ret;
24080 +}
24081
24082 /* Callback called when -fworking-director and -E to emit working
24083 directory in cpp output file. */
24084 diff -Nur a/gcc/fortran/gfortran.info b/gcc/fortran/gfortran.info
24085 --- a/gcc/fortran/gfortran.info 2009-07-22 10:33:04.000000000 +0200
24086 +++ b/gcc/fortran/gfortran.info 1970-01-01 01:00:00.000000000 +0100
24087 @@ -1,15040 +0,0 @@
24088 -This is doc/gfortran.info, produced by makeinfo version 4.13 from
24089 -/d/gcc-4.4.1/gcc-4.4.1/gcc/fortran/gfortran.texi.
24090 -
24091 -Copyright (C) 1999-2008 Free Software Foundation, Inc.
24092 -
24093 - Permission is granted to copy, distribute and/or modify this document
24094 -under the terms of the GNU Free Documentation License, Version 1.2 or
24095 -any later version published by the Free Software Foundation; with the
24096 -Invariant Sections being "Funding Free Software", the Front-Cover Texts
24097 -being (a) (see below), and with the Back-Cover Texts being (b) (see
24098 -below). A copy of the license is included in the section entitled "GNU
24099 -Free Documentation License".
24100 -
24101 - (a) The FSF's Front-Cover Text is:
24102 -
24103 - A GNU Manual
24104 -
24105 - (b) The FSF's Back-Cover Text is:
24106 -
24107 - You have freedom to copy and modify this GNU Manual, like GNU
24108 -software. Copies published by the Free Software Foundation raise
24109 -funds for GNU development.
24110 -
24111 -INFO-DIR-SECTION Software development
24112 -START-INFO-DIR-ENTRY
24113 -* gfortran: (gfortran). The GNU Fortran Compiler.
24114 -END-INFO-DIR-ENTRY
24115 - This file documents the use and the internals of the GNU Fortran
24116 -compiler, (`gfortran').
24117 -
24118 - Published by the Free Software Foundation 51 Franklin Street, Fifth
24119 -Floor Boston, MA 02110-1301 USA
24120 -
24121 - Copyright (C) 1999-2008 Free Software Foundation, Inc.
24122 -
24123 - Permission is granted to copy, distribute and/or modify this document
24124 -under the terms of the GNU Free Documentation License, Version 1.2 or
24125 -any later version published by the Free Software Foundation; with the
24126 -Invariant Sections being "Funding Free Software", the Front-Cover Texts
24127 -being (a) (see below), and with the Back-Cover Texts being (b) (see
24128 -below). A copy of the license is included in the section entitled "GNU
24129 -Free Documentation License".
24130 -
24131 - (a) The FSF's Front-Cover Text is:
24132 -
24133 - A GNU Manual
24134 -
24135 - (b) The FSF's Back-Cover Text is:
24136 -
24137 - You have freedom to copy and modify this GNU Manual, like GNU
24138 -software. Copies published by the Free Software Foundation raise
24139 -funds for GNU development.
24140 -
24141 -\1f
24142 -File: gfortran.info, Node: Top, Next: Introduction, Up: (dir)
24143 -
24144 -Introduction
24145 -************
24146 -
24147 -This manual documents the use of `gfortran', the GNU Fortran compiler.
24148 -You can find in this manual how to invoke `gfortran', as well as its
24149 -features and incompatibilities.
24150 -
24151 -* Menu:
24152 -
24153 -* Introduction::
24154 -
24155 -Part I: Invoking GNU Fortran
24156 -* Invoking GNU Fortran:: Command options supported by `gfortran'.
24157 -* Runtime:: Influencing runtime behavior with environment variables.
24158 -
24159 -Part II: Language Reference
24160 -* Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran.
24161 -* Compiler Characteristics:: KIND type parameters supported.
24162 -* Extensions:: Language extensions implemented by GNU Fortran.
24163 -* Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran.
24164 -* Intrinsic Modules:: Intrinsic modules supported by GNU Fortran.
24165 -
24166 -* Contributing:: How you can help.
24167 -* Copying:: GNU General Public License says
24168 - how you can copy and share GNU Fortran.
24169 -* GNU Free Documentation License::
24170 - How you can copy and share this manual.
24171 -* Funding:: How to help assure continued work for free software.
24172 -* Option Index:: Index of command line options
24173 -* Keyword Index:: Index of concepts
24174 -
24175 -\1f
24176 -File: gfortran.info, Node: Introduction, Next: Invoking GNU Fortran, Prev: Top, Up: Top
24177 -
24178 -1 Introduction
24179 -**************
24180 -
24181 -The GNU Fortran compiler front end was designed initially as a free
24182 -replacement for, or alternative to, the unix `f95' command; `gfortran'
24183 -is the command you'll use to invoke the compiler.
24184 -
24185 -* Menu:
24186 -
24187 -* About GNU Fortran:: What you should know about the GNU Fortran compiler.
24188 -* GNU Fortran and GCC:: You can compile Fortran, C, or other programs.
24189 -* Preprocessing and conditional compilation:: The Fortran preprocessor
24190 -* GNU Fortran and G77:: Why we chose to start from scratch.
24191 -* Project Status:: Status of GNU Fortran, roadmap, proposed extensions.
24192 -* Standards:: Standards supported by GNU Fortran.
24193 -
24194 -\1f
24195 -File: gfortran.info, Node: About GNU Fortran, Next: GNU Fortran and GCC, Up: Introduction
24196 -
24197 -1.1 About GNU Fortran
24198 -=====================
24199 -
24200 -The GNU Fortran compiler is still in an early state of development. It
24201 -can generate code for most constructs and expressions, but much work
24202 -remains to be done.
24203 -
24204 - When the GNU Fortran compiler is finished, it will do everything you
24205 -expect from any decent compiler:
24206 -
24207 - * Read a user's program, stored in a file and containing
24208 - instructions written in Fortran 77, Fortran 90, Fortran 95,
24209 - Fortran 2003 or Fortran 2008. This file contains "source code".
24210 -
24211 - * Translate the user's program into instructions a computer can
24212 - carry out more quickly than it takes to translate the instructions
24213 - in the first place. The result after compilation of a program is
24214 - "machine code", code designed to be efficiently translated and
24215 - processed by a machine such as your computer. Humans usually
24216 - aren't as good writing machine code as they are at writing Fortran
24217 - (or C++, Ada, or Java), because it is easy to make tiny mistakes
24218 - writing machine code.
24219 -
24220 - * Provide the user with information about the reasons why the
24221 - compiler is unable to create a binary from the source code.
24222 - Usually this will be the case if the source code is flawed. The
24223 - Fortran 90 standard requires that the compiler can point out
24224 - mistakes to the user. An incorrect usage of the language causes
24225 - an "error message".
24226 -
24227 - The compiler will also attempt to diagnose cases where the user's
24228 - program contains a correct usage of the language, but instructs
24229 - the computer to do something questionable. This kind of
24230 - diagnostics message is called a "warning message".
24231 -
24232 - * Provide optional information about the translation passes from the
24233 - source code to machine code. This can help a user of the compiler
24234 - to find the cause of certain bugs which may not be obvious in the
24235 - source code, but may be more easily found at a lower level
24236 - compiler output. It also helps developers to find bugs in the
24237 - compiler itself.
24238 -
24239 - * Provide information in the generated machine code that can make it
24240 - easier to find bugs in the program (using a debugging tool, called
24241 - a "debugger", such as the GNU Debugger `gdb').
24242 -
24243 - * Locate and gather machine code already generated to perform
24244 - actions requested by statements in the user's program. This
24245 - machine code is organized into "modules" and is located and
24246 - "linked" to the user program.
24247 -
24248 - The GNU Fortran compiler consists of several components:
24249 -
24250 - * A version of the `gcc' command (which also might be installed as
24251 - the system's `cc' command) that also understands and accepts
24252 - Fortran source code. The `gcc' command is the "driver" program for
24253 - all the languages in the GNU Compiler Collection (GCC); With `gcc',
24254 - you can compile the source code of any language for which a front
24255 - end is available in GCC.
24256 -
24257 - * The `gfortran' command itself, which also might be installed as the
24258 - system's `f95' command. `gfortran' is just another driver program,
24259 - but specifically for the Fortran compiler only. The difference
24260 - with `gcc' is that `gfortran' will automatically link the correct
24261 - libraries to your program.
24262 -
24263 - * A collection of run-time libraries. These libraries contain the
24264 - machine code needed to support capabilities of the Fortran
24265 - language that are not directly provided by the machine code
24266 - generated by the `gfortran' compilation phase, such as intrinsic
24267 - functions and subroutines, and routines for interaction with files
24268 - and the operating system.
24269 -
24270 - * The Fortran compiler itself, (`f951'). This is the GNU Fortran
24271 - parser and code generator, linked to and interfaced with the GCC
24272 - backend library. `f951' "translates" the source code to assembler
24273 - code. You would typically not use this program directly; instead,
24274 - the `gcc' or `gfortran' driver programs will call it for you.
24275 -
24276 -\1f
24277 -File: gfortran.info, Node: GNU Fortran and GCC, Next: Preprocessing and conditional compilation, Prev: About GNU Fortran, Up: Introduction
24278 -
24279 -1.2 GNU Fortran and GCC
24280 -=======================
24281 -
24282 -GNU Fortran is a part of GCC, the "GNU Compiler Collection". GCC
24283 -consists of a collection of front ends for various languages, which
24284 -translate the source code into a language-independent form called
24285 -"GENERIC". This is then processed by a common middle end which
24286 -provides optimization, and then passed to one of a collection of back
24287 -ends which generate code for different computer architectures and
24288 -operating systems.
24289 -
24290 - Functionally, this is implemented with a driver program (`gcc')
24291 -which provides the command-line interface for the compiler. It calls
24292 -the relevant compiler front-end program (e.g., `f951' for Fortran) for
24293 -each file in the source code, and then calls the assembler and linker
24294 -as appropriate to produce the compiled output. In a copy of GCC which
24295 -has been compiled with Fortran language support enabled, `gcc' will
24296 -recognize files with `.f', `.for', `.ftn', `.f90', `.f95', `.f03' and
24297 -`.f08' extensions as Fortran source code, and compile it accordingly. A
24298 -`gfortran' driver program is also provided, which is identical to `gcc'
24299 -except that it automatically links the Fortran runtime libraries into
24300 -the compiled program.
24301 -
24302 - Source files with `.f', `.for', `.fpp', `.ftn', `.F', `.FOR',
24303 -`.FPP', and `.FTN' extensions are treated as fixed form. Source files
24304 -with `.f90', `.f95', `.f03', `.f08', `.F90', `.F95', `.F03' and `.F08'
24305 -extensions are treated as free form. The capitalized versions of
24306 -either form are run through preprocessing. Source files with the lower
24307 -case `.fpp' extension are also run through preprocessing.
24308 -
24309 - This manual specifically documents the Fortran front end, which
24310 -handles the programming language's syntax and semantics. The aspects
24311 -of GCC which relate to the optimization passes and the back-end code
24312 -generation are documented in the GCC manual; see *note Introduction:
24313 -(gcc)Top. The two manuals together provide a complete reference for
24314 -the GNU Fortran compiler.
24315 -
24316 -\1f
24317 -File: gfortran.info, Node: Preprocessing and conditional compilation, Next: GNU Fortran and G77, Prev: GNU Fortran and GCC, Up: Introduction
24318 -
24319 -1.3 Preprocessing and conditional compilation
24320 -=============================================
24321 -
24322 -Many Fortran compilers including GNU Fortran allow passing the source
24323 -code through a C preprocessor (CPP; sometimes also called the Fortran
24324 -preprocessor, FPP) to allow for conditional compilation. In the case of
24325 -GNU Fortran, this is the GNU C Preprocessor in the traditional mode. On
24326 -systems with case-preserving file names, the preprocessor is
24327 -automatically invoked if the filename extension is `.F', `.FOR',
24328 -`.FTN', `.fpp', `.FPP', `.F90', `.F95', `.F03' or `.F08'. To manually
24329 -invoke the preprocessor on any file, use `-cpp', to disable
24330 -preprocessing on files where the preprocessor is run automatically, use
24331 -`-nocpp'.
24332 -
24333 - If a preprocessed file includes another file with the Fortran
24334 -`INCLUDE' statement, the included file is not preprocessed. To
24335 -preprocess included files, use the equivalent preprocessor statement
24336 -`#include'.
24337 -
24338 - If GNU Fortran invokes the preprocessor, `__GFORTRAN__' is defined
24339 -and `__GNUC__', `__GNUC_MINOR__' and `__GNUC_PATCHLEVEL__' can be used
24340 -to determine the version of the compiler. See *note Overview: (cpp)Top.
24341 -for details.
24342 -
24343 - While CPP is the de-facto standard for preprocessing Fortran code,
24344 -Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines
24345 -Conditional Compilation, which is not widely used and not directly
24346 -supported by the GNU Fortran compiler. You can use the program coco to
24347 -preprocess such files (`http://users.erols.com/dnagle/coco.html').
24348 -
24349 -\1f
24350 -File: gfortran.info, Node: GNU Fortran and G77, Next: Project Status, Prev: Preprocessing and conditional compilation, Up: Introduction
24351 -
24352 -1.4 GNU Fortran and G77
24353 -=======================
24354 -
24355 -The GNU Fortran compiler is the successor to `g77', the Fortran 77
24356 -front end included in GCC prior to version 4. It is an entirely new
24357 -program that has been designed to provide Fortran 95 support and
24358 -extensibility for future Fortran language standards, as well as
24359 -providing backwards compatibility for Fortran 77 and nearly all of the
24360 -GNU language extensions supported by `g77'.
24361 -
24362 -\1f
24363 -File: gfortran.info, Node: Project Status, Next: Standards, Prev: GNU Fortran and G77, Up: Introduction
24364 -
24365 -1.5 Project Status
24366 -==================
24367 -
24368 - As soon as `gfortran' can parse all of the statements correctly,
24369 - it will be in the "larva" state. When we generate code, the
24370 - "puppa" state. When `gfortran' is done, we'll see if it will be a
24371 - beautiful butterfly, or just a big bug....
24372 -
24373 - -Andy Vaught, April 2000
24374 -
24375 - The start of the GNU Fortran 95 project was announced on the GCC
24376 -homepage in March 18, 2000 (even though Andy had already been working
24377 -on it for a while, of course).
24378 -
24379 - The GNU Fortran compiler is able to compile nearly all
24380 -standard-compliant Fortran 95, Fortran 90, and Fortran 77 programs,
24381 -including a number of standard and non-standard extensions, and can be
24382 -used on real-world programs. In particular, the supported extensions
24383 -include OpenMP, Cray-style pointers, and several Fortran 2003 and
24384 -Fortran 2008 features such as enumeration, stream I/O, and some of the
24385 -enhancements to allocatable array support from TR 15581. However, it is
24386 -still under development and has a few remaining rough edges.
24387 -
24388 - At present, the GNU Fortran compiler passes the NIST Fortran 77 Test
24389 -Suite (http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html), and
24390 -produces acceptable results on the LAPACK Test Suite
24391 -(http://www.netlib.org/lapack/faq.html#1.21). It also provides
24392 -respectable performance on the Polyhedron Fortran compiler benchmarks
24393 -(http://www.polyhedron.com/pb05.html) and the Livermore Fortran Kernels
24394 -test
24395 -(http://www.llnl.gov/asci_benchmarks/asci/limited/lfk/README.html). It
24396 -has been used to compile a number of large real-world programs,
24397 -including the HIRLAM weather-forecasting code
24398 -(http://mysite.verizon.net/serveall/moene.pdf) and the Tonto quantum
24399 -chemistry package (http://www.theochem.uwa.edu.au/tonto/); see
24400 -`http://gcc.gnu.org/wiki/GfortranApps' for an extended list.
24401 -
24402 - Among other things, the GNU Fortran compiler is intended as a
24403 -replacement for G77. At this point, nearly all programs that could be
24404 -compiled with G77 can be compiled with GNU Fortran, although there are
24405 -a few minor known regressions.
24406 -
24407 - The primary work remaining to be done on GNU Fortran falls into three
24408 -categories: bug fixing (primarily regarding the treatment of invalid
24409 -code and providing useful error messages), improving the compiler
24410 -optimizations and the performance of compiled code, and extending the
24411 -compiler to support future standards--in particular, Fortran 2003.
24412 -
24413 -\1f
24414 -File: gfortran.info, Node: Standards, Prev: Project Status, Up: Introduction
24415 -
24416 -1.6 Standards
24417 -=============
24418 -
24419 -The GNU Fortran compiler implements ISO/IEC 1539:1997 (Fortran 95). As
24420 -such, it can also compile essentially all standard-compliant Fortran 90
24421 -and Fortran 77 programs. It also supports the ISO/IEC TR-15581
24422 -enhancements to allocatable arrays, and the OpenMP Application Program
24423 -Interface v2.5 (http://www.openmp.org/drupal/mp-documents/spec25.pdf)
24424 -specification.
24425 -
24426 - In the future, the GNU Fortran compiler will also support ISO/IEC
24427 -1539-1:2004 (Fortran 2003) and future Fortran standards. Partial support
24428 -of that standard is already provided; the current status of Fortran 2003
24429 -support is reported in the *note Fortran 2003 status:: section of the
24430 -documentation.
24431 -
24432 - The next version of the Fortran standard after Fortran 2003 is
24433 -currently being developed and the GNU Fortran compiler supports some of
24434 -its new features. This support is based on the latest draft of the
24435 -standard (available from `http://www.nag.co.uk/sc22wg5/') and no
24436 -guarantee of future compatibility is made, as the final standard might
24437 -differ from the draft. For more information, see the *note Fortran 2008
24438 -status:: section.
24439 -
24440 -\1f
24441 -File: gfortran.info, Node: Invoking GNU Fortran, Next: Runtime, Prev: Introduction, Up: Top
24442 -
24443 -2 GNU Fortran Command Options
24444 -*****************************
24445 -
24446 -The `gfortran' command supports all the options supported by the `gcc'
24447 -command. Only options specific to GNU Fortran are documented here.
24448 -
24449 - *Note GCC Command Options: (gcc)Invoking GCC, for information on the
24450 -non-Fortran-specific aspects of the `gcc' command (and, therefore, the
24451 -`gfortran' command).
24452 -
24453 - All GCC and GNU Fortran options are accepted both by `gfortran' and
24454 -by `gcc' (as well as any other drivers built at the same time, such as
24455 -`g++'), since adding GNU Fortran to the GCC distribution enables
24456 -acceptance of GNU Fortran options by all of the relevant drivers.
24457 -
24458 - In some cases, options have positive and negative forms; the
24459 -negative form of `-ffoo' would be `-fno-foo'. This manual documents
24460 -only one of these two forms, whichever one is not the default.
24461 -
24462 -* Menu:
24463 -
24464 -* Option Summary:: Brief list of all `gfortran' options,
24465 - without explanations.
24466 -* Fortran Dialect Options:: Controlling the variant of Fortran language
24467 - compiled.
24468 -* Preprocessing Options:: Enable and customize preprocessing.
24469 -* Error and Warning Options:: How picky should the compiler be?
24470 -* Debugging Options:: Symbol tables, measurements, and debugging dumps.
24471 -* Directory Options:: Where to find module files
24472 -* Link Options :: Influencing the linking step
24473 -* Runtime Options:: Influencing runtime behavior
24474 -* Code Gen Options:: Specifying conventions for function calls, data layout
24475 - and register usage.
24476 -* Environment Variables:: Environment variables that affect `gfortran'.
24477 -
24478 -\1f
24479 -File: gfortran.info, Node: Option Summary, Next: Fortran Dialect Options, Up: Invoking GNU Fortran
24480 -
24481 -2.1 Option summary
24482 -==================
24483 -
24484 -Here is a summary of all the options specific to GNU Fortran, grouped
24485 -by type. Explanations are in the following sections.
24486 -
24487 -_Fortran Language Options_
24488 - *Note Options controlling Fortran dialect: Fortran Dialect Options.
24489 - -fall-intrinsics -ffree-form -fno-fixed-form
24490 - -fdollar-ok -fimplicit-none -fmax-identifier-length
24491 - -std=STD -fd-lines-as-code -fd-lines-as-comments
24492 - -ffixed-line-length-N -ffixed-line-length-none
24493 - -ffree-line-length-N -ffree-line-length-none
24494 - -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
24495 - -fcray-pointer -fopenmp -fno-range-check -fbackslash -fmodule-private
24496 -
24497 -_Preprocessing Options_
24498 - *Note Enable and customize preprocessing: Preprocessing Options.
24499 - -cpp -dD -dI -dM -dN -dU -fworking-directory
24500 - -imultilib DIR -iprefix FILE -isysroot DIR
24501 - -iquote -isystem DIR -nocpp -nostdinc -undef
24502 - -AQUESTION=ANSWER -A-QUESTION[=ANSWER]
24503 - -C -CC -DMACRO[=DEFN] -UMACRO -H -P
24504 -
24505 -_Error and Warning Options_
24506 - *Note Options to request or suppress errors and warnings: Error
24507 - and Warning Options.
24508 - -fmax-errors=N
24509 - -fsyntax-only -pedantic -pedantic-errors
24510 - -Wall -Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation
24511 - -Wconversion -Wimplicit-interface -Wline-truncation -Wintrinsics-std
24512 - -Wsurprising -Wno-tabs -Wunderflow -Wunused-parameter -Wintrinsics-shadow
24513 - -Wno-align-commons
24514 -
24515 -_Debugging Options_
24516 - *Note Options for debugging your program or GNU Fortran: Debugging
24517 - Options.
24518 - -fdump-parse-tree -ffpe-trap=LIST
24519 - -fdump-core -fbacktrace
24520 -
24521 -_Directory Options_
24522 - *Note Options for directory search: Directory Options.
24523 - -IDIR -JDIR -MDIR
24524 - -fintrinsic-modules-path DIR
24525 -
24526 -_Link Options_
24527 - *Note Options for influencing the linking step: Link Options.
24528 - -static-libgfortran
24529 -
24530 -_Runtime Options_
24531 - *Note Options for influencing runtime behavior: Runtime Options.
24532 - -fconvert=CONVERSION -fno-range-check
24533 - -frecord-marker=LENGTH -fmax-subrecord-length=LENGTH
24534 - -fsign-zero
24535 -
24536 -_Code Generation Options_
24537 - *Note Options for code generation conventions: Code Gen Options.
24538 - -fno-automatic -ff2c -fno-underscoring
24539 - -fsecond-underscore
24540 - -fbounds-check -fcheck-array-temporaries -fmax-array-constructor =N
24541 - -fmax-stack-var-size=N
24542 - -fpack-derived -frepack-arrays -fshort-enums -fexternal-blas
24543 - -fblas-matmul-limit=N -frecursive -finit-local-zero
24544 - -finit-integer=N -finit-real=<ZERO|INF|-INF|NAN>
24545 - -finit-logical=<TRUE|FALSE> -finit-character=N -fno-align-commons
24546 -
24547 -
24548 -* Menu:
24549 -
24550 -* Fortran Dialect Options:: Controlling the variant of Fortran language
24551 - compiled.
24552 -* Preprocessing Options:: Enable and customize preprocessing.
24553 -* Error and Warning Options:: How picky should the compiler be?
24554 -* Debugging Options:: Symbol tables, measurements, and debugging dumps.
24555 -* Directory Options:: Where to find module files
24556 -* Link Options :: Influencing the linking step
24557 -* Runtime Options:: Influencing runtime behavior
24558 -* Code Gen Options:: Specifying conventions for function calls, data layout
24559 - and register usage.
24560 -
24561 -\1f
24562 -File: gfortran.info, Node: Fortran Dialect Options, Next: Preprocessing Options, Prev: Option Summary, Up: Invoking GNU Fortran
24563 -
24564 -2.2 Options controlling Fortran dialect
24565 -=======================================
24566 -
24567 -The following options control the details of the Fortran dialect
24568 -accepted by the compiler:
24569 -
24570 -`-ffree-form'
24571 -
24572 -`-ffixed-form'
24573 - Specify the layout used by the source file. The free form layout
24574 - was introduced in Fortran 90. Fixed form was traditionally used in
24575 - older Fortran programs. When neither option is specified, the
24576 - source form is determined by the file extension.
24577 -
24578 -`-fall-intrinsics'
24579 - This option causes all intrinsic procedures (including the
24580 - GNU-specific extensions) to be accepted. This can be useful with
24581 - `-std=f95' to force standard-compliance but get access to the full
24582 - range of intrinsics available with `gfortran'. As a consequence,
24583 - `-Wintrinsics-std' will be ignored and no user-defined procedure
24584 - with the same name as any intrinsic will be called except when it
24585 - is explicitly declared `EXTERNAL'.
24586 -
24587 -`-fd-lines-as-code'
24588 -
24589 -`-fd-lines-as-comments'
24590 - Enable special treatment for lines beginning with `d' or `D' in
24591 - fixed form sources. If the `-fd-lines-as-code' option is given
24592 - they are treated as if the first column contained a blank. If the
24593 - `-fd-lines-as-comments' option is given, they are treated as
24594 - comment lines.
24595 -
24596 -`-fdefault-double-8'
24597 - Set the `DOUBLE PRECISION' type to an 8 byte wide type. If
24598 - `-fdefault-real-8' is given, `DOUBLE PRECISION' would instead be
24599 - promoted to 16 bytes if possible, and `-fdefault-double-8' can be
24600 - used to prevent this. The kind of real constants like `1.d0' will
24601 - not be changed by `-fdefault-real-8' though, so also
24602 - `-fdefault-double-8' does not affect it.
24603 -
24604 -`-fdefault-integer-8'
24605 - Set the default integer and logical types to an 8 byte wide type.
24606 - Do nothing if this is already the default. This option also
24607 - affects the kind of integer constants like `42'.
24608 -
24609 -`-fdefault-real-8'
24610 - Set the default real type to an 8 byte wide type. Do nothing if
24611 - this is already the default. This option also affects the kind of
24612 - non-double real constants like `1.0', and does promote the default
24613 - width of `DOUBLE PRECISION' to 16 bytes if possible, unless
24614 - `-fdefault-double-8' is given, too.
24615 -
24616 -`-fdollar-ok'
24617 - Allow `$' as a valid character in a symbol name.
24618 -
24619 -`-fbackslash'
24620 - Change the interpretation of backslashes in string literals from a
24621 - single backslash character to "C-style" escape characters. The
24622 - following combinations are expanded `\a', `\b', `\f', `\n', `\r',
24623 - `\t', `\v', `\\', and `\0' to the ASCII characters alert,
24624 - backspace, form feed, newline, carriage return, horizontal tab,
24625 - vertical tab, backslash, and NUL, respectively. Additionally,
24626 - `\x'NN, `\u'NNNN and `\U'NNNNNNNN (where each N is a hexadecimal
24627 - digit) are translated into the Unicode characters corresponding to
24628 - the specified code points. All other combinations of a character
24629 - preceded by \ are unexpanded.
24630 -
24631 -`-fmodule-private'
24632 - Set the default accessibility of module entities to `PRIVATE'.
24633 - Use-associated entities will not be accessible unless they are
24634 - explicitly declared as `PUBLIC'.
24635 -
24636 -`-ffixed-line-length-N'
24637 - Set column after which characters are ignored in typical fixed-form
24638 - lines in the source file, and through which spaces are assumed (as
24639 - if padded to that length) after the ends of short fixed-form lines.
24640 -
24641 - Popular values for N include 72 (the standard and the default), 80
24642 - (card image), and 132 (corresponding to "extended-source" options
24643 - in some popular compilers). N may also be `none', meaning that
24644 - the entire line is meaningful and that continued character
24645 - constants never have implicit spaces appended to them to fill out
24646 - the line. `-ffixed-line-length-0' means the same thing as
24647 - `-ffixed-line-length-none'.
24648 -
24649 -`-ffree-line-length-N'
24650 - Set column after which characters are ignored in typical free-form
24651 - lines in the source file. The default value is 132. N may be
24652 - `none', meaning that the entire line is meaningful.
24653 - `-ffree-line-length-0' means the same thing as
24654 - `-ffree-line-length-none'.
24655 -
24656 -`-fmax-identifier-length=N'
24657 - Specify the maximum allowed identifier length. Typical values are
24658 - 31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
24659 -
24660 -`-fimplicit-none'
24661 - Specify that no implicit typing is allowed, unless overridden by
24662 - explicit `IMPLICIT' statements. This is the equivalent of adding
24663 - `implicit none' to the start of every procedure.
24664 -
24665 -`-fcray-pointer'
24666 - Enable the Cray pointer extension, which provides C-like pointer
24667 - functionality.
24668 -
24669 -`-fopenmp'
24670 - Enable the OpenMP extensions. This includes OpenMP `!$omp'
24671 - directives in free form and `c$omp', `*$omp' and `!$omp'
24672 - directives in fixed form, `!$' conditional compilation sentinels
24673 - in free form and `c$', `*$' and `!$' sentinels in fixed form, and
24674 - when linking arranges for the OpenMP runtime library to be linked
24675 - in. The option `-fopenmp' implies `-frecursive'.
24676 -
24677 -`-fno-range-check'
24678 - Disable range checking on results of simplification of constant
24679 - expressions during compilation. For example, GNU Fortran will give
24680 - an error at compile time when simplifying `a = 1. / 0'. With this
24681 - option, no error will be given and `a' will be assigned the value
24682 - `+Infinity'. If an expression evaluates to a value outside of the
24683 - relevant range of [`-HUGE()':`HUGE()'], then the expression will
24684 - be replaced by `-Inf' or `+Inf' as appropriate. Similarly, `DATA
24685 - i/Z'FFFFFFFF'/' will result in an integer overflow on most
24686 - systems, but with `-fno-range-check' the value will "wrap around"
24687 - and `i' will be initialized to -1 instead.
24688 -
24689 -`-std=STD'
24690 - Specify the standard to which the program is expected to conform,
24691 - which may be one of `f95', `f2003', `f2008', `gnu', or `legacy'.
24692 - The default value for STD is `gnu', which specifies a superset of
24693 - the Fortran 95 standard that includes all of the extensions
24694 - supported by GNU Fortran, although warnings will be given for
24695 - obsolete extensions not recommended for use in new code. The
24696 - `legacy' value is equivalent but without the warnings for obsolete
24697 - extensions, and may be useful for old non-standard programs. The
24698 - `f95', `f2003' and `f2008' values specify strict conformance to
24699 - the Fortran 95, Fortran 2003 and Fortran 2008 standards,
24700 - respectively; errors are given for all extensions beyond the
24701 - relevant language standard, and warnings are given for the Fortran
24702 - 77 features that are permitted but obsolescent in later standards.
24703 -
24704 -
24705 -\1f
24706 -File: gfortran.info, Node: Preprocessing Options, Next: Error and Warning Options, Prev: Fortran Dialect Options, Up: Invoking GNU Fortran
24707 -
24708 -2.3 Enable and customize preprocessing
24709 -======================================
24710 -
24711 -Preprocessor related options. See section *note Preprocessing and
24712 -conditional compilation:: for more detailed information on
24713 -preprocessing in `gfortran'.
24714 -
24715 -`-cpp'
24716 -
24717 -`-nocpp'
24718 - Enable preprocessing. The preprocessor is automatically invoked if
24719 - the file extension is `.fpp', `.FPP', `.F', `.FOR', `.FTN',
24720 - `.F90', `.F95', `.F03' or `.F08'. Use this option to manually
24721 - enable preprocessing of any kind of Fortran file.
24722 -
24723 - To disable preprocessing of files with any of the above listed
24724 - extensions, use the negative form: `-nocpp'.
24725 -
24726 - The preprocessor is run in traditional mode, be aware that any
24727 - restrictions of the file-format, e.g. fixed-form line width, apply
24728 - for preprocessed output as well.
24729 -
24730 -`-dM'
24731 - Instead of the normal output, generate a list of `'#define''
24732 - directives for all the macros defined during the execution of the
24733 - preprocessor, including predefined macros. This gives you a way of
24734 - finding out what is predefined in your version of the preprocessor.
24735 - Assuming you have no file `foo.f90', the command
24736 - touch foo.f90; gfortran -cpp -dM foo.f90
24737 - will show all the predefined macros.
24738 -
24739 -`-dD'
24740 - Like `-dM' except in two respects: it does not include the
24741 - predefined macros, and it outputs both the `#define' directives
24742 - and the result of preprocessing. Both kinds of output go to the
24743 - standard output file.
24744 -
24745 -`-dN'
24746 - Like `-dD', but emit only the macro names, not their expansions.
24747 -
24748 -`-dU'
24749 - Like `dD' except that only macros that are expanded, or whose
24750 - definedness is tested in preprocessor directives, are output; the
24751 - output is delayed until the use or test of the macro; and
24752 - `'#undef'' directives are also output for macros tested but
24753 - undefined at the time.
24754 -
24755 -`-dI'
24756 - Output `'#include'' directives in addition to the result of
24757 - preprocessing.
24758 -
24759 -`-fworking-directory'
24760 - Enable generation of linemarkers in the preprocessor output that
24761 - will let the compiler know the current working directory at the
24762 - time of preprocessing. When this option is enabled, the
24763 - preprocessor will emit, after the initial linemarker, a second
24764 - linemarker with the current working directory followed by two
24765 - slashes. GCC will use this directory, when it's present in the
24766 - preprocessed input, as the directory emitted as the current
24767 - working directory in some debugging information formats. This
24768 - option is implicitly enabled if debugging information is enabled,
24769 - but this can be inhibited with the negated form
24770 - `-fno-working-directory'. If the `-P' flag is present in the
24771 - command line, this option has no effect, since no `#line'
24772 - directives are emitted whatsoever.
24773 -
24774 -`-idirafter DIR'
24775 - Search DIR for include files, but do it after all directories
24776 - specified with `-I' and the standard system directories have been
24777 - exhausted. DIR is treated as a system include directory. If dir
24778 - begins with `=', then the `=' will be replaced by the sysroot
24779 - prefix; see `--sysroot' and `-isysroot'.
24780 -
24781 -`-imultilib DIR'
24782 - Use DIR as a subdirectory of the directory containing
24783 - target-specific C++ headers.
24784 -
24785 -`-iprefix PREFIX'
24786 - Specify PREFIX as the prefix for subsequent `-iwithprefix'
24787 - options. If the PREFIX represents a directory, you should include
24788 - the final `'/''.
24789 -
24790 -`-isysroot DIR'
24791 - This option is like the `--sysroot' option, but applies only to
24792 - header files. See the `--sysroot' option for more information.
24793 -
24794 -`-iquote DIR'
24795 - Search DIR only for header files requested with `#include "file"';
24796 - they are not searched for `#include <file>', before all directories
24797 - specified by `-I' and before the standard system directories. If
24798 - DIR begins with `=', then the `=' will be replaced by the sysroot
24799 - prefix; see `--sysroot' and `-isysroot'.
24800 -
24801 -`-isystem DIR'
24802 - Search DIR for header files, after all directories specified by
24803 - `-I' but before the standard system directories. Mark it as a
24804 - system directory, so that it gets the same special treatment as is
24805 - applied to the standard system directories. If DIR begins with
24806 - `=', then the `=' will be replaced by the sysroot prefix; see
24807 - `--sysroot' and `-isysroot'.
24808 -
24809 -`-nostdinc'
24810 - Do not search the standard system directories for header files.
24811 - Only the directories you have specified with `-I' options (and the
24812 - directory of the current file, if appropriate) are searched.
24813 -
24814 -`-undef'
24815 - Do not predefine any system-specific or GCC-specific macros. The
24816 - standard predefined macros remain defined.
24817 -
24818 -`-APREDICATE=ANSWER'
24819 - Make an assertion with the predicate PREDICATE and answer ANSWER.
24820 - This form is preferred to the older form -A predicate(answer),
24821 - which is still supported, because it does not use shell special
24822 - characters.
24823 -
24824 -`-A-PREDICATE=ANSWER'
24825 - Cancel an assertion with the predicate PREDICATE and answer ANSWER.
24826 -
24827 -`-C'
24828 - Do not discard comments. All comments are passed through to the
24829 - output file, except for comments in processed directives, which
24830 - are deleted along with the directive.
24831 -
24832 - You should be prepared for side effects when using `-C'; it causes
24833 - the preprocessor to treat comments as tokens in their own right.
24834 - For example, comments appearing at the start of what would be a
24835 - directive line have the effect of turning that line into an
24836 - ordinary source line, since the first token on the line is no
24837 - longer a `'#''.
24838 -
24839 - Warning: this currently handles C-Style comments only. The
24840 - preprocessor does not yet recognize Fortran-style comments.
24841 -
24842 -`-CC'
24843 - Do not discard comments, including during macro expansion. This is
24844 - like `-C', except that comments contained within macros are also
24845 - passed through to the output file where the macro is expanded.
24846 -
24847 - In addition to the side-effects of the `-C' option, the `-CC'
24848 - option causes all C++-style comments inside a macro to be
24849 - converted to C-style comments. This is to prevent later use of
24850 - that macro from inadvertently commenting out the remainder of the
24851 - source line. The `-CC' option is generally used to support lint
24852 - comments.
24853 -
24854 - Warning: this currently handles C- and C++-Style comments only. The
24855 - preprocessor does not yet recognize Fortran-style comments.
24856 -
24857 -`-DNAME'
24858 - Predefine name as a macro, with definition `1'.
24859 -
24860 -`-DNAME=DEFINITION'
24861 - The contents of DEFINITION are tokenized and processed as if they
24862 - appeared during translation phase three in a `'#define'' directive.
24863 - In particular, the definition will be truncated by embedded newline
24864 - characters.
24865 -
24866 - If you are invoking the preprocessor from a shell or shell-like
24867 - program you may need to use the shell's quoting syntax to protect
24868 - characters such as spaces that have a meaning in the shell syntax.
24869 -
24870 - If you wish to define a function-like macro on the command line,
24871 - write its argument list with surrounding parentheses before the
24872 - equals sign (if any). Parentheses are meaningful to most shells,
24873 - so you will need to quote the option. With sh and csh,
24874 - `-D'name(args...)=definition'' works.
24875 -
24876 - `-D' and `-U' options are processed in the order they are given on
24877 - the command line. All -imacros file and -include file options are
24878 - processed after all -D and -U options.
24879 -
24880 -`-H'
24881 - Print the name of each header file used, in addition to other
24882 - normal activities. Each name is indented to show how deep in the
24883 - `'#include'' stack it is.
24884 -
24885 -`-P'
24886 - Inhibit generation of linemarkers in the output from the
24887 - preprocessor. This might be useful when running the preprocessor
24888 - on something that is not C code, and will be sent to a program
24889 - which might be confused by the linemarkers.
24890 -
24891 -`-UNAME'
24892 - Cancel any previous definition of NAME, either built in or provided
24893 - with a `-D' option.
24894 -
24895 -\1f
24896 -File: gfortran.info, Node: Error and Warning Options, Next: Debugging Options, Prev: Preprocessing Options, Up: Invoking GNU Fortran
24897 -
24898 -2.4 Options to request or suppress errors and warnings
24899 -======================================================
24900 -
24901 -Errors are diagnostic messages that report that the GNU Fortran compiler
24902 -cannot compile the relevant piece of source code. The compiler will
24903 -continue to process the program in an attempt to report further errors
24904 -to aid in debugging, but will not produce any compiled output.
24905 -
24906 - Warnings are diagnostic messages that report constructions which are
24907 -not inherently erroneous but which are risky or suggest there is likely
24908 -to be a bug in the program. Unless `-Werror' is specified, they do not
24909 -prevent compilation of the program.
24910 -
24911 - You can request many specific warnings with options beginning `-W',
24912 -for example `-Wimplicit' to request warnings on implicit declarations.
24913 -Each of these specific warning options also has a negative form
24914 -beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
24915 -This manual lists only one of the two forms, whichever is not the
24916 -default.
24917 -
24918 - These options control the amount and kinds of errors and warnings
24919 -produced by GNU Fortran:
24920 -
24921 -`-fmax-errors=N'
24922 - Limits the maximum number of error messages to N, at which point
24923 - GNU Fortran bails out rather than attempting to continue
24924 - processing the source code. If N is 0, there is no limit on the
24925 - number of error messages produced.
24926 -
24927 -`-fsyntax-only'
24928 - Check the code for syntax errors, but don't actually compile it.
24929 - This will generate module files for each module present in the
24930 - code, but no other output file.
24931 -
24932 -`-pedantic'
24933 - Issue warnings for uses of extensions to Fortran 95. `-pedantic'
24934 - also applies to C-language constructs where they occur in GNU
24935 - Fortran source files, such as use of `\e' in a character constant
24936 - within a directive like `#include'.
24937 -
24938 - Valid Fortran 95 programs should compile properly with or without
24939 - this option. However, without this option, certain GNU extensions
24940 - and traditional Fortran features are supported as well. With this
24941 - option, many of them are rejected.
24942 -
24943 - Some users try to use `-pedantic' to check programs for
24944 - conformance. They soon find that it does not do quite what they
24945 - want--it finds some nonstandard practices, but not all. However,
24946 - improvements to GNU Fortran in this area are welcome.
24947 -
24948 - This should be used in conjunction with `-std=f95', `-std=f2003'
24949 - or `-std=f2008'.
24950 -
24951 -`-pedantic-errors'
24952 - Like `-pedantic', except that errors are produced rather than
24953 - warnings.
24954 -
24955 -`-Wall'
24956 - Enables commonly used warning options pertaining to usage that we
24957 - recommend avoiding and that we believe are easy to avoid. This
24958 - currently includes `-Waliasing', `-Wampersand', `-Wsurprising',
24959 - `-Wintrinsics-std', `-Wno-tabs', `-Wintrinsic-shadow' and
24960 - `-Wline-truncation'.
24961 -
24962 -`-Waliasing'
24963 - Warn about possible aliasing of dummy arguments. Specifically, it
24964 - warns if the same actual argument is associated with a dummy
24965 - argument with `INTENT(IN)' and a dummy argument with `INTENT(OUT)'
24966 - in a call with an explicit interface.
24967 -
24968 - The following example will trigger the warning.
24969 - interface
24970 - subroutine bar(a,b)
24971 - integer, intent(in) :: a
24972 - integer, intent(out) :: b
24973 - end subroutine
24974 - end interface
24975 - integer :: a
24976 -
24977 - call bar(a,a)
24978 -
24979 -`-Wampersand'
24980 - Warn about missing ampersand in continued character constants. The
24981 - warning is given with `-Wampersand', `-pedantic', `-std=f95',
24982 - `-std=f2003' and `-std=f2008'. Note: With no ampersand given in a
24983 - continued character constant, GNU Fortran assumes continuation at
24984 - the first non-comment, non-whitespace character after the ampersand
24985 - that initiated the continuation.
24986 -
24987 -`-Warray-temporaries'
24988 - Warn about array temporaries generated by the compiler. The
24989 - information generated by this warning is sometimes useful in
24990 - optimization, in order to avoid such temporaries.
24991 -
24992 -`-Wcharacter-truncation'
24993 - Warn when a character assignment will truncate the assigned string.
24994 -
24995 -`-Wline-truncation'
24996 - Warn when a source code line will be truncated.
24997 -
24998 -`-Wconversion'
24999 - Warn about implicit conversions between different types.
25000 -
25001 -`-Wimplicit-interface'
25002 - Warn if a procedure is called without an explicit interface. Note
25003 - this only checks that an explicit interface is present. It does
25004 - not check that the declared interfaces are consistent across
25005 - program units.
25006 -
25007 -`-Wintrinsics-std'
25008 - Warn if `gfortran' finds a procedure named like an intrinsic not
25009 - available in the currently selected standard (with `-std') and
25010 - treats it as `EXTERNAL' procedure because of this.
25011 - `-fall-intrinsics' can be used to never trigger this behaviour and
25012 - always link to the intrinsic regardless of the selected standard.
25013 -
25014 -`-Wsurprising'
25015 - Produce a warning when "suspicious" code constructs are
25016 - encountered. While technically legal these usually indicate that
25017 - an error has been made.
25018 -
25019 - This currently produces a warning under the following
25020 - circumstances:
25021 -
25022 - * An INTEGER SELECT construct has a CASE that can never be
25023 - matched as its lower value is greater than its upper value.
25024 -
25025 - * A LOGICAL SELECT construct has three CASE statements.
25026 -
25027 - * A TRANSFER specifies a source that is shorter than the
25028 - destination.
25029 -
25030 - * The type of a function result is declared more than once with
25031 - the same type. If `-pedantic' or standard-conforming mode is
25032 - enabled, this is an error.
25033 -
25034 -`-Wtabs'
25035 - By default, tabs are accepted as whitespace, but tabs are not
25036 - members of the Fortran Character Set. For continuation lines, a
25037 - tab followed by a digit between 1 and 9 is supported. `-Wno-tabs'
25038 - will cause a warning to be issued if a tab is encountered. Note,
25039 - `-Wno-tabs' is active for `-pedantic', `-std=f95', `-std=f2003',
25040 - `-std=f2008' and `-Wall'.
25041 -
25042 -`-Wunderflow'
25043 - Produce a warning when numerical constant expressions are
25044 - encountered, which yield an UNDERFLOW during compilation.
25045 -
25046 -`-Wintrinsic-shadow'
25047 - Warn if a user-defined procedure or module procedure has the same
25048 - name as an intrinsic; in this case, an explicit interface or
25049 - `EXTERNAL' or `INTRINSIC' declaration might be needed to get calls
25050 - later resolved to the desired intrinsic/procedure.
25051 -
25052 -`-Wunused-parameter'
25053 - Contrary to `gcc''s meaning of `-Wunused-parameter', `gfortran''s
25054 - implementation of this option does not warn about unused dummy
25055 - arguments, but about unused `PARAMETER' values.
25056 - `-Wunused-parameter' is not included in `-Wall' but is implied by
25057 - `-Wall -Wextra'.
25058 -
25059 -`-Walign-commons'
25060 - By default, `gfortran' warns about any occasion of variables being
25061 - padded for proper alignment inside a COMMON block. This warning
25062 - can be turned off via `-Wno-align-commons'. See also
25063 - `-falign-commons'.
25064 -
25065 -`-Werror'
25066 - Turns all warnings into errors.
25067 -
25068 - *Note Options to Request or Suppress Errors and Warnings: (gcc)Error
25069 -and Warning Options, for information on more options offered by the GBE
25070 -shared by `gfortran', `gcc' and other GNU compilers.
25071 -
25072 - Some of these have no effect when compiling programs written in
25073 -Fortran.
25074 -
25075 -\1f
25076 -File: gfortran.info, Node: Debugging Options, Next: Directory Options, Prev: Error and Warning Options, Up: Invoking GNU Fortran
25077 -
25078 -2.5 Options for debugging your program or GNU Fortran
25079 -=====================================================
25080 -
25081 -GNU Fortran has various special options that are used for debugging
25082 -either your program or the GNU Fortran compiler.
25083 -
25084 -`-fdump-parse-tree'
25085 - Output the internal parse tree before starting code generation.
25086 - Only really useful for debugging the GNU Fortran compiler itself.
25087 -
25088 -`-ffpe-trap=LIST'
25089 - Specify a list of IEEE exceptions when a Floating Point Exception
25090 - (FPE) should be raised. On most systems, this will result in a
25091 - SIGFPE signal being sent and the program being interrupted,
25092 - producing a core file useful for debugging. LIST is a (possibly
25093 - empty) comma-separated list of the following IEEE exceptions:
25094 - `invalid' (invalid floating point operation, such as
25095 - `SQRT(-1.0)'), `zero' (division by zero), `overflow' (overflow in
25096 - a floating point operation), `underflow' (underflow in a floating
25097 - point operation), `precision' (loss of precision during operation)
25098 - and `denormal' (operation produced a denormal value).
25099 -
25100 - Some of the routines in the Fortran runtime library, like
25101 - `CPU_TIME', are likely to trigger floating point exceptions when
25102 - `ffpe-trap=precision' is used. For this reason, the use of
25103 - `ffpe-trap=precision' is not recommended.
25104 -
25105 -`-fbacktrace'
25106 - Specify that, when a runtime error is encountered or a deadly
25107 - signal is emitted (segmentation fault, illegal instruction, bus
25108 - error or floating-point exception), the Fortran runtime library
25109 - should output a backtrace of the error. This option only has
25110 - influence for compilation of the Fortran main program.
25111 -
25112 -`-fdump-core'
25113 - Request that a core-dump file is written to disk when a runtime
25114 - error is encountered on systems that support core dumps. This
25115 - option is only effective for the compilation of the Fortran main
25116 - program.
25117 -
25118 - *Note Options for Debugging Your Program or GCC: (gcc)Debugging
25119 -Options, for more information on debugging options.
25120 -
25121 -\1f
25122 -File: gfortran.info, Node: Directory Options, Next: Link Options, Prev: Debugging Options, Up: Invoking GNU Fortran
25123 -
25124 -2.6 Options for directory search
25125 -================================
25126 -
25127 -These options affect how GNU Fortran searches for files specified by
25128 -the `INCLUDE' directive and where it searches for previously compiled
25129 -modules.
25130 -
25131 - It also affects the search paths used by `cpp' when used to
25132 -preprocess Fortran source.
25133 -
25134 -`-IDIR'
25135 - These affect interpretation of the `INCLUDE' directive (as well as
25136 - of the `#include' directive of the `cpp' preprocessor).
25137 -
25138 - Also note that the general behavior of `-I' and `INCLUDE' is
25139 - pretty much the same as of `-I' with `#include' in the `cpp'
25140 - preprocessor, with regard to looking for `header.gcc' files and
25141 - other such things.
25142 -
25143 - This path is also used to search for `.mod' files when previously
25144 - compiled modules are required by a `USE' statement.
25145 -
25146 - *Note Options for Directory Search: (gcc)Directory Options, for
25147 - information on the `-I' option.
25148 -
25149 -`-JDIR'
25150 -
25151 -`-MDIR'
25152 - This option specifies where to put `.mod' files for compiled
25153 - modules. It is also added to the list of directories to searched
25154 - by an `USE' statement.
25155 -
25156 - The default is the current directory.
25157 -
25158 - `-M' is deprecated to avoid conflicts with existing GCC options.
25159 -
25160 -`-fintrinsic-modules-path DIR'
25161 - This option specifies the location of pre-compiled intrinsic
25162 - modules, if they are not in the default location expected by the
25163 - compiler.
25164 -
25165 -\1f
25166 -File: gfortran.info, Node: Link Options, Next: Runtime Options, Prev: Directory Options, Up: Invoking GNU Fortran
25167 -
25168 -2.7 Influencing the linking step
25169 -================================
25170 -
25171 -These options come into play when the compiler links object files into
25172 -an executable output file. They are meaningless if the compiler is not
25173 -doing a link step.
25174 -
25175 -`-static-libgfortran'
25176 - On systems that provide `libgfortran' as a shared and a static
25177 - library, this option forces the use of the static version. If no
25178 - shared version of `libgfortran' was built when the compiler was
25179 - configured, this option has no effect.
25180 -
25181 -\1f
25182 -File: gfortran.info, Node: Runtime Options, Next: Code Gen Options, Prev: Link Options, Up: Invoking GNU Fortran
25183 -
25184 -2.8 Influencing runtime behavior
25185 -================================
25186 -
25187 -These options affect the runtime behavior of programs compiled with GNU
25188 -Fortran.
25189 -`-fconvert=CONVERSION'
25190 - Specify the representation of data for unformatted files. Valid
25191 - values for conversion are: `native', the default; `swap', swap
25192 - between big- and little-endian; `big-endian', use big-endian
25193 - representation for unformatted files; `little-endian', use
25194 - little-endian representation for unformatted files.
25195 -
25196 - _This option has an effect only when used in the main program.
25197 - The `CONVERT' specifier and the GFORTRAN_CONVERT_UNIT environment
25198 - variable override the default specified by `-fconvert'._
25199 -
25200 -`-fno-range-check'
25201 - Disable range checking of input values during integer `READ'
25202 - operations. For example, GNU Fortran will give an error if an
25203 - input value is outside of the relevant range of
25204 - [`-HUGE()':`HUGE()']. In other words, with `INTEGER (kind=4) :: i'
25205 - , attempting to read -2147483648 will give an error unless
25206 - `-fno-range-check' is given.
25207 -
25208 -`-frecord-marker=LENGTH'
25209 - Specify the length of record markers for unformatted files. Valid
25210 - values for LENGTH are 4 and 8. Default is 4. _This is different
25211 - from previous versions of `gfortran'_, which specified a default
25212 - record marker length of 8 on most systems. If you want to read or
25213 - write files compatible with earlier versions of `gfortran', use
25214 - `-frecord-marker=8'.
25215 -
25216 -`-fmax-subrecord-length=LENGTH'
25217 - Specify the maximum length for a subrecord. The maximum permitted
25218 - value for length is 2147483639, which is also the default. Only
25219 - really useful for use by the gfortran testsuite.
25220 -
25221 -`-fsign-zero'
25222 - When writing zero values, show the negative sign if the sign bit
25223 - is set. `fno-sign-zero' does not print the negative sign of zero
25224 - values for compatibility with F77. Default behavior is to show
25225 - the negative sign.
25226 -
25227 -\1f
25228 -File: gfortran.info, Node: Code Gen Options, Next: Environment Variables, Prev: Runtime Options, Up: Invoking GNU Fortran
25229 -
25230 -2.9 Options for code generation conventions
25231 -===========================================
25232 -
25233 -These machine-independent options control the interface conventions
25234 -used in code generation.
25235 -
25236 - Most of them have both positive and negative forms; the negative form
25237 -of `-ffoo' would be `-fno-foo'. In the table below, only one of the
25238 -forms is listed--the one which is not the default. You can figure out
25239 -the other form by either removing `no-' or adding it.
25240 -
25241 -`-fno-automatic'
25242 - Treat each program unit (except those marked as RECURSIVE) as if
25243 - the `SAVE' statement were specified for every local variable and
25244 - array referenced in it. Does not affect common blocks. (Some
25245 - Fortran compilers provide this option under the name `-static' or
25246 - `-save'.) The default, which is `-fautomatic', uses the stack for
25247 - local variables smaller than the value given by
25248 - `-fmax-stack-var-size'. Use the option `-frecursive' to use no
25249 - static memory.
25250 -
25251 -`-ff2c'
25252 - Generate code designed to be compatible with code generated by
25253 - `g77' and `f2c'.
25254 -
25255 - The calling conventions used by `g77' (originally implemented in
25256 - `f2c') require functions that return type default `REAL' to
25257 - actually return the C type `double', and functions that return
25258 - type `COMPLEX' to return the values via an extra argument in the
25259 - calling sequence that points to where to store the return value.
25260 - Under the default GNU calling conventions, such functions simply
25261 - return their results as they would in GNU C--default `REAL'
25262 - functions return the C type `float', and `COMPLEX' functions
25263 - return the GNU C type `complex'. Additionally, this option
25264 - implies the `-fsecond-underscore' option, unless
25265 - `-fno-second-underscore' is explicitly requested.
25266 -
25267 - This does not affect the generation of code that interfaces with
25268 - the `libgfortran' library.
25269 -
25270 - _Caution:_ It is not a good idea to mix Fortran code compiled with
25271 - `-ff2c' with code compiled with the default `-fno-f2c' calling
25272 - conventions as, calling `COMPLEX' or default `REAL' functions
25273 - between program parts which were compiled with different calling
25274 - conventions will break at execution time.
25275 -
25276 - _Caution:_ This will break code which passes intrinsic functions
25277 - of type default `REAL' or `COMPLEX' as actual arguments, as the
25278 - library implementations use the `-fno-f2c' calling conventions.
25279 -
25280 -`-fno-underscoring'
25281 - Do not transform names of entities specified in the Fortran source
25282 - file by appending underscores to them.
25283 -
25284 - With `-funderscoring' in effect, GNU Fortran appends one
25285 - underscore to external names with no underscores. This is done to
25286 - ensure compatibility with code produced by many UNIX Fortran
25287 - compilers.
25288 -
25289 - _Caution_: The default behavior of GNU Fortran is incompatible
25290 - with `f2c' and `g77', please use the `-ff2c' option if you want
25291 - object files compiled with GNU Fortran to be compatible with
25292 - object code created with these tools.
25293 -
25294 - Use of `-fno-underscoring' is not recommended unless you are
25295 - experimenting with issues such as integration of GNU Fortran into
25296 - existing system environments (vis-a`-vis existing libraries, tools,
25297 - and so on).
25298 -
25299 - For example, with `-funderscoring', and assuming other defaults
25300 - like `-fcase-lower' and that `j()' and `max_count()' are external
25301 - functions while `my_var' and `lvar' are local variables, a
25302 - statement like
25303 - I = J() + MAX_COUNT (MY_VAR, LVAR)
25304 - is implemented as something akin to:
25305 - i = j_() + max_count__(&my_var__, &lvar);
25306 -
25307 - With `-fno-underscoring', the same statement is implemented as:
25308 -
25309 - i = j() + max_count(&my_var, &lvar);
25310 -
25311 - Use of `-fno-underscoring' allows direct specification of
25312 - user-defined names while debugging and when interfacing GNU Fortran
25313 - code with other languages.
25314 -
25315 - Note that just because the names match does _not_ mean that the
25316 - interface implemented by GNU Fortran for an external name matches
25317 - the interface implemented by some other language for that same
25318 - name. That is, getting code produced by GNU Fortran to link to
25319 - code produced by some other compiler using this or any other
25320 - method can be only a small part of the overall solution--getting
25321 - the code generated by both compilers to agree on issues other than
25322 - naming can require significant effort, and, unlike naming
25323 - disagreements, linkers normally cannot detect disagreements in
25324 - these other areas.
25325 -
25326 - Also, note that with `-fno-underscoring', the lack of appended
25327 - underscores introduces the very real possibility that a
25328 - user-defined external name will conflict with a name in a system
25329 - library, which could make finding unresolved-reference bugs quite
25330 - difficult in some cases--they might occur at program run time, and
25331 - show up only as buggy behavior at run time.
25332 -
25333 - In future versions of GNU Fortran we hope to improve naming and
25334 - linking issues so that debugging always involves using the names
25335 - as they appear in the source, even if the names as seen by the
25336 - linker are mangled to prevent accidental linking between
25337 - procedures with incompatible interfaces.
25338 -
25339 -`-fsecond-underscore'
25340 - By default, GNU Fortran appends an underscore to external names.
25341 - If this option is used GNU Fortran appends two underscores to
25342 - names with underscores and one underscore to external names with
25343 - no underscores. GNU Fortran also appends two underscores to
25344 - internal names with underscores to avoid naming collisions with
25345 - external names.
25346 -
25347 - This option has no effect if `-fno-underscoring' is in effect. It
25348 - is implied by the `-ff2c' option.
25349 -
25350 - Otherwise, with this option, an external name such as `MAX_COUNT'
25351 - is implemented as a reference to the link-time external symbol
25352 - `max_count__', instead of `max_count_'. This is required for
25353 - compatibility with `g77' and `f2c', and is implied by use of the
25354 - `-ff2c' option.
25355 -
25356 -`-fbounds-check'
25357 - Enable generation of run-time checks for array subscripts and
25358 - against the declared minimum and maximum values. It also checks
25359 - array indices for assumed and deferred shape arrays against the
25360 - actual allocated bounds and ensures that all string lengths are
25361 - equal for character array constructors without an explicit
25362 - typespec.
25363 -
25364 - Some checks require that `-fbounds-check' is set for the
25365 - compilation of the main program.
25366 -
25367 - Note: In the future this may also include other forms of checking,
25368 - e.g., checking substring references.
25369 -
25370 -`fcheck-array-temporaries'
25371 - Warns at run time when for passing an actual argument a temporary
25372 - array had to be generated. The information generated by this
25373 - warning is sometimes useful in optimization, in order to avoid
25374 - such temporaries.
25375 -
25376 - Note: The warning is only printed once per location.
25377 -
25378 -`-fmax-array-constructor=N'
25379 - This option can be used to increase the upper limit permitted in
25380 - array constructors. The code below requires this option to expand
25381 - the array at compile time.
25382 -
25383 - `program test'
25384 - `implicit none'
25385 - `integer j'
25386 - `integer, parameter :: n = 100000'
25387 - `integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)'
25388 - `print '(10(I0,1X))', i'
25389 - `end program test'
25390 -
25391 - _Caution: This option can lead to long compile times and
25392 - excessively large object files._
25393 -
25394 - The default value for N is 65535.
25395 -
25396 -`-fmax-stack-var-size=N'
25397 - This option specifies the size in bytes of the largest array that
25398 - will be put on the stack; if the size is exceeded static memory is
25399 - used (except in procedures marked as RECURSIVE). Use the option
25400 - `-frecursive' to allow for recursive procedures which do not have
25401 - a RECURSIVE attribute or for parallel programs. Use
25402 - `-fno-automatic' to never use the stack.
25403 -
25404 - This option currently only affects local arrays declared with
25405 - constant bounds, and may not apply to all character variables.
25406 - Future versions of GNU Fortran may improve this behavior.
25407 -
25408 - The default value for N is 32768.
25409 -
25410 -`-fpack-derived'
25411 - This option tells GNU Fortran to pack derived type members as
25412 - closely as possible. Code compiled with this option is likely to
25413 - be incompatible with code compiled without this option, and may
25414 - execute slower.
25415 -
25416 -`-frepack-arrays'
25417 - In some circumstances GNU Fortran may pass assumed shape array
25418 - sections via a descriptor describing a noncontiguous area of
25419 - memory. This option adds code to the function prologue to repack
25420 - the data into a contiguous block at runtime.
25421 -
25422 - This should result in faster accesses to the array. However it
25423 - can introduce significant overhead to the function call,
25424 - especially when the passed data is noncontiguous.
25425 -
25426 -`-fshort-enums'
25427 - This option is provided for interoperability with C code that was
25428 - compiled with the `-fshort-enums' option. It will make GNU
25429 - Fortran choose the smallest `INTEGER' kind a given enumerator set
25430 - will fit in, and give all its enumerators this kind.
25431 -
25432 -`-fexternal-blas'
25433 - This option will make `gfortran' generate calls to BLAS functions
25434 - for some matrix operations like `MATMUL', instead of using our own
25435 - algorithms, if the size of the matrices involved is larger than a
25436 - given limit (see `-fblas-matmul-limit'). This may be profitable
25437 - if an optimized vendor BLAS library is available. The BLAS
25438 - library will have to be specified at link time.
25439 -
25440 -`-fblas-matmul-limit=N'
25441 - Only significant when `-fexternal-blas' is in effect. Matrix
25442 - multiplication of matrices with size larger than (or equal to) N
25443 - will be performed by calls to BLAS functions, while others will be
25444 - handled by `gfortran' internal algorithms. If the matrices
25445 - involved are not square, the size comparison is performed using the
25446 - geometric mean of the dimensions of the argument and result
25447 - matrices.
25448 -
25449 - The default value for N is 30.
25450 -
25451 -`-frecursive'
25452 - Allow indirect recursion by forcing all local arrays to be
25453 - allocated on the stack. This flag cannot be used together with
25454 - `-fmax-stack-var-size=' or `-fno-automatic'.
25455 -
25456 -`-finit-local-zero'
25457 -
25458 -`-finit-integer=N'
25459 -
25460 -`-finit-real=<ZERO|INF|-INF|NAN>'
25461 -
25462 -`-finit-logical=<TRUE|FALSE>'
25463 -
25464 -`-finit-character=N'
25465 - The `-finit-local-zero' option instructs the compiler to
25466 - initialize local `INTEGER', `REAL', and `COMPLEX' variables to
25467 - zero, `LOGICAL' variables to false, and `CHARACTER' variables to a
25468 - string of null bytes. Finer-grained initialization options are
25469 - provided by the `-finit-integer=N',
25470 - `-finit-real=<ZERO|INF|-INF|NAN>' (which also initializes the real
25471 - and imaginary parts of local `COMPLEX' variables),
25472 - `-finit-logical=<TRUE|FALSE>', and `-finit-character=N' (where N
25473 - is an ASCII character value) options. These options do not
25474 - initialize components of derived type variables, nor do they
25475 - initialize variables that appear in an `EQUIVALENCE' statement.
25476 - (This limitation may be removed in future releases).
25477 -
25478 - Note that the `-finit-real=nan' option initializes `REAL' and
25479 - `COMPLEX' variables with a quiet NaN.
25480 -
25481 -`-falign-commons'
25482 - By default, `gfortran' enforces proper alignment of all variables
25483 - in a COMMON block by padding them as needed. On certain platforms
25484 - this is mandatory, on others it increases performance. If a COMMON
25485 - block is not declared with consistent data types everywhere, this
25486 - padding can cause trouble, and `-fno-align-commons ' can be used
25487 - to disable automatic alignment. The same form of this option
25488 - should be used for all files that share a COMMON block. To avoid
25489 - potential alignment issues in COMMON blocks, it is recommended to
25490 - order objects from largests to smallest.
25491 -
25492 - *Note Options for Code Generation Conventions: (gcc)Code Gen
25493 -Options, for information on more options offered by the GBE shared by
25494 -`gfortran', `gcc', and other GNU compilers.
25495 -
25496 -\1f
25497 -File: gfortran.info, Node: Environment Variables, Prev: Code Gen Options, Up: Invoking GNU Fortran
25498 -
25499 -2.10 Environment variables affecting `gfortran'
25500 -===============================================
25501 -
25502 -The `gfortran' compiler currently does not make use of any environment
25503 -variables to control its operation above and beyond those that affect
25504 -the operation of `gcc'.
25505 -
25506 - *Note Environment Variables Affecting GCC: (gcc)Environment
25507 -Variables, for information on environment variables.
25508 -
25509 - *Note Runtime::, for environment variables that affect the run-time
25510 -behavior of programs compiled with GNU Fortran.
25511 -
25512 -\1f
25513 -File: gfortran.info, Node: Runtime, Next: Fortran 2003 and 2008 status, Prev: Invoking GNU Fortran, Up: Top
25514 -
25515 -3 Runtime: Influencing runtime behavior with environment variables
25516 -*******************************************************************
25517 -
25518 -The behavior of the `gfortran' can be influenced by environment
25519 -variables.
25520 -
25521 - Malformed environment variables are silently ignored.
25522 -
25523 -* Menu:
25524 -
25525 -* GFORTRAN_STDIN_UNIT:: Unit number for standard input
25526 -* GFORTRAN_STDOUT_UNIT:: Unit number for standard output
25527 -* GFORTRAN_STDERR_UNIT:: Unit number for standard error
25528 -* GFORTRAN_USE_STDERR:: Send library output to standard error
25529 -* GFORTRAN_TMPDIR:: Directory for scratch files
25530 -* GFORTRAN_UNBUFFERED_ALL:: Don't buffer I/O for all units.
25531 -* GFORTRAN_UNBUFFERED_PRECONNECTED:: Don't buffer I/O for preconnected units.
25532 -* GFORTRAN_SHOW_LOCUS:: Show location for runtime errors
25533 -* GFORTRAN_OPTIONAL_PLUS:: Print leading + where permitted
25534 -* GFORTRAN_DEFAULT_RECL:: Default record length for new files
25535 -* GFORTRAN_LIST_SEPARATOR:: Separator for list output
25536 -* GFORTRAN_CONVERT_UNIT:: Set endianness for unformatted I/O
25537 -* GFORTRAN_ERROR_DUMPCORE:: Dump core on run-time errors
25538 -* GFORTRAN_ERROR_BACKTRACE:: Show backtrace on run-time errors
25539 -
25540 -\1f
25541 -File: gfortran.info, Node: GFORTRAN_STDIN_UNIT, Next: GFORTRAN_STDOUT_UNIT, Up: Runtime
25542 -
25543 -3.1 `GFORTRAN_STDIN_UNIT'--Unit number for standard input
25544 -=========================================================
25545 -
25546 -This environment variable can be used to select the unit number
25547 -preconnected to standard input. This must be a positive integer. The
25548 -default value is 5.
25549 -
25550 -\1f
25551 -File: gfortran.info, Node: GFORTRAN_STDOUT_UNIT, Next: GFORTRAN_STDERR_UNIT, Prev: GFORTRAN_STDIN_UNIT, Up: Runtime
25552 -
25553 -3.2 `GFORTRAN_STDOUT_UNIT'--Unit number for standard output
25554 -===========================================================
25555 -
25556 -This environment variable can be used to select the unit number
25557 -preconnected to standard output. This must be a positive integer. The
25558 -default value is 6.
25559 -
25560 -\1f
25561 -File: gfortran.info, Node: GFORTRAN_STDERR_UNIT, Next: GFORTRAN_USE_STDERR, Prev: GFORTRAN_STDOUT_UNIT, Up: Runtime
25562 -
25563 -3.3 `GFORTRAN_STDERR_UNIT'--Unit number for standard error
25564 -==========================================================
25565 -
25566 -This environment variable can be used to select the unit number
25567 -preconnected to standard error. This must be a positive integer. The
25568 -default value is 0.
25569 -
25570 -\1f
25571 -File: gfortran.info, Node: GFORTRAN_USE_STDERR, Next: GFORTRAN_TMPDIR, Prev: GFORTRAN_STDERR_UNIT, Up: Runtime
25572 -
25573 -3.4 `GFORTRAN_USE_STDERR'--Send library output to standard error
25574 -================================================================
25575 -
25576 -This environment variable controls where library output is sent. If
25577 -the first letter is `y', `Y' or `1', standard error is used. If the
25578 -first letter is `n', `N' or `0', standard output is used.
25579 -
25580 -\1f
25581 -File: gfortran.info, Node: GFORTRAN_TMPDIR, Next: GFORTRAN_UNBUFFERED_ALL, Prev: GFORTRAN_USE_STDERR, Up: Runtime
25582 -
25583 -3.5 `GFORTRAN_TMPDIR'--Directory for scratch files
25584 -==================================================
25585 -
25586 -This environment variable controls where scratch files are created. If
25587 -this environment variable is missing, GNU Fortran searches for the
25588 -environment variable `TMP'. If this is also missing, the default is
25589 -`/tmp'.
25590 -
25591 -\1f
25592 -File: gfortran.info, Node: GFORTRAN_UNBUFFERED_ALL, Next: GFORTRAN_UNBUFFERED_PRECONNECTED, Prev: GFORTRAN_TMPDIR, Up: Runtime
25593 -
25594 -3.6 `GFORTRAN_UNBUFFERED_ALL'--Don't buffer I/O on all units
25595 -============================================================
25596 -
25597 -This environment variable controls whether all I/O is unbuffered. If
25598 -the first letter is `y', `Y' or `1', all I/O is unbuffered. This will
25599 -slow down small sequential reads and writes. If the first letter is
25600 -`n', `N' or `0', I/O is buffered. This is the default.
25601 -
25602 -\1f
25603 -File: gfortran.info, Node: GFORTRAN_UNBUFFERED_PRECONNECTED, Next: GFORTRAN_SHOW_LOCUS, Prev: GFORTRAN_UNBUFFERED_ALL, Up: Runtime
25604 -
25605 -3.7 `GFORTRAN_UNBUFFERED_PRECONNECTED'--Don't buffer I/O on preconnected units
25606 -==============================================================================
25607 -
25608 -The environment variable named `GFORTRAN_UNBUFFERED_PRECONNECTED'
25609 -controls whether I/O on a preconnected unit (i.e. STDOUT or STDERR) is
25610 -unbuffered. If the first letter is `y', `Y' or `1', I/O is unbuffered.
25611 -This will slow down small sequential reads and writes. If the first
25612 -letter is `n', `N' or `0', I/O is buffered. This is the default.
25613 -
25614 -\1f
25615 -File: gfortran.info, Node: GFORTRAN_SHOW_LOCUS, Next: GFORTRAN_OPTIONAL_PLUS, Prev: GFORTRAN_UNBUFFERED_PRECONNECTED, Up: Runtime
25616 -
25617 -3.8 `GFORTRAN_SHOW_LOCUS'--Show location for runtime errors
25618 -===========================================================
25619 -
25620 -If the first letter is `y', `Y' or `1', filename and line numbers for
25621 -runtime errors are printed. If the first letter is `n', `N' or `0',
25622 -don't print filename and line numbers for runtime errors. The default
25623 -is to print the location.
25624 -
25625 -\1f
25626 -File: gfortran.info, Node: GFORTRAN_OPTIONAL_PLUS, Next: GFORTRAN_DEFAULT_RECL, Prev: GFORTRAN_SHOW_LOCUS, Up: Runtime
25627 -
25628 -3.9 `GFORTRAN_OPTIONAL_PLUS'--Print leading + where permitted
25629 -=============================================================
25630 -
25631 -If the first letter is `y', `Y' or `1', a plus sign is printed where
25632 -permitted by the Fortran standard. If the first letter is `n', `N' or
25633 -`0', a plus sign is not printed in most cases. Default is not to print
25634 -plus signs.
25635 -
25636 -\1f
25637 -File: gfortran.info, Node: GFORTRAN_DEFAULT_RECL, Next: GFORTRAN_LIST_SEPARATOR, Prev: GFORTRAN_OPTIONAL_PLUS, Up: Runtime
25638 -
25639 -3.10 `GFORTRAN_DEFAULT_RECL'--Default record length for new files
25640 -=================================================================
25641 -
25642 -This environment variable specifies the default record length, in
25643 -bytes, for files which are opened without a `RECL' tag in the `OPEN'
25644 -statement. This must be a positive integer. The default value is
25645 -1073741824 bytes (1 GB).
25646 -
25647 -\1f
25648 -File: gfortran.info, Node: GFORTRAN_LIST_SEPARATOR, Next: GFORTRAN_CONVERT_UNIT, Prev: GFORTRAN_DEFAULT_RECL, Up: Runtime
25649 -
25650 -3.11 `GFORTRAN_LIST_SEPARATOR'--Separator for list output
25651 -=========================================================
25652 -
25653 -This environment variable specifies the separator when writing
25654 -list-directed output. It may contain any number of spaces and at most
25655 -one comma. If you specify this on the command line, be sure to quote
25656 -spaces, as in
25657 - $ GFORTRAN_LIST_SEPARATOR=' , ' ./a.out
25658 - when `a.out' is the compiled Fortran program that you want to run.
25659 -Default is a single space.
25660 -
25661 -\1f
25662 -File: gfortran.info, Node: GFORTRAN_CONVERT_UNIT, Next: GFORTRAN_ERROR_DUMPCORE, Prev: GFORTRAN_LIST_SEPARATOR, Up: Runtime
25663 -
25664 -3.12 `GFORTRAN_CONVERT_UNIT'--Set endianness for unformatted I/O
25665 -================================================================
25666 -
25667 -By setting the `GFORTRAN_CONVERT_UNIT' variable, it is possible to
25668 -change the representation of data for unformatted files. The syntax
25669 -for the `GFORTRAN_CONVERT_UNIT' variable is:
25670 - GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
25671 - mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
25672 - exception: mode ':' unit_list | unit_list ;
25673 - unit_list: unit_spec | unit_list unit_spec ;
25674 - unit_spec: INTEGER | INTEGER '-' INTEGER ;
25675 - The variable consists of an optional default mode, followed by a
25676 -list of optional exceptions, which are separated by semicolons from the
25677 -preceding default and each other. Each exception consists of a format
25678 -and a comma-separated list of units. Valid values for the modes are
25679 -the same as for the `CONVERT' specifier:
25680 -
25681 - `NATIVE' Use the native format. This is the default.
25682 -
25683 - `SWAP' Swap between little- and big-endian.
25684 -
25685 - `LITTLE_ENDIAN' Use the little-endian format for unformatted files.
25686 -
25687 - `BIG_ENDIAN' Use the big-endian format for unformatted files.
25688 - A missing mode for an exception is taken to mean `BIG_ENDIAN'.
25689 -Examples of values for `GFORTRAN_CONVERT_UNIT' are:
25690 - `'big_endian'' Do all unformatted I/O in big_endian mode.
25691 -
25692 - `'little_endian;native:10-20,25'' Do all unformatted I/O in
25693 - little_endian mode, except for units 10 to 20 and 25, which are in
25694 - native format.
25695 -
25696 - `'10-20'' Units 10 to 20 are big-endian, the rest is native.
25697 -
25698 - Setting the environment variables should be done on the command line
25699 -or via the `export' command for `sh'-compatible shells and via `setenv'
25700 -for `csh'-compatible shells.
25701 -
25702 - Example for `sh':
25703 - $ gfortran foo.f90
25704 - $ GFORTRAN_CONVERT_UNIT='big_endian;native:10-20' ./a.out
25705 -
25706 - Example code for `csh':
25707 - % gfortran foo.f90
25708 - % setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20'
25709 - % ./a.out
25710 -
25711 - Using anything but the native representation for unformatted data
25712 -carries a significant speed overhead. If speed in this area matters to
25713 -you, it is best if you use this only for data that needs to be portable.
25714 -
25715 - *Note CONVERT specifier::, for an alternative way to specify the
25716 -data representation for unformatted files. *Note Runtime Options::, for
25717 -setting a default data representation for the whole program. The
25718 -`CONVERT' specifier overrides the `-fconvert' compile options.
25719 -
25720 - _Note that the values specified via the GFORTRAN_CONVERT_UNIT
25721 -environment variable will override the CONVERT specifier in the open
25722 -statement_. This is to give control over data formats to users who do
25723 -not have the source code of their program available.
25724 -
25725 -\1f
25726 -File: gfortran.info, Node: GFORTRAN_ERROR_DUMPCORE, Next: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_CONVERT_UNIT, Up: Runtime
25727 -
25728 -3.13 `GFORTRAN_ERROR_DUMPCORE'--Dump core on run-time errors
25729 -============================================================
25730 -
25731 -If the `GFORTRAN_ERROR_DUMPCORE' variable is set to `y', `Y' or `1'
25732 -(only the first letter is relevant) then library run-time errors cause
25733 -core dumps. To disable the core dumps, set the variable to `n', `N',
25734 -`0'. Default is not to core dump unless the `-fdump-core' compile option
25735 -was used.
25736 -
25737 -\1f
25738 -File: gfortran.info, Node: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_ERROR_DUMPCORE, Up: Runtime
25739 -
25740 -3.14 `GFORTRAN_ERROR_BACKTRACE'--Show backtrace on run-time errors
25741 -==================================================================
25742 -
25743 -If the `GFORTRAN_ERROR_BACKTRACE' variable is set to `y', `Y' or `1'
25744 -(only the first letter is relevant) then a backtrace is printed when a
25745 -run-time error occurs. To disable the backtracing, set the variable to
25746 -`n', `N', `0'. Default is not to print a backtrace unless the
25747 -`-fbacktrace' compile option was used.
25748 -
25749 -\1f
25750 -File: gfortran.info, Node: Fortran 2003 and 2008 status, Next: Compiler Characteristics, Prev: Runtime, Up: Top
25751 -
25752 -4 Fortran 2003 and 2008 Status
25753 -******************************
25754 -
25755 -* Menu:
25756 -
25757 -* Fortran 2003 status::
25758 -* Fortran 2008 status::
25759 -
25760 -\1f
25761 -File: gfortran.info, Node: Fortran 2003 status, Next: Fortran 2008 status, Up: Fortran 2003 and 2008 status
25762 -
25763 -4.1 Fortran 2003 status
25764 -=======================
25765 -
25766 -Although GNU Fortran focuses on implementing the Fortran 95 standard
25767 -for the time being, a few Fortran 2003 features are currently available.
25768 -
25769 - * Intrinsics `command_argument_count', `get_command',
25770 - `get_command_argument', `get_environment_variable', and
25771 - `move_alloc'.
25772 -
25773 - * Array constructors using square brackets. That is, `[...]' rather
25774 - than `(/.../)'.
25775 -
25776 - * `FLUSH' statement.
25777 -
25778 - * `IOMSG=' specifier for I/O statements.
25779 -
25780 - * Support for the declaration of enumeration constants via the
25781 - `ENUM' and `ENUMERATOR' statements. Interoperability with `gcc'
25782 - is guaranteed also for the case where the `-fshort-enums' command
25783 - line option is given.
25784 -
25785 - * TR 15581:
25786 - * `ALLOCATABLE' dummy arguments.
25787 -
25788 - * `ALLOCATABLE' function results
25789 -
25790 - * `ALLOCATABLE' components of derived types
25791 -
25792 - * The `OPEN' statement supports the `ACCESS='STREAM'' specifier,
25793 - allowing I/O without any record structure.
25794 -
25795 - * Namelist input/output for internal files.
25796 -
25797 - * The `PROTECTED' statement and attribute.
25798 -
25799 - * The `VALUE' statement and attribute.
25800 -
25801 - * The `VOLATILE' statement and attribute.
25802 -
25803 - * The `IMPORT' statement, allowing to import host-associated derived
25804 - types.
25805 -
25806 - * `USE' statement with `INTRINSIC' and `NON_INTRINSIC' attribute;
25807 - supported intrinsic modules: `ISO_FORTRAN_ENV', `OMP_LIB' and
25808 - `OMP_LIB_KINDS'.
25809 -
25810 - * Renaming of operators in the `USE' statement.
25811 -
25812 - * Interoperability with C (ISO C Bindings)
25813 -
25814 - * BOZ as argument of INT, REAL, DBLE and CMPLX.
25815 -
25816 -
25817 -\1f
25818 -File: gfortran.info, Node: Fortran 2008 status, Prev: Fortran 2003 status, Up: Fortran 2003 and 2008 status
25819 -
25820 -4.2 Fortran 2008 status
25821 -=======================
25822 -
25823 -The next version of the Fortran standard after Fortran 2003 is currently
25824 -being worked on by the Working Group 5 of Sub-Committee 22 of the Joint
25825 -Technical Committee 1 of the International Organization for
25826 -Standardization (ISO) and the International Electrotechnical Commission
25827 -(IEC). This group is known at WG5 (http://www.nag.co.uk/sc22wg5/). The
25828 -next revision of the Fortran standard is informally referred to as
25829 -Fortran 2008, reflecting its planned release year. The GNU Fortran
25830 -compiler has support for some of the new features in Fortran 2008. This
25831 -support is based on the latest draft, available from
25832 -`http://www.nag.co.uk/sc22wg5/'. However, as the final standard may
25833 -differ from the drafts, no guarantee of backward compatibility can be
25834 -made and you should only use it for experimental purposes.
25835 -
25836 -\1f
25837 -File: gfortran.info, Node: Compiler Characteristics, Next: Extensions, Prev: Fortran 2003 and 2008 status, Up: Top
25838 -
25839 -5 Compiler Characteristics
25840 -**************************
25841 -
25842 -This chapter describes certain characteristics of the GNU Fortran
25843 -compiler, namely the KIND type parameter values supported.
25844 -
25845 -* Menu:
25846 -
25847 -* KIND Type Parameters::
25848 -
25849 -\1f
25850 -File: gfortran.info, Node: KIND Type Parameters, Up: Compiler Characteristics
25851 -
25852 -5.1 KIND Type Parameters
25853 -========================
25854 -
25855 -The `KIND' type parameters supported by GNU Fortran for the primitive
25856 -data types are:
25857 -
25858 -`INTEGER'
25859 - 1, 2, 4, 8*, 16*, default: 4 (1)
25860 -
25861 -`LOGICAL'
25862 - 1, 2, 4, 8*, 16*, default: 4 (1)
25863 -
25864 -`REAL'
25865 - 4, 8, 10**, 16**, default: 4 (2)
25866 -
25867 -`COMPLEX'
25868 - 4, 8, 10**, 16**, default: 4 (2)
25869 -
25870 -`CHARACTER'
25871 - 1, 4, default: 1
25872 -
25873 -
25874 -* = not available on all systems
25875 -** = not available on all systems; additionally 10 and 16 are never
25876 -available at the same time
25877 -(1) Unless -fdefault-integer-8 is used
25878 -(2) Unless -fdefault-real-8 is used
25879 -
25880 -The `KIND' value matches the storage size in bytes, except for
25881 -`COMPLEX' where the storage size is twice as much (or both real and
25882 -imaginary part are a real value of the given size). It is recommended
25883 -to use the `SELECT_*_KIND' intrinsics instead of the concrete values.
25884 -
25885 -\1f
25886 -File: gfortran.info, Node: Extensions, Next: Intrinsic Procedures, Prev: Compiler Characteristics, Up: Top
25887 -
25888 -6 Extensions
25889 -************
25890 -
25891 -The two sections below detail the extensions to standard Fortran that
25892 -are implemented in GNU Fortran, as well as some of the popular or
25893 -historically important extensions that are not (or not yet) implemented.
25894 -For the latter case, we explain the alternatives available to GNU
25895 -Fortran users, including replacement by standard-conforming code or GNU
25896 -extensions.
25897 -
25898 -* Menu:
25899 -
25900 -* Extensions implemented in GNU Fortran::
25901 -* Extensions not implemented in GNU Fortran::
25902 -
25903 -\1f
25904 -File: gfortran.info, Node: Extensions implemented in GNU Fortran, Next: Extensions not implemented in GNU Fortran, Up: Extensions
25905 -
25906 -6.1 Extensions implemented in GNU Fortran
25907 -=========================================
25908 -
25909 -GNU Fortran implements a number of extensions over standard Fortran.
25910 -This chapter contains information on their syntax and meaning. There
25911 -are currently two categories of GNU Fortran extensions, those that
25912 -provide functionality beyond that provided by any standard, and those
25913 -that are supported by GNU Fortran purely for backward compatibility
25914 -with legacy compilers. By default, `-std=gnu' allows the compiler to
25915 -accept both types of extensions, but to warn about the use of the
25916 -latter. Specifying either `-std=f95', `-std=f2003' or `-std=f2008'
25917 -disables both types of extensions, and `-std=legacy' allows both
25918 -without warning.
25919 -
25920 -* Menu:
25921 -
25922 -* Old-style kind specifications::
25923 -* Old-style variable initialization::
25924 -* Extensions to namelist::
25925 -* X format descriptor without count field::
25926 -* Commas in FORMAT specifications::
25927 -* Missing period in FORMAT specifications::
25928 -* I/O item lists::
25929 -* BOZ literal constants::
25930 -* Real array indices::
25931 -* Unary operators::
25932 -* Implicitly convert LOGICAL and INTEGER values::
25933 -* Hollerith constants support::
25934 -* Cray pointers::
25935 -* CONVERT specifier::
25936 -* OpenMP::
25937 -* Argument list functions::
25938 -
25939 -\1f
25940 -File: gfortran.info, Node: Old-style kind specifications, Next: Old-style variable initialization, Up: Extensions implemented in GNU Fortran
25941 -
25942 -6.1.1 Old-style kind specifications
25943 ------------------------------------
25944 -
25945 -GNU Fortran allows old-style kind specifications in declarations. These
25946 -look like:
25947 - TYPESPEC*size x,y,z
25948 - where `TYPESPEC' is a basic type (`INTEGER', `REAL', etc.), and
25949 -where `size' is a byte count corresponding to the storage size of a
25950 -valid kind for that type. (For `COMPLEX' variables, `size' is the
25951 -total size of the real and imaginary parts.) The statement then
25952 -declares `x', `y' and `z' to be of type `TYPESPEC' with the appropriate
25953 -kind. This is equivalent to the standard-conforming declaration
25954 - TYPESPEC(k) x,y,z
25955 - where `k' is the kind parameter suitable for the intended precision.
25956 -As kind parameters are implementation-dependent, use the `KIND',
25957 -`SELECTED_INT_KIND' and `SELECTED_REAL_KIND' intrinsics to retrieve the
25958 -correct value, for instance `REAL*8 x' can be replaced by:
25959 - INTEGER, PARAMETER :: dbl = KIND(1.0d0)
25960 - REAL(KIND=dbl) :: x
25961 -
25962 -\1f
25963 -File: gfortran.info, Node: Old-style variable initialization, Next: Extensions to namelist, Prev: Old-style kind specifications, Up: Extensions implemented in GNU Fortran
25964 -
25965 -6.1.2 Old-style variable initialization
25966 ----------------------------------------
25967 -
25968 -GNU Fortran allows old-style initialization of variables of the form:
25969 - INTEGER i/1/,j/2/
25970 - REAL x(2,2) /3*0.,1./
25971 - The syntax for the initializers is as for the `DATA' statement, but
25972 -unlike in a `DATA' statement, an initializer only applies to the
25973 -variable immediately preceding the initialization. In other words,
25974 -something like `INTEGER I,J/2,3/' is not valid. This style of
25975 -initialization is only allowed in declarations without double colons
25976 -(`::'); the double colons were introduced in Fortran 90, which also
25977 -introduced a standard syntax for initializing variables in type
25978 -declarations.
25979 -
25980 - Examples of standard-conforming code equivalent to the above example
25981 -are:
25982 - ! Fortran 90
25983 - INTEGER :: i = 1, j = 2
25984 - REAL :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x))
25985 - ! Fortran 77
25986 - INTEGER i, j
25987 - REAL x(2,2)
25988 - DATA i/1/, j/2/, x/3*0.,1./
25989 -
25990 - Note that variables which are explicitly initialized in declarations
25991 -or in `DATA' statements automatically acquire the `SAVE' attribute.
25992 -
25993 -\1f
25994 -File: gfortran.info, Node: Extensions to namelist, Next: X format descriptor without count field, Prev: Old-style variable initialization, Up: Extensions implemented in GNU Fortran
25995 -
25996 -6.1.3 Extensions to namelist
25997 -----------------------------
25998 -
25999 -GNU Fortran fully supports the Fortran 95 standard for namelist I/O
26000 -including array qualifiers, substrings and fully qualified derived
26001 -types. The output from a namelist write is compatible with namelist
26002 -read. The output has all names in upper case and indentation to column
26003 -1 after the namelist name. Two extensions are permitted:
26004 -
26005 - Old-style use of `$' instead of `&'
26006 - $MYNML
26007 - X(:)%Y(2) = 1.0 2.0 3.0
26008 - CH(1:4) = "abcd"
26009 - $END
26010 -
26011 - It should be noted that the default terminator is `/' rather than
26012 -`&END'.
26013 -
26014 - Querying of the namelist when inputting from stdin. After at least
26015 -one space, entering `?' sends to stdout the namelist name and the names
26016 -of the variables in the namelist:
26017 - ?
26018 -
26019 - &mynml
26020 - x
26021 - x%y
26022 - ch
26023 - &end
26024 -
26025 - Entering `=?' outputs the namelist to stdout, as if `WRITE(*,NML =
26026 -mynml)' had been called:
26027 - =?
26028 -
26029 - &MYNML
26030 - X(1)%Y= 0.000000 , 1.000000 , 0.000000 ,
26031 - X(2)%Y= 0.000000 , 2.000000 , 0.000000 ,
26032 - X(3)%Y= 0.000000 , 3.000000 , 0.000000 ,
26033 - CH=abcd, /
26034 -
26035 - To aid this dialog, when input is from stdin, errors send their
26036 -messages to stderr and execution continues, even if `IOSTAT' is set.
26037 -
26038 - `PRINT' namelist is permitted. This causes an error if `-std=f95'
26039 -is used.
26040 - PROGRAM test_print
26041 - REAL, dimension (4) :: x = (/1.0, 2.0, 3.0, 4.0/)
26042 - NAMELIST /mynml/ x
26043 - PRINT mynml
26044 - END PROGRAM test_print
26045 -
26046 - Expanded namelist reads are permitted. This causes an error if
26047 -`-std=f95' is used. In the following example, the first element of the
26048 -array will be given the value 0.00 and the two succeeding elements will
26049 -be given the values 1.00 and 2.00.
26050 - &MYNML
26051 - X(1,1) = 0.00 , 1.00 , 2.00
26052 - /
26053 -
26054 -\1f
26055 -File: gfortran.info, Node: X format descriptor without count field, Next: Commas in FORMAT specifications, Prev: Extensions to namelist, Up: Extensions implemented in GNU Fortran
26056 -
26057 -6.1.4 `X' format descriptor without count field
26058 ------------------------------------------------
26059 -
26060 -To support legacy codes, GNU Fortran permits the count field of the `X'
26061 -edit descriptor in `FORMAT' statements to be omitted. When omitted,
26062 -the count is implicitly assumed to be one.
26063 -
26064 - PRINT 10, 2, 3
26065 - 10 FORMAT (I1, X, I1)
26066 -
26067 -\1f
26068 -File: gfortran.info, Node: Commas in FORMAT specifications, Next: Missing period in FORMAT specifications, Prev: X format descriptor without count field, Up: Extensions implemented in GNU Fortran
26069 -
26070 -6.1.5 Commas in `FORMAT' specifications
26071 ----------------------------------------
26072 -
26073 -To support legacy codes, GNU Fortran allows the comma separator to be
26074 -omitted immediately before and after character string edit descriptors
26075 -in `FORMAT' statements.
26076 -
26077 - PRINT 10, 2, 3
26078 - 10 FORMAT ('FOO='I1' BAR='I2)
26079 -
26080 -\1f
26081 -File: gfortran.info, Node: Missing period in FORMAT specifications, Next: I/O item lists, Prev: Commas in FORMAT specifications, Up: Extensions implemented in GNU Fortran
26082 -
26083 -6.1.6 Missing period in `FORMAT' specifications
26084 ------------------------------------------------
26085 -
26086 -To support legacy codes, GNU Fortran allows missing periods in format
26087 -specifications if and only if `-std=legacy' is given on the command
26088 -line. This is considered non-conforming code and is discouraged.
26089 -
26090 - REAL :: value
26091 - READ(*,10) value
26092 - 10 FORMAT ('F4')
26093 -
26094 -\1f
26095 -File: gfortran.info, Node: I/O item lists, Next: BOZ literal constants, Prev: Missing period in FORMAT specifications, Up: Extensions implemented in GNU Fortran
26096 -
26097 -6.1.7 I/O item lists
26098 ---------------------
26099 -
26100 -To support legacy codes, GNU Fortran allows the input item list of the
26101 -`READ' statement, and the output item lists of the `WRITE' and `PRINT'
26102 -statements, to start with a comma.
26103 -
26104 -\1f
26105 -File: gfortran.info, Node: BOZ literal constants, Next: Real array indices, Prev: I/O item lists, Up: Extensions implemented in GNU Fortran
26106 -
26107 -6.1.8 BOZ literal constants
26108 ----------------------------
26109 -
26110 -Besides decimal constants, Fortran also supports binary (`b'), octal
26111 -(`o') and hexadecimal (`z') integer constants. The syntax is: `prefix
26112 -quote digits quote', were the prefix is either `b', `o' or `z', quote
26113 -is either `'' or `"' and the digits are for binary `0' or `1', for
26114 -octal between `0' and `7', and for hexadecimal between `0' and `F'.
26115 -(Example: `b'01011101''.)
26116 -
26117 - Up to Fortran 95, BOZ literals were only allowed to initialize
26118 -integer variables in DATA statements. Since Fortran 2003 BOZ literals
26119 -are also allowed as argument of `REAL', `DBLE', `INT' and `CMPLX'; the
26120 -result is the same as if the integer BOZ literal had been converted by
26121 -`TRANSFER' to, respectively, `real', `double precision', `integer' or
26122 -`complex'. As GNU Fortran extension the intrinsic procedures `FLOAT',
26123 -`DFLOAT', `COMPLEX' and `DCMPLX' are treated alike.
26124 -
26125 - As an extension, GNU Fortran allows hexadecimal BOZ literal
26126 -constants to be specified using the `X' prefix, in addition to the
26127 -standard `Z' prefix. The BOZ literal can also be specified by adding a
26128 -suffix to the string, for example, `Z'ABC'' and `'ABC'Z' are equivalent.
26129 -
26130 - Furthermore, GNU Fortran allows using BOZ literal constants outside
26131 -DATA statements and the four intrinsic functions allowed by Fortran
26132 -2003. In DATA statements, in direct assignments, where the right-hand
26133 -side only contains a BOZ literal constant, and for old-style
26134 -initializers of the form `integer i /o'0173'/', the constant is
26135 -transferred as if `TRANSFER' had been used; for `COMPLEX' numbers, only
26136 -the real part is initialized unless `CMPLX' is used. In all other
26137 -cases, the BOZ literal constant is converted to an `INTEGER' value with
26138 -the largest decimal representation. This value is then converted
26139 -numerically to the type and kind of the variable in question. (For
26140 -instance `real :: r = b'0000001' + 1' initializes `r' with `2.0'.) As
26141 -different compilers implement the extension differently, one should be
26142 -careful when doing bitwise initialization of non-integer variables.
26143 -
26144 - Note that initializing an `INTEGER' variable with a statement such
26145 -as `DATA i/Z'FFFFFFFF'/' will give an integer overflow error rather
26146 -than the desired result of -1 when `i' is a 32-bit integer on a system
26147 -that supports 64-bit integers. The `-fno-range-check' option can be
26148 -used as a workaround for legacy code that initializes integers in this
26149 -manner.
26150 -
26151 -\1f
26152 -File: gfortran.info, Node: Real array indices, Next: Unary operators, Prev: BOZ literal constants, Up: Extensions implemented in GNU Fortran
26153 -
26154 -6.1.9 Real array indices
26155 -------------------------
26156 -
26157 -As an extension, GNU Fortran allows the use of `REAL' expressions or
26158 -variables as array indices.
26159 -
26160 -\1f
26161 -File: gfortran.info, Node: Unary operators, Next: Implicitly convert LOGICAL and INTEGER values, Prev: Real array indices, Up: Extensions implemented in GNU Fortran
26162 -
26163 -6.1.10 Unary operators
26164 -----------------------
26165 -
26166 -As an extension, GNU Fortran allows unary plus and unary minus operators
26167 -to appear as the second operand of binary arithmetic operators without
26168 -the need for parenthesis.
26169 -
26170 - X = Y * -Z
26171 -
26172 -\1f
26173 -File: gfortran.info, Node: Implicitly convert LOGICAL and INTEGER values, Next: Hollerith constants support, Prev: Unary operators, Up: Extensions implemented in GNU Fortran
26174 -
26175 -6.1.11 Implicitly convert `LOGICAL' and `INTEGER' values
26176 ---------------------------------------------------------
26177 -
26178 -As an extension for backwards compatibility with other compilers, GNU
26179 -Fortran allows the implicit conversion of `LOGICAL' values to `INTEGER'
26180 -values and vice versa. When converting from a `LOGICAL' to an
26181 -`INTEGER', `.FALSE.' is interpreted as zero, and `.TRUE.' is
26182 -interpreted as one. When converting from `INTEGER' to `LOGICAL', the
26183 -value zero is interpreted as `.FALSE.' and any nonzero value is
26184 -interpreted as `.TRUE.'.
26185 -
26186 - LOGICAL :: l
26187 - l = 1
26188 -
26189 - INTEGER :: i
26190 - i = .TRUE.
26191 -
26192 - However, there is no implicit conversion of `INTEGER' values in
26193 -`if'-statements, nor of `LOGICAL' or `INTEGER' values in I/O operations.
26194 -
26195 -\1f
26196 -File: gfortran.info, Node: Hollerith constants support, Next: Cray pointers, Prev: Implicitly convert LOGICAL and INTEGER values, Up: Extensions implemented in GNU Fortran
26197 -
26198 -6.1.12 Hollerith constants support
26199 -----------------------------------
26200 -
26201 -GNU Fortran supports Hollerith constants in assignments, function
26202 -arguments, and `DATA' and `ASSIGN' statements. A Hollerith constant is
26203 -written as a string of characters preceded by an integer constant
26204 -indicating the character count, and the letter `H' or `h', and stored
26205 -in bytewise fashion in a numeric (`INTEGER', `REAL', or `complex') or
26206 -`LOGICAL' variable. The constant will be padded or truncated to fit
26207 -the size of the variable in which it is stored.
26208 -
26209 - Examples of valid uses of Hollerith constants:
26210 - complex*16 x(2)
26211 - data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
26212 - x(1) = 16HABCDEFGHIJKLMNOP
26213 - call foo (4h abc)
26214 -
26215 - Invalid Hollerith constants examples:
26216 - integer*4 a
26217 - a = 8H12345678 ! Valid, but the Hollerith constant will be truncated.
26218 - a = 0H ! At least one character is needed.
26219 -
26220 - In general, Hollerith constants were used to provide a rudimentary
26221 -facility for handling character strings in early Fortran compilers,
26222 -prior to the introduction of `CHARACTER' variables in Fortran 77; in
26223 -those cases, the standard-compliant equivalent is to convert the
26224 -program to use proper character strings. On occasion, there may be a
26225 -case where the intent is specifically to initialize a numeric variable
26226 -with a given byte sequence. In these cases, the same result can be
26227 -obtained by using the `TRANSFER' statement, as in this example.
26228 - INTEGER(KIND=4) :: a
26229 - a = TRANSFER ("abcd", a) ! equivalent to: a = 4Habcd
26230 -
26231 -\1f
26232 -File: gfortran.info, Node: Cray pointers, Next: CONVERT specifier, Prev: Hollerith constants support, Up: Extensions implemented in GNU Fortran
26233 -
26234 -6.1.13 Cray pointers
26235 ---------------------
26236 -
26237 -Cray pointers are part of a non-standard extension that provides a
26238 -C-like pointer in Fortran. This is accomplished through a pair of
26239 -variables: an integer "pointer" that holds a memory address, and a
26240 -"pointee" that is used to dereference the pointer.
26241 -
26242 - Pointer/pointee pairs are declared in statements of the form:
26243 - pointer ( <pointer> , <pointee> )
26244 - or,
26245 - pointer ( <pointer1> , <pointee1> ), ( <pointer2> , <pointee2> ), ...
26246 - The pointer is an integer that is intended to hold a memory address.
26247 -The pointee may be an array or scalar. A pointee can be an assumed
26248 -size array--that is, the last dimension may be left unspecified by
26249 -using a `*' in place of a value--but a pointee cannot be an assumed
26250 -shape array. No space is allocated for the pointee.
26251 -
26252 - The pointee may have its type declared before or after the pointer
26253 -statement, and its array specification (if any) may be declared before,
26254 -during, or after the pointer statement. The pointer may be declared as
26255 -an integer prior to the pointer statement. However, some machines have
26256 -default integer sizes that are different than the size of a pointer,
26257 -and so the following code is not portable:
26258 - integer ipt
26259 - pointer (ipt, iarr)
26260 - If a pointer is declared with a kind that is too small, the compiler
26261 -will issue a warning; the resulting binary will probably not work
26262 -correctly, because the memory addresses stored in the pointers may be
26263 -truncated. It is safer to omit the first line of the above example; if
26264 -explicit declaration of ipt's type is omitted, then the compiler will
26265 -ensure that ipt is an integer variable large enough to hold a pointer.
26266 -
26267 - Pointer arithmetic is valid with Cray pointers, but it is not the
26268 -same as C pointer arithmetic. Cray pointers are just ordinary
26269 -integers, so the user is responsible for determining how many bytes to
26270 -add to a pointer in order to increment it. Consider the following
26271 -example:
26272 - real target(10)
26273 - real pointee(10)
26274 - pointer (ipt, pointee)
26275 - ipt = loc (target)
26276 - ipt = ipt + 1
26277 - The last statement does not set `ipt' to the address of `target(1)',
26278 -as it would in C pointer arithmetic. Adding `1' to `ipt' just adds one
26279 -byte to the address stored in `ipt'.
26280 -
26281 - Any expression involving the pointee will be translated to use the
26282 -value stored in the pointer as the base address.
26283 -
26284 - To get the address of elements, this extension provides an intrinsic
26285 -function `LOC()'. The `LOC()' function is equivalent to the `&'
26286 -operator in C, except the address is cast to an integer type:
26287 - real ar(10)
26288 - pointer(ipt, arpte(10))
26289 - real arpte
26290 - ipt = loc(ar) ! Makes arpte is an alias for ar
26291 - arpte(1) = 1.0 ! Sets ar(1) to 1.0
26292 - The pointer can also be set by a call to the `MALLOC' intrinsic (see
26293 -*note MALLOC::).
26294 -
26295 - Cray pointees often are used to alias an existing variable. For
26296 -example:
26297 - integer target(10)
26298 - integer iarr(10)
26299 - pointer (ipt, iarr)
26300 - ipt = loc(target)
26301 - As long as `ipt' remains unchanged, `iarr' is now an alias for
26302 -`target'. The optimizer, however, will not detect this aliasing, so it
26303 -is unsafe to use `iarr' and `target' simultaneously. Using a pointee
26304 -in any way that violates the Fortran aliasing rules or assumptions is
26305 -illegal. It is the user's responsibility to avoid doing this; the
26306 -compiler works under the assumption that no such aliasing occurs.
26307 -
26308 - Cray pointers will work correctly when there is no aliasing (i.e.,
26309 -when they are used to access a dynamically allocated block of memory),
26310 -and also in any routine where a pointee is used, but any variable with
26311 -which it shares storage is not used. Code that violates these rules
26312 -may not run as the user intends. This is not a bug in the optimizer;
26313 -any code that violates the aliasing rules is illegal. (Note that this
26314 -is not unique to GNU Fortran; any Fortran compiler that supports Cray
26315 -pointers will "incorrectly" optimize code with illegal aliasing.)
26316 -
26317 - There are a number of restrictions on the attributes that can be
26318 -applied to Cray pointers and pointees. Pointees may not have the
26319 -`ALLOCATABLE', `INTENT', `OPTIONAL', `DUMMY', `TARGET', `INTRINSIC', or
26320 -`POINTER' attributes. Pointers may not have the `DIMENSION', `POINTER',
26321 -`TARGET', `ALLOCATABLE', `EXTERNAL', or `INTRINSIC' attributes.
26322 -Pointees may not occur in more than one pointer statement. A pointee
26323 -cannot be a pointer. Pointees cannot occur in equivalence, common, or
26324 -data statements.
26325 -
26326 - A Cray pointer may also point to a function or a subroutine. For
26327 -example, the following excerpt is valid:
26328 - implicit none
26329 - external sub
26330 - pointer (subptr,subpte)
26331 - external subpte
26332 - subptr = loc(sub)
26333 - call subpte()
26334 - [...]
26335 - subroutine sub
26336 - [...]
26337 - end subroutine sub
26338 -
26339 - A pointer may be modified during the course of a program, and this
26340 -will change the location to which the pointee refers. However, when
26341 -pointees are passed as arguments, they are treated as ordinary
26342 -variables in the invoked function. Subsequent changes to the pointer
26343 -will not change the base address of the array that was passed.
26344 -
26345 -\1f
26346 -File: gfortran.info, Node: CONVERT specifier, Next: OpenMP, Prev: Cray pointers, Up: Extensions implemented in GNU Fortran
26347 -
26348 -6.1.14 `CONVERT' specifier
26349 ---------------------------
26350 -
26351 -GNU Fortran allows the conversion of unformatted data between little-
26352 -and big-endian representation to facilitate moving of data between
26353 -different systems. The conversion can be indicated with the `CONVERT'
26354 -specifier on the `OPEN' statement. *Note GFORTRAN_CONVERT_UNIT::, for
26355 -an alternative way of specifying the data format via an environment
26356 -variable.
26357 -
26358 - Valid values for `CONVERT' are:
26359 - `CONVERT='NATIVE'' Use the native format. This is the default.
26360 -
26361 - `CONVERT='SWAP'' Swap between little- and big-endian.
26362 -
26363 - `CONVERT='LITTLE_ENDIAN'' Use the little-endian representation for
26364 - unformatted files.
26365 -
26366 - `CONVERT='BIG_ENDIAN'' Use the big-endian representation for
26367 - unformatted files.
26368 -
26369 - Using the option could look like this:
26370 - open(file='big.dat',form='unformatted',access='sequential', &
26371 - convert='big_endian')
26372 -
26373 - The value of the conversion can be queried by using
26374 -`INQUIRE(CONVERT=ch)'. The values returned are `'BIG_ENDIAN'' and
26375 -`'LITTLE_ENDIAN''.
26376 -
26377 - `CONVERT' works between big- and little-endian for `INTEGER' values
26378 -of all supported kinds and for `REAL' on IEEE systems of kinds 4 and 8.
26379 -Conversion between different "extended double" types on different
26380 -architectures such as m68k and x86_64, which GNU Fortran supports as
26381 -`REAL(KIND=10)' and `REAL(KIND=16)', will probably not work.
26382 -
26383 - _Note that the values specified via the GFORTRAN_CONVERT_UNIT
26384 -environment variable will override the CONVERT specifier in the open
26385 -statement_. This is to give control over data formats to users who do
26386 -not have the source code of their program available.
26387 -
26388 - Using anything but the native representation for unformatted data
26389 -carries a significant speed overhead. If speed in this area matters to
26390 -you, it is best if you use this only for data that needs to be portable.
26391 -
26392 -\1f
26393 -File: gfortran.info, Node: OpenMP, Next: Argument list functions, Prev: CONVERT specifier, Up: Extensions implemented in GNU Fortran
26394 -
26395 -6.1.15 OpenMP
26396 --------------
26397 -
26398 -OpenMP (Open Multi-Processing) is an application programming interface
26399 -(API) that supports multi-platform shared memory multiprocessing
26400 -programming in C/C++ and Fortran on many architectures, including Unix
26401 -and Microsoft Windows platforms. It consists of a set of compiler
26402 -directives, library routines, and environment variables that influence
26403 -run-time behavior.
26404 -
26405 - GNU Fortran strives to be compatible to the OpenMP Application
26406 -Program Interface v2.5
26407 -(http://www.openmp.org/drupal/mp-documents/spec25.pdf).
26408 -
26409 - To enable the processing of the OpenMP directive `!$omp' in
26410 -free-form source code; the `c$omp', `*$omp' and `!$omp' directives in
26411 -fixed form; the `!$' conditional compilation sentinels in free form;
26412 -and the `c$', `*$' and `!$' sentinels in fixed form, `gfortran' needs
26413 -to be invoked with the `-fopenmp'. This also arranges for automatic
26414 -linking of the GNU OpenMP runtime library *note libgomp: (libgomp)Top.
26415 -
26416 - The OpenMP Fortran runtime library routines are provided both in a
26417 -form of a Fortran 90 module named `omp_lib' and in a form of a Fortran
26418 -`include' file named `omp_lib.h'.
26419 -
26420 - An example of a parallelized loop taken from Appendix A.1 of the
26421 -OpenMP Application Program Interface v2.5:
26422 - SUBROUTINE A1(N, A, B)
26423 - INTEGER I, N
26424 - REAL B(N), A(N)
26425 - !$OMP PARALLEL DO !I is private by default
26426 - DO I=2,N
26427 - B(I) = (A(I) + A(I-1)) / 2.0
26428 - ENDDO
26429 - !$OMP END PARALLEL DO
26430 - END SUBROUTINE A1
26431 -
26432 - Please note:
26433 - * `-fopenmp' implies `-frecursive', i.e., all local arrays will be
26434 - allocated on the stack. When porting existing code to OpenMP, this
26435 - may lead to surprising results, especially to segmentation faults
26436 - if the stacksize is limited.
26437 -
26438 - * On glibc-based systems, OpenMP enabled applications can not be
26439 - statically linked due to limitations of the underlying
26440 - pthreads-implementation. It might be possible to get a working
26441 - solution if `-Wl,--whole-archive -lpthread -Wl,--no-whole-archive'
26442 - is added to the command line. However, this is not supported by
26443 - `gcc' and thus not recommended.
26444 -
26445 -\1f
26446 -File: gfortran.info, Node: Argument list functions, Prev: OpenMP, Up: Extensions implemented in GNU Fortran
26447 -
26448 -6.1.16 Argument list functions `%VAL', `%REF' and `%LOC'
26449 ---------------------------------------------------------
26450 -
26451 -GNU Fortran supports argument list functions `%VAL', `%REF' and `%LOC'
26452 -statements, for backward compatibility with g77. It is recommended
26453 -that these should be used only for code that is accessing facilities
26454 -outside of GNU Fortran, such as operating system or windowing
26455 -facilities. It is best to constrain such uses to isolated portions of a
26456 -program-portions that deal specifically and exclusively with low-level,
26457 -system-dependent facilities. Such portions might well provide a
26458 -portable interface for use by the program as a whole, but are
26459 -themselves not portable, and should be thoroughly tested each time they
26460 -are rebuilt using a new compiler or version of a compiler.
26461 -
26462 - `%VAL' passes a scalar argument by value, `%REF' passes it by
26463 -reference and `%LOC' passes its memory location. Since gfortran
26464 -already passes scalar arguments by reference, `%REF' is in effect a
26465 -do-nothing. `%LOC' has the same effect as a fortran pointer.
26466 -
26467 - An example of passing an argument by value to a C subroutine foo.:
26468 - C
26469 - C prototype void foo_ (float x);
26470 - C
26471 - external foo
26472 - real*4 x
26473 - x = 3.14159
26474 - call foo (%VAL (x))
26475 - end
26476 -
26477 - For details refer to the g77 manual
26478 -`http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top'.
26479 -
26480 - Also, the gfortran testsuite c_by_val.f and its partner c_by_val.c
26481 -are worth a look.
26482 -
26483 -\1f
26484 -File: gfortran.info, Node: Extensions not implemented in GNU Fortran, Prev: Extensions implemented in GNU Fortran, Up: Extensions
26485 -
26486 -6.2 Extensions not implemented in GNU Fortran
26487 -=============================================
26488 -
26489 -The long history of the Fortran language, its wide use and broad
26490 -userbase, the large number of different compiler vendors and the lack of
26491 -some features crucial to users in the first standards have lead to the
26492 -existence of a number of important extensions to the language. While
26493 -some of the most useful or popular extensions are supported by the GNU
26494 -Fortran compiler, not all existing extensions are supported. This
26495 -section aims at listing these extensions and offering advice on how
26496 -best make code that uses them running with the GNU Fortran compiler.
26497 -
26498 -* Menu:
26499 -
26500 -* STRUCTURE and RECORD::
26501 -* ENCODE and DECODE statements::
26502 -
26503 -\1f
26504 -File: gfortran.info, Node: STRUCTURE and RECORD, Next: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran
26505 -
26506 -6.2.1 `STRUCTURE' and `RECORD'
26507 -------------------------------
26508 -
26509 -Structures are user-defined aggregate data types; this functionality was
26510 -standardized in Fortran 90 with an different syntax, under the name of
26511 -"derived types". Here is an example of code using the non portable
26512 -structure syntax:
26513 -
26514 - ! Declaring a structure named ``item'' and containing three fields:
26515 - ! an integer ID, an description string and a floating-point price.
26516 - STRUCTURE /item/
26517 - INTEGER id
26518 - CHARACTER(LEN=200) description
26519 - REAL price
26520 - END STRUCTURE
26521 -
26522 - ! Define two variables, an single record of type ``item''
26523 - ! named ``pear'', and an array of items named ``store_catalog''
26524 - RECORD /item/ pear, store_catalog(100)
26525 -
26526 - ! We can directly access the fields of both variables
26527 - pear.id = 92316
26528 - pear.description = "juicy D'Anjou pear"
26529 - pear.price = 0.15
26530 - store_catalog(7).id = 7831
26531 - store_catalog(7).description = "milk bottle"
26532 - store_catalog(7).price = 1.2
26533 -
26534 - ! We can also manipulate the whole structure
26535 - store_catalog(12) = pear
26536 - print *, store_catalog(12)
26537 -
26538 -This code can easily be rewritten in the Fortran 90 syntax as following:
26539 -
26540 - ! ``STRUCTURE /name/ ... END STRUCTURE'' becomes
26541 - ! ``TYPE name ... END TYPE''
26542 - TYPE item
26543 - INTEGER id
26544 - CHARACTER(LEN=200) description
26545 - REAL price
26546 - END TYPE
26547 -
26548 - ! ``RECORD /name/ variable'' becomes ``TYPE(name) variable''
26549 - TYPE(item) pear, store_catalog(100)
26550 -
26551 - ! Instead of using a dot (.) to access fields of a record, the
26552 - ! standard syntax uses a percent sign (%)
26553 - pear%id = 92316
26554 - pear%description = "juicy D'Anjou pear"
26555 - pear%price = 0.15
26556 - store_catalog(7)%id = 7831
26557 - store_catalog(7)%description = "milk bottle"
26558 - store_catalog(7)%price = 1.2
26559 -
26560 - ! Assignments of a whole variable don't change
26561 - store_catalog(12) = pear
26562 - print *, store_catalog(12)
26563 -
26564 -\1f
26565 -File: gfortran.info, Node: ENCODE and DECODE statements, Prev: STRUCTURE and RECORD, Up: Extensions not implemented in GNU Fortran
26566 -
26567 -6.2.2 `ENCODE' and `DECODE' statements
26568 ---------------------------------------
26569 -
26570 -GNU Fortran doesn't support the `ENCODE' and `DECODE' statements.
26571 -These statements are best replaced by `READ' and `WRITE' statements
26572 -involving internal files (`CHARACTER' variables and arrays), which have
26573 -been part of the Fortran standard since Fortran 77. For example,
26574 -replace a code fragment like
26575 -
26576 - INTEGER*1 LINE(80)
26577 - REAL A, B, C
26578 - c ... Code that sets LINE
26579 - DECODE (80, 9000, LINE) A, B, C
26580 - 9000 FORMAT (1X, 3(F10.5))
26581 -
26582 -with the following:
26583 -
26584 - CHARACTER(LEN=80) LINE
26585 - REAL A, B, C
26586 - c ... Code that sets LINE
26587 - READ (UNIT=LINE, FMT=9000) A, B, C
26588 - 9000 FORMAT (1X, 3(F10.5))
26589 -
26590 - Similarly, replace a code fragment like
26591 -
26592 - INTEGER*1 LINE(80)
26593 - REAL A, B, C
26594 - c ... Code that sets A, B and C
26595 - ENCODE (80, 9000, LINE) A, B, C
26596 - 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
26597 -
26598 -with the following:
26599 -
26600 - INTEGER*1 LINE(80)
26601 - REAL A, B, C
26602 - c ... Code that sets A, B and C
26603 - WRITE (UNIT=LINE, FMT=9000) A, B, C
26604 - 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
26605 -
26606 -\1f
26607 -File: gfortran.info, Node: Intrinsic Procedures, Next: Intrinsic Modules, Prev: Extensions, Up: Top
26608 -
26609 -7 Intrinsic Procedures
26610 -**********************
26611 -
26612 -* Menu:
26613 -
26614 -* Introduction: Introduction to Intrinsics
26615 -* `ABORT': ABORT, Abort the program
26616 -* `ABS': ABS, Absolute value
26617 -* `ACCESS': ACCESS, Checks file access modes
26618 -* `ACHAR': ACHAR, Character in ASCII collating sequence
26619 -* `ACOS': ACOS, Arccosine function
26620 -* `ACOSH': ACOSH, Hyperbolic arccosine function
26621 -* `ADJUSTL': ADJUSTL, Left adjust a string
26622 -* `ADJUSTR': ADJUSTR, Right adjust a string
26623 -* `AIMAG': AIMAG, Imaginary part of complex number
26624 -* `AINT': AINT, Truncate to a whole number
26625 -* `ALARM': ALARM, Set an alarm clock
26626 -* `ALL': ALL, Determine if all values are true
26627 -* `ALLOCATED': ALLOCATED, Status of allocatable entity
26628 -* `AND': AND, Bitwise logical AND
26629 -* `ANINT': ANINT, Nearest whole number
26630 -* `ANY': ANY, Determine if any values are true
26631 -* `ASIN': ASIN, Arcsine function
26632 -* `ASINH': ASINH, Hyperbolic arcsine function
26633 -* `ASSOCIATED': ASSOCIATED, Status of a pointer or pointer/target pair
26634 -* `ATAN': ATAN, Arctangent function
26635 -* `ATAN2': ATAN2, Arctangent function
26636 -* `ATANH': ATANH, Hyperbolic arctangent function
26637 -* `BESSEL_J0': BESSEL_J0, Bessel function of the first kind of order 0
26638 -* `BESSEL_J1': BESSEL_J1, Bessel function of the first kind of order 1
26639 -* `BESSEL_JN': BESSEL_JN, Bessel function of the first kind
26640 -* `BESSEL_Y0': BESSEL_Y0, Bessel function of the second kind of order 0
26641 -* `BESSEL_Y1': BESSEL_Y1, Bessel function of the second kind of order 1
26642 -* `BESSEL_YN': BESSEL_YN, Bessel function of the second kind
26643 -* `BIT_SIZE': BIT_SIZE, Bit size inquiry function
26644 -* `BTEST': BTEST, Bit test function
26645 -* `C_ASSOCIATED': C_ASSOCIATED, Status of a C pointer
26646 -* `C_F_POINTER': C_F_POINTER, Convert C into Fortran pointer
26647 -* `C_F_PROCPOINTER': C_F_PROCPOINTER, Convert C into Fortran procedure pointer
26648 -* `C_FUNLOC': C_FUNLOC, Obtain the C address of a procedure
26649 -* `C_LOC': C_LOC, Obtain the C address of an object
26650 -* `C_SIZEOF': C_SIZEOF, Size in bytes of an expression
26651 -* `CEILING': CEILING, Integer ceiling function
26652 -* `CHAR': CHAR, Integer-to-character conversion function
26653 -* `CHDIR': CHDIR, Change working directory
26654 -* `CHMOD': CHMOD, Change access permissions of files
26655 -* `CMPLX': CMPLX, Complex conversion function
26656 -* `COMMAND_ARGUMENT_COUNT': COMMAND_ARGUMENT_COUNT, Get number of command line arguments
26657 -* `COMPLEX': COMPLEX, Complex conversion function
26658 -* `CONJG': CONJG, Complex conjugate function
26659 -* `COS': COS, Cosine function
26660 -* `COSH': COSH, Hyperbolic cosine function
26661 -* `COUNT': COUNT, Count occurrences of TRUE in an array
26662 -* `CPU_TIME': CPU_TIME, CPU time subroutine
26663 -* `CSHIFT': CSHIFT, Circular shift elements of an array
26664 -* `CTIME': CTIME, Subroutine (or function) to convert a time into a string
26665 -* `DATE_AND_TIME': DATE_AND_TIME, Date and time subroutine
26666 -* `DBLE': DBLE, Double precision conversion function
26667 -* `DCMPLX': DCMPLX, Double complex conversion function
26668 -* `DFLOAT': DFLOAT, Double precision conversion function
26669 -* `DIGITS': DIGITS, Significant digits function
26670 -* `DIM': DIM, Positive difference
26671 -* `DOT_PRODUCT': DOT_PRODUCT, Dot product function
26672 -* `DPROD': DPROD, Double product function
26673 -* `DREAL': DREAL, Double real part function
26674 -* `DTIME': DTIME, Execution time subroutine (or function)
26675 -* `EOSHIFT': EOSHIFT, End-off shift elements of an array
26676 -* `EPSILON': EPSILON, Epsilon function
26677 -* `ERF': ERF, Error function
26678 -* `ERFC': ERFC, Complementary error function
26679 -* `ERFC_SCALED': ERFC_SCALED, Exponentially-scaled complementary error function
26680 -* `ETIME': ETIME, Execution time subroutine (or function)
26681 -* `EXIT': EXIT, Exit the program with status.
26682 -* `EXP': EXP, Exponential function
26683 -* `EXPONENT': EXPONENT, Exponent function
26684 -* `FDATE': FDATE, Subroutine (or function) to get the current time as a string
26685 -* `FGET': FGET, Read a single character in stream mode from stdin
26686 -* `FGETC': FGETC, Read a single character in stream mode
26687 -* `FLOAT': FLOAT, Convert integer to default real
26688 -* `FLOOR': FLOOR, Integer floor function
26689 -* `FLUSH': FLUSH, Flush I/O unit(s)
26690 -* `FNUM': FNUM, File number function
26691 -* `FPUT': FPUT, Write a single character in stream mode to stdout
26692 -* `FPUTC': FPUTC, Write a single character in stream mode
26693 -* `FRACTION': FRACTION, Fractional part of the model representation
26694 -* `FREE': FREE, Memory de-allocation subroutine
26695 -* `FSEEK': FSEEK, Low level file positioning subroutine
26696 -* `FSTAT': FSTAT, Get file status
26697 -* `FTELL': FTELL, Current stream position
26698 -* `GAMMA': GAMMA, Gamma function
26699 -* `GERROR': GERROR, Get last system error message
26700 -* `GETARG': GETARG, Get command line arguments
26701 -* `GET_COMMAND': GET_COMMAND, Get the entire command line
26702 -* `GET_COMMAND_ARGUMENT': GET_COMMAND_ARGUMENT, Get command line arguments
26703 -* `GETCWD': GETCWD, Get current working directory
26704 -* `GETENV': GETENV, Get an environmental variable
26705 -* `GET_ENVIRONMENT_VARIABLE': GET_ENVIRONMENT_VARIABLE, Get an environmental variable
26706 -* `GETGID': GETGID, Group ID function
26707 -* `GETLOG': GETLOG, Get login name
26708 -* `GETPID': GETPID, Process ID function
26709 -* `GETUID': GETUID, User ID function
26710 -* `GMTIME': GMTIME, Convert time to GMT info
26711 -* `HOSTNM': HOSTNM, Get system host name
26712 -* `HUGE': HUGE, Largest number of a kind
26713 -* `HYPOT': HYPOT, Euclidian distance function
26714 -* `IACHAR': IACHAR, Code in ASCII collating sequence
26715 -* `IAND': IAND, Bitwise logical and
26716 -* `IARGC': IARGC, Get the number of command line arguments
26717 -* `IBCLR': IBCLR, Clear bit
26718 -* `IBITS': IBITS, Bit extraction
26719 -* `IBSET': IBSET, Set bit
26720 -* `ICHAR': ICHAR, Character-to-integer conversion function
26721 -* `IDATE': IDATE, Current local time (day/month/year)
26722 -* `IEOR': IEOR, Bitwise logical exclusive or
26723 -* `IERRNO': IERRNO, Function to get the last system error number
26724 -* `INDEX': INDEX intrinsic, Position of a substring within a string
26725 -* `INT': INT, Convert to integer type
26726 -* `INT2': INT2, Convert to 16-bit integer type
26727 -* `INT8': INT8, Convert to 64-bit integer type
26728 -* `IOR': IOR, Bitwise logical or
26729 -* `IRAND': IRAND, Integer pseudo-random number
26730 -* `IS_IOSTAT_END': IS_IOSTAT_END, Test for end-of-file value
26731 -* `IS_IOSTAT_EOR': IS_IOSTAT_EOR, Test for end-of-record value
26732 -* `ISATTY': ISATTY, Whether a unit is a terminal device
26733 -* `ISHFT': ISHFT, Shift bits
26734 -* `ISHFTC': ISHFTC, Shift bits circularly
26735 -* `ISNAN': ISNAN, Tests for a NaN
26736 -* `ITIME': ITIME, Current local time (hour/minutes/seconds)
26737 -* `KILL': KILL, Send a signal to a process
26738 -* `KIND': KIND, Kind of an entity
26739 -* `LBOUND': LBOUND, Lower dimension bounds of an array
26740 -* `LEADZ': LEADZ, Number of leading zero bits of an integer
26741 -* `LEN': LEN, Length of a character entity
26742 -* `LEN_TRIM': LEN_TRIM, Length of a character entity without trailing blank characters
26743 -* `LOG_GAMMA': LOG_GAMMA, Logarithm of the Gamma function
26744 -* `LGE': LGE, Lexical greater than or equal
26745 -* `LGT': LGT, Lexical greater than
26746 -* `LINK': LINK, Create a hard link
26747 -* `LLE': LLE, Lexical less than or equal
26748 -* `LLT': LLT, Lexical less than
26749 -* `LNBLNK': LNBLNK, Index of the last non-blank character in a string
26750 -* `LOC': LOC, Returns the address of a variable
26751 -* `LOG': LOG, Logarithm function
26752 -* `LOG10': LOG10, Base 10 logarithm function
26753 -* `LOGICAL': LOGICAL, Convert to logical type
26754 -* `LONG': LONG, Convert to integer type
26755 -* `LSHIFT': LSHIFT, Left shift bits
26756 -* `LSTAT': LSTAT, Get file status
26757 -* `LTIME': LTIME, Convert time to local time info
26758 -* `MALLOC': MALLOC, Dynamic memory allocation function
26759 -* `MATMUL': MATMUL, matrix multiplication
26760 -* `MAX': MAX, Maximum value of an argument list
26761 -* `MAXEXPONENT': MAXEXPONENT, Maximum exponent of a real kind
26762 -* `MAXLOC': MAXLOC, Location of the maximum value within an array
26763 -* `MAXVAL': MAXVAL, Maximum value of an array
26764 -* `MCLOCK': MCLOCK, Time function
26765 -* `MCLOCK8': MCLOCK8, Time function (64-bit)
26766 -* `MERGE': MERGE, Merge arrays
26767 -* `MIN': MIN, Minimum value of an argument list
26768 -* `MINEXPONENT': MINEXPONENT, Minimum exponent of a real kind
26769 -* `MINLOC': MINLOC, Location of the minimum value within an array
26770 -* `MINVAL': MINVAL, Minimum value of an array
26771 -* `MOD': MOD, Remainder function
26772 -* `MODULO': MODULO, Modulo function
26773 -* `MOVE_ALLOC': MOVE_ALLOC, Move allocation from one object to another
26774 -* `MVBITS': MVBITS, Move bits from one integer to another
26775 -* `NEAREST': NEAREST, Nearest representable number
26776 -* `NEW_LINE': NEW_LINE, New line character
26777 -* `NINT': NINT, Nearest whole number
26778 -* `NOT': NOT, Logical negation
26779 -* `NULL': NULL, Function that returns an disassociated pointer
26780 -* `OR': OR, Bitwise logical OR
26781 -* `PACK': PACK, Pack an array into an array of rank one
26782 -* `PERROR': PERROR, Print system error message
26783 -* `PRECISION': PRECISION, Decimal precision of a real kind
26784 -* `PRESENT': PRESENT, Determine whether an optional dummy argument is specified
26785 -* `PRODUCT': PRODUCT, Product of array elements
26786 -* `RADIX': RADIX, Base of a data model
26787 -* `RANDOM_NUMBER': RANDOM_NUMBER, Pseudo-random number
26788 -* `RANDOM_SEED': RANDOM_SEED, Initialize a pseudo-random number sequence
26789 -* `RAND': RAND, Real pseudo-random number
26790 -* `RANGE': RANGE, Decimal exponent range
26791 -* `RAN': RAN, Real pseudo-random number
26792 -* `REAL': REAL, Convert to real type
26793 -* `RENAME': RENAME, Rename a file
26794 -* `REPEAT': REPEAT, Repeated string concatenation
26795 -* `RESHAPE': RESHAPE, Function to reshape an array
26796 -* `RRSPACING': RRSPACING, Reciprocal of the relative spacing
26797 -* `RSHIFT': RSHIFT, Right shift bits
26798 -* `SCALE': SCALE, Scale a real value
26799 -* `SCAN': SCAN, Scan a string for the presence of a set of characters
26800 -* `SECNDS': SECNDS, Time function
26801 -* `SECOND': SECOND, CPU time function
26802 -* `SELECTED_CHAR_KIND': SELECTED_CHAR_KIND, Choose character kind
26803 -* `SELECTED_INT_KIND': SELECTED_INT_KIND, Choose integer kind
26804 -* `SELECTED_REAL_KIND': SELECTED_REAL_KIND, Choose real kind
26805 -* `SET_EXPONENT': SET_EXPONENT, Set the exponent of the model
26806 -* `SHAPE': SHAPE, Determine the shape of an array
26807 -* `SIGN': SIGN, Sign copying function
26808 -* `SIGNAL': SIGNAL, Signal handling subroutine (or function)
26809 -* `SIN': SIN, Sine function
26810 -* `SINH': SINH, Hyperbolic sine function
26811 -* `SIZE': SIZE, Function to determine the size of an array
26812 -* `SIZEOF': SIZEOF, Determine the size in bytes of an expression
26813 -* `SLEEP': SLEEP, Sleep for the specified number of seconds
26814 -* `SNGL': SNGL, Convert double precision real to default real
26815 -* `SPACING': SPACING, Smallest distance between two numbers of a given type
26816 -* `SPREAD': SPREAD, Add a dimension to an array
26817 -* `SQRT': SQRT, Square-root function
26818 -* `SRAND': SRAND, Reinitialize the random number generator
26819 -* `STAT': STAT, Get file status
26820 -* `SUM': SUM, Sum of array elements
26821 -* `SYMLNK': SYMLNK, Create a symbolic link
26822 -* `SYSTEM': SYSTEM, Execute a shell command
26823 -* `SYSTEM_CLOCK': SYSTEM_CLOCK, Time function
26824 -* `TAN': TAN, Tangent function
26825 -* `TANH': TANH, Hyperbolic tangent function
26826 -* `TIME': TIME, Time function
26827 -* `TIME8': TIME8, Time function (64-bit)
26828 -* `TINY': TINY, Smallest positive number of a real kind
26829 -* `TRAILZ': TRAILZ, Number of trailing zero bits of an integer
26830 -* `TRANSFER': TRANSFER, Transfer bit patterns
26831 -* `TRANSPOSE': TRANSPOSE, Transpose an array of rank two
26832 -* `TRIM': TRIM, Remove trailing blank characters of a string
26833 -* `TTYNAM': TTYNAM, Get the name of a terminal device.
26834 -* `UBOUND': UBOUND, Upper dimension bounds of an array
26835 -* `UMASK': UMASK, Set the file creation mask
26836 -* `UNLINK': UNLINK, Remove a file from the file system
26837 -* `UNPACK': UNPACK, Unpack an array of rank one into an array
26838 -* `VERIFY': VERIFY, Scan a string for the absence of a set of characters
26839 -* `XOR': XOR, Bitwise logical exclusive or
26840 -
26841 -\1f
26842 -File: gfortran.info, Node: Introduction to Intrinsics, Next: ABORT, Up: Intrinsic Procedures
26843 -
26844 -7.1 Introduction to intrinsic procedures
26845 -========================================
26846 -
26847 -The intrinsic procedures provided by GNU Fortran include all of the
26848 -intrinsic procedures required by the Fortran 95 standard, a set of
26849 -intrinsic procedures for backwards compatibility with G77, and a
26850 -selection of intrinsic procedures from the Fortran 2003 and Fortran 2008
26851 -standards. Any conflict between a description here and a description in
26852 -either the Fortran 95 standard, the Fortran 2003 standard or the Fortran
26853 -2008 standard is unintentional, and the standard(s) should be considered
26854 -authoritative.
26855 -
26856 - The enumeration of the `KIND' type parameter is processor defined in
26857 -the Fortran 95 standard. GNU Fortran defines the default integer type
26858 -and default real type by `INTEGER(KIND=4)' and `REAL(KIND=4)',
26859 -respectively. The standard mandates that both data types shall have
26860 -another kind, which have more precision. On typical target
26861 -architectures supported by `gfortran', this kind type parameter is
26862 -`KIND=8'. Hence, `REAL(KIND=8)' and `DOUBLE PRECISION' are equivalent.
26863 -In the description of generic intrinsic procedures, the kind type
26864 -parameter will be specified by `KIND=*', and in the description of
26865 -specific names for an intrinsic procedure the kind type parameter will
26866 -be explicitly given (e.g., `REAL(KIND=4)' or `REAL(KIND=8)'). Finally,
26867 -for brevity the optional `KIND=' syntax will be omitted.
26868 -
26869 - Many of the intrinsic procedures take one or more optional arguments.
26870 -This document follows the convention used in the Fortran 95 standard,
26871 -and denotes such arguments by square brackets.
26872 -
26873 - GNU Fortran offers the `-std=f95' and `-std=gnu' options, which can
26874 -be used to restrict the set of intrinsic procedures to a given
26875 -standard. By default, `gfortran' sets the `-std=gnu' option, and so
26876 -all intrinsic procedures described here are accepted. There is one
26877 -caveat. For a select group of intrinsic procedures, `g77' implemented
26878 -both a function and a subroutine. Both classes have been implemented
26879 -in `gfortran' for backwards compatibility with `g77'. It is noted here
26880 -that these functions and subroutines cannot be intermixed in a given
26881 -subprogram. In the descriptions that follow, the applicable standard
26882 -for each intrinsic procedure is noted.
26883 -
26884 -\1f
26885 -File: gfortran.info, Node: ABORT, Next: ABS, Prev: Introduction to Intrinsics, Up: Intrinsic Procedures
26886 -
26887 -7.2 `ABORT' -- Abort the program
26888 -================================
26889 -
26890 -_Description_:
26891 - `ABORT' causes immediate termination of the program. On operating
26892 - systems that support a core dump, `ABORT' will produce a core dump
26893 - even if the option `-fno-dump-core' is in effect, which is
26894 - suitable for debugging purposes.
26895 -
26896 -_Standard_:
26897 - GNU extension
26898 -
26899 -_Class_:
26900 - Subroutine
26901 -
26902 -_Syntax_:
26903 - `CALL ABORT'
26904 -
26905 -_Return value_:
26906 - Does not return.
26907 -
26908 -_Example_:
26909 - program test_abort
26910 - integer :: i = 1, j = 2
26911 - if (i /= j) call abort
26912 - end program test_abort
26913 -
26914 -_See also_:
26915 - *note EXIT::, *note KILL::
26916 -
26917 -
26918 -\1f
26919 -File: gfortran.info, Node: ABS, Next: ACCESS, Prev: ABORT, Up: Intrinsic Procedures
26920 -
26921 -7.3 `ABS' -- Absolute value
26922 -===========================
26923 -
26924 -_Description_:
26925 - `ABS(A)' computes the absolute value of `A'.
26926 -
26927 -_Standard_:
26928 - Fortran 77 and later, has overloads that are GNU extensions
26929 -
26930 -_Class_:
26931 - Elemental function
26932 -
26933 -_Syntax_:
26934 - `RESULT = ABS(A)'
26935 -
26936 -_Arguments_:
26937 - A The type of the argument shall be an `INTEGER',
26938 - `REAL', or `COMPLEX'.
26939 -
26940 -_Return value_:
26941 - The return value is of the same type and kind as the argument
26942 - except the return value is `REAL' for a `COMPLEX' argument.
26943 -
26944 -_Example_:
26945 - program test_abs
26946 - integer :: i = -1
26947 - real :: x = -1.e0
26948 - complex :: z = (-1.e0,0.e0)
26949 - i = abs(i)
26950 - x = abs(x)
26951 - x = abs(z)
26952 - end program test_abs
26953 -
26954 -_Specific names_:
26955 - Name Argument Return type Standard
26956 - `CABS(A)' `COMPLEX(4) `REAL(4)' Fortran 77 and
26957 - Z' later
26958 - `DABS(A)' `REAL(8) `REAL(8)' Fortran 77 and
26959 - X' later
26960 - `IABS(A)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
26961 - I' later
26962 - `ZABS(A)' `COMPLEX(8) `COMPLEX(8)' GNU extension
26963 - Z'
26964 - `CDABS(A)' `COMPLEX(8) `COMPLEX(8)' GNU extension
26965 - Z'
26966 -
26967 -\1f
26968 -File: gfortran.info, Node: ACCESS, Next: ACHAR, Prev: ABS, Up: Intrinsic Procedures
26969 -
26970 -7.4 `ACCESS' -- Checks file access modes
26971 -========================================
26972 -
26973 -_Description_:
26974 - `ACCESS(NAME, MODE)' checks whether the file NAME exists, is
26975 - readable, writable or executable. Except for the executable check,
26976 - `ACCESS' can be replaced by Fortran 95's `INQUIRE'.
26977 -
26978 -_Standard_:
26979 - GNU extension
26980 -
26981 -_Class_:
26982 - Inquiry function
26983 -
26984 -_Syntax_:
26985 - `RESULT = ACCESS(NAME, MODE)'
26986 -
26987 -_Arguments_:
26988 - NAME Scalar `CHARACTER' of default kind with the
26989 - file name. Tailing blank are ignored unless
26990 - the character `achar(0)' is present, then all
26991 - characters up to and excluding `achar(0)' are
26992 - used as file name.
26993 - MODE Scalar `CHARACTER' of default kind with the
26994 - file access mode, may be any concatenation of
26995 - `"r"' (readable), `"w"' (writable) and `"x"'
26996 - (executable), or `" "' to check for existence.
26997 -
26998 -_Return value_:
26999 - Returns a scalar `INTEGER', which is `0' if the file is accessible
27000 - in the given mode; otherwise or if an invalid argument has been
27001 - given for `MODE' the value `1' is returned.
27002 -
27003 -_Example_:
27004 - program access_test
27005 - implicit none
27006 - character(len=*), parameter :: file = 'test.dat'
27007 - character(len=*), parameter :: file2 = 'test.dat '//achar(0)
27008 - if(access(file,' ') == 0) print *, trim(file),' is exists'
27009 - if(access(file,'r') == 0) print *, trim(file),' is readable'
27010 - if(access(file,'w') == 0) print *, trim(file),' is writable'
27011 - if(access(file,'x') == 0) print *, trim(file),' is executable'
27012 - if(access(file2,'rwx') == 0) &
27013 - print *, trim(file2),' is readable, writable and executable'
27014 - end program access_test
27015 -
27016 -_Specific names_:
27017 -
27018 -_See also_:
27019 -
27020 -\1f
27021 -File: gfortran.info, Node: ACHAR, Next: ACOS, Prev: ACCESS, Up: Intrinsic Procedures
27022 -
27023 -7.5 `ACHAR' -- Character in ASCII collating sequence
27024 -====================================================
27025 -
27026 -_Description_:
27027 - `ACHAR(I)' returns the character located at position `I' in the
27028 - ASCII collating sequence.
27029 -
27030 -_Standard_:
27031 - Fortran 77 and later, with KIND argument Fortran 2003 and later
27032 -
27033 -_Class_:
27034 - Elemental function
27035 -
27036 -_Syntax_:
27037 - `RESULT = ACHAR(I [, KIND])'
27038 -
27039 -_Arguments_:
27040 - I The type shall be `INTEGER'.
27041 - KIND (Optional) An `INTEGER' initialization
27042 - expression indicating the kind parameter of
27043 - the result.
27044 -
27045 -_Return value_:
27046 - The return value is of type `CHARACTER' with a length of one. If
27047 - the KIND argument is present, the return value is of the specified
27048 - kind and of the default kind otherwise.
27049 -
27050 -_Example_:
27051 - program test_achar
27052 - character c
27053 - c = achar(32)
27054 - end program test_achar
27055 -
27056 -_Note_:
27057 - See *note ICHAR:: for a discussion of converting between numerical
27058 - values and formatted string representations.
27059 -
27060 -_See also_:
27061 - *note CHAR::, *note IACHAR::, *note ICHAR::
27062 -
27063 -
27064 -\1f
27065 -File: gfortran.info, Node: ACOS, Next: ACOSH, Prev: ACHAR, Up: Intrinsic Procedures
27066 -
27067 -7.6 `ACOS' -- Arccosine function
27068 -================================
27069 -
27070 -_Description_:
27071 - `ACOS(X)' computes the arccosine of X (inverse of `COS(X)').
27072 -
27073 -_Standard_:
27074 - Fortran 77 and later
27075 -
27076 -_Class_:
27077 - Elemental function
27078 -
27079 -_Syntax_:
27080 - `RESULT = ACOS(X)'
27081 -
27082 -_Arguments_:
27083 - X The type shall be `REAL' with a magnitude that
27084 - is less than or equal to one.
27085 -
27086 -_Return value_:
27087 - The return value is of type `REAL' and it lies in the range 0
27088 - \leq \acos(x) \leq \pi. The return value if of the same kind as X.
27089 -
27090 -_Example_:
27091 - program test_acos
27092 - real(8) :: x = 0.866_8
27093 - x = acos(x)
27094 - end program test_acos
27095 -
27096 -_Specific names_:
27097 - Name Argument Return type Standard
27098 - `DACOS(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27099 - later
27100 -
27101 -_See also_:
27102 - Inverse function: *note COS::
27103 -
27104 -
27105 -\1f
27106 -File: gfortran.info, Node: ACOSH, Next: ADJUSTL, Prev: ACOS, Up: Intrinsic Procedures
27107 -
27108 -7.7 `ACOSH' -- Hyperbolic arccosine function
27109 -============================================
27110 -
27111 -_Description_:
27112 - `ACOSH(X)' computes the hyperbolic arccosine of X (inverse of
27113 - `COSH(X)').
27114 -
27115 -_Standard_:
27116 - Fortran 2008 and later
27117 -
27118 -_Class_:
27119 - Elemental function
27120 -
27121 -_Syntax_:
27122 - `RESULT = ACOSH(X)'
27123 -
27124 -_Arguments_:
27125 - X The type shall be `REAL' or `COMPLEX'.
27126 -
27127 -_Return value_:
27128 - The return value has the same type and kind as X
27129 -
27130 -_Example_:
27131 - PROGRAM test_acosh
27132 - REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
27133 - WRITE (*,*) ACOSH(x)
27134 - END PROGRAM
27135 -
27136 -_Specific names_:
27137 - Name Argument Return type Standard
27138 - `DACOSH(X)' `REAL(8) X' `REAL(8)' GNU extension
27139 -
27140 -_See also_:
27141 - Inverse function: *note COSH::
27142 -
27143 -\1f
27144 -File: gfortran.info, Node: ADJUSTL, Next: ADJUSTR, Prev: ACOSH, Up: Intrinsic Procedures
27145 -
27146 -7.8 `ADJUSTL' -- Left adjust a string
27147 -=====================================
27148 -
27149 -_Description_:
27150 - `ADJUSTL(STRING)' will left adjust a string by removing leading
27151 - spaces. Spaces are inserted at the end of the string as needed.
27152 -
27153 -_Standard_:
27154 - Fortran 90 and later
27155 -
27156 -_Class_:
27157 - Elemental function
27158 -
27159 -_Syntax_:
27160 - `RESULT = ADJUSTL(STRING)'
27161 -
27162 -_Arguments_:
27163 - STRING The type shall be `CHARACTER'.
27164 -
27165 -_Return value_:
27166 - The return value is of type `CHARACTER' and of the same kind as
27167 - STRING where leading spaces are removed and the same number of
27168 - spaces are inserted on the end of STRING.
27169 -
27170 -_Example_:
27171 - program test_adjustl
27172 - character(len=20) :: str = ' gfortran'
27173 - str = adjustl(str)
27174 - print *, str
27175 - end program test_adjustl
27176 -
27177 -_See also_:
27178 - *note ADJUSTR::, *note TRIM::
27179 -
27180 -\1f
27181 -File: gfortran.info, Node: ADJUSTR, Next: AIMAG, Prev: ADJUSTL, Up: Intrinsic Procedures
27182 -
27183 -7.9 `ADJUSTR' -- Right adjust a string
27184 -======================================
27185 -
27186 -_Description_:
27187 - `ADJUSTR(STRING)' will right adjust a string by removing trailing
27188 - spaces. Spaces are inserted at the start of the string as needed.
27189 -
27190 -_Standard_:
27191 - Fortran 95 and later
27192 -
27193 -_Class_:
27194 - Elemental function
27195 -
27196 -_Syntax_:
27197 - `RESULT = ADJUSTR(STRING)'
27198 -
27199 -_Arguments_:
27200 - STR The type shall be `CHARACTER'.
27201 -
27202 -_Return value_:
27203 - The return value is of type `CHARACTER' and of the same kind as
27204 - STRING where trailing spaces are removed and the same number of
27205 - spaces are inserted at the start of STRING.
27206 -
27207 -_Example_:
27208 - program test_adjustr
27209 - character(len=20) :: str = 'gfortran'
27210 - str = adjustr(str)
27211 - print *, str
27212 - end program test_adjustr
27213 -
27214 -_See also_:
27215 - *note ADJUSTL::, *note TRIM::
27216 -
27217 -\1f
27218 -File: gfortran.info, Node: AIMAG, Next: AINT, Prev: ADJUSTR, Up: Intrinsic Procedures
27219 -
27220 -7.10 `AIMAG' -- Imaginary part of complex number
27221 -================================================
27222 -
27223 -_Description_:
27224 - `AIMAG(Z)' yields the imaginary part of complex argument `Z'. The
27225 - `IMAG(Z)' and `IMAGPART(Z)' intrinsic functions are provided for
27226 - compatibility with `g77', and their use in new code is strongly
27227 - discouraged.
27228 -
27229 -_Standard_:
27230 - Fortran 77 and later, has overloads that are GNU extensions
27231 -
27232 -_Class_:
27233 - Elemental function
27234 -
27235 -_Syntax_:
27236 - `RESULT = AIMAG(Z)'
27237 -
27238 -_Arguments_:
27239 - Z The type of the argument shall be `COMPLEX'.
27240 -
27241 -_Return value_:
27242 - The return value is of type `REAL' with the kind type parameter of
27243 - the argument.
27244 -
27245 -_Example_:
27246 - program test_aimag
27247 - complex(4) z4
27248 - complex(8) z8
27249 - z4 = cmplx(1.e0_4, 0.e0_4)
27250 - z8 = cmplx(0.e0_8, 1.e0_8)
27251 - print *, aimag(z4), dimag(z8)
27252 - end program test_aimag
27253 -
27254 -_Specific names_:
27255 - Name Argument Return type Standard
27256 - `DIMAG(Z)' `COMPLEX(8) `REAL(8)' GNU extension
27257 - Z'
27258 - `IMAG(Z)' `COMPLEX Z' `REAL' GNU extension
27259 - `IMAGPART(Z)' `COMPLEX Z' `REAL' GNU extension
27260 -
27261 -\1f
27262 -File: gfortran.info, Node: AINT, Next: ALARM, Prev: AIMAG, Up: Intrinsic Procedures
27263 -
27264 -7.11 `AINT' -- Truncate to a whole number
27265 -=========================================
27266 -
27267 -_Description_:
27268 - `AINT(A [, KIND])' truncates its argument to a whole number.
27269 -
27270 -_Standard_:
27271 - Fortran 77 and later
27272 -
27273 -_Class_:
27274 - Elemental function
27275 -
27276 -_Syntax_:
27277 - `RESULT = AINT(A [, KIND])'
27278 -
27279 -_Arguments_:
27280 - A The type of the argument shall be `REAL'.
27281 - KIND (Optional) An `INTEGER' initialization
27282 - expression indicating the kind parameter of
27283 - the result.
27284 -
27285 -_Return value_:
27286 - The return value is of type `REAL' with the kind type parameter of
27287 - the argument if the optional KIND is absent; otherwise, the kind
27288 - type parameter will be given by KIND. If the magnitude of X is
27289 - less than one, `AINT(X)' returns zero. If the magnitude is equal
27290 - to or greater than one then it returns the largest whole number
27291 - that does not exceed its magnitude. The sign is the same as the
27292 - sign of X.
27293 -
27294 -_Example_:
27295 - program test_aint
27296 - real(4) x4
27297 - real(8) x8
27298 - x4 = 1.234E0_4
27299 - x8 = 4.321_8
27300 - print *, aint(x4), dint(x8)
27301 - x8 = aint(x4,8)
27302 - end program test_aint
27303 -
27304 -_Specific names_:
27305 - Name Argument Return type Standard
27306 - `DINT(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27307 - later
27308 -
27309 -\1f
27310 -File: gfortran.info, Node: ALARM, Next: ALL, Prev: AINT, Up: Intrinsic Procedures
27311 -
27312 -7.12 `ALARM' -- Execute a routine after a given delay
27313 -=====================================================
27314 -
27315 -_Description_:
27316 - `ALARM(SECONDS, HANDLER [, STATUS])' causes external subroutine
27317 - HANDLER to be executed after a delay of SECONDS by using
27318 - `alarm(2)' to set up a signal and `signal(2)' to catch it. If
27319 - STATUS is supplied, it will be returned with the number of seconds
27320 - remaining until any previously scheduled alarm was due to be
27321 - delivered, or zero if there was no previously scheduled alarm.
27322 -
27323 -_Standard_:
27324 - GNU extension
27325 -
27326 -_Class_:
27327 - Subroutine
27328 -
27329 -_Syntax_:
27330 - `CALL ALARM(SECONDS, HANDLER [, STATUS])'
27331 -
27332 -_Arguments_:
27333 - SECONDS The type of the argument shall be a scalar
27334 - `INTEGER'. It is `INTENT(IN)'.
27335 - HANDLER Signal handler (`INTEGER FUNCTION' or
27336 - `SUBROUTINE') or dummy/global `INTEGER'
27337 - scalar. The scalar values may be either
27338 - `SIG_IGN=1' to ignore the alarm generated or
27339 - `SIG_DFL=0' to set the default action. It is
27340 - `INTENT(IN)'.
27341 - STATUS (Optional) STATUS shall be a scalar variable
27342 - of the default `INTEGER' kind. It is
27343 - `INTENT(OUT)'.
27344 -
27345 -_Example_:
27346 - program test_alarm
27347 - external handler_print
27348 - integer i
27349 - call alarm (3, handler_print, i)
27350 - print *, i
27351 - call sleep(10)
27352 - end program test_alarm
27353 - This will cause the external routine HANDLER_PRINT to be called
27354 - after 3 seconds.
27355 -
27356 -\1f
27357 -File: gfortran.info, Node: ALL, Next: ALLOCATED, Prev: ALARM, Up: Intrinsic Procedures
27358 -
27359 -7.13 `ALL' -- All values in MASK along DIM are true
27360 -===================================================
27361 -
27362 -_Description_:
27363 - `ALL(MASK [, DIM])' determines if all the values are true in MASK
27364 - in the array along dimension DIM.
27365 -
27366 -_Standard_:
27367 - Fortran 95 and later
27368 -
27369 -_Class_:
27370 - Transformational function
27371 -
27372 -_Syntax_:
27373 - `RESULT = ALL(MASK [, DIM])'
27374 -
27375 -_Arguments_:
27376 - MASK The type of the argument shall be `LOGICAL' and
27377 - it shall not be scalar.
27378 - DIM (Optional) DIM shall be a scalar integer with
27379 - a value that lies between one and the rank of
27380 - MASK.
27381 -
27382 -_Return value_:
27383 - `ALL(MASK)' returns a scalar value of type `LOGICAL' where the
27384 - kind type parameter is the same as the kind type parameter of
27385 - MASK. If DIM is present, then `ALL(MASK, DIM)' returns an array
27386 - with the rank of MASK minus 1. The shape is determined from the
27387 - shape of MASK where the DIM dimension is elided.
27388 -
27389 - (A)
27390 - `ALL(MASK)' is true if all elements of MASK are true. It
27391 - also is true if MASK has zero size; otherwise, it is false.
27392 -
27393 - (B)
27394 - If the rank of MASK is one, then `ALL(MASK,DIM)' is equivalent
27395 - to `ALL(MASK)'. If the rank is greater than one, then
27396 - `ALL(MASK,DIM)' is determined by applying `ALL' to the array
27397 - sections.
27398 -
27399 -_Example_:
27400 - program test_all
27401 - logical l
27402 - l = all((/.true., .true., .true./))
27403 - print *, l
27404 - call section
27405 - contains
27406 - subroutine section
27407 - integer a(2,3), b(2,3)
27408 - a = 1
27409 - b = 1
27410 - b(2,2) = 2
27411 - print *, all(a .eq. b, 1)
27412 - print *, all(a .eq. b, 2)
27413 - end subroutine section
27414 - end program test_all
27415 -
27416 -\1f
27417 -File: gfortran.info, Node: ALLOCATED, Next: AND, Prev: ALL, Up: Intrinsic Procedures
27418 -
27419 -7.14 `ALLOCATED' -- Status of an allocatable entity
27420 -===================================================
27421 -
27422 -_Description_:
27423 - `ALLOCATED(ARRAY)' checks the status of whether X is allocated.
27424 -
27425 -_Standard_:
27426 - Fortran 95 and later
27427 -
27428 -_Class_:
27429 - Inquiry function
27430 -
27431 -_Syntax_:
27432 - `RESULT = ALLOCATED(ARRAY)'
27433 -
27434 -_Arguments_:
27435 - ARRAY The argument shall be an `ALLOCATABLE' array.
27436 -
27437 -_Return value_:
27438 - The return value is a scalar `LOGICAL' with the default logical
27439 - kind type parameter. If ARRAY is allocated, `ALLOCATED(ARRAY)' is
27440 - `.TRUE.'; otherwise, it returns `.FALSE.'
27441 -
27442 -_Example_:
27443 - program test_allocated
27444 - integer :: i = 4
27445 - real(4), allocatable :: x(:)
27446 - if (.not. allocated(x)) allocate(x(i))
27447 - end program test_allocated
27448 -
27449 -\1f
27450 -File: gfortran.info, Node: AND, Next: ANINT, Prev: ALLOCATED, Up: Intrinsic Procedures
27451 -
27452 -7.15 `AND' -- Bitwise logical AND
27453 -=================================
27454 -
27455 -_Description_:
27456 - Bitwise logical `AND'.
27457 -
27458 - This intrinsic routine is provided for backwards compatibility with
27459 - GNU Fortran 77. For integer arguments, programmers should consider
27460 - the use of the *note IAND:: intrinsic defined by the Fortran
27461 - standard.
27462 -
27463 -_Standard_:
27464 - GNU extension
27465 -
27466 -_Class_:
27467 - Function
27468 -
27469 -_Syntax_:
27470 - `RESULT = AND(I, J)'
27471 -
27472 -_Arguments_:
27473 - I The type shall be either a scalar `INTEGER'
27474 - type or a scalar `LOGICAL' type.
27475 - J The type shall be the same as the type of I.
27476 -
27477 -_Return value_:
27478 - The return type is either a scalar `INTEGER' or a scalar
27479 - `LOGICAL'. If the kind type parameters differ, then the smaller
27480 - kind type is implicitly converted to larger kind, and the return
27481 - has the larger kind.
27482 -
27483 -_Example_:
27484 - PROGRAM test_and
27485 - LOGICAL :: T = .TRUE., F = .FALSE.
27486 - INTEGER :: a, b
27487 - DATA a / Z'F' /, b / Z'3' /
27488 -
27489 - WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
27490 - WRITE (*,*) AND(a, b)
27491 - END PROGRAM
27492 -
27493 -_See also_:
27494 - Fortran 95 elemental function: *note IAND::
27495 -
27496 -\1f
27497 -File: gfortran.info, Node: ANINT, Next: ANY, Prev: AND, Up: Intrinsic Procedures
27498 -
27499 -7.16 `ANINT' -- Nearest whole number
27500 -====================================
27501 -
27502 -_Description_:
27503 - `ANINT(A [, KIND])' rounds its argument to the nearest whole
27504 - number.
27505 -
27506 -_Standard_:
27507 - Fortran 77 and later
27508 -
27509 -_Class_:
27510 - Elemental function
27511 -
27512 -_Syntax_:
27513 - `RESULT = ANINT(A [, KIND])'
27514 -
27515 -_Arguments_:
27516 - A The type of the argument shall be `REAL'.
27517 - KIND (Optional) An `INTEGER' initialization
27518 - expression indicating the kind parameter of
27519 - the result.
27520 -
27521 -_Return value_:
27522 - The return value is of type real with the kind type parameter of
27523 - the argument if the optional KIND is absent; otherwise, the kind
27524 - type parameter will be given by KIND. If A is greater than zero,
27525 - `ANINT(A)' returns `AINT(X+0.5)'. If A is less than or equal to
27526 - zero then it returns `AINT(X-0.5)'.
27527 -
27528 -_Example_:
27529 - program test_anint
27530 - real(4) x4
27531 - real(8) x8
27532 - x4 = 1.234E0_4
27533 - x8 = 4.321_8
27534 - print *, anint(x4), dnint(x8)
27535 - x8 = anint(x4,8)
27536 - end program test_anint
27537 -
27538 -_Specific names_:
27539 - Name Argument Return type Standard
27540 - `DNINT(A)' `REAL(8) A' `REAL(8)' Fortran 77 and
27541 - later
27542 -
27543 -\1f
27544 -File: gfortran.info, Node: ANY, Next: ASIN, Prev: ANINT, Up: Intrinsic Procedures
27545 -
27546 -7.17 `ANY' -- Any value in MASK along DIM is true
27547 -=================================================
27548 -
27549 -_Description_:
27550 - `ANY(MASK [, DIM])' determines if any of the values in the logical
27551 - array MASK along dimension DIM are `.TRUE.'.
27552 -
27553 -_Standard_:
27554 - Fortran 95 and later
27555 -
27556 -_Class_:
27557 - Transformational function
27558 -
27559 -_Syntax_:
27560 - `RESULT = ANY(MASK [, DIM])'
27561 -
27562 -_Arguments_:
27563 - MASK The type of the argument shall be `LOGICAL' and
27564 - it shall not be scalar.
27565 - DIM (Optional) DIM shall be a scalar integer with
27566 - a value that lies between one and the rank of
27567 - MASK.
27568 -
27569 -_Return value_:
27570 - `ANY(MASK)' returns a scalar value of type `LOGICAL' where the
27571 - kind type parameter is the same as the kind type parameter of
27572 - MASK. If DIM is present, then `ANY(MASK, DIM)' returns an array
27573 - with the rank of MASK minus 1. The shape is determined from the
27574 - shape of MASK where the DIM dimension is elided.
27575 -
27576 - (A)
27577 - `ANY(MASK)' is true if any element of MASK is true;
27578 - otherwise, it is false. It also is false if MASK has zero
27579 - size.
27580 -
27581 - (B)
27582 - If the rank of MASK is one, then `ANY(MASK,DIM)' is equivalent
27583 - to `ANY(MASK)'. If the rank is greater than one, then
27584 - `ANY(MASK,DIM)' is determined by applying `ANY' to the array
27585 - sections.
27586 -
27587 -_Example_:
27588 - program test_any
27589 - logical l
27590 - l = any((/.true., .true., .true./))
27591 - print *, l
27592 - call section
27593 - contains
27594 - subroutine section
27595 - integer a(2,3), b(2,3)
27596 - a = 1
27597 - b = 1
27598 - b(2,2) = 2
27599 - print *, any(a .eq. b, 1)
27600 - print *, any(a .eq. b, 2)
27601 - end subroutine section
27602 - end program test_any
27603 -
27604 -\1f
27605 -File: gfortran.info, Node: ASIN, Next: ASINH, Prev: ANY, Up: Intrinsic Procedures
27606 -
27607 -7.18 `ASIN' -- Arcsine function
27608 -===============================
27609 -
27610 -_Description_:
27611 - `ASIN(X)' computes the arcsine of its X (inverse of `SIN(X)').
27612 -
27613 -_Standard_:
27614 - Fortran 77 and later
27615 -
27616 -_Class_:
27617 - Elemental function
27618 -
27619 -_Syntax_:
27620 - `RESULT = ASIN(X)'
27621 -
27622 -_Arguments_:
27623 - X The type shall be `REAL', and a magnitude that
27624 - is less than or equal to one.
27625 -
27626 -_Return value_:
27627 - The return value is of type `REAL' and it lies in the range -\pi /
27628 - 2 \leq \asin (x) \leq \pi / 2. The kind type parameter is the
27629 - same as X.
27630 -
27631 -_Example_:
27632 - program test_asin
27633 - real(8) :: x = 0.866_8
27634 - x = asin(x)
27635 - end program test_asin
27636 -
27637 -_Specific names_:
27638 - Name Argument Return type Standard
27639 - `DASIN(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27640 - later
27641 -
27642 -_See also_:
27643 - Inverse function: *note SIN::
27644 -
27645 -
27646 -\1f
27647 -File: gfortran.info, Node: ASINH, Next: ASSOCIATED, Prev: ASIN, Up: Intrinsic Procedures
27648 -
27649 -7.19 `ASINH' -- Hyperbolic arcsine function
27650 -===========================================
27651 -
27652 -_Description_:
27653 - `ASINH(X)' computes the hyperbolic arcsine of X (inverse of
27654 - `SINH(X)').
27655 -
27656 -_Standard_:
27657 - Fortran 2008 and later
27658 -
27659 -_Class_:
27660 - Elemental function
27661 -
27662 -_Syntax_:
27663 - `RESULT = ASINH(X)'
27664 -
27665 -_Arguments_:
27666 - X The type shall be `REAL' or `COMPLEX'.
27667 -
27668 -_Return value_:
27669 - The return value is of the same type and kind as X.
27670 -
27671 -_Example_:
27672 - PROGRAM test_asinh
27673 - REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
27674 - WRITE (*,*) ASINH(x)
27675 - END PROGRAM
27676 -
27677 -_Specific names_:
27678 - Name Argument Return type Standard
27679 - `DASINH(X)' `REAL(8) X' `REAL(8)' GNU extension.
27680 -
27681 -_See also_:
27682 - Inverse function: *note SINH::
27683 -
27684 -\1f
27685 -File: gfortran.info, Node: ASSOCIATED, Next: ATAN, Prev: ASINH, Up: Intrinsic Procedures
27686 -
27687 -7.20 `ASSOCIATED' -- Status of a pointer or pointer/target pair
27688 -===============================================================
27689 -
27690 -_Description_:
27691 - `ASSOCIATED(POINTER [, TARGET])' determines the status of the
27692 - pointer POINTER or if POINTER is associated with the target TARGET.
27693 -
27694 -_Standard_:
27695 - Fortran 95 and later
27696 -
27697 -_Class_:
27698 - Inquiry function
27699 -
27700 -_Syntax_:
27701 - `RESULT = ASSOCIATED(POINTER [, TARGET])'
27702 -
27703 -_Arguments_:
27704 - POINTER POINTER shall have the `POINTER' attribute and
27705 - it can be of any type.
27706 - TARGET (Optional) TARGET shall be a pointer or a
27707 - target. It must have the same type, kind type
27708 - parameter, and array rank as POINTER.
27709 - The association status of neither POINTER nor TARGET shall be
27710 - undefined.
27711 -
27712 -_Return value_:
27713 - `ASSOCIATED(POINTER)' returns a scalar value of type `LOGICAL(4)'.
27714 - There are several cases:
27715 - (A) When the optional TARGET is not present then
27716 - `ASSOCIATED(POINTER)' is true if POINTER is associated with a
27717 - target; otherwise, it returns false.
27718 -
27719 - (B) If TARGET is present and a scalar target, the result is true if
27720 - TARGET is not a zero-sized storage sequence and the target
27721 - associated with POINTER occupies the same storage units. If
27722 - POINTER is disassociated, the result is false.
27723 -
27724 - (C) If TARGET is present and an array target, the result is true if
27725 - TARGET and POINTER have the same shape, are not zero-sized
27726 - arrays, are arrays whose elements are not zero-sized storage
27727 - sequences, and TARGET and POINTER occupy the same storage
27728 - units in array element order. As in case(B), the result is
27729 - false, if POINTER is disassociated.
27730 -
27731 - (D) If TARGET is present and an scalar pointer, the result is true
27732 - if TARGET is associated with POINTER, the target associated
27733 - with TARGET are not zero-sized storage sequences and occupy
27734 - the same storage units. The result is false, if either
27735 - TARGET or POINTER is disassociated.
27736 -
27737 - (E) If TARGET is present and an array pointer, the result is true if
27738 - target associated with POINTER and the target associated with
27739 - TARGET have the same shape, are not zero-sized arrays, are
27740 - arrays whose elements are not zero-sized storage sequences,
27741 - and TARGET and POINTER occupy the same storage units in array
27742 - element order. The result is false, if either TARGET or
27743 - POINTER is disassociated.
27744 -
27745 -_Example_:
27746 - program test_associated
27747 - implicit none
27748 - real, target :: tgt(2) = (/1., 2./)
27749 - real, pointer :: ptr(:)
27750 - ptr => tgt
27751 - if (associated(ptr) .eqv. .false.) call abort
27752 - if (associated(ptr,tgt) .eqv. .false.) call abort
27753 - end program test_associated
27754 -
27755 -_See also_:
27756 - *note NULL::
27757 -
27758 -\1f
27759 -File: gfortran.info, Node: ATAN, Next: ATAN2, Prev: ASSOCIATED, Up: Intrinsic Procedures
27760 -
27761 -7.21 `ATAN' -- Arctangent function
27762 -==================================
27763 -
27764 -_Description_:
27765 - `ATAN(X)' computes the arctangent of X.
27766 -
27767 -_Standard_:
27768 - Fortran 77 and later
27769 -
27770 -_Class_:
27771 - Elemental function
27772 -
27773 -_Syntax_:
27774 - `RESULT = ATAN(X)'
27775 -
27776 -_Arguments_:
27777 - X The type shall be `REAL'.
27778 -
27779 -_Return value_:
27780 - The return value is of type `REAL' and it lies in the range - \pi
27781 - / 2 \leq \atan (x) \leq \pi / 2.
27782 -
27783 -_Example_:
27784 - program test_atan
27785 - real(8) :: x = 2.866_8
27786 - x = atan(x)
27787 - end program test_atan
27788 -
27789 -_Specific names_:
27790 - Name Argument Return type Standard
27791 - `DATAN(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27792 - later
27793 -
27794 -_See also_:
27795 - Inverse function: *note TAN::
27796 -
27797 -
27798 -\1f
27799 -File: gfortran.info, Node: ATAN2, Next: ATANH, Prev: ATAN, Up: Intrinsic Procedures
27800 -
27801 -7.22 `ATAN2' -- Arctangent function
27802 -===================================
27803 -
27804 -_Description_:
27805 - `ATAN2(Y, X)' computes the arctangent of the complex number X + i
27806 - Y.
27807 -
27808 -_Standard_:
27809 - Fortran 77 and later
27810 -
27811 -_Class_:
27812 - Elemental function
27813 -
27814 -_Syntax_:
27815 - `RESULT = ATAN2(Y, X)'
27816 -
27817 -_Arguments_:
27818 - Y The type shall be `REAL'.
27819 - X The type and kind type parameter shall be the
27820 - same as Y. If Y is zero, then X must be
27821 - nonzero.
27822 -
27823 -_Return value_:
27824 - The return value has the same type and kind type parameter as Y.
27825 - It is the principal value of the complex number X + i Y. If X is
27826 - nonzero, then it lies in the range -\pi \le \atan (x) \leq \pi.
27827 - The sign is positive if Y is positive. If Y is zero, then the
27828 - return value is zero if X is positive and \pi if X is negative.
27829 - Finally, if X is zero, then the magnitude of the result is \pi/2.
27830 -
27831 -_Example_:
27832 - program test_atan2
27833 - real(4) :: x = 1.e0_4, y = 0.5e0_4
27834 - x = atan2(y,x)
27835 - end program test_atan2
27836 -
27837 -_Specific names_:
27838 - Name Argument Return type Standard
27839 - `DATAN2(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27840 - later
27841 -
27842 -\1f
27843 -File: gfortran.info, Node: ATANH, Next: BESSEL_J0, Prev: ATAN2, Up: Intrinsic Procedures
27844 -
27845 -7.23 `ATANH' -- Hyperbolic arctangent function
27846 -==============================================
27847 -
27848 -_Description_:
27849 - `ATANH(X)' computes the hyperbolic arctangent of X (inverse of
27850 - `TANH(X)').
27851 -
27852 -_Standard_:
27853 - Fortran 2008 and later
27854 -
27855 -_Class_:
27856 - Elemental function
27857 -
27858 -_Syntax_:
27859 - `RESULT = ATANH(X)'
27860 -
27861 -_Arguments_:
27862 - X The type shall be `REAL' or `COMPLEX'.
27863 -
27864 -_Return value_:
27865 - The return value has same type and kind as X.
27866 -
27867 -_Example_:
27868 - PROGRAM test_atanh
27869 - REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
27870 - WRITE (*,*) ATANH(x)
27871 - END PROGRAM
27872 -
27873 -_Specific names_:
27874 - Name Argument Return type Standard
27875 - `DATANH(X)' `REAL(8) X' `REAL(8)' GNU extension
27876 -
27877 -_See also_:
27878 - Inverse function: *note TANH::
27879 -
27880 -\1f
27881 -File: gfortran.info, Node: BESSEL_J0, Next: BESSEL_J1, Prev: ATANH, Up: Intrinsic Procedures
27882 -
27883 -7.24 `BESSEL_J0' -- Bessel function of the first kind of order 0
27884 -================================================================
27885 -
27886 -_Description_:
27887 - `BESSEL_J0(X)' computes the Bessel function of the first kind of
27888 - order 0 of X. This function is available under the name `BESJ0' as
27889 - a GNU extension.
27890 -
27891 -_Standard_:
27892 - Fortran 2008 and later
27893 -
27894 -_Class_:
27895 - Elemental function
27896 -
27897 -_Syntax_:
27898 - `RESULT = BESSEL_J0(X)'
27899 -
27900 -_Arguments_:
27901 - X The type shall be `REAL', and it shall be
27902 - scalar.
27903 -
27904 -_Return value_:
27905 - The return value is of type `REAL' and lies in the range -
27906 - 0.4027... \leq Bessel (0,x) \leq 1. It has the same kind as X.
27907 -
27908 -_Example_:
27909 - program test_besj0
27910 - real(8) :: x = 0.0_8
27911 - x = bessel_j0(x)
27912 - end program test_besj0
27913 -
27914 -_Specific names_:
27915 - Name Argument Return type Standard
27916 - `DBESJ0(X)' `REAL(8) X' `REAL(8)' GNU extension
27917 -
27918 -\1f
27919 -File: gfortran.info, Node: BESSEL_J1, Next: BESSEL_JN, Prev: BESSEL_J0, Up: Intrinsic Procedures
27920 -
27921 -7.25 `BESSEL_J1' -- Bessel function of the first kind of order 1
27922 -================================================================
27923 -
27924 -_Description_:
27925 - `BESSEL_J1(X)' computes the Bessel function of the first kind of
27926 - order 1 of X. This function is available under the name `BESJ1' as
27927 - a GNU extension.
27928 -
27929 -_Standard_:
27930 - Fortran 2008
27931 -
27932 -_Class_:
27933 - Elemental function
27934 -
27935 -_Syntax_:
27936 - `RESULT = BESSEL_J1(X)'
27937 -
27938 -_Arguments_:
27939 - X The type shall be `REAL', and it shall be
27940 - scalar.
27941 -
27942 -_Return value_:
27943 - The return value is of type `REAL' and it lies in the range -
27944 - 0.5818... \leq Bessel (0,x) \leq 0.5818 . It has the same kind as
27945 - X.
27946 -
27947 -_Example_:
27948 - program test_besj1
27949 - real(8) :: x = 1.0_8
27950 - x = bessel_j1(x)
27951 - end program test_besj1
27952 -
27953 -_Specific names_:
27954 - Name Argument Return type Standard
27955 - `DBESJ1(X)' `REAL(8) X' `REAL(8)' GNU extension
27956 -
27957 -\1f
27958 -File: gfortran.info, Node: BESSEL_JN, Next: BESSEL_Y0, Prev: BESSEL_J1, Up: Intrinsic Procedures
27959 -
27960 -7.26 `BESSEL_JN' -- Bessel function of the first kind
27961 -=====================================================
27962 -
27963 -_Description_:
27964 - `BESSEL_JN(N, X)' computes the Bessel function of the first kind of
27965 - order N of X. This function is available under the name `BESJN' as
27966 - a GNU extension.
27967 -
27968 - If both arguments are arrays, their ranks and shapes shall conform.
27969 -
27970 -_Standard_:
27971 - Fortran 2008 and later
27972 -
27973 -_Class_:
27974 - Elemental function
27975 -
27976 -_Syntax_:
27977 - `RESULT = BESSEL_JN(N, X)'
27978 -
27979 -_Arguments_:
27980 - N Shall be a scalar or an array of type
27981 - `INTEGER'.
27982 - X Shall be a scalar or an array of type `REAL'.
27983 -
27984 -_Return value_:
27985 - The return value is a scalar of type `REAL'. It has the same kind
27986 - as X.
27987 -
27988 -_Example_:
27989 - program test_besjn
27990 - real(8) :: x = 1.0_8
27991 - x = bessel_jn(5,x)
27992 - end program test_besjn
27993 -
27994 -_Specific names_:
27995 - Name Argument Return type Standard
27996 - `DBESJN(X)' `INTEGER N' `REAL(8)' GNU extension
27997 - `REAL(8) X'
27998 -
27999 -\1f
28000 -File: gfortran.info, Node: BESSEL_Y0, Next: BESSEL_Y1, Prev: BESSEL_JN, Up: Intrinsic Procedures
28001 -
28002 -7.27 `BESSEL_Y0' -- Bessel function of the second kind of order 0
28003 -=================================================================
28004 -
28005 -_Description_:
28006 - `BESSEL_Y0(X)' computes the Bessel function of the second kind of
28007 - order 0 of X. This function is available under the name `BESY0' as
28008 - a GNU extension.
28009 -
28010 -_Standard_:
28011 - Fortran 2008 and later
28012 -
28013 -_Class_:
28014 - Elemental function
28015 -
28016 -_Syntax_:
28017 - `RESULT = BESSEL_Y0(X)'
28018 -
28019 -_Arguments_:
28020 - X The type shall be `REAL', and it shall be
28021 - scalar.
28022 -
28023 -_Return value_:
28024 - The return value is a scalar of type `REAL'. It has the same kind
28025 - as X.
28026 -
28027 -_Example_:
28028 - program test_besy0
28029 - real(8) :: x = 0.0_8
28030 - x = bessel_y0(x)
28031 - end program test_besy0
28032 -
28033 -_Specific names_:
28034 - Name Argument Return type Standard
28035 - `DBESY0(X)' `REAL(8) X' `REAL(8)' GNU extension
28036 -
28037 -\1f
28038 -File: gfortran.info, Node: BESSEL_Y1, Next: BESSEL_YN, Prev: BESSEL_Y0, Up: Intrinsic Procedures
28039 -
28040 -7.28 `BESSEL_Y1' -- Bessel function of the second kind of order 1
28041 -=================================================================
28042 -
28043 -_Description_:
28044 - `BESSEL_Y1(X)' computes the Bessel function of the second kind of
28045 - order 1 of X. This function is available under the name `BESY1' as
28046 - a GNU extension.
28047 -
28048 -_Standard_:
28049 - Fortran 2008 and later
28050 -
28051 -_Class_:
28052 - Elemental function
28053 -
28054 -_Syntax_:
28055 - `RESULT = BESSEL_Y1(X)'
28056 -
28057 -_Arguments_:
28058 - X The type shall be `REAL', and it shall be
28059 - scalar.
28060 -
28061 -_Return value_:
28062 - The return value is a scalar of type `REAL'. It has the same kind
28063 - as X.
28064 -
28065 -_Example_:
28066 - program test_besy1
28067 - real(8) :: x = 1.0_8
28068 - x = bessel_y1(x)
28069 - end program test_besy1
28070 -
28071 -_Specific names_:
28072 - Name Argument Return type Standard
28073 - `DBESY1(X)' `REAL(8) X' `REAL(8)' GNU extension
28074 -
28075 -\1f
28076 -File: gfortran.info, Node: BESSEL_YN, Next: BIT_SIZE, Prev: BESSEL_Y1, Up: Intrinsic Procedures
28077 -
28078 -7.29 `BESSEL_YN' -- Bessel function of the second kind
28079 -======================================================
28080 -
28081 -_Description_:
28082 - `BESSEL_YN(N, X)' computes the Bessel function of the second kind
28083 - of order N of X. This function is available under the name `BESYN'
28084 - as a GNU extension.
28085 -
28086 - If both arguments are arrays, their ranks and shapes shall conform.
28087 -
28088 -_Standard_:
28089 - Fortran 2008 and later
28090 -
28091 -_Class_:
28092 - Elemental function
28093 -
28094 -_Syntax_:
28095 - `RESULT = BESSEL_YN(N, X)'
28096 -
28097 -_Arguments_:
28098 - N Shall be a scalar or an array of type
28099 - `INTEGER'.
28100 - X Shall be a scalar or an array of type `REAL'.
28101 -
28102 -_Return value_:
28103 - The return value is a scalar of type `REAL'. It has the same kind
28104 - as X.
28105 -
28106 -_Example_:
28107 - program test_besyn
28108 - real(8) :: x = 1.0_8
28109 - x = bessel_yn(5,x)
28110 - end program test_besyn
28111 -
28112 -_Specific names_:
28113 - Name Argument Return type Standard
28114 - `DBESYN(N,X)' `INTEGER N' `REAL(8)' GNU extension
28115 - `REAL(8)
28116 - X'
28117 -
28118 -\1f
28119 -File: gfortran.info, Node: BIT_SIZE, Next: BTEST, Prev: BESSEL_YN, Up: Intrinsic Procedures
28120 -
28121 -7.30 `BIT_SIZE' -- Bit size inquiry function
28122 -============================================
28123 -
28124 -_Description_:
28125 - `BIT_SIZE(I)' returns the number of bits (integer precision plus
28126 - sign bit) represented by the type of I. The result of
28127 - `BIT_SIZE(I)' is independent of the actual value of I.
28128 -
28129 -_Standard_:
28130 - Fortran 95 and later
28131 -
28132 -_Class_:
28133 - Inquiry function
28134 -
28135 -_Syntax_:
28136 - `RESULT = BIT_SIZE(I)'
28137 -
28138 -_Arguments_:
28139 - I The type shall be `INTEGER'.
28140 -
28141 -_Return value_:
28142 - The return value is of type `INTEGER'
28143 -
28144 -_Example_:
28145 - program test_bit_size
28146 - integer :: i = 123
28147 - integer :: size
28148 - size = bit_size(i)
28149 - print *, size
28150 - end program test_bit_size
28151 -
28152 -\1f
28153 -File: gfortran.info, Node: BTEST, Next: C_ASSOCIATED, Prev: BIT_SIZE, Up: Intrinsic Procedures
28154 -
28155 -7.31 `BTEST' -- Bit test function
28156 -=================================
28157 -
28158 -_Description_:
28159 - `BTEST(I,POS)' returns logical `.TRUE.' if the bit at POS in I is
28160 - set. The counting of the bits starts at 0.
28161 -
28162 -_Standard_:
28163 - Fortran 95 and later
28164 -
28165 -_Class_:
28166 - Elemental function
28167 -
28168 -_Syntax_:
28169 - `RESULT = BTEST(I, POS)'
28170 -
28171 -_Arguments_:
28172 - I The type shall be `INTEGER'.
28173 - POS The type shall be `INTEGER'.
28174 -
28175 -_Return value_:
28176 - The return value is of type `LOGICAL'
28177 -
28178 -_Example_:
28179 - program test_btest
28180 - integer :: i = 32768 + 1024 + 64
28181 - integer :: pos
28182 - logical :: bool
28183 - do pos=0,16
28184 - bool = btest(i, pos)
28185 - print *, pos, bool
28186 - end do
28187 - end program test_btest
28188 -
28189 -\1f
28190 -File: gfortran.info, Node: C_ASSOCIATED, Next: C_F_POINTER, Prev: BTEST, Up: Intrinsic Procedures
28191 -
28192 -7.32 `C_ASSOCIATED' -- Status of a C pointer
28193 -============================================
28194 -
28195 -_Description_:
28196 - `C_ASSOCIATED(c_prt_1[, c_ptr_2])' determines the status of the C
28197 - pointer C_PTR_1 or if C_PTR_1 is associated with the target
28198 - C_PTR_2.
28199 -
28200 -_Standard_:
28201 - Fortran 2003 and later
28202 -
28203 -_Class_:
28204 - Inquiry function
28205 -
28206 -_Syntax_:
28207 - `RESULT = C_ASSOCIATED(c_prt_1[, c_ptr_2])'
28208 -
28209 -_Arguments_:
28210 - C_PTR_1 Scalar of the type `C_PTR' or `C_FUNPTR'.
28211 - C_PTR_2 (Optional) Scalar of the same type as C_PTR_1.
28212 -
28213 -_Return value_:
28214 - The return value is of type `LOGICAL'; it is `.false.' if either
28215 - C_PTR_1 is a C NULL pointer or if C_PTR1 and C_PTR_2 point to
28216 - different addresses.
28217 -
28218 -_Example_:
28219 - subroutine association_test(a,b)
28220 - use iso_c_binding, only: c_associated, c_loc, c_ptr
28221 - implicit none
28222 - real, pointer :: a
28223 - type(c_ptr) :: b
28224 - if(c_associated(b, c_loc(a))) &
28225 - stop 'b and a do not point to same target'
28226 - end subroutine association_test
28227 -
28228 -_See also_:
28229 - *note C_LOC::, *note C_FUNLOC::
28230 -
28231 -\1f
28232 -File: gfortran.info, Node: C_FUNLOC, Next: C_LOC, Prev: C_F_PROCPOINTER, Up: Intrinsic Procedures
28233 -
28234 -7.33 `C_FUNLOC' -- Obtain the C address of a procedure
28235 -======================================================
28236 -
28237 -_Description_:
28238 - `C_FUNLOC(x)' determines the C address of the argument.
28239 -
28240 -_Standard_:
28241 - Fortran 2003 and later
28242 -
28243 -_Class_:
28244 - Inquiry function
28245 -
28246 -_Syntax_:
28247 - `RESULT = C_FUNLOC(x)'
28248 -
28249 -_Arguments_:
28250 - X Interoperable function or pointer to such
28251 - function.
28252 -
28253 -_Return value_:
28254 - The return value is of type `C_FUNPTR' and contains the C address
28255 - of the argument.
28256 -
28257 -_Example_:
28258 - module x
28259 - use iso_c_binding
28260 - implicit none
28261 - contains
28262 - subroutine sub(a) bind(c)
28263 - real(c_float) :: a
28264 - a = sqrt(a)+5.0
28265 - end subroutine sub
28266 - end module x
28267 - program main
28268 - use iso_c_binding
28269 - use x
28270 - implicit none
28271 - interface
28272 - subroutine my_routine(p) bind(c,name='myC_func')
28273 - import :: c_funptr
28274 - type(c_funptr), intent(in) :: p
28275 - end subroutine
28276 - end interface
28277 - call my_routine(c_funloc(sub))
28278 - end program main
28279 -
28280 -_See also_:
28281 - *note C_ASSOCIATED::, *note C_LOC::, *note C_F_POINTER::, *note
28282 - C_F_PROCPOINTER::
28283 -
28284 -\1f
28285 -File: gfortran.info, Node: C_F_PROCPOINTER, Next: C_FUNLOC, Prev: C_F_POINTER, Up: Intrinsic Procedures
28286 -
28287 -7.34 `C_F_PROCPOINTER' -- Convert C into Fortran procedure pointer
28288 -==================================================================
28289 -
28290 -_Description_:
28291 - `C_F_PROCPOINTER(CPTR, FPTR)' Assign the target of the C function
28292 - pointer CPTR to the Fortran procedure pointer FPTR.
28293 -
28294 - Note: Due to the currently lacking support of procedure pointers
28295 - in GNU Fortran this function is not fully operable.
28296 -
28297 -_Standard_:
28298 - Fortran 2003 and later
28299 -
28300 -_Class_:
28301 - Subroutine
28302 -
28303 -_Syntax_:
28304 - `CALL C_F_PROCPOINTER(cptr, fptr)'
28305 -
28306 -_Arguments_:
28307 - CPTR scalar of the type `C_FUNPTR'. It is
28308 - `INTENT(IN)'.
28309 - FPTR procedure pointer interoperable with CPTR. It
28310 - is `INTENT(OUT)'.
28311 -
28312 -_Example_:
28313 - program main
28314 - use iso_c_binding
28315 - implicit none
28316 - abstract interface
28317 - function func(a)
28318 - import :: c_float
28319 - real(c_float), intent(in) :: a
28320 - real(c_float) :: func
28321 - end function
28322 - end interface
28323 - interface
28324 - function getIterFunc() bind(c,name="getIterFunc")
28325 - import :: c_funptr
28326 - type(c_funptr) :: getIterFunc
28327 - end function
28328 - end interface
28329 - type(c_funptr) :: cfunptr
28330 - procedure(func), pointer :: myFunc
28331 - cfunptr = getIterFunc()
28332 - call c_f_procpointer(cfunptr, myFunc)
28333 - end program main
28334 -
28335 -_See also_:
28336 - *note C_LOC::, *note C_F_POINTER::
28337 -
28338 -\1f
28339 -File: gfortran.info, Node: C_F_POINTER, Next: C_F_PROCPOINTER, Prev: C_ASSOCIATED, Up: Intrinsic Procedures
28340 -
28341 -7.35 `C_F_POINTER' -- Convert C into Fortran pointer
28342 -====================================================
28343 -
28344 -_Description_:
28345 - `C_F_POINTER(CPTR, FPTR[, SHAPE])' Assign the target the C pointer
28346 - CPTR to the Fortran pointer FPTR and specify its shape.
28347 -
28348 -_Standard_:
28349 - Fortran 2003 and later
28350 -
28351 -_Class_:
28352 - Subroutine
28353 -
28354 -_Syntax_:
28355 - `CALL C_F_POINTER(CPTR, FPTR[, SHAPE])'
28356 -
28357 -_Arguments_:
28358 - CPTR scalar of the type `C_PTR'. It is `INTENT(IN)'.
28359 - FPTR pointer interoperable with CPTR. It is
28360 - `INTENT(OUT)'.
28361 - SHAPE (Optional) Rank-one array of type `INTEGER'
28362 - with `INTENT(IN)'. It shall be present if and
28363 - only if FPTR is an array. The size must be
28364 - equal to the rank of FPTR.
28365 -
28366 -_Example_:
28367 - program main
28368 - use iso_c_binding
28369 - implicit none
28370 - interface
28371 - subroutine my_routine(p) bind(c,name='myC_func')
28372 - import :: c_ptr
28373 - type(c_ptr), intent(out) :: p
28374 - end subroutine
28375 - end interface
28376 - type(c_ptr) :: cptr
28377 - real,pointer :: a(:)
28378 - call my_routine(cptr)
28379 - call c_f_pointer(cptr, a, [12])
28380 - end program main
28381 -
28382 -_See also_:
28383 - *note C_LOC::, *note C_F_PROCPOINTER::
28384 -
28385 -\1f
28386 -File: gfortran.info, Node: C_LOC, Next: C_SIZEOF, Prev: C_FUNLOC, Up: Intrinsic Procedures
28387 -
28388 -7.36 `C_LOC' -- Obtain the C address of an object
28389 -=================================================
28390 -
28391 -_Description_:
28392 - `C_LOC(X)' determines the C address of the argument.
28393 -
28394 -_Standard_:
28395 - Fortran 2003 and later
28396 -
28397 -_Class_:
28398 - Inquiry function
28399 -
28400 -_Syntax_:
28401 - `RESULT = C_LOC(X)'
28402 -
28403 -_Arguments_:
28404 - X Associated scalar pointer or interoperable
28405 - scalar or allocated allocatable variable with
28406 - `TARGET' attribute.
28407 -
28408 -_Return value_:
28409 - The return value is of type `C_PTR' and contains the C address of
28410 - the argument.
28411 -
28412 -_Example_:
28413 - subroutine association_test(a,b)
28414 - use iso_c_binding, only: c_associated, c_loc, c_ptr
28415 - implicit none
28416 - real, pointer :: a
28417 - type(c_ptr) :: b
28418 - if(c_associated(b, c_loc(a))) &
28419 - stop 'b and a do not point to same target'
28420 - end subroutine association_test
28421 -
28422 -_See also_:
28423 - *note C_ASSOCIATED::, *note C_FUNLOC::, *note C_F_POINTER::, *note
28424 - C_F_PROCPOINTER::
28425 -
28426 -\1f
28427 -File: gfortran.info, Node: C_SIZEOF, Next: CEILING, Prev: C_LOC, Up: Intrinsic Procedures
28428 -
28429 -7.37 `C_SIZEOF' -- Size in bytes of an expression
28430 -=================================================
28431 -
28432 -_Description_:
28433 - `C_SIZEOF(X)' calculates the number of bytes of storage the
28434 - expression `X' occupies.
28435 -
28436 -_Standard_:
28437 - Fortran 2008
28438 -
28439 -_Class_:
28440 - Intrinsic function
28441 -
28442 -_Syntax_:
28443 - `N = C_SIZEOF(X)'
28444 -
28445 -_Arguments_:
28446 - X The argument shall be of any type, rank or
28447 - shape.
28448 -
28449 -_Return value_:
28450 - The return value is of type integer and of the system-dependent
28451 - kind C_SIZE_T (from the ISO_C_BINDING module). Its value is the
28452 - number of bytes occupied by the argument. If the argument has the
28453 - `POINTER' attribute, the number of bytes of the storage area
28454 - pointed to is returned. If the argument is of a derived type with
28455 - `POINTER' or `ALLOCATABLE' components, the return value doesn't
28456 - account for the sizes of the data pointed to by these components.
28457 -
28458 -_Example_:
28459 - use iso_c_binding
28460 - integer(c_int) :: i
28461 - real(c_float) :: r, s(5)
28462 - print *, (c_sizeof(s)/c_sizeof(r) == 5)
28463 - end
28464 - The example will print `.TRUE.' unless you are using a platform
28465 - where default `REAL' variables are unusually padded.
28466 -
28467 -_See also_:
28468 - *note SIZEOF::
28469 -
28470 -\1f
28471 -File: gfortran.info, Node: CEILING, Next: CHAR, Prev: C_SIZEOF, Up: Intrinsic Procedures
28472 -
28473 -7.38 `CEILING' -- Integer ceiling function
28474 -==========================================
28475 -
28476 -_Description_:
28477 - `CEILING(A)' returns the least integer greater than or equal to A.
28478 -
28479 -_Standard_:
28480 - Fortran 95 and later
28481 -
28482 -_Class_:
28483 - Elemental function
28484 -
28485 -_Syntax_:
28486 - `RESULT = CEILING(A [, KIND])'
28487 -
28488 -_Arguments_:
28489 - A The type shall be `REAL'.
28490 - KIND (Optional) An `INTEGER' initialization
28491 - expression indicating the kind parameter of
28492 - the result.
28493 -
28494 -_Return value_:
28495 - The return value is of type `INTEGER(KIND)' if KIND is present and
28496 - a default-kind `INTEGER' otherwise.
28497 -
28498 -_Example_:
28499 - program test_ceiling
28500 - real :: x = 63.29
28501 - real :: y = -63.59
28502 - print *, ceiling(x) ! returns 64
28503 - print *, ceiling(y) ! returns -63
28504 - end program test_ceiling
28505 -
28506 -_See also_:
28507 - *note FLOOR::, *note NINT::
28508 -
28509 -
28510 -\1f
28511 -File: gfortran.info, Node: CHAR, Next: CHDIR, Prev: CEILING, Up: Intrinsic Procedures
28512 -
28513 -7.39 `CHAR' -- Character conversion function
28514 -============================================
28515 -
28516 -_Description_:
28517 - `CHAR(I [, KIND])' returns the character represented by the
28518 - integer I.
28519 -
28520 -_Standard_:
28521 - Fortran 77 and later
28522 -
28523 -_Class_:
28524 - Elemental function
28525 -
28526 -_Syntax_:
28527 - `RESULT = CHAR(I [, KIND])'
28528 -
28529 -_Arguments_:
28530 - I The type shall be `INTEGER'.
28531 - KIND (Optional) An `INTEGER' initialization
28532 - expression indicating the kind parameter of
28533 - the result.
28534 -
28535 -_Return value_:
28536 - The return value is of type `CHARACTER(1)'
28537 -
28538 -_Example_:
28539 - program test_char
28540 - integer :: i = 74
28541 - character(1) :: c
28542 - c = char(i)
28543 - print *, i, c ! returns 'J'
28544 - end program test_char
28545 -
28546 -_Note_:
28547 - See *note ICHAR:: for a discussion of converting between numerical
28548 - values and formatted string representations.
28549 -
28550 -_See also_:
28551 - *note ACHAR::, *note IACHAR::, *note ICHAR::
28552 -
28553 -
28554 -\1f
28555 -File: gfortran.info, Node: CHDIR, Next: CHMOD, Prev: CHAR, Up: Intrinsic Procedures
28556 -
28557 -7.40 `CHDIR' -- Change working directory
28558 -========================================
28559 -
28560 -_Description_:
28561 - Change current working directory to a specified path.
28562 -
28563 - This intrinsic is provided in both subroutine and function forms;
28564 - however, only one form can be used in any given program unit.
28565 -
28566 -_Standard_:
28567 - GNU extension
28568 -
28569 -_Class_:
28570 - Subroutine, function
28571 -
28572 -_Syntax_:
28573 - `CALL CHDIR(NAME [, STATUS])'
28574 - `STATUS = CHDIR(NAME)'
28575 -
28576 -_Arguments_:
28577 - NAME The type shall be `CHARACTER' of default kind
28578 - and shall specify a valid path within the file
28579 - system.
28580 - STATUS (Optional) `INTEGER' status flag of the default
28581 - kind. Returns 0 on success, and a system
28582 - specific and nonzero error code otherwise.
28583 -
28584 -_Example_:
28585 - PROGRAM test_chdir
28586 - CHARACTER(len=255) :: path
28587 - CALL getcwd(path)
28588 - WRITE(*,*) TRIM(path)
28589 - CALL chdir("/tmp")
28590 - CALL getcwd(path)
28591 - WRITE(*,*) TRIM(path)
28592 - END PROGRAM
28593 -
28594 -_See also_:
28595 - *note GETCWD::
28596 -
28597 -\1f
28598 -File: gfortran.info, Node: CHMOD, Next: CMPLX, Prev: CHDIR, Up: Intrinsic Procedures
28599 -
28600 -7.41 `CHMOD' -- Change access permissions of files
28601 -==================================================
28602 -
28603 -_Description_:
28604 - `CHMOD' changes the permissions of a file. This function invokes
28605 - `/bin/chmod' and might therefore not work on all platforms.
28606 -
28607 - This intrinsic is provided in both subroutine and function forms;
28608 - however, only one form can be used in any given program unit.
28609 -
28610 -_Standard_:
28611 - GNU extension
28612 -
28613 -_Class_:
28614 - Subroutine, function
28615 -
28616 -_Syntax_:
28617 - `CALL CHMOD(NAME, MODE[, STATUS])'
28618 - `STATUS = CHMOD(NAME, MODE)'
28619 -
28620 -_Arguments_:
28621 - NAME Scalar `CHARACTER' of default kind with the
28622 - file name. Trailing blanks are ignored unless
28623 - the character `achar(0)' is present, then all
28624 - characters up to and excluding `achar(0)' are
28625 - used as the file name.
28626 - MODE Scalar `CHARACTER' of default kind giving the
28627 - file permission. MODE uses the same syntax as
28628 - the MODE argument of `/bin/chmod'.
28629 - STATUS (optional) scalar `INTEGER', which is `0' on
28630 - success and nonzero otherwise.
28631 -
28632 -_Return value_:
28633 - In either syntax, STATUS is set to `0' on success and nonzero
28634 - otherwise.
28635 -
28636 -_Example_:
28637 - `CHMOD' as subroutine
28638 - program chmod_test
28639 - implicit none
28640 - integer :: status
28641 - call chmod('test.dat','u+x',status)
28642 - print *, 'Status: ', status
28643 - end program chmod_test
28644 - `CHMOD' as function:
28645 - program chmod_test
28646 - implicit none
28647 - integer :: status
28648 - status = chmod('test.dat','u+x')
28649 - print *, 'Status: ', status
28650 - end program chmod_test
28651 -
28652 -
28653 -\1f
28654 -File: gfortran.info, Node: CMPLX, Next: COMMAND_ARGUMENT_COUNT, Prev: CHMOD, Up: Intrinsic Procedures
28655 -
28656 -7.42 `CMPLX' -- Complex conversion function
28657 -===========================================
28658 -
28659 -_Description_:
28660 - `CMPLX(X [, Y [, KIND]])' returns a complex number where X is
28661 - converted to the real component. If Y is present it is converted
28662 - to the imaginary component. If Y is not present then the
28663 - imaginary component is set to 0.0. If X is complex then Y must
28664 - not be present.
28665 -
28666 -_Standard_:
28667 - Fortran 77 and later
28668 -
28669 -_Class_:
28670 - Elemental function
28671 -
28672 -_Syntax_:
28673 - `RESULT = CMPLX(X [, Y [, KIND]])'
28674 -
28675 -_Arguments_:
28676 - X The type may be `INTEGER', `REAL', or
28677 - `COMPLEX'.
28678 - Y (Optional; only allowed if X is not
28679 - `COMPLEX'.) May be `INTEGER' or `REAL'.
28680 - KIND (Optional) An `INTEGER' initialization
28681 - expression indicating the kind parameter of
28682 - the result.
28683 -
28684 -_Return value_:
28685 - The return value is of `COMPLEX' type, with a kind equal to KIND
28686 - if it is specified. If KIND is not specified, the result is of
28687 - the default `COMPLEX' kind, regardless of the kinds of X and Y.
28688 -
28689 -_Example_:
28690 - program test_cmplx
28691 - integer :: i = 42
28692 - real :: x = 3.14
28693 - complex :: z
28694 - z = cmplx(i, x)
28695 - print *, z, cmplx(x)
28696 - end program test_cmplx
28697 -
28698 -_See also_:
28699 - *note COMPLEX::
28700 -
28701 -\1f
28702 -File: gfortran.info, Node: COMMAND_ARGUMENT_COUNT, Next: COMPLEX, Prev: CMPLX, Up: Intrinsic Procedures
28703 -
28704 -7.43 `COMMAND_ARGUMENT_COUNT' -- Get number of command line arguments
28705 -=====================================================================
28706 -
28707 -_Description_:
28708 - `COMMAND_ARGUMENT_COUNT()' returns the number of arguments passed
28709 - on the command line when the containing program was invoked.
28710 -
28711 -_Standard_:
28712 - Fortran 2003 and later
28713 -
28714 -_Class_:
28715 - Inquiry function
28716 -
28717 -_Syntax_:
28718 - `RESULT = COMMAND_ARGUMENT_COUNT()'
28719 -
28720 -_Arguments_:
28721 - None
28722 -
28723 -_Return value_:
28724 - The return value is of type `INTEGER(4)'
28725 -
28726 -_Example_:
28727 - program test_command_argument_count
28728 - integer :: count
28729 - count = command_argument_count()
28730 - print *, count
28731 - end program test_command_argument_count
28732 -
28733 -_See also_:
28734 - *note GET_COMMAND::, *note GET_COMMAND_ARGUMENT::
28735 -
28736 -\1f
28737 -File: gfortran.info, Node: COMPLEX, Next: CONJG, Prev: COMMAND_ARGUMENT_COUNT, Up: Intrinsic Procedures
28738 -
28739 -7.44 `COMPLEX' -- Complex conversion function
28740 -=============================================
28741 -
28742 -_Description_:
28743 - `COMPLEX(X, Y)' returns a complex number where X is converted to
28744 - the real component and Y is converted to the imaginary component.
28745 -
28746 -_Standard_:
28747 - GNU extension
28748 -
28749 -_Class_:
28750 - Elemental function
28751 -
28752 -_Syntax_:
28753 - `RESULT = COMPLEX(X, Y)'
28754 -
28755 -_Arguments_:
28756 - X The type may be `INTEGER' or `REAL'.
28757 - Y The type may be `INTEGER' or `REAL'.
28758 -
28759 -_Return value_:
28760 - If X and Y are both of `INTEGER' type, then the return value is of
28761 - default `COMPLEX' type.
28762 -
28763 - If X and Y are of `REAL' type, or one is of `REAL' type and one is
28764 - of `INTEGER' type, then the return value is of `COMPLEX' type with
28765 - a kind equal to that of the `REAL' argument with the highest
28766 - precision.
28767 -
28768 -_Example_:
28769 - program test_complex
28770 - integer :: i = 42
28771 - real :: x = 3.14
28772 - print *, complex(i, x)
28773 - end program test_complex
28774 -
28775 -_See also_:
28776 - *note CMPLX::
28777 -
28778 -\1f
28779 -File: gfortran.info, Node: CONJG, Next: COS, Prev: COMPLEX, Up: Intrinsic Procedures
28780 -
28781 -7.45 `CONJG' -- Complex conjugate function
28782 -==========================================
28783 -
28784 -_Description_:
28785 - `CONJG(Z)' returns the conjugate of Z. If Z is `(x, y)' then the
28786 - result is `(x, -y)'
28787 -
28788 -_Standard_:
28789 - Fortran 77 and later, has overloads that are GNU extensions
28790 -
28791 -_Class_:
28792 - Elemental function
28793 -
28794 -_Syntax_:
28795 - `Z = CONJG(Z)'
28796 -
28797 -_Arguments_:
28798 - Z The type shall be `COMPLEX'.
28799 -
28800 -_Return value_:
28801 - The return value is of type `COMPLEX'.
28802 -
28803 -_Example_:
28804 - program test_conjg
28805 - complex :: z = (2.0, 3.0)
28806 - complex(8) :: dz = (2.71_8, -3.14_8)
28807 - z= conjg(z)
28808 - print *, z
28809 - dz = dconjg(dz)
28810 - print *, dz
28811 - end program test_conjg
28812 -
28813 -_Specific names_:
28814 - Name Argument Return type Standard
28815 - `DCONJG(Z)' `COMPLEX(8) `COMPLEX(8)' GNU extension
28816 - Z'
28817 -
28818 -\1f
28819 -File: gfortran.info, Node: COS, Next: COSH, Prev: CONJG, Up: Intrinsic Procedures
28820 -
28821 -7.46 `COS' -- Cosine function
28822 -=============================
28823 -
28824 -_Description_:
28825 - `COS(X)' computes the cosine of X.
28826 -
28827 -_Standard_:
28828 - Fortran 77 and later, has overloads that are GNU extensions
28829 -
28830 -_Class_:
28831 - Elemental function
28832 -
28833 -_Syntax_:
28834 - `RESULT = COS(X)'
28835 -
28836 -_Arguments_:
28837 - X The type shall be `REAL' or `COMPLEX'.
28838 -
28839 -_Return value_:
28840 - The return value is of type `REAL' and it lies in the range -1
28841 - \leq \cos (x) \leq 1. The kind type parameter is the same as X.
28842 -
28843 -_Example_:
28844 - program test_cos
28845 - real :: x = 0.0
28846 - x = cos(x)
28847 - end program test_cos
28848 -
28849 -_Specific names_:
28850 - Name Argument Return type Standard
28851 - `DCOS(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
28852 - later
28853 - `CCOS(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 77 and
28854 - X' later
28855 - `ZCOS(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
28856 - X'
28857 - `CDCOS(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
28858 - X'
28859 -
28860 -_See also_:
28861 - Inverse function: *note ACOS::
28862 -
28863 -
28864 -\1f
28865 -File: gfortran.info, Node: COSH, Next: COUNT, Prev: COS, Up: Intrinsic Procedures
28866 -
28867 -7.47 `COSH' -- Hyperbolic cosine function
28868 -=========================================
28869 -
28870 -_Description_:
28871 - `COSH(X)' computes the hyperbolic cosine of X.
28872 -
28873 -_Standard_:
28874 - Fortran 77 and later
28875 -
28876 -_Class_:
28877 - Elemental function
28878 -
28879 -_Syntax_:
28880 - `X = COSH(X)'
28881 -
28882 -_Arguments_:
28883 - X The type shall be `REAL'.
28884 -
28885 -_Return value_:
28886 - The return value is of type `REAL' and it is positive ( \cosh (x)
28887 - \geq 0 ). For a `REAL' argument X, \cosh (x) \geq 1 . The
28888 - return value is of the same kind as X.
28889 -
28890 -_Example_:
28891 - program test_cosh
28892 - real(8) :: x = 1.0_8
28893 - x = cosh(x)
28894 - end program test_cosh
28895 -
28896 -_Specific names_:
28897 - Name Argument Return type Standard
28898 - `DCOSH(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
28899 - later
28900 -
28901 -_See also_:
28902 - Inverse function: *note ACOSH::
28903 -
28904 -
28905 -\1f
28906 -File: gfortran.info, Node: COUNT, Next: CPU_TIME, Prev: COSH, Up: Intrinsic Procedures
28907 -
28908 -7.48 `COUNT' -- Count function
28909 -==============================
28910 -
28911 -_Description_:
28912 - `COUNT(MASK [, DIM [, KIND]])' counts the number of `.TRUE.'
28913 - elements of MASK along the dimension of DIM. If DIM is omitted it
28914 - is taken to be `1'. DIM is a scalar of type `INTEGER' in the
28915 - range of 1 /leq DIM /leq n) where n is the rank of MASK.
28916 -
28917 -_Standard_:
28918 - Fortran 95 and later, with KIND argument Fortran 2003 and later
28919 -
28920 -_Class_:
28921 - Transformational function
28922 -
28923 -_Syntax_:
28924 - `RESULT = COUNT(MASK [, DIM [, KIND]])'
28925 -
28926 -_Arguments_:
28927 - MASK The type shall be `LOGICAL'.
28928 - DIM (Optional) The type shall be `INTEGER'.
28929 - KIND (Optional) An `INTEGER' initialization
28930 - expression indicating the kind parameter of
28931 - the result.
28932 -
28933 -_Return value_:
28934 - The return value is of type `INTEGER' and of kind KIND. If KIND is
28935 - absent, the return value is of default integer kind. The result
28936 - has a rank equal to that of MASK.
28937 -
28938 -_Example_:
28939 - program test_count
28940 - integer, dimension(2,3) :: a, b
28941 - logical, dimension(2,3) :: mask
28942 - a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
28943 - b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
28944 - print '(3i3)', a(1,:)
28945 - print '(3i3)', a(2,:)
28946 - print *
28947 - print '(3i3)', b(1,:)
28948 - print '(3i3)', b(2,:)
28949 - print *
28950 - mask = a.ne.b
28951 - print '(3l3)', mask(1,:)
28952 - print '(3l3)', mask(2,:)
28953 - print *
28954 - print '(3i3)', count(mask)
28955 - print *
28956 - print '(3i3)', count(mask, 1)
28957 - print *
28958 - print '(3i3)', count(mask, 2)
28959 - end program test_count
28960 -
28961 -\1f
28962 -File: gfortran.info, Node: CPU_TIME, Next: CSHIFT, Prev: COUNT, Up: Intrinsic Procedures
28963 -
28964 -7.49 `CPU_TIME' -- CPU elapsed time in seconds
28965 -==============================================
28966 -
28967 -_Description_:
28968 - Returns a `REAL' value representing the elapsed CPU time in
28969 - seconds. This is useful for testing segments of code to determine
28970 - execution time.
28971 -
28972 - If a time source is available, time will be reported with
28973 - microsecond resolution. If no time source is available, TIME is
28974 - set to `-1.0'.
28975 -
28976 - Note that TIME may contain a, system dependent, arbitrary offset
28977 - and may not start with `0.0'. For `CPU_TIME', the absolute value
28978 - is meaningless, only differences between subsequent calls to this
28979 - subroutine, as shown in the example below, should be used.
28980 -
28981 -_Standard_:
28982 - Fortran 95 and later
28983 -
28984 -_Class_:
28985 - Subroutine
28986 -
28987 -_Syntax_:
28988 - `CALL CPU_TIME(TIME)'
28989 -
28990 -_Arguments_:
28991 - TIME The type shall be `REAL' with `INTENT(OUT)'.
28992 -
28993 -_Return value_:
28994 - None
28995 -
28996 -_Example_:
28997 - program test_cpu_time
28998 - real :: start, finish
28999 - call cpu_time(start)
29000 - ! put code to test here
29001 - call cpu_time(finish)
29002 - print '("Time = ",f6.3," seconds.")',finish-start
29003 - end program test_cpu_time
29004 -
29005 -_See also_:
29006 - *note SYSTEM_CLOCK::, *note DATE_AND_TIME::
29007 -
29008 -\1f
29009 -File: gfortran.info, Node: CSHIFT, Next: CTIME, Prev: CPU_TIME, Up: Intrinsic Procedures
29010 -
29011 -7.50 `CSHIFT' -- Circular shift elements of an array
29012 -====================================================
29013 -
29014 -_Description_:
29015 - `CSHIFT(ARRAY, SHIFT [, DIM])' performs a circular shift on
29016 - elements of ARRAY along the dimension of DIM. If DIM is omitted
29017 - it is taken to be `1'. DIM is a scalar of type `INTEGER' in the
29018 - range of 1 /leq DIM /leq n) where n is the rank of ARRAY. If the
29019 - rank of ARRAY is one, then all elements of ARRAY are shifted by
29020 - SHIFT places. If rank is greater than one, then all complete rank
29021 - one sections of ARRAY along the given dimension are shifted.
29022 - Elements shifted out one end of each rank one section are shifted
29023 - back in the other end.
29024 -
29025 -_Standard_:
29026 - Fortran 95 and later
29027 -
29028 -_Class_:
29029 - Transformational function
29030 -
29031 -_Syntax_:
29032 - `RESULT = CSHIFT(ARRAY, SHIFT [, DIM])'
29033 -
29034 -_Arguments_:
29035 - ARRAY Shall be an array of any type.
29036 - SHIFT The type shall be `INTEGER'.
29037 - DIM The type shall be `INTEGER'.
29038 -
29039 -_Return value_:
29040 - Returns an array of same type and rank as the ARRAY argument.
29041 -
29042 -_Example_:
29043 - program test_cshift
29044 - integer, dimension(3,3) :: a
29045 - a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
29046 - print '(3i3)', a(1,:)
29047 - print '(3i3)', a(2,:)
29048 - print '(3i3)', a(3,:)
29049 - a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
29050 - print *
29051 - print '(3i3)', a(1,:)
29052 - print '(3i3)', a(2,:)
29053 - print '(3i3)', a(3,:)
29054 - end program test_cshift
29055 -
29056 -\1f
29057 -File: gfortran.info, Node: CTIME, Next: DATE_AND_TIME, Prev: CSHIFT, Up: Intrinsic Procedures
29058 -
29059 -7.51 `CTIME' -- Convert a time into a string
29060 -============================================
29061 -
29062 -_Description_:
29063 - `CTIME' converts a system time value, such as returned by
29064 - `TIME8()', to a string of the form `Sat Aug 19 18:13:14 1995'.
29065 -
29066 - This intrinsic is provided in both subroutine and function forms;
29067 - however, only one form can be used in any given program unit.
29068 -
29069 -_Standard_:
29070 - GNU extension
29071 -
29072 -_Class_:
29073 - Subroutine, function
29074 -
29075 -_Syntax_:
29076 - `CALL CTIME(TIME, RESULT)'.
29077 - `RESULT = CTIME(TIME)', (not recommended).
29078 -
29079 -_Arguments_:
29080 - TIME The type shall be of type `INTEGER(KIND=8)'.
29081 - RESULT The type shall be of type `CHARACTER' and of
29082 - default kind.
29083 -
29084 -_Return value_:
29085 - The converted date and time as a string.
29086 -
29087 -_Example_:
29088 - program test_ctime
29089 - integer(8) :: i
29090 - character(len=30) :: date
29091 - i = time8()
29092 -
29093 - ! Do something, main part of the program
29094 -
29095 - call ctime(i,date)
29096 - print *, 'Program was started on ', date
29097 - end program test_ctime
29098 -
29099 -_See Also_:
29100 - *note GMTIME::, *note LTIME::, *note TIME::, *note TIME8::
29101 -
29102 -\1f
29103 -File: gfortran.info, Node: DATE_AND_TIME, Next: DBLE, Prev: CTIME, Up: Intrinsic Procedures
29104 -
29105 -7.52 `DATE_AND_TIME' -- Date and time subroutine
29106 -================================================
29107 -
29108 -_Description_:
29109 - `DATE_AND_TIME(DATE, TIME, ZONE, VALUES)' gets the corresponding
29110 - date and time information from the real-time system clock. DATE is
29111 - `INTENT(OUT)' and has form ccyymmdd. TIME is `INTENT(OUT)' and
29112 - has form hhmmss.sss. ZONE is `INTENT(OUT)' and has form (+-)hhmm,
29113 - representing the difference with respect to Coordinated Universal
29114 - Time (UTC). Unavailable time and date parameters return blanks.
29115 -
29116 - VALUES is `INTENT(OUT)' and provides the following:
29117 -
29118 - `VALUE(1)': The year
29119 - `VALUE(2)': The month
29120 - `VALUE(3)': The day of the month
29121 - `VALUE(4)': Time difference with UTC
29122 - in minutes
29123 - `VALUE(5)': The hour of the day
29124 - `VALUE(6)': The minutes of the hour
29125 - `VALUE(7)': The seconds of the minute
29126 - `VALUE(8)': The milliseconds of the
29127 - second
29128 -
29129 -_Standard_:
29130 - Fortran 95 and later
29131 -
29132 -_Class_:
29133 - Subroutine
29134 -
29135 -_Syntax_:
29136 - `CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])'
29137 -
29138 -_Arguments_:
29139 - DATE (Optional) The type shall be `CHARACTER(LEN=8)'
29140 - or larger, and of default kind.
29141 - TIME (Optional) The type shall be
29142 - `CHARACTER(LEN=10)' or larger, and of default
29143 - kind.
29144 - ZONE (Optional) The type shall be `CHARACTER(LEN=5)'
29145 - or larger, and of default kind.
29146 - VALUES (Optional) The type shall be `INTEGER(8)'.
29147 -
29148 -_Return value_:
29149 - None
29150 -
29151 -_Example_:
29152 - program test_time_and_date
29153 - character(8) :: date
29154 - character(10) :: time
29155 - character(5) :: zone
29156 - integer,dimension(8) :: values
29157 - ! using keyword arguments
29158 - call date_and_time(date,time,zone,values)
29159 - call date_and_time(DATE=date,ZONE=zone)
29160 - call date_and_time(TIME=time)
29161 - call date_and_time(VALUES=values)
29162 - print '(a,2x,a,2x,a)', date, time, zone
29163 - print '(8i5))', values
29164 - end program test_time_and_date
29165 -
29166 -_See also_:
29167 - *note CPU_TIME::, *note SYSTEM_CLOCK::
29168 -
29169 -\1f
29170 -File: gfortran.info, Node: DBLE, Next: DCMPLX, Prev: DATE_AND_TIME, Up: Intrinsic Procedures
29171 -
29172 -7.53 `DBLE' -- Double conversion function
29173 -=========================================
29174 -
29175 -_Description_:
29176 - `DBLE(A)' Converts A to double precision real type.
29177 -
29178 -_Standard_:
29179 - Fortran 77 and later
29180 -
29181 -_Class_:
29182 - Elemental function
29183 -
29184 -_Syntax_:
29185 - `RESULT = DBLE(A)'
29186 -
29187 -_Arguments_:
29188 - A The type shall be `INTEGER', `REAL', or
29189 - `COMPLEX'.
29190 -
29191 -_Return value_:
29192 - The return value is of type double precision real.
29193 -
29194 -_Example_:
29195 - program test_dble
29196 - real :: x = 2.18
29197 - integer :: i = 5
29198 - complex :: z = (2.3,1.14)
29199 - print *, dble(x), dble(i), dble(z)
29200 - end program test_dble
29201 -
29202 -_See also_:
29203 - *note DFLOAT::, *note FLOAT::, *note REAL::
29204 -
29205 -\1f
29206 -File: gfortran.info, Node: DCMPLX, Next: DFLOAT, Prev: DBLE, Up: Intrinsic Procedures
29207 -
29208 -7.54 `DCMPLX' -- Double complex conversion function
29209 -===================================================
29210 -
29211 -_Description_:
29212 - `DCMPLX(X [,Y])' returns a double complex number where X is
29213 - converted to the real component. If Y is present it is converted
29214 - to the imaginary component. If Y is not present then the
29215 - imaginary component is set to 0.0. If X is complex then Y must
29216 - not be present.
29217 -
29218 -_Standard_:
29219 - GNU extension
29220 -
29221 -_Class_:
29222 - Elemental function
29223 -
29224 -_Syntax_:
29225 - `RESULT = DCMPLX(X [, Y])'
29226 -
29227 -_Arguments_:
29228 - X The type may be `INTEGER', `REAL', or
29229 - `COMPLEX'.
29230 - Y (Optional if X is not `COMPLEX'.) May be
29231 - `INTEGER' or `REAL'.
29232 -
29233 -_Return value_:
29234 - The return value is of type `COMPLEX(8)'
29235 -
29236 -_Example_:
29237 - program test_dcmplx
29238 - integer :: i = 42
29239 - real :: x = 3.14
29240 - complex :: z
29241 - z = cmplx(i, x)
29242 - print *, dcmplx(i)
29243 - print *, dcmplx(x)
29244 - print *, dcmplx(z)
29245 - print *, dcmplx(x,i)
29246 - end program test_dcmplx
29247 -
29248 -\1f
29249 -File: gfortran.info, Node: DFLOAT, Next: DIGITS, Prev: DCMPLX, Up: Intrinsic Procedures
29250 -
29251 -7.55 `DFLOAT' -- Double conversion function
29252 -===========================================
29253 -
29254 -_Description_:
29255 - `DFLOAT(A)' Converts A to double precision real type.
29256 -
29257 -_Standard_:
29258 - GNU extension
29259 -
29260 -_Class_:
29261 - Elemental function
29262 -
29263 -_Syntax_:
29264 - `RESULT = DFLOAT(A)'
29265 -
29266 -_Arguments_:
29267 - A The type shall be `INTEGER'.
29268 -
29269 -_Return value_:
29270 - The return value is of type double precision real.
29271 -
29272 -_Example_:
29273 - program test_dfloat
29274 - integer :: i = 5
29275 - print *, dfloat(i)
29276 - end program test_dfloat
29277 -
29278 -_See also_:
29279 - *note DBLE::, *note FLOAT::, *note REAL::
29280 -
29281 -\1f
29282 -File: gfortran.info, Node: DIGITS, Next: DIM, Prev: DFLOAT, Up: Intrinsic Procedures
29283 -
29284 -7.56 `DIGITS' -- Significant binary digits function
29285 -===================================================
29286 -
29287 -_Description_:
29288 - `DIGITS(X)' returns the number of significant binary digits of the
29289 - internal model representation of X. For example, on a system
29290 - using a 32-bit floating point representation, a default real
29291 - number would likely return 24.
29292 -
29293 -_Standard_:
29294 - Fortran 95 and later
29295 -
29296 -_Class_:
29297 - Inquiry function
29298 -
29299 -_Syntax_:
29300 - `RESULT = DIGITS(X)'
29301 -
29302 -_Arguments_:
29303 - X The type may be `INTEGER' or `REAL'.
29304 -
29305 -_Return value_:
29306 - The return value is of type `INTEGER'.
29307 -
29308 -_Example_:
29309 - program test_digits
29310 - integer :: i = 12345
29311 - real :: x = 3.143
29312 - real(8) :: y = 2.33
29313 - print *, digits(i)
29314 - print *, digits(x)
29315 - print *, digits(y)
29316 - end program test_digits
29317 -
29318 -\1f
29319 -File: gfortran.info, Node: DIM, Next: DOT_PRODUCT, Prev: DIGITS, Up: Intrinsic Procedures
29320 -
29321 -7.57 `DIM' -- Positive difference
29322 -=================================
29323 -
29324 -_Description_:
29325 - `DIM(X,Y)' returns the difference `X-Y' if the result is positive;
29326 - otherwise returns zero.
29327 -
29328 -_Standard_:
29329 - Fortran 77 and later
29330 -
29331 -_Class_:
29332 - Elemental function
29333 -
29334 -_Syntax_:
29335 - `RESULT = DIM(X, Y)'
29336 -
29337 -_Arguments_:
29338 - X The type shall be `INTEGER' or `REAL'
29339 - Y The type shall be the same type and kind as X.
29340 -
29341 -_Return value_:
29342 - The return value is of type `INTEGER' or `REAL'.
29343 -
29344 -_Example_:
29345 - program test_dim
29346 - integer :: i
29347 - real(8) :: x
29348 - i = dim(4, 15)
29349 - x = dim(4.345_8, 2.111_8)
29350 - print *, i
29351 - print *, x
29352 - end program test_dim
29353 -
29354 -_Specific names_:
29355 - Name Argument Return type Standard
29356 - `IDIM(X,Y)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
29357 - X,Y' later
29358 - `DDIM(X,Y)' `REAL(8) `REAL(8)' Fortran 77 and
29359 - X,Y' later
29360 -
29361 -\1f
29362 -File: gfortran.info, Node: DOT_PRODUCT, Next: DPROD, Prev: DIM, Up: Intrinsic Procedures
29363 -
29364 -7.58 `DOT_PRODUCT' -- Dot product function
29365 -==========================================
29366 -
29367 -_Description_:
29368 - `DOT_PRODUCT(VECTOR_A, VECTOR_B)' computes the dot product
29369 - multiplication of two vectors VECTOR_A and VECTOR_B. The two
29370 - vectors may be either numeric or logical and must be arrays of
29371 - rank one and of equal size. If the vectors are `INTEGER' or
29372 - `REAL', the result is `SUM(VECTOR_A*VECTOR_B)'. If the vectors are
29373 - `COMPLEX', the result is `SUM(CONJG(VECTOR_A)*VECTOR_B)'. If the
29374 - vectors are `LOGICAL', the result is `ANY(VECTOR_A .AND.
29375 - VECTOR_B)'.
29376 -
29377 -_Standard_:
29378 - Fortran 95 and later
29379 -
29380 -_Class_:
29381 - Transformational function
29382 -
29383 -_Syntax_:
29384 - `RESULT = DOT_PRODUCT(VECTOR_A, VECTOR_B)'
29385 -
29386 -_Arguments_:
29387 - VECTOR_A The type shall be numeric or `LOGICAL', rank 1.
29388 - VECTOR_B The type shall be numeric if VECTOR_A is of
29389 - numeric type or `LOGICAL' if VECTOR_A is of
29390 - type `LOGICAL'. VECTOR_B shall be a rank-one
29391 - array.
29392 -
29393 -_Return value_:
29394 - If the arguments are numeric, the return value is a scalar of
29395 - numeric type, `INTEGER', `REAL', or `COMPLEX'. If the arguments
29396 - are `LOGICAL', the return value is `.TRUE.' or `.FALSE.'.
29397 -
29398 -_Example_:
29399 - program test_dot_prod
29400 - integer, dimension(3) :: a, b
29401 - a = (/ 1, 2, 3 /)
29402 - b = (/ 4, 5, 6 /)
29403 - print '(3i3)', a
29404 - print *
29405 - print '(3i3)', b
29406 - print *
29407 - print *, dot_product(a,b)
29408 - end program test_dot_prod
29409 -
29410 -\1f
29411 -File: gfortran.info, Node: DPROD, Next: DREAL, Prev: DOT_PRODUCT, Up: Intrinsic Procedures
29412 -
29413 -7.59 `DPROD' -- Double product function
29414 -=======================================
29415 -
29416 -_Description_:
29417 - `DPROD(X,Y)' returns the product `X*Y'.
29418 -
29419 -_Standard_:
29420 - Fortran 77 and later
29421 -
29422 -_Class_:
29423 - Elemental function
29424 -
29425 -_Syntax_:
29426 - `RESULT = DPROD(X, Y)'
29427 -
29428 -_Arguments_:
29429 - X The type shall be `REAL'.
29430 - Y The type shall be `REAL'.
29431 -
29432 -_Return value_:
29433 - The return value is of type `REAL(8)'.
29434 -
29435 -_Example_:
29436 - program test_dprod
29437 - real :: x = 5.2
29438 - real :: y = 2.3
29439 - real(8) :: d
29440 - d = dprod(x,y)
29441 - print *, d
29442 - end program test_dprod
29443 -
29444 -\1f
29445 -File: gfortran.info, Node: DREAL, Next: DTIME, Prev: DPROD, Up: Intrinsic Procedures
29446 -
29447 -7.60 `DREAL' -- Double real part function
29448 -=========================================
29449 -
29450 -_Description_:
29451 - `DREAL(Z)' returns the real part of complex variable Z.
29452 -
29453 -_Standard_:
29454 - GNU extension
29455 -
29456 -_Class_:
29457 - Elemental function
29458 -
29459 -_Syntax_:
29460 - `RESULT = DREAL(A)'
29461 -
29462 -_Arguments_:
29463 - A The type shall be `COMPLEX(8)'.
29464 -
29465 -_Return value_:
29466 - The return value is of type `REAL(8)'.
29467 -
29468 -_Example_:
29469 - program test_dreal
29470 - complex(8) :: z = (1.3_8,7.2_8)
29471 - print *, dreal(z)
29472 - end program test_dreal
29473 -
29474 -_See also_:
29475 - *note AIMAG::
29476 -
29477 -
29478 -\1f
29479 -File: gfortran.info, Node: DTIME, Next: EOSHIFT, Prev: DREAL, Up: Intrinsic Procedures
29480 -
29481 -7.61 `DTIME' -- Execution time subroutine (or function)
29482 -=======================================================
29483 -
29484 -_Description_:
29485 - `DTIME(TARRAY, RESULT)' initially returns the number of seconds of
29486 - runtime since the start of the process's execution in RESULT.
29487 - TARRAY returns the user and system components of this time in
29488 - `TARRAY(1)' and `TARRAY(2)' respectively. RESULT is equal to
29489 - `TARRAY(1) + TARRAY(2)'.
29490 -
29491 - Subsequent invocations of `DTIME' return values accumulated since
29492 - the previous invocation.
29493 -
29494 - On some systems, the underlying timings are represented using
29495 - types with sufficiently small limits that overflows (wrap around)
29496 - are possible, such as 32-bit types. Therefore, the values returned
29497 - by this intrinsic might be, or become, negative, or numerically
29498 - less than previous values, during a single run of the compiled
29499 - program.
29500 -
29501 - Please note, that this implementation is thread safe if used
29502 - within OpenMP directives, i.e., its state will be consistent while
29503 - called from multiple threads. However, if `DTIME' is called from
29504 - multiple threads, the result is still the time since the last
29505 - invocation. This may not give the intended results. If possible,
29506 - use `CPU_TIME' instead.
29507 -
29508 - This intrinsic is provided in both subroutine and function forms;
29509 - however, only one form can be used in any given program unit.
29510 -
29511 - TARRAY and RESULT are `INTENT(OUT)' and provide the following:
29512 -
29513 - `TARRAY(1)': User time in seconds.
29514 - `TARRAY(2)': System time in seconds.
29515 - `RESULT': Run time since start in
29516 - seconds.
29517 -
29518 -_Standard_:
29519 - GNU extension
29520 -
29521 -_Class_:
29522 - Subroutine, function
29523 -
29524 -_Syntax_:
29525 - `CALL DTIME(TARRAY, RESULT)'.
29526 - `RESULT = DTIME(TARRAY)', (not recommended).
29527 -
29528 -_Arguments_:
29529 - TARRAY The type shall be `REAL, DIMENSION(2)'.
29530 - RESULT The type shall be `REAL'.
29531 -
29532 -_Return value_:
29533 - Elapsed time in seconds since the last invocation or since the
29534 - start of program execution if not called before.
29535 -
29536 -_Example_:
29537 - program test_dtime
29538 - integer(8) :: i, j
29539 - real, dimension(2) :: tarray
29540 - real :: result
29541 - call dtime(tarray, result)
29542 - print *, result
29543 - print *, tarray(1)
29544 - print *, tarray(2)
29545 - do i=1,100000000 ! Just a delay
29546 - j = i * i - i
29547 - end do
29548 - call dtime(tarray, result)
29549 - print *, result
29550 - print *, tarray(1)
29551 - print *, tarray(2)
29552 - end program test_dtime
29553 -
29554 -_See also_:
29555 - *note CPU_TIME::
29556 -
29557 -
29558 -\1f
29559 -File: gfortran.info, Node: EOSHIFT, Next: EPSILON, Prev: DTIME, Up: Intrinsic Procedures
29560 -
29561 -7.62 `EOSHIFT' -- End-off shift elements of an array
29562 -====================================================
29563 -
29564 -_Description_:
29565 - `EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])' performs an end-off shift
29566 - on elements of ARRAY along the dimension of DIM. If DIM is
29567 - omitted it is taken to be `1'. DIM is a scalar of type `INTEGER'
29568 - in the range of 1 /leq DIM /leq n) where n is the rank of ARRAY.
29569 - If the rank of ARRAY is one, then all elements of ARRAY are
29570 - shifted by SHIFT places. If rank is greater than one, then all
29571 - complete rank one sections of ARRAY along the given dimension are
29572 - shifted. Elements shifted out one end of each rank one section
29573 - are dropped. If BOUNDARY is present then the corresponding value
29574 - of from BOUNDARY is copied back in the other end. If BOUNDARY is
29575 - not present then the following are copied in depending on the type
29576 - of ARRAY.
29577 -
29578 - _Array _Boundary Value_
29579 - Type_
29580 - Numeric 0 of the type and kind of ARRAY.
29581 - Logical `.FALSE.'.
29582 - Character(LEN)LEN blanks.
29583 -
29584 -_Standard_:
29585 - Fortran 95 and later
29586 -
29587 -_Class_:
29588 - Transformational function
29589 -
29590 -_Syntax_:
29591 - `RESULT = EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])'
29592 -
29593 -_Arguments_:
29594 - ARRAY May be any type, not scalar.
29595 - SHIFT The type shall be `INTEGER'.
29596 - BOUNDARY Same type as ARRAY.
29597 - DIM The type shall be `INTEGER'.
29598 -
29599 -_Return value_:
29600 - Returns an array of same type and rank as the ARRAY argument.
29601 -
29602 -_Example_:
29603 - program test_eoshift
29604 - integer, dimension(3,3) :: a
29605 - a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
29606 - print '(3i3)', a(1,:)
29607 - print '(3i3)', a(2,:)
29608 - print '(3i3)', a(3,:)
29609 - a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
29610 - print *
29611 - print '(3i3)', a(1,:)
29612 - print '(3i3)', a(2,:)
29613 - print '(3i3)', a(3,:)
29614 - end program test_eoshift
29615 -
29616 -\1f
29617 -File: gfortran.info, Node: EPSILON, Next: ERF, Prev: EOSHIFT, Up: Intrinsic Procedures
29618 -
29619 -7.63 `EPSILON' -- Epsilon function
29620 -==================================
29621 -
29622 -_Description_:
29623 - `EPSILON(X)' returns the smallest number E of the same kind as X
29624 - such that 1 + E > 1.
29625 -
29626 -_Standard_:
29627 - Fortran 95 and later
29628 -
29629 -_Class_:
29630 - Inquiry function
29631 -
29632 -_Syntax_:
29633 - `RESULT = EPSILON(X)'
29634 -
29635 -_Arguments_:
29636 - X The type shall be `REAL'.
29637 -
29638 -_Return value_:
29639 - The return value is of same type as the argument.
29640 -
29641 -_Example_:
29642 - program test_epsilon
29643 - real :: x = 3.143
29644 - real(8) :: y = 2.33
29645 - print *, EPSILON(x)
29646 - print *, EPSILON(y)
29647 - end program test_epsilon
29648 -
29649 -\1f
29650 -File: gfortran.info, Node: ERF, Next: ERFC, Prev: EPSILON, Up: Intrinsic Procedures
29651 -
29652 -7.64 `ERF' -- Error function
29653 -============================
29654 -
29655 -_Description_:
29656 - `ERF(X)' computes the error function of X.
29657 -
29658 -_Standard_:
29659 - Fortran 2008 and later
29660 -
29661 -_Class_:
29662 - Elemental function
29663 -
29664 -_Syntax_:
29665 - `RESULT = ERF(X)'
29666 -
29667 -_Arguments_:
29668 - X The type shall be `REAL'.
29669 -
29670 -_Return value_:
29671 - The return value is of type `REAL', of the same kind as X and lies
29672 - in the range -1 \leq erf (x) \leq 1 .
29673 -
29674 -_Example_:
29675 - program test_erf
29676 - real(8) :: x = 0.17_8
29677 - x = erf(x)
29678 - end program test_erf
29679 -
29680 -_Specific names_:
29681 - Name Argument Return type Standard
29682 - `DERF(X)' `REAL(8) X' `REAL(8)' GNU extension
29683 -
29684 -\1f
29685 -File: gfortran.info, Node: ERFC, Next: ERFC_SCALED, Prev: ERF, Up: Intrinsic Procedures
29686 -
29687 -7.65 `ERFC' -- Error function
29688 -=============================
29689 -
29690 -_Description_:
29691 - `ERFC(X)' computes the complementary error function of X.
29692 -
29693 -_Standard_:
29694 - Fortran 2008 and later
29695 -
29696 -_Class_:
29697 - Elemental function
29698 -
29699 -_Syntax_:
29700 - `RESULT = ERFC(X)'
29701 -
29702 -_Arguments_:
29703 - X The type shall be `REAL'.
29704 -
29705 -_Return value_:
29706 - The return value is of type `REAL' and of the same kind as X. It
29707 - lies in the range 0 \leq erfc (x) \leq 2 .
29708 -
29709 -_Example_:
29710 - program test_erfc
29711 - real(8) :: x = 0.17_8
29712 - x = erfc(x)
29713 - end program test_erfc
29714 -
29715 -_Specific names_:
29716 - Name Argument Return type Standard
29717 - `DERFC(X)' `REAL(8) X' `REAL(8)' GNU extension
29718 -
29719 -\1f
29720 -File: gfortran.info, Node: ERFC_SCALED, Next: ETIME, Prev: ERFC, Up: Intrinsic Procedures
29721 -
29722 -7.66 `ERFC_SCALED' -- Error function
29723 -====================================
29724 -
29725 -_Description_:
29726 - `ERFC_SCALED(X)' computes the exponentially-scaled complementary
29727 - error function of X.
29728 -
29729 -_Standard_:
29730 - Fortran 2008 and later
29731 -
29732 -_Class_:
29733 - Elemental function
29734 -
29735 -_Syntax_:
29736 - `RESULT = ERFC_SCALED(X)'
29737 -
29738 -_Arguments_:
29739 - X The type shall be `REAL'.
29740 -
29741 -_Return value_:
29742 - The return value is of type `REAL' and of the same kind as X.
29743 -
29744 -_Example_:
29745 - program test_erfc_scaled
29746 - real(8) :: x = 0.17_8
29747 - x = erfc_scaled(x)
29748 - end program test_erfc_scaled
29749 -
29750 -\1f
29751 -File: gfortran.info, Node: ETIME, Next: EXIT, Prev: ERFC_SCALED, Up: Intrinsic Procedures
29752 -
29753 -7.67 `ETIME' -- Execution time subroutine (or function)
29754 -=======================================================
29755 -
29756 -_Description_:
29757 - `ETIME(TARRAY, RESULT)' returns the number of seconds of runtime
29758 - since the start of the process's execution in RESULT. TARRAY
29759 - returns the user and system components of this time in `TARRAY(1)'
29760 - and `TARRAY(2)' respectively. RESULT is equal to `TARRAY(1) +
29761 - TARRAY(2)'.
29762 -
29763 - On some systems, the underlying timings are represented using
29764 - types with sufficiently small limits that overflows (wrap around)
29765 - are possible, such as 32-bit types. Therefore, the values returned
29766 - by this intrinsic might be, or become, negative, or numerically
29767 - less than previous values, during a single run of the compiled
29768 - program.
29769 -
29770 - This intrinsic is provided in both subroutine and function forms;
29771 - however, only one form can be used in any given program unit.
29772 -
29773 - TARRAY and RESULT are `INTENT(OUT)' and provide the following:
29774 -
29775 - `TARRAY(1)': User time in seconds.
29776 - `TARRAY(2)': System time in seconds.
29777 - `RESULT': Run time since start in seconds.
29778 -
29779 -_Standard_:
29780 - GNU extension
29781 -
29782 -_Class_:
29783 - Subroutine, function
29784 -
29785 -_Syntax_:
29786 - `CALL ETIME(TARRAY, RESULT)'.
29787 - `RESULT = ETIME(TARRAY)', (not recommended).
29788 -
29789 -_Arguments_:
29790 - TARRAY The type shall be `REAL, DIMENSION(2)'.
29791 - RESULT The type shall be `REAL'.
29792 -
29793 -_Return value_:
29794 - Elapsed time in seconds since the start of program execution.
29795 -
29796 -_Example_:
29797 - program test_etime
29798 - integer(8) :: i, j
29799 - real, dimension(2) :: tarray
29800 - real :: result
29801 - call ETIME(tarray, result)
29802 - print *, result
29803 - print *, tarray(1)
29804 - print *, tarray(2)
29805 - do i=1,100000000 ! Just a delay
29806 - j = i * i - i
29807 - end do
29808 - call ETIME(tarray, result)
29809 - print *, result
29810 - print *, tarray(1)
29811 - print *, tarray(2)
29812 - end program test_etime
29813 -
29814 -_See also_:
29815 - *note CPU_TIME::
29816 -
29817 -
29818 -\1f
29819 -File: gfortran.info, Node: EXIT, Next: EXP, Prev: ETIME, Up: Intrinsic Procedures
29820 -
29821 -7.68 `EXIT' -- Exit the program with status.
29822 -============================================
29823 -
29824 -_Description_:
29825 - `EXIT' causes immediate termination of the program with status.
29826 - If status is omitted it returns the canonical _success_ for the
29827 - system. All Fortran I/O units are closed.
29828 -
29829 -_Standard_:
29830 - GNU extension
29831 -
29832 -_Class_:
29833 - Subroutine
29834 -
29835 -_Syntax_:
29836 - `CALL EXIT([STATUS])'
29837 -
29838 -_Arguments_:
29839 - STATUS Shall be an `INTEGER' of the default kind.
29840 -
29841 -_Return value_:
29842 - `STATUS' is passed to the parent process on exit.
29843 -
29844 -_Example_:
29845 - program test_exit
29846 - integer :: STATUS = 0
29847 - print *, 'This program is going to exit.'
29848 - call EXIT(STATUS)
29849 - end program test_exit
29850 -
29851 -_See also_:
29852 - *note ABORT::, *note KILL::
29853 -
29854 -\1f
29855 -File: gfortran.info, Node: EXP, Next: EXPONENT, Prev: EXIT, Up: Intrinsic Procedures
29856 -
29857 -7.69 `EXP' -- Exponential function
29858 -==================================
29859 -
29860 -_Description_:
29861 - `EXP(X)' computes the base e exponential of X.
29862 -
29863 -_Standard_:
29864 - Fortran 77 and later, has overloads that are GNU extensions
29865 -
29866 -_Class_:
29867 - Elemental function
29868 -
29869 -_Syntax_:
29870 - `RESULT = EXP(X)'
29871 -
29872 -_Arguments_:
29873 - X The type shall be `REAL' or `COMPLEX'.
29874 -
29875 -_Return value_:
29876 - The return value has same type and kind as X.
29877 -
29878 -_Example_:
29879 - program test_exp
29880 - real :: x = 1.0
29881 - x = exp(x)
29882 - end program test_exp
29883 -
29884 -_Specific names_:
29885 - Name Argument Return type Standard
29886 - `DEXP(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
29887 - later
29888 - `CEXP(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 77 and
29889 - X' later
29890 - `ZEXP(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
29891 - X'
29892 - `CDEXP(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
29893 - X'
29894 -
29895 -\1f
29896 -File: gfortran.info, Node: EXPONENT, Next: FDATE, Prev: EXP, Up: Intrinsic Procedures
29897 -
29898 -7.70 `EXPONENT' -- Exponent function
29899 -====================================
29900 -
29901 -_Description_:
29902 - `EXPONENT(X)' returns the value of the exponent part of X. If X is
29903 - zero the value returned is zero.
29904 -
29905 -_Standard_:
29906 - Fortran 95 and later
29907 -
29908 -_Class_:
29909 - Elemental function
29910 -
29911 -_Syntax_:
29912 - `RESULT = EXPONENT(X)'
29913 -
29914 -_Arguments_:
29915 - X The type shall be `REAL'.
29916 -
29917 -_Return value_:
29918 - The return value is of type default `INTEGER'.
29919 -
29920 -_Example_:
29921 - program test_exponent
29922 - real :: x = 1.0
29923 - integer :: i
29924 - i = exponent(x)
29925 - print *, i
29926 - print *, exponent(0.0)
29927 - end program test_exponent
29928 -
29929 -\1f
29930 -File: gfortran.info, Node: FDATE, Next: FGET, Prev: EXPONENT, Up: Intrinsic Procedures
29931 -
29932 -7.71 `FDATE' -- Get the current time as a string
29933 -================================================
29934 -
29935 -_Description_:
29936 - `FDATE(DATE)' returns the current date (using the same format as
29937 - `CTIME') in DATE. It is equivalent to `CALL CTIME(DATE, TIME())'.
29938 -
29939 - This intrinsic is provided in both subroutine and function forms;
29940 - however, only one form can be used in any given program unit.
29941 -
29942 - DATE is an `INTENT(OUT)' `CHARACTER' variable of the default kind.
29943 -
29944 -_Standard_:
29945 - GNU extension
29946 -
29947 -_Class_:
29948 - Subroutine, function
29949 -
29950 -_Syntax_:
29951 - `CALL FDATE(DATE)'.
29952 - `DATE = FDATE()', (not recommended).
29953 -
29954 -_Arguments_:
29955 - DATE The type shall be of type `CHARACTER' of the
29956 - default kind
29957 -
29958 -_Return value_:
29959 - The current date as a string.
29960 -
29961 -_Example_:
29962 - program test_fdate
29963 - integer(8) :: i, j
29964 - character(len=30) :: date
29965 - call fdate(date)
29966 - print *, 'Program started on ', date
29967 - do i = 1, 100000000 ! Just a delay
29968 - j = i * i - i
29969 - end do
29970 - call fdate(date)
29971 - print *, 'Program ended on ', date
29972 - end program test_fdate
29973 -
29974 -\1f
29975 -File: gfortran.info, Node: FLOAT, Next: FLOOR, Prev: FGETC, Up: Intrinsic Procedures
29976 -
29977 -7.72 `FLOAT' -- Convert integer to default real
29978 -===============================================
29979 -
29980 -_Description_:
29981 - `FLOAT(A)' converts the integer A to a default real value.
29982 -
29983 -_Standard_:
29984 - Fortran 77 and later
29985 -
29986 -_Class_:
29987 - Elemental function
29988 -
29989 -_Syntax_:
29990 - `RESULT = FLOAT(A)'
29991 -
29992 -_Arguments_:
29993 - A The type shall be `INTEGER'.
29994 -
29995 -_Return value_:
29996 - The return value is of type default `REAL'.
29997 -
29998 -_Example_:
29999 - program test_float
30000 - integer :: i = 1
30001 - if (float(i) /= 1.) call abort
30002 - end program test_float
30003 -
30004 -_See also_:
30005 - *note DBLE::, *note DFLOAT::, *note REAL::
30006 -
30007 -\1f
30008 -File: gfortran.info, Node: FGET, Next: FGETC, Prev: FDATE, Up: Intrinsic Procedures
30009 -
30010 -7.73 `FGET' -- Read a single character in stream mode from stdin
30011 -================================================================
30012 -
30013 -_Description_:
30014 - Read a single character in stream mode from stdin by bypassing
30015 - normal formatted output. Stream I/O should not be mixed with
30016 - normal record-oriented (formatted or unformatted) I/O on the same
30017 - unit; the results are unpredictable.
30018 -
30019 - This intrinsic is provided in both subroutine and function forms;
30020 - however, only one form can be used in any given program unit.
30021 -
30022 - Note that the `FGET' intrinsic is provided for backwards
30023 - compatibility with `g77'. GNU Fortran provides the Fortran 2003
30024 - Stream facility. Programmers should consider the use of new
30025 - stream IO feature in new code for future portability. See also
30026 - *note Fortran 2003 status::.
30027 -
30028 -_Standard_:
30029 - GNU extension
30030 -
30031 -_Class_:
30032 - Subroutine, function
30033 -
30034 -_Syntax_:
30035 - `CALL FGET(C [, STATUS])'
30036 -
30037 -_Arguments_:
30038 - C The type shall be `CHARACTER' and of default
30039 - kind.
30040 - STATUS (Optional) status flag of type `INTEGER'.
30041 - Returns 0 on success, -1 on end-of-file, and a
30042 - system specific positive error code otherwise.
30043 -
30044 -_Example_:
30045 - PROGRAM test_fget
30046 - INTEGER, PARAMETER :: strlen = 100
30047 - INTEGER :: status, i = 1
30048 - CHARACTER(len=strlen) :: str = ""
30049 -
30050 - WRITE (*,*) 'Enter text:'
30051 - DO
30052 - CALL fget(str(i:i), status)
30053 - if (status /= 0 .OR. i > strlen) exit
30054 - i = i + 1
30055 - END DO
30056 - WRITE (*,*) TRIM(str)
30057 - END PROGRAM
30058 -
30059 -_See also_:
30060 - *note FGETC::, *note FPUT::, *note FPUTC::
30061 -
30062 -\1f
30063 -File: gfortran.info, Node: FGETC, Next: FLOAT, Prev: FGET, Up: Intrinsic Procedures
30064 -
30065 -7.74 `FGETC' -- Read a single character in stream mode
30066 -======================================================
30067 -
30068 -_Description_:
30069 - Read a single character in stream mode by bypassing normal
30070 - formatted output. Stream I/O should not be mixed with normal
30071 - record-oriented (formatted or unformatted) I/O on the same unit;
30072 - the results are unpredictable.
30073 -
30074 - This intrinsic is provided in both subroutine and function forms;
30075 - however, only one form can be used in any given program unit.
30076 -
30077 - Note that the `FGET' intrinsic is provided for backwards
30078 - compatibility with `g77'. GNU Fortran provides the Fortran 2003
30079 - Stream facility. Programmers should consider the use of new
30080 - stream IO feature in new code for future portability. See also
30081 - *note Fortran 2003 status::.
30082 -
30083 -_Standard_:
30084 - GNU extension
30085 -
30086 -_Class_:
30087 - Subroutine, function
30088 -
30089 -_Syntax_:
30090 - `CALL FGETC(UNIT, C [, STATUS])'
30091 -
30092 -_Arguments_:
30093 - UNIT The type shall be `INTEGER'.
30094 - C The type shall be `CHARACTER' and of default
30095 - kind.
30096 - STATUS (Optional) status flag of type `INTEGER'.
30097 - Returns 0 on success, -1 on end-of-file and a
30098 - system specific positive error code otherwise.
30099 -
30100 -_Example_:
30101 - PROGRAM test_fgetc
30102 - INTEGER :: fd = 42, status
30103 - CHARACTER :: c
30104 -
30105 - OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
30106 - DO
30107 - CALL fgetc(fd, c, status)
30108 - IF (status /= 0) EXIT
30109 - call fput(c)
30110 - END DO
30111 - CLOSE(UNIT=fd)
30112 - END PROGRAM
30113 -
30114 -_See also_:
30115 - *note FGET::, *note FPUT::, *note FPUTC::
30116 -
30117 -\1f
30118 -File: gfortran.info, Node: FLOOR, Next: FLUSH, Prev: FLOAT, Up: Intrinsic Procedures
30119 -
30120 -7.75 `FLOOR' -- Integer floor function
30121 -======================================
30122 -
30123 -_Description_:
30124 - `FLOOR(A)' returns the greatest integer less than or equal to X.
30125 -
30126 -_Standard_:
30127 - Fortran 95 and later
30128 -
30129 -_Class_:
30130 - Elemental function
30131 -
30132 -_Syntax_:
30133 - `RESULT = FLOOR(A [, KIND])'
30134 -
30135 -_Arguments_:
30136 - A The type shall be `REAL'.
30137 - KIND (Optional) An `INTEGER' initialization
30138 - expression indicating the kind parameter of
30139 - the result.
30140 -
30141 -_Return value_:
30142 - The return value is of type `INTEGER(KIND)' if KIND is present and
30143 - of default-kind `INTEGER' otherwise.
30144 -
30145 -_Example_:
30146 - program test_floor
30147 - real :: x = 63.29
30148 - real :: y = -63.59
30149 - print *, floor(x) ! returns 63
30150 - print *, floor(y) ! returns -64
30151 - end program test_floor
30152 -
30153 -_See also_:
30154 - *note CEILING::, *note NINT::
30155 -
30156 -
30157 -\1f
30158 -File: gfortran.info, Node: FLUSH, Next: FNUM, Prev: FLOOR, Up: Intrinsic Procedures
30159 -
30160 -7.76 `FLUSH' -- Flush I/O unit(s)
30161 -=================================
30162 -
30163 -_Description_:
30164 - Flushes Fortran unit(s) currently open for output. Without the
30165 - optional argument, all units are flushed, otherwise just the unit
30166 - specified.
30167 -
30168 -_Standard_:
30169 - GNU extension
30170 -
30171 -_Class_:
30172 - Subroutine
30173 -
30174 -_Syntax_:
30175 - `CALL FLUSH(UNIT)'
30176 -
30177 -_Arguments_:
30178 - UNIT (Optional) The type shall be `INTEGER'.
30179 -
30180 -_Note_:
30181 - Beginning with the Fortran 2003 standard, there is a `FLUSH'
30182 - statement that should be preferred over the `FLUSH' intrinsic.
30183 -
30184 -
30185 -\1f
30186 -File: gfortran.info, Node: FNUM, Next: FPUT, Prev: FLUSH, Up: Intrinsic Procedures
30187 -
30188 -7.77 `FNUM' -- File number function
30189 -===================================
30190 -
30191 -_Description_:
30192 - `FNUM(UNIT)' returns the POSIX file descriptor number
30193 - corresponding to the open Fortran I/O unit `UNIT'.
30194 -
30195 -_Standard_:
30196 - GNU extension
30197 -
30198 -_Class_:
30199 - Function
30200 -
30201 -_Syntax_:
30202 - `RESULT = FNUM(UNIT)'
30203 -
30204 -_Arguments_:
30205 - UNIT The type shall be `INTEGER'.
30206 -
30207 -_Return value_:
30208 - The return value is of type `INTEGER'
30209 -
30210 -_Example_:
30211 - program test_fnum
30212 - integer :: i
30213 - open (unit=10, status = "scratch")
30214 - i = fnum(10)
30215 - print *, i
30216 - close (10)
30217 - end program test_fnum
30218 -
30219 -\1f
30220 -File: gfortran.info, Node: FPUT, Next: FPUTC, Prev: FNUM, Up: Intrinsic Procedures
30221 -
30222 -7.78 `FPUT' -- Write a single character in stream mode to stdout
30223 -================================================================
30224 -
30225 -_Description_:
30226 - Write a single character in stream mode to stdout by bypassing
30227 - normal formatted output. Stream I/O should not be mixed with
30228 - normal record-oriented (formatted or unformatted) I/O on the same
30229 - unit; the results are unpredictable.
30230 -
30231 - This intrinsic is provided in both subroutine and function forms;
30232 - however, only one form can be used in any given program unit.
30233 -
30234 - Note that the `FGET' intrinsic is provided for backwards
30235 - compatibility with `g77'. GNU Fortran provides the Fortran 2003
30236 - Stream facility. Programmers should consider the use of new
30237 - stream IO feature in new code for future portability. See also
30238 - *note Fortran 2003 status::.
30239 -
30240 -_Standard_:
30241 - GNU extension
30242 -
30243 -_Class_:
30244 - Subroutine, function
30245 -
30246 -_Syntax_:
30247 - `CALL FPUT(C [, STATUS])'
30248 -
30249 -_Arguments_:
30250 - C The type shall be `CHARACTER' and of default
30251 - kind.
30252 - STATUS (Optional) status flag of type `INTEGER'.
30253 - Returns 0 on success, -1 on end-of-file and a
30254 - system specific positive error code otherwise.
30255 -
30256 -_Example_:
30257 - PROGRAM test_fput
30258 - CHARACTER(len=10) :: str = "gfortran"
30259 - INTEGER :: i
30260 - DO i = 1, len_trim(str)
30261 - CALL fput(str(i:i))
30262 - END DO
30263 - END PROGRAM
30264 -
30265 -_See also_:
30266 - *note FPUTC::, *note FGET::, *note FGETC::
30267 -
30268 -\1f
30269 -File: gfortran.info, Node: FPUTC, Next: FRACTION, Prev: FPUT, Up: Intrinsic Procedures
30270 -
30271 -7.79 `FPUTC' -- Write a single character in stream mode
30272 -=======================================================
30273 -
30274 -_Description_:
30275 - Write a single character in stream mode by bypassing normal
30276 - formatted output. Stream I/O should not be mixed with normal
30277 - record-oriented (formatted or unformatted) I/O on the same unit;
30278 - the results are unpredictable.
30279 -
30280 - This intrinsic is provided in both subroutine and function forms;
30281 - however, only one form can be used in any given program unit.
30282 -
30283 - Note that the `FGET' intrinsic is provided for backwards
30284 - compatibility with `g77'. GNU Fortran provides the Fortran 2003
30285 - Stream facility. Programmers should consider the use of new
30286 - stream IO feature in new code for future portability. See also
30287 - *note Fortran 2003 status::.
30288 -
30289 -_Standard_:
30290 - GNU extension
30291 -
30292 -_Class_:
30293 - Subroutine, function
30294 -
30295 -_Syntax_:
30296 - `CALL FPUTC(UNIT, C [, STATUS])'
30297 -
30298 -_Arguments_:
30299 - UNIT The type shall be `INTEGER'.
30300 - C The type shall be `CHARACTER' and of default
30301 - kind.
30302 - STATUS (Optional) status flag of type `INTEGER'.
30303 - Returns 0 on success, -1 on end-of-file and a
30304 - system specific positive error code otherwise.
30305 -
30306 -_Example_:
30307 - PROGRAM test_fputc
30308 - CHARACTER(len=10) :: str = "gfortran"
30309 - INTEGER :: fd = 42, i
30310 -
30311 - OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
30312 - DO i = 1, len_trim(str)
30313 - CALL fputc(fd, str(i:i))
30314 - END DO
30315 - CLOSE(fd)
30316 - END PROGRAM
30317 -
30318 -_See also_:
30319 - *note FPUT::, *note FGET::, *note FGETC::
30320 -
30321 -\1f
30322 -File: gfortran.info, Node: FRACTION, Next: FREE, Prev: FPUTC, Up: Intrinsic Procedures
30323 -
30324 -7.80 `FRACTION' -- Fractional part of the model representation
30325 -==============================================================
30326 -
30327 -_Description_:
30328 - `FRACTION(X)' returns the fractional part of the model
30329 - representation of `X'.
30330 -
30331 -_Standard_:
30332 - Fortran 95 and later
30333 -
30334 -_Class_:
30335 - Elemental function
30336 -
30337 -_Syntax_:
30338 - `Y = FRACTION(X)'
30339 -
30340 -_Arguments_:
30341 - X The type of the argument shall be a `REAL'.
30342 -
30343 -_Return value_:
30344 - The return value is of the same type and kind as the argument.
30345 - The fractional part of the model representation of `X' is returned;
30346 - it is `X * RADIX(X)**(-EXPONENT(X))'.
30347 -
30348 -_Example_:
30349 - program test_fraction
30350 - real :: x
30351 - x = 178.1387e-4
30352 - print *, fraction(x), x * radix(x)**(-exponent(x))
30353 - end program test_fraction
30354 -
30355 -
30356 -\1f
30357 -File: gfortran.info, Node: FREE, Next: FSEEK, Prev: FRACTION, Up: Intrinsic Procedures
30358 -
30359 -7.81 `FREE' -- Frees memory
30360 -===========================
30361 -
30362 -_Description_:
30363 - Frees memory previously allocated by `MALLOC()'. The `FREE'
30364 - intrinsic is an extension intended to be used with Cray pointers,
30365 - and is provided in GNU Fortran to allow user to compile legacy
30366 - code. For new code using Fortran 95 pointers, the memory
30367 - de-allocation intrinsic is `DEALLOCATE'.
30368 -
30369 -_Standard_:
30370 - GNU extension
30371 -
30372 -_Class_:
30373 - Subroutine
30374 -
30375 -_Syntax_:
30376 - `CALL FREE(PTR)'
30377 -
30378 -_Arguments_:
30379 - PTR The type shall be `INTEGER'. It represents the
30380 - location of the memory that should be
30381 - de-allocated.
30382 -
30383 -_Return value_:
30384 - None
30385 -
30386 -_Example_:
30387 - See `MALLOC' for an example.
30388 -
30389 -_See also_:
30390 - *note MALLOC::
30391 -
30392 -\1f
30393 -File: gfortran.info, Node: FSEEK, Next: FSTAT, Prev: FREE, Up: Intrinsic Procedures
30394 -
30395 -7.82 `FSEEK' -- Low level file positioning subroutine
30396 -=====================================================
30397 -
30398 -_Description_:
30399 - Moves UNIT to the specified OFFSET. If WHENCE is set to 0, the
30400 - OFFSET is taken as an absolute value `SEEK_SET', if set to 1,
30401 - OFFSET is taken to be relative to the current position `SEEK_CUR',
30402 - and if set to 2 relative to the end of the file `SEEK_END'. On
30403 - error, STATUS is set to a nonzero value. If STATUS the seek fails
30404 - silently.
30405 -
30406 - This intrinsic routine is not fully backwards compatible with
30407 - `g77'. In `g77', the `FSEEK' takes a statement label instead of a
30408 - STATUS variable. If FSEEK is used in old code, change
30409 - CALL FSEEK(UNIT, OFFSET, WHENCE, *label)
30410 - to
30411 - INTEGER :: status
30412 - CALL FSEEK(UNIT, OFFSET, WHENCE, status)
30413 - IF (status /= 0) GOTO label
30414 -
30415 - Please note that GNU Fortran provides the Fortran 2003 Stream
30416 - facility. Programmers should consider the use of new stream IO
30417 - feature in new code for future portability. See also *note Fortran
30418 - 2003 status::.
30419 -
30420 -_Standard_:
30421 - GNU extension
30422 -
30423 -_Class_:
30424 - Subroutine
30425 -
30426 -_Syntax_:
30427 - `CALL FSEEK(UNIT, OFFSET, WHENCE[, STATUS])'
30428 -
30429 -_Arguments_:
30430 - UNIT Shall be a scalar of type `INTEGER'.
30431 - OFFSET Shall be a scalar of type `INTEGER'.
30432 - WHENCE Shall be a scalar of type `INTEGER'. Its
30433 - value shall be either 0, 1 or 2.
30434 - STATUS (Optional) shall be a scalar of type
30435 - `INTEGER(4)'.
30436 -
30437 -_Example_:
30438 - PROGRAM test_fseek
30439 - INTEGER, PARAMETER :: SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2
30440 - INTEGER :: fd, offset, ierr
30441 -
30442 - ierr = 0
30443 - offset = 5
30444 - fd = 10
30445 -
30446 - OPEN(UNIT=fd, FILE="fseek.test")
30447 - CALL FSEEK(fd, offset, SEEK_SET, ierr) ! move to OFFSET
30448 - print *, FTELL(fd), ierr
30449 -
30450 - CALL FSEEK(fd, 0, SEEK_END, ierr) ! move to end
30451 - print *, FTELL(fd), ierr
30452 -
30453 - CALL FSEEK(fd, 0, SEEK_SET, ierr) ! move to beginning
30454 - print *, FTELL(fd), ierr
30455 -
30456 - CLOSE(UNIT=fd)
30457 - END PROGRAM
30458 -
30459 -_See also_:
30460 - *note FTELL::
30461 -
30462 -\1f
30463 -File: gfortran.info, Node: FSTAT, Next: FTELL, Prev: FSEEK, Up: Intrinsic Procedures
30464 -
30465 -7.83 `FSTAT' -- Get file status
30466 -===============================
30467 -
30468 -_Description_:
30469 - `FSTAT' is identical to *note STAT::, except that information
30470 - about an already opened file is obtained.
30471 -
30472 - The elements in `BUFF' are the same as described by *note STAT::.
30473 -
30474 - This intrinsic is provided in both subroutine and function forms;
30475 - however, only one form can be used in any given program unit.
30476 -
30477 -_Standard_:
30478 - GNU extension
30479 -
30480 -_Class_:
30481 - Subroutine, function
30482 -
30483 -_Syntax_:
30484 - `CALL FSTAT(UNIT, BUFF [, STATUS])'
30485 -
30486 -_Arguments_:
30487 - UNIT An open I/O unit number of type `INTEGER'.
30488 - BUFF The type shall be `INTEGER(4), DIMENSION(13)'.
30489 - STATUS (Optional) status flag of type `INTEGER(4)'.
30490 - Returns 0 on success and a system specific
30491 - error code otherwise.
30492 -
30493 -_Example_:
30494 - See *note STAT:: for an example.
30495 -
30496 -_See also_:
30497 - To stat a link: *note LSTAT::, to stat a file: *note STAT::
30498 -
30499 -\1f
30500 -File: gfortran.info, Node: FTELL, Next: GAMMA, Prev: FSTAT, Up: Intrinsic Procedures
30501 -
30502 -7.84 `FTELL' -- Current stream position
30503 -=======================================
30504 -
30505 -_Description_:
30506 - Retrieves the current position within an open file.
30507 -
30508 - This intrinsic is provided in both subroutine and function forms;
30509 - however, only one form can be used in any given program unit.
30510 -
30511 -_Standard_:
30512 - GNU extension
30513 -
30514 -_Class_:
30515 - Subroutine, function
30516 -
30517 -_Syntax_:
30518 - `CALL FTELL(UNIT, OFFSET)'
30519 - `OFFSET = FTELL(UNIT)'
30520 -
30521 -_Arguments_:
30522 - OFFSET Shall of type `INTEGER'.
30523 - UNIT Shall of type `INTEGER'.
30524 -
30525 -_Return value_:
30526 - In either syntax, OFFSET is set to the current offset of unit
30527 - number UNIT, or to -1 if the unit is not currently open.
30528 -
30529 -_Example_:
30530 - PROGRAM test_ftell
30531 - INTEGER :: i
30532 - OPEN(10, FILE="temp.dat")
30533 - CALL ftell(10,i)
30534 - WRITE(*,*) i
30535 - END PROGRAM
30536 -
30537 -_See also_:
30538 - *note FSEEK::
30539 -
30540 -\1f
30541 -File: gfortran.info, Node: GAMMA, Next: GERROR, Prev: FTELL, Up: Intrinsic Procedures
30542 -
30543 -7.85 `GAMMA' -- Gamma function
30544 -==============================
30545 -
30546 -_Description_:
30547 - `GAMMA(X)' computes Gamma (\Gamma) of X. For positive, integer
30548 - values of X the Gamma function simplifies to the factorial
30549 - function \Gamma(x)=(x-1)!.
30550 -
30551 -_Standard_:
30552 - Fortran 2008 and later
30553 -
30554 -_Class_:
30555 - Elemental function
30556 -
30557 -_Syntax_:
30558 - `X = GAMMA(X)'
30559 -
30560 -_Arguments_:
30561 - X Shall be of type `REAL' and neither zero nor a
30562 - negative integer.
30563 -
30564 -_Return value_:
30565 - The return value is of type `REAL' of the same kind as X.
30566 -
30567 -_Example_:
30568 - program test_gamma
30569 - real :: x = 1.0
30570 - x = gamma(x) ! returns 1.0
30571 - end program test_gamma
30572 -
30573 -_Specific names_:
30574 - Name Argument Return type Standard
30575 - `GAMMA(X)' `REAL(4) X' `REAL(4)' GNU Extension
30576 - `DGAMMA(X)' `REAL(8) X' `REAL(8)' GNU Extension
30577 -
30578 -_See also_:
30579 - Logarithm of the Gamma function: *note LOG_GAMMA::
30580 -
30581 -
30582 -\1f
30583 -File: gfortran.info, Node: GERROR, Next: GETARG, Prev: GAMMA, Up: Intrinsic Procedures
30584 -
30585 -7.86 `GERROR' -- Get last system error message
30586 -==============================================
30587 -
30588 -_Description_:
30589 - Returns the system error message corresponding to the last system
30590 - error. This resembles the functionality of `strerror(3)' in C.
30591 -
30592 -_Standard_:
30593 - GNU extension
30594 -
30595 -_Class_:
30596 - Subroutine
30597 -
30598 -_Syntax_:
30599 - `CALL GERROR(RESULT)'
30600 -
30601 -_Arguments_:
30602 - RESULT Shall of type `CHARACTER' and of default
30603 -
30604 -_Example_:
30605 - PROGRAM test_gerror
30606 - CHARACTER(len=100) :: msg
30607 - CALL gerror(msg)
30608 - WRITE(*,*) msg
30609 - END PROGRAM
30610 -
30611 -_See also_:
30612 - *note IERRNO::, *note PERROR::
30613 -
30614 -\1f
30615 -File: gfortran.info, Node: GETARG, Next: GET_COMMAND, Prev: GERROR, Up: Intrinsic Procedures
30616 -
30617 -7.87 `GETARG' -- Get command line arguments
30618 -===========================================
30619 -
30620 -_Description_:
30621 - Retrieve the POS-th argument that was passed on the command line
30622 - when the containing program was invoked.
30623 -
30624 - This intrinsic routine is provided for backwards compatibility with
30625 - GNU Fortran 77. In new code, programmers should consider the use
30626 - of the *note GET_COMMAND_ARGUMENT:: intrinsic defined by the
30627 - Fortran 2003 standard.
30628 -
30629 -_Standard_:
30630 - GNU extension
30631 -
30632 -_Class_:
30633 - Subroutine
30634 -
30635 -_Syntax_:
30636 - `CALL GETARG(POS, VALUE)'
30637 -
30638 -_Arguments_:
30639 - POS Shall be of type `INTEGER' and not wider than
30640 - the default integer kind; POS \geq 0
30641 - VALUE Shall be of type `CHARACTER' and of default
30642 - kind.
30643 - VALUE Shall be of type `CHARACTER'.
30644 -
30645 -_Return value_:
30646 - After `GETARG' returns, the VALUE argument holds the POSth command
30647 - line argument. If VALUE can not hold the argument, it is truncated
30648 - to fit the length of VALUE. If there are less than POS arguments
30649 - specified at the command line, VALUE will be filled with blanks.
30650 - If POS = 0, VALUE is set to the name of the program (on systems
30651 - that support this feature).
30652 -
30653 -_Example_:
30654 - PROGRAM test_getarg
30655 - INTEGER :: i
30656 - CHARACTER(len=32) :: arg
30657 -
30658 - DO i = 1, iargc()
30659 - CALL getarg(i, arg)
30660 - WRITE (*,*) arg
30661 - END DO
30662 - END PROGRAM
30663 -
30664 -_See also_:
30665 - GNU Fortran 77 compatibility function: *note IARGC::
30666 -
30667 - Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note
30668 - GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
30669 -
30670 -\1f
30671 -File: gfortran.info, Node: GET_COMMAND, Next: GET_COMMAND_ARGUMENT, Prev: GETARG, Up: Intrinsic Procedures
30672 -
30673 -7.88 `GET_COMMAND' -- Get the entire command line
30674 -=================================================
30675 -
30676 -_Description_:
30677 - Retrieve the entire command line that was used to invoke the
30678 - program.
30679 -
30680 -_Standard_:
30681 - Fortran 2003 and later
30682 -
30683 -_Class_:
30684 - Subroutine
30685 -
30686 -_Syntax_:
30687 - `CALL GET_COMMAND(COMMAND)'
30688 -
30689 -_Arguments_:
30690 - COMMAND Shall be of type `CHARACTER' and of default
30691 - kind.
30692 -
30693 -_Return value_:
30694 - Stores the entire command line that was used to invoke the program
30695 - in COMMAND. If COMMAND is not large enough, the command will be
30696 - truncated.
30697 -
30698 -_Example_:
30699 - PROGRAM test_get_command
30700 - CHARACTER(len=255) :: cmd
30701 - CALL get_command(cmd)
30702 - WRITE (*,*) TRIM(cmd)
30703 - END PROGRAM
30704 -
30705 -_See also_:
30706 - *note GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
30707 -
30708 -\1f
30709 -File: gfortran.info, Node: GET_COMMAND_ARGUMENT, Next: GETCWD, Prev: GET_COMMAND, Up: Intrinsic Procedures
30710 -
30711 -7.89 `GET_COMMAND_ARGUMENT' -- Get command line arguments
30712 -=========================================================
30713 -
30714 -_Description_:
30715 - Retrieve the NUMBER-th argument that was passed on the command
30716 - line when the containing program was invoked.
30717 -
30718 -_Standard_:
30719 - Fortran 2003 and later
30720 -
30721 -_Class_:
30722 - Subroutine
30723 -
30724 -_Syntax_:
30725 - `CALL GET_COMMAND_ARGUMENT(NUMBER [, VALUE, LENGTH, STATUS])'
30726 -
30727 -_Arguments_:
30728 - NUMBER Shall be a scalar of type `INTEGER(4)', NUMBER
30729 - \geq 0
30730 - VALUE Shall be a scalar of type `CHARACTER' and of
30731 - default kind.
30732 - LENGTH (Option) Shall be a scalar of type
30733 - `INTEGER(4)'.
30734 - STATUS (Option) Shall be a scalar of type
30735 - `INTEGER(4)'.
30736 -
30737 -_Return value_:
30738 - After `GET_COMMAND_ARGUMENT' returns, the VALUE argument holds the
30739 - NUMBER-th command line argument. If VALUE can not hold the
30740 - argument, it is truncated to fit the length of VALUE. If there are
30741 - less than NUMBER arguments specified at the command line, VALUE
30742 - will be filled with blanks. If NUMBER = 0, VALUE is set to the
30743 - name of the program (on systems that support this feature). The
30744 - LENGTH argument contains the length of the NUMBER-th command line
30745 - argument. If the argument retrieval fails, STATUS is a positive
30746 - number; if VALUE contains a truncated command line argument,
30747 - STATUS is -1; and otherwise the STATUS is zero.
30748 -
30749 -_Example_:
30750 - PROGRAM test_get_command_argument
30751 - INTEGER :: i
30752 - CHARACTER(len=32) :: arg
30753 -
30754 - i = 0
30755 - DO
30756 - CALL get_command_argument(i, arg)
30757 - IF (LEN_TRIM(arg) == 0) EXIT
30758 -
30759 - WRITE (*,*) TRIM(arg)
30760 - i = i+1
30761 - END DO
30762 - END PROGRAM
30763 -
30764 -_See also_:
30765 - *note GET_COMMAND::, *note COMMAND_ARGUMENT_COUNT::
30766 -
30767 -\1f
30768 -File: gfortran.info, Node: GETCWD, Next: GETENV, Prev: GET_COMMAND_ARGUMENT, Up: Intrinsic Procedures
30769 -
30770 -7.90 `GETCWD' -- Get current working directory
30771 -==============================================
30772 -
30773 -_Description_:
30774 - Get current working directory.
30775 -
30776 - This intrinsic is provided in both subroutine and function forms;
30777 - however, only one form can be used in any given program unit.
30778 -
30779 -_Standard_:
30780 - GNU extension
30781 -
30782 -_Class_:
30783 - Subroutine, function
30784 -
30785 -_Syntax_:
30786 - `CALL GETCWD(C [, STATUS])'
30787 -
30788 -_Arguments_:
30789 - C The type shall be `CHARACTER' and of default
30790 - kind.
30791 - STATUS (Optional) status flag. Returns 0 on success,
30792 - a system specific and nonzero error code
30793 - otherwise.
30794 -
30795 -_Example_:
30796 - PROGRAM test_getcwd
30797 - CHARACTER(len=255) :: cwd
30798 - CALL getcwd(cwd)
30799 - WRITE(*,*) TRIM(cwd)
30800 - END PROGRAM
30801 -
30802 -_See also_:
30803 - *note CHDIR::
30804 -
30805 -\1f
30806 -File: gfortran.info, Node: GETENV, Next: GET_ENVIRONMENT_VARIABLE, Prev: GETCWD, Up: Intrinsic Procedures
30807 -
30808 -7.91 `GETENV' -- Get an environmental variable
30809 -==============================================
30810 -
30811 -_Description_:
30812 - Get the VALUE of the environmental variable NAME.
30813 -
30814 - This intrinsic routine is provided for backwards compatibility with
30815 - GNU Fortran 77. In new code, programmers should consider the use
30816 - of the *note GET_ENVIRONMENT_VARIABLE:: intrinsic defined by the
30817 - Fortran 2003 standard.
30818 -
30819 -_Standard_:
30820 - GNU extension
30821 -
30822 -_Class_:
30823 - Subroutine
30824 -
30825 -_Syntax_:
30826 - `CALL GETENV(NAME, VALUE)'
30827 -
30828 -_Arguments_:
30829 - NAME Shall be of type `CHARACTER' and of default
30830 - kind.
30831 - VALUE Shall be of type `CHARACTER' and of default
30832 - kind.
30833 -
30834 -_Return value_:
30835 - Stores the value of NAME in VALUE. If VALUE is not large enough to
30836 - hold the data, it is truncated. If NAME is not set, VALUE will be
30837 - filled with blanks.
30838 -
30839 -_Example_:
30840 - PROGRAM test_getenv
30841 - CHARACTER(len=255) :: homedir
30842 - CALL getenv("HOME", homedir)
30843 - WRITE (*,*) TRIM(homedir)
30844 - END PROGRAM
30845 -
30846 -_See also_:
30847 - *note GET_ENVIRONMENT_VARIABLE::
30848 -
30849 -\1f
30850 -File: gfortran.info, Node: GET_ENVIRONMENT_VARIABLE, Next: GETGID, Prev: GETENV, Up: Intrinsic Procedures
30851 -
30852 -7.92 `GET_ENVIRONMENT_VARIABLE' -- Get an environmental variable
30853 -================================================================
30854 -
30855 -_Description_:
30856 - Get the VALUE of the environmental variable NAME.
30857 -
30858 -_Standard_:
30859 - Fortran 2003 and later
30860 -
30861 -_Class_:
30862 - Subroutine
30863 -
30864 -_Syntax_:
30865 - `CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS,
30866 - TRIM_NAME)'
30867 -
30868 -_Arguments_:
30869 - NAME Shall be a scalar of type `CHARACTER(1)'.
30870 - VALUE Shall be a scalar of type `CHARACTER(1)'.
30871 - LENGTH Shall be a scalar of type `INTEGER(4)'.
30872 - STATUS Shall be a scalar of type `INTEGER(4)'.
30873 - TRIM_NAME Shall be a scalar of type `LOGICAL(4)'.
30874 -
30875 -_Return value_:
30876 - Stores the value of NAME in VALUE. If VALUE is not large enough to
30877 - hold the data, it is truncated. If NAME is not set, VALUE will be
30878 - filled with blanks. Argument LENGTH contains the length needed for
30879 - storing the environment variable NAME or zero if it is not
30880 - present. STATUS is -1 if VALUE is present but too short for the
30881 - environment variable; it is 1 if the environment variable does not
30882 - exist and 2 if the processor does not support environment
30883 - variables; in all other cases STATUS is zero. If TRIM_NAME is
30884 - present with the value `.FALSE.', the trailing blanks in NAME are
30885 - significant; otherwise they are not part of the environment
30886 - variable name.
30887 -
30888 -_Example_:
30889 - PROGRAM test_getenv
30890 - CHARACTER(len=255) :: homedir
30891 - CALL get_environment_variable("HOME", homedir)
30892 - WRITE (*,*) TRIM(homedir)
30893 - END PROGRAM
30894 -
30895 -\1f
30896 -File: gfortran.info, Node: GETGID, Next: GETLOG, Prev: GET_ENVIRONMENT_VARIABLE, Up: Intrinsic Procedures
30897 -
30898 -7.93 `GETGID' -- Group ID function
30899 -==================================
30900 -
30901 -_Description_:
30902 - Returns the numerical group ID of the current process.
30903 -
30904 -_Standard_:
30905 - GNU extension
30906 -
30907 -_Class_:
30908 - Function
30909 -
30910 -_Syntax_:
30911 - `RESULT = GETGID()'
30912 -
30913 -_Return value_:
30914 - The return value of `GETGID' is an `INTEGER' of the default kind.
30915 -
30916 -_Example_:
30917 - See `GETPID' for an example.
30918 -
30919 -_See also_:
30920 - *note GETPID::, *note GETUID::
30921 -
30922 -\1f
30923 -File: gfortran.info, Node: GETLOG, Next: GETPID, Prev: GETGID, Up: Intrinsic Procedures
30924 -
30925 -7.94 `GETLOG' -- Get login name
30926 -===============================
30927 -
30928 -_Description_:
30929 - Gets the username under which the program is running.
30930 -
30931 -_Standard_:
30932 - GNU extension
30933 -
30934 -_Class_:
30935 - Subroutine
30936 -
30937 -_Syntax_:
30938 - `CALL GETLOG(C)'
30939 -
30940 -_Arguments_:
30941 - C Shall be of type `CHARACTER' and of default
30942 - kind.
30943 -
30944 -_Return value_:
30945 - Stores the current user name in LOGIN. (On systems where POSIX
30946 - functions `geteuid' and `getpwuid' are not available, and the
30947 - `getlogin' function is not implemented either, this will return a
30948 - blank string.)
30949 -
30950 -_Example_:
30951 - PROGRAM TEST_GETLOG
30952 - CHARACTER(32) :: login
30953 - CALL GETLOG(login)
30954 - WRITE(*,*) login
30955 - END PROGRAM
30956 -
30957 -_See also_:
30958 - *note GETUID::
30959 -
30960 -\1f
30961 -File: gfortran.info, Node: GETPID, Next: GETUID, Prev: GETLOG, Up: Intrinsic Procedures
30962 -
30963 -7.95 `GETPID' -- Process ID function
30964 -====================================
30965 -
30966 -_Description_:
30967 - Returns the numerical process identifier of the current process.
30968 -
30969 -_Standard_:
30970 - GNU extension
30971 -
30972 -_Class_:
30973 - Function
30974 -
30975 -_Syntax_:
30976 - `RESULT = GETPID()'
30977 -
30978 -_Return value_:
30979 - The return value of `GETPID' is an `INTEGER' of the default kind.
30980 -
30981 -_Example_:
30982 - program info
30983 - print *, "The current process ID is ", getpid()
30984 - print *, "Your numerical user ID is ", getuid()
30985 - print *, "Your numerical group ID is ", getgid()
30986 - end program info
30987 -
30988 -_See also_:
30989 - *note GETGID::, *note GETUID::
30990 -
30991 -\1f
30992 -File: gfortran.info, Node: GETUID, Next: GMTIME, Prev: GETPID, Up: Intrinsic Procedures
30993 -
30994 -7.96 `GETUID' -- User ID function
30995 -=================================
30996 -
30997 -_Description_:
30998 - Returns the numerical user ID of the current process.
30999 -
31000 -_Standard_:
31001 - GNU extension
31002 -
31003 -_Class_:
31004 - Function
31005 -
31006 -_Syntax_:
31007 - `RESULT = GETUID()'
31008 -
31009 -_Return value_:
31010 - The return value of `GETUID' is an `INTEGER' of the default kind.
31011 -
31012 -_Example_:
31013 - See `GETPID' for an example.
31014 -
31015 -_See also_:
31016 - *note GETPID::, *note GETLOG::
31017 -
31018 -\1f
31019 -File: gfortran.info, Node: GMTIME, Next: HOSTNM, Prev: GETUID, Up: Intrinsic Procedures
31020 -
31021 -7.97 `GMTIME' -- Convert time to GMT info
31022 -=========================================
31023 -
31024 -_Description_:
31025 - Given a system time value TIME (as provided by the `TIME8()'
31026 - intrinsic), fills VALUES with values extracted from it appropriate
31027 - to the UTC time zone (Universal Coordinated Time, also known in
31028 - some countries as GMT, Greenwich Mean Time), using `gmtime(3)'.
31029 -
31030 -_Standard_:
31031 - GNU extension
31032 -
31033 -_Class_:
31034 - Subroutine
31035 -
31036 -_Syntax_:
31037 - `CALL GMTIME(TIME, VALUES)'
31038 -
31039 -_Arguments_:
31040 - TIME An `INTEGER' scalar expression corresponding
31041 - to a system time, with `INTENT(IN)'.
31042 - VALUES A default `INTEGER' array with 9 elements,
31043 - with `INTENT(OUT)'.
31044 -
31045 -_Return value_:
31046 - The elements of VALUES are assigned as follows:
31047 - 1. Seconds after the minute, range 0-59 or 0-61 to allow for leap
31048 - seconds
31049 -
31050 - 2. Minutes after the hour, range 0-59
31051 -
31052 - 3. Hours past midnight, range 0-23
31053 -
31054 - 4. Day of month, range 0-31
31055 -
31056 - 5. Number of months since January, range 0-12
31057 -
31058 - 6. Years since 1900
31059 -
31060 - 7. Number of days since Sunday, range 0-6
31061 -
31062 - 8. Days since January 1
31063 -
31064 - 9. Daylight savings indicator: positive if daylight savings is in
31065 - effect, zero if not, and negative if the information is not
31066 - available.
31067 -
31068 -_See also_:
31069 - *note CTIME::, *note LTIME::, *note TIME::, *note TIME8::
31070 -
31071 -
31072 -\1f
31073 -File: gfortran.info, Node: HOSTNM, Next: HUGE, Prev: GMTIME, Up: Intrinsic Procedures
31074 -
31075 -7.98 `HOSTNM' -- Get system host name
31076 -=====================================
31077 -
31078 -_Description_:
31079 - Retrieves the host name of the system on which the program is
31080 - running.
31081 -
31082 - This intrinsic is provided in both subroutine and function forms;
31083 - however, only one form can be used in any given program unit.
31084 -
31085 -_Standard_:
31086 - GNU extension
31087 -
31088 -_Class_:
31089 - Subroutine, function
31090 -
31091 -_Syntax_:
31092 - `CALL HOSTNM(C [, STATUS])'
31093 - `STATUS = HOSTNM(NAME)'
31094 -
31095 -_Arguments_:
31096 - C Shall of type `CHARACTER' and of default kind.
31097 - STATUS (Optional) status flag of type `INTEGER'.
31098 - Returns 0 on success, or a system specific
31099 - error code otherwise.
31100 -
31101 -_Return value_:
31102 - In either syntax, NAME is set to the current hostname if it can be
31103 - obtained, or to a blank string otherwise.
31104 -
31105 -
31106 -\1f
31107 -File: gfortran.info, Node: HUGE, Next: HYPOT, Prev: HOSTNM, Up: Intrinsic Procedures
31108 -
31109 -7.99 `HUGE' -- Largest number of a kind
31110 -=======================================
31111 -
31112 -_Description_:
31113 - `HUGE(X)' returns the largest number that is not an infinity in
31114 - the model of the type of `X'.
31115 -
31116 -_Standard_:
31117 - Fortran 95 and later
31118 -
31119 -_Class_:
31120 - Inquiry function
31121 -
31122 -_Syntax_:
31123 - `RESULT = HUGE(X)'
31124 -
31125 -_Arguments_:
31126 - X Shall be of type `REAL' or `INTEGER'.
31127 -
31128 -_Return value_:
31129 - The return value is of the same type and kind as X
31130 -
31131 -_Example_:
31132 - program test_huge_tiny
31133 - print *, huge(0), huge(0.0), huge(0.0d0)
31134 - print *, tiny(0.0), tiny(0.0d0)
31135 - end program test_huge_tiny
31136 -
31137 -\1f
31138 -File: gfortran.info, Node: HYPOT, Next: IACHAR, Prev: HUGE, Up: Intrinsic Procedures
31139 -
31140 -7.100 `HYPOT' -- Euclidean distance function
31141 -============================================
31142 -
31143 -_Description_:
31144 - `HYPOT(X,Y)' is the Euclidean distance function. It is equal to
31145 - \sqrtX^2 + Y^2, without undue underflow or overflow.
31146 -
31147 -_Standard_:
31148 - Fortran 2008 and later
31149 -
31150 -_Class_:
31151 - Elemental function
31152 -
31153 -_Syntax_:
31154 - `RESULT = HYPOT(X, Y)'
31155 -
31156 -_Arguments_:
31157 - X The type shall be `REAL'.
31158 - Y The type and kind type parameter shall be the
31159 - same as X.
31160 -
31161 -_Return value_:
31162 - The return value has the same type and kind type parameter as X.
31163 -
31164 -_Example_:
31165 - program test_hypot
31166 - real(4) :: x = 1.e0_4, y = 0.5e0_4
31167 - x = hypot(x,y)
31168 - end program test_hypot
31169 -
31170 -\1f
31171 -File: gfortran.info, Node: IACHAR, Next: IAND, Prev: HYPOT, Up: Intrinsic Procedures
31172 -
31173 -7.101 `IACHAR' -- Code in ASCII collating sequence
31174 -==================================================
31175 -
31176 -_Description_:
31177 - `IACHAR(C)' returns the code for the ASCII character in the first
31178 - character position of `C'.
31179 -
31180 -_Standard_:
31181 - Fortran 95 and later, with KIND argument Fortran 2003 and later
31182 -
31183 -_Class_:
31184 - Elemental function
31185 -
31186 -_Syntax_:
31187 - `RESULT = IACHAR(C [, KIND])'
31188 -
31189 -_Arguments_:
31190 - C Shall be a scalar `CHARACTER', with
31191 - `INTENT(IN)'
31192 - KIND (Optional) An `INTEGER' initialization
31193 - expression indicating the kind parameter of
31194 - the result.
31195 -
31196 -_Return value_:
31197 - The return value is of type `INTEGER' and of kind KIND. If KIND is
31198 - absent, the return value is of default integer kind.
31199 -
31200 -_Example_:
31201 - program test_iachar
31202 - integer i
31203 - i = iachar(' ')
31204 - end program test_iachar
31205 -
31206 -_Note_:
31207 - See *note ICHAR:: for a discussion of converting between numerical
31208 - values and formatted string representations.
31209 -
31210 -_See also_:
31211 - *note ACHAR::, *note CHAR::, *note ICHAR::
31212 -
31213 -
31214 -\1f
31215 -File: gfortran.info, Node: IAND, Next: IARGC, Prev: IACHAR, Up: Intrinsic Procedures
31216 -
31217 -7.102 `IAND' -- Bitwise logical and
31218 -===================================
31219 -
31220 -_Description_:
31221 - Bitwise logical `AND'.
31222 -
31223 -_Standard_:
31224 - Fortran 95 and later
31225 -
31226 -_Class_:
31227 - Elemental function
31228 -
31229 -_Syntax_:
31230 - `RESULT = IAND(I, J)'
31231 -
31232 -_Arguments_:
31233 - I The type shall be `INTEGER'.
31234 - J The type shall be `INTEGER', of the same kind
31235 - as I. (As a GNU extension, different kinds
31236 - are also permitted.)
31237 -
31238 -_Return value_:
31239 - The return type is `INTEGER', of the same kind as the arguments.
31240 - (If the argument kinds differ, it is of the same kind as the
31241 - larger argument.)
31242 -
31243 -_Example_:
31244 - PROGRAM test_iand
31245 - INTEGER :: a, b
31246 - DATA a / Z'F' /, b / Z'3' /
31247 - WRITE (*,*) IAND(a, b)
31248 - END PROGRAM
31249 -
31250 -_See also_:
31251 - *note IOR::, *note IEOR::, *note IBITS::, *note IBSET::, *note
31252 - IBCLR::, *note NOT::
31253 -
31254 -
31255 -\1f
31256 -File: gfortran.info, Node: IARGC, Next: IBCLR, Prev: IAND, Up: Intrinsic Procedures
31257 -
31258 -7.103 `IARGC' -- Get the number of command line arguments
31259 -=========================================================
31260 -
31261 -_Description_:
31262 - `IARGC()' returns the number of arguments passed on the command
31263 - line when the containing program was invoked.
31264 -
31265 - This intrinsic routine is provided for backwards compatibility with
31266 - GNU Fortran 77. In new code, programmers should consider the use
31267 - of the *note COMMAND_ARGUMENT_COUNT:: intrinsic defined by the
31268 - Fortran 2003 standard.
31269 -
31270 -_Standard_:
31271 - GNU extension
31272 -
31273 -_Class_:
31274 - Function
31275 -
31276 -_Syntax_:
31277 - `RESULT = IARGC()'
31278 -
31279 -_Arguments_:
31280 - None.
31281 -
31282 -_Return value_:
31283 - The number of command line arguments, type `INTEGER(4)'.
31284 -
31285 -_Example_:
31286 - See *note GETARG::
31287 -
31288 -_See also_:
31289 - GNU Fortran 77 compatibility subroutine: *note GETARG::
31290 -
31291 - Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note
31292 - GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
31293 -
31294 -\1f
31295 -File: gfortran.info, Node: IBCLR, Next: IBITS, Prev: IARGC, Up: Intrinsic Procedures
31296 -
31297 -7.104 `IBCLR' -- Clear bit
31298 -==========================
31299 -
31300 -_Description_:
31301 - `IBCLR' returns the value of I with the bit at position POS set to
31302 - zero.
31303 -
31304 -_Standard_:
31305 - Fortran 95 and later
31306 -
31307 -_Class_:
31308 - Elemental function
31309 -
31310 -_Syntax_:
31311 - `RESULT = IBCLR(I, POS)'
31312 -
31313 -_Arguments_:
31314 - I The type shall be `INTEGER'.
31315 - POS The type shall be `INTEGER'.
31316 -
31317 -_Return value_:
31318 - The return value is of type `INTEGER' and of the same kind as I.
31319 -
31320 -_See also_:
31321 - *note IBITS::, *note IBSET::, *note IAND::, *note IOR::, *note
31322 - IEOR::, *note MVBITS::
31323 -
31324 -
31325 -\1f
31326 -File: gfortran.info, Node: IBITS, Next: IBSET, Prev: IBCLR, Up: Intrinsic Procedures
31327 -
31328 -7.105 `IBITS' -- Bit extraction
31329 -===============================
31330 -
31331 -_Description_:
31332 - `IBITS' extracts a field of length LEN from I, starting from bit
31333 - position POS and extending left for LEN bits. The result is
31334 - right-justified and the remaining bits are zeroed. The value of
31335 - `POS+LEN' must be less than or equal to the value `BIT_SIZE(I)'.
31336 -
31337 -_Standard_:
31338 - Fortran 95 and later
31339 -
31340 -_Class_:
31341 - Elemental function
31342 -
31343 -_Syntax_:
31344 - `RESULT = IBITS(I, POS, LEN)'
31345 -
31346 -_Arguments_:
31347 - I The type shall be `INTEGER'.
31348 - POS The type shall be `INTEGER'.
31349 - LEN The type shall be `INTEGER'.
31350 -
31351 -_Return value_:
31352 - The return value is of type `INTEGER' and of the same kind as I.
31353 -
31354 -_See also_:
31355 - *note BIT_SIZE::, *note IBCLR::, *note IBSET::, *note IAND::,
31356 - *note IOR::, *note IEOR::
31357 -
31358 -\1f
31359 -File: gfortran.info, Node: IBSET, Next: ICHAR, Prev: IBITS, Up: Intrinsic Procedures
31360 -
31361 -7.106 `IBSET' -- Set bit
31362 -========================
31363 -
31364 -_Description_:
31365 - `IBSET' returns the value of I with the bit at position POS set to
31366 - one.
31367 -
31368 -_Standard_:
31369 - Fortran 95 and later
31370 -
31371 -_Class_:
31372 - Elemental function
31373 -
31374 -_Syntax_:
31375 - `RESULT = IBSET(I, POS)'
31376 -
31377 -_Arguments_:
31378 - I The type shall be `INTEGER'.
31379 - POS The type shall be `INTEGER'.
31380 -
31381 -_Return value_:
31382 - The return value is of type `INTEGER' and of the same kind as I.
31383 -
31384 -_See also_:
31385 - *note IBCLR::, *note IBITS::, *note IAND::, *note IOR::, *note
31386 - IEOR::, *note MVBITS::
31387 -
31388 -
31389 -\1f
31390 -File: gfortran.info, Node: ICHAR, Next: IDATE, Prev: IBSET, Up: Intrinsic Procedures
31391 -
31392 -7.107 `ICHAR' -- Character-to-integer conversion function
31393 -=========================================================
31394 -
31395 -_Description_:
31396 - `ICHAR(C)' returns the code for the character in the first
31397 - character position of `C' in the system's native character set.
31398 - The correspondence between characters and their codes is not
31399 - necessarily the same across different GNU Fortran implementations.
31400 -
31401 -_Standard_:
31402 - Fortan 95 and later, with KIND argument Fortran 2003 and later
31403 -
31404 -_Class_:
31405 - Elemental function
31406 -
31407 -_Syntax_:
31408 - `RESULT = ICHAR(C [, KIND])'
31409 -
31410 -_Arguments_:
31411 - C Shall be a scalar `CHARACTER', with
31412 - `INTENT(IN)'
31413 - KIND (Optional) An `INTEGER' initialization
31414 - expression indicating the kind parameter of
31415 - the result.
31416 -
31417 -_Return value_:
31418 - The return value is of type `INTEGER' and of kind KIND. If KIND is
31419 - absent, the return value is of default integer kind.
31420 -
31421 -_Example_:
31422 - program test_ichar
31423 - integer i
31424 - i = ichar(' ')
31425 - end program test_ichar
31426 -
31427 -_Note_:
31428 - No intrinsic exists to convert between a numeric value and a
31429 - formatted character string representation - for instance, given the
31430 - `CHARACTER' value `'154'', obtaining an `INTEGER' or `REAL' value
31431 - with the value 154, or vice versa. Instead, this functionality is
31432 - provided by internal-file I/O, as in the following example:
31433 - program read_val
31434 - integer value
31435 - character(len=10) string, string2
31436 - string = '154'
31437 -
31438 - ! Convert a string to a numeric value
31439 - read (string,'(I10)') value
31440 - print *, value
31441 -
31442 - ! Convert a value to a formatted string
31443 - write (string2,'(I10)') value
31444 - print *, string2
31445 - end program read_val
31446 -
31447 -_See also_:
31448 - *note ACHAR::, *note CHAR::, *note IACHAR::
31449 -
31450 -
31451 -\1f
31452 -File: gfortran.info, Node: IDATE, Next: IEOR, Prev: ICHAR, Up: Intrinsic Procedures
31453 -
31454 -7.108 `IDATE' -- Get current local time subroutine (day/month/year)
31455 -===================================================================
31456 -
31457 -_Description_:
31458 - `IDATE(TARRAY)' Fills TARRAY with the numerical values at the
31459 - current local time. The day (in the range 1-31), month (in the
31460 - range 1-12), and year appear in elements 1, 2, and 3 of TARRAY,
31461 - respectively. The year has four significant digits.
31462 -
31463 -_Standard_:
31464 - GNU extension
31465 -
31466 -_Class_:
31467 - Subroutine
31468 -
31469 -_Syntax_:
31470 - `CALL IDATE(VALUES)'
31471 -
31472 -_Arguments_:
31473 - VALUES The type shall be `INTEGER, DIMENSION(3)' and
31474 - the kind shall be the default integer kind.
31475 -
31476 -_Return value_:
31477 - Does not return anything.
31478 -
31479 -_Example_:
31480 - program test_idate
31481 - integer, dimension(3) :: tarray
31482 - call idate(tarray)
31483 - print *, tarray(1)
31484 - print *, tarray(2)
31485 - print *, tarray(3)
31486 - end program test_idate
31487 -
31488 -\1f
31489 -File: gfortran.info, Node: IEOR, Next: IERRNO, Prev: IDATE, Up: Intrinsic Procedures
31490 -
31491 -7.109 `IEOR' -- Bitwise logical exclusive or
31492 -============================================
31493 -
31494 -_Description_:
31495 - `IEOR' returns the bitwise boolean exclusive-OR of I and J.
31496 -
31497 -_Standard_:
31498 - Fortran 95 and later
31499 -
31500 -_Class_:
31501 - Elemental function
31502 -
31503 -_Syntax_:
31504 - `RESULT = IEOR(I, J)'
31505 -
31506 -_Arguments_:
31507 - I The type shall be `INTEGER'.
31508 - J The type shall be `INTEGER', of the same kind
31509 - as I. (As a GNU extension, different kinds
31510 - are also permitted.)
31511 -
31512 -_Return value_:
31513 - The return type is `INTEGER', of the same kind as the arguments.
31514 - (If the argument kinds differ, it is of the same kind as the
31515 - larger argument.)
31516 -
31517 -_See also_:
31518 - *note IOR::, *note IAND::, *note IBITS::, *note IBSET::, *note
31519 - IBCLR::, *note NOT::
31520 -
31521 -\1f
31522 -File: gfortran.info, Node: IERRNO, Next: INDEX intrinsic, Prev: IEOR, Up: Intrinsic Procedures
31523 -
31524 -7.110 `IERRNO' -- Get the last system error number
31525 -==================================================
31526 -
31527 -_Description_:
31528 - Returns the last system error number, as given by the C `errno()'
31529 - function.
31530 -
31531 -_Standard_:
31532 - GNU extension
31533 -
31534 -_Class_:
31535 - Function
31536 -
31537 -_Syntax_:
31538 - `RESULT = IERRNO()'
31539 -
31540 -_Arguments_:
31541 - None.
31542 -
31543 -_Return value_:
31544 - The return value is of type `INTEGER' and of the default integer
31545 - kind.
31546 -
31547 -_See also_:
31548 - *note PERROR::
31549 -
31550 -\1f
31551 -File: gfortran.info, Node: INDEX intrinsic, Next: INT, Prev: IERRNO, Up: Intrinsic Procedures
31552 -
31553 -7.111 `INDEX' -- Position of a substring within a string
31554 -========================================================
31555 -
31556 -_Description_:
31557 - Returns the position of the start of the first occurrence of string
31558 - SUBSTRING as a substring in STRING, counting from one. If
31559 - SUBSTRING is not present in STRING, zero is returned. If the BACK
31560 - argument is present and true, the return value is the start of the
31561 - last occurrence rather than the first.
31562 -
31563 -_Standard_:
31564 - Fortran 77 and later, with KIND argument Fortran 2003 and later
31565 -
31566 -_Class_:
31567 - Elemental function
31568 -
31569 -_Syntax_:
31570 - `RESULT = INDEX(STRING, SUBSTRING [, BACK [, KIND]])'
31571 -
31572 -_Arguments_:
31573 - STRING Shall be a scalar `CHARACTER', with
31574 - `INTENT(IN)'
31575 - SUBSTRING Shall be a scalar `CHARACTER', with
31576 - `INTENT(IN)'
31577 - BACK (Optional) Shall be a scalar `LOGICAL', with
31578 - `INTENT(IN)'
31579 - KIND (Optional) An `INTEGER' initialization
31580 - expression indicating the kind parameter of
31581 - the result.
31582 -
31583 -_Return value_:
31584 - The return value is of type `INTEGER' and of kind KIND. If KIND is
31585 - absent, the return value is of default integer kind.
31586 -
31587 -_See also_:
31588 - *note SCAN::, *note VERIFY::
31589 -
31590 -\1f
31591 -File: gfortran.info, Node: INT, Next: INT2, Prev: INDEX intrinsic, Up: Intrinsic Procedures
31592 -
31593 -7.112 `INT' -- Convert to integer type
31594 -======================================
31595 -
31596 -_Description_:
31597 - Convert to integer type
31598 -
31599 -_Standard_:
31600 - Fortran 77 and later
31601 -
31602 -_Class_:
31603 - Elemental function
31604 -
31605 -_Syntax_:
31606 - `RESULT = INT(A [, KIND))'
31607 -
31608 -_Arguments_:
31609 - A Shall be of type `INTEGER', `REAL', or
31610 - `COMPLEX'.
31611 - KIND (Optional) An `INTEGER' initialization
31612 - expression indicating the kind parameter of
31613 - the result.
31614 -
31615 -_Return value_:
31616 - These functions return a `INTEGER' variable or array under the
31617 - following rules:
31618 -
31619 - (A)
31620 - If A is of type `INTEGER', `INT(A) = A'
31621 -
31622 - (B)
31623 - If A is of type `REAL' and |A| < 1, `INT(A)' equals `0'. If
31624 - |A| \geq 1, then `INT(A)' equals the largest integer that
31625 - does not exceed the range of A and whose sign is the same as
31626 - the sign of A.
31627 -
31628 - (C)
31629 - If A is of type `COMPLEX', rule B is applied to the real part
31630 - of A.
31631 -
31632 -_Example_:
31633 - program test_int
31634 - integer :: i = 42
31635 - complex :: z = (-3.7, 1.0)
31636 - print *, int(i)
31637 - print *, int(z), int(z,8)
31638 - end program
31639 -
31640 -_Specific names_:
31641 - Name Argument Return type Standard
31642 - `IFIX(A)' `REAL(4) A' `INTEGER' Fortran 77 and
31643 - later
31644 - `IDINT(A)' `REAL(8) A' `INTEGER' Fortran 77 and
31645 - later
31646 -
31647 -
31648 -\1f
31649 -File: gfortran.info, Node: INT2, Next: INT8, Prev: INT, Up: Intrinsic Procedures
31650 -
31651 -7.113 `INT2' -- Convert to 16-bit integer type
31652 -==============================================
31653 -
31654 -_Description_:
31655 - Convert to a `KIND=2' integer type. This is equivalent to the
31656 - standard `INT' intrinsic with an optional argument of `KIND=2',
31657 - and is only included for backwards compatibility.
31658 -
31659 - The `SHORT' intrinsic is equivalent to `INT2'.
31660 -
31661 -_Standard_:
31662 - GNU extension
31663 -
31664 -_Class_:
31665 - Elemental function
31666 -
31667 -_Syntax_:
31668 - `RESULT = INT2(A)'
31669 -
31670 -_Arguments_:
31671 - A Shall be of type `INTEGER', `REAL', or
31672 - `COMPLEX'.
31673 -
31674 -_Return value_:
31675 - The return value is a `INTEGER(2)' variable.
31676 -
31677 -_See also_:
31678 - *note INT::, *note INT8::, *note LONG::
31679 -
31680 -\1f
31681 -File: gfortran.info, Node: INT8, Next: IOR, Prev: INT2, Up: Intrinsic Procedures
31682 -
31683 -7.114 `INT8' -- Convert to 64-bit integer type
31684 -==============================================
31685 -
31686 -_Description_:
31687 - Convert to a `KIND=8' integer type. This is equivalent to the
31688 - standard `INT' intrinsic with an optional argument of `KIND=8',
31689 - and is only included for backwards compatibility.
31690 -
31691 -_Standard_:
31692 - GNU extension
31693 -
31694 -_Class_:
31695 - Elemental function
31696 -
31697 -_Syntax_:
31698 - `RESULT = INT8(A)'
31699 -
31700 -_Arguments_:
31701 - A Shall be of type `INTEGER', `REAL', or
31702 - `COMPLEX'.
31703 -
31704 -_Return value_:
31705 - The return value is a `INTEGER(8)' variable.
31706 -
31707 -_See also_:
31708 - *note INT::, *note INT2::, *note LONG::
31709 -
31710 -\1f
31711 -File: gfortran.info, Node: IOR, Next: IRAND, Prev: INT8, Up: Intrinsic Procedures
31712 -
31713 -7.115 `IOR' -- Bitwise logical or
31714 -=================================
31715 -
31716 -_Description_:
31717 - `IOR' returns the bitwise boolean inclusive-OR of I and J.
31718 -
31719 -_Standard_:
31720 - Fortran 95 and later
31721 -
31722 -_Class_:
31723 - Elemental function
31724 -
31725 -_Syntax_:
31726 - `RESULT = IOR(I, J)'
31727 -
31728 -_Arguments_:
31729 - I The type shall be `INTEGER'.
31730 - J The type shall be `INTEGER', of the same kind
31731 - as I. (As a GNU extension, different kinds
31732 - are also permitted.)
31733 -
31734 -_Return value_:
31735 - The return type is `INTEGER', of the same kind as the arguments.
31736 - (If the argument kinds differ, it is of the same kind as the
31737 - larger argument.)
31738 -
31739 -_See also_:
31740 - *note IEOR::, *note IAND::, *note IBITS::, *note IBSET::, *note
31741 - IBCLR::, *note NOT::
31742 -
31743 -\1f
31744 -File: gfortran.info, Node: IRAND, Next: IS_IOSTAT_END, Prev: IOR, Up: Intrinsic Procedures
31745 -
31746 -7.116 `IRAND' -- Integer pseudo-random number
31747 -=============================================
31748 -
31749 -_Description_:
31750 - `IRAND(FLAG)' returns a pseudo-random number from a uniform
31751 - distribution between 0 and a system-dependent limit (which is in
31752 - most cases 2147483647). If FLAG is 0, the next number in the
31753 - current sequence is returned; if FLAG is 1, the generator is
31754 - restarted by `CALL SRAND(0)'; if FLAG has any other value, it is
31755 - used as a new seed with `SRAND'.
31756 -
31757 - This intrinsic routine is provided for backwards compatibility with
31758 - GNU Fortran 77. It implements a simple modulo generator as provided
31759 - by `g77'. For new code, one should consider the use of *note
31760 - RANDOM_NUMBER:: as it implements a superior algorithm.
31761 -
31762 -_Standard_:
31763 - GNU extension
31764 -
31765 -_Class_:
31766 - Function
31767 -
31768 -_Syntax_:
31769 - `RESULT = IRAND(I)'
31770 -
31771 -_Arguments_:
31772 - I Shall be a scalar `INTEGER' of kind 4.
31773 -
31774 -_Return value_:
31775 - The return value is of `INTEGER(kind=4)' type.
31776 -
31777 -_Example_:
31778 - program test_irand
31779 - integer,parameter :: seed = 86456
31780 -
31781 - call srand(seed)
31782 - print *, irand(), irand(), irand(), irand()
31783 - print *, irand(seed), irand(), irand(), irand()
31784 - end program test_irand
31785 -
31786 -
31787 -\1f
31788 -File: gfortran.info, Node: IS_IOSTAT_END, Next: IS_IOSTAT_EOR, Prev: IRAND, Up: Intrinsic Procedures
31789 -
31790 -7.117 `IS_IOSTAT_END' -- Test for end-of-file value
31791 -===================================================
31792 -
31793 -_Description_:
31794 - `IS_IOSTAT_END' tests whether an variable has the value of the I/O
31795 - status "end of file". The function is equivalent to comparing the
31796 - variable with the `IOSTAT_END' parameter of the intrinsic module
31797 - `ISO_FORTRAN_ENV'.
31798 -
31799 -_Standard_:
31800 - Fortran 2003 and later
31801 -
31802 -_Class_:
31803 - Elemental function
31804 -
31805 -_Syntax_:
31806 - `RESULT = IS_IOSTAT_END(I)'
31807 -
31808 -_Arguments_:
31809 - I Shall be of the type `INTEGER'.
31810 -
31811 -_Return value_:
31812 - Returns a `LOGICAL' of the default kind, which `.TRUE.' if I has
31813 - the value which indicates an end of file condition for IOSTAT=
31814 - specifiers, and is `.FALSE.' otherwise.
31815 -
31816 -_Example_:
31817 - PROGRAM iostat
31818 - IMPLICIT NONE
31819 - INTEGER :: stat, i
31820 - OPEN(88, FILE='test.dat')
31821 - READ(88, *, IOSTAT=stat) i
31822 - IF(IS_IOSTAT_END(stat)) STOP 'END OF FILE'
31823 - END PROGRAM
31824 -
31825 -\1f
31826 -File: gfortran.info, Node: IS_IOSTAT_EOR, Next: ISATTY, Prev: IS_IOSTAT_END, Up: Intrinsic Procedures
31827 -
31828 -7.118 `IS_IOSTAT_EOR' -- Test for end-of-record value
31829 -=====================================================
31830 -
31831 -_Description_:
31832 - `IS_IOSTAT_EOR' tests whether an variable has the value of the I/O
31833 - status "end of record". The function is equivalent to comparing the
31834 - variable with the `IOSTAT_EOR' parameter of the intrinsic module
31835 - `ISO_FORTRAN_ENV'.
31836 -
31837 -_Standard_:
31838 - Fortran 2003 and later
31839 -
31840 -_Class_:
31841 - Elemental function
31842 -
31843 -_Syntax_:
31844 - `RESULT = IS_IOSTAT_EOR(I)'
31845 -
31846 -_Arguments_:
31847 - I Shall be of the type `INTEGER'.
31848 -
31849 -_Return value_:
31850 - Returns a `LOGICAL' of the default kind, which `.TRUE.' if I has
31851 - the value which indicates an end of file condition for IOSTAT=
31852 - specifiers, and is `.FALSE.' otherwise.
31853 -
31854 -_Example_:
31855 - PROGRAM iostat
31856 - IMPLICIT NONE
31857 - INTEGER :: stat, i(50)
31858 - OPEN(88, FILE='test.dat', FORM='UNFORMATTED')
31859 - READ(88, IOSTAT=stat) i
31860 - IF(IS_IOSTAT_EOR(stat)) STOP 'END OF RECORD'
31861 - END PROGRAM
31862 -
31863 -\1f
31864 -File: gfortran.info, Node: ISATTY, Next: ISHFT, Prev: IS_IOSTAT_EOR, Up: Intrinsic Procedures
31865 -
31866 -7.119 `ISATTY' -- Whether a unit is a terminal device.
31867 -======================================================
31868 -
31869 -_Description_:
31870 - Determine whether a unit is connected to a terminal device.
31871 -
31872 -_Standard_:
31873 - GNU extension
31874 -
31875 -_Class_:
31876 - Function
31877 -
31878 -_Syntax_:
31879 - `RESULT = ISATTY(UNIT)'
31880 -
31881 -_Arguments_:
31882 - UNIT Shall be a scalar `INTEGER'.
31883 -
31884 -_Return value_:
31885 - Returns `.TRUE.' if the UNIT is connected to a terminal device,
31886 - `.FALSE.' otherwise.
31887 -
31888 -_Example_:
31889 - PROGRAM test_isatty
31890 - INTEGER(kind=1) :: unit
31891 - DO unit = 1, 10
31892 - write(*,*) isatty(unit=unit)
31893 - END DO
31894 - END PROGRAM
31895 -
31896 -_See also_:
31897 - *note TTYNAM::
31898 -
31899 -\1f
31900 -File: gfortran.info, Node: ISHFT, Next: ISHFTC, Prev: ISATTY, Up: Intrinsic Procedures
31901 -
31902 -7.120 `ISHFT' -- Shift bits
31903 -===========================
31904 -
31905 -_Description_:
31906 - `ISHFT' returns a value corresponding to I with all of the bits
31907 - shifted SHIFT places. A value of SHIFT greater than zero
31908 - corresponds to a left shift, a value of zero corresponds to no
31909 - shift, and a value less than zero corresponds to a right shift.
31910 - If the absolute value of SHIFT is greater than `BIT_SIZE(I)', the
31911 - value is undefined. Bits shifted out from the left end or right
31912 - end are lost; zeros are shifted in from the opposite end.
31913 -
31914 -_Standard_:
31915 - Fortran 95 and later
31916 -
31917 -_Class_:
31918 - Elemental function
31919 -
31920 -_Syntax_:
31921 - `RESULT = ISHFT(I, SHIFT)'
31922 -
31923 -_Arguments_:
31924 - I The type shall be `INTEGER'.
31925 - SHIFT The type shall be `INTEGER'.
31926 -
31927 -_Return value_:
31928 - The return value is of type `INTEGER' and of the same kind as I.
31929 -
31930 -_See also_:
31931 - *note ISHFTC::
31932 -
31933 -\1f
31934 -File: gfortran.info, Node: ISHFTC, Next: ISNAN, Prev: ISHFT, Up: Intrinsic Procedures
31935 -
31936 -7.121 `ISHFTC' -- Shift bits circularly
31937 -=======================================
31938 -
31939 -_Description_:
31940 - `ISHFTC' returns a value corresponding to I with the rightmost
31941 - SIZE bits shifted circularly SHIFT places; that is, bits shifted
31942 - out one end are shifted into the opposite end. A value of SHIFT
31943 - greater than zero corresponds to a left shift, a value of zero
31944 - corresponds to no shift, and a value less than zero corresponds to
31945 - a right shift. The absolute value of SHIFT must be less than
31946 - SIZE. If the SIZE argument is omitted, it is taken to be
31947 - equivalent to `BIT_SIZE(I)'.
31948 -
31949 -_Standard_:
31950 - Fortran 95 and later
31951 -
31952 -_Class_:
31953 - Elemental function
31954 -
31955 -_Syntax_:
31956 - `RESULT = ISHFTC(I, SHIFT [, SIZE])'
31957 -
31958 -_Arguments_:
31959 - I The type shall be `INTEGER'.
31960 - SHIFT The type shall be `INTEGER'.
31961 - SIZE (Optional) The type shall be `INTEGER'; the
31962 - value must be greater than zero and less than
31963 - or equal to `BIT_SIZE(I)'.
31964 -
31965 -_Return value_:
31966 - The return value is of type `INTEGER' and of the same kind as I.
31967 -
31968 -_See also_:
31969 - *note ISHFT::
31970 -
31971 -\1f
31972 -File: gfortran.info, Node: ISNAN, Next: ITIME, Prev: ISHFTC, Up: Intrinsic Procedures
31973 -
31974 -7.122 `ISNAN' -- Test for a NaN
31975 -===============================
31976 -
31977 -_Description_:
31978 - `ISNAN' tests whether a floating-point value is an IEEE
31979 - Not-a-Number (NaN).
31980 -
31981 -_Standard_:
31982 - GNU extension
31983 -
31984 -_Class_:
31985 - Elemental function
31986 -
31987 -_Syntax_:
31988 - `ISNAN(X)'
31989 -
31990 -_Arguments_:
31991 - X Variable of the type `REAL'.
31992 -
31993 -_Return value_:
31994 - Returns a default-kind `LOGICAL'. The returned value is `TRUE' if
31995 - X is a NaN and `FALSE' otherwise.
31996 -
31997 -_Example_:
31998 - program test_nan
31999 - implicit none
32000 - real :: x
32001 - x = -1.0
32002 - x = sqrt(x)
32003 - if (isnan(x)) stop '"x" is a NaN'
32004 - end program test_nan
32005 -
32006 -\1f
32007 -File: gfortran.info, Node: ITIME, Next: KILL, Prev: ISNAN, Up: Intrinsic Procedures
32008 -
32009 -7.123 `ITIME' -- Get current local time subroutine (hour/minutes/seconds)
32010 -=========================================================================
32011 -
32012 -_Description_:
32013 - `IDATE(VALUES)' Fills VALUES with the numerical values at the
32014 - current local time. The hour (in the range 1-24), minute (in the
32015 - range 1-60), and seconds (in the range 1-60) appear in elements 1,
32016 - 2, and 3 of VALUES, respectively.
32017 -
32018 -_Standard_:
32019 - GNU extension
32020 -
32021 -_Class_:
32022 - Subroutine
32023 -
32024 -_Syntax_:
32025 - `CALL ITIME(VALUES)'
32026 -
32027 -_Arguments_:
32028 - VALUES The type shall be `INTEGER, DIMENSION(3)' and
32029 - the kind shall be the default integer kind.
32030 -
32031 -_Return value_:
32032 - Does not return anything.
32033 -
32034 -_Example_:
32035 - program test_itime
32036 - integer, dimension(3) :: tarray
32037 - call itime(tarray)
32038 - print *, tarray(1)
32039 - print *, tarray(2)
32040 - print *, tarray(3)
32041 - end program test_itime
32042 -
32043 -\1f
32044 -File: gfortran.info, Node: KILL, Next: KIND, Prev: ITIME, Up: Intrinsic Procedures
32045 -
32046 -7.124 `KILL' -- Send a signal to a process
32047 -==========================================
32048 -
32049 -_Description_:
32050 -
32051 -_Standard_:
32052 - Sends the signal specified by SIGNAL to the process PID. See
32053 - `kill(2)'.
32054 -
32055 - This intrinsic is provided in both subroutine and function forms;
32056 - however, only one form can be used in any given program unit.
32057 -
32058 -_Class_:
32059 - Subroutine, function
32060 -
32061 -_Syntax_:
32062 - `CALL KILL(C, VALUE [, STATUS])'
32063 -
32064 -_Arguments_:
32065 - C Shall be a scalar `INTEGER', with `INTENT(IN)'
32066 - VALUE Shall be a scalar `INTEGER', with `INTENT(IN)'
32067 - STATUS (Optional) status flag of type `INTEGER(4)' or
32068 - `INTEGER(8)'. Returns 0 on success, or a
32069 - system-specific error code otherwise.
32070 -
32071 -_See also_:
32072 - *note ABORT::, *note EXIT::
32073 -
32074 -\1f
32075 -File: gfortran.info, Node: KIND, Next: LBOUND, Prev: KILL, Up: Intrinsic Procedures
32076 -
32077 -7.125 `KIND' -- Kind of an entity
32078 -=================================
32079 -
32080 -_Description_:
32081 - `KIND(X)' returns the kind value of the entity X.
32082 -
32083 -_Standard_:
32084 - Fortran 95 and later
32085 -
32086 -_Class_:
32087 - Inquiry function
32088 -
32089 -_Syntax_:
32090 - `K = KIND(X)'
32091 -
32092 -_Arguments_:
32093 - X Shall be of type `LOGICAL', `INTEGER', `REAL',
32094 - `COMPLEX' or `CHARACTER'.
32095 -
32096 -_Return value_:
32097 - The return value is a scalar of type `INTEGER' and of the default
32098 - integer kind.
32099 -
32100 -_Example_:
32101 - program test_kind
32102 - integer,parameter :: kc = kind(' ')
32103 - integer,parameter :: kl = kind(.true.)
32104 -
32105 - print *, "The default character kind is ", kc
32106 - print *, "The default logical kind is ", kl
32107 - end program test_kind
32108 -
32109 -
32110 -\1f
32111 -File: gfortran.info, Node: LBOUND, Next: LEADZ, Prev: KIND, Up: Intrinsic Procedures
32112 -
32113 -7.126 `LBOUND' -- Lower dimension bounds of an array
32114 -====================================================
32115 -
32116 -_Description_:
32117 - Returns the lower bounds of an array, or a single lower bound
32118 - along the DIM dimension.
32119 -
32120 -_Standard_:
32121 - Fortran 95 and later, with KIND argument Fortran 2003 and later
32122 -
32123 -_Class_:
32124 - Inquiry function
32125 -
32126 -_Syntax_:
32127 - `RESULT = LBOUND(ARRAY [, DIM [, KIND]])'
32128 -
32129 -_Arguments_:
32130 - ARRAY Shall be an array, of any type.
32131 - DIM (Optional) Shall be a scalar `INTEGER'.
32132 - KIND (Optional) An `INTEGER' initialization
32133 - expression indicating the kind parameter of
32134 - the result.
32135 -
32136 -_Return value_:
32137 - The return value is of type `INTEGER' and of kind KIND. If KIND is
32138 - absent, the return value is of default integer kind. If DIM is
32139 - absent, the result is an array of the lower bounds of ARRAY. If
32140 - DIM is present, the result is a scalar corresponding to the lower
32141 - bound of the array along that dimension. If ARRAY is an
32142 - expression rather than a whole array or array structure component,
32143 - or if it has a zero extent along the relevant dimension, the lower
32144 - bound is taken to be 1.
32145 -
32146 -_See also_:
32147 - *note UBOUND::
32148 -
32149 -\1f
32150 -File: gfortran.info, Node: LEADZ, Next: LEN, Prev: LBOUND, Up: Intrinsic Procedures
32151 -
32152 -7.127 `LEADZ' -- Number of leading zero bits of an integer
32153 -==========================================================
32154 -
32155 -_Description_:
32156 - `LEADZ' returns the number of leading zero bits of an integer.
32157 -
32158 -_Standard_:
32159 - Fortran 2008 and later
32160 -
32161 -_Class_:
32162 - Elemental function
32163 -
32164 -_Syntax_:
32165 - `RESULT = LEADZ(I)'
32166 -
32167 -_Arguments_:
32168 - I Shall be of type `INTEGER'.
32169 -
32170 -_Return value_:
32171 - The type of the return value is the default `INTEGER'. If all the
32172 - bits of `I' are zero, the result value is `BIT_SIZE(I)'.
32173 -
32174 -_Example_:
32175 - PROGRAM test_leadz
32176 - WRITE (*,*) LEADZ(1) ! prints 8 if BITSIZE(I) has the value 32
32177 - END PROGRAM
32178 -
32179 -_See also_:
32180 - *note BIT_SIZE::, *note TRAILZ::
32181 -
32182 -\1f
32183 -File: gfortran.info, Node: LEN, Next: LEN_TRIM, Prev: LEADZ, Up: Intrinsic Procedures
32184 -
32185 -7.128 `LEN' -- Length of a character entity
32186 -===========================================
32187 -
32188 -_Description_:
32189 - Returns the length of a character string. If STRING is an array,
32190 - the length of an element of STRING is returned. Note that STRING
32191 - need not be defined when this intrinsic is invoked, since only the
32192 - length, not the content, of STRING is needed.
32193 -
32194 -_Standard_:
32195 - Fortran 77 and later, with KIND argument Fortran 2003 and later
32196 -
32197 -_Class_:
32198 - Inquiry function
32199 -
32200 -_Syntax_:
32201 - `L = LEN(STRING [, KIND])'
32202 -
32203 -_Arguments_:
32204 - STRING Shall be a scalar or array of type
32205 - `CHARACTER', with `INTENT(IN)'
32206 - KIND (Optional) An `INTEGER' initialization
32207 - expression indicating the kind parameter of
32208 - the result.
32209 -
32210 -_Return value_:
32211 - The return value is of type `INTEGER' and of kind KIND. If KIND is
32212 - absent, the return value is of default integer kind.
32213 -
32214 -_See also_:
32215 - *note LEN_TRIM::, *note ADJUSTL::, *note ADJUSTR::
32216 -
32217 -\1f
32218 -File: gfortran.info, Node: LEN_TRIM, Next: LOG_GAMMA, Prev: LEN, Up: Intrinsic Procedures
32219 -
32220 -7.129 `LEN_TRIM' -- Length of a character entity without trailing blank characters
32221 -==================================================================================
32222 -
32223 -_Description_:
32224 - Returns the length of a character string, ignoring any trailing
32225 - blanks.
32226 -
32227 -_Standard_:
32228 - Fortran 95 and later, with KIND argument Fortran 2003 and later
32229 -
32230 -_Class_:
32231 - Elemental function
32232 -
32233 -_Syntax_:
32234 - `RESULT = LEN_TRIM(STRING [, KIND])'
32235 -
32236 -_Arguments_:
32237 - STRING Shall be a scalar of type `CHARACTER', with
32238 - `INTENT(IN)'
32239 - KIND (Optional) An `INTEGER' initialization
32240 - expression indicating the kind parameter of
32241 - the result.
32242 -
32243 -_Return value_:
32244 - The return value is of type `INTEGER' and of kind KIND. If KIND is
32245 - absent, the return value is of default integer kind.
32246 -
32247 -_See also_:
32248 - *note LEN::, *note ADJUSTL::, *note ADJUSTR::
32249 -
32250 -\1f
32251 -File: gfortran.info, Node: LGE, Next: LGT, Prev: LOG_GAMMA, Up: Intrinsic Procedures
32252 -
32253 -7.130 `LGE' -- Lexical greater than or equal
32254 -============================================
32255 -
32256 -_Description_:
32257 - Determines whether one string is lexically greater than or equal to
32258 - another string, where the two strings are interpreted as containing
32259 - ASCII character codes. If the String A and String B are not the
32260 - same length, the shorter is compared as if spaces were appended to
32261 - it to form a value that has the same length as the longer.
32262 -
32263 - In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
32264 - and `LLT' differ from the corresponding intrinsic operators
32265 - `.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
32266 - processor's character ordering (which is not ASCII on some
32267 - targets), whereas the former always use the ASCII ordering.
32268 -
32269 -_Standard_:
32270 - Fortran 77 and later
32271 -
32272 -_Class_:
32273 - Elemental function
32274 -
32275 -_Syntax_:
32276 - `RESULT = LGE(STRING_A, STRING_B)'
32277 -
32278 -_Arguments_:
32279 - STRING_A Shall be of default `CHARACTER' type.
32280 - STRING_B Shall be of default `CHARACTER' type.
32281 -
32282 -_Return value_:
32283 - Returns `.TRUE.' if `STRING_A >= STRING_B', and `.FALSE.'
32284 - otherwise, based on the ASCII ordering.
32285 -
32286 -_See also_:
32287 - *note LGT::, *note LLE::, *note LLT::
32288 -
32289 -\1f
32290 -File: gfortran.info, Node: LGT, Next: LINK, Prev: LGE, Up: Intrinsic Procedures
32291 -
32292 -7.131 `LGT' -- Lexical greater than
32293 -===================================
32294 -
32295 -_Description_:
32296 - Determines whether one string is lexically greater than another
32297 - string, where the two strings are interpreted as containing ASCII
32298 - character codes. If the String A and String B are not the same
32299 - length, the shorter is compared as if spaces were appended to it
32300 - to form a value that has the same length as the longer.
32301 -
32302 - In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
32303 - and `LLT' differ from the corresponding intrinsic operators
32304 - `.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
32305 - processor's character ordering (which is not ASCII on some
32306 - targets), whereas the former always use the ASCII ordering.
32307 -
32308 -_Standard_:
32309 - Fortran 77 and later
32310 -
32311 -_Class_:
32312 - Elemental function
32313 -
32314 -_Syntax_:
32315 - `RESULT = LGT(STRING_A, STRING_B)'
32316 -
32317 -_Arguments_:
32318 - STRING_A Shall be of default `CHARACTER' type.
32319 - STRING_B Shall be of default `CHARACTER' type.
32320 -
32321 -_Return value_:
32322 - Returns `.TRUE.' if `STRING_A > STRING_B', and `.FALSE.'
32323 - otherwise, based on the ASCII ordering.
32324 -
32325 -_See also_:
32326 - *note LGE::, *note LLE::, *note LLT::
32327 -
32328 -\1f
32329 -File: gfortran.info, Node: LINK, Next: LLE, Prev: LGT, Up: Intrinsic Procedures
32330 -
32331 -7.132 `LINK' -- Create a hard link
32332 -==================================
32333 -
32334 -_Description_:
32335 - Makes a (hard) link from file PATH1 to PATH2. A null character
32336 - (`CHAR(0)') can be used to mark the end of the names in PATH1 and
32337 - PATH2; otherwise, trailing blanks in the file names are ignored.
32338 - If the STATUS argument is supplied, it contains 0 on success or a
32339 - nonzero error code upon return; see `link(2)'.
32340 -
32341 - This intrinsic is provided in both subroutine and function forms;
32342 - however, only one form can be used in any given program unit.
32343 -
32344 -_Standard_:
32345 - GNU extension
32346 -
32347 -_Class_:
32348 - Subroutine, function
32349 -
32350 -_Syntax_:
32351 - `CALL LINK(PATH1, PATH2 [, STATUS])'
32352 - `STATUS = LINK(PATH1, PATH2)'
32353 -
32354 -_Arguments_:
32355 - PATH1 Shall be of default `CHARACTER' type.
32356 - PATH2 Shall be of default `CHARACTER' type.
32357 - STATUS (Optional) Shall be of default `INTEGER' type.
32358 -
32359 -_See also_:
32360 - *note SYMLNK::, *note UNLINK::
32361 -
32362 -\1f
32363 -File: gfortran.info, Node: LLE, Next: LLT, Prev: LINK, Up: Intrinsic Procedures
32364 -
32365 -7.133 `LLE' -- Lexical less than or equal
32366 -=========================================
32367 -
32368 -_Description_:
32369 - Determines whether one string is lexically less than or equal to
32370 - another string, where the two strings are interpreted as
32371 - containing ASCII character codes. If the String A and String B
32372 - are not the same length, the shorter is compared as if spaces were
32373 - appended to it to form a value that has the same length as the
32374 - longer.
32375 -
32376 - In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
32377 - and `LLT' differ from the corresponding intrinsic operators
32378 - `.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
32379 - processor's character ordering (which is not ASCII on some
32380 - targets), whereas the former always use the ASCII ordering.
32381 -
32382 -_Standard_:
32383 - Fortran 77 and later
32384 -
32385 -_Class_:
32386 - Elemental function
32387 -
32388 -_Syntax_:
32389 - `RESULT = LLE(STRING_A, STRING_B)'
32390 -
32391 -_Arguments_:
32392 - STRING_A Shall be of default `CHARACTER' type.
32393 - STRING_B Shall be of default `CHARACTER' type.
32394 -
32395 -_Return value_:
32396 - Returns `.TRUE.' if `STRING_A <= STRING_B', and `.FALSE.'
32397 - otherwise, based on the ASCII ordering.
32398 -
32399 -_See also_:
32400 - *note LGE::, *note LGT::, *note LLT::
32401 -
32402 -\1f
32403 -File: gfortran.info, Node: LLT, Next: LNBLNK, Prev: LLE, Up: Intrinsic Procedures
32404 -
32405 -7.134 `LLT' -- Lexical less than
32406 -================================
32407 -
32408 -_Description_:
32409 - Determines whether one string is lexically less than another
32410 - string, where the two strings are interpreted as containing ASCII
32411 - character codes. If the String A and String B are not the same
32412 - length, the shorter is compared as if spaces were appended to it
32413 - to form a value that has the same length as the longer.
32414 -
32415 - In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
32416 - and `LLT' differ from the corresponding intrinsic operators
32417 - `.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
32418 - processor's character ordering (which is not ASCII on some
32419 - targets), whereas the former always use the ASCII ordering.
32420 -
32421 -_Standard_:
32422 - Fortran 77 and later
32423 -
32424 -_Class_:
32425 - Elemental function
32426 -
32427 -_Syntax_:
32428 - `RESULT = LLT(STRING_A, STRING_B)'
32429 -
32430 -_Arguments_:
32431 - STRING_A Shall be of default `CHARACTER' type.
32432 - STRING_B Shall be of default `CHARACTER' type.
32433 -
32434 -_Return value_:
32435 - Returns `.TRUE.' if `STRING_A < STRING_B', and `.FALSE.'
32436 - otherwise, based on the ASCII ordering.
32437 -
32438 -_See also_:
32439 - *note LGE::, *note LGT::, *note LLE::
32440 -
32441 -\1f
32442 -File: gfortran.info, Node: LNBLNK, Next: LOC, Prev: LLT, Up: Intrinsic Procedures
32443 -
32444 -7.135 `LNBLNK' -- Index of the last non-blank character in a string
32445 -===================================================================
32446 -
32447 -_Description_:
32448 - Returns the length of a character string, ignoring any trailing
32449 - blanks. This is identical to the standard `LEN_TRIM' intrinsic,
32450 - and is only included for backwards compatibility.
32451 -
32452 -_Standard_:
32453 - GNU extension
32454 -
32455 -_Class_:
32456 - Elemental function
32457 -
32458 -_Syntax_:
32459 - `RESULT = LNBLNK(STRING)'
32460 -
32461 -_Arguments_:
32462 - STRING Shall be a scalar of type `CHARACTER', with
32463 - `INTENT(IN)'
32464 -
32465 -_Return value_:
32466 - The return value is of `INTEGER(kind=4)' type.
32467 -
32468 -_See also_:
32469 - *note INDEX intrinsic::, *note LEN_TRIM::
32470 -
32471 -\1f
32472 -File: gfortran.info, Node: LOC, Next: LOG, Prev: LNBLNK, Up: Intrinsic Procedures
32473 -
32474 -7.136 `LOC' -- Returns the address of a variable
32475 -================================================
32476 -
32477 -_Description_:
32478 - `LOC(X)' returns the address of X as an integer.
32479 -
32480 -_Standard_:
32481 - GNU extension
32482 -
32483 -_Class_:
32484 - Inquiry function
32485 -
32486 -_Syntax_:
32487 - `RESULT = LOC(X)'
32488 -
32489 -_Arguments_:
32490 - X Variable of any type.
32491 -
32492 -_Return value_:
32493 - The return value is of type `INTEGER', with a `KIND' corresponding
32494 - to the size (in bytes) of a memory address on the target machine.
32495 -
32496 -_Example_:
32497 - program test_loc
32498 - integer :: i
32499 - real :: r
32500 - i = loc(r)
32501 - print *, i
32502 - end program test_loc
32503 -
32504 -\1f
32505 -File: gfortran.info, Node: LOG, Next: LOG10, Prev: LOC, Up: Intrinsic Procedures
32506 -
32507 -7.137 `LOG' -- Logarithm function
32508 -=================================
32509 -
32510 -_Description_:
32511 - `LOG(X)' computes the logarithm of X.
32512 -
32513 -_Standard_:
32514 - Fortran 77 and later
32515 -
32516 -_Class_:
32517 - Elemental function
32518 -
32519 -_Syntax_:
32520 - `RESULT = LOG(X)'
32521 -
32522 -_Arguments_:
32523 - X The type shall be `REAL' or `COMPLEX'.
32524 -
32525 -_Return value_:
32526 - The return value is of type `REAL' or `COMPLEX'. The kind type
32527 - parameter is the same as X. If X is `COMPLEX', the imaginary part
32528 - \omega is in the range -\pi \leq \omega \leq \pi.
32529 -
32530 -_Example_:
32531 - program test_log
32532 - real(8) :: x = 1.0_8
32533 - complex :: z = (1.0, 2.0)
32534 - x = log(x)
32535 - z = log(z)
32536 - end program test_log
32537 -
32538 -_Specific names_:
32539 - Name Argument Return type Standard
32540 - `ALOG(X)' `REAL(4) X' `REAL(4)' f95, gnu
32541 - `DLOG(X)' `REAL(8) X' `REAL(8)' f95, gnu
32542 - `CLOG(X)' `COMPLEX(4) `COMPLEX(4)' f95, gnu
32543 - X'
32544 - `ZLOG(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
32545 - X'
32546 - `CDLOG(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
32547 - X'
32548 -
32549 -\1f
32550 -File: gfortran.info, Node: LOG10, Next: LOGICAL, Prev: LOG, Up: Intrinsic Procedures
32551 -
32552 -7.138 `LOG10' -- Base 10 logarithm function
32553 -===========================================
32554 -
32555 -_Description_:
32556 - `LOG10(X)' computes the base 10 logarithm of X.
32557 -
32558 -_Standard_:
32559 - Fortran 77 and later
32560 -
32561 -_Class_:
32562 - Elemental function
32563 -
32564 -_Syntax_:
32565 - `RESULT = LOG10(X)'
32566 -
32567 -_Arguments_:
32568 - X The type shall be `REAL'.
32569 -
32570 -_Return value_:
32571 - The return value is of type `REAL' or `COMPLEX'. The kind type
32572 - parameter is the same as X.
32573 -
32574 -_Example_:
32575 - program test_log10
32576 - real(8) :: x = 10.0_8
32577 - x = log10(x)
32578 - end program test_log10
32579 -
32580 -_Specific names_:
32581 - Name Argument Return type Standard
32582 - `ALOG10(X)' `REAL(4) X' `REAL(4)' Fortran 95 and
32583 - later
32584 - `DLOG10(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
32585 - later
32586 -
32587 -\1f
32588 -File: gfortran.info, Node: LOG_GAMMA, Next: LGE, Prev: LEN_TRIM, Up: Intrinsic Procedures
32589 -
32590 -7.139 `LOG_GAMMA' -- Logarithm of the Gamma function
32591 -====================================================
32592 -
32593 -_Description_:
32594 - `LOG_GAMMA(X)' computes the natural logarithm of the absolute value
32595 - of the Gamma (\Gamma) function.
32596 -
32597 -_Standard_:
32598 - Fortran 2008 and later
32599 -
32600 -_Class_:
32601 - Elemental function
32602 -
32603 -_Syntax_:
32604 - `X = LOG_GAMMA(X)'
32605 -
32606 -_Arguments_:
32607 - X Shall be of type `REAL' and neither zero nor a
32608 - negative integer.
32609 -
32610 -_Return value_:
32611 - The return value is of type `REAL' of the same kind as X.
32612 -
32613 -_Example_:
32614 - program test_log_gamma
32615 - real :: x = 1.0
32616 - x = lgamma(x) ! returns 0.0
32617 - end program test_log_gamma
32618 -
32619 -_Specific names_:
32620 - Name Argument Return type Standard
32621 - `LGAMMA(X)' `REAL(4) X' `REAL(4)' GNU Extension
32622 - `ALGAMA(X)' `REAL(4) X' `REAL(4)' GNU Extension
32623 - `DLGAMA(X)' `REAL(8) X' `REAL(8)' GNU Extension
32624 -
32625 -_See also_:
32626 - Gamma function: *note GAMMA::
32627 -
32628 -
32629 -\1f
32630 -File: gfortran.info, Node: LOGICAL, Next: LONG, Prev: LOG10, Up: Intrinsic Procedures
32631 -
32632 -7.140 `LOGICAL' -- Convert to logical type
32633 -==========================================
32634 -
32635 -_Description_:
32636 - Converts one kind of `LOGICAL' variable to another.
32637 -
32638 -_Standard_:
32639 - Fortran 95 and later
32640 -
32641 -_Class_:
32642 - Elemental function
32643 -
32644 -_Syntax_:
32645 - `RESULT = LOGICAL(L [, KIND])'
32646 -
32647 -_Arguments_:
32648 - L The type shall be `LOGICAL'.
32649 - KIND (Optional) An `INTEGER' initialization
32650 - expression indicating the kind parameter of
32651 - the result.
32652 -
32653 -_Return value_:
32654 - The return value is a `LOGICAL' value equal to L, with a kind
32655 - corresponding to KIND, or of the default logical kind if KIND is
32656 - not given.
32657 -
32658 -_See also_:
32659 - *note INT::, *note REAL::, *note CMPLX::
32660 -
32661 -\1f
32662 -File: gfortran.info, Node: LONG, Next: LSHIFT, Prev: LOGICAL, Up: Intrinsic Procedures
32663 -
32664 -7.141 `LONG' -- Convert to integer type
32665 -=======================================
32666 -
32667 -_Description_:
32668 - Convert to a `KIND=4' integer type, which is the same size as a C
32669 - `long' integer. This is equivalent to the standard `INT'
32670 - intrinsic with an optional argument of `KIND=4', and is only
32671 - included for backwards compatibility.
32672 -
32673 -_Standard_:
32674 - GNU extension
32675 -
32676 -_Class_:
32677 - Elemental function
32678 -
32679 -_Syntax_:
32680 - `RESULT = LONG(A)'
32681 -
32682 -_Arguments_:
32683 - A Shall be of type `INTEGER', `REAL', or
32684 - `COMPLEX'.
32685 -
32686 -_Return value_:
32687 - The return value is a `INTEGER(4)' variable.
32688 -
32689 -_See also_:
32690 - *note INT::, *note INT2::, *note INT8::
32691 -
32692 -\1f
32693 -File: gfortran.info, Node: LSHIFT, Next: LSTAT, Prev: LONG, Up: Intrinsic Procedures
32694 -
32695 -7.142 `LSHIFT' -- Left shift bits
32696 -=================================
32697 -
32698 -_Description_:
32699 - `LSHIFT' returns a value corresponding to I with all of the bits
32700 - shifted left by SHIFT places. If the absolute value of SHIFT is
32701 - greater than `BIT_SIZE(I)', the value is undefined. Bits shifted
32702 - out from the left end are lost; zeros are shifted in from the
32703 - opposite end.
32704 -
32705 - This function has been superseded by the `ISHFT' intrinsic, which
32706 - is standard in Fortran 95 and later.
32707 -
32708 -_Standard_:
32709 - GNU extension
32710 -
32711 -_Class_:
32712 - Elemental function
32713 -
32714 -_Syntax_:
32715 - `RESULT = LSHIFT(I, SHIFT)'
32716 -
32717 -_Arguments_:
32718 - I The type shall be `INTEGER'.
32719 - SHIFT The type shall be `INTEGER'.
32720 -
32721 -_Return value_:
32722 - The return value is of type `INTEGER' and of the same kind as I.
32723 -
32724 -_See also_:
32725 - *note ISHFT::, *note ISHFTC::, *note RSHIFT::
32726 -
32727 -
32728 -\1f
32729 -File: gfortran.info, Node: LSTAT, Next: LTIME, Prev: LSHIFT, Up: Intrinsic Procedures
32730 -
32731 -7.143 `LSTAT' -- Get file status
32732 -================================
32733 -
32734 -_Description_:
32735 - `LSTAT' is identical to *note STAT::, except that if path is a
32736 - symbolic link, then the link itself is statted, not the file that
32737 - it refers to.
32738 -
32739 - The elements in `BUFF' are the same as described by *note STAT::.
32740 -
32741 - This intrinsic is provided in both subroutine and function forms;
32742 - however, only one form can be used in any given program unit.
32743 -
32744 -_Standard_:
32745 - GNU extension
32746 -
32747 -_Class_:
32748 - Subroutine, function
32749 -
32750 -_Syntax_:
32751 - `CALL LSTAT(FILE, BUFF [, STATUS])'
32752 -
32753 -_Arguments_:
32754 - FILE The type shall be `CHARACTER' of the default
32755 - kind, a valid path within the file system.
32756 - BUFF The type shall be `INTEGER(4), DIMENSION(13)'.
32757 - STATUS (Optional) status flag of type `INTEGER(4)'.
32758 - Returns 0 on success and a system specific
32759 - error code otherwise.
32760 -
32761 -_Example_:
32762 - See *note STAT:: for an example.
32763 -
32764 -_See also_:
32765 - To stat an open file: *note FSTAT::, to stat a file: *note STAT::
32766 -
32767 -\1f
32768 -File: gfortran.info, Node: LTIME, Next: MALLOC, Prev: LSTAT, Up: Intrinsic Procedures
32769 -
32770 -7.144 `LTIME' -- Convert time to local time info
32771 -================================================
32772 -
32773 -_Description_:
32774 - Given a system time value STIME (as provided by the `TIME8()'
32775 - intrinsic), fills TARRAY with values extracted from it appropriate
32776 - to the local time zone using `localtime(3)'.
32777 -
32778 -_Standard_:
32779 - GNU extension
32780 -
32781 -_Class_:
32782 - Subroutine
32783 -
32784 -_Syntax_:
32785 - `CALL LTIME(STIME, TARRAY)'
32786 -
32787 -_Arguments_:
32788 - STIME An `INTEGER' scalar expression corresponding
32789 - to a system time, with `INTENT(IN)'.
32790 - TARRAY A default `INTEGER' array with 9 elements,
32791 - with `INTENT(OUT)'.
32792 -
32793 -_Return value_:
32794 - The elements of TARRAY are assigned as follows:
32795 - 1. Seconds after the minute, range 0-59 or 0-61 to allow for leap
32796 - seconds
32797 -
32798 - 2. Minutes after the hour, range 0-59
32799 -
32800 - 3. Hours past midnight, range 0-23
32801 -
32802 - 4. Day of month, range 0-31
32803 -
32804 - 5. Number of months since January, range 0-12
32805 -
32806 - 6. Years since 1900
32807 -
32808 - 7. Number of days since Sunday, range 0-6
32809 -
32810 - 8. Days since January 1
32811 -
32812 - 9. Daylight savings indicator: positive if daylight savings is in
32813 - effect, zero if not, and negative if the information is not
32814 - available.
32815 -
32816 -_See also_:
32817 - *note CTIME::, *note GMTIME::, *note TIME::, *note TIME8::
32818 -
32819 -
32820 -\1f
32821 -File: gfortran.info, Node: MALLOC, Next: MATMUL, Prev: LTIME, Up: Intrinsic Procedures
32822 -
32823 -7.145 `MALLOC' -- Allocate dynamic memory
32824 -=========================================
32825 -
32826 -_Description_:
32827 - `MALLOC(SIZE)' allocates SIZE bytes of dynamic memory and returns
32828 - the address of the allocated memory. The `MALLOC' intrinsic is an
32829 - extension intended to be used with Cray pointers, and is provided
32830 - in GNU Fortran to allow the user to compile legacy code. For new
32831 - code using Fortran 95 pointers, the memory allocation intrinsic is
32832 - `ALLOCATE'.
32833 -
32834 -_Standard_:
32835 - GNU extension
32836 -
32837 -_Class_:
32838 - Function
32839 -
32840 -_Syntax_:
32841 - `PTR = MALLOC(SIZE)'
32842 -
32843 -_Arguments_:
32844 - SIZE The type shall be `INTEGER'.
32845 -
32846 -_Return value_:
32847 - The return value is of type `INTEGER(K)', with K such that
32848 - variables of type `INTEGER(K)' have the same size as C pointers
32849 - (`sizeof(void *)').
32850 -
32851 -_Example_:
32852 - The following example demonstrates the use of `MALLOC' and `FREE'
32853 - with Cray pointers.
32854 -
32855 - program test_malloc
32856 - implicit none
32857 - integer i
32858 - real*8 x(*), z
32859 - pointer(ptr_x,x)
32860 -
32861 - ptr_x = malloc(20*8)
32862 - do i = 1, 20
32863 - x(i) = sqrt(1.0d0 / i)
32864 - end do
32865 - z = 0
32866 - do i = 1, 20
32867 - z = z + x(i)
32868 - print *, z
32869 - end do
32870 - call free(ptr_x)
32871 - end program test_malloc
32872 -
32873 -_See also_:
32874 - *note FREE::
32875 -
32876 -\1f
32877 -File: gfortran.info, Node: MATMUL, Next: MAX, Prev: MALLOC, Up: Intrinsic Procedures
32878 -
32879 -7.146 `MATMUL' -- matrix multiplication
32880 -=======================================
32881 -
32882 -_Description_:
32883 - Performs a matrix multiplication on numeric or logical arguments.
32884 -
32885 -_Standard_:
32886 - Fortran 95 and later
32887 -
32888 -_Class_:
32889 - Transformational function
32890 -
32891 -_Syntax_:
32892 - `RESULT = MATMUL(MATRIX_A, MATRIX_B)'
32893 -
32894 -_Arguments_:
32895 - MATRIX_A An array of `INTEGER', `REAL', `COMPLEX', or
32896 - `LOGICAL' type, with a rank of one or two.
32897 - MATRIX_B An array of `INTEGER', `REAL', or `COMPLEX'
32898 - type if MATRIX_A is of a numeric type;
32899 - otherwise, an array of `LOGICAL' type. The
32900 - rank shall be one or two, and the first (or
32901 - only) dimension of MATRIX_B shall be equal to
32902 - the last (or only) dimension of MATRIX_A.
32903 -
32904 -_Return value_:
32905 - The matrix product of MATRIX_A and MATRIX_B. The type and kind of
32906 - the result follow the usual type and kind promotion rules, as for
32907 - the `*' or `.AND.' operators.
32908 -
32909 -_See also_:
32910 -
32911 -\1f
32912 -File: gfortran.info, Node: MAX, Next: MAXEXPONENT, Prev: MATMUL, Up: Intrinsic Procedures
32913 -
32914 -7.147 `MAX' -- Maximum value of an argument list
32915 -================================================
32916 -
32917 -_Description_:
32918 - Returns the argument with the largest (most positive) value.
32919 -
32920 -_Standard_:
32921 - Fortran 77 and later
32922 -
32923 -_Class_:
32924 - Elemental function
32925 -
32926 -_Syntax_:
32927 - `RESULT = MAX(A1, A2 [, A3 [, ...]])'
32928 -
32929 -_Arguments_:
32930 - A1 The type shall be `INTEGER' or `REAL'.
32931 - A2, A3, An expression of the same type and kind as A1.
32932 - ... (As a GNU extension, arguments of different
32933 - kinds are permitted.)
32934 -
32935 -_Return value_:
32936 - The return value corresponds to the maximum value among the
32937 - arguments, and has the same type and kind as the first argument.
32938 -
32939 -_Specific names_:
32940 - Name Argument Return type Standard
32941 - `MAX0(I)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
32942 - I' later
32943 - `AMAX0(I)' `INTEGER(4) `REAL(MAX(X))'Fortran 77 and
32944 - I' later
32945 - `MAX1(X)' `REAL X' `INT(MAX(X))' Fortran 77 and
32946 - later
32947 - `AMAX1(X)' `REAL(4) `REAL(4)' Fortran 77 and
32948 - X' later
32949 - `DMAX1(X)' `REAL(8) `REAL(8)' Fortran 77 and
32950 - X' later
32951 -
32952 -_See also_:
32953 - *note MAXLOC:: *note MAXVAL::, *note MIN::
32954 -
32955 -
32956 -\1f
32957 -File: gfortran.info, Node: MAXEXPONENT, Next: MAXLOC, Prev: MAX, Up: Intrinsic Procedures
32958 -
32959 -7.148 `MAXEXPONENT' -- Maximum exponent of a real kind
32960 -======================================================
32961 -
32962 -_Description_:
32963 - `MAXEXPONENT(X)' returns the maximum exponent in the model of the
32964 - type of `X'.
32965 -
32966 -_Standard_:
32967 - Fortran 95 and later
32968 -
32969 -_Class_:
32970 - Inquiry function
32971 -
32972 -_Syntax_:
32973 - `RESULT = MAXEXPONENT(X)'
32974 -
32975 -_Arguments_:
32976 - X Shall be of type `REAL'.
32977 -
32978 -_Return value_:
32979 - The return value is of type `INTEGER' and of the default integer
32980 - kind.
32981 -
32982 -_Example_:
32983 - program exponents
32984 - real(kind=4) :: x
32985 - real(kind=8) :: y
32986 -
32987 - print *, minexponent(x), maxexponent(x)
32988 - print *, minexponent(y), maxexponent(y)
32989 - end program exponents
32990 -
32991 -\1f
32992 -File: gfortran.info, Node: MAXLOC, Next: MAXVAL, Prev: MAXEXPONENT, Up: Intrinsic Procedures
32993 -
32994 -7.149 `MAXLOC' -- Location of the maximum value within an array
32995 -===============================================================
32996 -
32997 -_Description_:
32998 - Determines the location of the element in the array with the
32999 - maximum value, or, if the DIM argument is supplied, determines the
33000 - locations of the maximum element along each row of the array in the
33001 - DIM direction. If MASK is present, only the elements for which
33002 - MASK is `.TRUE.' are considered. If more than one element in the
33003 - array has the maximum value, the location returned is that of the
33004 - first such element in array element order. If the array has zero
33005 - size, or all of the elements of MASK are `.FALSE.', then the
33006 - result is an array of zeroes. Similarly, if DIM is supplied and
33007 - all of the elements of MASK along a given row are zero, the result
33008 - value for that row is zero.
33009 -
33010 -_Standard_:
33011 - Fortran 95 and later
33012 -
33013 -_Class_:
33014 - Transformational function
33015 -
33016 -_Syntax_:
33017 - `RESULT = MAXLOC(ARRAY, DIM [, MASK])'
33018 - `RESULT = MAXLOC(ARRAY [, MASK])'
33019 -
33020 -_Arguments_:
33021 - ARRAY Shall be an array of type `INTEGER', `REAL',
33022 - or `CHARACTER'.
33023 - DIM (Optional) Shall be a scalar of type
33024 - `INTEGER', with a value between one and the
33025 - rank of ARRAY, inclusive. It may not be an
33026 - optional dummy argument.
33027 - MASK Shall be an array of type `LOGICAL', and
33028 - conformable with ARRAY.
33029 -
33030 -_Return value_:
33031 - If DIM is absent, the result is a rank-one array with a length
33032 - equal to the rank of ARRAY. If DIM is present, the result is an
33033 - array with a rank one less than the rank of ARRAY, and a size
33034 - corresponding to the size of ARRAY with the DIM dimension removed.
33035 - If DIM is present and ARRAY has a rank of one, the result is a
33036 - scalar. In all cases, the result is of default `INTEGER' type.
33037 -
33038 -_See also_:
33039 - *note MAX::, *note MAXVAL::
33040 -
33041 -
33042 -\1f
33043 -File: gfortran.info, Node: MAXVAL, Next: MCLOCK, Prev: MAXLOC, Up: Intrinsic Procedures
33044 -
33045 -7.150 `MAXVAL' -- Maximum value of an array
33046 -===========================================
33047 -
33048 -_Description_:
33049 - Determines the maximum value of the elements in an array value,
33050 - or, if the DIM argument is supplied, determines the maximum value
33051 - along each row of the array in the DIM direction. If MASK is
33052 - present, only the elements for which MASK is `.TRUE.' are
33053 - considered. If the array has zero size, or all of the elements of
33054 - MASK are `.FALSE.', then the result is `-HUGE(ARRAY)' if ARRAY is
33055 - numeric, or a string of nulls if ARRAY is of character type.
33056 -
33057 -_Standard_:
33058 - Fortran 95 and later
33059 -
33060 -_Class_:
33061 - Transformational function
33062 -
33063 -_Syntax_:
33064 - `RESULT = MAXVAL(ARRAY, DIM [, MASK])'
33065 - `RESULT = MAXVAL(ARRAY [, MASK])'
33066 -
33067 -_Arguments_:
33068 - ARRAY Shall be an array of type `INTEGER', `REAL',
33069 - or `CHARACTER'.
33070 - DIM (Optional) Shall be a scalar of type
33071 - `INTEGER', with a value between one and the
33072 - rank of ARRAY, inclusive. It may not be an
33073 - optional dummy argument.
33074 - MASK Shall be an array of type `LOGICAL', and
33075 - conformable with ARRAY.
33076 -
33077 -_Return value_:
33078 - If DIM is absent, or if ARRAY has a rank of one, the result is a
33079 - scalar. If DIM is present, the result is an array with a rank one
33080 - less than the rank of ARRAY, and a size corresponding to the size
33081 - of ARRAY with the DIM dimension removed. In all cases, the result
33082 - is of the same type and kind as ARRAY.
33083 -
33084 -_See also_:
33085 - *note MAX::, *note MAXLOC::
33086 -
33087 -\1f
33088 -File: gfortran.info, Node: MCLOCK, Next: MCLOCK8, Prev: MAXVAL, Up: Intrinsic Procedures
33089 -
33090 -7.151 `MCLOCK' -- Time function
33091 -===============================
33092 -
33093 -_Description_:
33094 - Returns the number of clock ticks since the start of the process,
33095 - based on the UNIX function `clock(3)'.
33096 -
33097 - This intrinsic is not fully portable, such as to systems with
33098 - 32-bit `INTEGER' types but supporting times wider than 32 bits.
33099 - Therefore, the values returned by this intrinsic might be, or
33100 - become, negative, or numerically less than previous values, during
33101 - a single run of the compiled program.
33102 -
33103 -_Standard_:
33104 - GNU extension
33105 -
33106 -_Class_:
33107 - Function
33108 -
33109 -_Syntax_:
33110 - `RESULT = MCLOCK()'
33111 -
33112 -_Return value_:
33113 - The return value is a scalar of type `INTEGER(4)', equal to the
33114 - number of clock ticks since the start of the process, or `-1' if
33115 - the system does not support `clock(3)'.
33116 -
33117 -_See also_:
33118 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
33119 - *note TIME::
33120 -
33121 -
33122 -\1f
33123 -File: gfortran.info, Node: MCLOCK8, Next: MERGE, Prev: MCLOCK, Up: Intrinsic Procedures
33124 -
33125 -7.152 `MCLOCK8' -- Time function (64-bit)
33126 -=========================================
33127 -
33128 -_Description_:
33129 - Returns the number of clock ticks since the start of the process,
33130 - based on the UNIX function `clock(3)'.
33131 -
33132 - _Warning:_ this intrinsic does not increase the range of the timing
33133 - values over that returned by `clock(3)'. On a system with a 32-bit
33134 - `clock(3)', `MCLOCK8()' will return a 32-bit value, even though it
33135 - is converted to a 64-bit `INTEGER(8)' value. That means overflows
33136 - of the 32-bit value can still occur. Therefore, the values
33137 - returned by this intrinsic might be or become negative or
33138 - numerically less than previous values during a single run of the
33139 - compiled program.
33140 -
33141 -_Standard_:
33142 - GNU extension
33143 -
33144 -_Class_:
33145 - Function
33146 -
33147 -_Syntax_:
33148 - `RESULT = MCLOCK8()'
33149 -
33150 -_Return value_:
33151 - The return value is a scalar of type `INTEGER(8)', equal to the
33152 - number of clock ticks since the start of the process, or `-1' if
33153 - the system does not support `clock(3)'.
33154 -
33155 -_See also_:
33156 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
33157 - *note TIME8::
33158 -
33159 -
33160 -\1f
33161 -File: gfortran.info, Node: MERGE, Next: MIN, Prev: MCLOCK8, Up: Intrinsic Procedures
33162 -
33163 -7.153 `MERGE' -- Merge variables
33164 -================================
33165 -
33166 -_Description_:
33167 - Select values from two arrays according to a logical mask. The
33168 - result is equal to TSOURCE if MASK is `.TRUE.', or equal to
33169 - FSOURCE if it is `.FALSE.'.
33170 -
33171 -_Standard_:
33172 - Fortran 95 and later
33173 -
33174 -_Class_:
33175 - Elemental function
33176 -
33177 -_Syntax_:
33178 - `RESULT = MERGE(TSOURCE, FSOURCE, MASK)'
33179 -
33180 -_Arguments_:
33181 - TSOURCE May be of any type.
33182 - FSOURCE Shall be of the same type and type parameters
33183 - as TSOURCE.
33184 - MASK Shall be of type `LOGICAL'.
33185 -
33186 -_Return value_:
33187 - The result is of the same type and type parameters as TSOURCE.
33188 -
33189 -
33190 -\1f
33191 -File: gfortran.info, Node: MIN, Next: MINEXPONENT, Prev: MERGE, Up: Intrinsic Procedures
33192 -
33193 -7.154 `MIN' -- Minimum value of an argument list
33194 -================================================
33195 -
33196 -_Description_:
33197 - Returns the argument with the smallest (most negative) value.
33198 -
33199 -_Standard_:
33200 - Fortran 77 and later
33201 -
33202 -_Class_:
33203 - Elemental function
33204 -
33205 -_Syntax_:
33206 - `RESULT = MIN(A1, A2 [, A3, ...])'
33207 -
33208 -_Arguments_:
33209 - A1 The type shall be `INTEGER' or `REAL'.
33210 - A2, A3, An expression of the same type and kind as A1.
33211 - ... (As a GNU extension, arguments of different
33212 - kinds are permitted.)
33213 -
33214 -_Return value_:
33215 - The return value corresponds to the maximum value among the
33216 - arguments, and has the same type and kind as the first argument.
33217 -
33218 -_Specific names_:
33219 - Name Argument Return type Standard
33220 - `MIN0(I)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
33221 - I' later
33222 - `AMIN0(I)' `INTEGER(4) `REAL(MIN(X))'Fortran 77 and
33223 - I' later
33224 - `MIN1(X)' `REAL X' `INT(MIN(X))' Fortran 77 and
33225 - later
33226 - `AMIN1(X)' `REAL(4) `REAL(4)' Fortran 77 and
33227 - X' later
33228 - `DMIN1(X)' `REAL(8) `REAL(8)' Fortran 77 and
33229 - X' later
33230 -
33231 -_See also_:
33232 - *note MAX::, *note MINLOC::, *note MINVAL::
33233 -
33234 -\1f
33235 -File: gfortran.info, Node: MINEXPONENT, Next: MINLOC, Prev: MIN, Up: Intrinsic Procedures
33236 -
33237 -7.155 `MINEXPONENT' -- Minimum exponent of a real kind
33238 -======================================================
33239 -
33240 -_Description_:
33241 - `MINEXPONENT(X)' returns the minimum exponent in the model of the
33242 - type of `X'.
33243 -
33244 -_Standard_:
33245 - Fortran 95 and later
33246 -
33247 -_Class_:
33248 - Inquiry function
33249 -
33250 -_Syntax_:
33251 - `RESULT = MINEXPONENT(X)'
33252 -
33253 -_Arguments_:
33254 - X Shall be of type `REAL'.
33255 -
33256 -_Return value_:
33257 - The return value is of type `INTEGER' and of the default integer
33258 - kind.
33259 -
33260 -_Example_:
33261 - See `MAXEXPONENT' for an example.
33262 -
33263 -\1f
33264 -File: gfortran.info, Node: MINLOC, Next: MINVAL, Prev: MINEXPONENT, Up: Intrinsic Procedures
33265 -
33266 -7.156 `MINLOC' -- Location of the minimum value within an array
33267 -===============================================================
33268 -
33269 -_Description_:
33270 - Determines the location of the element in the array with the
33271 - minimum value, or, if the DIM argument is supplied, determines the
33272 - locations of the minimum element along each row of the array in the
33273 - DIM direction. If MASK is present, only the elements for which
33274 - MASK is `.TRUE.' are considered. If more than one element in the
33275 - array has the minimum value, the location returned is that of the
33276 - first such element in array element order. If the array has zero
33277 - size, or all of the elements of MASK are `.FALSE.', then the
33278 - result is an array of zeroes. Similarly, if DIM is supplied and
33279 - all of the elements of MASK along a given row are zero, the result
33280 - value for that row is zero.
33281 -
33282 -_Standard_:
33283 - Fortran 95 and later
33284 -
33285 -_Class_:
33286 - Transformational function
33287 -
33288 -_Syntax_:
33289 - `RESULT = MINLOC(ARRAY, DIM [, MASK])'
33290 - `RESULT = MINLOC(ARRAY [, MASK])'
33291 -
33292 -_Arguments_:
33293 - ARRAY Shall be an array of type `INTEGER', `REAL',
33294 - or `CHARACTER'.
33295 - DIM (Optional) Shall be a scalar of type
33296 - `INTEGER', with a value between one and the
33297 - rank of ARRAY, inclusive. It may not be an
33298 - optional dummy argument.
33299 - MASK Shall be an array of type `LOGICAL', and
33300 - conformable with ARRAY.
33301 -
33302 -_Return value_:
33303 - If DIM is absent, the result is a rank-one array with a length
33304 - equal to the rank of ARRAY. If DIM is present, the result is an
33305 - array with a rank one less than the rank of ARRAY, and a size
33306 - corresponding to the size of ARRAY with the DIM dimension removed.
33307 - If DIM is present and ARRAY has a rank of one, the result is a
33308 - scalar. In all cases, the result is of default `INTEGER' type.
33309 -
33310 -_See also_:
33311 - *note MIN::, *note MINVAL::
33312 -
33313 -
33314 -\1f
33315 -File: gfortran.info, Node: MINVAL, Next: MOD, Prev: MINLOC, Up: Intrinsic Procedures
33316 -
33317 -7.157 `MINVAL' -- Minimum value of an array
33318 -===========================================
33319 -
33320 -_Description_:
33321 - Determines the minimum value of the elements in an array value,
33322 - or, if the DIM argument is supplied, determines the minimum value
33323 - along each row of the array in the DIM direction. If MASK is
33324 - present, only the elements for which MASK is `.TRUE.' are
33325 - considered. If the array has zero size, or all of the elements of
33326 - MASK are `.FALSE.', then the result is `HUGE(ARRAY)' if ARRAY is
33327 - numeric, or a string of `CHAR(255)' characters if ARRAY is of
33328 - character type.
33329 -
33330 -_Standard_:
33331 - Fortran 95 and later
33332 -
33333 -_Class_:
33334 - Transformational function
33335 -
33336 -_Syntax_:
33337 - `RESULT = MINVAL(ARRAY, DIM [, MASK])'
33338 - `RESULT = MINVAL(ARRAY [, MASK])'
33339 -
33340 -_Arguments_:
33341 - ARRAY Shall be an array of type `INTEGER', `REAL',
33342 - or `CHARACTER'.
33343 - DIM (Optional) Shall be a scalar of type
33344 - `INTEGER', with a value between one and the
33345 - rank of ARRAY, inclusive. It may not be an
33346 - optional dummy argument.
33347 - MASK Shall be an array of type `LOGICAL', and
33348 - conformable with ARRAY.
33349 -
33350 -_Return value_:
33351 - If DIM is absent, or if ARRAY has a rank of one, the result is a
33352 - scalar. If DIM is present, the result is an array with a rank one
33353 - less than the rank of ARRAY, and a size corresponding to the size
33354 - of ARRAY with the DIM dimension removed. In all cases, the result
33355 - is of the same type and kind as ARRAY.
33356 -
33357 -_See also_:
33358 - *note MIN::, *note MINLOC::
33359 -
33360 -
33361 -\1f
33362 -File: gfortran.info, Node: MOD, Next: MODULO, Prev: MINVAL, Up: Intrinsic Procedures
33363 -
33364 -7.158 `MOD' -- Remainder function
33365 -=================================
33366 -
33367 -_Description_:
33368 - `MOD(A,P)' computes the remainder of the division of A by P. It is
33369 - calculated as `A - (INT(A/P) * P)'.
33370 -
33371 -_Standard_:
33372 - Fortran 77 and later
33373 -
33374 -_Class_:
33375 - Elemental function
33376 -
33377 -_Syntax_:
33378 - `RESULT = MOD(A, P)'
33379 -
33380 -_Arguments_:
33381 - A Shall be a scalar of type `INTEGER' or `REAL'
33382 - P Shall be a scalar of the same type as A and not
33383 - equal to zero
33384 -
33385 -_Return value_:
33386 - The kind of the return value is the result of cross-promoting the
33387 - kinds of the arguments.
33388 -
33389 -_Example_:
33390 - program test_mod
33391 - print *, mod(17,3)
33392 - print *, mod(17.5,5.5)
33393 - print *, mod(17.5d0,5.5)
33394 - print *, mod(17.5,5.5d0)
33395 -
33396 - print *, mod(-17,3)
33397 - print *, mod(-17.5,5.5)
33398 - print *, mod(-17.5d0,5.5)
33399 - print *, mod(-17.5,5.5d0)
33400 -
33401 - print *, mod(17,-3)
33402 - print *, mod(17.5,-5.5)
33403 - print *, mod(17.5d0,-5.5)
33404 - print *, mod(17.5,-5.5d0)
33405 - end program test_mod
33406 -
33407 -_Specific names_:
33408 - Name Arguments Return type Standard
33409 - `AMOD(A,P)' `REAL(4)' `REAL(4)' Fortran 95 and
33410 - later
33411 - `DMOD(A,P)' `REAL(8)' `REAL(8)' Fortran 95 and
33412 - later
33413 -
33414 -\1f
33415 -File: gfortran.info, Node: MODULO, Next: MOVE_ALLOC, Prev: MOD, Up: Intrinsic Procedures
33416 -
33417 -7.159 `MODULO' -- Modulo function
33418 -=================================
33419 -
33420 -_Description_:
33421 - `MODULO(A,P)' computes the A modulo P.
33422 -
33423 -_Standard_:
33424 - Fortran 95 and later
33425 -
33426 -_Class_:
33427 - Elemental function
33428 -
33429 -_Syntax_:
33430 - `RESULT = MODULO(A, P)'
33431 -
33432 -_Arguments_:
33433 - A Shall be a scalar of type `INTEGER' or `REAL'
33434 - P Shall be a scalar of the same type and kind as
33435 - A
33436 -
33437 -_Return value_:
33438 - The type and kind of the result are those of the arguments.
33439 - If A and P are of type `INTEGER':
33440 - `MODULO(A,P)' has the value R such that `A=Q*P+R', where Q is
33441 - an integer and R is between 0 (inclusive) and P (exclusive).
33442 -
33443 - If A and P are of type `REAL':
33444 - `MODULO(A,P)' has the value of `A - FLOOR (A / P) * P'.
33445 - In all cases, if P is zero the result is processor-dependent.
33446 -
33447 -_Example_:
33448 - program test_modulo
33449 - print *, modulo(17,3)
33450 - print *, modulo(17.5,5.5)
33451 -
33452 - print *, modulo(-17,3)
33453 - print *, modulo(-17.5,5.5)
33454 -
33455 - print *, modulo(17,-3)
33456 - print *, modulo(17.5,-5.5)
33457 - end program
33458 -
33459 -
33460 -\1f
33461 -File: gfortran.info, Node: MOVE_ALLOC, Next: MVBITS, Prev: MODULO, Up: Intrinsic Procedures
33462 -
33463 -7.160 `MOVE_ALLOC' -- Move allocation from one object to another
33464 -================================================================
33465 -
33466 -_Description_:
33467 - `MOVE_ALLOC(SRC, DEST)' moves the allocation from SRC to DEST.
33468 - SRC will become deallocated in the process.
33469 -
33470 -_Standard_:
33471 - Fortran 2003 and later
33472 -
33473 -_Class_:
33474 - Subroutine
33475 -
33476 -_Syntax_:
33477 - `CALL MOVE_ALLOC(SRC, DEST)'
33478 -
33479 -_Arguments_:
33480 - SRC `ALLOCATABLE', `INTENT(INOUT)', may be of any
33481 - type and kind.
33482 - DEST `ALLOCATABLE', `INTENT(OUT)', shall be of the
33483 - same type, kind and rank as SRC.
33484 -
33485 -_Return value_:
33486 - None
33487 -
33488 -_Example_:
33489 - program test_move_alloc
33490 - integer, allocatable :: a(:), b(:)
33491 -
33492 - allocate(a(3))
33493 - a = [ 1, 2, 3 ]
33494 - call move_alloc(a, b)
33495 - print *, allocated(a), allocated(b)
33496 - print *, b
33497 - end program test_move_alloc
33498 -
33499 -\1f
33500 -File: gfortran.info, Node: MVBITS, Next: NEAREST, Prev: MOVE_ALLOC, Up: Intrinsic Procedures
33501 -
33502 -7.161 `MVBITS' -- Move bits from one integer to another
33503 -=======================================================
33504 -
33505 -_Description_:
33506 - Moves LEN bits from positions FROMPOS through `FROMPOS+LEN-1' of
33507 - FROM to positions TOPOS through `TOPOS+LEN-1' of TO. The portion
33508 - of argument TO not affected by the movement of bits is unchanged.
33509 - The values of `FROMPOS+LEN-1' and `TOPOS+LEN-1' must be less than
33510 - `BIT_SIZE(FROM)'.
33511 -
33512 -_Standard_:
33513 - Fortran 95 and later
33514 -
33515 -_Class_:
33516 - Elemental subroutine
33517 -
33518 -_Syntax_:
33519 - `CALL MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)'
33520 -
33521 -_Arguments_:
33522 - FROM The type shall be `INTEGER'.
33523 - FROMPOS The type shall be `INTEGER'.
33524 - LEN The type shall be `INTEGER'.
33525 - TO The type shall be `INTEGER', of the same kind
33526 - as FROM.
33527 - TOPOS The type shall be `INTEGER'.
33528 -
33529 -_See also_:
33530 - *note IBCLR::, *note IBSET::, *note IBITS::, *note IAND::, *note
33531 - IOR::, *note IEOR::
33532 -
33533 -\1f
33534 -File: gfortran.info, Node: NEAREST, Next: NEW_LINE, Prev: MVBITS, Up: Intrinsic Procedures
33535 -
33536 -7.162 `NEAREST' -- Nearest representable number
33537 -===============================================
33538 -
33539 -_Description_:
33540 - `NEAREST(X, S)' returns the processor-representable number nearest
33541 - to `X' in the direction indicated by the sign of `S'.
33542 -
33543 -_Standard_:
33544 - Fortran 95 and later
33545 -
33546 -_Class_:
33547 - Elemental function
33548 -
33549 -_Syntax_:
33550 - `RESULT = NEAREST(X, S)'
33551 -
33552 -_Arguments_:
33553 - X Shall be of type `REAL'.
33554 - S (Optional) shall be of type `REAL' and not
33555 - equal to zero.
33556 -
33557 -_Return value_:
33558 - The return value is of the same type as `X'. If `S' is positive,
33559 - `NEAREST' returns the processor-representable number greater than
33560 - `X' and nearest to it. If `S' is negative, `NEAREST' returns the
33561 - processor-representable number smaller than `X' and nearest to it.
33562 -
33563 -_Example_:
33564 - program test_nearest
33565 - real :: x, y
33566 - x = nearest(42.0, 1.0)
33567 - y = nearest(42.0, -1.0)
33568 - write (*,"(3(G20.15))") x, y, x - y
33569 - end program test_nearest
33570 -
33571 -\1f
33572 -File: gfortran.info, Node: NEW_LINE, Next: NINT, Prev: NEAREST, Up: Intrinsic Procedures
33573 -
33574 -7.163 `NEW_LINE' -- New line character
33575 -======================================
33576 -
33577 -_Description_:
33578 - `NEW_LINE(C)' returns the new-line character.
33579 -
33580 -_Standard_:
33581 - Fortran 2003 and later
33582 -
33583 -_Class_:
33584 - Inquiry function
33585 -
33586 -_Syntax_:
33587 - `RESULT = NEW_LINE(C)'
33588 -
33589 -_Arguments_:
33590 - C The argument shall be a scalar or array of the
33591 - type `CHARACTER'.
33592 -
33593 -_Return value_:
33594 - Returns a CHARACTER scalar of length one with the new-line
33595 - character of the same kind as parameter C.
33596 -
33597 -_Example_:
33598 - program newline
33599 - implicit none
33600 - write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
33601 - end program newline
33602 -
33603 -\1f
33604 -File: gfortran.info, Node: NINT, Next: NOT, Prev: NEW_LINE, Up: Intrinsic Procedures
33605 -
33606 -7.164 `NINT' -- Nearest whole number
33607 -====================================
33608 -
33609 -_Description_:
33610 - `NINT(X)' rounds its argument to the nearest whole number.
33611 -
33612 -_Standard_:
33613 - Fortran 77 and later, with KIND argument Fortran 90 and later
33614 -
33615 -_Class_:
33616 - Elemental function
33617 -
33618 -_Syntax_:
33619 - `RESULT = NINT(X [, KIND])'
33620 -
33621 -_Arguments_:
33622 - X The type of the argument shall be `REAL'.
33623 - KIND (Optional) An `INTEGER' initialization
33624 - expression indicating the kind parameter of
33625 - the result.
33626 -
33627 -_Return value_:
33628 - Returns A with the fractional portion of its magnitude eliminated
33629 - by rounding to the nearest whole number and with its sign
33630 - preserved, converted to an `INTEGER' of the default kind.
33631 -
33632 -_Example_:
33633 - program test_nint
33634 - real(4) x4
33635 - real(8) x8
33636 - x4 = 1.234E0_4
33637 - x8 = 4.321_8
33638 - print *, nint(x4), idnint(x8)
33639 - end program test_nint
33640 -
33641 -_Specific names_:
33642 - Name Argument Standard
33643 - `IDNINT(X)' `REAL(8)' Fortran 95 and
33644 - later
33645 -
33646 -_See also_:
33647 - *note CEILING::, *note FLOOR::
33648 -
33649 -
33650 -\1f
33651 -File: gfortran.info, Node: NOT, Next: NULL, Prev: NINT, Up: Intrinsic Procedures
33652 -
33653 -7.165 `NOT' -- Logical negation
33654 -===============================
33655 -
33656 -_Description_:
33657 - `NOT' returns the bitwise boolean inverse of I.
33658 -
33659 -_Standard_:
33660 - Fortran 95 and later
33661 -
33662 -_Class_:
33663 - Elemental function
33664 -
33665 -_Syntax_:
33666 - `RESULT = NOT(I)'
33667 -
33668 -_Arguments_:
33669 - I The type shall be `INTEGER'.
33670 -
33671 -_Return value_:
33672 - The return type is `INTEGER', of the same kind as the argument.
33673 -
33674 -_See also_:
33675 - *note IAND::, *note IEOR::, *note IOR::, *note IBITS::, *note
33676 - IBSET::, *note IBCLR::
33677 -
33678 -
33679 -\1f
33680 -File: gfortran.info, Node: NULL, Next: OR, Prev: NOT, Up: Intrinsic Procedures
33681 -
33682 -7.166 `NULL' -- Function that returns an disassociated pointer
33683 -==============================================================
33684 -
33685 -_Description_:
33686 - Returns a disassociated pointer.
33687 -
33688 - If MOLD is present, a dissassociated pointer of the same type is
33689 - returned, otherwise the type is determined by context.
33690 -
33691 - In Fortran 95, MOLD is optional. Please note that Fortran 2003
33692 - includes cases where it is required.
33693 -
33694 -_Standard_:
33695 - Fortran 95 and later
33696 -
33697 -_Class_:
33698 - Transformational function
33699 -
33700 -_Syntax_:
33701 - `PTR => NULL([MOLD])'
33702 -
33703 -_Arguments_:
33704 - MOLD (Optional) shall be a pointer of any
33705 - association status and of any type.
33706 -
33707 -_Return value_:
33708 - A disassociated pointer.
33709 -
33710 -_Example_:
33711 - REAL, POINTER, DIMENSION(:) :: VEC => NULL ()
33712 -
33713 -_See also_:
33714 - *note ASSOCIATED::
33715 -
33716 -\1f
33717 -File: gfortran.info, Node: OR, Next: PACK, Prev: NULL, Up: Intrinsic Procedures
33718 -
33719 -7.167 `OR' -- Bitwise logical OR
33720 -================================
33721 -
33722 -_Description_:
33723 - Bitwise logical `OR'.
33724 -
33725 - This intrinsic routine is provided for backwards compatibility with
33726 - GNU Fortran 77. For integer arguments, programmers should consider
33727 - the use of the *note IOR:: intrinsic defined by the Fortran
33728 - standard.
33729 -
33730 -_Standard_:
33731 - GNU extension
33732 -
33733 -_Class_:
33734 - Function
33735 -
33736 -_Syntax_:
33737 - `RESULT = OR(X, Y)'
33738 -
33739 -_Arguments_:
33740 - X The type shall be either a scalar `INTEGER'
33741 - type or a scalar `LOGICAL' type.
33742 - Y The type shall be the same as the type of X.
33743 -
33744 -_Return value_:
33745 - The return type is either a scalar `INTEGER' or a scalar
33746 - `LOGICAL'. If the kind type parameters differ, then the smaller
33747 - kind type is implicitly converted to larger kind, and the return
33748 - has the larger kind.
33749 -
33750 -_Example_:
33751 - PROGRAM test_or
33752 - LOGICAL :: T = .TRUE., F = .FALSE.
33753 - INTEGER :: a, b
33754 - DATA a / Z'F' /, b / Z'3' /
33755 -
33756 - WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
33757 - WRITE (*,*) OR(a, b)
33758 - END PROGRAM
33759 -
33760 -_See also_:
33761 - Fortran 95 elemental function: *note IOR::
33762 -
33763 -\1f
33764 -File: gfortran.info, Node: PACK, Next: PERROR, Prev: OR, Up: Intrinsic Procedures
33765 -
33766 -7.168 `PACK' -- Pack an array into an array of rank one
33767 -=======================================================
33768 -
33769 -_Description_:
33770 - Stores the elements of ARRAY in an array of rank one.
33771 -
33772 - The beginning of the resulting array is made up of elements whose
33773 - MASK equals `TRUE'. Afterwards, positions are filled with elements
33774 - taken from VECTOR.
33775 -
33776 -_Standard_:
33777 - Fortran 95 and later
33778 -
33779 -_Class_:
33780 - Transformational function
33781 -
33782 -_Syntax_:
33783 - `RESULT = PACK(ARRAY, MASK[,VECTOR]'
33784 -
33785 -_Arguments_:
33786 - ARRAY Shall be an array of any type.
33787 - MASK Shall be an array of type `LOGICAL' and of the
33788 - same size as ARRAY. Alternatively, it may be a
33789 - `LOGICAL' scalar.
33790 - VECTOR (Optional) shall be an array of the same type
33791 - as ARRAY and of rank one. If present, the
33792 - number of elements in VECTOR shall be equal to
33793 - or greater than the number of true elements in
33794 - MASK. If MASK is scalar, the number of
33795 - elements in VECTOR shall be equal to or
33796 - greater than the number of elements in ARRAY.
33797 -
33798 -_Return value_:
33799 - The result is an array of rank one and the same type as that of
33800 - ARRAY. If VECTOR is present, the result size is that of VECTOR,
33801 - the number of `TRUE' values in MASK otherwise.
33802 -
33803 -_Example_:
33804 - Gathering nonzero elements from an array:
33805 - PROGRAM test_pack_1
33806 - INTEGER :: m(6)
33807 - m = (/ 1, 0, 0, 0, 5, 0 /)
33808 - WRITE(*, FMT="(6(I0, ' '))") pack(m, m /= 0) ! "1 5"
33809 - END PROGRAM
33810 -
33811 - Gathering nonzero elements from an array and appending elements
33812 - from VECTOR:
33813 - PROGRAM test_pack_2
33814 - INTEGER :: m(4)
33815 - m = (/ 1, 0, 0, 2 /)
33816 - WRITE(*, FMT="(4(I0, ' '))") pack(m, m /= 0, (/ 0, 0, 3, 4 /)) ! "1 2 3 4"
33817 - END PROGRAM
33818 -
33819 -_See also_:
33820 - *note UNPACK::
33821 -
33822 -\1f
33823 -File: gfortran.info, Node: PERROR, Next: PRECISION, Prev: PACK, Up: Intrinsic Procedures
33824 -
33825 -7.169 `PERROR' -- Print system error message
33826 -============================================
33827 -
33828 -_Description_:
33829 - Prints (on the C `stderr' stream) a newline-terminated error
33830 - message corresponding to the last system error. This is prefixed by
33831 - STRING, a colon and a space. See `perror(3)'.
33832 -
33833 -_Standard_:
33834 - GNU extension
33835 -
33836 -_Class_:
33837 - Subroutine
33838 -
33839 -_Syntax_:
33840 - `CALL PERROR(STRING)'
33841 -
33842 -_Arguments_:
33843 - STRING A scalar of type `CHARACTER' and of the
33844 - default kind.
33845 -
33846 -_See also_:
33847 - *note IERRNO::
33848 -
33849 -\1f
33850 -File: gfortran.info, Node: PRECISION, Next: PRESENT, Prev: PERROR, Up: Intrinsic Procedures
33851 -
33852 -7.170 `PRECISION' -- Decimal precision of a real kind
33853 -=====================================================
33854 -
33855 -_Description_:
33856 - `PRECISION(X)' returns the decimal precision in the model of the
33857 - type of `X'.
33858 -
33859 -_Standard_:
33860 - Fortran 95 and later
33861 -
33862 -_Class_:
33863 - Inquiry function
33864 -
33865 -_Syntax_:
33866 - `RESULT = PRECISION(X)'
33867 -
33868 -_Arguments_:
33869 - X Shall be of type `REAL' or `COMPLEX'.
33870 -
33871 -_Return value_:
33872 - The return value is of type `INTEGER' and of the default integer
33873 - kind.
33874 -
33875 -_Example_:
33876 - program prec_and_range
33877 - real(kind=4) :: x(2)
33878 - complex(kind=8) :: y
33879 -
33880 - print *, precision(x), range(x)
33881 - print *, precision(y), range(y)
33882 - end program prec_and_range
33883 -
33884 -\1f
33885 -File: gfortran.info, Node: PRESENT, Next: PRODUCT, Prev: PRECISION, Up: Intrinsic Procedures
33886 -
33887 -7.171 `PRESENT' -- Determine whether an optional dummy argument is specified
33888 -============================================================================
33889 -
33890 -_Description_:
33891 - Determines whether an optional dummy argument is present.
33892 -
33893 -_Standard_:
33894 - Fortran 95 and later
33895 -
33896 -_Class_:
33897 - Inquiry function
33898 -
33899 -_Syntax_:
33900 - `RESULT = PRESENT(A)'
33901 -
33902 -_Arguments_:
33903 - A May be of any type and may be a pointer,
33904 - scalar or array value, or a dummy procedure.
33905 - It shall be the name of an optional dummy
33906 - argument accessible within the current
33907 - subroutine or function.
33908 -
33909 -_Return value_:
33910 - Returns either `TRUE' if the optional argument A is present, or
33911 - `FALSE' otherwise.
33912 -
33913 -_Example_:
33914 - PROGRAM test_present
33915 - WRITE(*,*) f(), f(42) ! "F T"
33916 - CONTAINS
33917 - LOGICAL FUNCTION f(x)
33918 - INTEGER, INTENT(IN), OPTIONAL :: x
33919 - f = PRESENT(x)
33920 - END FUNCTION
33921 - END PROGRAM
33922 -
33923 -\1f
33924 -File: gfortran.info, Node: PRODUCT, Next: RADIX, Prev: PRESENT, Up: Intrinsic Procedures
33925 -
33926 -7.172 `PRODUCT' -- Product of array elements
33927 -============================================
33928 -
33929 -_Description_:
33930 - Multiplies the elements of ARRAY along dimension DIM if the
33931 - corresponding element in MASK is `TRUE'.
33932 -
33933 -_Standard_:
33934 - Fortran 95 and later
33935 -
33936 -_Class_:
33937 - Transformational function
33938 -
33939 -_Syntax_:
33940 - `RESULT = PRODUCT(ARRAY[, MASK])' `RESULT = PRODUCT(ARRAY, DIM[,
33941 - MASK])'
33942 -
33943 -_Arguments_:
33944 - ARRAY Shall be an array of type `INTEGER', `REAL' or
33945 - `COMPLEX'.
33946 - DIM (Optional) shall be a scalar of type `INTEGER'
33947 - with a value in the range from 1 to n, where n
33948 - equals the rank of ARRAY.
33949 - MASK (Optional) shall be of type `LOGICAL' and
33950 - either be a scalar or an array of the same
33951 - shape as ARRAY.
33952 -
33953 -_Return value_:
33954 - The result is of the same type as ARRAY.
33955 -
33956 - If DIM is absent, a scalar with the product of all elements in
33957 - ARRAY is returned. Otherwise, an array of rank n-1, where n equals
33958 - the rank of ARRAY, and a shape similar to that of ARRAY with
33959 - dimension DIM dropped is returned.
33960 -
33961 -_Example_:
33962 - PROGRAM test_product
33963 - INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /)
33964 - print *, PRODUCT(x) ! all elements, product = 120
33965 - print *, PRODUCT(x, MASK=MOD(x, 2)==1) ! odd elements, product = 15
33966 - END PROGRAM
33967 -
33968 -_See also_:
33969 - *note SUM::
33970 -
33971 -\1f
33972 -File: gfortran.info, Node: RADIX, Next: RANDOM_NUMBER, Prev: PRODUCT, Up: Intrinsic Procedures
33973 -
33974 -7.173 `RADIX' -- Base of a model number
33975 -=======================================
33976 -
33977 -_Description_:
33978 - `RADIX(X)' returns the base of the model representing the entity X.
33979 -
33980 -_Standard_:
33981 - Fortran 95 and later
33982 -
33983 -_Class_:
33984 - Inquiry function
33985 -
33986 -_Syntax_:
33987 - `RESULT = RADIX(X)'
33988 -
33989 -_Arguments_:
33990 - X Shall be of type `INTEGER' or `REAL'
33991 -
33992 -_Return value_:
33993 - The return value is a scalar of type `INTEGER' and of the default
33994 - integer kind.
33995 -
33996 -_Example_:
33997 - program test_radix
33998 - print *, "The radix for the default integer kind is", radix(0)
33999 - print *, "The radix for the default real kind is", radix(0.0)
34000 - end program test_radix
34001 -
34002 -
34003 -\1f
34004 -File: gfortran.info, Node: RAN, Next: REAL, Prev: RANGE, Up: Intrinsic Procedures
34005 -
34006 -7.174 `RAN' -- Real pseudo-random number
34007 -========================================
34008 -
34009 -_Description_:
34010 - For compatibility with HP FORTRAN 77/iX, the `RAN' intrinsic is
34011 - provided as an alias for `RAND'. See *note RAND:: for complete
34012 - documentation.
34013 -
34014 -_Standard_:
34015 - GNU extension
34016 -
34017 -_Class_:
34018 - Function
34019 -
34020 -_See also_:
34021 - *note RAND::, *note RANDOM_NUMBER::
34022 -
34023 -\1f
34024 -File: gfortran.info, Node: RAND, Next: RANGE, Prev: RANDOM_SEED, Up: Intrinsic Procedures
34025 -
34026 -7.175 `RAND' -- Real pseudo-random number
34027 -=========================================
34028 -
34029 -_Description_:
34030 - `RAND(FLAG)' returns a pseudo-random number from a uniform
34031 - distribution between 0 and 1. If FLAG is 0, the next number in the
34032 - current sequence is returned; if FLAG is 1, the generator is
34033 - restarted by `CALL SRAND(0)'; if FLAG has any other value, it is
34034 - used as a new seed with `SRAND'.
34035 -
34036 - This intrinsic routine is provided for backwards compatibility with
34037 - GNU Fortran 77. It implements a simple modulo generator as provided
34038 - by `g77'. For new code, one should consider the use of *note
34039 - RANDOM_NUMBER:: as it implements a superior algorithm.
34040 -
34041 -_Standard_:
34042 - GNU extension
34043 -
34044 -_Class_:
34045 - Function
34046 -
34047 -_Syntax_:
34048 - `RESULT = RAND(FLAG)'
34049 -
34050 -_Arguments_:
34051 - FLAG Shall be a scalar `INTEGER' of kind 4.
34052 -
34053 -_Return value_:
34054 - The return value is of `REAL' type and the default kind.
34055 -
34056 -_Example_:
34057 - program test_rand
34058 - integer,parameter :: seed = 86456
34059 -
34060 - call srand(seed)
34061 - print *, rand(), rand(), rand(), rand()
34062 - print *, rand(seed), rand(), rand(), rand()
34063 - end program test_rand
34064 -
34065 -_See also_:
34066 - *note SRAND::, *note RANDOM_NUMBER::
34067 -
34068 -
34069 -\1f
34070 -File: gfortran.info, Node: RANDOM_NUMBER, Next: RANDOM_SEED, Prev: RADIX, Up: Intrinsic Procedures
34071 -
34072 -7.176 `RANDOM_NUMBER' -- Pseudo-random number
34073 -=============================================
34074 -
34075 -_Description_:
34076 - Returns a single pseudorandom number or an array of pseudorandom
34077 - numbers from the uniform distribution over the range 0 \leq x < 1.
34078 -
34079 - The runtime-library implements George Marsaglia's KISS (Keep It
34080 - Simple Stupid) random number generator (RNG). This RNG combines:
34081 - 1. The congruential generator x(n) = 69069 \cdot x(n-1) +
34082 - 1327217885 with a period of 2^32,
34083 -
34084 - 2. A 3-shift shift-register generator with a period of 2^32 - 1,
34085 -
34086 - 3. Two 16-bit multiply-with-carry generators with a period of
34087 - 597273182964842497 > 2^59.
34088 - The overall period exceeds 2^123.
34089 -
34090 - Please note, this RNG is thread safe if used within OpenMP
34091 - directives, i.e., its state will be consistent while called from
34092 - multiple threads. However, the KISS generator does not create
34093 - random numbers in parallel from multiple sources, but in sequence
34094 - from a single source. If an OpenMP-enabled application heavily
34095 - relies on random numbers, one should consider employing a
34096 - dedicated parallel random number generator instead.
34097 -
34098 -_Standard_:
34099 - Fortran 95 and later
34100 -
34101 -_Class_:
34102 - Subroutine
34103 -
34104 -_Syntax_:
34105 - `RANDOM_NUMBER(HARVEST)'
34106 -
34107 -_Arguments_:
34108 - HARVEST Shall be a scalar or an array of type `REAL'.
34109 -
34110 -_Example_:
34111 - program test_random_number
34112 - REAL :: r(5,5)
34113 - CALL init_random_seed() ! see example of RANDOM_SEED
34114 - CALL RANDOM_NUMBER(r)
34115 - end program
34116 -
34117 -_See also_:
34118 - *note RANDOM_SEED::
34119 -
34120 -\1f
34121 -File: gfortran.info, Node: RANDOM_SEED, Next: RAND, Prev: RANDOM_NUMBER, Up: Intrinsic Procedures
34122 -
34123 -7.177 `RANDOM_SEED' -- Initialize a pseudo-random number sequence
34124 -=================================================================
34125 -
34126 -_Description_:
34127 - Restarts or queries the state of the pseudorandom number generator
34128 - used by `RANDOM_NUMBER'.
34129 -
34130 - If `RANDOM_SEED' is called without arguments, it is initialized to
34131 - a default state. The example below shows how to initialize the
34132 - random seed based on the system's time.
34133 -
34134 -_Standard_:
34135 - Fortran 95 and later
34136 -
34137 -_Class_:
34138 - Subroutine
34139 -
34140 -_Syntax_:
34141 - `CALL RANDOM_SEED(SIZE, PUT, GET)'
34142 -
34143 -_Arguments_:
34144 - SIZE (Optional) Shall be a scalar and of type
34145 - default `INTEGER', with `INTENT(OUT)'. It
34146 - specifies the minimum size of the arrays used
34147 - with the PUT and GET arguments.
34148 - PUT (Optional) Shall be an array of type default
34149 - `INTEGER' and rank one. It is `INTENT(IN)' and
34150 - the size of the array must be larger than or
34151 - equal to the number returned by the SIZE
34152 - argument.
34153 - GET (Optional) Shall be an array of type default
34154 - `INTEGER' and rank one. It is `INTENT(OUT)'
34155 - and the size of the array must be larger than
34156 - or equal to the number returned by the SIZE
34157 - argument.
34158 -
34159 -_Example_:
34160 - SUBROUTINE init_random_seed()
34161 - INTEGER :: i, n, clock
34162 - INTEGER, DIMENSION(:), ALLOCATABLE :: seed
34163 -
34164 - CALL RANDOM_SEED(size = n)
34165 - ALLOCATE(seed(n))
34166 -
34167 - CALL SYSTEM_CLOCK(COUNT=clock)
34168 -
34169 - seed = clock + 37 * (/ (i - 1, i = 1, n) /)
34170 - CALL RANDOM_SEED(PUT = seed)
34171 -
34172 - DEALLOCATE(seed)
34173 - END SUBROUTINE
34174 -
34175 -_See also_:
34176 - *note RANDOM_NUMBER::
34177 -
34178 -\1f
34179 -File: gfortran.info, Node: RANGE, Next: RAN, Prev: RAND, Up: Intrinsic Procedures
34180 -
34181 -7.178 `RANGE' -- Decimal exponent range
34182 -=======================================
34183 -
34184 -_Description_:
34185 - `RANGE(X)' returns the decimal exponent range in the model of the
34186 - type of `X'.
34187 -
34188 -_Standard_:
34189 - Fortran 95 and later
34190 -
34191 -_Class_:
34192 - Inquiry function
34193 -
34194 -_Syntax_:
34195 - `RESULT = RANGE(X)'
34196 -
34197 -_Arguments_:
34198 - X Shall be of type `INTEGER', `REAL' or
34199 - `COMPLEX'.
34200 -
34201 -_Return value_:
34202 - The return value is of type `INTEGER' and of the default integer
34203 - kind.
34204 -
34205 -_Example_:
34206 - See `PRECISION' for an example.
34207 -
34208 -\1f
34209 -File: gfortran.info, Node: REAL, Next: RENAME, Prev: RAN, Up: Intrinsic Procedures
34210 -
34211 -7.179 `REAL' -- Convert to real type
34212 -====================================
34213 -
34214 -_Description_:
34215 - `REAL(X [, KIND])' converts its argument X to a real type. The
34216 - `REALPART(X)' function is provided for compatibility with `g77',
34217 - and its use is strongly discouraged.
34218 -
34219 -_Standard_:
34220 - Fortran 77 and later
34221 -
34222 -_Class_:
34223 - Elemental function
34224 -
34225 -_Syntax_:
34226 - `RESULT = REAL(X [, KIND])'
34227 - `RESULT = REALPART(Z)'
34228 -
34229 -_Arguments_:
34230 - X Shall be `INTEGER', `REAL', or `COMPLEX'.
34231 - KIND (Optional) An `INTEGER' initialization
34232 - expression indicating the kind parameter of
34233 - the result.
34234 -
34235 -_Return value_:
34236 - These functions return a `REAL' variable or array under the
34237 - following rules:
34238 -
34239 - (A)
34240 - `REAL(X)' is converted to a default real type if X is an
34241 - integer or real variable.
34242 -
34243 - (B)
34244 - `REAL(X)' is converted to a real type with the kind type
34245 - parameter of X if X is a complex variable.
34246 -
34247 - (C)
34248 - `REAL(X, KIND)' is converted to a real type with kind type
34249 - parameter KIND if X is a complex, integer, or real variable.
34250 -
34251 -_Example_:
34252 - program test_real
34253 - complex :: x = (1.0, 2.0)
34254 - print *, real(x), real(x,8), realpart(x)
34255 - end program test_real
34256 -
34257 -_See also_:
34258 - *note DBLE::, *note DFLOAT::, *note FLOAT::
34259 -
34260 -
34261 -\1f
34262 -File: gfortran.info, Node: RENAME, Next: REPEAT, Prev: REAL, Up: Intrinsic Procedures
34263 -
34264 -7.180 `RENAME' -- Rename a file
34265 -===============================
34266 -
34267 -_Description_:
34268 - Renames a file from file PATH1 to PATH2. A null character
34269 - (`CHAR(0)') can be used to mark the end of the names in PATH1 and
34270 - PATH2; otherwise, trailing blanks in the file names are ignored.
34271 - If the STATUS argument is supplied, it contains 0 on success or a
34272 - nonzero error code upon return; see `rename(2)'.
34273 -
34274 - This intrinsic is provided in both subroutine and function forms;
34275 - however, only one form can be used in any given program unit.
34276 -
34277 -_Standard_:
34278 - GNU extension
34279 -
34280 -_Class_:
34281 - Subroutine, function
34282 -
34283 -_Syntax_:
34284 - `CALL RENAME(PATH1, PATH2 [, STATUS])'
34285 - `STATUS = RENAME(PATH1, PATH2)'
34286 -
34287 -_Arguments_:
34288 - PATH1 Shall be of default `CHARACTER' type.
34289 - PATH2 Shall be of default `CHARACTER' type.
34290 - STATUS (Optional) Shall be of default `INTEGER' type.
34291 -
34292 -_See also_:
34293 - *note LINK::
34294 -
34295 -
34296 -\1f
34297 -File: gfortran.info, Node: REPEAT, Next: RESHAPE, Prev: RENAME, Up: Intrinsic Procedures
34298 -
34299 -7.181 `REPEAT' -- Repeated string concatenation
34300 -===============================================
34301 -
34302 -_Description_:
34303 - Concatenates NCOPIES copies of a string.
34304 -
34305 -_Standard_:
34306 - Fortran 95 and later
34307 -
34308 -_Class_:
34309 - Transformational function
34310 -
34311 -_Syntax_:
34312 - `RESULT = REPEAT(STRING, NCOPIES)'
34313 -
34314 -_Arguments_:
34315 - STRING Shall be scalar and of type `CHARACTER'.
34316 - NCOPIES Shall be scalar and of type `INTEGER'.
34317 -
34318 -_Return value_:
34319 - A new scalar of type `CHARACTER' built up from NCOPIES copies of
34320 - STRING.
34321 -
34322 -_Example_:
34323 - program test_repeat
34324 - write(*,*) repeat("x", 5) ! "xxxxx"
34325 - end program
34326 -
34327 -\1f
34328 -File: gfortran.info, Node: RESHAPE, Next: RRSPACING, Prev: REPEAT, Up: Intrinsic Procedures
34329 -
34330 -7.182 `RESHAPE' -- Function to reshape an array
34331 -===============================================
34332 -
34333 -_Description_:
34334 - Reshapes SOURCE to correspond to SHAPE. If necessary, the new
34335 - array may be padded with elements from PAD or permuted as defined
34336 - by ORDER.
34337 -
34338 -_Standard_:
34339 - Fortran 95 and later
34340 -
34341 -_Class_:
34342 - Transformational function
34343 -
34344 -_Syntax_:
34345 - `RESULT = RESHAPE(SOURCE, SHAPE[, PAD, ORDER])'
34346 -
34347 -_Arguments_:
34348 - SOURCE Shall be an array of any type.
34349 - SHAPE Shall be of type `INTEGER' and an array of
34350 - rank one. Its values must be positive or zero.
34351 - PAD (Optional) shall be an array of the same type
34352 - as SOURCE.
34353 - ORDER (Optional) shall be of type `INTEGER' and an
34354 - array of the same shape as SHAPE. Its values
34355 - shall be a permutation of the numbers from 1
34356 - to n, where n is the size of SHAPE. If ORDER
34357 - is absent, the natural ordering shall be
34358 - assumed.
34359 -
34360 -_Return value_:
34361 - The result is an array of shape SHAPE with the same type as SOURCE.
34362 -
34363 -_Example_:
34364 - PROGRAM test_reshape
34365 - INTEGER, DIMENSION(4) :: x
34366 - WRITE(*,*) SHAPE(x) ! prints "4"
34367 - WRITE(*,*) SHAPE(RESHAPE(x, (/2, 2/))) ! prints "2 2"
34368 - END PROGRAM
34369 -
34370 -_See also_:
34371 - *note SHAPE::
34372 -
34373 -\1f
34374 -File: gfortran.info, Node: RRSPACING, Next: RSHIFT, Prev: RESHAPE, Up: Intrinsic Procedures
34375 -
34376 -7.183 `RRSPACING' -- Reciprocal of the relative spacing
34377 -=======================================================
34378 -
34379 -_Description_:
34380 - `RRSPACING(X)' returns the reciprocal of the relative spacing of
34381 - model numbers near X.
34382 -
34383 -_Standard_:
34384 - Fortran 95 and later
34385 -
34386 -_Class_:
34387 - Elemental function
34388 -
34389 -_Syntax_:
34390 - `RESULT = RRSPACING(X)'
34391 -
34392 -_Arguments_:
34393 - X Shall be of type `REAL'.
34394 -
34395 -_Return value_:
34396 - The return value is of the same type and kind as X. The value
34397 - returned is equal to `ABS(FRACTION(X)) *
34398 - FLOAT(RADIX(X))**DIGITS(X)'.
34399 -
34400 -_See also_:
34401 - *note SPACING::
34402 -
34403 -\1f
34404 -File: gfortran.info, Node: RSHIFT, Next: SCALE, Prev: RRSPACING, Up: Intrinsic Procedures
34405 -
34406 -7.184 `RSHIFT' -- Right shift bits
34407 -==================================
34408 -
34409 -_Description_:
34410 - `RSHIFT' returns a value corresponding to I with all of the bits
34411 - shifted right by SHIFT places. If the absolute value of SHIFT is
34412 - greater than `BIT_SIZE(I)', the value is undefined. Bits shifted
34413 - out from the left end are lost; zeros are shifted in from the
34414 - opposite end.
34415 -
34416 - This function has been superseded by the `ISHFT' intrinsic, which
34417 - is standard in Fortran 95 and later.
34418 -
34419 -_Standard_:
34420 - GNU extension
34421 -
34422 -_Class_:
34423 - Elemental function
34424 -
34425 -_Syntax_:
34426 - `RESULT = RSHIFT(I, SHIFT)'
34427 -
34428 -_Arguments_:
34429 - I The type shall be `INTEGER'.
34430 - SHIFT The type shall be `INTEGER'.
34431 -
34432 -_Return value_:
34433 - The return value is of type `INTEGER' and of the same kind as I.
34434 -
34435 -_See also_:
34436 - *note ISHFT::, *note ISHFTC::, *note LSHIFT::
34437 -
34438 -
34439 -\1f
34440 -File: gfortran.info, Node: SCALE, Next: SCAN, Prev: RSHIFT, Up: Intrinsic Procedures
34441 -
34442 -7.185 `SCALE' -- Scale a real value
34443 -===================================
34444 -
34445 -_Description_:
34446 - `SCALE(X,I)' returns `X * RADIX(X)**I'.
34447 -
34448 -_Standard_:
34449 - Fortran 95 and later
34450 -
34451 -_Class_:
34452 - Elemental function
34453 -
34454 -_Syntax_:
34455 - `RESULT = SCALE(X, I)'
34456 -
34457 -_Arguments_:
34458 - X The type of the argument shall be a `REAL'.
34459 - I The type of the argument shall be a `INTEGER'.
34460 -
34461 -_Return value_:
34462 - The return value is of the same type and kind as X. Its value is
34463 - `X * RADIX(X)**I'.
34464 -
34465 -_Example_:
34466 - program test_scale
34467 - real :: x = 178.1387e-4
34468 - integer :: i = 5
34469 - print *, scale(x,i), x*radix(x)**i
34470 - end program test_scale
34471 -
34472 -
34473 -\1f
34474 -File: gfortran.info, Node: SCAN, Next: SECNDS, Prev: SCALE, Up: Intrinsic Procedures
34475 -
34476 -7.186 `SCAN' -- Scan a string for the presence of a set of characters
34477 -=====================================================================
34478 -
34479 -_Description_:
34480 - Scans a STRING for any of the characters in a SET of characters.
34481 -
34482 - If BACK is either absent or equals `FALSE', this function returns
34483 - the position of the leftmost character of STRING that is in SET.
34484 - If BACK equals `TRUE', the rightmost position is returned. If no
34485 - character of SET is found in STRING, the result is zero.
34486 -
34487 -_Standard_:
34488 - Fortran 95 and later, with KIND argument Fortran 2003 and later
34489 -
34490 -_Class_:
34491 - Elemental function
34492 -
34493 -_Syntax_:
34494 - `RESULT = SCAN(STRING, SET[, BACK [, KIND]])'
34495 -
34496 -_Arguments_:
34497 - STRING Shall be of type `CHARACTER'.
34498 - SET Shall be of type `CHARACTER'.
34499 - BACK (Optional) shall be of type `LOGICAL'.
34500 - KIND (Optional) An `INTEGER' initialization
34501 - expression indicating the kind parameter of
34502 - the result.
34503 -
34504 -_Return value_:
34505 - The return value is of type `INTEGER' and of kind KIND. If KIND is
34506 - absent, the return value is of default integer kind.
34507 -
34508 -_Example_:
34509 - PROGRAM test_scan
34510 - WRITE(*,*) SCAN("FORTRAN", "AO") ! 2, found 'O'
34511 - WRITE(*,*) SCAN("FORTRAN", "AO", .TRUE.) ! 6, found 'A'
34512 - WRITE(*,*) SCAN("FORTRAN", "C++") ! 0, found none
34513 - END PROGRAM
34514 -
34515 -_See also_:
34516 - *note INDEX intrinsic::, *note VERIFY::
34517 -
34518 -\1f
34519 -File: gfortran.info, Node: SECNDS, Next: SECOND, Prev: SCAN, Up: Intrinsic Procedures
34520 -
34521 -7.187 `SECNDS' -- Time function
34522 -===============================
34523 -
34524 -_Description_:
34525 - `SECNDS(X)' gets the time in seconds from the real-time system
34526 - clock. X is a reference time, also in seconds. If this is zero,
34527 - the time in seconds from midnight is returned. This function is
34528 - non-standard and its use is discouraged.
34529 -
34530 -_Standard_:
34531 - GNU extension
34532 -
34533 -_Class_:
34534 - Function
34535 -
34536 -_Syntax_:
34537 - `RESULT = SECNDS (X)'
34538 -
34539 -_Arguments_:
34540 - T Shall be of type `REAL(4)'.
34541 - X Shall be of type `REAL(4)'.
34542 -
34543 -_Return value_:
34544 - None
34545 -
34546 -_Example_:
34547 - program test_secnds
34548 - integer :: i
34549 - real(4) :: t1, t2
34550 - print *, secnds (0.0) ! seconds since midnight
34551 - t1 = secnds (0.0) ! reference time
34552 - do i = 1, 10000000 ! do something
34553 - end do
34554 - t2 = secnds (t1) ! elapsed time
34555 - print *, "Something took ", t2, " seconds."
34556 - end program test_secnds
34557 -
34558 -\1f
34559 -File: gfortran.info, Node: SECOND, Next: SELECTED_CHAR_KIND, Prev: SECNDS, Up: Intrinsic Procedures
34560 -
34561 -7.188 `SECOND' -- CPU time function
34562 -===================================
34563 -
34564 -_Description_:
34565 - Returns a `REAL(4)' value representing the elapsed CPU time in
34566 - seconds. This provides the same functionality as the standard
34567 - `CPU_TIME' intrinsic, and is only included for backwards
34568 - compatibility.
34569 -
34570 - This intrinsic is provided in both subroutine and function forms;
34571 - however, only one form can be used in any given program unit.
34572 -
34573 -_Standard_:
34574 - GNU extension
34575 -
34576 -_Class_:
34577 - Subroutine, function
34578 -
34579 -_Syntax_:
34580 - `CALL SECOND(TIME)'
34581 - `TIME = SECOND()'
34582 -
34583 -_Arguments_:
34584 - TIME Shall be of type `REAL(4)'.
34585 -
34586 -_Return value_:
34587 - In either syntax, TIME is set to the process's current runtime in
34588 - seconds.
34589 -
34590 -_See also_:
34591 - *note CPU_TIME::
34592 -
34593 -
34594 -\1f
34595 -File: gfortran.info, Node: SELECTED_CHAR_KIND, Next: SELECTED_INT_KIND, Prev: SECOND, Up: Intrinsic Procedures
34596 -
34597 -7.189 `SELECTED_CHAR_KIND' -- Choose character kind
34598 -===================================================
34599 -
34600 -_Description_:
34601 - `SELECTED_CHAR_KIND(NAME)' returns the kind value for the character
34602 - set named NAME, if a character set with such a name is supported,
34603 - or -1 otherwise. Currently, supported character sets include
34604 - "ASCII" and "DEFAULT", which are equivalent.
34605 -
34606 -_Standard_:
34607 - Fortran 2003 and later
34608 -
34609 -_Class_:
34610 - Transformational function
34611 -
34612 -_Syntax_:
34613 - `RESULT = SELECTED_CHAR_KIND(NAME)'
34614 -
34615 -_Arguments_:
34616 - NAME Shall be a scalar and of the default character
34617 - type.
34618 -
34619 -_Example_:
34620 - program ascii_kind
34621 - integer,parameter :: ascii = selected_char_kind("ascii")
34622 - character(kind=ascii, len=26) :: s
34623 -
34624 - s = ascii_"abcdefghijklmnopqrstuvwxyz"
34625 - print *, s
34626 - end program ascii_kind
34627 -
34628 -\1f
34629 -File: gfortran.info, Node: SELECTED_INT_KIND, Next: SELECTED_REAL_KIND, Prev: SELECTED_CHAR_KIND, Up: Intrinsic Procedures
34630 -
34631 -7.190 `SELECTED_INT_KIND' -- Choose integer kind
34632 -================================================
34633 -
34634 -_Description_:
34635 - `SELECTED_INT_KIND(I)' return the kind value of the smallest
34636 - integer type that can represent all values ranging from -10^I
34637 - (exclusive) to 10^I (exclusive). If there is no integer kind that
34638 - accommodates this range, `SELECTED_INT_KIND' returns -1.
34639 -
34640 -_Standard_:
34641 - Fortran 95 and later
34642 -
34643 -_Class_:
34644 - Transformational function
34645 -
34646 -_Syntax_:
34647 - `RESULT = SELECTED_INT_KIND(I)'
34648 -
34649 -_Arguments_:
34650 - I Shall be a scalar and of type `INTEGER'.
34651 -
34652 -_Example_:
34653 - program large_integers
34654 - integer,parameter :: k5 = selected_int_kind(5)
34655 - integer,parameter :: k15 = selected_int_kind(15)
34656 - integer(kind=k5) :: i5
34657 - integer(kind=k15) :: i15
34658 -
34659 - print *, huge(i5), huge(i15)
34660 -
34661 - ! The following inequalities are always true
34662 - print *, huge(i5) >= 10_k5**5-1
34663 - print *, huge(i15) >= 10_k15**15-1
34664 - end program large_integers
34665 -
34666 -\1f
34667 -File: gfortran.info, Node: SELECTED_REAL_KIND, Next: SET_EXPONENT, Prev: SELECTED_INT_KIND, Up: Intrinsic Procedures
34668 -
34669 -7.191 `SELECTED_REAL_KIND' -- Choose real kind
34670 -==============================================
34671 -
34672 -_Description_:
34673 - `SELECTED_REAL_KIND(P,R)' returns the kind value of a real data
34674 - type with decimal precision of at least `P' digits and exponent
34675 - range greater at least `R'.
34676 -
34677 -_Standard_:
34678 - Fortran 95 and later
34679 -
34680 -_Class_:
34681 - Transformational function
34682 -
34683 -_Syntax_:
34684 - `RESULT = SELECTED_REAL_KIND(P, R)'
34685 -
34686 -_Arguments_:
34687 - P (Optional) shall be a scalar and of type
34688 - `INTEGER'.
34689 - R (Optional) shall be a scalar and of type
34690 - `INTEGER'.
34691 - At least one argument shall be present.
34692 -
34693 -_Return value_:
34694 - `SELECTED_REAL_KIND' returns the value of the kind type parameter
34695 - of a real data type with decimal precision of at least `P' digits
34696 - and a decimal exponent range of at least `R'. If more than one
34697 - real data type meet the criteria, the kind of the data type with
34698 - the smallest decimal precision is returned. If no real data type
34699 - matches the criteria, the result is
34700 - -1 if the processor does not support a real data type with a
34701 - precision greater than or equal to `P'
34702 -
34703 - -2 if the processor does not support a real type with an exponent
34704 - range greater than or equal to `R'
34705 -
34706 - -3 if neither is supported.
34707 -
34708 -_Example_:
34709 - program real_kinds
34710 - integer,parameter :: p6 = selected_real_kind(6)
34711 - integer,parameter :: p10r100 = selected_real_kind(10,100)
34712 - integer,parameter :: r400 = selected_real_kind(r=400)
34713 - real(kind=p6) :: x
34714 - real(kind=p10r100) :: y
34715 - real(kind=r400) :: z
34716 -
34717 - print *, precision(x), range(x)
34718 - print *, precision(y), range(y)
34719 - print *, precision(z), range(z)
34720 - end program real_kinds
34721 -
34722 -\1f
34723 -File: gfortran.info, Node: SET_EXPONENT, Next: SHAPE, Prev: SELECTED_REAL_KIND, Up: Intrinsic Procedures
34724 -
34725 -7.192 `SET_EXPONENT' -- Set the exponent of the model
34726 -=====================================================
34727 -
34728 -_Description_:
34729 - `SET_EXPONENT(X, I)' returns the real number whose fractional part
34730 - is that that of X and whose exponent part is I.
34731 -
34732 -_Standard_:
34733 - Fortran 95 and later
34734 -
34735 -_Class_:
34736 - Elemental function
34737 -
34738 -_Syntax_:
34739 - `RESULT = SET_EXPONENT(X, I)'
34740 -
34741 -_Arguments_:
34742 - X Shall be of type `REAL'.
34743 - I Shall be of type `INTEGER'.
34744 -
34745 -_Return value_:
34746 - The return value is of the same type and kind as X. The real
34747 - number whose fractional part is that that of X and whose exponent
34748 - part if I is returned; it is `FRACTION(X) * RADIX(X)**I'.
34749 -
34750 -_Example_:
34751 - PROGRAM test_setexp
34752 - REAL :: x = 178.1387e-4
34753 - INTEGER :: i = 17
34754 - PRINT *, SET_EXPONENT(x, i), FRACTION(x) * RADIX(x)**i
34755 - END PROGRAM
34756 -
34757 -
34758 -\1f
34759 -File: gfortran.info, Node: SHAPE, Next: SIGN, Prev: SET_EXPONENT, Up: Intrinsic Procedures
34760 -
34761 -7.193 `SHAPE' -- Determine the shape of an array
34762 -================================================
34763 -
34764 -_Description_:
34765 - Determines the shape of an array.
34766 -
34767 -_Standard_:
34768 - Fortran 95 and later
34769 -
34770 -_Class_:
34771 - Inquiry function
34772 -
34773 -_Syntax_:
34774 - `RESULT = SHAPE(SOURCE)'
34775 -
34776 -_Arguments_:
34777 - SOURCE Shall be an array or scalar of any type. If
34778 - SOURCE is a pointer it must be associated and
34779 - allocatable arrays must be allocated.
34780 -
34781 -_Return value_:
34782 - An `INTEGER' array of rank one with as many elements as SOURCE has
34783 - dimensions. The elements of the resulting array correspond to the
34784 - extend of SOURCE along the respective dimensions. If SOURCE is a
34785 - scalar, the result is the rank one array of size zero.
34786 -
34787 -_Example_:
34788 - PROGRAM test_shape
34789 - INTEGER, DIMENSION(-1:1, -1:2) :: A
34790 - WRITE(*,*) SHAPE(A) ! (/ 3, 4 /)
34791 - WRITE(*,*) SIZE(SHAPE(42)) ! (/ /)
34792 - END PROGRAM
34793 -
34794 -_See also_:
34795 - *note RESHAPE::, *note SIZE::
34796 -
34797 -\1f
34798 -File: gfortran.info, Node: SIGN, Next: SIGNAL, Prev: SHAPE, Up: Intrinsic Procedures
34799 -
34800 -7.194 `SIGN' -- Sign copying function
34801 -=====================================
34802 -
34803 -_Description_:
34804 - `SIGN(A,B)' returns the value of A with the sign of B.
34805 -
34806 -_Standard_:
34807 - Fortran 77 and later
34808 -
34809 -_Class_:
34810 - Elemental function
34811 -
34812 -_Syntax_:
34813 - `RESULT = SIGN(A, B)'
34814 -
34815 -_Arguments_:
34816 - A Shall be of type `INTEGER' or `REAL'
34817 - B Shall be of the same type and kind as A
34818 -
34819 -_Return value_:
34820 - The kind of the return value is that of A and B. If B\ge 0 then
34821 - the result is `ABS(A)', else it is `-ABS(A)'.
34822 -
34823 -_Example_:
34824 - program test_sign
34825 - print *, sign(-12,1)
34826 - print *, sign(-12,0)
34827 - print *, sign(-12,-1)
34828 -
34829 - print *, sign(-12.,1.)
34830 - print *, sign(-12.,0.)
34831 - print *, sign(-12.,-1.)
34832 - end program test_sign
34833 -
34834 -_Specific names_:
34835 - Name Arguments Return type Standard
34836 - `ISIGN(A,P)' `INTEGER(4)' `INTEGER(4)' f95, gnu
34837 - `DSIGN(A,P)' `REAL(8)' `REAL(8)' f95, gnu
34838 -
34839 -\1f
34840 -File: gfortran.info, Node: SIGNAL, Next: SIN, Prev: SIGN, Up: Intrinsic Procedures
34841 -
34842 -7.195 `SIGNAL' -- Signal handling subroutine (or function)
34843 -==========================================================
34844 -
34845 -_Description_:
34846 - `SIGNAL(NUMBER, HANDLER [, STATUS])' causes external subroutine
34847 - HANDLER to be executed with a single integer argument when signal
34848 - NUMBER occurs. If HANDLER is an integer, it can be used to turn
34849 - off handling of signal NUMBER or revert to its default action.
34850 - See `signal(2)'.
34851 -
34852 - If `SIGNAL' is called as a subroutine and the STATUS argument is
34853 - supplied, it is set to the value returned by `signal(2)'.
34854 -
34855 -_Standard_:
34856 - GNU extension
34857 -
34858 -_Class_:
34859 - Subroutine, function
34860 -
34861 -_Syntax_:
34862 - `CALL SIGNAL(NUMBER, HANDLER [, STATUS])'
34863 - `STATUS = SIGNAL(NUMBER, HANDLER)'
34864 -
34865 -_Arguments_:
34866 - NUMBER Shall be a scalar integer, with `INTENT(IN)'
34867 - HANDLER Signal handler (`INTEGER FUNCTION' or
34868 - `SUBROUTINE') or dummy/global `INTEGER' scalar.
34869 - `INTEGER'. It is `INTENT(IN)'.
34870 - STATUS (Optional) STATUS shall be a scalar integer.
34871 - It has `INTENT(OUT)'.
34872 -
34873 -_Return value_:
34874 - The `SIGNAL' function returns the value returned by `signal(2)'.
34875 -
34876 -_Example_:
34877 - program test_signal
34878 - intrinsic signal
34879 - external handler_print
34880 -
34881 - call signal (12, handler_print)
34882 - call signal (10, 1)
34883 -
34884 - call sleep (30)
34885 - end program test_signal
34886 -
34887 -\1f
34888 -File: gfortran.info, Node: SIN, Next: SINH, Prev: SIGNAL, Up: Intrinsic Procedures
34889 -
34890 -7.196 `SIN' -- Sine function
34891 -============================
34892 -
34893 -_Description_:
34894 - `SIN(X)' computes the sine of X.
34895 -
34896 -_Standard_:
34897 - Fortran 77 and later
34898 -
34899 -_Class_:
34900 - Elemental function
34901 -
34902 -_Syntax_:
34903 - `RESULT = SIN(X)'
34904 -
34905 -_Arguments_:
34906 - X The type shall be `REAL' or `COMPLEX'.
34907 -
34908 -_Return value_:
34909 - The return value has same type and kind as X.
34910 -
34911 -_Example_:
34912 - program test_sin
34913 - real :: x = 0.0
34914 - x = sin(x)
34915 - end program test_sin
34916 -
34917 -_Specific names_:
34918 - Name Argument Return type Standard
34919 - `DSIN(X)' `REAL(8) X' `REAL(8)' f95, gnu
34920 - `CSIN(X)' `COMPLEX(4) `COMPLEX(4)' f95, gnu
34921 - X'
34922 - `ZSIN(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
34923 - X'
34924 - `CDSIN(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
34925 - X'
34926 -
34927 -_See also_:
34928 - *note ASIN::
34929 -
34930 -\1f
34931 -File: gfortran.info, Node: SINH, Next: SIZE, Prev: SIN, Up: Intrinsic Procedures
34932 -
34933 -7.197 `SINH' -- Hyperbolic sine function
34934 -========================================
34935 -
34936 -_Description_:
34937 - `SINH(X)' computes the hyperbolic sine of X.
34938 -
34939 -_Standard_:
34940 - Fortran 95 and later
34941 -
34942 -_Class_:
34943 - Elemental function
34944 -
34945 -_Syntax_:
34946 - `RESULT = SINH(X)'
34947 -
34948 -_Arguments_:
34949 - X The type shall be `REAL'.
34950 -
34951 -_Return value_:
34952 - The return value is of type `REAL'.
34953 -
34954 -_Example_:
34955 - program test_sinh
34956 - real(8) :: x = - 1.0_8
34957 - x = sinh(x)
34958 - end program test_sinh
34959 -
34960 -_Specific names_:
34961 - Name Argument Return type Standard
34962 - `DSINH(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
34963 - later
34964 -
34965 -_See also_:
34966 - *note ASINH::
34967 -
34968 -\1f
34969 -File: gfortran.info, Node: SIZE, Next: SIZEOF, Prev: SINH, Up: Intrinsic Procedures
34970 -
34971 -7.198 `SIZE' -- Determine the size of an array
34972 -==============================================
34973 -
34974 -_Description_:
34975 - Determine the extent of ARRAY along a specified dimension DIM, or
34976 - the total number of elements in ARRAY if DIM is absent.
34977 -
34978 -_Standard_:
34979 - Fortran 95 and later, with KIND argument Fortran 2003 and later
34980 -
34981 -_Class_:
34982 - Inquiry function
34983 -
34984 -_Syntax_:
34985 - `RESULT = SIZE(ARRAY[, DIM [, KIND]])'
34986 -
34987 -_Arguments_:
34988 - ARRAY Shall be an array of any type. If ARRAY is a
34989 - pointer it must be associated and allocatable
34990 - arrays must be allocated.
34991 - DIM (Optional) shall be a scalar of type `INTEGER'
34992 - and its value shall be in the range from 1 to
34993 - n, where n equals the rank of ARRAY.
34994 - KIND (Optional) An `INTEGER' initialization
34995 - expression indicating the kind parameter of
34996 - the result.
34997 -
34998 -_Return value_:
34999 - The return value is of type `INTEGER' and of kind KIND. If KIND is
35000 - absent, the return value is of default integer kind.
35001 -
35002 -_Example_:
35003 - PROGRAM test_size
35004 - WRITE(*,*) SIZE((/ 1, 2 /)) ! 2
35005 - END PROGRAM
35006 -
35007 -_See also_:
35008 - *note SHAPE::, *note RESHAPE::
35009 -
35010 -\1f
35011 -File: gfortran.info, Node: SIZEOF, Next: SLEEP, Prev: SIZE, Up: Intrinsic Procedures
35012 -
35013 -7.199 `SIZEOF' -- Size in bytes of an expression
35014 -================================================
35015 -
35016 -_Description_:
35017 - `SIZEOF(X)' calculates the number of bytes of storage the
35018 - expression `X' occupies.
35019 -
35020 -_Standard_:
35021 - GNU extension
35022 -
35023 -_Class_:
35024 - Intrinsic function
35025 -
35026 -_Syntax_:
35027 - `N = SIZEOF(X)'
35028 -
35029 -_Arguments_:
35030 - X The argument shall be of any type, rank or
35031 - shape.
35032 -
35033 -_Return value_:
35034 - The return value is of type integer and of the system-dependent
35035 - kind C_SIZE_T (from the ISO_C_BINDING module). Its value is the
35036 - number of bytes occupied by the argument. If the argument has the
35037 - `POINTER' attribute, the number of bytes of the storage area
35038 - pointed to is returned. If the argument is of a derived type with
35039 - `POINTER' or `ALLOCATABLE' components, the return value doesn't
35040 - account for the sizes of the data pointed to by these components.
35041 -
35042 -_Example_:
35043 - integer :: i
35044 - real :: r, s(5)
35045 - print *, (sizeof(s)/sizeof(r) == 5)
35046 - end
35047 - The example will print `.TRUE.' unless you are using a platform
35048 - where default `REAL' variables are unusually padded.
35049 -
35050 -_See also_:
35051 - *note C_SIZEOF::
35052 -
35053 -\1f
35054 -File: gfortran.info, Node: SLEEP, Next: SNGL, Prev: SIZEOF, Up: Intrinsic Procedures
35055 -
35056 -7.200 `SLEEP' -- Sleep for the specified number of seconds
35057 -==========================================================
35058 -
35059 -_Description_:
35060 - Calling this subroutine causes the process to pause for SECONDS
35061 - seconds.
35062 -
35063 -_Standard_:
35064 - GNU extension
35065 -
35066 -_Class_:
35067 - Subroutine
35068 -
35069 -_Syntax_:
35070 - `CALL SLEEP(SECONDS)'
35071 -
35072 -_Arguments_:
35073 - SECONDS The type shall be of default `INTEGER'.
35074 -
35075 -_Example_:
35076 - program test_sleep
35077 - call sleep(5)
35078 - end
35079 -
35080 -\1f
35081 -File: gfortran.info, Node: SNGL, Next: SPACING, Prev: SLEEP, Up: Intrinsic Procedures
35082 -
35083 -7.201 `SNGL' -- Convert double precision real to default real
35084 -=============================================================
35085 -
35086 -_Description_:
35087 - `SNGL(A)' converts the double precision real A to a default real
35088 - value. This is an archaic form of `REAL' that is specific to one
35089 - type for A.
35090 -
35091 -_Standard_:
35092 - Fortran 77 and later
35093 -
35094 -_Class_:
35095 - Elemental function
35096 -
35097 -_Syntax_:
35098 - `RESULT = SNGL(A)'
35099 -
35100 -_Arguments_:
35101 - A The type shall be a double precision `REAL'.
35102 -
35103 -_Return value_:
35104 - The return value is of type default `REAL'.
35105 -
35106 -_See also_:
35107 - *note DBLE::
35108 -
35109 -\1f
35110 -File: gfortran.info, Node: SPACING, Next: SPREAD, Prev: SNGL, Up: Intrinsic Procedures
35111 -
35112 -7.202 `SPACING' -- Smallest distance between two numbers of a given type
35113 -========================================================================
35114 -
35115 -_Description_:
35116 - Determines the distance between the argument X and the nearest
35117 - adjacent number of the same type.
35118 -
35119 -_Standard_:
35120 - Fortran 95 and later
35121 -
35122 -_Class_:
35123 - Elemental function
35124 -
35125 -_Syntax_:
35126 - `RESULT = SPACING(X)'
35127 -
35128 -_Arguments_:
35129 - X Shall be of type `REAL'.
35130 -
35131 -_Return value_:
35132 - The result is of the same type as the input argument X.
35133 -
35134 -_Example_:
35135 - PROGRAM test_spacing
35136 - INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
35137 - INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200)
35138 -
35139 - WRITE(*,*) spacing(1.0_SGL) ! "1.1920929E-07" on i686
35140 - WRITE(*,*) spacing(1.0_DBL) ! "2.220446049250313E-016" on i686
35141 - END PROGRAM
35142 -
35143 -_See also_:
35144 - *note RRSPACING::
35145 -
35146 -\1f
35147 -File: gfortran.info, Node: SPREAD, Next: SQRT, Prev: SPACING, Up: Intrinsic Procedures
35148 -
35149 -7.203 `SPREAD' -- Add a dimension to an array
35150 -=============================================
35151 -
35152 -_Description_:
35153 - Replicates a SOURCE array NCOPIES times along a specified
35154 - dimension DIM.
35155 -
35156 -_Standard_:
35157 - Fortran 95 and later
35158 -
35159 -_Class_:
35160 - Transformational function
35161 -
35162 -_Syntax_:
35163 - `RESULT = SPREAD(SOURCE, DIM, NCOPIES)'
35164 -
35165 -_Arguments_:
35166 - SOURCE Shall be a scalar or an array of any type and
35167 - a rank less than seven.
35168 - DIM Shall be a scalar of type `INTEGER' with a
35169 - value in the range from 1 to n+1, where n
35170 - equals the rank of SOURCE.
35171 - NCOPIES Shall be a scalar of type `INTEGER'.
35172 -
35173 -_Return value_:
35174 - The result is an array of the same type as SOURCE and has rank n+1
35175 - where n equals the rank of SOURCE.
35176 -
35177 -_Example_:
35178 - PROGRAM test_spread
35179 - INTEGER :: a = 1, b(2) = (/ 1, 2 /)
35180 - WRITE(*,*) SPREAD(A, 1, 2) ! "1 1"
35181 - WRITE(*,*) SPREAD(B, 1, 2) ! "1 1 2 2"
35182 - END PROGRAM
35183 -
35184 -_See also_:
35185 - *note UNPACK::
35186 -
35187 -\1f
35188 -File: gfortran.info, Node: SQRT, Next: SRAND, Prev: SPREAD, Up: Intrinsic Procedures
35189 -
35190 -7.204 `SQRT' -- Square-root function
35191 -====================================
35192 -
35193 -_Description_:
35194 - `SQRT(X)' computes the square root of X.
35195 -
35196 -_Standard_:
35197 - Fortran 77 and later
35198 -
35199 -_Class_:
35200 - Elemental function
35201 -
35202 -_Syntax_:
35203 - `RESULT = SQRT(X)'
35204 -
35205 -_Arguments_:
35206 - X The type shall be `REAL' or `COMPLEX'.
35207 -
35208 -_Return value_:
35209 - The return value is of type `REAL' or `COMPLEX'. The kind type
35210 - parameter is the same as X.
35211 -
35212 -_Example_:
35213 - program test_sqrt
35214 - real(8) :: x = 2.0_8
35215 - complex :: z = (1.0, 2.0)
35216 - x = sqrt(x)
35217 - z = sqrt(z)
35218 - end program test_sqrt
35219 -
35220 -_Specific names_:
35221 - Name Argument Return type Standard
35222 - `DSQRT(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
35223 - later
35224 - `CSQRT(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 95 and
35225 - X' later
35226 - `ZSQRT(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
35227 - X'
35228 - `CDSQRT(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
35229 - X'
35230 -
35231 -\1f
35232 -File: gfortran.info, Node: SRAND, Next: STAT, Prev: SQRT, Up: Intrinsic Procedures
35233 -
35234 -7.205 `SRAND' -- Reinitialize the random number generator
35235 -=========================================================
35236 -
35237 -_Description_:
35238 - `SRAND' reinitializes the pseudo-random number generator called by
35239 - `RAND' and `IRAND'. The new seed used by the generator is
35240 - specified by the required argument SEED.
35241 -
35242 -_Standard_:
35243 - GNU extension
35244 -
35245 -_Class_:
35246 - Subroutine
35247 -
35248 -_Syntax_:
35249 - `CALL SRAND(SEED)'
35250 -
35251 -_Arguments_:
35252 - SEED Shall be a scalar `INTEGER(kind=4)'.
35253 -
35254 -_Return value_:
35255 - Does not return anything.
35256 -
35257 -_Example_:
35258 - See `RAND' and `IRAND' for examples.
35259 -
35260 -_Notes_:
35261 - The Fortran 2003 standard specifies the intrinsic `RANDOM_SEED' to
35262 - initialize the pseudo-random numbers generator and `RANDOM_NUMBER'
35263 - to generate pseudo-random numbers. Please note that in GNU
35264 - Fortran, these two sets of intrinsics (`RAND', `IRAND' and `SRAND'
35265 - on the one hand, `RANDOM_NUMBER' and `RANDOM_SEED' on the other
35266 - hand) access two independent pseudo-random number generators.
35267 -
35268 -_See also_:
35269 - *note RAND::, *note RANDOM_SEED::, *note RANDOM_NUMBER::
35270 -
35271 -
35272 -\1f
35273 -File: gfortran.info, Node: STAT, Next: SUM, Prev: SRAND, Up: Intrinsic Procedures
35274 -
35275 -7.206 `STAT' -- Get file status
35276 -===============================
35277 -
35278 -_Description_:
35279 - This function returns information about a file. No permissions are
35280 - required on the file itself, but execute (search) permission is
35281 - required on all of the directories in path that lead to the file.
35282 -
35283 - The elements that are obtained and stored in the array `BUFF':
35284 - `buff(1)' Device ID
35285 - `buff(2)' Inode number
35286 - `buff(3)' File mode
35287 - `buff(4)' Number of links
35288 - `buff(5)' Owner's uid
35289 - `buff(6)' Owner's gid
35290 - `buff(7)' ID of device containing directory entry for
35291 - file (0 if not available)
35292 - `buff(8)' File size (bytes)
35293 - `buff(9)' Last access time
35294 - `buff(10)' Last modification time
35295 - `buff(11)' Last file status change time
35296 - `buff(12)' Preferred I/O block size (-1 if not available)
35297 - `buff(13)' Number of blocks allocated (-1 if not
35298 - available)
35299 -
35300 - Not all these elements are relevant on all systems. If an element
35301 - is not relevant, it is returned as 0.
35302 -
35303 - This intrinsic is provided in both subroutine and function forms;
35304 - however, only one form can be used in any given program unit.
35305 -
35306 -_Standard_:
35307 - GNU extension
35308 -
35309 -_Class_:
35310 - Subroutine, function
35311 -
35312 -_Syntax_:
35313 - `CALL STAT(FILE,BUFF[,STATUS])'
35314 -
35315 -_Arguments_:
35316 - FILE The type shall be `CHARACTER', of the default
35317 - kind and a valid path within the file system.
35318 - BUFF The type shall be `INTEGER(4), DIMENSION(13)'.
35319 - STATUS (Optional) status flag of type `INTEGER(4)'.
35320 - Returns 0 on success and a system specific
35321 - error code otherwise.
35322 -
35323 -_Example_:
35324 - PROGRAM test_stat
35325 - INTEGER, DIMENSION(13) :: buff
35326 - INTEGER :: status
35327 -
35328 - CALL STAT("/etc/passwd", buff, status)
35329 -
35330 - IF (status == 0) THEN
35331 - WRITE (*, FMT="('Device ID:', T30, I19)") buff(1)
35332 - WRITE (*, FMT="('Inode number:', T30, I19)") buff(2)
35333 - WRITE (*, FMT="('File mode (octal):', T30, O19)") buff(3)
35334 - WRITE (*, FMT="('Number of links:', T30, I19)") buff(4)
35335 - WRITE (*, FMT="('Owner''s uid:', T30, I19)") buff(5)
35336 - WRITE (*, FMT="('Owner''s gid:', T30, I19)") buff(6)
35337 - WRITE (*, FMT="('Device where located:', T30, I19)") buff(7)
35338 - WRITE (*, FMT="('File size:', T30, I19)") buff(8)
35339 - WRITE (*, FMT="('Last access time:', T30, A19)") CTIME(buff(9))
35340 - WRITE (*, FMT="('Last modification time', T30, A19)") CTIME(buff(10))
35341 - WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
35342 - WRITE (*, FMT="('Preferred block size:', T30, I19)") buff(12)
35343 - WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
35344 - END IF
35345 - END PROGRAM
35346 -
35347 -_See also_:
35348 - To stat an open file: *note FSTAT::, to stat a link: *note LSTAT::
35349 -
35350 -\1f
35351 -File: gfortran.info, Node: SUM, Next: SYMLNK, Prev: STAT, Up: Intrinsic Procedures
35352 -
35353 -7.207 `SUM' -- Sum of array elements
35354 -====================================
35355 -
35356 -_Description_:
35357 - Adds the elements of ARRAY along dimension DIM if the
35358 - corresponding element in MASK is `TRUE'.
35359 -
35360 -_Standard_:
35361 - Fortran 95 and later
35362 -
35363 -_Class_:
35364 - Transformational function
35365 -
35366 -_Syntax_:
35367 - `RESULT = SUM(ARRAY[, MASK])' `RESULT = SUM(ARRAY, DIM[, MASK])'
35368 -
35369 -_Arguments_:
35370 - ARRAY Shall be an array of type `INTEGER', `REAL' or
35371 - `COMPLEX'.
35372 - DIM (Optional) shall be a scalar of type `INTEGER'
35373 - with a value in the range from 1 to n, where n
35374 - equals the rank of ARRAY.
35375 - MASK (Optional) shall be of type `LOGICAL' and
35376 - either be a scalar or an array of the same
35377 - shape as ARRAY.
35378 -
35379 -_Return value_:
35380 - The result is of the same type as ARRAY.
35381 -
35382 - If DIM is absent, a scalar with the sum of all elements in ARRAY
35383 - is returned. Otherwise, an array of rank n-1, where n equals the
35384 - rank of ARRAY,and a shape similar to that of ARRAY with dimension
35385 - DIM dropped is returned.
35386 -
35387 -_Example_:
35388 - PROGRAM test_sum
35389 - INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /)
35390 - print *, SUM(x) ! all elements, sum = 15
35391 - print *, SUM(x, MASK=MOD(x, 2)==1) ! odd elements, sum = 9
35392 - END PROGRAM
35393 -
35394 -_See also_:
35395 - *note PRODUCT::
35396 -
35397 -\1f
35398 -File: gfortran.info, Node: SYMLNK, Next: SYSTEM, Prev: SUM, Up: Intrinsic Procedures
35399 -
35400 -7.208 `SYMLNK' -- Create a symbolic link
35401 -========================================
35402 -
35403 -_Description_:
35404 - Makes a symbolic link from file PATH1 to PATH2. A null character
35405 - (`CHAR(0)') can be used to mark the end of the names in PATH1 and
35406 - PATH2; otherwise, trailing blanks in the file names are ignored.
35407 - If the STATUS argument is supplied, it contains 0 on success or a
35408 - nonzero error code upon return; see `symlink(2)'. If the system
35409 - does not supply `symlink(2)', `ENOSYS' is returned.
35410 -
35411 - This intrinsic is provided in both subroutine and function forms;
35412 - however, only one form can be used in any given program unit.
35413 -
35414 -_Standard_:
35415 - GNU extension
35416 -
35417 -_Class_:
35418 - Subroutine, function
35419 -
35420 -_Syntax_:
35421 - `CALL SYMLNK(PATH1, PATH2 [, STATUS])'
35422 - `STATUS = SYMLNK(PATH1, PATH2)'
35423 -
35424 -_Arguments_:
35425 - PATH1 Shall be of default `CHARACTER' type.
35426 - PATH2 Shall be of default `CHARACTER' type.
35427 - STATUS (Optional) Shall be of default `INTEGER' type.
35428 -
35429 -_See also_:
35430 - *note LINK::, *note UNLINK::
35431 -
35432 -
35433 -\1f
35434 -File: gfortran.info, Node: SYSTEM, Next: SYSTEM_CLOCK, Prev: SYMLNK, Up: Intrinsic Procedures
35435 -
35436 -7.209 `SYSTEM' -- Execute a shell command
35437 -=========================================
35438 -
35439 -_Description_:
35440 - Passes the command COMMAND to a shell (see `system(3)'). If
35441 - argument STATUS is present, it contains the value returned by
35442 - `system(3)', which is presumably 0 if the shell command succeeded.
35443 - Note that which shell is used to invoke the command is
35444 - system-dependent and environment-dependent.
35445 -
35446 - This intrinsic is provided in both subroutine and function forms;
35447 - however, only one form can be used in any given program unit.
35448 -
35449 -_Standard_:
35450 - GNU extension
35451 -
35452 -_Class_:
35453 - Subroutine, function
35454 -
35455 -_Syntax_:
35456 - `CALL SYSTEM(COMMAND [, STATUS])'
35457 - `STATUS = SYSTEM(COMMAND)'
35458 -
35459 -_Arguments_:
35460 - COMMAND Shall be of default `CHARACTER' type.
35461 - STATUS (Optional) Shall be of default `INTEGER' type.
35462 -
35463 -_See also_:
35464 -
35465 -\1f
35466 -File: gfortran.info, Node: SYSTEM_CLOCK, Next: TAN, Prev: SYSTEM, Up: Intrinsic Procedures
35467 -
35468 -7.210 `SYSTEM_CLOCK' -- Time function
35469 -=====================================
35470 -
35471 -_Description_:
35472 - Determines the COUNT of milliseconds of wall clock time since the
35473 - Epoch (00:00:00 UTC, January 1, 1970) modulo COUNT_MAX, COUNT_RATE
35474 - determines the number of clock ticks per second. COUNT_RATE and
35475 - COUNT_MAX are constant and specific to `gfortran'.
35476 -
35477 - If there is no clock, COUNT is set to `-HUGE(COUNT)', and
35478 - COUNT_RATE and COUNT_MAX are set to zero
35479 -
35480 -_Standard_:
35481 - Fortran 95 and later
35482 -
35483 -_Class_:
35484 - Subroutine
35485 -
35486 -_Syntax_:
35487 - `CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])'
35488 -
35489 -_Arguments_:
35490 -
35491 -_Arguments_:
35492 - COUNT (Optional) shall be a scalar of type default
35493 - `INTEGER' with `INTENT(OUT)'.
35494 - COUNT_RATE (Optional) shall be a scalar of type default
35495 - `INTEGER' with `INTENT(OUT)'.
35496 - COUNT_MAX (Optional) shall be a scalar of type default
35497 - `INTEGER' with `INTENT(OUT)'.
35498 -
35499 -_Example_:
35500 - PROGRAM test_system_clock
35501 - INTEGER :: count, count_rate, count_max
35502 - CALL SYSTEM_CLOCK(count, count_rate, count_max)
35503 - WRITE(*,*) count, count_rate, count_max
35504 - END PROGRAM
35505 -
35506 -_See also_:
35507 - *note DATE_AND_TIME::, *note CPU_TIME::
35508 -
35509 -\1f
35510 -File: gfortran.info, Node: TAN, Next: TANH, Prev: SYSTEM_CLOCK, Up: Intrinsic Procedures
35511 -
35512 -7.211 `TAN' -- Tangent function
35513 -===============================
35514 -
35515 -_Description_:
35516 - `TAN(X)' computes the tangent of X.
35517 -
35518 -_Standard_:
35519 - Fortran 77 and later
35520 -
35521 -_Class_:
35522 - Elemental function
35523 -
35524 -_Syntax_:
35525 - `RESULT = TAN(X)'
35526 -
35527 -_Arguments_:
35528 - X The type shall be `REAL'.
35529 -
35530 -_Return value_:
35531 - The return value is of type `REAL'. The kind type parameter is
35532 - the same as X.
35533 -
35534 -_Example_:
35535 - program test_tan
35536 - real(8) :: x = 0.165_8
35537 - x = tan(x)
35538 - end program test_tan
35539 -
35540 -_Specific names_:
35541 - Name Argument Return type Standard
35542 - `DTAN(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
35543 - later
35544 -
35545 -_See also_:
35546 - *note ATAN::
35547 -
35548 -\1f
35549 -File: gfortran.info, Node: TANH, Next: TIME, Prev: TAN, Up: Intrinsic Procedures
35550 -
35551 -7.212 `TANH' -- Hyperbolic tangent function
35552 -===========================================
35553 -
35554 -_Description_:
35555 - `TANH(X)' computes the hyperbolic tangent of X.
35556 -
35557 -_Standard_:
35558 - Fortran 77 and later
35559 -
35560 -_Class_:
35561 - Elemental function
35562 -
35563 -_Syntax_:
35564 - `X = TANH(X)'
35565 -
35566 -_Arguments_:
35567 - X The type shall be `REAL'.
35568 -
35569 -_Return value_:
35570 - The return value is of type `REAL' and lies in the range - 1 \leq
35571 - tanh(x) \leq 1 .
35572 -
35573 -_Example_:
35574 - program test_tanh
35575 - real(8) :: x = 2.1_8
35576 - x = tanh(x)
35577 - end program test_tanh
35578 -
35579 -_Specific names_:
35580 - Name Argument Return type Standard
35581 - `DTANH(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
35582 - later
35583 -
35584 -_See also_:
35585 - *note ATANH::
35586 -
35587 -\1f
35588 -File: gfortran.info, Node: TIME, Next: TIME8, Prev: TANH, Up: Intrinsic Procedures
35589 -
35590 -7.213 `TIME' -- Time function
35591 -=============================
35592 -
35593 -_Description_:
35594 - Returns the current time encoded as an integer (in the manner of
35595 - the UNIX function `time(3)'). This value is suitable for passing to
35596 - `CTIME()', `GMTIME()', and `LTIME()'.
35597 -
35598 - This intrinsic is not fully portable, such as to systems with
35599 - 32-bit `INTEGER' types but supporting times wider than 32 bits.
35600 - Therefore, the values returned by this intrinsic might be, or
35601 - become, negative, or numerically less than previous values, during
35602 - a single run of the compiled program.
35603 -
35604 - See *note TIME8::, for information on a similar intrinsic that
35605 - might be portable to more GNU Fortran implementations, though to
35606 - fewer Fortran compilers.
35607 -
35608 -_Standard_:
35609 - GNU extension
35610 -
35611 -_Class_:
35612 - Function
35613 -
35614 -_Syntax_:
35615 - `RESULT = TIME()'
35616 -
35617 -_Return value_:
35618 - The return value is a scalar of type `INTEGER(4)'.
35619 -
35620 -_See also_:
35621 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
35622 - *note TIME8::
35623 -
35624 -
35625 -\1f
35626 -File: gfortran.info, Node: TIME8, Next: TINY, Prev: TIME, Up: Intrinsic Procedures
35627 -
35628 -7.214 `TIME8' -- Time function (64-bit)
35629 -=======================================
35630 -
35631 -_Description_:
35632 - Returns the current time encoded as an integer (in the manner of
35633 - the UNIX function `time(3)'). This value is suitable for passing to
35634 - `CTIME()', `GMTIME()', and `LTIME()'.
35635 -
35636 - _Warning:_ this intrinsic does not increase the range of the timing
35637 - values over that returned by `time(3)'. On a system with a 32-bit
35638 - `time(3)', `TIME8()' will return a 32-bit value, even though it is
35639 - converted to a 64-bit `INTEGER(8)' value. That means overflows of
35640 - the 32-bit value can still occur. Therefore, the values returned
35641 - by this intrinsic might be or become negative or numerically less
35642 - than previous values during a single run of the compiled program.
35643 -
35644 -_Standard_:
35645 - GNU extension
35646 -
35647 -_Class_:
35648 - Function
35649 -
35650 -_Syntax_:
35651 - `RESULT = TIME8()'
35652 -
35653 -_Return value_:
35654 - The return value is a scalar of type `INTEGER(8)'.
35655 -
35656 -_See also_:
35657 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK8::,
35658 - *note TIME::
35659 -
35660 -
35661 -\1f
35662 -File: gfortran.info, Node: TINY, Next: TRAILZ, Prev: TIME8, Up: Intrinsic Procedures
35663 -
35664 -7.215 `TINY' -- Smallest positive number of a real kind
35665 -=======================================================
35666 -
35667 -_Description_:
35668 - `TINY(X)' returns the smallest positive (non zero) number in the
35669 - model of the type of `X'.
35670 -
35671 -_Standard_:
35672 - Fortran 95 and later
35673 -
35674 -_Class_:
35675 - Inquiry function
35676 -
35677 -_Syntax_:
35678 - `RESULT = TINY(X)'
35679 -
35680 -_Arguments_:
35681 - X Shall be of type `REAL'.
35682 -
35683 -_Return value_:
35684 - The return value is of the same type and kind as X
35685 -
35686 -_Example_:
35687 - See `HUGE' for an example.
35688 -
35689 -\1f
35690 -File: gfortran.info, Node: TRAILZ, Next: TRANSFER, Prev: TINY, Up: Intrinsic Procedures
35691 -
35692 -7.216 `TRAILZ' -- Number of trailing zero bits of an integer
35693 -============================================================
35694 -
35695 -_Description_:
35696 - `TRAILZ' returns the number of trailing zero bits of an integer.
35697 -
35698 -_Standard_:
35699 - Fortran 2008 and later
35700 -
35701 -_Class_:
35702 - Elemental function
35703 -
35704 -_Syntax_:
35705 - `RESULT = TRAILZ(I)'
35706 -
35707 -_Arguments_:
35708 - I Shall be of type `INTEGER'.
35709 -
35710 -_Return value_:
35711 - The type of the return value is the default `INTEGER'. If all the
35712 - bits of `I' are zero, the result value is `BIT_SIZE(I)'.
35713 -
35714 -_Example_:
35715 - PROGRAM test_trailz
35716 - WRITE (*,*) TRAILZ(8) ! prints 3
35717 - END PROGRAM
35718 -
35719 -_See also_:
35720 - *note BIT_SIZE::, *note LEADZ::
35721 -
35722 -\1f
35723 -File: gfortran.info, Node: TRANSFER, Next: TRANSPOSE, Prev: TRAILZ, Up: Intrinsic Procedures
35724 -
35725 -7.217 `TRANSFER' -- Transfer bit patterns
35726 -=========================================
35727 -
35728 -_Description_:
35729 - Interprets the bitwise representation of SOURCE in memory as if it
35730 - is the representation of a variable or array of the same type and
35731 - type parameters as MOLD.
35732 -
35733 - This is approximately equivalent to the C concept of _casting_ one
35734 - type to another.
35735 -
35736 -_Standard_:
35737 - Fortran 95 and later
35738 -
35739 -_Class_:
35740 - Transformational function
35741 -
35742 -_Syntax_:
35743 - `RESULT = TRANSFER(SOURCE, MOLD[, SIZE])'
35744 -
35745 -_Arguments_:
35746 - SOURCE Shall be a scalar or an array of any type.
35747 - MOLD Shall be a scalar or an array of any type.
35748 - SIZE (Optional) shall be a scalar of type `INTEGER'.
35749 -
35750 -_Return value_:
35751 - The result has the same type as MOLD, with the bit level
35752 - representation of SOURCE. If SIZE is present, the result is a
35753 - one-dimensional array of length SIZE. If SIZE is absent but MOLD
35754 - is an array (of any size or shape), the result is a one-
35755 - dimensional array of the minimum length needed to contain the
35756 - entirety of the bitwise representation of SOURCE. If SIZE is
35757 - absent and MOLD is a scalar, the result is a scalar.
35758 -
35759 - If the bitwise representation of the result is longer than that of
35760 - SOURCE, then the leading bits of the result correspond to those of
35761 - SOURCE and any trailing bits are filled arbitrarily.
35762 -
35763 - When the resulting bit representation does not correspond to a
35764 - valid representation of a variable of the same type as MOLD, the
35765 - results are undefined, and subsequent operations on the result
35766 - cannot be guaranteed to produce sensible behavior. For example,
35767 - it is possible to create `LOGICAL' variables for which `VAR' and
35768 - `.NOT.VAR' both appear to be true.
35769 -
35770 -_Example_:
35771 - PROGRAM test_transfer
35772 - integer :: x = 2143289344
35773 - print *, transfer(x, 1.0) ! prints "NaN" on i686
35774 - END PROGRAM
35775 -
35776 -\1f
35777 -File: gfortran.info, Node: TRANSPOSE, Next: TRIM, Prev: TRANSFER, Up: Intrinsic Procedures
35778 -
35779 -7.218 `TRANSPOSE' -- Transpose an array of rank two
35780 -===================================================
35781 -
35782 -_Description_:
35783 - Transpose an array of rank two. Element (i, j) of the result has
35784 - the value `MATRIX(j, i)', for all i, j.
35785 -
35786 -_Standard_:
35787 - Fortran 95 and later
35788 -
35789 -_Class_:
35790 - Transformational function
35791 -
35792 -_Syntax_:
35793 - `RESULT = TRANSPOSE(MATRIX)'
35794 -
35795 -_Arguments_:
35796 - MATRIX Shall be an array of any type and have a rank
35797 - of two.
35798 -
35799 -_Return value_:
35800 - The result has the same type as MATRIX, and has shape `(/ m, n /)'
35801 - if MATRIX has shape `(/ n, m /)'.
35802 -
35803 -\1f
35804 -File: gfortran.info, Node: TRIM, Next: TTYNAM, Prev: TRANSPOSE, Up: Intrinsic Procedures
35805 -
35806 -7.219 `TRIM' -- Remove trailing blank characters of a string
35807 -============================================================
35808 -
35809 -_Description_:
35810 - Removes trailing blank characters of a string.
35811 -
35812 -_Standard_:
35813 - Fortran 95 and later
35814 -
35815 -_Class_:
35816 - Transformational function
35817 -
35818 -_Syntax_:
35819 - `RESULT = TRIM(STRING)'
35820 -
35821 -_Arguments_:
35822 - STRING Shall be a scalar of type `CHARACTER'.
35823 -
35824 -_Return value_:
35825 - A scalar of type `CHARACTER' which length is that of STRING less
35826 - the number of trailing blanks.
35827 -
35828 -_Example_:
35829 - PROGRAM test_trim
35830 - CHARACTER(len=10), PARAMETER :: s = "GFORTRAN "
35831 - WRITE(*,*) LEN(s), LEN(TRIM(s)) ! "10 8", with/without trailing blanks
35832 - END PROGRAM
35833 -
35834 -_See also_:
35835 - *note ADJUSTL::, *note ADJUSTR::
35836 -
35837 -\1f
35838 -File: gfortran.info, Node: TTYNAM, Next: UBOUND, Prev: TRIM, Up: Intrinsic Procedures
35839 -
35840 -7.220 `TTYNAM' -- Get the name of a terminal device.
35841 -====================================================
35842 -
35843 -_Description_:
35844 - Get the name of a terminal device. For more information, see
35845 - `ttyname(3)'.
35846 -
35847 - This intrinsic is provided in both subroutine and function forms;
35848 - however, only one form can be used in any given program unit.
35849 -
35850 -_Standard_:
35851 - GNU extension
35852 -
35853 -_Class_:
35854 - Subroutine, function
35855 -
35856 -_Syntax_:
35857 - `CALL TTYNAM(UNIT, NAME)'
35858 - `NAME = TTYNAM(UNIT)'
35859 -
35860 -_Arguments_:
35861 - UNIT Shall be a scalar `INTEGER'.
35862 - NAME Shall be of type `CHARACTER'.
35863 -
35864 -_Example_:
35865 - PROGRAM test_ttynam
35866 - INTEGER :: unit
35867 - DO unit = 1, 10
35868 - IF (isatty(unit=unit)) write(*,*) ttynam(unit)
35869 - END DO
35870 - END PROGRAM
35871 -
35872 -_See also_:
35873 - *note ISATTY::
35874 -
35875 -\1f
35876 -File: gfortran.info, Node: UBOUND, Next: UMASK, Prev: TTYNAM, Up: Intrinsic Procedures
35877 -
35878 -7.221 `UBOUND' -- Upper dimension bounds of an array
35879 -====================================================
35880 -
35881 -_Description_:
35882 - Returns the upper bounds of an array, or a single upper bound
35883 - along the DIM dimension.
35884 -
35885 -_Standard_:
35886 - Fortran 95 and later, with KIND argument Fortran 2003 and later
35887 -
35888 -_Class_:
35889 - Inquiry function
35890 -
35891 -_Syntax_:
35892 - `RESULT = UBOUND(ARRAY [, DIM [, KIND]])'
35893 -
35894 -_Arguments_:
35895 - ARRAY Shall be an array, of any type.
35896 - DIM (Optional) Shall be a scalar `INTEGER'.
35897 - KIND (Optional) An `INTEGER' initialization
35898 - expression indicating the kind parameter of
35899 - the result.
35900 -
35901 -_Return value_:
35902 - The return value is of type `INTEGER' and of kind KIND. If KIND is
35903 - absent, the return value is of default integer kind. If DIM is
35904 - absent, the result is an array of the upper bounds of ARRAY. If
35905 - DIM is present, the result is a scalar corresponding to the upper
35906 - bound of the array along that dimension. If ARRAY is an
35907 - expression rather than a whole array or array structure component,
35908 - or if it has a zero extent along the relevant dimension, the upper
35909 - bound is taken to be the number of elements along the relevant
35910 - dimension.
35911 -
35912 -_See also_:
35913 - *note LBOUND::
35914 -
35915 -\1f
35916 -File: gfortran.info, Node: UMASK, Next: UNLINK, Prev: UBOUND, Up: Intrinsic Procedures
35917 -
35918 -7.222 `UMASK' -- Set the file creation mask
35919 -===========================================
35920 -
35921 -_Description_:
35922 - Sets the file creation mask to MASK and returns the old value in
35923 - argument OLD if it is supplied. See `umask(2)'.
35924 -
35925 -_Standard_:
35926 - GNU extension
35927 -
35928 -_Class_:
35929 - Subroutine
35930 -
35931 -_Syntax_:
35932 - `CALL UMASK(MASK [, OLD])'
35933 -
35934 -_Arguments_:
35935 - MASK Shall be a scalar of type `INTEGER'.
35936 - MASK (Optional) Shall be a scalar of type `INTEGER'.
35937 -
35938 -
35939 -\1f
35940 -File: gfortran.info, Node: UNLINK, Next: UNPACK, Prev: UMASK, Up: Intrinsic Procedures
35941 -
35942 -7.223 `UNLINK' -- Remove a file from the file system
35943 -====================================================
35944 -
35945 -_Description_:
35946 - Unlinks the file PATH. A null character (`CHAR(0)') can be used to
35947 - mark the end of the name in PATH; otherwise, trailing blanks in
35948 - the file name are ignored. If the STATUS argument is supplied, it
35949 - contains 0 on success or a nonzero error code upon return; see
35950 - `unlink(2)'.
35951 -
35952 - This intrinsic is provided in both subroutine and function forms;
35953 - however, only one form can be used in any given program unit.
35954 -
35955 -_Standard_:
35956 - GNU extension
35957 -
35958 -_Class_:
35959 - Subroutine, function
35960 -
35961 -_Syntax_:
35962 - `CALL UNLINK(PATH [, STATUS])'
35963 - `STATUS = UNLINK(PATH)'
35964 -
35965 -_Arguments_:
35966 - PATH Shall be of default `CHARACTER' type.
35967 - STATUS (Optional) Shall be of default `INTEGER' type.
35968 -
35969 -_See also_:
35970 - *note LINK::, *note SYMLNK::
35971 -
35972 -\1f
35973 -File: gfortran.info, Node: UNPACK, Next: VERIFY, Prev: UNLINK, Up: Intrinsic Procedures
35974 -
35975 -7.224 `UNPACK' -- Unpack an array of rank one into an array
35976 -===========================================================
35977 -
35978 -_Description_:
35979 - Store the elements of VECTOR in an array of higher rank.
35980 -
35981 -_Standard_:
35982 - Fortran 95 and later
35983 -
35984 -_Class_:
35985 - Transformational function
35986 -
35987 -_Syntax_:
35988 - `RESULT = UNPACK(VECTOR, MASK, FIELD)'
35989 -
35990 -_Arguments_:
35991 - VECTOR Shall be an array of any type and rank one. It
35992 - shall have at least as many elements as MASK
35993 - has `TRUE' values.
35994 - MASK Shall be an array of type `LOGICAL'.
35995 - FIELD Shall be of the same type as VECTOR and have
35996 - the same shape as MASK.
35997 -
35998 -_Return value_:
35999 - The resulting array corresponds to FIELD with `TRUE' elements of
36000 - MASK replaced by values from VECTOR in array element order.
36001 -
36002 -_Example_:
36003 - PROGRAM test_unpack
36004 - integer :: vector(2) = (/1,1/)
36005 - logical :: mask(4) = (/ .TRUE., .FALSE., .FALSE., .TRUE. /)
36006 - integer :: field(2,2) = 0, unity(2,2)
36007 -
36008 - ! result: unity matrix
36009 - unity = unpack(vector, reshape(mask, (/2,2/)), field)
36010 - END PROGRAM
36011 -
36012 -_See also_:
36013 - *note PACK::, *note SPREAD::
36014 -
36015 -\1f
36016 -File: gfortran.info, Node: VERIFY, Next: XOR, Prev: UNPACK, Up: Intrinsic Procedures
36017 -
36018 -7.225 `VERIFY' -- Scan a string for the absence of a set of characters
36019 -======================================================================
36020 -
36021 -_Description_:
36022 - Verifies that all the characters in a SET are present in a STRING.
36023 -
36024 - If BACK is either absent or equals `FALSE', this function returns
36025 - the position of the leftmost character of STRING that is not in
36026 - SET. If BACK equals `TRUE', the rightmost position is returned. If
36027 - all characters of SET are found in STRING, the result is zero.
36028 -
36029 -_Standard_:
36030 - Fortran 95 and later, with KIND argument Fortran 2003 and later
36031 -
36032 -_Class_:
36033 - Elemental function
36034 -
36035 -_Syntax_:
36036 - `RESULT = VERIFY(STRING, SET[, BACK [, KIND]])'
36037 -
36038 -_Arguments_:
36039 - STRING Shall be of type `CHARACTER'.
36040 - SET Shall be of type `CHARACTER'.
36041 - BACK (Optional) shall be of type `LOGICAL'.
36042 - KIND (Optional) An `INTEGER' initialization
36043 - expression indicating the kind parameter of
36044 - the result.
36045 -
36046 -_Return value_:
36047 - The return value is of type `INTEGER' and of kind KIND. If KIND is
36048 - absent, the return value is of default integer kind.
36049 -
36050 -_Example_:
36051 - PROGRAM test_verify
36052 - WRITE(*,*) VERIFY("FORTRAN", "AO") ! 1, found 'F'
36053 - WRITE(*,*) VERIFY("FORTRAN", "FOO") ! 3, found 'R'
36054 - WRITE(*,*) VERIFY("FORTRAN", "C++") ! 1, found 'F'
36055 - WRITE(*,*) VERIFY("FORTRAN", "C++", .TRUE.) ! 7, found 'N'
36056 - WRITE(*,*) VERIFY("FORTRAN", "FORTRAN") ! 0' found none
36057 - END PROGRAM
36058 -
36059 -_See also_:
36060 - *note SCAN::, *note INDEX intrinsic::
36061 -
36062 -\1f
36063 -File: gfortran.info, Node: XOR, Prev: VERIFY, Up: Intrinsic Procedures
36064 -
36065 -7.226 `XOR' -- Bitwise logical exclusive OR
36066 -===========================================
36067 -
36068 -_Description_:
36069 - Bitwise logical exclusive or.
36070 -
36071 - This intrinsic routine is provided for backwards compatibility with
36072 - GNU Fortran 77. For integer arguments, programmers should consider
36073 - the use of the *note IEOR:: intrinsic defined by the Fortran
36074 - standard.
36075 -
36076 -_Standard_:
36077 - GNU extension
36078 -
36079 -_Class_:
36080 - Function
36081 -
36082 -_Syntax_:
36083 - `RESULT = XOR(X, Y)'
36084 -
36085 -_Arguments_:
36086 - X The type shall be either a scalar `INTEGER'
36087 - type or a scalar `LOGICAL' type.
36088 - Y The type shall be the same as the type of I.
36089 -
36090 -_Return value_:
36091 - The return type is either a scalar `INTEGER' or a scalar
36092 - `LOGICAL'. If the kind type parameters differ, then the smaller
36093 - kind type is implicitly converted to larger kind, and the return
36094 - has the larger kind.
36095 -
36096 -_Example_:
36097 - PROGRAM test_xor
36098 - LOGICAL :: T = .TRUE., F = .FALSE.
36099 - INTEGER :: a, b
36100 - DATA a / Z'F' /, b / Z'3' /
36101 -
36102 - WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
36103 - WRITE (*,*) XOR(a, b)
36104 - END PROGRAM
36105 -
36106 -_See also_:
36107 - Fortran 95 elemental function: *note IEOR::
36108 -
36109 -\1f
36110 -File: gfortran.info, Node: Intrinsic Modules, Next: Contributing, Prev: Intrinsic Procedures, Up: Top
36111 -
36112 -8 Intrinsic Modules
36113 -*******************
36114 -
36115 -8.1 `ISO_FORTRAN_ENV'
36116 -=====================
36117 -
36118 -_Standard_:
36119 - Fortran 2003 and later
36120 -
36121 - The `ISO_FORTRAN_ENV' module provides the following scalar
36122 -default-integer named constants:
36123 -
36124 -`CHARACTER_STORAGE_SIZE':
36125 - Size in bits of the character storage unit.
36126 -
36127 -`ERROR_UNIT':
36128 - Identifies the preconnected unit used for error reporting.
36129 -
36130 -`FILE_STORAGE_SIZE':
36131 - Size in bits of the file-storage unit.
36132 -
36133 -`INPUT_UNIT':
36134 - Identifies the preconnected unit identified by the asterisk (`*')
36135 - in `READ' statement.
36136 -
36137 -`IOSTAT_END':
36138 - The value assigned to the variable passed to the IOSTAT= specifier
36139 - of an input/output statement if an end-of-file condition occurred.
36140 -
36141 -`IOSTAT_EOR':
36142 - The value assigned to the variable passed to the IOSTAT= specifier
36143 - of an input/output statement if an end-of-record condition
36144 - occurred.
36145 -
36146 -`NUMERIC_STORAGE_SIZE':
36147 - The size in bits of the numeric storage unit.
36148 -
36149 -`OUTPUT_UNIT':
36150 - Identifies the preconnected unit identified by the asterisk (`*')
36151 - in `WRITE' statement.
36152 -
36153 -8.2 `ISO_C_BINDING'
36154 -===================
36155 -
36156 -_Standard_:
36157 - Fortran 2003 and later, GNU extensions
36158 -
36159 - The following intrinsic procedures are provided by the module; their
36160 -definition can be found in the section Intrinsic Procedures of this
36161 -manual.
36162 -
36163 -`C_ASSOCIATED'
36164 -
36165 -`C_F_POINTER'
36166 -
36167 -`C_F_PROCPOINTER'
36168 -
36169 -`C_FUNLOC'
36170 -
36171 -`C_LOC'
36172 -
36173 - The `ISO_C_BINDING' module provides the following named constants of
36174 -the type integer, which can be used as KIND type parameter. Note that
36175 -GNU Fortran currently does not support the `C_INT_FAST...' KIND type
36176 -parameters (marked by an asterisk (`*') in the list below). The
36177 -`C_INT_FAST...' parameters have therefore the value -2 and cannot be
36178 -used as KIND type parameter of the `INTEGER' type.
36179 -
36180 - In addition to the integer named constants required by the Fortran
36181 -2003 standard, GNU Fortran provides as an extension named constants for
36182 -the 128-bit integer types supported by the C compiler: `C_INT128_T,
36183 -C_INT_LEAST128_T, C_INT_FAST128_T'.
36184 -
36185 -Fortran Named constant C type Extension
36186 -Type
36187 -`INTEGER' `C_INT' `int'
36188 -`INTEGER' `C_SHORT' `short int'
36189 -`INTEGER' `C_LONG' `long int'
36190 -`INTEGER' `C_LONG_LONG' `long long int'
36191 -`INTEGER' `C_SIGNED_CHAR' `signed char'/`unsigned
36192 - char'
36193 -`INTEGER' `C_SIZE_T' `size_t'
36194 -`INTEGER' `C_INT8_T' `int8_t'
36195 -`INTEGER' `C_INT16_T' `int16_t'
36196 -`INTEGER' `C_INT32_T' `int32_t'
36197 -`INTEGER' `C_INT64_T' `int64_t'
36198 -`INTEGER' `C_INT128_T' `int128_t' Ext.
36199 -`INTEGER' `C_INT_LEAST8_T' `int_least8_t'
36200 -`INTEGER' `C_INT_LEAST16_T' `int_least16_t'
36201 -`INTEGER' `C_INT_LEAST32_T' `int_least32_t'
36202 -`INTEGER' `C_INT_LEAST64_T' `int_least64_t'
36203 -`INTEGER' `C_INT_LEAST128_T' `int_least128_t' Ext.
36204 -`INTEGER' `C_INT_FAST8_T'* `int_fast8_t'
36205 -`INTEGER' `C_INT_FAST16_T'* `int_fast16_t'
36206 -`INTEGER' `C_INT_FAST32_T'* `int_fast32_t'
36207 -`INTEGER' `C_INT_FAST64_T'* `int_fast64_t'
36208 -`INTEGER' `C_INT_FAST128_T'* `int_fast128_t' Ext.
36209 -`INTEGER' `C_INTMAX_T' `intmax_t'
36210 -`INTEGER' `C_INTPTR_T' `intptr_t'
36211 -`REAL' `C_FLOAT' `float'
36212 -`REAL' `C_DOUBLE' `double'
36213 -`REAL' `C_LONG_DOUBLE' `long double'
36214 -`COMPLEX' `C_FLOAT_COMPLEX' `float _Complex'
36215 -`COMPLEX' `C_DOUBLE_COMPLEX' `double _Complex'
36216 -`COMPLEX' `C_LONG_DOUBLE_COMPLEX' `long double _Complex'
36217 -`LOGICAL' `C_BOOL' `_Bool'
36218 -`CHARACTER' `C_CHAR' `char'
36219 -
36220 - Additionally, the following `(CHARACTER(KIND=C_CHAR))' are defined.
36221 -
36222 -Name C definition Value
36223 -`C_NULL_CHAR' null character `'\0''
36224 -`C_ALERT' alert `'\a''
36225 -`C_BACKSPACE' backspace `'\b''
36226 -`C_FORM_FEED' form feed `'\f''
36227 -`C_NEW_LINE' new line `'\n''
36228 -`C_CARRIAGE_RETURN'carriage return `'\r''
36229 -`C_HORIZONTAL_TAB'horizontal tab `'\t''
36230 -`C_VERTICAL_TAB'vertical tab `'\v''
36231 -
36232 -8.3 OpenMP Modules `OMP_LIB' and `OMP_LIB_KINDS'
36233 -================================================
36234 -
36235 -_Standard_:
36236 - OpenMP Application Program Interface v3.0
36237 -
36238 - The OpenMP Fortran runtime library routines are provided both in a
36239 -form of two Fortran 90 modules, named `OMP_LIB' and `OMP_LIB_KINDS',
36240 -and in a form of a Fortran `include' file named `omp_lib.h'. The
36241 -procedures provided by `OMP_LIB' can be found in the *note
36242 -Introduction: (libgomp)Top. manual, the named constants defined in the
36243 -`OMP_LIB_KINDS' module are listed below.
36244 -
36245 - For details refer to the actual OpenMP Application Program Interface
36246 -v3.0 (http://www.openmp.org/mp-documents/spec30.pdf).
36247 -
36248 - `OMP_LIB_KINDS' provides the following scalar default-integer named
36249 -constants:
36250 -
36251 -`omp_integer_kind'
36252 -
36253 -`omp_logical_kind'
36254 -
36255 -`omp_lock_kind'
36256 -
36257 -`omp_nest_lock_kind'
36258 -
36259 -`omp_sched_kind'
36260 -
36261 -\1f
36262 -File: gfortran.info, Node: Contributing, Next: Copying, Prev: Intrinsic Modules, Up: Top
36263 -
36264 -Contributing
36265 -************
36266 -
36267 -Free software is only possible if people contribute to efforts to
36268 -create it. We're always in need of more people helping out with ideas
36269 -and comments, writing documentation and contributing code.
36270 -
36271 - If you want to contribute to GNU Fortran, have a look at the long
36272 -lists of projects you can take on. Some of these projects are small,
36273 -some of them are large; some are completely orthogonal to the rest of
36274 -what is happening on GNU Fortran, but others are "mainstream" projects
36275 -in need of enthusiastic hackers. All of these projects are important!
36276 -We'll eventually get around to the things here, but they are also
36277 -things doable by someone who is willing and able.
36278 -
36279 -* Menu:
36280 -
36281 -* Contributors::
36282 -* Projects::
36283 -* Proposed Extensions::
36284 -
36285 -\1f
36286 -File: gfortran.info, Node: Contributors, Next: Projects, Up: Contributing
36287 -
36288 -Contributors to GNU Fortran
36289 -===========================
36290 -
36291 -Most of the parser was hand-crafted by _Andy Vaught_, who is also the
36292 -initiator of the whole project. Thanks Andy! Most of the interface
36293 -with GCC was written by _Paul Brook_.
36294 -
36295 - The following individuals have contributed code and/or ideas and
36296 -significant help to the GNU Fortran project (in alphabetical order):
36297 -
36298 - - Janne Blomqvist
36299 -
36300 - - Steven Bosscher
36301 -
36302 - - Paul Brook
36303 -
36304 - - Tobias Burnus
36305 -
36306 - - Franc,ois-Xavier Coudert
36307 -
36308 - - Bud Davis
36309 -
36310 - - Jerry DeLisle
36311 -
36312 - - Erik Edelmann
36313 -
36314 - - Bernhard Fischer
36315 -
36316 - - Daniel Franke
36317 -
36318 - - Richard Guenther
36319 -
36320 - - Richard Henderson
36321 -
36322 - - Katherine Holcomb
36323 -
36324 - - Jakub Jelinek
36325 -
36326 - - Niels Kristian Bech Jensen
36327 -
36328 - - Steven Johnson
36329 -
36330 - - Steven G. Kargl
36331 -
36332 - - Thomas Koenig
36333 -
36334 - - Asher Langton
36335 -
36336 - - H. J. Lu
36337 -
36338 - - Toon Moene
36339 -
36340 - - Brooks Moses
36341 -
36342 - - Andrew Pinski
36343 -
36344 - - Tim Prince
36345 -
36346 - - Christopher D. Rickett
36347 -
36348 - - Richard Sandiford
36349 -
36350 - - Tobias Schlu"ter
36351 -
36352 - - Roger Sayle
36353 -
36354 - - Paul Thomas
36355 -
36356 - - Andy Vaught
36357 -
36358 - - Feng Wang
36359 -
36360 - - Janus Weil
36361 -
36362 - The following people have contributed bug reports, smaller or larger
36363 -patches, and much needed feedback and encouragement for the GNU Fortran
36364 -project:
36365 -
36366 - - Bill Clodius
36367 -
36368 - - Dominique d'Humie`res
36369 -
36370 - - Kate Hedstrom
36371 -
36372 - - Erik Schnetter
36373 -
36374 - Many other individuals have helped debug, test and improve the GNU
36375 -Fortran compiler over the past few years, and we welcome you to do the
36376 -same! If you already have done so, and you would like to see your name
36377 -listed in the list above, please contact us.
36378 -
36379 -\1f
36380 -File: gfortran.info, Node: Projects, Next: Proposed Extensions, Prev: Contributors, Up: Contributing
36381 -
36382 -Projects
36383 -========
36384 -
36385 -_Help build the test suite_
36386 - Solicit more code for donation to the test suite: the more
36387 - extensive the testsuite, the smaller the risk of breaking things
36388 - in the future! We can keep code private on request.
36389 -
36390 -_Bug hunting/squishing_
36391 - Find bugs and write more test cases! Test cases are especially very
36392 - welcome, because it allows us to concentrate on fixing bugs
36393 - instead of isolating them. Going through the bugzilla database at
36394 - `http://gcc.gnu.org/bugzilla/' to reduce testcases posted there and
36395 - add more information (for example, for which version does the
36396 - testcase work, for which versions does it fail?) is also very
36397 - helpful.
36398 -
36399 -
36400 -\1f
36401 -File: gfortran.info, Node: Proposed Extensions, Prev: Projects, Up: Contributing
36402 -
36403 -Proposed Extensions
36404 -===================
36405 -
36406 -Here's a list of proposed extensions for the GNU Fortran compiler, in
36407 -no particular order. Most of these are necessary to be fully
36408 -compatible with existing Fortran compilers, but they are not part of
36409 -the official J3 Fortran 95 standard.
36410 -
36411 -Compiler extensions:
36412 ---------------------
36413 -
36414 - * User-specified alignment rules for structures.
36415 -
36416 - * Flag to generate `Makefile' info.
36417 -
36418 - * Automatically extend single precision constants to double.
36419 -
36420 - * Compile code that conserves memory by dynamically allocating
36421 - common and module storage either on stack or heap.
36422 -
36423 - * Compile flag to generate code for array conformance checking
36424 - (suggest -CC).
36425 -
36426 - * User control of symbol names (underscores, etc).
36427 -
36428 - * Compile setting for maximum size of stack frame size before
36429 - spilling parts to static or heap.
36430 -
36431 - * Flag to force local variables into static space.
36432 -
36433 - * Flag to force local variables onto stack.
36434 -
36435 -Environment Options
36436 --------------------
36437 -
36438 - * Pluggable library modules for random numbers, linear algebra. LA
36439 - should use BLAS calling conventions.
36440 -
36441 - * Environment variables controlling actions on arithmetic exceptions
36442 - like overflow, underflow, precision loss--Generate NaN, abort,
36443 - default. action.
36444 -
36445 - * Set precision for fp units that support it (i387).
36446 -
36447 - * Variable for setting fp rounding mode.
36448 -
36449 - * Variable to fill uninitialized variables with a user-defined bit
36450 - pattern.
36451 -
36452 - * Environment variable controlling filename that is opened for that
36453 - unit number.
36454 -
36455 - * Environment variable to clear/trash memory being freed.
36456 -
36457 - * Environment variable to control tracing of allocations and frees.
36458 -
36459 - * Environment variable to display allocated memory at normal program
36460 - end.
36461 -
36462 - * Environment variable for filename for * IO-unit.
36463 -
36464 - * Environment variable for temporary file directory.
36465 -
36466 - * Environment variable forcing standard output to be line buffered
36467 - (unix).
36468 -
36469 -
36470 -\1f
36471 -File: gfortran.info, Node: Copying, Next: GNU Free Documentation License, Prev: Contributing, Up: Top
36472 -
36473 -GNU General Public License
36474 -**************************
36475 -
36476 - Version 3, 29 June 2007
36477 -
36478 - Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'
36479 -
36480 - Everyone is permitted to copy and distribute verbatim copies of this
36481 - license document, but changing it is not allowed.
36482 -
36483 -Preamble
36484 -========
36485 -
36486 -The GNU General Public License is a free, copyleft license for software
36487 -and other kinds of works.
36488 -
36489 - The licenses for most software and other practical works are designed
36490 -to take away your freedom to share and change the works. By contrast,
36491 -the GNU General Public License is intended to guarantee your freedom to
36492 -share and change all versions of a program-to make sure it remains free
36493 -software for all its users. We, the Free Software Foundation, use the
36494 -GNU General Public License for most of our software; it applies also to
36495 -any other work released this way by its authors. You can apply it to
36496 -your programs, too.
36497 -
36498 - When we speak of free software, we are referring to freedom, not
36499 -price. Our General Public Licenses are designed to make sure that you
36500 -have the freedom to distribute copies of free software (and charge for
36501 -them if you wish), that you receive source code or can get it if you
36502 -want it, that you can change the software or use pieces of it in new
36503 -free programs, and that you know you can do these things.
36504 -
36505 - To protect your rights, we need to prevent others from denying you
36506 -these rights or asking you to surrender the rights. Therefore, you
36507 -have certain responsibilities if you distribute copies of the software,
36508 -or if you modify it: responsibilities to respect the freedom of others.
36509 -
36510 - For example, if you distribute copies of such a program, whether
36511 -gratis or for a fee, you must pass on to the recipients the same
36512 -freedoms that you received. You must make sure that they, too, receive
36513 -or can get the source code. And you must show them these terms so they
36514 -know their rights.
36515 -
36516 - Developers that use the GNU GPL protect your rights with two steps:
36517 -(1) assert copyright on the software, and (2) offer you this License
36518 -giving you legal permission to copy, distribute and/or modify it.
36519 -
36520 - For the developers' and authors' protection, the GPL clearly explains
36521 -that there is no warranty for this free software. For both users' and
36522 -authors' sake, the GPL requires that modified versions be marked as
36523 -changed, so that their problems will not be attributed erroneously to
36524 -authors of previous versions.
36525 -
36526 - Some devices are designed to deny users access to install or run
36527 -modified versions of the software inside them, although the
36528 -manufacturer can do so. This is fundamentally incompatible with the
36529 -aim of protecting users' freedom to change the software. The
36530 -systematic pattern of such abuse occurs in the area of products for
36531 -individuals to use, which is precisely where it is most unacceptable.
36532 -Therefore, we have designed this version of the GPL to prohibit the
36533 -practice for those products. If such problems arise substantially in
36534 -other domains, we stand ready to extend this provision to those domains
36535 -in future versions of the GPL, as needed to protect the freedom of
36536 -users.
36537 -
36538 - Finally, every program is threatened constantly by software patents.
36539 -States should not allow patents to restrict development and use of
36540 -software on general-purpose computers, but in those that do, we wish to
36541 -avoid the special danger that patents applied to a free program could
36542 -make it effectively proprietary. To prevent this, the GPL assures that
36543 -patents cannot be used to render the program non-free.
36544 -
36545 - The precise terms and conditions for copying, distribution and
36546 -modification follow.
36547 -
36548 -TERMS AND CONDITIONS
36549 -====================
36550 -
36551 - 0. Definitions.
36552 -
36553 - "This License" refers to version 3 of the GNU General Public
36554 - License.
36555 -
36556 - "Copyright" also means copyright-like laws that apply to other
36557 - kinds of works, such as semiconductor masks.
36558 -
36559 - "The Program" refers to any copyrightable work licensed under this
36560 - License. Each licensee is addressed as "you". "Licensees" and
36561 - "recipients" may be individuals or organizations.
36562 -
36563 - To "modify" a work means to copy from or adapt all or part of the
36564 - work in a fashion requiring copyright permission, other than the
36565 - making of an exact copy. The resulting work is called a "modified
36566 - version" of the earlier work or a work "based on" the earlier work.
36567 -
36568 - A "covered work" means either the unmodified Program or a work
36569 - based on the Program.
36570 -
36571 - To "propagate" a work means to do anything with it that, without
36572 - permission, would make you directly or secondarily liable for
36573 - infringement under applicable copyright law, except executing it
36574 - on a computer or modifying a private copy. Propagation includes
36575 - copying, distribution (with or without modification), making
36576 - available to the public, and in some countries other activities as
36577 - well.
36578 -
36579 - To "convey" a work means any kind of propagation that enables other
36580 - parties to make or receive copies. Mere interaction with a user
36581 - through a computer network, with no transfer of a copy, is not
36582 - conveying.
36583 -
36584 - An interactive user interface displays "Appropriate Legal Notices"
36585 - to the extent that it includes a convenient and prominently visible
36586 - feature that (1) displays an appropriate copyright notice, and (2)
36587 - tells the user that there is no warranty for the work (except to
36588 - the extent that warranties are provided), that licensees may
36589 - convey the work under this License, and how to view a copy of this
36590 - License. If the interface presents a list of user commands or
36591 - options, such as a menu, a prominent item in the list meets this
36592 - criterion.
36593 -
36594 - 1. Source Code.
36595 -
36596 - The "source code" for a work means the preferred form of the work
36597 - for making modifications to it. "Object code" means any
36598 - non-source form of a work.
36599 -
36600 - A "Standard Interface" means an interface that either is an
36601 - official standard defined by a recognized standards body, or, in
36602 - the case of interfaces specified for a particular programming
36603 - language, one that is widely used among developers working in that
36604 - language.
36605 -
36606 - The "System Libraries" of an executable work include anything,
36607 - other than the work as a whole, that (a) is included in the normal
36608 - form of packaging a Major Component, but which is not part of that
36609 - Major Component, and (b) serves only to enable use of the work
36610 - with that Major Component, or to implement a Standard Interface
36611 - for which an implementation is available to the public in source
36612 - code form. A "Major Component", in this context, means a major
36613 - essential component (kernel, window system, and so on) of the
36614 - specific operating system (if any) on which the executable work
36615 - runs, or a compiler used to produce the work, or an object code
36616 - interpreter used to run it.
36617 -
36618 - The "Corresponding Source" for a work in object code form means all
36619 - the source code needed to generate, install, and (for an executable
36620 - work) run the object code and to modify the work, including
36621 - scripts to control those activities. However, it does not include
36622 - the work's System Libraries, or general-purpose tools or generally
36623 - available free programs which are used unmodified in performing
36624 - those activities but which are not part of the work. For example,
36625 - Corresponding Source includes interface definition files
36626 - associated with source files for the work, and the source code for
36627 - shared libraries and dynamically linked subprograms that the work
36628 - is specifically designed to require, such as by intimate data
36629 - communication or control flow between those subprograms and other
36630 - parts of the work.
36631 -
36632 - The Corresponding Source need not include anything that users can
36633 - regenerate automatically from other parts of the Corresponding
36634 - Source.
36635 -
36636 - The Corresponding Source for a work in source code form is that
36637 - same work.
36638 -
36639 - 2. Basic Permissions.
36640 -
36641 - All rights granted under this License are granted for the term of
36642 - copyright on the Program, and are irrevocable provided the stated
36643 - conditions are met. This License explicitly affirms your unlimited
36644 - permission to run the unmodified Program. The output from running
36645 - a covered work is covered by this License only if the output,
36646 - given its content, constitutes a covered work. This License
36647 - acknowledges your rights of fair use or other equivalent, as
36648 - provided by copyright law.
36649 -
36650 - You may make, run and propagate covered works that you do not
36651 - convey, without conditions so long as your license otherwise
36652 - remains in force. You may convey covered works to others for the
36653 - sole purpose of having them make modifications exclusively for
36654 - you, or provide you with facilities for running those works,
36655 - provided that you comply with the terms of this License in
36656 - conveying all material for which you do not control copyright.
36657 - Those thus making or running the covered works for you must do so
36658 - exclusively on your behalf, under your direction and control, on
36659 - terms that prohibit them from making any copies of your
36660 - copyrighted material outside their relationship with you.
36661 -
36662 - Conveying under any other circumstances is permitted solely under
36663 - the conditions stated below. Sublicensing is not allowed; section
36664 - 10 makes it unnecessary.
36665 -
36666 - 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
36667 -
36668 - No covered work shall be deemed part of an effective technological
36669 - measure under any applicable law fulfilling obligations under
36670 - article 11 of the WIPO copyright treaty adopted on 20 December
36671 - 1996, or similar laws prohibiting or restricting circumvention of
36672 - such measures.
36673 -
36674 - When you convey a covered work, you waive any legal power to forbid
36675 - circumvention of technological measures to the extent such
36676 - circumvention is effected by exercising rights under this License
36677 - with respect to the covered work, and you disclaim any intention
36678 - to limit operation or modification of the work as a means of
36679 - enforcing, against the work's users, your or third parties' legal
36680 - rights to forbid circumvention of technological measures.
36681 -
36682 - 4. Conveying Verbatim Copies.
36683 -
36684 - You may convey verbatim copies of the Program's source code as you
36685 - receive it, in any medium, provided that you conspicuously and
36686 - appropriately publish on each copy an appropriate copyright notice;
36687 - keep intact all notices stating that this License and any
36688 - non-permissive terms added in accord with section 7 apply to the
36689 - code; keep intact all notices of the absence of any warranty; and
36690 - give all recipients a copy of this License along with the Program.
36691 -
36692 - You may charge any price or no price for each copy that you convey,
36693 - and you may offer support or warranty protection for a fee.
36694 -
36695 - 5. Conveying Modified Source Versions.
36696 -
36697 - You may convey a work based on the Program, or the modifications to
36698 - produce it from the Program, in the form of source code under the
36699 - terms of section 4, provided that you also meet all of these
36700 - conditions:
36701 -
36702 - a. The work must carry prominent notices stating that you
36703 - modified it, and giving a relevant date.
36704 -
36705 - b. The work must carry prominent notices stating that it is
36706 - released under this License and any conditions added under
36707 - section 7. This requirement modifies the requirement in
36708 - section 4 to "keep intact all notices".
36709 -
36710 - c. You must license the entire work, as a whole, under this
36711 - License to anyone who comes into possession of a copy. This
36712 - License will therefore apply, along with any applicable
36713 - section 7 additional terms, to the whole of the work, and all
36714 - its parts, regardless of how they are packaged. This License
36715 - gives no permission to license the work in any other way, but
36716 - it does not invalidate such permission if you have separately
36717 - received it.
36718 -
36719 - d. If the work has interactive user interfaces, each must display
36720 - Appropriate Legal Notices; however, if the Program has
36721 - interactive interfaces that do not display Appropriate Legal
36722 - Notices, your work need not make them do so.
36723 -
36724 - A compilation of a covered work with other separate and independent
36725 - works, which are not by their nature extensions of the covered
36726 - work, and which are not combined with it such as to form a larger
36727 - program, in or on a volume of a storage or distribution medium, is
36728 - called an "aggregate" if the compilation and its resulting
36729 - copyright are not used to limit the access or legal rights of the
36730 - compilation's users beyond what the individual works permit.
36731 - Inclusion of a covered work in an aggregate does not cause this
36732 - License to apply to the other parts of the aggregate.
36733 -
36734 - 6. Conveying Non-Source Forms.
36735 -
36736 - You may convey a covered work in object code form under the terms
36737 - of sections 4 and 5, provided that you also convey the
36738 - machine-readable Corresponding Source under the terms of this
36739 - License, in one of these ways:
36740 -
36741 - a. Convey the object code in, or embodied in, a physical product
36742 - (including a physical distribution medium), accompanied by the
36743 - Corresponding Source fixed on a durable physical medium
36744 - customarily used for software interchange.
36745 -
36746 - b. Convey the object code in, or embodied in, a physical product
36747 - (including a physical distribution medium), accompanied by a
36748 - written offer, valid for at least three years and valid for
36749 - as long as you offer spare parts or customer support for that
36750 - product model, to give anyone who possesses the object code
36751 - either (1) a copy of the Corresponding Source for all the
36752 - software in the product that is covered by this License, on a
36753 - durable physical medium customarily used for software
36754 - interchange, for a price no more than your reasonable cost of
36755 - physically performing this conveying of source, or (2) access
36756 - to copy the Corresponding Source from a network server at no
36757 - charge.
36758 -
36759 - c. Convey individual copies of the object code with a copy of
36760 - the written offer to provide the Corresponding Source. This
36761 - alternative is allowed only occasionally and noncommercially,
36762 - and only if you received the object code with such an offer,
36763 - in accord with subsection 6b.
36764 -
36765 - d. Convey the object code by offering access from a designated
36766 - place (gratis or for a charge), and offer equivalent access
36767 - to the Corresponding Source in the same way through the same
36768 - place at no further charge. You need not require recipients
36769 - to copy the Corresponding Source along with the object code.
36770 - If the place to copy the object code is a network server, the
36771 - Corresponding Source may be on a different server (operated
36772 - by you or a third party) that supports equivalent copying
36773 - facilities, provided you maintain clear directions next to
36774 - the object code saying where to find the Corresponding Source.
36775 - Regardless of what server hosts the Corresponding Source, you
36776 - remain obligated to ensure that it is available for as long
36777 - as needed to satisfy these requirements.
36778 -
36779 - e. Convey the object code using peer-to-peer transmission,
36780 - provided you inform other peers where the object code and
36781 - Corresponding Source of the work are being offered to the
36782 - general public at no charge under subsection 6d.
36783 -
36784 -
36785 - A separable portion of the object code, whose source code is
36786 - excluded from the Corresponding Source as a System Library, need
36787 - not be included in conveying the object code work.
36788 -
36789 - A "User Product" is either (1) a "consumer product", which means
36790 - any tangible personal property which is normally used for personal,
36791 - family, or household purposes, or (2) anything designed or sold for
36792 - incorporation into a dwelling. In determining whether a product
36793 - is a consumer product, doubtful cases shall be resolved in favor of
36794 - coverage. For a particular product received by a particular user,
36795 - "normally used" refers to a typical or common use of that class of
36796 - product, regardless of the status of the particular user or of the
36797 - way in which the particular user actually uses, or expects or is
36798 - expected to use, the product. A product is a consumer product
36799 - regardless of whether the product has substantial commercial,
36800 - industrial or non-consumer uses, unless such uses represent the
36801 - only significant mode of use of the product.
36802 -
36803 - "Installation Information" for a User Product means any methods,
36804 - procedures, authorization keys, or other information required to
36805 - install and execute modified versions of a covered work in that
36806 - User Product from a modified version of its Corresponding Source.
36807 - The information must suffice to ensure that the continued
36808 - functioning of the modified object code is in no case prevented or
36809 - interfered with solely because modification has been made.
36810 -
36811 - If you convey an object code work under this section in, or with,
36812 - or specifically for use in, a User Product, and the conveying
36813 - occurs as part of a transaction in which the right of possession
36814 - and use of the User Product is transferred to the recipient in
36815 - perpetuity or for a fixed term (regardless of how the transaction
36816 - is characterized), the Corresponding Source conveyed under this
36817 - section must be accompanied by the Installation Information. But
36818 - this requirement does not apply if neither you nor any third party
36819 - retains the ability to install modified object code on the User
36820 - Product (for example, the work has been installed in ROM).
36821 -
36822 - The requirement to provide Installation Information does not
36823 - include a requirement to continue to provide support service,
36824 - warranty, or updates for a work that has been modified or
36825 - installed by the recipient, or for the User Product in which it
36826 - has been modified or installed. Access to a network may be denied
36827 - when the modification itself materially and adversely affects the
36828 - operation of the network or violates the rules and protocols for
36829 - communication across the network.
36830 -
36831 - Corresponding Source conveyed, and Installation Information
36832 - provided, in accord with this section must be in a format that is
36833 - publicly documented (and with an implementation available to the
36834 - public in source code form), and must require no special password
36835 - or key for unpacking, reading or copying.
36836 -
36837 - 7. Additional Terms.
36838 -
36839 - "Additional permissions" are terms that supplement the terms of
36840 - this License by making exceptions from one or more of its
36841 - conditions. Additional permissions that are applicable to the
36842 - entire Program shall be treated as though they were included in
36843 - this License, to the extent that they are valid under applicable
36844 - law. If additional permissions apply only to part of the Program,
36845 - that part may be used separately under those permissions, but the
36846 - entire Program remains governed by this License without regard to
36847 - the additional permissions.
36848 -
36849 - When you convey a copy of a covered work, you may at your option
36850 - remove any additional permissions from that copy, or from any part
36851 - of it. (Additional permissions may be written to require their own
36852 - removal in certain cases when you modify the work.) You may place
36853 - additional permissions on material, added by you to a covered work,
36854 - for which you have or can give appropriate copyright permission.
36855 -
36856 - Notwithstanding any other provision of this License, for material
36857 - you add to a covered work, you may (if authorized by the copyright
36858 - holders of that material) supplement the terms of this License
36859 - with terms:
36860 -
36861 - a. Disclaiming warranty or limiting liability differently from
36862 - the terms of sections 15 and 16 of this License; or
36863 -
36864 - b. Requiring preservation of specified reasonable legal notices
36865 - or author attributions in that material or in the Appropriate
36866 - Legal Notices displayed by works containing it; or
36867 -
36868 - c. Prohibiting misrepresentation of the origin of that material,
36869 - or requiring that modified versions of such material be
36870 - marked in reasonable ways as different from the original
36871 - version; or
36872 -
36873 - d. Limiting the use for publicity purposes of names of licensors
36874 - or authors of the material; or
36875 -
36876 - e. Declining to grant rights under trademark law for use of some
36877 - trade names, trademarks, or service marks; or
36878 -
36879 - f. Requiring indemnification of licensors and authors of that
36880 - material by anyone who conveys the material (or modified
36881 - versions of it) with contractual assumptions of liability to
36882 - the recipient, for any liability that these contractual
36883 - assumptions directly impose on those licensors and authors.
36884 -
36885 - All other non-permissive additional terms are considered "further
36886 - restrictions" within the meaning of section 10. If the Program as
36887 - you received it, or any part of it, contains a notice stating that
36888 - it is governed by this License along with a term that is a further
36889 - restriction, you may remove that term. If a license document
36890 - contains a further restriction but permits relicensing or
36891 - conveying under this License, you may add to a covered work
36892 - material governed by the terms of that license document, provided
36893 - that the further restriction does not survive such relicensing or
36894 - conveying.
36895 -
36896 - If you add terms to a covered work in accord with this section, you
36897 - must place, in the relevant source files, a statement of the
36898 - additional terms that apply to those files, or a notice indicating
36899 - where to find the applicable terms.
36900 -
36901 - Additional terms, permissive or non-permissive, may be stated in
36902 - the form of a separately written license, or stated as exceptions;
36903 - the above requirements apply either way.
36904 -
36905 - 8. Termination.
36906 -
36907 - You may not propagate or modify a covered work except as expressly
36908 - provided under this License. Any attempt otherwise to propagate or
36909 - modify it is void, and will automatically terminate your rights
36910 - under this License (including any patent licenses granted under
36911 - the third paragraph of section 11).
36912 -
36913 - However, if you cease all violation of this License, then your
36914 - license from a particular copyright holder is reinstated (a)
36915 - provisionally, unless and until the copyright holder explicitly
36916 - and finally terminates your license, and (b) permanently, if the
36917 - copyright holder fails to notify you of the violation by some
36918 - reasonable means prior to 60 days after the cessation.
36919 -
36920 - Moreover, your license from a particular copyright holder is
36921 - reinstated permanently if the copyright holder notifies you of the
36922 - violation by some reasonable means, this is the first time you have
36923 - received notice of violation of this License (for any work) from
36924 - that copyright holder, and you cure the violation prior to 30 days
36925 - after your receipt of the notice.
36926 -
36927 - Termination of your rights under this section does not terminate
36928 - the licenses of parties who have received copies or rights from
36929 - you under this License. If your rights have been terminated and
36930 - not permanently reinstated, you do not qualify to receive new
36931 - licenses for the same material under section 10.
36932 -
36933 - 9. Acceptance Not Required for Having Copies.
36934 -
36935 - You are not required to accept this License in order to receive or
36936 - run a copy of the Program. Ancillary propagation of a covered work
36937 - occurring solely as a consequence of using peer-to-peer
36938 - transmission to receive a copy likewise does not require
36939 - acceptance. However, nothing other than this License grants you
36940 - permission to propagate or modify any covered work. These actions
36941 - infringe copyright if you do not accept this License. Therefore,
36942 - by modifying or propagating a covered work, you indicate your
36943 - acceptance of this License to do so.
36944 -
36945 - 10. Automatic Licensing of Downstream Recipients.
36946 -
36947 - Each time you convey a covered work, the recipient automatically
36948 - receives a license from the original licensors, to run, modify and
36949 - propagate that work, subject to this License. You are not
36950 - responsible for enforcing compliance by third parties with this
36951 - License.
36952 -
36953 - An "entity transaction" is a transaction transferring control of an
36954 - organization, or substantially all assets of one, or subdividing an
36955 - organization, or merging organizations. If propagation of a
36956 - covered work results from an entity transaction, each party to that
36957 - transaction who receives a copy of the work also receives whatever
36958 - licenses to the work the party's predecessor in interest had or
36959 - could give under the previous paragraph, plus a right to
36960 - possession of the Corresponding Source of the work from the
36961 - predecessor in interest, if the predecessor has it or can get it
36962 - with reasonable efforts.
36963 -
36964 - You may not impose any further restrictions on the exercise of the
36965 - rights granted or affirmed under this License. For example, you
36966 - may not impose a license fee, royalty, or other charge for
36967 - exercise of rights granted under this License, and you may not
36968 - initiate litigation (including a cross-claim or counterclaim in a
36969 - lawsuit) alleging that any patent claim is infringed by making,
36970 - using, selling, offering for sale, or importing the Program or any
36971 - portion of it.
36972 -
36973 - 11. Patents.
36974 -
36975 - A "contributor" is a copyright holder who authorizes use under this
36976 - License of the Program or a work on which the Program is based.
36977 - The work thus licensed is called the contributor's "contributor
36978 - version".
36979 -
36980 - A contributor's "essential patent claims" are all patent claims
36981 - owned or controlled by the contributor, whether already acquired or
36982 - hereafter acquired, that would be infringed by some manner,
36983 - permitted by this License, of making, using, or selling its
36984 - contributor version, but do not include claims that would be
36985 - infringed only as a consequence of further modification of the
36986 - contributor version. For purposes of this definition, "control"
36987 - includes the right to grant patent sublicenses in a manner
36988 - consistent with the requirements of this License.
36989 -
36990 - Each contributor grants you a non-exclusive, worldwide,
36991 - royalty-free patent license under the contributor's essential
36992 - patent claims, to make, use, sell, offer for sale, import and
36993 - otherwise run, modify and propagate the contents of its
36994 - contributor version.
36995 -
36996 - In the following three paragraphs, a "patent license" is any
36997 - express agreement or commitment, however denominated, not to
36998 - enforce a patent (such as an express permission to practice a
36999 - patent or covenant not to sue for patent infringement). To
37000 - "grant" such a patent license to a party means to make such an
37001 - agreement or commitment not to enforce a patent against the party.
37002 -
37003 - If you convey a covered work, knowingly relying on a patent
37004 - license, and the Corresponding Source of the work is not available
37005 - for anyone to copy, free of charge and under the terms of this
37006 - License, through a publicly available network server or other
37007 - readily accessible means, then you must either (1) cause the
37008 - Corresponding Source to be so available, or (2) arrange to deprive
37009 - yourself of the benefit of the patent license for this particular
37010 - work, or (3) arrange, in a manner consistent with the requirements
37011 - of this License, to extend the patent license to downstream
37012 - recipients. "Knowingly relying" means you have actual knowledge
37013 - that, but for the patent license, your conveying the covered work
37014 - in a country, or your recipient's use of the covered work in a
37015 - country, would infringe one or more identifiable patents in that
37016 - country that you have reason to believe are valid.
37017 -
37018 - If, pursuant to or in connection with a single transaction or
37019 - arrangement, you convey, or propagate by procuring conveyance of, a
37020 - covered work, and grant a patent license to some of the parties
37021 - receiving the covered work authorizing them to use, propagate,
37022 - modify or convey a specific copy of the covered work, then the
37023 - patent license you grant is automatically extended to all
37024 - recipients of the covered work and works based on it.
37025 -
37026 - A patent license is "discriminatory" if it does not include within
37027 - the scope of its coverage, prohibits the exercise of, or is
37028 - conditioned on the non-exercise of one or more of the rights that
37029 - are specifically granted under this License. You may not convey a
37030 - covered work if you are a party to an arrangement with a third
37031 - party that is in the business of distributing software, under
37032 - which you make payment to the third party based on the extent of
37033 - your activity of conveying the work, and under which the third
37034 - party grants, to any of the parties who would receive the covered
37035 - work from you, a discriminatory patent license (a) in connection
37036 - with copies of the covered work conveyed by you (or copies made
37037 - from those copies), or (b) primarily for and in connection with
37038 - specific products or compilations that contain the covered work,
37039 - unless you entered into that arrangement, or that patent license
37040 - was granted, prior to 28 March 2007.
37041 -
37042 - Nothing in this License shall be construed as excluding or limiting
37043 - any implied license or other defenses to infringement that may
37044 - otherwise be available to you under applicable patent law.
37045 -
37046 - 12. No Surrender of Others' Freedom.
37047 -
37048 - If conditions are imposed on you (whether by court order,
37049 - agreement or otherwise) that contradict the conditions of this
37050 - License, they do not excuse you from the conditions of this
37051 - License. If you cannot convey a covered work so as to satisfy
37052 - simultaneously your obligations under this License and any other
37053 - pertinent obligations, then as a consequence you may not convey it
37054 - at all. For example, if you agree to terms that obligate you to
37055 - collect a royalty for further conveying from those to whom you
37056 - convey the Program, the only way you could satisfy both those
37057 - terms and this License would be to refrain entirely from conveying
37058 - the Program.
37059 -
37060 - 13. Use with the GNU Affero General Public License.
37061 -
37062 - Notwithstanding any other provision of this License, you have
37063 - permission to link or combine any covered work with a work licensed
37064 - under version 3 of the GNU Affero General Public License into a
37065 - single combined work, and to convey the resulting work. The terms
37066 - of this License will continue to apply to the part which is the
37067 - covered work, but the special requirements of the GNU Affero
37068 - General Public License, section 13, concerning interaction through
37069 - a network will apply to the combination as such.
37070 -
37071 - 14. Revised Versions of this License.
37072 -
37073 - The Free Software Foundation may publish revised and/or new
37074 - versions of the GNU General Public License from time to time.
37075 - Such new versions will be similar in spirit to the present
37076 - version, but may differ in detail to address new problems or
37077 - concerns.
37078 -
37079 - Each version is given a distinguishing version number. If the
37080 - Program specifies that a certain numbered version of the GNU
37081 - General Public License "or any later version" applies to it, you
37082 - have the option of following the terms and conditions either of
37083 - that numbered version or of any later version published by the
37084 - Free Software Foundation. If the Program does not specify a
37085 - version number of the GNU General Public License, you may choose
37086 - any version ever published by the Free Software Foundation.
37087 -
37088 - If the Program specifies that a proxy can decide which future
37089 - versions of the GNU General Public License can be used, that
37090 - proxy's public statement of acceptance of a version permanently
37091 - authorizes you to choose that version for the Program.
37092 -
37093 - Later license versions may give you additional or different
37094 - permissions. However, no additional obligations are imposed on any
37095 - author or copyright holder as a result of your choosing to follow a
37096 - later version.
37097 -
37098 - 15. Disclaimer of Warranty.
37099 -
37100 - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
37101 - APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
37102 - COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
37103 - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
37104 - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
37105 - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
37106 - RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
37107 - SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
37108 - NECESSARY SERVICING, REPAIR OR CORRECTION.
37109 -
37110 - 16. Limitation of Liability.
37111 -
37112 - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
37113 - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
37114 - AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
37115 - FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
37116 - CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
37117 - THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
37118 - BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
37119 - PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
37120 - PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
37121 - THE POSSIBILITY OF SUCH DAMAGES.
37122 -
37123 - 17. Interpretation of Sections 15 and 16.
37124 -
37125 - If the disclaimer of warranty and limitation of liability provided
37126 - above cannot be given local legal effect according to their terms,
37127 - reviewing courts shall apply local law that most closely
37128 - approximates an absolute waiver of all civil liability in
37129 - connection with the Program, unless a warranty or assumption of
37130 - liability accompanies a copy of the Program in return for a fee.
37131 -
37132 -
37133 -END OF TERMS AND CONDITIONS
37134 -===========================
37135 -
37136 -How to Apply These Terms to Your New Programs
37137 -=============================================
37138 -
37139 -If you develop a new program, and you want it to be of the greatest
37140 -possible use to the public, the best way to achieve this is to make it
37141 -free software which everyone can redistribute and change under these
37142 -terms.
37143 -
37144 - To do so, attach the following notices to the program. It is safest
37145 -to attach them to the start of each source file to most effectively
37146 -state the exclusion of warranty; and each file should have at least the
37147 -"copyright" line and a pointer to where the full notice is found.
37148 -
37149 - ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
37150 - Copyright (C) YEAR NAME OF AUTHOR
37151 -
37152 - This program is free software: you can redistribute it and/or modify
37153 - it under the terms of the GNU General Public License as published by
37154 - the Free Software Foundation, either version 3 of the License, or (at
37155 - your option) any later version.
37156 -
37157 - This program is distributed in the hope that it will be useful, but
37158 - WITHOUT ANY WARRANTY; without even the implied warranty of
37159 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37160 - General Public License for more details.
37161 -
37162 - You should have received a copy of the GNU General Public License
37163 - along with this program. If not, see `http://www.gnu.org/licenses/'.
37164 -
37165 - Also add information on how to contact you by electronic and paper
37166 -mail.
37167 -
37168 - If the program does terminal interaction, make it output a short
37169 -notice like this when it starts in an interactive mode:
37170 -
37171 - PROGRAM Copyright (C) YEAR NAME OF AUTHOR
37172 - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
37173 - This is free software, and you are welcome to redistribute it
37174 - under certain conditions; type `show c' for details.
37175 -
37176 - The hypothetical commands `show w' and `show c' should show the
37177 -appropriate parts of the General Public License. Of course, your
37178 -program's commands might be different; for a GUI interface, you would
37179 -use an "about box".
37180 -
37181 - You should also get your employer (if you work as a programmer) or
37182 -school, if any, to sign a "copyright disclaimer" for the program, if
37183 -necessary. For more information on this, and how to apply and follow
37184 -the GNU GPL, see `http://www.gnu.org/licenses/'.
37185 -
37186 - The GNU General Public License does not permit incorporating your
37187 -program into proprietary programs. If your program is a subroutine
37188 -library, you may consider it more useful to permit linking proprietary
37189 -applications with the library. If this is what you want to do, use the
37190 -GNU Lesser General Public License instead of this License. But first,
37191 -please read `http://www.gnu.org/philosophy/why-not-lgpl.html'.
37192 -
37193 -\1f
37194 -File: gfortran.info, Node: GNU Free Documentation License, Next: Funding, Prev: Copying, Up: Top
37195 -
37196 -GNU Free Documentation License
37197 -******************************
37198 -
37199 - Version 1.2, November 2002
37200 -
37201 - Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
37202 - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
37203 -
37204 - Everyone is permitted to copy and distribute verbatim copies
37205 - of this license document, but changing it is not allowed.
37206 -
37207 - 0. PREAMBLE
37208 -
37209 - The purpose of this License is to make a manual, textbook, or other
37210 - functional and useful document "free" in the sense of freedom: to
37211 - assure everyone the effective freedom to copy and redistribute it,
37212 - with or without modifying it, either commercially or
37213 - noncommercially. Secondarily, this License preserves for the
37214 - author and publisher a way to get credit for their work, while not
37215 - being considered responsible for modifications made by others.
37216 -
37217 - This License is a kind of "copyleft", which means that derivative
37218 - works of the document must themselves be free in the same sense.
37219 - It complements the GNU General Public License, which is a copyleft
37220 - license designed for free software.
37221 -
37222 - We have designed this License in order to use it for manuals for
37223 - free software, because free software needs free documentation: a
37224 - free program should come with manuals providing the same freedoms
37225 - that the software does. But this License is not limited to
37226 - software manuals; it can be used for any textual work, regardless
37227 - of subject matter or whether it is published as a printed book.
37228 - We recommend this License principally for works whose purpose is
37229 - instruction or reference.
37230 -
37231 - 1. APPLICABILITY AND DEFINITIONS
37232 -
37233 - This License applies to any manual or other work, in any medium,
37234 - that contains a notice placed by the copyright holder saying it
37235 - can be distributed under the terms of this License. Such a notice
37236 - grants a world-wide, royalty-free license, unlimited in duration,
37237 - to use that work under the conditions stated herein. The
37238 - "Document", below, refers to any such manual or work. Any member
37239 - of the public is a licensee, and is addressed as "you". You
37240 - accept the license if you copy, modify or distribute the work in a
37241 - way requiring permission under copyright law.
37242 -
37243 - A "Modified Version" of the Document means any work containing the
37244 - Document or a portion of it, either copied verbatim, or with
37245 - modifications and/or translated into another language.
37246 -
37247 - A "Secondary Section" is a named appendix or a front-matter section
37248 - of the Document that deals exclusively with the relationship of the
37249 - publishers or authors of the Document to the Document's overall
37250 - subject (or to related matters) and contains nothing that could
37251 - fall directly within that overall subject. (Thus, if the Document
37252 - is in part a textbook of mathematics, a Secondary Section may not
37253 - explain any mathematics.) The relationship could be a matter of
37254 - historical connection with the subject or with related matters, or
37255 - of legal, commercial, philosophical, ethical or political position
37256 - regarding them.
37257 -
37258 - The "Invariant Sections" are certain Secondary Sections whose
37259 - titles are designated, as being those of Invariant Sections, in
37260 - the notice that says that the Document is released under this
37261 - License. If a section does not fit the above definition of
37262 - Secondary then it is not allowed to be designated as Invariant.
37263 - The Document may contain zero Invariant Sections. If the Document
37264 - does not identify any Invariant Sections then there are none.
37265 -
37266 - The "Cover Texts" are certain short passages of text that are
37267 - listed, as Front-Cover Texts or Back-Cover Texts, in the notice
37268 - that says that the Document is released under this License. A
37269 - Front-Cover Text may be at most 5 words, and a Back-Cover Text may
37270 - be at most 25 words.
37271 -
37272 - A "Transparent" copy of the Document means a machine-readable copy,
37273 - represented in a format whose specification is available to the
37274 - general public, that is suitable for revising the document
37275 - straightforwardly with generic text editors or (for images
37276 - composed of pixels) generic paint programs or (for drawings) some
37277 - widely available drawing editor, and that is suitable for input to
37278 - text formatters or for automatic translation to a variety of
37279 - formats suitable for input to text formatters. A copy made in an
37280 - otherwise Transparent file format whose markup, or absence of
37281 - markup, has been arranged to thwart or discourage subsequent
37282 - modification by readers is not Transparent. An image format is
37283 - not Transparent if used for any substantial amount of text. A
37284 - copy that is not "Transparent" is called "Opaque".
37285 -
37286 - Examples of suitable formats for Transparent copies include plain
37287 - ASCII without markup, Texinfo input format, LaTeX input format,
37288 - SGML or XML using a publicly available DTD, and
37289 - standard-conforming simple HTML, PostScript or PDF designed for
37290 - human modification. Examples of transparent image formats include
37291 - PNG, XCF and JPG. Opaque formats include proprietary formats that
37292 - can be read and edited only by proprietary word processors, SGML or
37293 - XML for which the DTD and/or processing tools are not generally
37294 - available, and the machine-generated HTML, PostScript or PDF
37295 - produced by some word processors for output purposes only.
37296 -
37297 - The "Title Page" means, for a printed book, the title page itself,
37298 - plus such following pages as are needed to hold, legibly, the
37299 - material this License requires to appear in the title page. For
37300 - works in formats which do not have any title page as such, "Title
37301 - Page" means the text near the most prominent appearance of the
37302 - work's title, preceding the beginning of the body of the text.
37303 -
37304 - A section "Entitled XYZ" means a named subunit of the Document
37305 - whose title either is precisely XYZ or contains XYZ in parentheses
37306 - following text that translates XYZ in another language. (Here XYZ
37307 - stands for a specific section name mentioned below, such as
37308 - "Acknowledgements", "Dedications", "Endorsements", or "History".)
37309 - To "Preserve the Title" of such a section when you modify the
37310 - Document means that it remains a section "Entitled XYZ" according
37311 - to this definition.
37312 -
37313 - The Document may include Warranty Disclaimers next to the notice
37314 - which states that this License applies to the Document. These
37315 - Warranty Disclaimers are considered to be included by reference in
37316 - this License, but only as regards disclaiming warranties: any other
37317 - implication that these Warranty Disclaimers may have is void and
37318 - has no effect on the meaning of this License.
37319 -
37320 - 2. VERBATIM COPYING
37321 -
37322 - You may copy and distribute the Document in any medium, either
37323 - commercially or noncommercially, provided that this License, the
37324 - copyright notices, and the license notice saying this License
37325 - applies to the Document are reproduced in all copies, and that you
37326 - add no other conditions whatsoever to those of this License. You
37327 - may not use technical measures to obstruct or control the reading
37328 - or further copying of the copies you make or distribute. However,
37329 - you may accept compensation in exchange for copies. If you
37330 - distribute a large enough number of copies you must also follow
37331 - the conditions in section 3.
37332 -
37333 - You may also lend copies, under the same conditions stated above,
37334 - and you may publicly display copies.
37335 -
37336 - 3. COPYING IN QUANTITY
37337 -
37338 - If you publish printed copies (or copies in media that commonly
37339 - have printed covers) of the Document, numbering more than 100, and
37340 - the Document's license notice requires Cover Texts, you must
37341 - enclose the copies in covers that carry, clearly and legibly, all
37342 - these Cover Texts: Front-Cover Texts on the front cover, and
37343 - Back-Cover Texts on the back cover. Both covers must also clearly
37344 - and legibly identify you as the publisher of these copies. The
37345 - front cover must present the full title with all words of the
37346 - title equally prominent and visible. You may add other material
37347 - on the covers in addition. Copying with changes limited to the
37348 - covers, as long as they preserve the title of the Document and
37349 - satisfy these conditions, can be treated as verbatim copying in
37350 - other respects.
37351 -
37352 - If the required texts for either cover are too voluminous to fit
37353 - legibly, you should put the first ones listed (as many as fit
37354 - reasonably) on the actual cover, and continue the rest onto
37355 - adjacent pages.
37356 -
37357 - If you publish or distribute Opaque copies of the Document
37358 - numbering more than 100, you must either include a
37359 - machine-readable Transparent copy along with each Opaque copy, or
37360 - state in or with each Opaque copy a computer-network location from
37361 - which the general network-using public has access to download
37362 - using public-standard network protocols a complete Transparent
37363 - copy of the Document, free of added material. If you use the
37364 - latter option, you must take reasonably prudent steps, when you
37365 - begin distribution of Opaque copies in quantity, to ensure that
37366 - this Transparent copy will remain thus accessible at the stated
37367 - location until at least one year after the last time you
37368 - distribute an Opaque copy (directly or through your agents or
37369 - retailers) of that edition to the public.
37370 -
37371 - It is requested, but not required, that you contact the authors of
37372 - the Document well before redistributing any large number of
37373 - copies, to give them a chance to provide you with an updated
37374 - version of the Document.
37375 -
37376 - 4. MODIFICATIONS
37377 -
37378 - You may copy and distribute a Modified Version of the Document
37379 - under the conditions of sections 2 and 3 above, provided that you
37380 - release the Modified Version under precisely this License, with
37381 - the Modified Version filling the role of the Document, thus
37382 - licensing distribution and modification of the Modified Version to
37383 - whoever possesses a copy of it. In addition, you must do these
37384 - things in the Modified Version:
37385 -
37386 - A. Use in the Title Page (and on the covers, if any) a title
37387 - distinct from that of the Document, and from those of
37388 - previous versions (which should, if there were any, be listed
37389 - in the History section of the Document). You may use the
37390 - same title as a previous version if the original publisher of
37391 - that version gives permission.
37392 -
37393 - B. List on the Title Page, as authors, one or more persons or
37394 - entities responsible for authorship of the modifications in
37395 - the Modified Version, together with at least five of the
37396 - principal authors of the Document (all of its principal
37397 - authors, if it has fewer than five), unless they release you
37398 - from this requirement.
37399 -
37400 - C. State on the Title page the name of the publisher of the
37401 - Modified Version, as the publisher.
37402 -
37403 - D. Preserve all the copyright notices of the Document.
37404 -
37405 - E. Add an appropriate copyright notice for your modifications
37406 - adjacent to the other copyright notices.
37407 -
37408 - F. Include, immediately after the copyright notices, a license
37409 - notice giving the public permission to use the Modified
37410 - Version under the terms of this License, in the form shown in
37411 - the Addendum below.
37412 -
37413 - G. Preserve in that license notice the full lists of Invariant
37414 - Sections and required Cover Texts given in the Document's
37415 - license notice.
37416 -
37417 - H. Include an unaltered copy of this License.
37418 -
37419 - I. Preserve the section Entitled "History", Preserve its Title,
37420 - and add to it an item stating at least the title, year, new
37421 - authors, and publisher of the Modified Version as given on
37422 - the Title Page. If there is no section Entitled "History" in
37423 - the Document, create one stating the title, year, authors,
37424 - and publisher of the Document as given on its Title Page,
37425 - then add an item describing the Modified Version as stated in
37426 - the previous sentence.
37427 -
37428 - J. Preserve the network location, if any, given in the Document
37429 - for public access to a Transparent copy of the Document, and
37430 - likewise the network locations given in the Document for
37431 - previous versions it was based on. These may be placed in
37432 - the "History" section. You may omit a network location for a
37433 - work that was published at least four years before the
37434 - Document itself, or if the original publisher of the version
37435 - it refers to gives permission.
37436 -
37437 - K. For any section Entitled "Acknowledgements" or "Dedications",
37438 - Preserve the Title of the section, and preserve in the
37439 - section all the substance and tone of each of the contributor
37440 - acknowledgements and/or dedications given therein.
37441 -
37442 - L. Preserve all the Invariant Sections of the Document,
37443 - unaltered in their text and in their titles. Section numbers
37444 - or the equivalent are not considered part of the section
37445 - titles.
37446 -
37447 - M. Delete any section Entitled "Endorsements". Such a section
37448 - may not be included in the Modified Version.
37449 -
37450 - N. Do not retitle any existing section to be Entitled
37451 - "Endorsements" or to conflict in title with any Invariant
37452 - Section.
37453 -
37454 - O. Preserve any Warranty Disclaimers.
37455 -
37456 - If the Modified Version includes new front-matter sections or
37457 - appendices that qualify as Secondary Sections and contain no
37458 - material copied from the Document, you may at your option
37459 - designate some or all of these sections as invariant. To do this,
37460 - add their titles to the list of Invariant Sections in the Modified
37461 - Version's license notice. These titles must be distinct from any
37462 - other section titles.
37463 -
37464 - You may add a section Entitled "Endorsements", provided it contains
37465 - nothing but endorsements of your Modified Version by various
37466 - parties--for example, statements of peer review or that the text
37467 - has been approved by an organization as the authoritative
37468 - definition of a standard.
37469 -
37470 - You may add a passage of up to five words as a Front-Cover Text,
37471 - and a passage of up to 25 words as a Back-Cover Text, to the end
37472 - of the list of Cover Texts in the Modified Version. Only one
37473 - passage of Front-Cover Text and one of Back-Cover Text may be
37474 - added by (or through arrangements made by) any one entity. If the
37475 - Document already includes a cover text for the same cover,
37476 - previously added by you or by arrangement made by the same entity
37477 - you are acting on behalf of, you may not add another; but you may
37478 - replace the old one, on explicit permission from the previous
37479 - publisher that added the old one.
37480 -
37481 - The author(s) and publisher(s) of the Document do not by this
37482 - License give permission to use their names for publicity for or to
37483 - assert or imply endorsement of any Modified Version.
37484 -
37485 - 5. COMBINING DOCUMENTS
37486 -
37487 - You may combine the Document with other documents released under
37488 - this License, under the terms defined in section 4 above for
37489 - modified versions, provided that you include in the combination
37490 - all of the Invariant Sections of all of the original documents,
37491 - unmodified, and list them all as Invariant Sections of your
37492 - combined work in its license notice, and that you preserve all
37493 - their Warranty Disclaimers.
37494 -
37495 - The combined work need only contain one copy of this License, and
37496 - multiple identical Invariant Sections may be replaced with a single
37497 - copy. If there are multiple Invariant Sections with the same name
37498 - but different contents, make the title of each such section unique
37499 - by adding at the end of it, in parentheses, the name of the
37500 - original author or publisher of that section if known, or else a
37501 - unique number. Make the same adjustment to the section titles in
37502 - the list of Invariant Sections in the license notice of the
37503 - combined work.
37504 -
37505 - In the combination, you must combine any sections Entitled
37506 - "History" in the various original documents, forming one section
37507 - Entitled "History"; likewise combine any sections Entitled
37508 - "Acknowledgements", and any sections Entitled "Dedications". You
37509 - must delete all sections Entitled "Endorsements."
37510 -
37511 - 6. COLLECTIONS OF DOCUMENTS
37512 -
37513 - You may make a collection consisting of the Document and other
37514 - documents released under this License, and replace the individual
37515 - copies of this License in the various documents with a single copy
37516 - that is included in the collection, provided that you follow the
37517 - rules of this License for verbatim copying of each of the
37518 - documents in all other respects.
37519 -
37520 - You may extract a single document from such a collection, and
37521 - distribute it individually under this License, provided you insert
37522 - a copy of this License into the extracted document, and follow
37523 - this License in all other respects regarding verbatim copying of
37524 - that document.
37525 -
37526 - 7. AGGREGATION WITH INDEPENDENT WORKS
37527 -
37528 - A compilation of the Document or its derivatives with other
37529 - separate and independent documents or works, in or on a volume of
37530 - a storage or distribution medium, is called an "aggregate" if the
37531 - copyright resulting from the compilation is not used to limit the
37532 - legal rights of the compilation's users beyond what the individual
37533 - works permit. When the Document is included in an aggregate, this
37534 - License does not apply to the other works in the aggregate which
37535 - are not themselves derivative works of the Document.
37536 -
37537 - If the Cover Text requirement of section 3 is applicable to these
37538 - copies of the Document, then if the Document is less than one half
37539 - of the entire aggregate, the Document's Cover Texts may be placed
37540 - on covers that bracket the Document within the aggregate, or the
37541 - electronic equivalent of covers if the Document is in electronic
37542 - form. Otherwise they must appear on printed covers that bracket
37543 - the whole aggregate.
37544 -
37545 - 8. TRANSLATION
37546 -
37547 - Translation is considered a kind of modification, so you may
37548 - distribute translations of the Document under the terms of section
37549 - 4. Replacing Invariant Sections with translations requires special
37550 - permission from their copyright holders, but you may include
37551 - translations of some or all Invariant Sections in addition to the
37552 - original versions of these Invariant Sections. You may include a
37553 - translation of this License, and all the license notices in the
37554 - Document, and any Warranty Disclaimers, provided that you also
37555 - include the original English version of this License and the
37556 - original versions of those notices and disclaimers. In case of a
37557 - disagreement between the translation and the original version of
37558 - this License or a notice or disclaimer, the original version will
37559 - prevail.
37560 -
37561 - If a section in the Document is Entitled "Acknowledgements",
37562 - "Dedications", or "History", the requirement (section 4) to
37563 - Preserve its Title (section 1) will typically require changing the
37564 - actual title.
37565 -
37566 - 9. TERMINATION
37567 -
37568 - You may not copy, modify, sublicense, or distribute the Document
37569 - except as expressly provided for under this License. Any other
37570 - attempt to copy, modify, sublicense or distribute the Document is
37571 - void, and will automatically terminate your rights under this
37572 - License. However, parties who have received copies, or rights,
37573 - from you under this License will not have their licenses
37574 - terminated so long as such parties remain in full compliance.
37575 -
37576 - 10. FUTURE REVISIONS OF THIS LICENSE
37577 -
37578 - The Free Software Foundation may publish new, revised versions of
37579 - the GNU Free Documentation License from time to time. Such new
37580 - versions will be similar in spirit to the present version, but may
37581 - differ in detail to address new problems or concerns. See
37582 - `http://www.gnu.org/copyleft/'.
37583 -
37584 - Each version of the License is given a distinguishing version
37585 - number. If the Document specifies that a particular numbered
37586 - version of this License "or any later version" applies to it, you
37587 - have the option of following the terms and conditions either of
37588 - that specified version or of any later version that has been
37589 - published (not as a draft) by the Free Software Foundation. If
37590 - the Document does not specify a version number of this License,
37591 - you may choose any version ever published (not as a draft) by the
37592 - Free Software Foundation.
37593 -
37594 -ADDENDUM: How to use this License for your documents
37595 -====================================================
37596 -
37597 -To use this License in a document you have written, include a copy of
37598 -the License in the document and put the following copyright and license
37599 -notices just after the title page:
37600 -
37601 - Copyright (C) YEAR YOUR NAME.
37602 - Permission is granted to copy, distribute and/or modify this document
37603 - under the terms of the GNU Free Documentation License, Version 1.2
37604 - or any later version published by the Free Software Foundation;
37605 - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
37606 - Texts. A copy of the license is included in the section entitled ``GNU
37607 - Free Documentation License''.
37608 -
37609 - If you have Invariant Sections, Front-Cover Texts and Back-Cover
37610 -Texts, replace the "with...Texts." line with this:
37611 -
37612 - with the Invariant Sections being LIST THEIR TITLES, with
37613 - the Front-Cover Texts being LIST, and with the Back-Cover Texts
37614 - being LIST.
37615 -
37616 - If you have Invariant Sections without Cover Texts, or some other
37617 -combination of the three, merge those two alternatives to suit the
37618 -situation.
37619 -
37620 - If your document contains nontrivial examples of program code, we
37621 -recommend releasing these examples in parallel under your choice of
37622 -free software license, such as the GNU General Public License, to
37623 -permit their use in free software.
37624 -
37625 -\1f
37626 -File: gfortran.info, Node: Funding, Next: Option Index, Prev: GNU Free Documentation License, Up: Top
37627 -
37628 -Funding Free Software
37629 -*********************
37630 -
37631 -If you want to have more free software a few years from now, it makes
37632 -sense for you to help encourage people to contribute funds for its
37633 -development. The most effective approach known is to encourage
37634 -commercial redistributors to donate.
37635 -
37636 - Users of free software systems can boost the pace of development by
37637 -encouraging for-a-fee distributors to donate part of their selling price
37638 -to free software developers--the Free Software Foundation, and others.
37639 -
37640 - The way to convince distributors to do this is to demand it and
37641 -expect it from them. So when you compare distributors, judge them
37642 -partly by how much they give to free software development. Show
37643 -distributors they must compete to be the one who gives the most.
37644 -
37645 - To make this approach work, you must insist on numbers that you can
37646 -compare, such as, "We will donate ten dollars to the Frobnitz project
37647 -for each disk sold." Don't be satisfied with a vague promise, such as
37648 -"A portion of the profits are donated," since it doesn't give a basis
37649 -for comparison.
37650 -
37651 - Even a precise fraction "of the profits from this disk" is not very
37652 -meaningful, since creative accounting and unrelated business decisions
37653 -can greatly alter what fraction of the sales price counts as profit.
37654 -If the price you pay is $50, ten percent of the profit is probably less
37655 -than a dollar; it might be a few cents, or nothing at all.
37656 -
37657 - Some redistributors do development work themselves. This is useful
37658 -too; but to keep everyone honest, you need to inquire how much they do,
37659 -and what kind. Some kinds of development make much more long-term
37660 -difference than others. For example, maintaining a separate version of
37661 -a program contributes very little; maintaining the standard version of a
37662 -program for the whole community contributes much. Easy new ports
37663 -contribute little, since someone else would surely do them; difficult
37664 -ports such as adding a new CPU to the GNU Compiler Collection
37665 -contribute more; major new features or packages contribute the most.
37666 -
37667 - By establishing the idea that supporting further development is "the
37668 -proper thing to do" when distributing free software for a fee, we can
37669 -assure a steady flow of resources into making more free software.
37670 -
37671 - Copyright (C) 1994 Free Software Foundation, Inc.
37672 - Verbatim copying and redistribution of this section is permitted
37673 - without royalty; alteration is not permitted.
37674 -
37675 -\1f
37676 -File: gfortran.info, Node: Option Index, Next: Keyword Index, Prev: Funding, Up: Top
37677 -
37678 -Option Index
37679 -************
37680 -
37681 -`gfortran''s command line options are indexed here without any initial
37682 -`-' or `--'. Where an option has both positive and negative forms (such
37683 -as -foption and -fno-option), relevant entries in the manual are
37684 -indexed under the most appropriate form; it may sometimes be useful to
37685 -look up both forms.
37686 -
37687 -