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
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
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 */) ;;
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 */) ;;
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 */)
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
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],
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.
63 + LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS"
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])
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
83 noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
86 - noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
87 + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj}"
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
95 noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
98 - noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
99 + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj}"
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
108 #define SED_PROGRAM "/usr/bin/sed"
110 -static char const sed_cmd_z[] = SED_PROGRAM;
111 +static char const sed_cmd_z[] = "sed";
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
120 * DO NOT EDIT THIS FILE (fixincl.x)
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
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
130 * You must regenerate it. Use the ./genfixes script.
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.
136 - * This file contains 180 fixup descriptions.
137 + * This file contains 181 fixup descriptions.
139 * See README for more information.
143 #define SED_PROGRAM "/usr/bin/sed"
145 -static char const sed_cmd_z[] = SED_PROGRAM;
146 +static char const sed_cmd_z[] = "sed";
148 /* * * * * * * * * * * * * * * * * * * * * * * * * *
150 @@ -2300,6 +2300,42 @@
152 /* * * * * * * * * * * * * * * * * * * * * * * * * *
154 + * Description of Glibc_String2_Memset fix
156 +tSCC zGlibc_String2_MemsetName[] =
157 + "glibc_string2_memset";
160 + * File name selection pattern
162 +tSCC zGlibc_String2_MemsetList[] =
163 + "bits/string2.h\0";
165 + * Machine/OS name selection pattern
167 +#define apzGlibc_String2_MemsetMachs (const char**)NULL
170 + * content selection pattern - do fix if pattern found
172 +tSCC zGlibc_String2_MemsetSelect0[] =
173 + "#ifndef _HAVE_STRING_ARCH_memset\n\
174 +# if _STRING_ARCH_unaligned";
176 +#define GLIBC_STRING2_MEMSET_TEST_CT 1
177 +static tTestDesc aGlibc_String2_MemsetTests[] = {
178 + { TT_EGREP, zGlibc_String2_MemsetSelect0, (regex_t*)NULL }, };
181 + * Fix Command Arguments for Glibc_String2_Memset
183 +static const char* apzGlibc_String2_MemsetPatch[] = {
188 +/* * * * * * * * * * * * * * * * * * * * * * * * * *
190 * Description of Gnu_Types fix
192 tSCC zGnu_TypesName[] =
193 @@ -5617,8 +5653,7 @@
194 * Machine/OS name selection pattern
196 tSCC* apzSolaris_Mutex_Init_2Machs[] = {
197 - "*-*-solaris2.[0-9]",
198 - "*-*-solaris2.[0-9][!0-9]*",
203 @@ -5627,8 +5662,15 @@
204 tSCC zSolaris_Mutex_Init_2Select0[] =
205 "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
207 -#define SOLARIS_MUTEX_INIT_2_TEST_CT 1
209 + * perform the 'test' shell command - do fix on success
211 +tSCC zSolaris_Mutex_Init_2Test0[] =
212 + " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
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 }, };
220 @@ -5670,8 +5712,15 @@
221 tSCC zSolaris_Rwlock_Init_1Select0[] =
222 "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
224 -#define SOLARIS_RWLOCK_INIT_1_TEST_CT 1
226 + * perform the 'test' shell command - do fix on success
228 +tSCC zSolaris_Rwlock_Init_1Test0[] =
229 + " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
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 }, };
237 @@ -5741,8 +5790,7 @@
238 * Machine/OS name selection pattern
240 tSCC* apzSolaris_Once_Init_2Machs[] = {
241 - "*-*-solaris2.[0-9]",
242 - "*-*-solaris2.[0-9][!0-9]*",
247 @@ -5751,8 +5799,15 @@
248 tSCC zSolaris_Once_Init_2Select0[] =
249 "@\\(#\\)pthread.h[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
251 -#define SOLARIS_ONCE_INIT_2_TEST_CT 1
253 + * perform the 'test' shell command - do fix on success
255 +tSCC zSolaris_Once_Init_2Test0[] =
256 + " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
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 }, };
264 @@ -7308,9 +7363,9 @@
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
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,
285 @@ -7774,6 +7830,11 @@
286 GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
287 aGlibc_Mutex_InitTests, apzGlibc_Mutex_InitPatch, 0 },
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 },
294 { zGnu_TypesName, zGnu_TypesList,
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 @@
304 +/* glibc's bits/string2.h (before 2004-05-26) generates bogus
305 + -Wstrict-aliasing warnings from calls to memset. */
307 + hackname = glibc_string2_memset;
308 + files = "bits/string2.h";
309 + select = "#ifndef _HAVE_STRING_ARCH_memset\n# if _STRING_ARCH_unaligned";
311 + c_fix_arg = "%0 && 0";
312 + test_text = "#ifndef _HAVE_STRING_ARCH_memset\n"
313 + "# if _STRING_ARCH_unaligned\n"
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 @@
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.
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
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.
352 hackname = solaris_mutex_init_2;
353 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
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.
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`\"";
366 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
368 @@ -2967,6 +2990,7 @@
369 "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
370 ",[ \t]*0\\}" "(|[ \t].*)$";
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 @@
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.
388 hackname = solaris_rwlock_init_1;
389 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
391 mach = '*-*-solaris*';
392 + test = " -n \"`grep '#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)' \\`dirname $file\\`/sys/types.h`\"";
394 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
396 @@ -3024,24 +3045,14 @@
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.
408 hackname = solaris_once_init_2;
409 select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
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.
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`\"";
422 c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\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
428 /* Make sure the process will pay attention to us, send the
429 supplied command, and then have it output a special marker that
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);
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
440 # define __STRING_INLINE extern __inline
442 #endif /* GLIBC_C99_INLINE_3_CHECK */
445 +#if defined( GLIBC_STRING2_MEMSET_CHECK )
446 +#ifndef _HAVE_STRING_ARCH_memset
447 +# if _STRING_ARCH_unaligned && 0
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
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
464 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
465 ac_executable_extensions="$build_exeext"])
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= ;;
479 + AC_SUBST(licensedir, $with_license)
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" ;;
492 + CSL_LICENSE_FEATURE=""
494 + if test x"$CSL_LICENSE_FEATURE" != x; then
495 + AC_DEFINE_UNQUOTED(CSL_LICENSE_FEATURE, "$CSL_LICENSE_FEATURE",
496 + [Required license feature])
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" ;;
510 + CSL_LICENSE_VERSION=""
512 + if test x"$CSL_LICENSE_VERSION" != x; then
513 + AC_DEFINE_UNQUOTED(CSL_LICENSE_VERSION, "$CSL_LICENSE_VERSION",
514 + [Required license version])
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
522 return ok_for_base_p_1 (regno, mode, outer_code, index_code);
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. */
528 +static inline enum reg_class
529 +index_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED)
531 +#ifdef MODE_INDEX_REG_CLASS
532 + return MODE_INDEX_REG_CLASS (mode);
534 + return INDEX_REG_CLASS;
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. */
543 +ok_for_index_p_1 (unsigned regno, enum machine_mode mode ATTRIBUTE_UNUSED)
545 +#ifdef REGNO_MODE_OK_FOR_INDEX_P
546 + return REGNO_MODE_OK_FOR_INDEX_P (regno, mode);
548 + return REGNO_OK_FOR_INDEX_P (regno);
552 +/* Wrapper around ok_for_index_p_1, for use after register allocation is
553 + complete. Arguments as for the called function. */
556 +regno_ok_for_index_p (unsigned regno, enum machine_mode mode)
558 + if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0)
559 + regno = reg_renumber[regno];
561 + return ok_for_index_p_1 (regno, mode);
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. */
569 valreg = (mem_value == 0 && outmode != VOIDmode
570 - ? hard_libcall_value (outmode) : NULL_RTX);
571 + ? hard_libcall_value (outmode, orgfun) : NULL_RTX);
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);
584 + /* We can only use save_mode if the arg is sufficiently
586 + if (STRICT_ALIGNMENT
587 + && GET_MODE_ALIGNMENT (save_mode) > arg->locate.boundary)
588 + save_mode = BLKmode;
590 + adr = memory_address (save_mode, XEXP (arg->stack_slot, 0));
591 + stack_area = gen_rtx_MEM (save_mode, adr);
593 if (save_mode == BLKmode)
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
601 #include "c-common.h"
602 -#include "diagnostic.h"
607 #include "tree-inline.h"
610 +#include "diagnostic.h"
611 #include "tree-iterator.h"
613 #include "tree-mudflap.h"
615 This is a count, since unevaluated expressions can nest. */
618 +/* Whether lexing has been completed, so subsequent preprocessor
619 + errors should use the compiler's input_location. */
620 +bool done_lexing = false;
622 /* Information about how a function name is generated. */
625 @@ -7522,6 +7526,68 @@
626 #undef catenate_messages
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
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)
642 + diagnostic_info diagnostic;
643 + diagnostic_t dlevel;
644 + int save_warn_system_headers = warn_system_headers;
649 + case CPP_DL_WARNING_SYSHDR:
650 + if (flag_no_output)
652 + warn_system_headers = 1;
653 + /* Fall through. */
654 + case CPP_DL_WARNING:
655 + if (flag_no_output)
657 + dlevel = DK_WARNING;
659 + case CPP_DL_PEDWARN:
660 + if (flag_no_output && !flag_pedantic_errors)
662 + dlevel = DK_PEDWARN;
677 + gcc_unreachable ();
680 + location = input_location;
681 + diagnostic_set_info_translated (&diagnostic, msg, ap,
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;
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
699 extern int skip_evaluation;
701 +/* Whether lexing has been completed, so subsequent preprocessor
702 + errors should use the compiler's input_location. */
704 +extern bool done_lexing;
706 /* C types are partitioned into three subsets: object, function, and
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
714 enum tree_code code = TREE_CODE (type);
715 const char *invalid_conv_diag;
718 if (type == error_mark_node
719 || expr == error_mark_node
722 if (type == TREE_TYPE (expr))
724 + ret = targetm.convert_to_type (type, expr);
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;
736 struct c_arg_info *arg_info = 0;
737 + const char *errmsg;
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;
745 + errmsg = targetm.invalid_return_type (type);
749 + type = integer_type_node;
752 /* Construct the function type and go to the next
753 inner layer of declarator. */
754 @@ -5044,6 +5051,7 @@
756 tree parm, type, typelt;
758 + const char *errmsg;
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 @@
766 + errmsg = targetm.invalid_parameter_type (type);
770 + TREE_VALUE (typelt) = error_mark_node;
771 + TREE_TYPE (parm) = error_mark_node;
774 if (DECL_NAME (parm) && TREE_USED (parm))
775 warn_if_shadowing (parm);
777 @@ -8071,7 +8087,7 @@
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)
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
793 - align = LOCAL_DECL_ALIGNMENT (decl);
794 + align = alignment_for_aligned_arrays (TREE_TYPE (decl),
795 + LOCAL_DECL_ALIGNMENT (decl));
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
803 if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
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;
812 if (assembler_name_hash)
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
819 /* Set for aliases once they got through assemble_alias. */
821 + /* Set if the function is a nested function or has nested functions. */
822 + unsigned ever_was_nested : 1;
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
830 Common Var(warn_padded) Warning
831 Warn when padding is required to align structure members
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
838 Common Var(warn_shadow) Warning
839 Warn when one local variable shadows another
842 Common Joined UInteger Var(flag_abi_version) Init(2)
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.
851 Common Report Var(align_functions,0) Optimization UInteger
852 Align the start of functions
854 Common Report Var(flag_early_inlining) Init(1) Optimization
855 Perform early inlining
858 +Common Report Joined Undocumented
859 +EGLIBC configuration specifier, serves multilib purposes.
861 feliminate-dwarf2-dups
862 Common Report Var(flag_eliminate_dwarf2_dups)
863 Perform DWARF2 duplicate elimination
865 Common Report Var(flag_profile_values)
866 Insert code to profile values of expressions
868 +fpromote-loop-indices
869 +Common Report Var(flag_promote_loop_indices) Optimization
870 +Promote loop indices to word-sized indices when safe
875 @@ -1227,6 +1245,15 @@
876 Common Report Var(flag_tree_pre) Optimization
877 Enable SSA-PRE optimization on trees
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.
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.
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
901 #include "c-pragma.h"
904 #include "langhooks.h"
909 /* Forward definitions of types. */
910 typedef struct minipool_node Mnode;
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 *);
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);
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,
931 static rtx emit_set_insn (rtx, rtx);
932 static int arm_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
934 +static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree,
936 +static int aapcs_select_return_coproc (const_tree, const_tree);
938 #ifdef OBJECT_FORMAT_ELF
939 static void arm_elf_asm_constructor (rtx, int) ATTRIBUTE_UNUSED;
941 static bool arm_output_ttype (rtx);
943 static void arm_dwarf_handle_frame_unspec (const char *, rtx, int);
944 +static rtx arm_dwarf_register_span(rtx);
946 static tree arm_cxx_guard_type (void);
947 static bool arm_cxx_guard_mask_bit (void);
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);
963 /* Initialize the GCC target structure. */
965 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
966 #define TARGET_FUNCTION_OK_FOR_SIBCALL arm_function_ok_for_sibcall
968 +#undef TARGET_FUNCTION_VALUE
969 +#define TARGET_FUNCTION_VALUE arm_function_value
971 +#undef TARGET_LIBCALL_VALUE
972 +#define TARGET_LIBCALL_VALUE arm_libcall_value
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
978 #undef TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
979 #define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS arm_allocate_stack_slots_for_args
981 +#undef TARGET_WARN_FUNC_RESULT
982 +#define TARGET_WARN_FUNC_RESULT arm_warn_func_result
984 #undef TARGET_DEFAULT_SHORT_ENUMS
985 #define TARGET_DEFAULT_SHORT_ENUMS arm_default_short_enums
988 #undef TARGET_ASM_TTYPE
989 #define TARGET_ASM_TTYPE arm_output_ttype
991 +#undef TARGET_CXX_TTYPE_REF_ENCODE
992 +#define TARGET_CXX_TTYPE_REF_ENCODE hook_cxx_ttype_ref_in_bit0
994 #undef TARGET_ARM_EABI_UNWINDER
995 #define TARGET_ARM_EABI_UNWINDER true
996 #endif /* TARGET_UNWIND_INFO */
998 #undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
999 #define TARGET_DWARF_HANDLE_FRAME_UNSPEC arm_dwarf_handle_frame_unspec
1001 +#undef TARGET_DWARF_REGISTER_SPAN
1002 +#define TARGET_DWARF_REGISTER_SPAN arm_dwarf_register_span
1004 #undef TARGET_CANNOT_COPY_INSN_P
1005 #define TARGET_CANNOT_COPY_INSN_P arm_cannot_copy_insn_p
1007 @@ -398,6 +434,30 @@
1008 #define TARGET_ASM_OUTPUT_DWARF_DTPREL arm_output_dwarf_dtprel
1011 +#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
1012 +#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD arm_multipass_dfa_lookahead
1014 +#undef TARGET_INVALID_PARAMETER_TYPE
1015 +#define TARGET_INVALID_PARAMETER_TYPE arm_invalid_parameter_type
1017 +#undef TARGET_INVALID_RETURN_TYPE
1018 +#define TARGET_INVALID_RETURN_TYPE arm_invalid_return_type
1020 +#undef TARGET_PROMOTED_TYPE
1021 +#define TARGET_PROMOTED_TYPE arm_promoted_type
1023 +#undef TARGET_CONVERT_TO_TYPE
1024 +#define TARGET_CONVERT_TO_TYPE arm_convert_to_type
1026 +#undef TARGET_SCALAR_MODE_SUPPORTED_P
1027 +#define TARGET_SCALAR_MODE_SUPPORTED_P arm_scalar_mode_supported_p
1029 +#undef TARGET_VECTOR_MIN_ALIGNMENT
1030 +#define TARGET_VECTOR_MIN_ALIGNMENT arm_vector_min_alignment
1032 +#undef TARGET_VECTOR_ALWAYS_MISALIGN
1033 +#define TARGET_VECTOR_ALWAYS_MISALIGN arm_vector_always_misalign
1035 struct gcc_target targetm = TARGET_INITIALIZER;
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;
1042 -/* Which floating point model to use. */
1043 -enum arm_fp_model arm_fp_model;
1045 -/* Which floating point hardware is available. */
1046 -enum fputype arm_fpu_arch;
1048 /* Which floating point hardware to schedule for. */
1049 -enum fputype arm_fpu_tune;
1052 +/* Which floating popint hardware to use. */
1053 +const struct arm_fpu_desc *arm_fpu_desc;
1055 /* Whether to use floating point hardware. */
1056 enum float_abi_type arm_float_abi;
1058 +/* Which __fp16 format to use. */
1059 +enum arm_fp16_format_type arm_fp16_format;
1061 /* Which ABI to use. */
1062 enum arm_abi_type arm_abi;
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. */
1071 #define FL_IWMMXT (1 << 29) /* XScale v2 or "Intel Wireless MMX technology". */
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)
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)
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)
1090 /* The bits in this mask specify which
1091 instructions we are allowed to generate. */
1093 /* Nonzero if instructions not present in the 'M' profile can be used. */
1094 int arm_arch_notm = 0;
1096 +/* Nonzero if instructions present in ARMv7E-M can be used. */
1097 +int arm_arch7em = 0;
1099 /* Nonzero if this chip can benefit from load scheduling. */
1100 int arm_ld_sched = 0;
1103 /* Nonzero if tuning for XScale */
1104 int arm_tune_xscale = 0;
1106 +/* Nonzero if tuning for Marvell Feroceon. */
1107 +int arm_tune_marvell_f = 0;
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;
1113 /* Nonzero if generating Thumb instructions. */
1116 +/* Nonzero if generating code for Janus2. */
1117 +int janus2_code = 0;
1119 /* Nonzero if we should define __THUMB_INTERWORK__ in the
1121 XXX This is a bit of a hack, it's intended to help work around
1123 /* The maximum number of insns to be used when loading a constant. */
1124 static int arm_constant_limit = 3;
1126 +static enum arm_pcs arm_pcs_default;
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}
1143 @@ -705,49 +789,34 @@
1145 /* The name of the preprocessor macro to define for this architecture. */
1147 -char arm_arch_name[] = "__ARM_ARCH_0UNK__";
1151 - const char * name;
1155 +#define ARM_ARCH_NAME_SIZE 25
1156 +char arm_arch_name[ARM_ARCH_NAME_SIZE] = "__ARM_ARCH_0UNK__";
1158 /* Available values for -mfpu=. */
1160 -static const struct fpu_desc all_fpus[] =
1161 +static const struct arm_fpu_desc all_fpus[] =
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},
1194 -/* Floating point models used by the different hardware.
1195 - See fputype in arm.h. */
1197 -static const enum fputype fp_model_for_fpu[] =
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 */
1215 @@ -765,6 +834,23 @@
1222 + enum arm_fp16_format_type fp16_format_type;
1226 +/* Available values for -mfp16-format=. */
1228 +static const struct fp16_format all_fp16_formats[] =
1230 + {"none", ARM_FP16_FORMAT_NONE},
1231 + {"ieee", ARM_FP16_FORMAT_IEEE},
1232 + {"alternative", ARM_FP16_FORMAT_ALTERNATIVE}
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);
1244 + /* Half-precision float operations. The compiler handles all operations
1245 + with NULL libfuncs by converting the SFmode. */
1246 + switch (arm_fp16_format)
1248 + case ARM_FP16_FORMAT_IEEE:
1249 + case ARM_FP16_FORMAT_ALTERNATIVE:
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"));
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);
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);
1283 /* On AAPCS systems, this is the "struct __va_list". */
1284 @@ -1135,6 +1259,7 @@
1285 arm_override_options (void)
1289 enum processor_type target_arch_cpu = arm_none;
1290 enum processor_type selected_cpu = arm_none;
1292 @@ -1152,7 +1277,11 @@
1294 /* Set the architecture define. */
1295 if (i != ARM_OPT_SET_TUNE)
1296 - sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
1298 + len = snprintf (arm_arch_name, ARM_ARCH_NAME_SIZE,
1299 + "__ARM_ARCH_%s__", sel->arch);
1300 + gcc_assert (len < ARM_ARCH_NAME_SIZE);
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
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",
1315 insn_flags = sel->flags;
1316 @@ -1279,7 +1408,11 @@
1318 insn_flags = sel->flags;
1320 - sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
1322 + len = snprintf (arm_arch_name, ARM_ARCH_NAME_SIZE,
1323 + "__ARM_ARCH_%s__", sel->arch);
1324 + gcc_assert (len < ARM_ARCH_NAME_SIZE);
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 @@
1331 gcc_assert (arm_tune != arm_none);
1333 + if (arm_tune == cortexa8 && optimize >= 3)
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)
1343 tune_flags = all_cores[(int)arm_tune].flags;
1345 + if (target_fp16_format_name)
1347 + for (i = 0; i < ARRAY_SIZE (all_fp16_formats); i++)
1349 + if (streq (all_fp16_formats[i].name, target_fp16_format_name))
1351 + arm_fp16_format = all_fp16_formats[i].fp16_format_type;
1355 + if (i == ARRAY_SIZE (all_fp16_formats))
1356 + error ("invalid __fp16 format option: -mfp16-format=%s",
1357 + target_fp16_format_name);
1360 + arm_fp16_format = ARM_FP16_FORMAT_NONE;
1362 if (target_abi_name)
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;
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");
1394 + arm_arch_hwdiv = (TARGET_ARM && TARGET_MARVELL_DIV)
1395 + || (TARGET_THUMB2 && (insn_flags & FL_DIV) != 0);
1397 /* If we are not using the default (ARM mode) section anchor offset
1398 ranges, then set the correct ranges now. */
1400 @@ -1434,7 +1608,6 @@
1401 if (TARGET_IWMMXT_ABI && !TARGET_IWMMXT)
1402 error ("iwmmxt abi requires an iwmmxt capable cpu");
1404 - arm_fp_model = ARM_FP_MODEL_UNKNOWN;
1405 if (target_fpu_name == NULL && target_fpe_name != NULL)
1407 if (streq (target_fpe_name, "2"))
1408 @@ -1445,46 +1618,52 @@
1409 error ("invalid floating point emulation option: -mfpe=%s",
1412 - if (target_fpu_name != NULL)
1414 - /* The user specified a FPU. */
1415 - for (i = 0; i < ARRAY_SIZE (all_fpus); i++)
1417 - if (streq (all_fpus[i].name, target_fpu_name))
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];
1425 - if (arm_fp_model == ARM_FP_MODEL_UNKNOWN)
1426 - error ("invalid floating point option: -mfpu=%s", target_fpu_name);
1430 + if (target_fpu_name == NULL)
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;
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;
1444 if (arm_arch_cirrus)
1445 - arm_fpu_arch = FPUTYPE_MAVERICK;
1446 + target_fpu_name = "maverick";
1448 - arm_fpu_arch = FPUTYPE_FPA_EMU2;
1449 + target_fpu_name = "fpe2";
1451 - if (tune_flags & FL_CO_PROC && arm_fpu_arch == FPUTYPE_FPA_EMU2)
1452 - arm_fpu_tune = FPUTYPE_FPA;
1455 + arm_fpu_desc = NULL;
1456 + for (i = 0; i < ARRAY_SIZE (all_fpus); i++)
1458 + if (streq (all_fpus[i].name, target_fpu_name))
1460 + arm_fpu_desc = &all_fpus[i];
1464 + if (!arm_fpu_desc)
1465 + error ("invalid floating point option: -mfpu=%s", target_fpu_name);
1467 + switch (arm_fpu_desc->model)
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;
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;
1481 + case ARM_FP_MODEL_MAVERICK:
1482 + arm_fpu_attr = FPU_MAVERICK;
1485 + case ARM_FP_MODEL_VFP:
1486 + arm_fpu_attr = FPU_VFP;
1490 + gcc_unreachable();
1493 if (target_float_abi_name != NULL)
1494 @@ -1505,9 +1684,6 @@
1496 arm_float_abi = TARGET_DEFAULT_FLOAT_ABI;
1498 - if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
1499 - sorry ("-mfloat-abi=hard and VFP");
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");
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");
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;
1517 + if (TARGET_AAPCS_BASED)
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
1524 + arm_pcs_default = ARM_PCS_AAPCS_VFP;
1526 + arm_pcs_default = ARM_PCS_AAPCS;
1530 + if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
1531 + sorry ("-mfloat-abi=hard and VFP");
1533 + if (arm_abi == ARM_ABI_APCS)
1534 + arm_pcs_default = ARM_PCS_APCS;
1536 + arm_pcs_default = ARM_PCS_ATPCS;
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;
1548 @@ -1616,8 +1817,7 @@
1552 - /* ??? We might want scheduling for thumb2. */
1553 - if (TARGET_THUMB && flag_schedule_insns)
1554 + if (TARGET_THUMB1 && flag_schedule_insns)
1556 /* Don't warn since it's on by default in -O2. */
1557 flag_schedule_insns = 0;
1558 @@ -1653,6 +1853,36 @@
1560 /* Register global variables with the garbage collector. */
1561 arm_add_gc_roots ();
1563 + if (low_irq_latency && TARGET_THUMB)
1566 + "-low-irq-latency has no effect when compiling for the Thumb");
1567 + low_irq_latency = 0;
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)
1577 + if (optimize == 2)
1579 + flag_unroll_loops = 1;
1580 + if (!PARAM_SET_P (PARAM_MAX_UNROLL_TIMES))
1581 + set_param_value ("max-unroll-times", 2);
1583 + else if (optimize > 2)
1585 + flag_unroll_loops = 1;
1586 + if (!PARAM_SET_P (PARAM_MAX_UNROLL_TIMES))
1587 + set_param_value ("max-unroll-times", 4);
1590 + flag_unroll_loops = 0;
1595 @@ -1782,6 +2012,14 @@
1596 return !IS_NAKED (arm_current_func_type ());
1600 +arm_warn_func_result (void)
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 ());
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 @@
1612 /* Define how to find the value returned by a function. */
1615 -arm_function_value(const_tree type, const_tree func ATTRIBUTE_UNUSED)
1617 +arm_function_value(const_tree type, const_tree func,
1618 + bool outgoing ATTRIBUTE_UNUSED)
1620 enum machine_mode mode;
1621 int unsignedp ATTRIBUTE_UNUSED;
1622 rtx r ATTRIBUTE_UNUSED;
1624 mode = TYPE_MODE (type);
1626 + if (TARGET_AAPCS_BASED)
1627 + return aapcs_allocate_return_reg (mode, type, func);
1629 /* Promote integer types. */
1630 if (INTEGRAL_TYPE_P (type))
1631 PROMOTE_FUNCTION_MODE (mode, unsignedp, type);
1632 @@ -2897,7 +3140,36 @@
1636 - return LIBCALL_VALUE(mode);
1637 + return LIBCALL_VALUE (mode);
1641 +arm_libcall_value (enum machine_mode mode, rtx libcall)
1643 + if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS
1644 + && GET_MODE_CLASS (mode) == MODE_FLOAT)
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));
1662 + /* XXX There are other libcalls that return in integer registers,
1663 + but I think they are all handled by hard insns. */
1666 + return LIBCALL_VALUE (mode);
1669 /* Determine the amount of memory needed to store the possible return
1670 @@ -2907,10 +3179,12 @@
1677 if (TARGET_HARD_FLOAT_ABI)
1683 if (TARGET_MAVERICK)
1684 @@ -2923,27 +3197,56 @@
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
1695 -arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
1696 +arm_return_in_memory (const_tree type, const_tree fntype)
1700 - size = int_size_in_bytes (type);
1701 + size = int_size_in_bytes (type); /* Negative if not fixed size. */
1703 + if (TARGET_AAPCS_BASED)
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)
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)
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)
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));
1732 + /* The rest go in memory. */
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));
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. */
1747 + (TREE_CODE (type) != VECTOR_TYPE))
1748 + /* All simple types are returned in registers. */
1751 if (arm_abi != ARM_ABI_APCS)
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)
1760 if (TREE_CODE (type) == RECORD_TYPE)
1762 @@ -2980,18 +3283,18 @@
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. */
1769 /* Check that the first field is valid for returning in a register. */
1771 /* ... Floats are not allowed */
1772 if (FLOAT_TYPE_P (TREE_TYPE (field)))
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))
1782 /* Now check the remaining fields, if any. Only bitfields are allowed,
1783 since they are not addressable. */
1784 @@ -3003,10 +3306,10 @@
1787 if (!DECL_BIT_FIELD_TYPE (field))
1796 if (TREE_CODE (type) == UNION_TYPE)
1797 @@ -3023,18 +3326,18 @@
1800 if (FLOAT_TYPE_P (TREE_TYPE (field)))
1804 if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
1812 #endif /* not ARM_WINCE */
1814 /* Return all other types in memory. */
1819 /* Indicate whether or not words of a double are in big-endian order. */
1820 @@ -3059,14 +3362,780 @@
1824 +const struct pcs_attribute_arg
1827 + enum arm_pcs value;
1828 +} pcs_attribute_args[] =
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}
1838 +static enum arm_pcs
1839 +arm_pcs_from_attribute (tree attr)
1841 + const struct pcs_attribute_arg *ptr;
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;
1849 + arg = TREE_STRING_POINTER (TREE_VALUE (attr));
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;
1856 + /* An unrecognized interrupt type. */
1857 + return ARM_PCS_UNKNOWN;
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)
1866 + bool user_convention = false;
1867 + enum arm_pcs user_pcs = arm_pcs_default;
1870 + gcc_assert (type);
1872 + attr = lookup_attribute ("pcs", TYPE_ATTRIBUTES (type));
1875 + user_pcs = arm_pcs_from_attribute (TREE_VALUE (attr));
1876 + user_convention = true;
1879 + if (TARGET_AAPCS_BASED)
1881 + /* Detect varargs functions. These always use the base rules
1882 + (no argument is ever a candidate for a co-processor
1884 + bool base_rules = (TYPE_ARG_TYPES (type) != 0
1885 + && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (type)))
1886 + != void_type_node));
1888 + if (user_convention)
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");
1897 + return ARM_PCS_AAPCS;
1898 + else if (user_convention)
1900 + else if (decl && flag_unit_at_a_time)
1902 + /* Local functions never leak outside this compilation unit,
1903 + so we are free to use whatever conventions are
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;
1911 + else if (user_convention && user_pcs != arm_pcs_default)
1912 + sorry ("PCS variant");
1914 + /* For everything else we use the target's default. */
1915 + return arm_pcs_default;
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)
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;
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. */
1936 +aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
1938 + enum machine_mode mode;
1939 + HOST_WIDE_INT size;
1941 + switch (TREE_CODE (type))
1944 + mode = TYPE_MODE (type);
1945 + if (mode != DFmode && mode != SFmode)
1948 + if (*modep == VOIDmode)
1951 + if (*modep == mode)
1956 + case COMPLEX_TYPE:
1957 + mode = TYPE_MODE (TREE_TYPE (type));
1958 + if (mode != DFmode && mode != SFmode)
1961 + if (*modep == VOIDmode)
1964 + if (*modep == mode)
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);
1986 + if (*modep == VOIDmode)
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)
2000 + tree index = TYPE_DOMAIN (type);
2002 + /* Can't handle incomplete types. */
2003 + if (!COMPLETE_TYPE_P(type))
2006 + count = aapcs_vfp_sub_candidate (TREE_TYPE (type), modep);
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)
2016 + count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
2017 + - tree_low_cst (TYPE_MIN_VALUE (index), 1));
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)))
2034 + /* Can't handle incomplete types. */
2035 + if (!COMPLETE_TYPE_P(type))
2038 + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
2040 + if (TREE_CODE (field) != FIELD_DECL)
2043 + sub_count = aapcs_vfp_sub_candidate (TREE_TYPE (field), modep);
2044 + if (sub_count < 0)
2046 + count += sub_count;
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)))
2059 + case QUAL_UNION_TYPE:
2061 + /* These aren't very interesting except in a degenerate case. */
2066 + /* Can't handle incomplete types. */
2067 + if (!COMPLETE_TYPE_P(type))
2070 + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
2072 + if (TREE_CODE (field) != FIELD_DECL)
2075 + sub_count = aapcs_vfp_sub_candidate (TREE_TYPE (field), modep);
2076 + if (sub_count < 0)
2078 + count = count > sub_count ? count : sub_count;
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)))
2097 +/* Return true if PCS_VARIANT should use VFP registers. */
2099 +use_vfp_abi (enum arm_pcs pcs_variant, bool is_double)
2101 + if (pcs_variant == ARM_PCS_AAPCS_VFP)
2104 + if (pcs_variant != ARM_PCS_AAPCS_LOCAL)
2107 + return (TARGET_32BIT && TARGET_VFP && TARGET_HARD_FLOAT &&
2108 + (TARGET_VFP_DOUBLE || !is_double));
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)
2116 + enum machine_mode new_mode = VOIDmode;
2118 + if (GET_MODE_CLASS (mode) == MODE_FLOAT
2119 + || GET_MODE_CLASS (mode) == MODE_VECTOR_INT
2120 + || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
2125 + else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
2128 + new_mode = (mode == DCmode ? DFmode : SFmode);
2130 + else if (type && (mode == BLKmode || TREE_CODE (type) == VECTOR_TYPE))
2132 + int ag_count = aapcs_vfp_sub_candidate (type, &new_mode);
2134 + if (ag_count > 0 && ag_count <= 4)
2135 + *count = ag_count;
2143 + if (!use_vfp_abi (pcs_variant, ARM_NUM_REGS (new_mode) > 1))
2146 + *base_mode = new_mode;
2151 +aapcs_vfp_is_return_candidate (enum arm_pcs pcs_variant,
2152 + enum machine_mode mode, const_tree type)
2154 + int count ATTRIBUTE_UNUSED;
2155 + int ag_mode ATTRIBUTE_UNUSED;
2157 + if (!use_vfp_abi (pcs_variant, false))
2159 + return aapcs_vfp_is_call_or_return_candidate (pcs_variant, mode, type,
2160 + &ag_mode, &count);
2164 +aapcs_vfp_is_call_candidate (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2167 + if (!use_vfp_abi (pcum->pcs_variant, false))
2170 + return aapcs_vfp_is_call_or_return_candidate (pcum->pcs_variant, mode, type,
2171 + &pcum->aapcs_vfp_rmode,
2172 + &pcum->aapcs_vfp_rcount);
2176 +aapcs_vfp_allocate (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2177 + const_tree type ATTRIBUTE_UNUSED)
2179 + int shift = GET_MODE_SIZE (pcum->aapcs_vfp_rmode) / GET_MODE_SIZE (SFmode);
2180 + unsigned mask = (1 << (shift * pcum->aapcs_vfp_rcount)) - 1;
2183 + for (regno = 0; regno < NUM_VFP_ARG_REGS; regno += shift)
2184 + if (((pcum->aapcs_vfp_regs_free >> regno) & mask) == mask)
2186 + pcum->aapcs_vfp_reg_alloc = mask << regno;
2187 + if (mode == BLKmode || (mode == TImode && !TARGET_NEON))
2190 + int rcount = pcum->aapcs_vfp_rcount;
2191 + int rshift = shift;
2192 + enum machine_mode rmode = pcum->aapcs_vfp_rmode;
2196 + /* Avoid using unsupported vector modes. */
2197 + if (rmode == V2SImode)
2199 + else if (rmode == V4SImode)
2206 + par = gen_rtx_PARALLEL (mode, rtvec_alloc (rcount));
2207 + for (i = 0; i < rcount; i++)
2209 + rtx tmp = gen_rtx_REG (rmode,
2210 + FIRST_VFP_REGNUM + regno + i * rshift);
2211 + tmp = gen_rtx_EXPR_LIST
2213 + GEN_INT (i * GET_MODE_SIZE (rmode)));
2214 + XVECEXP (par, 0, i) = tmp;
2217 + pcum->aapcs_reg = par;
2220 + pcum->aapcs_reg = gen_rtx_REG (mode, FIRST_VFP_REGNUM + regno);
2227 +aapcs_vfp_allocate_return_reg (enum arm_pcs pcs_variant ATTRIBUTE_UNUSED,
2228 + enum machine_mode mode,
2229 + const_tree type ATTRIBUTE_UNUSED)
2231 + if (!use_vfp_abi (pcs_variant, false))
2234 + if (mode == BLKmode || (mode == TImode && !TARGET_NEON))
2242 + aapcs_vfp_is_call_or_return_candidate (pcs_variant, mode, type,
2243 + &ag_mode, &count);
2247 + if (ag_mode == V2SImode)
2249 + else if (ag_mode == V4SImode)
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++)
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;
2268 + return gen_rtx_REG (mode, FIRST_VFP_REGNUM);
2272 +aapcs_vfp_advance (CUMULATIVE_ARGS *pcum ATTRIBUTE_UNUSED,
2273 + enum machine_mode mode ATTRIBUTE_UNUSED,
2274 + const_tree type ATTRIBUTE_UNUSED)
2276 + pcum->aapcs_vfp_regs_free &= ~pcum->aapcs_vfp_reg_alloc;
2277 + pcum->aapcs_vfp_reg_alloc = 0;
2281 +#define AAPCS_CP(X) \
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 \
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
2299 + /* Initialize co-processor related state in CUMULATIVE_ARGS structure. */
2300 + void (*cum_init) (CUMULATIVE_ARGS *, const_tree, rtx, const_tree);
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);
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);
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);
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);
2322 + /* Finish processing this argument and prepare to start processing
2324 + void (*advance) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
2325 +} aapcs_cp_arg_layout[ARM_NUM_COPROC_SLOTS] =
2333 +aapcs_select_call_coproc (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2338 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2339 + if (aapcs_cp_arg_layout[i].is_call_candidate (pcum, mode, type))
2346 +aapcs_select_return_coproc (const_tree type, const_tree fntype)
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;
2355 + const_tree fndecl = NULL_TREE;
2357 + if (TREE_CODE (fntype) == FUNCTION_DECL)
2360 + fntype = TREE_TYPE (fntype);
2363 + pcs_variant = arm_get_pcs_model (fntype, fndecl);
2366 + pcs_variant = arm_pcs_default;
2368 + if (pcs_variant != ARM_PCS_AAPCS)
2372 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2373 + if (aapcs_cp_arg_layout[i].is_return_candidate (pcs_variant,
2382 +aapcs_allocate_return_reg (enum machine_mode mode, const_tree type,
2383 + const_tree fntype)
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;
2392 + const_tree fndecl = NULL_TREE;
2394 + if (TREE_CODE (fntype) == FUNCTION_DECL)
2397 + fntype = TREE_TYPE (fntype);
2400 + pcs_variant = arm_get_pcs_model (fntype, fndecl);
2403 + pcs_variant = arm_pcs_default;
2405 + /* Promote integer types. */
2406 + if (type && INTEGRAL_TYPE_P (type))
2407 + PROMOTE_FUNCTION_MODE (mode, unsignedp, type);
2409 + if (pcs_variant != ARM_PCS_AAPCS)
2413 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2414 + if (aapcs_cp_arg_layout[i].is_return_candidate (pcs_variant, mode,
2416 + return aapcs_cp_arg_layout[i].allocate_return_reg (pcs_variant,
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))
2424 + HOST_WIDE_INT size = int_size_in_bytes (type);
2425 + if (size % UNITS_PER_WORD != 0)
2427 + size += UNITS_PER_WORD - size % UNITS_PER_WORD;
2428 + mode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
2432 + return gen_rtx_REG (mode, R0_REGNUM);
2436 +aapcs_libcall_value (enum machine_mode mode)
2438 + return aapcs_allocate_return_reg (mode, NULL_TREE, NULL_TREE);
2441 +/* Lay out a function argument using the AAPCS rules. The rule
2442 + numbers referred to here are those in the AAPCS. */
2444 +aapcs_layout_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2445 + tree type, int named)
2447 + int nregs, nregs2;
2450 + /* We only need to do this once per argument. */
2451 + if (pcum->aapcs_arg_processed)
2454 + pcum->aapcs_arg_processed = true;
2456 + /* Special case: if named is false then we are handling an incoming
2457 + anonymous argument which is on the stack. */
2461 + /* Is this a potential co-processor register candidate? */
2462 + if (pcum->pcs_variant != ARM_PCS_AAPCS)
2464 + int slot = aapcs_select_call_coproc (pcum, mode, type);
2465 + pcum->aapcs_cprc_slot = slot;
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
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])
2477 + /* C1.cp - Try to allocate the argument to co-processor
2479 + if (aapcs_cp_arg_layout[slot].allocate (pcum, mode, type))
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;
2491 + /* We didn't get a register, so this argument goes on the
2493 + gcc_assert (pcum->can_split == false);
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))
2504 + nregs = ARM_NUM_REGS2(mode, type);
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);
2514 + nregs2 = nregs ? nregs : 1;
2516 + /* C4 - Argument fits entirely in core registers. */
2517 + if (ncrn + nregs2 <= NUM_ARG_REGS)
2519 + pcum->aapcs_reg = gen_rtx_REG (mode, ncrn);
2520 + pcum->aapcs_next_ncrn = ncrn + nregs;
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)
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;
2535 + /* C6 - NCRN is set to 4. */
2536 + pcum->aapcs_next_ncrn = NUM_ARG_REGS;
2538 + /* C7,C8 - arugment goes on the stack. We have nothing to do here. */
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. */
2546 arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype,
2547 - rtx libname ATTRIBUTE_UNUSED,
2549 tree fndecl ATTRIBUTE_UNUSED)
2551 + /* Long call handling. */
2553 + pcum->pcs_variant = arm_get_pcs_model (fntype, fndecl);
2555 + pcum->pcs_variant = arm_pcs_default;
2557 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
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. */
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;
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;
2584 + if (pcum->pcs_variant != ARM_PCS_AAPCS)
2588 + for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
2590 + pcum->aapcs_cprc_failed[i] = false;
2591 + aapcs_cp_arg_layout[i].cum_init (pcum, fntype, libname, fndecl);
2599 /* On the ARM, the offset starts at 0. */
2601 pcum->iwmmxt_nregs = 0;
2602 @@ -3120,6 +4189,17 @@
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;
2611 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2613 + aapcs_layout_arg (pcum, mode, type, named);
2614 + return pcum->aapcs_reg;
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 @@
2623 arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2624 - tree type, bool named ATTRIBUTE_UNUSED)
2625 + tree type, bool named)
2627 int nregs = pcum->nregs;
2629 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2631 + aapcs_layout_arg (pcum, mode, type, named);
2632 + return pcum->aapcs_partial;
2635 if (TARGET_IWMMXT_ABI && arm_vector_mode_supported_p (mode))
2638 @@ -3173,7 +4259,40 @@
2640 return (NUM_ARG_REGS - nregs) * UNITS_PER_WORD;
2647 +arm_function_arg_advance (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
2648 + tree type, bool named)
2650 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
2652 + aapcs_layout_arg (pcum, mode, type, named);
2654 + if (pcum->aapcs_cprc_slot >= 0)
2656 + aapcs_cp_arg_layout[pcum->aapcs_cprc_slot].advance (pcum, mode,
2658 + pcum->aapcs_cprc_slot = -1;
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;
2670 + if (arm_vector_mode_supported_p (mode)
2671 + && pcum->named_count > pcum->nargs
2672 + && TARGET_IWMMXT_ABI)
2673 + pcum->iwmmxt_nregs += 1;
2675 + pcum->nregs += ARM_NUM_REGS2 (mode, type);
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 @@
2693 +/* Handle a "pcs" attribute; arguments as in struct
2694 + attribute_spec.handler. */
2696 +arm_handle_pcs_attribute (tree *node ATTRIBUTE_UNUSED, tree name, tree args,
2697 + int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
2699 + if (arm_pcs_from_attribute (args) == ARM_PCS_UNKNOWN)
2701 + warning (OPT_Wattributes, "%qs attribute ignored",
2702 + IDENTIFIER_POINTER (name));
2703 + *no_add_attrs = true;
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 @@
2713 /* Return nonzero if it is ok to make a tail-call to DECL. */
2715 -arm_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
2716 +arm_function_ok_for_sibcall (tree decl, tree exp)
2718 unsigned long func_type;
2720 @@ -3522,6 +4658,21 @@
2721 if (IS_INTERRUPT (func_type))
2724 + if (!VOID_TYPE_P (TREE_TYPE (DECL_RESULT (cfun->decl))))
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
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))
2739 /* Never tailcall if function may be called with a misaligned SP. */
2740 if (IS_STACKALIGN (func_type))
2742 @@ -4120,6 +5271,7 @@
2743 if (GET_MODE_SIZE (mode) <= 4
2747 || (mode == QImode && outer == SIGN_EXTEND))))
2750 @@ -4148,13 +5300,15 @@
2754 - if (mode == HImode || (outer == SIGN_EXTEND && mode == QImode))
2755 + if (mode == HImode
2757 + || (outer == SIGN_EXTEND && mode == QImode))
2763 - range = (mode == HImode) ? 4095 : 4096;
2764 + range = (mode == HImode || mode == HFmode) ? 4095 : 4096;
2766 return (code == CONST_INT
2767 && INTVAL (index) < range
2768 @@ -4325,7 +5479,8 @@
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 @@
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);
2786 *total = COSTS_N_INSNS (20);
2787 @@ -5063,23 +6218,6 @@
2791 - if (TARGET_THUMB2)
2793 - if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2795 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2796 - *total = COSTS_N_INSNS (1);
2798 - *total = COSTS_N_INSNS (20);
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). */
2810 *total = COSTS_N_INSNS (ARM_NUM_REGS (mode));
2811 @@ -5102,7 +6240,9 @@
2813 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2815 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2816 + if (TARGET_HARD_FLOAT
2817 + && (mode == SFmode
2818 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2820 *total = COSTS_N_INSNS (1);
2821 if (GET_CODE (XEXP (x, 0)) == CONST_DOUBLE
2822 @@ -5143,6 +6283,17 @@
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))
2832 + *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, speed);
2833 + *total += rtx_cost (XEXP (x, 1), code, speed);
2838 && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
2839 && ((INTVAL (XEXP (XEXP (x, 1), 1)) &
2840 @@ -5164,6 +6315,19 @@
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)))
2853 + /* The cost comes from the cost of the multiply. */
2860 @@ -5192,7 +6356,9 @@
2862 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2864 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2865 + if (TARGET_HARD_FLOAT
2866 + && (mode == SFmode
2867 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2869 *total = COSTS_N_INSNS (1);
2870 if (GET_CODE (XEXP (x, 1)) == CONST_DOUBLE
2871 @@ -5307,7 +6473,9 @@
2873 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2875 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2876 + if (TARGET_HARD_FLOAT
2877 + && (mode == SFmode
2878 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2880 *total = COSTS_N_INSNS (1);
2882 @@ -5460,7 +6628,9 @@
2884 if (GET_MODE_CLASS (mode == MODE_FLOAT))
2886 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2887 + if (TARGET_HARD_FLOAT
2888 + && (mode == SFmode
2889 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2891 *total = COSTS_N_INSNS (1);
2893 @@ -5563,7 +6733,8 @@
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);
2902 *total = COSTS_N_INSNS (4);
2903 @@ -5638,7 +6809,8 @@
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))
2911 *total = COSTS_N_INSNS (1);
2913 @@ -5668,7 +6840,8 @@
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))
2921 *total = COSTS_N_INSNS (1);
2923 @@ -5698,7 +6871,8 @@
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))
2931 *total = COSTS_N_INSNS (1);
2933 @@ -5722,7 +6896,8 @@
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);
2942 *total = COSTS_N_INSNS (1 + ARM_NUM_REGS (mode));
2943 @@ -5939,7 +7114,9 @@
2945 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2947 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2948 + if (TARGET_HARD_FLOAT
2949 + && (mode == SFmode
2950 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2952 *total = COSTS_N_INSNS (1);
2954 @@ -6096,7 +7273,9 @@
2956 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
2958 - if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode))
2959 + if (TARGET_HARD_FLOAT
2960 + && (mode == SFmode
2961 + || (mode == DFmode && !TARGET_VFP_SINGLE)))
2963 *total = COSTS_N_INSNS (1);
2965 @@ -6919,10 +8098,13 @@
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
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)
2977 -neon_vector_mem_operand (rtx op, bool core)
2978 +neon_vector_mem_operand (rtx op, int type)
2982 @@ -6955,23 +8137,16 @@
2983 return arm_address_register_rtx_p (ind, 0);
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);
2992 - /* FIXME: We can support this too if we use VLD1/VST1. */
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);
3000 + /* FIXME: vld1 allows register post-modify. */
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 @@
3012 coproc_secondary_reload_class (enum machine_mode mode, rtx x, bool wb)
3014 + if (mode == HFmode)
3016 + if (!TARGET_NEON_FP16)
3017 + return GENERAL_REGS;
3018 + if (s_register_operand (x, mode) || neon_vector_mem_operand (x, 2))
3020 + return GENERAL_REGS;
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))
3030 if (arm_coproc_mem_operand (x, wb) || s_register_operand (x, mode))
3031 @@ -7438,6 +8622,9 @@
3035 + if (low_irq_latency)
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 @@
3045 + if (low_irq_latency)
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 @@
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))
3060 @@ -7937,7 +9127,7 @@
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))
3069 @@ -9555,7 +10745,10 @@
3070 gcc_assert (GET_CODE (from) != BARRIER);
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);
3077 + count += get_attr_length (from);
3079 /* If there is a jump table, add its length. */
3080 tmp = is_jump_table (from);
3081 @@ -9867,6 +11060,8 @@
3085 + else if (LABEL_P (insn) && (align_jumps > 0 || align_loops > 0))
3086 + address += MAX (align_jumps, align_loops);
3089 fix = minipool_fix_head;
3090 @@ -10072,6 +11267,21 @@
3091 vfp_output_fldmd (FILE * stream, unsigned int base, int reg, int count)
3096 + if (low_irq_latency)
3098 + /* Output a sequence of FLDD instructions. */
3100 + for (i = reg; i < reg + count; ++i, offset += 8)
3102 + fputc ('\t', stream);
3103 + asm_fprintf (stream, "fldd\td%d, [%r,#%d]\n", i, base, offset);
3105 + asm_fprintf (stream, "\tadd\tsp, sp, #%d\n", count * 8);
3110 /* Workaround ARM10 VFPr1 bug. */
3111 if (count == 2 && !arm_arch6)
3112 @@ -10142,6 +11352,56 @@
3116 + if (low_irq_latency)
3124 + saved_size = count * GET_MODE_SIZE (DFmode);
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;
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));
3143 + /* push double VFP registers to stack */
3144 + for (i = 0; i < count; ++i )
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);
3160 + REG_NOTES (sp_insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
3161 + REG_NOTES (sp_insn));
3163 + return saved_size;
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 @@
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. */
3177 output_move_quad (rtx *operands)
3178 @@ -10954,6 +12214,12 @@
3183 + templ = "v%smdb%%?\t%%0!, %%h1";
3184 + ops[0] = XEXP (addr, 0);
3189 /* FIXME: Not currently enabled in neon_vector_mem_operand. */
3191 @@ -10968,7 +12234,7 @@
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))
3199 gcc_assert (overlap == -1);
3200 @@ -11557,7 +12823,7 @@
3203 /* Workaround ARM10 VFPr1 bug. */
3204 - if (count == 2 && !arm_arch6)
3205 + if (count == 2 && !arm_arch6 && !low_irq_latency)
3209 @@ -11886,6 +13152,41 @@
3210 return_used_this_function = 0;
3213 +/* Generate to STREAM a code sequence that pops registers identified
3214 + in REGS_MASK from SP. SP is incremented as the result.
3217 +print_pop_reg_by_ldr (FILE *stream, int regs_mask, int rfe)
3221 + gcc_assert (! (regs_mask & (1 << SP_REGNUM)));
3223 + for (reg = 0; reg < PC_REGNUM; ++reg)
3224 + if (regs_mask & (1 << reg))
3225 + asm_fprintf (stream, "\tldr\t%r, [%r], #4\n",
3228 + if (regs_mask & (1 << PC_REGNUM))
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
3241 + asm_fprintf (stream, "\tldm\tsp!, {pc}^\n");
3243 + asm_fprintf (stream, "\tldr\t%r, [%r], #4\n",
3244 + PC_REGNUM, SP_REGNUM);
3249 arm_output_epilogue (rtx sibling)
3251 @@ -11946,7 +13247,7 @@
3252 /* This variable is for the Virtual Frame Pointer, not VFP regs. */
3253 int vfp_offset = offsets->frame;
3255 - if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
3256 + if (TARGET_FPA_EMU2)
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);
3264 - if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
3265 + if (TARGET_FPA_EMU2)
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))
3276 asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
3278 else if (saved_regs_mask)
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,
3287 - else if (TARGET_ARM)
3288 - print_multi_reg (f, "ldmfd\t%r!, ", SP_REGNUM, saved_regs_mask,
3290 + gcc_assert ( ! (saved_regs_mask & (1 << SP_REGNUM)));
3292 + if (low_irq_latency)
3293 + print_pop_reg_by_ldr (f, saved_regs_mask, rfe);
3295 + print_multi_reg (f, "ldmfd\t%r!, ", SP_REGNUM, saved_regs_mask,
3298 print_multi_reg (f, "pop\t", SP_REGNUM, saved_regs_mask, 0);
3300 @@ -12389,6 +13687,32 @@
3302 gcc_assert (num_regs && num_regs <= 16);
3304 + if (low_irq_latency)
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)));
3312 + for (i = LAST_ARM_REGNUM; i >= 0; --i)
3314 + if (mask & (1 << i))
3317 + rtx reg, where, mem;
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;
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 @@
3337 - for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
3339 - if ((offsets->saved_regs_mask & (1 << i)) == 0)
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)
3354 - /* Push/pop an argument register (r3) if all callee saved
3355 - registers are already being pushed. */
3359 + for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
3361 + if ((offsets->saved_regs_mask & (1 << i)) == 0)
3370 @@ -12876,7 +14201,7 @@
3372 /* Save any floating point call-saved registers used by this
3374 - if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
3375 + if (TARGET_FPA_EMU2)
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 @@
3381 fprintf (stream, ", %s ", shift);
3383 - arm_print_operand (stream, XEXP (x, 1), 0);
3385 + arm_print_operand (stream, XEXP (x, 1), 0);
3387 + fprintf(stream, "\n\tnop");
3390 fprintf (stream, "#" HOST_WIDE_INT_PRINT_DEC, val);
3392 @@ -13704,6 +15033,30 @@
3396 + /* Print the high single-precision register of a VFP double-precision
3400 + int mode = GET_MODE (x);
3403 + if (GET_MODE_SIZE (mode) != 8 || GET_CODE (x) != REG)
3405 + output_operand_lossage ("invalid operand for code '%c'", code);
3409 + regno = REGNO (x);
3410 + if (!VFP_REGNO_OK_FOR_DOUBLE (regno))
3412 + output_operand_lossage ("invalid operand for code '%c'", code);
3416 + fprintf (stream, "s%d", regno - FIRST_VFP_REGNUM + 1);
3420 /* Print a VFP/Neon double precision or quad precision register name. */
3423 @@ -13821,6 +15174,57 @@
3427 + /* Memory operand for vld1/vst1 instruction. */
3431 + bool postinc = FALSE;
3434 + gcc_assert (GET_CODE (x) == MEM);
3435 + addr = XEXP (x, 0);
3436 + if (GET_CODE (addr) == POST_INC)
3439 + addr = XEXP (addr, 0);
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));
3446 + asm_fprintf (stream, ", :%d", align << 3);
3447 + asm_fprintf (stream, "]");
3449 + fputs("!", stream);
3453 + /* Register specifier for vld1.16/vst1.16. Translate the S register
3454 + number into a D register number and element index. */
3457 + int mode = GET_MODE (x);
3460 + if (GET_MODE_SIZE (mode) != 2 || GET_CODE (x) != REG)
3462 + output_operand_lossage ("invalid operand for code '%c'", code);
3466 + regno = REGNO (x);
3467 + if (!VFP_REGNO_OK_FOR_SINGLE (regno))
3469 + output_operand_lossage ("invalid operand for code '%c'", code);
3473 + regno = regno - FIRST_VFP_REGNUM;
3474 + fprintf (stream, "d%d[%d]", regno/2, ((regno % 2) ? 2 : 0));
3481 @@ -13854,6 +15258,12 @@
3483 gcc_assert (GET_CODE (x) != NEG);
3484 fputc ('#', stream);
3485 + if (GET_CODE (x) == HIGH)
3487 + fputs (":lower16:", stream);
3491 output_addr_const (stream, x);
3494 @@ -14245,6 +15655,10 @@
3495 first insn after the following code_label if REVERSE is true. */
3496 rtx start_insn = insn;
3498 + /* Don't do this if we're not considering conditional execution. */
3499 + if (TARGET_NO_SINGLE_COND_EXEC)
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 @@
3507 return VFP_REGNO_OK_FOR_DOUBLE (regno);
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);
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;
3520 if (IS_IWMMXT_REGNUM (regno))
3521 - return VALID_IWMMXT_REG_MODE (mode);
3522 + return VALID_IWMMXT_REG_MODE (mode) && mode != SImode;
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;
3537 if (regno == FRAME_POINTER_REGNUM
3538 || regno == ARG_POINTER_REGNUM)
3539 @@ -16103,6 +17522,15 @@
3543 +arm_init_fp16_builtins (void)
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");
3552 arm_init_builtins (void)
3554 arm_init_tls_builtins ();
3555 @@ -16112,6 +17540,71 @@
3558 arm_init_neon_builtins ();
3560 + if (arm_fp16_format)
3561 + arm_init_fp16_builtins ();
3564 +/* Implement TARGET_INVALID_PARAMETER_TYPE. */
3566 +static const char *
3567 +arm_invalid_parameter_type (const_tree t)
3569 + if (SCALAR_FLOAT_TYPE_P (t) && TYPE_PRECISION (t) == 16)
3570 + return N_("function parameters cannot have __fp16 type");
3574 +/* Implement TARGET_INVALID_PARAMETER_TYPE. */
3576 +static const char *
3577 +arm_invalid_return_type (const_tree t)
3579 + if (SCALAR_FLOAT_TYPE_P (t) && TYPE_PRECISION (t) == 16)
3580 + return N_("functions cannot return __fp16 type");
3584 +/* Implement TARGET_PROMOTED_TYPE. */
3587 +arm_promoted_type (const_tree t)
3589 + if (SCALAR_FLOAT_TYPE_P (t) && TYPE_PRECISION (t) == 16)
3590 + return float_type_node;
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. */
3600 +arm_convert_to_type (tree type, tree expr)
3602 + tree fromtype = TREE_TYPE (expr);
3603 + if (!SCALAR_FLOAT_TYPE_P (fromtype) || !SCALAR_FLOAT_TYPE_P (type))
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));
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. */
3618 +arm_scalar_mode_supported_p (enum machine_mode mode)
3620 + if (mode == HFmode)
3621 + return (arm_fp16_format != ARM_FP16_FORMAT_NONE);
3623 + return default_scalar_mode_supported_p (mode);
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;
3631 + val = val & (unsigned HOST_WIDE_INT)0xffffffffu;
3632 if (val == 0) /* XXX */
3635 @@ -18279,40 +19773,8 @@
3638 int set_float_abi_attributes = 0;
3639 - switch (arm_fpu_arch)
3644 - case FPUTYPE_FPA_EMU2:
3645 - fpu_name = "fpe2";
3647 - case FPUTYPE_FPA_EMU3:
3648 - fpu_name = "fpe3";
3650 - case FPUTYPE_MAVERICK:
3651 - fpu_name = "maverick";
3655 - set_float_abi_attributes = 1;
3657 - case FPUTYPE_VFP3D16:
3658 - fpu_name = "vfpv3-d16";
3659 - set_float_abi_attributes = 1;
3661 - case FPUTYPE_VFP3:
3662 - fpu_name = "vfpv3";
3663 - set_float_abi_attributes = 1;
3665 - case FPUTYPE_NEON:
3666 - fpu_name = "neon";
3667 - set_float_abi_attributes = 1;
3672 - if (set_float_abi_attributes)
3673 + fpu_name = arm_fpu_desc->name;
3674 + if (arm_fp_model == ARM_FP_MODEL_VFP)
3676 if (TARGET_HARD_FLOAT)
3677 asm_fprintf (asm_out_file, "\t.eabi_attribute 27, 3\n");
3678 @@ -18362,6 +19824,11 @@
3680 asm_fprintf (asm_out_file, "\t.eabi_attribute 30, %d\n", val);
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);
3687 if (arm_lang_output_object_attributes_hook)
3688 arm_lang_output_object_attributes_hook();
3690 @@ -18591,6 +20058,23 @@
3694 +/* Emit a fp16 constant appropriately padded to occupy a 4-byte word.
3695 + HFmode constant pool entries are actually loaded with ldr. */
3697 +arm_emit_fp16_const (rtx c)
3699 + REAL_VALUE_TYPE r;
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);
3712 arm_output_load_gr (rtx *operands)
3714 @@ -18628,19 +20112,24 @@
3718 -arm_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
3719 +arm_setup_incoming_varargs (CUMULATIVE_ARGS *pcum,
3720 enum machine_mode mode,
3723 int second_time ATTRIBUTE_UNUSED)
3725 - int nregs = cum->nregs;
3727 - && ARM_DOUBLEWORD_ALIGN
3728 - && arm_needs_doubleword_align (mode, type))
3733 cfun->machine->uses_anonymous_args = 1;
3734 + if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
3736 + nregs = pcum->aapcs_ncrn;
3737 + if ((nregs & 1) && arm_needs_doubleword_align (mode, type))
3741 + nregs = pcum->nregs;
3743 if (nregs < NUM_ARG_REGS)
3744 *pretend_size = (NUM_ARG_REGS - nregs) * UNITS_PER_WORD;
3746 @@ -19024,9 +20513,10 @@
3747 || mode == V16QImode || mode == V4SFmode || mode == V2DImode))
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)))
3760 @@ -19057,9 +20547,14 @@
3761 if (IS_FPA_REGNUM (regno))
3762 return (TARGET_AAPCS_BASED ? 96 : 16) + regno - FIRST_FPA_REGNUM;
3764 - /* FIXME: VFPv3 register numbering. */
3765 if (IS_VFP_REGNUM (regno))
3766 - return 64 + regno - FIRST_VFP_REGNUM;
3768 + /* See comment in arm_dwarf_register_span. */
3769 + if (VFP_REGNO_OK_FOR_SINGLE (regno))
3770 + return 64 + regno - FIRST_VFP_REGNUM;
3772 + return 256 + (regno - FIRST_VFP_REGNUM) / 2;
3775 if (IS_IWMMXT_GR_REGNUM (regno))
3776 return 104 + regno - FIRST_IWMMXT_GR_REGNUM;
3777 @@ -19070,6 +20565,39 @@
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. */
3785 +arm_dwarf_register_span(rtx rtl)
3792 + regno = REGNO (rtl);
3793 + if (!IS_VFP_REGNUM (regno))
3796 + /* The EABI defines two VFP register ranges:
3797 + 64-95: Legacy VFPv2 numbering for S0-S31 (obsolescent)
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))
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);
3815 #ifdef TARGET_UNWIND_INFO
3816 /* Emit unwind directives for a store-multiple instruction or stack pointer
3817 @@ -19556,6 +21084,7 @@
3825 @@ -19620,6 +21149,10 @@
3826 return "St9__va_list";
3829 + /* Half-precision float. */
3830 + if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16)
3833 if (TREE_CODE (type) != VECTOR_TYPE)
3836 @@ -19676,6 +21209,86 @@
3837 given on the command line. */
3839 flag_section_anchors = 2;
3843 + /* Select optimizations that are a win for code size.
3845 + The inlining options set below have two important
3846 + consequences for functions not explicitly marked
3848 + - Static functions used once are inlined if
3849 + sufficiently small. Static functions used twice
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
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);
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
3879 + flag_promote_loop_indices = 1;
3883 +/* Return how many instructions to look ahead for better insn
3886 +arm_multipass_dfa_lookahead (void)
3888 + return (arm_tune == marvell_f) ? 4 : 0;
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. */
3896 +arm_vector_min_alignment (const_tree type)
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
3904 + gcc_assert (TREE_CODE (type) == VECTOR_TYPE);
3905 + return TYPE_ALIGN_UNIT (TREE_TYPE (type));
3908 + return default_vector_min_alignment (type);
3912 +arm_vector_always_misalign(const_tree type ATTRIBUTE_UNUSED)
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
3919 + return TARGET_NEON && !BYTES_BIG_ENDIAN;
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
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)
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)
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
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__"); \
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)
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)
3973 #define TARGET_HARD_TP (target_thread_pointer == TP_CP15)
3974 #define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT)
3976 @@ -211,35 +222,43 @@
3978 #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
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. */
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)
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)
3998 +/* FPU only supports VFP single-precision instructions. */
3999 +#define TARGET_VFP_SINGLE (TARGET_VFP && arm_arch_vfp_regs == VFP_REG_SINGLE)
4001 +/* FPU supports VFP double-precision instructions. */
4002 +#define TARGET_VFP_DOUBLE (TARGET_VFP && arm_arch_vfp_regs != VFP_REG_SINGLE)
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)
4007 +/* FPU supports VFP half-precision floating-point. */
4008 +#define TARGET_FP16 (TARGET_VFP && arm_arch_vfp_fp16)
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
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)
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))
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 @@
4034 -extern enum arm_fp_model arm_fp_model;
4036 -/* Which floating point hardware is available. Also update
4037 - fp_model_for_fpu in arm.c when adding entries to this list. */
4040 - /* No FP hardware. */
4042 - /* Full FPA support. */
4044 - /* Emulated FPA hardware, Issue 2 emulator (no LFM/SFM). */
4046 - /* Emulated FPA hardware, Issue 3 emulator. */
4048 - /* Cirrus Maverick floating point co-processor. */
4058 +enum vfp_reg_type {
4064 -/* Recast the floating point class to be the floating point attribute. */
4065 -#define arm_fpu_attr ((enum attr_fpu) arm_fpu_tune)
4067 -/* What type of floating point to tune for */
4068 -extern enum fputype arm_fpu_tune;
4069 +extern const struct arm_fpu_desc
4072 + enum arm_fp_model model;
4074 + enum vfp_reg_type myregs;
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
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;
4092 @@ -337,6 +346,21 @@
4093 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
4096 +/* Which __fp16 format to use.
4097 + The enumeration values correspond to the numbering for the
4098 + Tag_ABI_FP_16bit_format attribute.
4100 +enum arm_fp16_format_type
4102 + ARM_FP16_FORMAT_NONE = 0,
4103 + ARM_FP16_FORMAT_IEEE = 1,
4104 + ARM_FP16_FORMAT_ALTERNATIVE = 2
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)
4111 /* Which ABI to use. */
4114 @@ -383,12 +407,18 @@
4115 /* Nonzero if instructions not present in the 'M' profile can be used. */
4116 extern int arm_arch_notm;
4118 +/* Nonzero if instructions present in ARMv7E-M can be used. */
4119 +extern int arm_arch7em;
4121 /* Nonzero if this chip can benefit from load scheduling. */
4122 extern int arm_ld_sched;
4124 /* Nonzero if generating thumb code. */
4125 extern int thumb_code;
4127 +/* Nonzero if generating Janus2 code. */
4128 +extern int janus2_code;
4130 /* Nonzero if this chip is a StrongARM. */
4131 extern int arm_tune_strongarm;
4134 /* Nonzero if tuning for XScale. */
4135 extern int arm_tune_xscale;
4137 +/* Nonzero if tuning for Marvell Feroceon. */
4138 +extern int arm_tune_marvell_f;
4140 /* Nonzero if tuning for stores via the write buffer. */
4141 extern int arm_tune_wbuf;
4143 @@ -423,6 +456,10 @@
4144 /* Nonzero if chip supports integer division instruction. */
4145 extern int arm_arch_hwdiv;
4147 +/* Nonzero if we should minimize interrupt latency of the
4148 + generated code. */
4149 +extern int low_irq_latency;
4151 #ifndef TARGET_DEFAULT
4152 #define TARGET_DEFAULT (MASK_APCS_FRAME)
4154 @@ -757,12 +794,11 @@
4155 fixed_regs[regno] = call_used_regs[regno] = 1; \
4158 - if (TARGET_THUMB && optimize_size) \
4160 - /* When optimizing for size, it's better not to use \
4161 - the HI regs, because of the overhead of stacking \
4163 - /* ??? Is this still true for thumb2? */ \
4164 + if (TARGET_THUMB1 && optimize_size) \
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; \
4173 /* The number of (integer) argument register available. */
4174 #define NUM_ARG_REGS 4
4176 +/* And similarly for the VFP. */
4177 +#define NUM_VFP_ARG_REGS 16
4179 /* Return the register number of the N'th (integer) argument. */
4180 #define ARG_REGISTER(N) (N - 1)
4182 @@ -1059,7 +1098,7 @@
4183 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
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)
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)) \
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)
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))
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. */
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) \
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 @@
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)))
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);
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))
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];
4301 +/* The number of potential ways of assigning to a co-processor. */
4302 +#define ARM_NUM_COPROC_SLOTS 1
4304 +/* Enumeration of procedure calling standard variants. We don't really
4305 + support all of these yet. */
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). */
4318 +/* We can't define this inside a generator file because it needs enum
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. */
4326 /* This is the number of registers of arguments scanned so far. */
4327 @@ -1628,9 +1690,33 @@
4332 + /* Which procedure call variant to use for this call. */
4333 + enum arm_pcs pcs_variant;
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
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
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
4355 + int /* enum machine_mode */ aapcs_vfp_rmode;
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; \
4372 - (CUM).nregs += ARM_NUM_REGS2 (MODE, TYPE)
4373 + arm_function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
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 @@
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)))
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))
4400 /* Position Independent Code. */
4401 /* We decide which register to use based on the compilation options and
4402 @@ -2392,6 +2475,7 @@
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)
4409 #define ASM_APP_OFF (TARGET_THUMB1 ? "\t.code\t16\n" : \
4410 @@ -2404,6 +2488,19 @@
4412 asm_fprintf (STREAM,"\tstmfd\t%r!,{%r}\n", \
4413 STACK_POINTER_REGNUM, REGNO); \
4414 + else if (TARGET_THUMB1 \
4415 + && (REGNO) == STATIC_CHAIN_REGNUM) \
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"); \
4428 asm_fprintf (STREAM, "\tpush {%r}\n", REGNO); \
4430 @@ -2415,6 +2512,14 @@
4432 asm_fprintf (STREAM, "\tldmfd\t%r!,{%r}\n", \
4433 STACK_POINTER_REGNUM, REGNO); \
4434 + else if (TARGET_THUMB1 \
4435 + && (REGNO) == STATIC_CHAIN_REGNUM) \
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"); \
4443 asm_fprintf (STREAM, "\tpop {%r}\n", REGNO); \
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
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.
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
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")))
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")))
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")))
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")))
4484 ; LENGTH of an instruction (in bytes)
4486 ;; scheduling information.
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"))
4493 ; TYPE attribute is used to detect floating point instructions which, if
4495 (define_attr "ldsched" "no,yes" (const (symbol_ref "arm_ld_sched")))
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"
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"))
4511 (const_string "yes"))))
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"))))
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")
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]);
4542 @@ -620,10 +627,11 @@
4543 sub%?\\t%0, %1, #%n2
4544 sub%?\\t%0, %1, #%n2
4547 - GET_CODE (operands[2]) == CONST_INT
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))]
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.
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")))]
4571 static const char * const asms[] =
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\",
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];
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)))]
4594 + HOST_WIDE_INT offset = INTVAL (operands[2]);
4597 + else if (offset < -255)
4600 + operands[3] = GEN_INT (offset);
4601 + operands[2] = GEN_INT (INTVAL (operands[2]) - offset);
4603 + [(set_attr "length" "2,2,2,2,2,2,2,4,4")]
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"))
4619 (define_insn "*addsi3_carryin_alt1"
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"
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"
4636 if (TARGET_MAVERICK)
4638 @@ -1332,6 +1361,49 @@
4639 (set_attr "predicable" "yes")]
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.
4650 +; <add/sub> r3, r3, <constant>
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" "")]))]
4661 + [(set (match_dup 0)
4662 + (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4664 + (set (match_dup 0)
4665 + (match_op_dup:SI 1 [(match_dup 0) (match_dup 5)]))]
4668 +; Likewise for MLS. MLS is available only on select architectures.
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)]))]
4685 (define_insn "*mulsi3addsi_compare0"
4686 [(set (reg:CC_NOOV CC_REGNUM)
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"
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)"
4706 @@ -1960,6 +2032,7 @@
4709 [(set_attr "length" "4,4,16")
4710 + (set_attr "insn" "and")
4711 (set_attr "predicable" "yes")]
4714 @@ -1969,7 +2042,8 @@
4715 (match_operand:SI 2 "register_operand" "l")))]
4718 - [(set_attr "length" "2")]
4719 + [(set_attr "length" "2")
4720 + (set_attr "insn" "and")]
4723 (define_insn "*andsi3_compare0"
4724 @@ -1984,7 +2058,8 @@
4727 bic%.\\t%0, %1, #%B2"
4728 - [(set_attr "conds" "set")]
4729 + [(set_attr "conds" "set")
4730 + (set_attr "insn" "and,*")]
4733 (define_insn "*andsi3_compare0_scratch"
4734 @@ -2280,7 +2355,7 @@
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"))
4755 (define_insn "*andsi_notsi_si_compare0"
4756 @@ -2576,6 +2655,7 @@
4757 orr%?\\t%Q0, %Q1, %2
4759 [(set_attr "length" "4,8")
4760 + (set_attr "insn" "orr")
4761 (set_attr "predicable" "yes")]
4764 @@ -2638,7 +2718,8 @@
4765 (match_operand:SI 2 "register_operand" "l")))]
4768 - [(set_attr "length" "2")]
4769 + [(set_attr "length" "2")
4770 + (set_attr "insn" "orr")]
4774 @@ -2663,7 +2744,8 @@
4775 (ior:SI (match_dup 1) (match_dup 2)))]
4777 "orr%.\\t%0, %1, %2"
4778 - [(set_attr "conds" "set")]
4779 + [(set_attr "conds" "set")
4780 + (set_attr "insn" "orr")]
4783 (define_insn "*iorsi3_compare0_scratch"
4784 @@ -2674,7 +2756,8 @@
4785 (clobber (match_scratch:SI 0 "=r"))]
4787 "orr%.\\t%0, %1, %2"
4788 - [(set_attr "conds" "set")]
4789 + [(set_attr "conds" "set")
4790 + (set_attr "insn" "orr")]
4793 (define_insn "xordi3"
4794 @@ -2697,7 +2780,8 @@
4795 eor%?\\t%Q0, %Q1, %2
4797 [(set_attr "length" "4,8")
4798 - (set_attr "predicable" "yes")]
4799 + (set_attr "predicable" "yes")
4800 + (set_attr "insn" "eor")]
4803 (define_insn "*xordi_sesidi_di"
4804 @@ -2728,7 +2812,8 @@
4805 (match_operand:SI 2 "arm_rhs_operand" "rI")))]
4807 "eor%?\\t%0, %1, %2"
4808 - [(set_attr "predicable" "yes")]
4809 + [(set_attr "predicable" "yes")
4810 + (set_attr "insn" "eor")]
4813 (define_insn "*thumb1_xorsi3"
4814 @@ -2737,7 +2822,8 @@
4815 (match_operand:SI 2 "register_operand" "l")))]
4818 - [(set_attr "length" "2")]
4819 + [(set_attr "length" "2")
4820 + (set_attr "insn" "eor")]
4823 (define_insn "*xorsi3_compare0"
4824 @@ -2749,7 +2835,8 @@
4825 (xor:SI (match_dup 1) (match_dup 2)))]
4827 "eor%.\\t%0, %1, %2"
4828 - [(set_attr "conds" "set")]
4829 + [(set_attr "conds" "set")
4830 + (set_attr "insn" "eor")]
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))])]
4839 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4841 if (operands[2] == const0_rtx || operands[2] == constm1_rtx)
4843 @@ -2933,7 +3020,8 @@
4846 "orr%?\\t%0, %1, %1, asr #31"
4847 - [(set_attr "predicable" "yes")]
4848 + [(set_attr "predicable" "yes")
4849 + (set_attr "insn" "orr")]
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))]
4858 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
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))])]
4867 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
4869 if (operands[2] == const0_rtx)
4871 @@ -2973,7 +3061,8 @@
4874 "and%?\\t%0, %1, %1, asr #31"
4875 - [(set_attr "predicable" "yes")]
4876 + [(set_attr "predicable" "yes")
4877 + (set_attr "insn" "and")]
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))]
4886 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
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))])]
4895 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
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))]
4904 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
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))])]
4913 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
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))]
4922 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
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))]
4931 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
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")))]
4940 + "TARGET_THUMB1 && !janus2_code"
4942 [(set_attr "length" "2")]
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"
4952 + lsl\\t%0, %1, %2\;nop"
4953 + [(set_attr "length" "2,4")]
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 @@
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")]
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")))]
4973 + "TARGET_THUMB1 && !janus2_code"
4975 [(set_attr "length" "2")]
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"
4985 + asr\\t%0, %1, %2\;nop"
4986 + [(set_attr "length" "2,4")]
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 @@
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")]
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")))]
5005 + "TARGET_THUMB1 && !janus2_code"
5007 [(set_attr "length" "2")]
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"
5017 + lsr\\t%0, %1, %2; nop"
5018 + [(set_attr "length" "2,4")]
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")))]
5029 + "TARGET_THUMB1 && !janus2_code"
5031 [(set_attr "length" "2")]
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")]
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"))
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"))
5071 (define_insn "*shiftsi3_compare0_scratch"
5072 @@ -3370,7 +3512,11 @@
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"))
5084 (define_insn "*arm_notsi_shiftsi"
5085 @@ -3382,9 +3528,14 @@
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"))
5100 (define_insn "*arm_notsi_shiftsi_compare0"
5101 @@ -3399,9 +3550,14 @@
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"))
5116 (define_insn "*arm_not_shiftsi_compare0_scratch"
5117 @@ -3415,9 +3571,14 @@
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"))
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)"
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
5147 (define_expand "abssi2"
5148 @@ -3567,22 +3728,28 @@
5151 operands[2] = gen_rtx_SCRATCH (SImode);
5152 + else if (TARGET_NO_SINGLE_COND_EXEC)
5154 + emit_insn(gen_rtx_SET(VOIDmode, operands[0],
5155 + gen_rtx_ABS(SImode, operands[1])));
5159 operands[2] = gen_rtx_REG (CCmode, CC_REGNUM);
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))]
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"
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")
5185 (define_insn_and_split "*thumb1_abssi2"
5186 @@ -3600,17 +3767,17 @@
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))]
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"
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")
5212 (define_insn_and_split "*thumb1_neg_abssi2"
5213 @@ -3627,6 +3794,93 @@
5214 [(set_attr "length" "6")]
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"
5223 + [(set_attr "shift" "1")
5224 + (set_attr "length" "8")
5225 + (set_attr "predicable" "yes")]
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"
5233 + [(set_attr "shift" "1")
5234 + (set_attr "length" "8")
5235 + (set_attr "predicable" "yes")]
5238 +;; Splitters for ABS patterns.
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))))]
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))))]
5260 +;; GCC does not add/remove clobbers when matching splitters, so we need
5261 +;; variants with and without the CC clobber.
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))
5268 + (set (match_dup 0) (minus:SI (match_dup 0)
5269 + (ashiftrt:SI (match_dup 1) (const_int 31))))]
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))
5279 + (set (match_dup 0) (minus:SI (match_dup 0)
5280 + (ashiftrt:SI (match_dup 1) (const_int 31))))]
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))
5289 + (set (match_dup 0) (minus:SI (ashiftrt:SI (match_dup 1) (const_int 31))
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))
5300 + (set (match_dup 0) (minus:SI (ashiftrt:SI (match_dup 1) (const_int 31))
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"
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)"
5324 (define_insn_and_split "one_cmpldi2"
5325 @@ -3682,7 +3936,8 @@
5326 (not:SI (match_operand:SI 1 "s_register_operand" "r")))]
5329 - [(set_attr "predicable" "yes")]
5330 + [(set_attr "predicable" "yes")
5331 + (set_attr "insn" "mvn")]
5334 (define_insn "*thumb1_one_cmplsi2"
5335 @@ -3690,7 +3945,8 @@
5336 (not:SI (match_operand:SI 1 "register_operand" "l")))]
5339 - [(set_attr "length" "2")]
5340 + [(set_attr "length" "2")
5341 + (set_attr "insn" "mvn")]
5344 (define_insn "*notsi_compare0"
5345 @@ -3701,7 +3957,8 @@
5346 (not:SI (match_dup 1)))]
5349 - [(set_attr "conds" "set")]
5350 + [(set_attr "conds" "set")
5351 + (set_attr "insn" "mvn")]
5354 (define_insn "*notsi_compare0_scratch"
5355 @@ -3711,11 +3968,40 @@
5356 (clobber (match_scratch:SI 0 "=r"))]
5359 - [(set_attr "conds" "set")]
5360 + [(set_attr "conds" "set")
5361 + (set_attr "insn" "mvn")]
5364 ;; Fixed <--> Floating conversion insns
5366 +(define_expand "floatsihf2"
5367 + [(set (match_operand:HF 0 "general_operand" "")
5368 + (float:HF (match_operand:SI 1 "general_operand" "")))]
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);
5380 +(define_expand "floatdihf2"
5381 + [(set (match_operand:HF 0 "general_operand" "")
5382 + (float:HF (match_operand:DI 1 "general_operand" "")))]
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);
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"
5404 if (TARGET_MAVERICK)
5406 @@ -3740,6 +4026,30 @@
5410 +(define_expand "fix_trunchfsi2"
5411 + [(set (match_operand:SI 0 "general_operand" "")
5412 + (fix:SI (fix:HF (match_operand:HF 1 "general_operand" ""))))]
5416 + rtx op1 = convert_to_mode (SFmode, operands[1], 0);
5417 + expand_fix (operands[0], op1, 0);
5422 +(define_expand "fix_trunchfdi2"
5423 + [(set (match_operand:DI 0 "general_operand" "")
5424 + (fix:DI (fix:HF (match_operand:HF 1 "general_operand" ""))))]
5428 + rtx op1 = convert_to_mode (SFmode, operands[1], 0);
5429 + expand_fix (operands[0], op1, 0);
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"
5444 if (TARGET_MAVERICK)
5446 @@ -3776,9 +4086,25 @@
5447 [(set (match_operand:SF 0 "s_register_operand" "")
5449 (match_operand:DF 1 "s_register_operand" "")))]
5450 - "TARGET_32BIT && TARGET_HARD_FLOAT"
5451 + "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE"
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" "")))]
5464 + op1 = convert_to_mode (SFmode, operands[1], 0);
5465 + op1 = convert_to_mode (HFmode, op1, 0);
5466 + emit_move_insn (operands[0], op1);
5471 ;; Zero and sign extension instructions.
5473 @@ -3800,6 +4126,7 @@
5474 return \"mov%?\\t%R0, #0\";
5476 [(set_attr "length" "8")
5477 + (set_attr "insn" "mov")
5478 (set_attr "predicable" "yes")]
5481 @@ -3843,6 +4170,7 @@
5483 [(set_attr "length" "8")
5484 (set_attr "shift" "1")
5485 + (set_attr "insn" "mov")
5486 (set_attr "predicable" "yes")]
5489 @@ -4123,6 +4451,28 @@
5493 +(define_code_iterator ior_xor [ior xor])
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" ""))
5502 + (match_operator 5 "subreg_lowpart_operator"
5503 + [(match_operand:SI 4 "s_register_operand" "")]))))]
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))
5511 + (set (match_dup 0) (zero_extend:SI (match_dup 5)))]
5512 + "operands[5] = gen_lowpart (GET_MODE (operands[5]), operands[0]);"
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"
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" "")))]
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));
5542 ;; Move insns (including loads and stores)
5544 @@ -4877,6 +5242,7 @@
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,*,*")]
5552 @@ -4903,14 +5269,6 @@
5553 optimize && can_create_pseudo_p ());
5557 - if (TARGET_USE_MOVT && !target_word_relocations
5558 - && GET_CODE (operands[1]) == SYMBOL_REF
5559 - && !flag_pic && !arm_tls_referenced_p (operands[1]))
5561 - arm_emit_movpair (operands[0], operands[1]);
5565 else /* TARGET_THUMB1... */
5567 @@ -4984,18 +5342,9 @@
5568 (set_attr "length" "4")]
5571 -(define_insn "*arm_movw"
5572 - [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
5573 - (high:SI (match_operand:SI 1 "general_operand" "i")))]
5575 - "movw%?\t%0, #:lower16:%c1"
5576 - [(set_attr "predicable" "yes")
5577 - (set_attr "length" "4")]
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 @@
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 @@
5600 + [(set (match_operand:SI 0 "arm_general_register_operand" "")
5601 + (match_operand:SI 1 "general_operand" ""))]
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))]
5608 + arm_emit_movpair (operands[0], operands[1]);
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)))]
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;
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")]
5632 @@ -5638,7 +6002,8 @@
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")]
5641 (define_expand "thumb_movhi_clobber"
5642 @@ -5769,6 +6134,7 @@
5645 [(set_attr "type" "*,*,load1,store1")
5646 + (set_attr "insn" "mov,mvn,*,*")
5647 (set_attr "predicable" "yes")]
5650 @@ -5787,9 +6153,111 @@
5652 [(set_attr "length" "2")
5653 (set_attr "type" "*,load1,store1,*,*,*")
5654 + (set_attr "insn" "*,*,*,mov,mov,mov")
5655 (set_attr "pool_range" "*,32,*,*,*,*")]
5659 +(define_expand "movhf"
5660 + [(set (match_operand:HF 0 "general_operand" "")
5661 + (match_operand:HF 1 "general_operand" ""))]
5666 + if (GET_CODE (operands[0]) == MEM)
5667 + operands[1] = force_reg (HFmode, operands[1]);
5669 + else /* TARGET_THUMB1 */
5671 + if (can_create_pseudo_p ())
5673 + if (GET_CODE (operands[0]) != REG)
5674 + operands[1] = force_reg (HFmode, operands[1]);
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))"
5687 + switch (which_alternative)
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 */
5697 + REAL_VALUE_TYPE r;
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);
5708 + if (arm_arch_thumb2)
5709 + output_asm_insn (\"movw%?\\t%0, %1\", ops);
5711 + output_asm_insn (\"mov%?\\t%0, %2\;orr%?\\t%0, %0, %3\", ops);
5715 + gcc_unreachable ();
5718 + [(set_attr "conds" "unconditional")
5719 + (set_attr "type" "load1,store1,*,*")
5720 + (set_attr "length" "4,4,4,8")
5721 + (set_attr "predicable" "yes")
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"))]
5729 + && ( s_register_operand (operands[0], HFmode)
5730 + || s_register_operand (operands[1], HFmode))"
5732 + switch (which_alternative)
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))
5745 + /* Constant pool entry. */
5746 + return \"ldr\\t%0, %1\";
5748 + return \"ldrh\\t%0, %1\";
5750 + case 2: return \"strh\\t%1, %0\";
5751 + default: return \"mov\\t%0, %1\";
5754 + [(set_attr "length" "2")
5755 + (set_attr "type" "*,load1,store1,*,*")
5756 + (set_attr "pool_range" "*,1020,*,*,*")]
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,*")]
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" "")]
5775 + "TARGET_EITHER && !low_irq_latency"
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"
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"))
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"))
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"))
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)))]
5832 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5833 "operands[1] = arm_gen_compare_reg (EQ, arm_compare_op0, arm_compare_op1);"
5836 (define_expand "sne"
5837 [(set (match_operand:SI 0 "s_register_operand" "")
5838 (ne:SI (match_dup 1) (const_int 0)))]
5840 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5841 "operands[1] = arm_gen_compare_reg (NE, arm_compare_op0, arm_compare_op1);"
5844 (define_expand "sgt"
5845 [(set (match_operand:SI 0 "s_register_operand" "")
5846 (gt:SI (match_dup 1) (const_int 0)))]
5848 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5849 "operands[1] = arm_gen_compare_reg (GT, arm_compare_op0, arm_compare_op1);"
5852 (define_expand "sle"
5853 [(set (match_operand:SI 0 "s_register_operand" "")
5854 (le:SI (match_dup 1) (const_int 0)))]
5856 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5857 "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);"
5860 (define_expand "sge"
5861 [(set (match_operand:SI 0 "s_register_operand" "")
5862 (ge:SI (match_dup 1) (const_int 0)))]
5864 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5865 "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);"
5868 (define_expand "slt"
5869 [(set (match_operand:SI 0 "s_register_operand" "")
5870 (lt:SI (match_dup 1) (const_int 0)))]
5872 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5873 "operands[1] = arm_gen_compare_reg (LT, arm_compare_op0, arm_compare_op1);"
5876 (define_expand "sgtu"
5877 [(set (match_operand:SI 0 "s_register_operand" "")
5878 (gtu:SI (match_dup 1) (const_int 0)))]
5880 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5881 "operands[1] = arm_gen_compare_reg (GTU, arm_compare_op0, arm_compare_op1);"
5884 (define_expand "sleu"
5885 [(set (match_operand:SI 0 "s_register_operand" "")
5886 (leu:SI (match_dup 1) (const_int 0)))]
5888 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5889 "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);"
5892 (define_expand "sgeu"
5893 [(set (match_operand:SI 0 "s_register_operand" "")
5894 (geu:SI (match_dup 1) (const_int 0)))]
5896 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5897 "operands[1] = arm_gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1);"
5900 (define_expand "sltu"
5901 [(set (match_operand:SI 0 "s_register_operand" "")
5902 (ltu:SI (match_dup 1) (const_int 0)))]
5904 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
5905 "operands[1] = arm_gen_compare_reg (LTU, arm_compare_op0, arm_compare_op1);"
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,
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,
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,
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,
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,
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,
5961 @@ -8018,6 +8499,7 @@
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")]
5969 @@ -8028,6 +8510,7 @@
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")]
5977 @@ -8038,6 +8521,7 @@
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")]
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" "")))]
5990 + "TARGET_32BIT && !TARGET_NO_COND_EXEC"
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"
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"
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")]
6021 (define_insn "*movsfcc_soft_insn"
6022 @@ -8330,7 +8815,8 @@
6026 - [(set_attr "conds" "use")]
6027 + [(set_attr "conds" "use")
6028 + (set_attr "insn" "mov")]
6032 @@ -8733,7 +9219,7 @@
6033 [(match_operand 1 "cc_register" "") (const_int 0)])
6036 - "TARGET_ARM && USE_RETURN_INSN (TRUE)"
6037 + "TARGET_ARM && USE_RETURN_INSN (TRUE) && !TARGET_NO_COND_EXEC"
6040 if (arm_ccfsm_state == 2)
6041 @@ -8754,7 +9240,7 @@
6042 [(match_operand 1 "cc_register" "") (const_int 0)])
6045 - "TARGET_ARM && USE_RETURN_INSN (TRUE)"
6046 + "TARGET_ARM && USE_RETURN_INSN (TRUE) && !TARGET_NO_COND_EXEC"
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"))
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"))
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"))
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"))
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"))
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"))
6128 @@ -9194,6 +9704,7 @@
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")]
6136 @@ -9207,6 +9718,7 @@
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")]
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))]
6149 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
6151 if (operands[3] == const0_rtx)
6153 @@ -9271,6 +9783,7 @@
6156 [(set_attr "conds" "use")
6157 + (set_attr "insn" "mov")
6158 (set_attr "length" "4,4,8")]
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))]
6166 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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))]
6175 + "TARGET_ARM && !TARGET_NO_COND_EXEC"
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))]
6184 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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))]
6193 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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))]
6202 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6204 [(set_attr "conds" "clob")
6205 (set_attr "length" "12")]
6206 @@ -9968,7 +10481,7 @@
6208 (match_operand:SI 2 "s_register_operand" "r,r"))))
6209 (clobber (reg:CC CC_REGNUM))]
6211 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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")]
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))]
6228 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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")]
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))]
6245 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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"))
6264 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6265 + (eq_attr "fix_janus" "yes"))
6268 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6269 + (eq_attr "fix_janus" "yes"))
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))]
6280 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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"))
6299 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6300 + (eq_attr "fix_janus" "yes"))
6303 + (if_then_else (and (eq_attr "type" "alu_shift_reg")
6304 + (eq_attr "fix_janus" "yes"))
6307 + (set_attr "insn" "mov")]
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))]
6316 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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"))
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))]
6344 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6346 [(set_attr "conds" "clob")
6347 (set_attr "length" "12")]
6348 @@ -10171,6 +10717,7 @@
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")]
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))]
6361 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6363 [(set_attr "conds" "clob")
6364 (set_attr "length" "12")]
6365 @@ -10203,6 +10750,7 @@
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")]
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))]
6378 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
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))]
6387 + "TARGET_ARM && !TARGET_NO_SINGLE_COND_EXEC"
6389 [(set_attr "conds" "clob")
6390 (set_attr "length" "8,12")]
6391 @@ -10614,7 +11162,7 @@
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 "" "")
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 @@
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 @@
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")]
6435 @@ -10864,6 +11413,24 @@
6439 +(define_insn "align_16"
6440 + [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN16)]
6443 + assemble_align (128);
6448 +(define_insn "align_32"
6449 + [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN32)]
6452 + assemble_align (256);
6457 (define_insn "consttable_end"
6458 [(unspec_volatile [(const_int 0)] VUNSPEC_POOL_END)]
6460 @@ -10890,6 +11457,7 @@
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);
6468 @@ -10902,19 +11470,30 @@
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)))
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);
6484 + if (GET_MODE (x) == HFmode)
6485 + arm_emit_fp16_const (x);
6488 + REAL_VALUE_TYPE r;
6489 + REAL_VALUE_FROM_CONST_DOUBLE (r, x);
6490 + assemble_real (r, GET_MODE (x), BITS_PER_WORD);
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)
6503 + assemble_integer (x, 4, BITS_PER_WORD, 1);
6504 + mark_symbol_refs_as_used (x);
6508 @@ -11008,6 +11587,28 @@
6509 [(set_attr "predicable" "yes")
6510 (set_attr "insn" "clz")])
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"
6517 + [(set_attr "predicable" "yes")
6518 + (set_attr "insn" "clz")])
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"
6526 + rtx tmp = gen_reg_rtx (SImode);
6527 + emit_insn (gen_rbitsi2 (tmp, operands[1]));
6528 + emit_insn (gen_clzsi2 (operands[0], tmp));
6534 ;; V5E instructions.
6536 (define_insn "prefetch"
6537 @@ -11017,13 +11618,15 @@
6538 "TARGET_32BIT && arm_arch5e"
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.
6547 [(match_operator 0 "arm_comparison_operator"
6548 [(match_operand 1 "cc_register" "")
6551 + "TARGET_32BIT && !TARGET_NO_SINGLE_COND_EXEC"
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
6559 FIXME What format is this? */
6560 FLOAT_MODE (XF, 12, 0);
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));
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.
6574 -/* ??? This should actually have 512 bits but the precision only has 9
6576 -FRACTIONAL_INT_MODE (XI, 511, 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
6585 +#if defined (__vxworks) && defined (_WRS_KERNEL)
6586 +#include <vxWorks.h>
6591 typedef __builtin_neon_qi int8x8_t __attribute__ ((__vector_size__ (8)));
6592 typedef __builtin_neon_hi int16x4_t __attribute__ ((__vector_size__ (8)));
6594 typedef __builtin_neon_usi uint32x4_t __attribute__ ((__vector_size__ (16)));
6595 typedef __builtin_neon_udi uint64x2_t __attribute__ ((__vector_size__ (16)));
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;
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)
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);
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)
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);
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)
6624 - return (float32x2_t)__builtin_neon_vdup_nv2sf (__a);
6625 + return (float32x2_t)__builtin_neon_vdup_nv2sf ((__builtin_neon_sf) __a);
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)
6633 - return (float32x4_t)__builtin_neon_vdup_nv4sf (__a);
6634 + return (float32x4_t)__builtin_neon_vdup_nv4sf ((__builtin_neon_sf) __a);
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)
6642 - return (float32x2_t)__builtin_neon_vdup_nv2sf (__a);
6643 + return (float32x2_t)__builtin_neon_vdup_nv2sf ((__builtin_neon_sf) __a);
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)
6651 - return (float32x4_t)__builtin_neon_vdup_nv4sf (__a);
6652 + return (float32x4_t)__builtin_neon_vdup_nv4sf ((__builtin_neon_sf) __a);
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)
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);
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)
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);
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)
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);
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)
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);
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)
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);
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)
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);
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)
6714 - return (float32x2_t)__builtin_neon_vld1v2sf (__a);
6715 + return (float32x2_t)__builtin_neon_vld1v2sf ((const __builtin_neon_sf *) __a);
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)
6723 - return (float32x4_t)__builtin_neon_vld1v4sf (__a);
6724 + return (float32x4_t)__builtin_neon_vld1v4sf ((const __builtin_neon_sf *) __a);
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)
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);
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)
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);
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)
6750 - return (float32x2_t)__builtin_neon_vld1_dupv2sf (__a);
6751 + return (float32x2_t)__builtin_neon_vld1_dupv2sf ((const __builtin_neon_sf *) __a);
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)
6759 - return (float32x4_t)__builtin_neon_vld1_dupv4sf (__a);
6760 + return (float32x4_t)__builtin_neon_vld1_dupv4sf ((const __builtin_neon_sf *) __a);
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)
6768 - __builtin_neon_vst1v2sf (__a, __b);
6769 + __builtin_neon_vst1v2sf ((__builtin_neon_sf *) __a, __b);
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)
6777 - __builtin_neon_vst1v4sf (__a, __b);
6778 + __builtin_neon_vst1v4sf ((__builtin_neon_sf *) __a, __b);
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)
6786 - __builtin_neon_vst1_lanev2sf (__a, __b, __c);
6787 + __builtin_neon_vst1_lanev2sf ((__builtin_neon_sf *) __a, __b, __c);
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)
6795 - __builtin_neon_vst1_lanev4sf (__a, __b, __c);
6796 + __builtin_neon_vst1_lanev4sf ((__builtin_neon_sf *) __a, __b, __c);
6799 __extension__ static __inline void __attribute__ ((__always_inline__))
6800 @@ -8512,7 +8516,7 @@
6801 vld2_f32 (const float32_t * __a)
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);
6809 @@ -8600,7 +8604,7 @@
6810 vld2q_f32 (const float32_t * __a)
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);
6818 @@ -8676,7 +8680,7 @@
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);
6827 @@ -8748,7 +8752,7 @@
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);
6836 @@ -8807,7 +8811,7 @@
6837 vld2_dup_f32 (const float32_t * __a)
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);
6845 @@ -8892,7 +8896,7 @@
6846 vst2_f32 (float32_t * __a, float32x2x2_t __b)
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);
6853 __extension__ static __inline void __attribute__ ((__always_inline__))
6854 @@ -8969,7 +8973,7 @@
6855 vst2q_f32 (float32_t * __a, float32x4x2_t __b)
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);
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)
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);
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)
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);
6880 __extension__ static __inline void __attribute__ ((__always_inline__))
6881 @@ -9140,7 +9144,7 @@
6882 vld3_f32 (const float32_t * __a)
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);
6890 @@ -9228,7 +9232,7 @@
6891 vld3q_f32 (const float32_t * __a)
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);
6899 @@ -9304,7 +9308,7 @@
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);
6908 @@ -9376,7 +9380,7 @@
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);
6917 @@ -9435,7 +9439,7 @@
6918 vld3_dup_f32 (const float32_t * __a)
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);
6926 @@ -9520,7 +9524,7 @@
6927 vst3_f32 (float32_t * __a, float32x2x3_t __b)
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);
6934 __extension__ static __inline void __attribute__ ((__always_inline__))
6935 @@ -9597,7 +9601,7 @@
6936 vst3q_f32 (float32_t * __a, float32x4x3_t __b)
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);
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)
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);
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)
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);
6961 __extension__ static __inline void __attribute__ ((__always_inline__))
6962 @@ -9768,7 +9772,7 @@
6963 vld4_f32 (const float32_t * __a)
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);
6971 @@ -9856,7 +9860,7 @@
6972 vld4q_f32 (const float32_t * __a)
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);
6980 @@ -9932,7 +9936,7 @@
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);
6989 @@ -10004,7 +10008,7 @@
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);
6998 @@ -10063,7 +10067,7 @@
6999 vld4_dup_f32 (const float32_t * __a)
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);
7007 @@ -10148,7 +10152,7 @@
7008 vst4_f32 (float32_t * __a, float32x2x4_t __b)
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);
7015 __extension__ static __inline void __attribute__ ((__always_inline__))
7016 @@ -10225,7 +10229,7 @@
7017 vst4q_f32 (float32_t * __a, float32x4x4_t __b)
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);
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)
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);
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)
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);
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
7048 Target RejectNegative Joined Undocumented Var(target_fpe_name)
7051 +Target RejectNegative Joined Var(target_fp16_format_name)
7052 +Specify the __fp16 floating-point format
7056 Target RejectNegative Mask(FPE) Undocumented
7058 Target RejectNegative
7059 Alias for -mfloat-abi=hard
7062 +Target Report Mask(FIX_JANUS)
7063 +Work around hardware errata for Avalent Janus 2CC cores.
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
7073 +Target Report Mask(MARVELL_DIV)
7074 +Generate hardware integer division instructions supported by some Marvell cores.
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
7084 +Target Report Var(low_irq_latency)
7085 +Try to reduce interrupt latency of the generated code
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
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);
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 @@
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,
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);
7122 extern int arm_apply_result_size (void);
7123 +extern rtx aapcs_libcall_value (enum machine_mode);
7125 #endif /* RTX_CODE */
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
7131 ;; -*- buffer-read-only: t -*-
7132 ;; Generated automatically by gentune.sh from arm-cores.def
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
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"
7147 /* TARGET_BIG_ENDIAN_DEFAULT is set in
7148 config.gcc for big endian configurations. */
7151 #define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}"
7153 +#define BE8_LINK_SPEC " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
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
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
7166 #define LINK_SPEC BPABI_LINK_SPEC
7168 #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
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")));
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")));
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")));
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")));
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
7199 #endif /* L_aeabi_ulcmp */
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__)
7210 + .ifc \signed, unsigned
7212 + mov xxh, #0xffffffff
7218 + movlt xxh, #0x80000000
7220 + movgt xxh, #0x7fffffff
7221 + movgt xxl, #0xffffffff
7223 + b SYM (__aeabi_ldiv0) __PLT__
7226 + /* Note: Thumb-1 code calls via an ARM shim on processors which
7227 + support ARM mode. */
7233 + .ifc \signed, unsigned
7234 + movne xxh, #0xffffffff
7235 + movne xxl, #0xffffffff
7237 + movlt xxh, #0x80000000
7239 + movgt xxh, #0x7fffffff
7240 + movgt xxl, #0xffffffff
7242 + b SYM (__aeabi_ldiv0) __PLT__
7247 #ifdef L_aeabi_ldivmod
7249 ARM_FUNC_START aeabi_ldivmod
7250 + test_div_by_zero signed
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__)
7261 + stmfd sp!, {sp, lr}
7263 bl SYM(__gnu_ldivmod_helper) __PLT__
7270 #endif /* L_aeabi_ldivmod */
7271 @@ -85,17 +134,20 @@
7272 #ifdef L_aeabi_uldivmod
7274 ARM_FUNC_START aeabi_uldivmod
7275 + test_div_by_zero unsigned
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__)
7286 + stmfd sp!, {sp, lr}
7288 bl SYM(__gnu_uldivmod_helper) __PLT__
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
7301 #endif /* L_aeabi_ulcmp */
7303 +.macro test_div_by_zero signed
7312 + .ifc \signed, unsigned
7315 + mvn xxh, xxh @ 0xffffffff
7322 + mvn xxl, xxl @ 0xffffffff
7323 + lsr xxh, xxl, #1 @ 0x7fffffff
7326 + lsl xxh, xxh, #24 @ 0x80000000
7330 + @ tailcalls are tricky on v6-m.
7336 + @ We know we are not on armv4t, so pop pc is safe.
7340 + .word __aeabi_ldiv0 - 1b
7344 #ifdef L_aeabi_ldivmod
7346 FUNC_START aeabi_ldivmod
7347 + test_div_by_zero signed
7353 #ifdef L_aeabi_uldivmod
7355 FUNC_START aeabi_uldivmod
7356 + test_div_by_zero unsigned
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
7365 ;; In ARM state, 'l' is an alias for 'r'
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
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
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
7384 (define_register_constraint "h" "TARGET_THUMB ? HI_REGS : NO_REGS"
7385 "In Thumb state the core registers @code{r8}-@code{r15}.")
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")))))
7394 (define_register_constraint "k" "STACK_REG"
7395 "@internal The stack register.")
7397 @@ -116,11 +124,9 @@
7398 : ((ival >= 0 && ival <= 1020) && ((ival & 3) == 0))")))
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)")))
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)")))
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)")))
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)")))
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"
7433 In ARM/Thumb-2 state a const_double which can be used with a VFP fconsts
7434 - or fconstd instruction."
7436 (and (match_code "const_double")
7437 (match_test "TARGET_32BIT && vfp3_const_double_rtx (op)")))
7439 +(define_constraint "Dy"
7441 + In ARM/Thumb-2 state a const_double which can be used with a VFP fconstd
7443 + (and (match_code "const_double")
7444 + (match_test "TARGET_32BIT && TARGET_VFP_DOUBLE && vfp3_const_double_rtx (op)")))
7446 (define_memory_constraint "Ut"
7448 In ARM/Thumb-2 state an address valid for loading/storing opaque structure
7449 @@ -214,17 +239,24 @@
7451 (define_memory_constraint "Un"
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)")))
7458 +(define_memory_constraint "Um"
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)")))
7466 (define_memory_constraint "Us"
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)")))
7474 (define_memory_constraint "Uq"
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
7480 +/* Half-float conversion routines.
7482 + Copyright (C) 2008, 2009 Free Software Foundation, Inc.
7483 + Contributed by CodeSourcery.
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
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.
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.
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/>. */
7504 +static inline unsigned short
7505 +__gnu_f2h_internal(unsigned int a, int ieee)
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;
7517 + return sign | 0x7e00 | (mantissa >> 13);
7520 + if (aexp == 0 && mantissa == 0)
7525 + /* Decimal point between bits 22 and 23. */
7526 + mantissa |= 0x00800000;
7529 + mask = 0x007fffff;
7532 + else if (aexp != -25)
7533 + mask >>= 24 + aexp;
7536 + mask = 0x00001fff;
7539 + if (mantissa & mask)
7541 + increment = (mask + 1) >> 1;
7542 + if ((mantissa & mask) == increment)
7543 + increment = mantissa & (increment << 1);
7544 + mantissa += increment;
7545 + if (mantissa >= 0x01000000)
7555 + return sign | 0x7c00;
7560 + return sign | 0x7fff;
7568 + mantissa >>= -14 - aexp;
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));
7578 +__gnu_h2f_internal(unsigned short a, int ieee)
7580 + unsigned int sign = (unsigned int)(a & 0x8000) << 16;
7581 + int aexp = (a >> 10) & 0x1f;
7582 + unsigned int mantissa = a & 0x3ff;
7584 + if (aexp == 0x1f && ieee)
7585 + return sign | 0x7f800000 | (mantissa << 13);
7591 + if (mantissa == 0)
7594 + shift = __builtin_clz(mantissa) - 21;
7595 + mantissa <<= shift;
7599 + return sign | (((aexp + 0x70) << 23) + (mantissa << 13));
7603 +__gnu_f2h_ieee(unsigned int a)
7605 + return __gnu_f2h_internal(a, 1);
7609 +__gnu_h2f_ieee(unsigned short a)
7611 + return __gnu_h2f_internal(a, 1);
7615 +__gnu_f2h_alternative(unsigned int x)
7617 + return __gnu_f2h_internal(x, 0);
7621 +__gnu_h2f_alternative(unsigned short a)
7623 + return __gnu_h2f_internal(a, 0);
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 @@
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\";
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
7645 +;; ARM instruction patterns for hardware division
7646 +;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
7647 +;; Written by CodeSourcery, LLC.
7649 +;; This file is part of GCC.
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.
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.
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.
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")))]
7671 + "sdiv%?\t%0, %1, %2"
7672 + [(set_attr "predicable" "yes")
7673 + (set_attr "insn" "sdiv")]
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")))]
7681 + "udiv%?\t%0, %1, %2"
7682 + [(set_attr "predicable" "yes")
7683 + (set_attr "insn" "udiv")]
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
7690 ARM_FUNC_START adddf3
7691 ARM_FUNC_ALIAS aeabi_dadd adddf3
7693 -1: do_push {r4, r5, lr}
7694 +1: do_push (r4, r5, lr)
7696 @ Look for zeroes, equal values, INF, or NAN.
7697 shift1 lsl, r4, xh, #1
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
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
7717 RETc(eq) @ we are done already.
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
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)
7732 - do_push {r4, r5, lr}
7733 + do_push (r4, r5, lr)
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)
7744 - do_push {r4, r5, lr}
7745 + do_push (r4, r5, lr)
7748 ands r5, ah, #0x80000000 @ sign bit in r5
7750 @ Legacy code expects the result to be returned in f0. Copy it
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)
7765 @ Mask out exponents, trap any zero/denormal/INF/NAN.
7768 ARM_FUNC_START divdf3
7769 ARM_FUNC_ALIAS aeabi_ddiv divdf3
7771 - do_push {r4, r5, r6, lr}
7772 + do_push (r4, r5, r6, lr)
7774 @ Mask out exponents, trap any zero/denormal/INF/NAN.
7776 @@ -1117,7 +1117,7 @@
7777 ARM_FUNC_ALIAS eqdf2 cmpdf2
7778 mov ip, #1 @ how should we specify unordered here?
7780 -1: str ip, [sp, #-4]
7781 +1: str ip, [sp, #-4]!
7783 @ Trap any INF/NAN first.
7785 @@ -1129,7 +1129,8 @@
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
7791 + orrs ip, xl, xh, lsl #1 @ if x == 0.0 or -0.0
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 @@
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
7804 @@ -1194,7 +1195,7 @@
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)
7811 @ Set the Z flag correctly, and the C flag unconditionally.
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
7817 and r3, ip, #0x80000000
7819 @ Well, no way to make it shorter without the umull instruction.
7820 - do_push {r3, r4, r5}
7821 + do_push (r3, r4, r5)
7824 bic r0, r0, r4, lsl #16
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)
7835 ARM_FUNC_ALIAS eqsf2 cmpsf2
7836 mov ip, #1 @ how should we specify unordered here?
7838 -1: str ip, [sp, #-4]
7839 +1: str ip, [sp, #-4]!
7841 @ Trap any INF/NAN first.
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
7849 + orrs ip, r2, r3, lsr #1 @ test if both are 0, clear C flag
7851 teqne r0, r1 @ if not 0 compare sign
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.
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)
7869 @ Set the Z flag correctly, and the C flag unconditionally.
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
7875 #if defined(__ELF__) && defined(__linux__)
7876 .section .note.GNU-stack,"",%progbits
7879 +#endif /* __ELF__ and __linux__ */
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 /* ------------------------------------------------------------------------ */
7892 /* We need to know what prefix to add to function names. */
7894 .macro shift1 op, arg0, arg1, arg2
7895 \op \arg0, \arg1, \arg2
7897 -#define do_push push
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
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
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);\
7924 +#define do_push5(r1, r2, r3, r4, r5) \
7925 + do_push4 (r2, r3, r4, r5);\
7928 +#define do_pop(...) \
7929 +_buildN1(do_pop, _buildC1(__VA_ARGS__))( __VA_ARGS__)
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) \
7936 + do_pup3 (r2, r3, r4)
7937 +#define do_pop5(r1, r2, r3, r4, r5) \
7939 + do_pop4 (r2, r3, r4, r5)
7941 +#define do_push(...) stmfd sp!, { __VA_ARGS__}
7942 +#define do_pop(...) ldmfd sp!, {__VA_ARGS__}
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
7952 -.macro ARM_LDIV0 name
7953 +#ifdef __ARM_EABI__
7954 +.macro ARM_LDIV0 name signed
7956 + .ifc \signed, unsigned
7957 + movne r0, #0xffffffff
7959 + movgt r0, #0x7fffffff
7960 + movlt r0, #0x80000000
7962 + b SYM (__aeabi_idiv0) __PLT__
7965 +.macro ARM_LDIV0 name signed
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.
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
7983 + mvn r0, r0 @ 0xffffffff
7991 + lsr r0, r0, #1 @ 0x7fffffff
7994 + lsl r0, r0, #24 @ 0x80000000
8002 + @ We know we are not on armv4t, so pop pc is safe.
8006 + .word __aeabi_idiv0 - 4b
8007 +#elif defined(__thumb2__)
8009 + .ifc \signed, unsigned
8011 + mov r0, #0xffffffff
8016 + movgt r0, #0x7fffffff
8018 + movlt r0, #0x80000000
8020 + b.w SYM(__aeabi_idiv0) __PLT__
8027 + .ifc \signed, unsigned
8028 + movne r0, #0xffffffff
8030 + movgt r0, #0x7fffffff
8031 + movlt r0, #0x80000000
8033 + b SYM(__aeabi_idiv0) __PLT__
8038 +.macro THUMB_LDIV0 name signed
8040 98: cfi_push 98b - __\name, 0xe, -0x4, 0x8
8042 @@ -277,18 +395,19 @@
8048 .macro FUNC_END name
8052 -.macro DIV_FUNC_END name
8053 +.macro DIV_FUNC_END name signed
8054 cfi_start __\name, LSYM(Lend_div0)
8058 + THUMB_LDIV0 \name \signed
8061 + ARM_LDIV0 \name \signed
8063 cfi_end LSYM(Lend_div0)
8065 @@ -413,6 +532,12 @@
8069 +#ifdef __ARM_EABI__
8071 + .weak SYM (__\name)
8076 /* Register aliases. */
8078 @@ -437,6 +562,43 @@
8080 #if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
8082 +#if defined (__thumb2__)
8083 + clz \curbit, \dividend
8084 + clz \result, \divisor
8085 + sub \curbit, \result, \curbit
8086 + rsb \curbit, \curbit, #31
8088 + add \curbit, \result, \curbit, lsl #4
8095 + .set shift, shift - 1
8096 + cmp.w \dividend, \divisor, lsl #shift
8098 + adc.w \result, \result, \result
8100 + subcs.w \dividend, \dividend, \divisor, lsl #shift
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
8110 + add pc, pc, \curbit, lsl #2
8113 + cmp \dividend, \divisor
8114 + subcs \dividend, \dividend, \divisor
8115 + mov \divisor, \divisor, lsr #1
8116 + adc \result, \result, \result
8118 +#else /* ! defined(__ARM_TUNE_MARVELL_F__) */
8119 clz \curbit, \dividend
8120 clz \result, \divisor
8121 sub \curbit, \result, \curbit
8123 adc \result, \result, \result
8124 subcs \dividend, \dividend, \divisor, lsl #shift
8126 +#endif /* defined(__ARM_TUNE_MARVELL_F__) */
8128 #else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
8129 #if __ARM_ARCH__ >= 5
8130 @@ -499,18 +662,23 @@
8133 1: cmp \dividend, \divisor
8135 subhs \dividend, \dividend, \divisor
8136 orrhs \result, \result, \curbit
8137 cmp \dividend, \divisor, lsr #1
8139 subhs \dividend, \dividend, \divisor, lsr #1
8140 orrhs \result, \result, \curbit, lsr #1
8141 cmp \dividend, \divisor, lsr #2
8143 subhs \dividend, \dividend, \divisor, lsr #2
8144 orrhs \result, \result, \curbit, lsr #2
8145 cmp \dividend, \divisor, lsr #3
8147 subhs \dividend, \dividend, \divisor, lsr #3
8148 orrhs \result, \result, \curbit, lsr #3
8149 cmp \dividend, #0 @ Early termination?
8151 movnes \curbit, \curbit, lsr #4 @ No, any more bits to do?
8152 movne \divisor, \divisor, lsr #4
8154 @@ -799,13 +967,14 @@
8155 /* ------------------------------------------------------------------------ */
8158 +#if defined(__ARM_ARCH_6M__)
8161 FUNC_ALIAS aeabi_uidiv udivsi3
8167 +LSYM(udivsi3_nodiv0):
8171 @@ -819,9 +988,16 @@
8175 -#else /* ARM version. */
8176 +#else /* ARM/Thumb-2 version. */
8178 + ARM_FUNC_START udivsi3
8179 + ARM_FUNC_ALIAS aeabi_uidiv udivsi3
8181 + /* Note: if called via udivsi3_nodiv0, this will unnecessarily check
8182 + for division-by-zero a second time. */
8183 +LSYM(udivsi3_nodiv0):
8189 @@ -834,7 +1010,8 @@
8199 @@ -845,19 +1022,24 @@
8201 #endif /* ARM version */
8203 - DIV_FUNC_END udivsi3
8204 + DIV_FUNC_END udivsi3 unsigned
8206 +#if defined(__ARM_ARCH_6M__)
8207 FUNC_START aeabi_uidivmod
8213 + bl LSYM(udivsi3_nodiv0)
8219 +ARM_FUNC_START aeabi_uidivmod
8222 stmfd sp!, { r0, r1, lr }
8224 + bl LSYM(udivsi3_nodiv0)
8225 ldmfd sp!, { r1, r2, lr }
8228 @@ -904,19 +1086,20 @@
8230 #endif /* ARM version. */
8232 - DIV_FUNC_END umodsi3
8233 + DIV_FUNC_END umodsi3 unsigned
8235 #endif /* L_umodsi3 */
8236 /* ------------------------------------------------------------------------ */
8239 +#if defined(__ARM_ARCH_6M__)
8242 FUNC_ALIAS aeabi_idiv divsi3
8248 +LSYM(divsi3_nodiv0):
8251 eor work, divisor @ Save the sign of the result.
8252 @@ -945,15 +1128,21 @@
8256 -#else /* ARM version. */
8257 +#else /* ARM/Thumb-2 version. */
8259 + ARM_FUNC_START divsi3
8260 + ARM_FUNC_ALIAS aeabi_idiv divsi3
8263 - eor ip, r0, r1 @ save the sign of the result.
8265 +LSYM(divsi3_nodiv0):
8266 + eor ip, r0, r1 @ save the sign of the result.
8268 rsbmi r1, r1, #0 @ loops below use unsigned.
8269 subs r2, r1, #1 @ division by 1 or -1 ?
8273 rsbmi r3, r0, #0 @ positive dividend value
8276 @@ -963,14 +1152,18 @@
8277 ARM_DIV_BODY r3, r1, r0, r2
8284 10: teq ip, r0 @ same sign ?
8293 moveq r0, ip, asr #31
8296 @@ -979,24 +1172,30 @@
8304 #endif /* ARM version */
8306 - DIV_FUNC_END divsi3
8307 + DIV_FUNC_END divsi3 signed
8309 +#if defined(__ARM_ARCH_6M__)
8310 FUNC_START aeabi_idivmod
8316 + bl LSYM(divsi3_nodiv0)
8322 +ARM_FUNC_START aeabi_idivmod
8325 stmfd sp!, { r0, r1, lr }
8327 + bl LSYM(divsi3_nodiv0)
8328 ldmfd sp!, { r1, r2, lr }
8331 @@ -1062,21 +1261,25 @@
8333 #endif /* ARM version */
8335 - DIV_FUNC_END modsi3
8336 + DIV_FUNC_END modsi3 signed
8338 #endif /* L_modsi3 */
8339 /* ------------------------------------------------------------------------ */
8343 - FUNC_ALIAS aeabi_idiv0 div0
8344 - FUNC_ALIAS aeabi_ldiv0 div0
8346 +#ifdef __ARM_EABI__
8349 + FUNC_START aeabi_idiv0
8350 + FUNC_START aeabi_ldiv0
8353 FUNC_END aeabi_ldiv0
8354 FUNC_END aeabi_idiv0
8361 #endif /* L_divmodsi_tools */
8362 /* ------------------------------------------------------------------------ */
8363 @@ -1086,16 +1289,49 @@
8364 /* Constant taken from <asm/signal.h>. */
8367 +#ifdef __ARM_EABI__
8370 + ARM_FUNC_START aeabi_idiv0
8371 + ARM_FUNC_START aeabi_ldiv0
8379 bl SYM(raise) __PLT__
8382 +#ifdef __ARM_EABI__
8383 + FUNC_END aeabi_ldiv0
8384 + FUNC_END aeabi_idiv0
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
8395 +#if __ARM_ARCH__ >= 7 || defined(__ARM_ARCH_6T2__)
8406 + FUNC_END clear_cache
8408 +#error "This is only for ARM EABI GNU/Linux"
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 @@
8417 ARM_FUNC_START clzdi2
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
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. */
8430 -#define LINK_SPEC LINUX_TARGET_LINK_SPEC
8431 +#define LINK_SPEC LINUX_TARGET_LINK_SPEC BE8_LINK_SPEC
8433 /* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
8434 do not use -lfloat. */
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
8442 #undef CLEAR_INSN_CACHE
8443 -#define CLEAR_INSN_CACHE(BEG, END) \
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" \
8451 - : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \
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
8459 /* NWFPE always understands FPA instructions. */
8460 #undef FPUTYPE_DEFAULT
8461 -#define FPUTYPE_DEFAULT FPUTYPE_FPA_EMU3
8462 +#define FPUTYPE_DEFAULT "fpe3"
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
8470 +;; Marvell 2850 pipeline description
8471 +;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
8472 +;; Written by Marvell and CodeSourcery, Inc.
8474 +;; This file is part of GCC.
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.
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.
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.
8491 +;; This automaton provides a pipeline description for the Marvell
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.
8498 +(define_automaton "marvell_f")
8500 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8502 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8504 +;; This is a dual-issue processor with three pipelines:
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
8510 +;; 2. Arithmetic pipeline A2.
8511 +;; Issue | E1 | E2 | WB
8513 +;; 3. Multiply and multiply-accumulate pipeline.
8514 +;; Issue | MAC1 | MAC2 | MAC3 | WB
8516 +;; There are various bypasses modelled to a greater or lesser extent.
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.
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
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.
8529 +(define_cpu_unit "sram" "marvell_f")
8531 +;; Handling of dual-issue constraints.
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
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);
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).
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.
8560 +;; First Second instruction group
8562 +;; DP1 DP2 L S SWP PLD CLZ M2 M3 B
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
8568 +;; SWP } ok ok X X X X ok ok ok ok
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
8577 +;; (1) without register shift
8578 +;; (2) with register shift
8579 +;; (3) with immediate offset
8580 +;; (4) with register offset
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.
8588 +(define_cpu_unit "reg_shift_lock" "marvell_f")
8590 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8591 +;; ALU instructions
8592 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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.
8600 +;; The first two cases are separate so they can be identified for
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)")
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)")
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)")
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)")
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).
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.
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)")
8645 +;; 3. ALU operations with a shift-by-constant operand.
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)")
8653 +;; 4. ALU operations with a shift-by-register operand. Since the
8654 +;; instruction is never mov or mvn, a dual-issue constraint must
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)")
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.
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")
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")
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")
8692 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8693 +;; Multiplication instructions
8694 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8696 +;; Multiplication instructions in group "Multiply 2".
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")
8703 +;; Multiplication instructions in group "Multiply 3". There is a
8704 +;; dual-issue constraint with non-multiplication ALU instructions
8705 +;; to be respected here.
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")
8713 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8714 +;; Branch instructions
8715 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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
8722 +(define_insn_reservation "marvell_f_branches" 0
8723 + (and (eq_attr "tune" "marvell_f")
8724 + (eq_attr "type" "branch"))
8727 +;; Call latencies are not predictable; a semi-arbitrary very large
8728 +;; number is used as "positive infinity" for such latencies.
8730 +(define_insn_reservation "marvell_f_call" 32
8731 + (and (eq_attr "tune" "marvell_f")
8732 + (eq_attr "type" "call"))
8735 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8736 +;; Load/store instructions
8737 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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.
8743 +;; 1. Load/store for single registers.
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.
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")
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.
8764 +(define_bypass 2 "marvell_f_load1"
8765 + "marvell_f_alu_shift_op"
8766 + "arm_no_early_alu_shift_value_dep")
8768 +(define_bypass 2 "marvell_f_load1"
8769 + "marvell_f_alu_shift_reg_op"
8770 + "arm_no_early_alu_shift_dep")
8772 +;; Stores write at the WR stage and loads read at the E2 stage, giving
8773 +;; a store latency of three.
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")
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.
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")
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")
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.
8800 +(define_bypass 3 "marvell_f_load2"
8801 + "marvell_f_alu_shift_op"
8802 + "arm_no_early_alu_shift_value_dep")
8804 +(define_bypass 3 "marvell_f_load2"
8805 + "marvell_f_alu_shift_reg_op"
8806 + "arm_no_early_alu_shift_dep")
8808 +;; 3. Load/store for more than two registers.
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.
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")
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.
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")
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
8839 +;; Marvell 2850 VFP pipeline description
8840 +;; Copyright (C) 2007 Free Software Foundation, Inc.
8841 +;; Written by CodeSourcery, Inc.
8843 +;; This file is part of GCC.
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.
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.
8855 +;; This automaton provides a pipeline description for the Marvell
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.
8862 +(define_automaton "marvell_f_vfp")
8864 +;; This is a single-issue VFPv2 implementation with the following execution
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.
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.
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.
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.
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")
8910 +;; An attribute to indicate whether our reservations are applicable.
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"))))
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.
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.
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")
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")
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")
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")
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
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")
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")
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")
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")
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")
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")
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")
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
8996 +/* MontaVista GNU/Linux Configuration.
8997 + Copyright (C) 2009
8998 + Free Software Foundation, Inc.
9000 +This file is part of GCC.
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)
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.
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/>. */
9016 +/* Add -tarmv6 and -tthumb2 options for convenience in generating multilibs.
9019 +#define CC1_SPEC " \
9020 + %{tarmv6: -march=armv6 -mfloat-abi=softfp ; \
9021 + tthumb2: -mthumb -march=armv7-a -mfloat-abi=softfp ; \
9024 +/* The various C libraries each have their own subdirectory. */
9025 +#undef SYSROOT_SUFFIX_SPEC
9026 +#define SYSROOT_SUFFIX_SPEC \
9027 + "%{tarmv6:/armv6 ; \
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
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)
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"
9049 @@ -399,7 +400,11 @@
9053 +"#if defined (__vxworks) && defined (_WRS_KERNEL)";
9054 +"#include <vxWorks.h>";
9056 "#include <stdint.h>";
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
9068 - (UNSPEC_VZIP2 204)])
9069 + (UNSPEC_VZIP2 204)
9070 + (UNSPEC_MISALIGNED_ACCESS 205)])
9072 ;; Double-width vector modes.
9073 (define_mode_iterator VD [V8QI V4HI V2SI V2SF])
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"))]
9080 + && (register_operand (operands[0], <MODE>mode)
9081 + || register_operand (operands[1], <MODE>mode))"
9083 if (which_alternative == 2)
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
9093 switch (which_alternative)
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"))]
9100 + && (register_operand (operands[0], <MODE>mode)
9101 + || register_operand (operands[1], <MODE>mode))"
9103 if (which_alternative == 2)
9105 @@ -549,6 +554,11 @@
9106 (match_operand:TI 1 "general_operand" ""))]
9109 + if (can_create_pseudo_p ())
9111 + if (GET_CODE (operands[0]) != REG)
9112 + operands[1] = force_reg (TImode, operands[1]);
9116 (define_expand "mov<mode>"
9117 @@ -556,12 +566,19 @@
9118 (match_operand:VSTRUCT 1 "general_operand" ""))]
9121 + if (can_create_pseudo_p ())
9123 + if (GET_CODE (operands[0]) != REG)
9124 + operands[1] = force_reg (<MODE>mode, operands[1]);
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"))]
9133 + && (register_operand (operands[0], <MODE>mode)
9134 + || register_operand (operands[1], <MODE>mode))"
9136 switch (which_alternative)
9138 @@ -658,6 +675,49 @@
9139 neon_disambiguate_copy (operands, dest, src, 4);
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"
9148 + if (!s_register_operand (operands[0], <MODE>mode)
9149 + && !s_register_operand (operands[1], <MODE>mode))
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")])
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")])
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")])
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")])
9185 (define_insn "vec_set<mode>_internal"
9186 [(set (match_operand:VD 0 "s_register_operand" "=w")
9188 @@ -862,6 +922,50 @@
9189 (const_string "neon_mul_qqq_8_16_32_ddd_32")))))]
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")))]
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))
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")))))]
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"))))]
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))
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")))))]
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 @@
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";
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
9253 | T_ptrto of vectype | T_const of vectype
9257 + | T_intDI | T_floatSF
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
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
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
9289 #undef FPUTYPE_DEFAULT
9290 -#define FPUTYPE_DEFAULT FPUTYPE_VFP
9291 +#define FPUTYPE_DEFAULT "vfp"
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
9297 +/* Definitions for generic libgloss based cofigs where crt0 is supplied by
9298 + the linker script.
9299 + Copyright (C) 2006 Free Software Foundation, Inc.
9301 + This file is part of GCC.
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.
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.
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/>. */
9317 +#undef STARTFILE_SPEC
9318 +#define STARTFILE_SPEC " crti%O%s crtbegin%O%s"
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
9326 || REGNO_REG_CLASS (REGNO (op)) == FPA_REGS));
9329 +(define_special_predicate "subreg_lowpart_operator"
9330 + (and (match_code "subreg")
9331 + (match_test "subreg_lowpart_p (op)")))
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)")))
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)")))
9345 ;; True for logical binary operators.
9346 (define_special_predicate "logical_binary_operator"
9347 (and (match_code "ior,xor,and")
9349 HOST_WIDE_INT i = 1, base = 0;
9352 + if (low_irq_latency)
9356 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
9359 HOST_WIDE_INT i = 1, base = 0;
9362 + if (low_irq_latency)
9366 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
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
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)
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
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
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
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
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
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
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
9420 +MULTILIB_OPTIONS += mfloat-abi=hard
9421 +MULTILIB_DIRNAMES += fpu
9422 +MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
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
9431 +# Overrides for ASA
9433 +# Here is the expected output from xgcc -print-multi-lib.
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
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
9448 +MULTILIB_EXTRA_OPTS = fno-omit-frame-pointer mapcs-frame
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*
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
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
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
9485 # Add the BPABI C functions.
9486 LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \
9487 $(srcdir)/config/arm/unaligned-funcs.c
9489 +LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
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
9498 +# Multilibs for SourceryG++ arm-none-eabi
9500 +MULTILIB_OPTIONS = mthumb
9501 +MULTILIB_DIRNAMES = t
9502 +MULTILIB_EXCEPTIONS =
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
9551 +MULTILIB_OPTIONS += mfloat-abi=softfp/mfloat-abi=hard
9552 +MULTILIB_DIRNAMES += softfp hard
9553 +MULTILIB_MATCHES += mfloat-abi?hard=mhard-float
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
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
9573 +MULTILIB_OPTIONS += mbig-endian
9574 +MULTILIB_DIRNAMES += be
9575 +MULTILIB_ALIASES += mbig-endian=mfpu?neon/mbig-endian
9577 +# ARMv6-M does not have ARM mode.
9578 +MULTILIB_EXCEPTIONS += march=armv6-m
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
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
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
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
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
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
9637 +# We don't have a big-endian ARMv6-M compatible multilibs.
9638 +MULTILIB_EXCEPTIONS += *march=armv6-m*mbig-endian
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
9646 +# Use ARM libraries for big-endian Thumb.
9647 +MULTILIB_ALIASES += mbig-endian=mthumb/mbig-endian
9649 +# Don't bother with big-endian Thumb-2 VFP. Use the soft-float libraries
9651 +MULTILIB_ALIASES += mthumb/march?armv7/mbig-endian=mthumb/march?armv7/mfloat-abi?softfp/mbig-endian
9653 +# The only -mfloat-abi=hard libraries provided are for little-endian
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
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
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
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
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
9700 +# We build 4 multilibs:
9703 +# thumb2/ -mthumb -march=armv7
9704 +# armv6-m/ -mthumb -march=armv6-m
9706 +MULTILIB_OPTIONS = mthumb
9707 +MULTILIB_DIRNAMES = thumb
9708 +MULTILIB_EXCEPTIONS =
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
9726 +MULTILIB_EXCEPTIONS += march=armv6-m
9727 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m1
9728 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m0
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
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
9740 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7
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
9751 +# Multilibs for SourceryG++ arm-none-linux-gnueabi
9753 +MULTILIB_OPTIONS = mthumb
9754 +MULTILIB_DIRNAMES = t
9755 +MULTILIB_EXCEPTIONS =
9759 +MULTILIB_OPTIONS += march=armv4t/march=armv7-a
9760 +MULTILIB_DIRNAMES += v4t v7a
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
9784 +MULTILIB_OPTIONS += mfloat-abi=softfp/mfloat-abi=hard
9785 +MULTILIB_DIRNAMES += softfp hard
9786 +MULTILIB_MATCHES += mfloat-abi?hard=mhard-float
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
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
9804 +# Do not build Thumb libraries.
9805 +MULTILIB_EXCEPTIONS += mthumb
9806 +MULTILIB_EXCEPTIONS += mthumb/mfpu=neon
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
9817 +# We do not support ARMv4t big-endian.
9818 +MULTILIB_EXCEPTIONS += *march=armv4t*mbig-endian
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
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
9837 +# Use ARM libraries for big-endian Thumb.
9838 +MULTILIB_ALIASES += mbig-endian=mthumb/mbig-endian
9840 +# Don't bother with big-endian Thumb-2 VFP. Use the soft-float libraries
9842 +MULTILIB_ALIASES += mthumb/march?armv7-a/mbig-endian=mthumb/march?armv7-a/mfloat-abi?softfp/mbig-endian
9844 +# The only -mfloat-abi=hard libraries provided are for little-endian
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
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
9867 +# We build 3 multilibs:
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
9878 +MULTILIB_ALIASES = march?armv4t=mthumb/march?armv4t
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
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
9919 +# EABI uClinux multilib selection. Other setting are inherited from t-arm-elf
9921 +# We build 3 multilibs:
9923 +# thumb2/ -mthumb -march=armv7 -mfix-cortex-m3-ldrd
9924 +# armv6-m/ -mthumb -march=armv6-m
9926 +MULTILIB_OPTIONS = mthumb
9927 +MULTILIB_DIRNAMES = thumb
9928 +MULTILIB_EXCEPTIONS =
9931 +MULTILIB_OPTIONS += march=armv7/march=armv6-m
9932 +MULTILIB_DIRNAMES += armv7 armv6-m
9934 +MULTILIB_EXCEPTIONS += mthumb
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
9951 +MULTILIB_EXCEPTIONS += march=armv6-m
9952 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m1
9953 +MULTILIB_MATCHES += march?armv6-m=mcpu?cortex-m0
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
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
9968 +MULTILIB_ALIASES += mthumb/march?armv7/mfix-cortex-m3-ldrd=mthumb/march?armv7
9971 +MULTILIB_OSDIRNAMES = mthumb/march.armv7/mfix-cortex-m3-ldrd=!thumb2
9972 +MULTILIB_OSDIRNAMES += mthumb/march.armv6-m=!armv6-m
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
9978 ;; changes made in armv5t as "thumb2". These are considered part
9979 ;; the 16-bit Thumb-1 instruction set.
9981 +(include "hwdiv.md")
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")]
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))]
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")]
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))]
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")]
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,*")]
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 @@
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,*,*")]
10054 ;; ??? We can probably do better with thumb2
10055 @@ -1128,27 +1109,7 @@
10056 return \"add%!\\t%0, %1, %2\";
10058 [(set_attr "predicable" "yes")
10059 - (set_attr "length" "2")]
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")]
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")]
10083 (define_insn "*thumb2_subsi_short"
10084 @@ -1162,6 +1123,71 @@
10085 (set_attr "length" "2")]
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.
10094 + [(set (match_operand:SI 0 "low_register_operand" "")
10095 + (mult:SI (match_operand:SI 1 "low_register_operand" "")
10097 + "TARGET_THUMB2 && optimize_size && peep2_regno_dead_p (0, CC_REGNUM)"
10099 + [(set (match_dup 0)
10100 + (mult:SI (match_dup 0) (match_dup 1)))
10101 + (clobber (reg:CC CC_REGNUM))])]
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)"
10111 + [(set (match_dup 0)
10112 + (mult:SI (match_dup 0) (match_dup 1)))
10113 + (clobber (reg:CC CC_REGNUM))])]
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")])
10128 +(define_insn "*thumb2_mulsi_short_compare0"
10129 + [(set (reg:CC_NOOV CC_REGNUM)
10131 + (mult:SI (match_operand:SI 1 "register_operand" "%0")
10132 + (match_operand:SI 2 "register_operand" "l"))
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")])
10141 +(define_insn "*thumb2_mulsi_short_compare0_scratch"
10142 + [(set (reg:CC_NOOV CC_REGNUM)
10144 + (mult:SI (match_operand:SI 1 "register_operand" "%0")
10145 + (match_operand:SI 2 "register_operand" "l"))
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")])
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))]
10160 - if (get_attr_length (insn) == 2 && which_alternative == 0)
10161 + if (get_attr_length (insn) == 2)
10162 return \"cbz\\t%0, %l1\";
10164 return \"cmp\\t%0, #0\;beq\\t%l1\";
10165 @@ -1179,7 +1205,8 @@
10166 [(set (attr "length")
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)))
10175 @@ -1193,7 +1220,7 @@
10176 (clobber (reg:CC CC_REGNUM))]
10179 - if (get_attr_length (insn) == 2 && which_alternative == 0)
10180 + if (get_attr_length (insn) == 2)
10181 return \"cbnz\\t%0, %l1\";
10183 return \"cmp\\t%0, #0\;bne\\t%l1\";
10184 @@ -1201,7 +1228,8 @@
10185 [(set (attr "length")
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)))
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
10199 MULTILIB_DIRNAMES =
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
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
10212 +# MontaVista GNU/Linux Configuration.
10213 +# Copyright (C) 2009
10214 +# Free Software Foundation, Inc.
10216 +# This file is part of GCC.
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.
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.
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/>.
10232 +MULTILIB_OPTIONS = tarmv6/tthumb2
10233 +MULTILIB_DIRNAMES = armv6 thumb2
10235 +MULTILIB_EXCEPTIONS =
10237 +MULTILIB_OSDIRNAMES =
10239 +MULTILIB_ALIASES =
10241 +MULTILIB_MATCHES =
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
10249 LIB2ADDEH = $(srcdir)/unwind-c.c $(srcdir)/config/arm/pr-support.c
10250 LIB2ADDEHDEP = $(UNWIND_H)
10252 +# Include half-float helpers.
10253 +LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
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
10262 +# Wind River GNU/Linux Configuration.
10263 +# Copyright (C) 2006, 2007, 2008
10264 +# Free Software Foundation, Inc.
10266 +# This file is part of GCC.
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.
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.
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/>.
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
10289 +MULTILIB_EXCEPTIONS = *muclibc*/*tarm920t*
10290 +MULTILIB_EXCEPTIONS += *muclibc*/*cortex-a8-be8*
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*
10297 +MULTILIB_MATCHES = tiwmmxt=tiwmmxt2
10299 +MULTILIB_ALIASES = tcortex-a8-be8=tcortex-a8-be8/mfloat-abi?softfp
10300 +MULTILIB_OSDIRNAMES =
10302 +# These files must be built for each multilib.
10303 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
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
10309 #undef ARM_DEFAULT_ABI
10310 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
10312 +#undef LINK_GCC_C_SEQUENCE_SPEC
10313 +#define LINK_GCC_C_SEQUENCE_SPEC \
10314 + "--start-group %G %L --end-group"
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);
10327 restore_non_core_regs (&saved_vrs);
10330 @@ -1168,6 +1167,9 @@
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,
10340 @@ -1197,8 +1199,6 @@
10341 ucbp->barrier_cache.bitpattern[4] = (_uw) &data[1];
10343 if (data[0] & uint32_highbit)
10344 - phase2_call_unexpected_after_unwind = 1;
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;
10354 + phase2_call_unexpected_after_unwind = 1;
10356 if (data[0] & uint32_highbit)
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 @@
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. */
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. */
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
10379 || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
10381 + if (can_create_pseudo_p ())
10383 + if (GET_CODE (operands[0]) != REG)
10384 + operands[1] = force_reg (<MODE>mode, operands[1]);
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
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 @@
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,*")]
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 @@
10423 return \"movw%?\\t%0, %1\";
10425 - return \"ldr%?\\t%0, %1\";
10427 - return \"str%?\\t%1, %0\";
10428 + return \"ldr%?\\t%0, %1\";
10430 - return \"fmsr%?\\t%0, %1\\t%@ int\";
10432 - return \"fmrs%?\\t%0, %1\\t%@ int\";
10433 + return \"str%?\\t%1, %0\";
10435 + return \"fmsr%?\\t%0, %1\\t%@ int\";
10437 + return \"fmrs%?\\t%0, %1\\t%@ int\";
10439 return \"fcpys%?\\t%0, %1\\t%@ int\";
10441 + case 11: case 12:
10442 return output_move_vfp (operands);
10444 gcc_unreachable ();
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,*")]
10459 @@ -145,7 +153,10 @@
10461 return \"fmrrd%?\\t%Q0, %R0, %P1\\t%@ int\";
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\";
10467 + return \"fcpyd%?\\t%P0, %P1\\t%@ int\";
10469 return output_move_vfp (operands);
10471 @@ -153,7 +164,14 @@
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")
10480 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10484 (set_attr "pool_range" "*,1020,*,*,*,*,1020,*")
10485 (set_attr "neg_pool_range" "*,1008,*,*,*,*,1008,*")]
10487 @@ -172,7 +190,10 @@
10489 return \"fmrrd%?\\t%Q0, %R0, %P1\\t%@ int\";
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\";
10495 + return \"fcpyd%?\\t%P0, %P1\\t%@ int\";
10497 return output_move_vfp (operands);
10499 @@ -180,11 +201,123 @@
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")
10508 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10512 (set_attr "pool_range" "*,4096,*,*,*,*,1020,*")
10513 (set_attr "neg_pool_range" "*, 0,*,*,*,*,1008,*")]
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))"
10524 + switch (which_alternative)
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 */
10544 + REAL_VALUE_TYPE r;
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);
10555 + if (arm_arch_thumb2)
10556 + output_asm_insn (\"movw\\t%0, %1\", ops);
10558 + output_asm_insn (\"mov\\t%0, %2\;orr\\t%0, %0, %3\", ops);
10562 + gcc_unreachable ();
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")]
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))"
10579 + switch (which_alternative)
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 */
10595 + REAL_VALUE_TYPE r;
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);
10606 + if (arm_arch_thumb2)
10607 + output_asm_insn (\"movw\\t%0, %1\", ops);
10609 + output_asm_insn (\"mov\\t%0, %2\;orr\\t%0, %0, %3\", ops);
10613 + gcc_unreachable ();
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")]
10623 ;; Disparage the w<->r cases because reloading an invalid address is
10624 @@ -222,6 +355,8 @@
10625 [(set_attr "predicable" "yes")
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,*,*,*")]
10633 @@ -258,6 +393,8 @@
10634 [(set_attr "predicable" "yes")
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,*,*,*")]
10642 @@ -267,7 +404,7 @@
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 @@
10653 return \"fmrrd%?\\t%Q0, %R0, %P1\";
10655 + gcc_assert (TARGET_VFP_DOUBLE);
10656 return \"fconstd%?\\t%P0, #%G1\";
10658 return output_move_double (operands);
10660 return output_move_vfp (operands);
10662 - return \"fcpyd%?\\t%P0, %P1\";
10663 + if (TARGET_VFP_SINGLE)
10664 + return \"fcpys%?\\t%0, %1\;fcpys%?\\t%p0, %p1\";
10666 + return \"fcpyd%?\\t%P0, %P1\";
10670 @@ -296,14 +437,21 @@
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")
10679 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10683 (set_attr "pool_range" "*,*,*,1020,*,1020,*,*,*")
10684 (set_attr "neg_pool_range" "*,*,*,1008,*,1008,*,*,*")]
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"
10694 @@ -314,13 +462,17 @@
10696 return \"fmrrd%?\\t%Q0, %R0, %P1\";
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);
10703 return output_move_vfp (operands);
10705 - return \"fcpyd%?\\t%P0, %P1\";
10706 + if (TARGET_VFP_SINGLE)
10707 + return \"fcpys%?\\t%0, %1\;fcpys%?\\t%p0, %p1\";
10709 + return \"fcpyd%?\\t%P0, %P1\";
10713 @@ -328,7 +480,14 @@
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")
10722 + (eq (symbol_ref "TARGET_VFP_SINGLE") (const_int 1))
10726 (set_attr "pool_range" "*,*,*,4096,*,1020,*,*,*")
10727 (set_attr "neg_pool_range" "*,*,*,0,*,1008,*,*,*")]
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")]
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")]
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"
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")]
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"
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")]
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"
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))]
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")]
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")]
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")]
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"
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)
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"
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)
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"
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"
11062 fcmped%?\\t%P0, %P1
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
11068 /* There is no default multilib. */
11069 #undef MULTILIB_DEFAULTS
11071 -#define FPUTYPE_DEFAULT FPUTYPE_VFP
11072 +#define FPUTYPE_DEFAULT "vfp"
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
11080 +/* Wind River GNU/Linux Configuration.
11081 + Copyright (C) 2006, 2007, 2008
11082 + Free Software Foundation, Inc.
11084 +This file is part of GCC.
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.
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.
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/>. */
11100 +/* Use the ARM926EJ-S by default. */
11101 +#undef SUBTARGET_CPU_DEFAULT
11102 +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm926ejs
11104 +/* Add a -tiwmmxt option for convenience in generating multilibs.
11105 + This option generates big-endian IWMMXT code. */
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 \
11116 + %{txscale:%{mfloat-abi=softfp:%eXScale VFP multilib not provided}} \
11117 + %{tarm920t:%{mfloat-abi=softfp:%eARM920T VFP multilib not provided}} \
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" }
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}"
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"
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}"
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}}}"
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
11160 +;; Atom Scheduling
11161 +;; Copyright (C) 2009 Free Software Foundation, Inc.
11163 +;; This file is part of GCC.
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.
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.
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/>.
11179 +;; Atom is an in-order core with two integer pipelines.
11182 +(define_attr "atom_unit" "sishuf,simul,jeu,complex,other"
11183 + (const_string "other"))
11185 +(define_attr "atom_sse_attr" "rcp,movdup,lfence,fence,prefetch,sqrt,mxcsr,other"
11186 + (const_string "other"))
11188 +(define_automaton "atom")
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")
11193 +;; EU: Execution Unit
11194 +;; Atom EUs are connected by port 0 or port 1.
11196 +(define_cpu_unit "atom-eu-0, atom-eu-1,
11197 + atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4"
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)")
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 +
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)")
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)")
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")
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")
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,
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")
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)")
11243 +;;; Complex macro-instruction has variants of latency, and uses both ports.
11244 +(define_reservation "atom-complex" "(atom-port-dual + atom-all-eu)")
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")
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")))
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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"))))))
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"))))))
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")
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")
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")
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")
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")
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"))))
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"))))
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")
11430 +(define_insn_reservation "atom_ishift1" 1
11431 + (and (eq_attr "cpu" "atom")
11432 + (and (eq_attr "type" "ishift1")
11433 + (eq_attr "memory" "none")))
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")))
11442 +(define_insn_reservation "atom_rotate" 1
11443 + (and (eq_attr "cpu" "atom")
11444 + (and (eq_attr "type" "rotate")
11445 + (eq_attr "memory" "none")))
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")))
11454 +(define_insn_reservation "atom_rotate1" 1
11455 + (and (eq_attr "cpu" "atom")
11456 + (and (eq_attr "type" "rotate1")
11457 + (eq_attr "memory" "none")))
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")))
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"))))
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"))))
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")
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")
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")
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")
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")
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")
11514 +(define_insn_reservation "atom_ibr" 1
11515 + (and (eq_attr "cpu" "atom")
11516 + (and (eq_attr "type" "ibr")
11517 + (eq_attr "memory" "!load")))
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")
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")
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")
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")
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")
11552 +;; UCODE if segreg, ignored
11553 +(define_insn_reservation "atom_push" 2
11554 + (and (eq_attr "cpu" "atom")
11555 + (eq_attr "type" "push"))
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")))
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")))
11572 +;; UCODE if segreg, ignored
11573 +(define_insn_reservation "atom_call" 1
11574 + (and (eq_attr "cpu" "atom")
11575 + (eq_attr "type" "call"))
11578 +(define_insn_reservation "atom_callv" 1
11579 + (and (eq_attr "cpu" "atom")
11580 + (eq_attr "type" "callv"))
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")
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")
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")
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")
11605 +(define_insn_reservation "atom_sselog1" 1
11606 + (and (eq_attr "cpu" "atom")
11607 + (and (eq_attr "type" "sselog1")
11608 + (eq_attr "memory" "none")))
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")))
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")
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")))))
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")))))
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")
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")
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"))))
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")
11675 +(define_insn_reservation "atom_sseimul" 1
11676 + (and (eq_attr "cpu" "atom")
11677 + (eq_attr "type" "sseimul"))
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"))))
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")))
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")
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"))))
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")
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")
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"))))
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"))))
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"))))
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")
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")))))
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")))))
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")
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")))
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")))
11793 +(define_insn_reservation "atom_ssecmp" 1
11794 + (and (eq_attr "cpu" "atom")
11795 + (eq_attr "type" "ssecmp"))
11796 + "atom-simple-either")
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")
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")))))
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")))))
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")
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"))))
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")
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")
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")
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")
11868 +;; Define bypass here
11870 +;; There will be no stall from lea to non-mem EX insns
11871 +(define_bypass 0 "atom_lea"
11873 + atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx,
11874 + atom_incdec, atom_setcc, atom_icmov, atom_pop")
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")
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"
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")
11910 +;; Stall from imul to lea is 8 cycles.
11911 +(define_bypass 9 "atom_imul, atom_imul_mem" "atom_lea")
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")
11923 +;; There will be 0 cycle stall from cmp/test to jcc
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")
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")
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")
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
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
11970 +/* Sourcery G++ IA32 GNU/Linux Configuration.
11971 + Copyright (C) 2007
11972 + Free Software Foundation, Inc.
11974 +This file is part of GCC.
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.
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.
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/>. */
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). */
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 ; \
12002 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
12003 +#define SYSROOT_HEADERS_SUFFIX_SPEC SYSROOT_SUFFIX_SPEC
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
12015 +/* Sourcery G++ Lite IA32 GNU/Linux Configuration.
12016 + Copyright (C) 2009
12017 + Free Software Foundation, Inc.
12019 +This file is part of GCC.
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.
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.
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/>. */
12035 +#undef SYSROOT_SUFFIX_SPEC
12036 +#define SYSROOT_SUFFIX_SPEC \
12037 + "%{march=atom:%{!m64:/atom} ; \
12038 + march=core2:%{m64:/core2}}"
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
12050 +; Additional options for Sourcery G++.
12053 +Target Undocumented
12056 +Target Undocumented
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
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)
12072 #define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
12073 @@ -203,7 +203,7 @@
12074 #define CHECK_STACK_LIMIT 4000
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)
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
12088 Create GUI application
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;
12105 @@ -398,9 +398,22 @@
12107 __cpuid (1, eax, ebx, ecx, edx);
12109 - /* We don't care for extended family. */
12110 model = (eax >> 4) & 0x0f;
12111 family = (eax >> 8) & 0x0f;
12112 + if (vendor == SIG_INTEL)
12114 + unsigned int extended_model, extended_family;
12116 + extended_model = (eax >> 12) & 0xf0;
12117 + extended_family = (eax >> 20) & 0xff;
12118 + if (family == 0x0f)
12120 + family += extended_family;
12121 + model += extended_model;
12123 + else if (family == 0x06)
12124 + model += extended_model;
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 @@
12139 case PROCESSOR_PENTIUMPRO:
12141 - /* It is Core 2 Duo. */
12143 + /* It is Core 2 or Atom. */
12144 + cpu = (model == 28) ? "atom" : "core2";
12148 @@ -597,6 +611,8 @@
12149 options = concat (options, "-mcx16 ", NULL);
12151 options = concat (options, "-msahf ", NULL);
12153 + options = concat (options, "-mmovbe ", NULL);
12155 options = concat (options, "-maes ", NULL);
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. */
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. */
12237 /* Generic64 should produce code tuned for Nocona and K8. */
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)
12246 #define m_GEODE (1<<PROCESSOR_GEODE)
12247 #define m_K6 (1<<PROCESSOR_K6)
12248 @@ -1231,10 +1305,11 @@
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,
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,
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 @@
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,
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 */,
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,
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),
12284 /* X86_TUNE_USE_MOV0 */
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),
12291 /* X86_TUNE_USE_XCHGB: Use xchgb %rh,%rl instead of rolw/rorw $8,rx. */
12293 @@ -1292,8 +1367,8 @@
12294 ~(m_PENT | m_PPRO),
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 ? */,
12302 /* X86_TUNE_FAST_PREFIX */
12303 ~(m_PENT | m_486 | m_386),
12304 @@ -1317,26 +1392,28 @@
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,
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,
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
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,
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),
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,
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
12347 /* X86_TUNE_SSE_UNALIGNED_MOVE_OPTIMAL */
12349 @@ -1365,13 +1443,13 @@
12350 m_PPRO | m_PENT4 | m_NOCONA,
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,
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,
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,
12364 /* X86_TUNE_SHIFT1 */
12366 @@ -1380,29 +1458,32 @@
12369 /* X86_TUNE_INTER_UNIT_MOVES */
12370 - ~(m_AMD_MULTIPLE | m_GENERIC),
12371 + ~(m_AMD_MULTIPLE | m_ATOM | m_GENERIC),
12373 /* X86_TUNE_INTER_UNIT_CONVERSIONS */
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
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
12387 /* X86_TUNE_USE_BT */
12388 - m_AMD_MULTIPLE | m_CORE2 | m_GENERIC,
12389 + m_AMD_MULTIPLE | m_ATOM | m_CORE2 | m_GENERIC,
12391 /* X86_TUNE_USE_INCDEC */
12392 - ~(m_PENT4 | m_NOCONA | m_GENERIC),
12393 + ~(m_PENT4 | m_NOCONA | m_GENERIC | m_ATOM),
12395 /* X86_TUNE_PAD_RETURNS */
12396 m_AMD_MULTIPLE | m_CORE2 | m_GENERIC,
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,
12403 /* X86_TUNE_SHORTEN_X87_SSE */
12405 @@ -1447,6 +1528,10 @@
12406 with a subsequent conditional jump instruction into a single
12407 compare-and-branch uop. */
12410 + /* X86_TUNE_OPT_AGU: Optimize for Address Generation Unit. This flag
12411 + will impact LEA instruction selection. */
12415 /* Feature tests against the various architecture variations. */
12416 @@ -1472,10 +1557,11 @@
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
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;
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;
12434 +/* The abi used by target. */
12435 +enum calling_abi ix86_abi;
12437 /* Values 1-5: see jump.c */
12438 int ix86_branch_cost;
12440 @@ -1819,6 +1908,8 @@
12441 static bool ix86_can_inline_p (tree, tree);
12442 static void ix86_set_current_function (tree);
12444 +static enum calling_abi ix86_function_abi (const_tree);
12447 /* The svr4 ABI for the i386 says that records and unions are returned
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
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
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}
12474 static const char *const cpu_names[TARGET_CPU_DEFAULT_max] =
12475 @@ -1971,6 +2065,7 @@
12483 @@ -2209,6 +2304,19 @@
12490 + ix86_isa_flags |= OPTION_MASK_ISA_MOVBE_SET;
12491 + ix86_isa_flags_explicit |= OPTION_MASK_ISA_MOVBE_SET;
12495 + ix86_isa_flags &= ~OPTION_MASK_ISA_MOVBE_UNSET;
12496 + ix86_isa_flags_explicit |= OPTION_MASK_ISA_MOVBE_UNSET;
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 },
12511 @@ -2487,7 +2596,8 @@
12513 PTA_PCLMUL = 1 << 18,
12515 - PTA_FMA = 1 << 20
12516 + PTA_FMA = 1 << 20,
12517 + PTA_MOVBE = 1 << 21
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);
12535 + /* Validate -mabi= value. */
12536 + if (ix86_abi_string)
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;
12543 + error ("unknown ABI (%s) for %sabi=%s %s",
12544 + ix86_abi_string, prefix, suffix, sw);
12547 + ix86_abi = DEFAULT_ABI;
12549 if (ix86_cmodel_string != 0)
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 @@
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)
12570 - if (DEFAULT_ABI == MS_ABI)
12571 + if (ix86_abi == MS_ABI)
12572 parm_regs = x86_64_ms_abi_int_parameter_registers;
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])
12580 @@ -4627,7 +4757,7 @@
12582 ix86_reg_parm_stack_space (const_tree fndecl)
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);
12589 @@ -4639,37 +4769,39 @@
12591 /* Returns value SYSV_ABI, MS_ABI dependent on fntype, specifying the
12595 ix86_function_type_abi (const_tree fntype)
12597 if (TARGET_64BIT && fntype != NULL)
12600 - if (DEFAULT_ABI == SYSV_ABI)
12601 - abi = lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)) ? MS_ABI : SYSV_ABI;
12603 - abi = lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)) ? SYSV_ABI : MS_ABI;
12605 + enum calling_abi abi = ix86_abi;
12606 + if (abi == SYSV_ABI)
12608 + if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
12611 + else if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
12615 - return DEFAULT_ABI;
12620 +static enum calling_abi
12621 ix86_function_abi (const_tree fndecl)
12624 - return DEFAULT_ABI;
12626 return ix86_function_type_abi (TREE_TYPE (fndecl));
12629 /* Returns value SYSV_ABI, MS_ABI dependent on cfun, specifying the
12633 ix86_cfun_abi (void)
12635 if (! cfun || ! TARGET_64BIT)
12636 - return DEFAULT_ABI;
12638 return cfun->machine->call_abi;
12641 @@ -4683,7 +4815,7 @@
12642 ix86_call_abi_override (const_tree fndecl)
12644 if (fndecl == NULL_TREE)
12645 - cfun->machine->call_abi = DEFAULT_ABI;
12646 + cfun->machine->call_abi = ix86_abi;
12648 cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl));
12650 @@ -4724,8 +4856,8 @@
12651 cum->nregs = ix86_regparm;
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
12661 @@ -4733,8 +4865,8 @@
12662 cum->sse_nregs = SSE_REGPARM_MAX;
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;
12672 @@ -5700,7 +5832,7 @@
12674 mode = type_natural_mode (type, NULL);
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
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))
12693 @@ -5942,7 +6074,7 @@
12694 if (type && TREE_CODE (type) == VECTOR_TYPE)
12695 mode = type_natural_mode (type, cum);
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)
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)
12709 int msize = (int) GET_MODE_SIZE (mode);
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
12715 - if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
12716 + if (TARGET_64BIT && ix86_abi == MS_ABI)
12718 return TARGET_FLOAT_RETURNS_IN_80387;
12720 @@ -6498,13 +6630,13 @@
12722 ix86_build_builtin_va_list (void)
12724 - tree ret = ix86_build_builtin_va_list_abi (DEFAULT_ABI);
12725 + tree ret = ix86_build_builtin_va_list_abi (ix86_abi);
12727 /* Initialize abi specific va_list builtin types. */
12731 - if (DEFAULT_ABI == MS_ABI)
12732 + if (ix86_abi == MS_ABI)
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;
12740 - if (DEFAULT_ABI != MS_ABI)
12741 + if (ix86_abi != MS_ABI)
12743 t = ix86_build_builtin_va_list_abi (MS_ABI);
12744 if (TREE_CODE (t) != RECORD_TYPE)
12745 @@ -6551,8 +6683,8 @@
12747 int regparm = ix86_regparm;
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;
12754 /* GPR size of varargs save area. */
12755 if (cfun->va_list_gpr_size)
12756 @@ -6705,7 +6837,7 @@
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));
12764 /* Implement va_start. */
12765 @@ -12987,6 +13119,316 @@
12766 emit_move_insn (operands[0], dst);
12769 +#define LEA_SEARCH_THRESHOLD 12
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. */
12780 +distance_non_agu_define (unsigned int regno1, unsigned int regno2,
12783 + basic_block bb = BLOCK_FOR_INSN (insn);
12784 + int distance = 0;
12786 + enum attr_type insn_type;
12788 + if (insn != BB_HEAD (bb))
12790 + rtx prev = PREV_INSN (insn);
12791 + while (prev && distance < LEA_SEARCH_THRESHOLD)
12793 + if (INSN_P (prev))
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)))
12802 + insn_type = get_attr_type (prev);
12803 + if (insn_type != TYPE_LEA)
12807 + if (prev == BB_HEAD (bb))
12809 + prev = PREV_INSN (prev);
12813 + if (distance < LEA_SEARCH_THRESHOLD)
12816 + edge_iterator ei;
12817 + bool simple_loop = false;
12819 + FOR_EACH_EDGE (e, ei, bb->preds)
12820 + if (e->src == bb)
12822 + simple_loop = true;
12828 + rtx prev = BB_END (bb);
12831 + && distance < LEA_SEARCH_THRESHOLD)
12833 + if (INSN_P (prev))
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)))
12842 + insn_type = get_attr_type (prev);
12843 + if (insn_type != TYPE_LEA)
12847 + prev = PREV_INSN (prev);
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);
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. */
12867 +distance_agu_use (unsigned int regno0, rtx insn)
12869 + basic_block bb = BLOCK_FOR_INSN (insn);
12870 + int distance = 0;
12874 + if (insn != BB_END (bb))
12876 + rtx next = NEXT_INSN (insn);
12877 + while (next && distance < LEA_SEARCH_THRESHOLD)
12879 + if (INSN_P (next))
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))
12888 + /* Return DISTANCE if OP0 is used in memory
12889 + address in NEXT. */
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))
12898 + /* Return -1 if OP0 is set in NEXT. */
12902 + if (next == BB_END (bb))
12904 + next = NEXT_INSN (next);
12908 + if (distance < LEA_SEARCH_THRESHOLD)
12911 + edge_iterator ei;
12912 + bool simple_loop = false;
12914 + FOR_EACH_EDGE (e, ei, bb->succs)
12915 + if (e->dest == bb)
12917 + simple_loop = true;
12923 + rtx next = BB_HEAD (bb);
12926 + && distance < LEA_SEARCH_THRESHOLD)
12928 + if (INSN_P (next))
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))
12937 + /* Return DISTANCE if OP0 is used in memory
12938 + address in NEXT. */
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))
12947 + /* Return -1 if OP0 is set in NEXT. */
12952 + next = NEXT_INSN (next);
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
12964 + Positive value: LEA is more preferred than ADD*/
12965 +#define IX86_LEA_PRIORITY 2
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
12974 +ix86_lea_for_add_ok (enum rtx_code code ATTRIBUTE_UNUSED,
12975 + rtx insn, rtx operands[])
12977 + unsigned int regno0 = true_regnum (operands[0]);
12978 + unsigned int regno1 = true_regnum (operands[1]);
12979 + unsigned int regno2;
12981 + if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun))
12982 + return regno0 != regno1;
12984 + regno2 = true_regnum (operands[2]);
12986 + /* If a = b + c, (a!=b && a!=c), must use lea form. */
12987 + if (regno0 != regno1 && regno0 != regno2)
12991 + int dist_define, dist_use;
12992 + dist_define = distance_non_agu_define (regno1, regno2, insn);
12993 + if (dist_define <= 0)
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)
13007 +/* Return true if destination reg of SET_BODY is shift count of
13011 +ix86_dep_by_shift_count_body (const_rtx set_body, const_rtx use_body)
13017 + /* Retrieve destination of SET_BODY. */
13018 + switch (GET_CODE (set_body))
13021 + set_dest = SET_DEST (set_body);
13022 + if (!set_dest || !REG_P (set_dest))
13026 + for (i = XVECLEN (set_body, 0) - 1; i >= 0; i--)
13027 + if (ix86_dep_by_shift_count_body (XVECEXP (set_body, 0, i),
13035 + /* Retrieve shift count of USE_BODY. */
13036 + switch (GET_CODE (use_body))
13039 + shift_rtx = XEXP (use_body, 1);
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)))
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))
13058 + rtx shift_count = XEXP (shift_rtx, 1);
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))
13069 +/* Return true if destination reg of SET_INSN is shift count of
13073 +ix86_dep_by_shift_count (const_rtx set_insn, const_rtx use_insn)
13075 + return ix86_dep_by_shift_count_body (PATTERN (set_insn),
13076 + PATTERN (use_insn));
13079 /* Return TRUE or FALSE depending on whether the unary operator meets the
13080 appropriate constraints. */
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;
13091 @@ -19099,6 +19541,7 @@
13094 case PROCESSOR_PENTIUM:
13095 + case PROCESSOR_ATOM:
13099 @@ -19165,41 +19608,21 @@
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
13109 -ix86_agi_dependent (rtx insn, rtx dep_insn, enum attr_type insn_type)
13111 +ix86_agi_dependent (rtx set_insn, rtx use_insn)
13115 - if (insn_type == TYPE_LEA
13116 - && TARGET_PENTIUM)
13118 - addr = PATTERN (insn);
13120 - if (GET_CODE (addr) == PARALLEL)
13121 - addr = XVECEXP (addr, 0, 0);
13123 - gcc_assert (GET_CODE (addr) == SET);
13125 - addr = SET_SRC (addr);
13130 - extract_insn_cached (insn);
13131 - for (i = recog_data.n_operands - 1; i >= 0; --i)
13132 - if (MEM_P (recog_data.operand[i]))
13134 - addr = XEXP (recog_data.operand[i], 0);
13141 - return modified_in_p (addr, dep_insn);
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]))
13147 + rtx addr = XEXP (recog_data.operand[i], 0);
13148 + return modified_in_p (addr, set_insn) != 0;
13154 @@ -19227,7 +19650,20 @@
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)
13161 + rtx addr = PATTERN (insn);
13163 + if (GET_CODE (addr) == PARALLEL)
13164 + addr = XVECEXP (addr, 0, 0);
13166 + gcc_assert (GET_CODE (addr) == SET);
13168 + addr = SET_SRC (addr);
13169 + if (modified_in_p (addr, dep_insn))
13172 + else if (ix86_agi_dependent (dep_insn, insn))
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))
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))
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))
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:
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))
13218 enum attr_unit unit = get_attr_unit (insn);
13220 @@ -29594,14 +30031,11 @@
13222 ix86_fn_abi_va_list (tree fndecl)
13227 return va_list_type_node;
13228 gcc_assert (fndecl != NULL_TREE);
13229 - abi = ix86_function_abi ((const_tree) fndecl);
13231 - if (abi == MS_ABI)
13232 + if (ix86_function_abi ((const_tree) fndecl) == MS_ABI)
13233 return ms_va_list_type_node;
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__");
13243 + case PROCESSOR_ATOM:
13244 + def_or_undef (parse_in, "__atom");
13245 + def_or_undef (parse_in, "__atom__");
13247 /* use PROCESSOR_max to not set/unset the arch macro. */
13248 case PROCESSOR_max:
13250 @@ -187,6 +191,9 @@
13251 case PROCESSOR_CORE2:
13252 def_or_undef (parse_in, "__tune_core2__");
13254 + case PROCESSOR_ATOM:
13255 + def_or_undef (parse_in, "__tune_atom__");
13257 case PROCESSOR_GENERIC32:
13258 case PROCESSOR_GENERIC64:
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
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)
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,
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]
13293 /* Feature tests against the various architecture variations. */
13294 enum ix86_arch_indices {
13295 @@ -470,7 +474,10 @@
13299 -/* The default abi form used by target. */
13300 +/* The abi used by target. */
13301 +extern enum calling_abi ix86_abi;
13303 +/* The default abi used by target. */
13304 #define DEFAULT_ABI SYSV_ABI
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,
13313 TARGET_CPU_DEFAULT_geode,
13314 TARGET_CPU_DEFAULT_k6,
13315 @@ -658,7 +666,7 @@
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)
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. */
13333 @@ -2230,6 +2238,7 @@
13334 PROCESSOR_GENERIC32,
13335 PROCESSOR_GENERIC64,
13336 PROCESSOR_AMDFAM10,
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. */
13346 + enum calling_abi call_abi;
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 @@
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")))
13362 @@ -612,6 +612,12 @@
13363 (define_attr "i387_cw" "trunc,floor,ceil,mask_pm,uninitialized,any"
13364 (const_string "any"))
13366 +;; Define attribute to classify add/sub insns that consumes carry flag (CF)
13367 +(define_attr "use_carry" "0,1" (const_string "0"))
13369 +;; Define attribute to indicate unaligned ssemov insns
13370 +(define_attr "movu" "0,1" (const_string "0"))
13372 ;; Describe a user's asm statement.
13373 (define_asm_attributes
13374 [(set_attr "length" "128")
13375 @@ -727,6 +733,7 @@
13377 (include "athlon.md")
13378 (include "geode.md")
13379 +(include "atom.md")
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")])
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")])
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")])
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")])
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")])
13423 @@ -6130,9 +6142,9 @@
13424 (set_attr "mode" "SI")])
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)"
13436 @@ -6153,6 +6165,10 @@
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}";
13444 gcc_assert (rtx_equal_p (operands[0], operands[1]));
13446 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
13447 @@ -6171,8 +6187,11 @@
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)
13471 @@ -6394,9 +6413,9 @@
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)"
13484 @@ -6417,6 +6436,10 @@
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}";
13492 gcc_assert (rtx_equal_p (operands[0], operands[1]));
13494 /* Make things pretty and `subl $4,%eax' rather than `addl $-4, %eax'.
13495 @@ -6433,7 +6456,10 @@
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)"
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")])
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")])
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")])
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")])
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 @@
13561 [(set_attr "length" "1")
13562 + (set_attr "atom_unit" "jeu")
13563 (set_attr "length_immediate" "0")
13564 (set_attr "modrm" "0")])
13566 @@ -15247,6 +15277,7 @@
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 @@
13577 [(set_attr "length" "3")
13578 + (set_attr "atom_unit" "jeu")
13579 (set_attr "length_immediate" "2")
13580 (set_attr "modrm" "0")])
13582 @@ -15610,7 +15642,7 @@
13583 (bswap:SI (match_operand:SI 1 "register_operand" "")))]
13586 - if (!TARGET_BSWAP)
13587 + if (!(TARGET_BSWAP || TARGET_MOVBE))
13589 rtx x = operands[0];
13591 @@ -15622,6 +15654,21 @@
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]))"
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")])
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")])
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" "")))]
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]))"
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")])
13640 +(define_insn "*bswapdi_1"
13641 [(set (match_operand:DI 0 "register_operand" "=r")
13642 (bswap:DI (match_operand:DI 1 "register_operand" "0")))]
13644 @@ -16378,6 +16447,7 @@
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")])
13652 @@ -16729,6 +16799,7 @@
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")])
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 @@
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 @@
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 @@
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 @@
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];
13723 [(set_attr "type" "sse")
13724 + (set_attr "atom_sse_attr" "prefetch")
13725 (set_attr "memory" "none")])
13727 (define_insn "*prefetch_sse_rex"
13728 @@ -21752,6 +21831,7 @@
13729 return patterns[locality];
13731 [(set_attr "type" "sse")
13732 + (set_attr "atom_sse_attr" "prefetch")
13733 (set_attr "memory" "none")])
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
13744 +Target RejectNegative Joined Var(ix86_abi_string)
13745 +Generate code that conforms to the given ABI
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.
13755 +Target Report Mask(ISA_MOVBE) Var(ix86_isa_flags) VarExists Save
13756 +Support code generation of movbe instruction.
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
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,
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
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) \
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>")])
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>")])
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>")])
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")])
13833 @@ -424,7 +428,7 @@
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")])
13842 @@ -434,7 +438,7 @@
13845 "movnti\t{%1, %0|%0, %1}"
13846 - [(set_attr "type" "ssecvt")
13847 + [(set_attr "type" "ssemov")
13848 (set_attr "mode" "V2DF")])
13850 (define_insn "avx_lddqu<avxmodesuffix>"
13851 @@ -445,6 +449,7 @@
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>")])
13859 @@ -454,7 +459,8 @@
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")])
13869 @@ -761,6 +767,7 @@
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")])
13877 @@ -787,6 +794,7 @@
13879 "rcpss\t{%1, %0|%0, %1}"
13880 [(set_attr "type" "sse")
13881 + (set_attr "atom_sse_attr" "rcp")
13882 (set_attr "mode" "SF")])
13884 (define_expand "sqrtv8sf2"
13885 @@ -832,6 +840,7 @@
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")])
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>")])
13900 (define_expand "rsqrtv8sf2"
13901 @@ -1039,7 +1049,7 @@
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>")])
13909 ;; These versions of the min/max patterns implement exactly the operations
13910 @@ -1175,6 +1185,7 @@
13912 "addsubpd\t{%2, %0|%0, %2}"
13913 [(set_attr "type" "sseadd")
13914 + (set_attr "atom_unit" "complex")
13915 (set_attr "mode" "V2DF")])
13917 (define_insn "avx_h<plusminus_insn>v4df3"
13918 @@ -1298,6 +1309,7 @@
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")])
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")])
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")])
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")])
13950 @@ -7614,6 +7629,7 @@
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")])
13958 @@ -7635,7 +7651,7 @@
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>")])
13967 @@ -7645,7 +7661,7 @@
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 @@
13997 [(set_attr "type" "sse")
13998 + (set_attr "atom_sse_attr" "mxcsr")
13999 (set_attr "prefix" "maybe_vex")
14000 (set_attr "memory" "load")])
14002 @@ -7702,6 +7719,7 @@
14005 [(set_attr "type" "sse")
14006 + (set_attr "atom_sse_attr" "mxcsr")
14007 (set_attr "prefix" "maybe_vex")
14008 (set_attr "memory" "store")])
14010 @@ -7720,6 +7738,7 @@
14011 "TARGET_SSE || TARGET_3DNOW_A"
14013 [(set_attr "type" "sse")
14014 + (set_attr "atom_sse_attr" "fence")
14015 (set_attr "memory" "unknown")])
14017 (define_insn "sse2_clflush"
14018 @@ -7728,6 +7747,7 @@
14021 [(set_attr "type" "sse")
14022 + (set_attr "atom_sse_attr" "fence")
14023 (set_attr "memory" "unknown")])
14025 (define_expand "sse2_mfence"
14026 @@ -7745,6 +7765,7 @@
14027 "TARGET_64BIT || TARGET_SSE2"
14029 [(set_attr "type" "sse")
14030 + (set_attr "atom_sse_attr" "fence")
14031 (set_attr "memory" "unknown")])
14033 (define_expand "sse2_lfence"
14034 @@ -7762,6 +7783,7 @@
14037 [(set_attr "type" "sse")
14038 + (set_attr "atom_sse_attr" "lfence")
14039 (set_attr "memory" "unknown")])
14041 (define_insn "sse3_mwait"
14042 @@ -7885,6 +7907,7 @@
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 @@
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")])
14058 @@ -7967,6 +7991,7 @@
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 @@
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")])
14074 @@ -8073,6 +8099,7 @@
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 @@
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")])
14090 @@ -8187,6 +8215,7 @@
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 @@
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")])
14106 @@ -8269,6 +8299,7 @@
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 @@
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")])
14122 @@ -8375,6 +8407,7 @@
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 @@
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")])
14138 @@ -8509,6 +8543,7 @@
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 @@
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")])
14154 @@ -8754,6 +8790,7 @@
14155 return "palignr\t{%3, %2, %0|%0, %2, %3}";
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}";
14165 [(set_attr "type" "sseishft")
14166 + (set_attr "atom_unit" "sishuf")
14167 (set_attr "prefix_extra" "1")
14168 (set_attr "mode" "DI")])
14170 @@ -8956,7 +8994,7 @@
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
14183 +# Sourcery G++ IA32 GNU/Linux Configuration.
14184 +# Copyright (C) 2007
14185 +# Free Software Foundation, Inc.
14187 +# This file is part of GCC.
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.
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.
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/>.
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
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
14212 +# Sourcery G++ Lite IA32 GNU/Linux Configuration.
14213 +# Copyright (C) 2009
14214 +# Free Software Foundation, Inc.
14216 +# This file is part of GCC.
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.
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.
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/>.
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
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
14242 +# Wind River GNU/Linux Configuration.
14243 +# Copyright (C) 2009
14244 +# Free Software Foundation, Inc.
14246 +# This file is part of GCC.
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.
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.
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/>.
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 @@
14271 HOST_WIDE_INT rounded;
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 @@
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",
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));
14295 + fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC "\t" ASM_COMMENT_START
14296 + " " HOST_WIDE_INT_PRINT_DEC "\n", rounded, size);
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
14304 +/* Wind River IA32 GNU/Linux Configuration.
14305 + Copyright (C) 2009
14306 + Free Software Foundation, Inc.
14308 +This file is part of GCC.
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.
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.
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/>. */
14324 +#undef SYSROOT_SUFFIX_SPEC
14325 +#define SYSROOT_SUFFIX_SPEC \
14326 + "%{msystem-glibc:/system-glibc}"
14328 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
14329 +#define SYSROOT_HEADERS_SUFFIX_SPEC SYSROOT_SUFFIX_SPEC
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
14341 +; Additional options for Wind River Linux Sourcery G++.
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")))
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")))
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__)
14368 +#elif defined (__mcfisab__) || defined (__mcfisac__)
14373 @@ -202,6 +204,8 @@
14374 #if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
14377 +#elif defined (__mcfisab__) || defined (__mcfisac__)
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
14386 fs->regs.reg[9].how = REG_SAVED_OFFSET;
14387 fs->regs.reg[9].loc.offset = (long) &sc->sc_a1 - cfa;
14389 +#ifdef __uClinux__
14390 + fs->regs.reg[13].how = REG_SAVED_OFFSET;
14391 + fs->regs.reg[13].loc.offset = (long) &sc->sc_a5 - cfa;
14394 fs->regs.reg[24].how = REG_SAVED_OFFSET;
14395 fs->regs.reg[24].loc.offset = (long) &sc->sc_pc - cfa;
14397 +#if defined __mcffpu__ && !defined __uClinux__
14398 if (*(int *) sc->sc_fpstate)
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;
14405 +#elif defined __mcffpu__
14406 +# error Implement this when uClinux kernel is ported to an FPU architecture
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;
14418 + (pc[0] == 0x70ad && pc[1] == 0x0280 && pc[2] == 0x0000 &&
14419 + pc[3] == 0x00ff && pc[4] == 0x4e40 && pc[5] == 0x0000))
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
14427 /* ??? Need to add a dependency between m68k.o and sched-int.h. */
14428 #include "sched-int.h"
14429 #include "insn-codes.h"
14432 enum reg_class regno_reg_class[] =
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);
14443 +static void m68k_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
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
14451 +#ifdef HAVE_AS_TLS
14452 +#undef TARGET_HAVE_TLS
14453 +#define TARGET_HAVE_TLS (true)
14455 +#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
14456 +#define TARGET_ASM_OUTPUT_DWARF_DTPREL m68k_output_dwarf_dtprel
14459 static const struct attribute_spec m68k_attribute_table[] =
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));
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));
14472 @@ -1425,6 +1435,86 @@
14473 return replace_equiv_address (x, gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM));
14476 +/* Convert X to a legitimate address and return it if successful. Otherwise
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. */
14485 +m68k_legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
14487 + if (m68k_tls_symbol_p (x))
14488 + return m68k_legitimize_tls_address (x);
14490 + if (GET_CODE (x) == PLUS)
14492 + int ch = (x) != (oldx);
14495 +#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
14497 + if (GET_CODE (XEXP (x, 0)) == MULT)
14500 + XEXP (x, 0) = force_operand (XEXP (x, 0), 0);
14502 + if (GET_CODE (XEXP (x, 1)) == MULT)
14505 + XEXP (x, 1) = force_operand (XEXP (x, 1), 0);
14509 + if (GET_CODE (XEXP (x, 1)) == REG
14510 + && GET_CODE (XEXP (x, 0)) == REG)
14512 + if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT)
14515 + x = force_operand (x, 0);
14519 + if (memory_address_p (mode, x))
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))
14527 + rtx temp = gen_reg_rtx (Pmode);
14528 + rtx val = force_operand (XEXP (x, 1), 0);
14529 + emit_move_insn (temp, val);
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);
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))
14541 + rtx temp = gen_reg_rtx (Pmode);
14542 + rtx val = force_operand (XEXP (x, 0), 0);
14543 + emit_move_insn (temp, val);
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);
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. */
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)
14566 if (!strict_p && GET_CODE (x) == SUBREG)
14567 x = SUBREG_REG (x);
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)))));
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. */
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)
14589 @@ -1753,7 +1845,7 @@
14590 && GET_MODE (XEXP (x, 0)) == HImode)
14593 - if (m68k_legitimate_index_reg_p (x, strict_p))
14594 + if (m68k_legitimate_index_reg_p (mode, x, strict_p))
14596 address->scale = scale;
14597 address->index = x;
14598 @@ -1777,7 +1869,7 @@
14599 && !offset_within_block_p (base, INTVAL (offset)))
14603 + return m68k_tls_reference_p (x, false);
14606 /* Return true if X is a legitimate constant address that can reach
14607 @@ -1805,7 +1897,7 @@
14612 + return !m68k_tls_reference_p (x, false);
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)
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)
14628 - address->base = XEXP (x, 0);
14629 - address->offset = XEXP (x, 1);
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))
14635 + address->base = XEXP (x, 0);
14636 + address->offset = XEXP (x, 1);
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))
14649 address->offset = XEXP (x, 1);
14651 @@ -1937,7 +2031,7 @@
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))
14660 @@ -1956,14 +2050,14 @@
14661 if (GET_CODE (x) == PLUS)
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))
14667 address->base = XEXP (x, 0);
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))
14675 address->base = XEXP (x, 1);
14677 @@ -2025,6 +2119,243 @@
14678 && !address.index);
14681 +/* Return GOT pointer. */
14684 +m68k_get_gp (void)
14686 + if (pic_offset_table_rtx == NULL_RTX)
14687 + pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_REG);
14689 + crtl->uses_pic_offset_table = 1;
14691 + return pic_offset_table_rtx;
14694 +/* M68K relocations, used to distinguish GOT and TLS relocations in UNSPEC
14696 +enum m68k_reloc { RELOC_GOT, RELOC_TLSGD, RELOC_TLSLDM, RELOC_TLSLDO,
14697 + RELOC_TLSIE, RELOC_TLSLE };
14699 +#define TLS_RELOC_P(RELOC) ((RELOC) != RELOC_GOT)
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. */
14706 +m68k_wrap_symbol (rtx x, enum m68k_reloc reloc, rtx base_reg, rtx temp_reg)
14710 + use_x_p = (base_reg == pic_offset_table_rtx) ? TARGET_XGOT : TARGET_XTLS;
14712 + if (TARGET_COLDFIRE && use_x_p)
14713 + /* When compiling with -mx{got, tls} switch the code will look like this:
14715 + move.l <X>@<RELOC>,<TEMP_REG>
14716 + add.l <BASE_REG>,<TEMP_REG> */
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)),
14722 + x = gen_rtx_CONST (Pmode, x);
14724 + if (temp_reg == NULL)
14726 + gcc_assert (can_create_pseudo_p ());
14727 + temp_reg = gen_reg_rtx (Pmode);
14730 + emit_move_insn (temp_reg, x);
14731 + emit_insn (gen_addsi3 (temp_reg, temp_reg, base_reg));
14736 + x = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, x, GEN_INT (reloc)),
14738 + x = gen_rtx_CONST (Pmode, x);
14740 + x = gen_rtx_PLUS (Pmode, base_reg, x);
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. */
14751 +m68k_unwrap_symbol_1 (rtx orig, bool unwrap_reloc32_p,
14752 + enum m68k_reloc *reloc_ptr)
14754 + if (GET_CODE (orig) == CONST)
14757 + enum m68k_reloc dummy;
14759 + x = XEXP (orig, 0);
14761 + if (reloc_ptr == NULL)
14762 + reloc_ptr = &dummy;
14764 + /* Handle an addend. */
14765 + if ((GET_CODE (x) == PLUS || GET_CODE (x) == MINUS)
14766 + && CONST_INT_P (XEXP (x, 1)))
14769 + if (GET_CODE (x) == UNSPEC)
14771 + switch (XINT (x, 1))
14773 + case UNSPEC_RELOC16:
14774 + orig = XVECEXP (x, 0, 0);
14775 + *reloc_ptr = (enum m68k_reloc) INTVAL (XVECEXP (x, 0, 1));
14778 + case UNSPEC_RELOC32:
14779 + if (unwrap_reloc32_p)
14781 + orig = XVECEXP (x, 0, 0);
14782 + *reloc_ptr = (enum m68k_reloc) INTVAL (XVECEXP (x, 0, 1));
14795 +/* Unwrap symbol from UNSPEC_RELOC16 and, if unwrap_reloc32_p,
14796 + UNSPEC_RELOC32 wrappers. */
14799 +m68k_unwrap_symbol (rtx orig, bool unwrap_reloc32_p)
14801 + return m68k_unwrap_symbol_1 (orig, unwrap_reloc32_p, NULL);
14804 +/* Helper for m68k_final_prescan_insn. */
14807 +m68k_final_prescan_insn_1 (rtx *x_ptr, void *data ATTRIBUTE_UNUSED)
14811 + if (m68k_unwrap_symbol (x, true) != x)
14812 + /* For rationale of the below, see comment in m68k_final_prescan_insn. */
14816 + gcc_assert (GET_CODE (x) == CONST);
14817 + plus = XEXP (x, 0);
14819 + if (GET_CODE (plus) == PLUS || GET_CODE (plus) == MINUS)
14824 + unspec = XEXP (plus, 0);
14825 + gcc_assert (GET_CODE (unspec) == UNSPEC);
14826 + addend = XEXP (plus, 1);
14827 + gcc_assert (CONST_INT_P (addend));
14829 + /* We now have all the pieces, rearrange them. */
14831 + /* Move symbol to plus. */
14832 + XEXP (plus, 0) = XVECEXP (unspec, 0, 0);
14834 + /* Move plus inside unspec. */
14835 + XVECEXP (unspec, 0, 0) = plus;
14837 + /* Move unspec to top level of const. */
14838 + XEXP (x, 0) = unspec;
14847 +/* Prescan insn before outputing assembler for it. */
14850 +m68k_final_prescan_insn (rtx insn ATTRIBUTE_UNUSED,
14851 + rtx *operands, int n_operands)
14855 + /* Combine and, possibly, other optimizations may do good job
14857 + (const (unspec [(symbol)]))
14859 + (const (plus (unspec [(symbol)])
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".
14865 + It seems that the easiest solution to this is to convert such
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. */
14872 + for (i = 0; i < n_operands; ++i)
14876 + op = operands[i];
14878 + for_each_rtx (&op, m68k_final_prescan_insn_1, NULL);
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. */
14886 +m68k_move_to_reg (rtx x, rtx orig, rtx reg)
14890 + if (reg == NULL_RTX)
14892 + gcc_assert (can_create_pseudo_p ());
14893 + reg = gen_reg_rtx (Pmode);
14896 + insn = emit_move_insn (reg, x);
14897 + /* Put a REG_EQUAL note on this insn, so that it can be optimized
14899 + set_unique_reg_note (insn, REG_EQUAL, orig);
14904 +/* Does the same as m68k_wrap_symbol, but returns a memory reference to
14908 +m68k_wrap_symbol_into_got_ref (rtx x, enum m68k_reloc reloc, rtx temp_reg)
14910 + x = m68k_wrap_symbol (x, reloc, m68k_get_gp (), temp_reg);
14912 + x = gen_rtx_MEM (Pmode, x);
14913 + MEM_READONLY_P (x) = 1;
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 @@
14925 - if (TARGET_COLDFIRE && TARGET_XGOT)
14926 - /* When compiling with -mxgot switch the code for the above
14927 - example will look like this:
14930 - addl _foo@GOT, a0
14932 - movel #12345, a0@ */
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),
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);
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);
14953 + pic_ref = m68k_wrap_symbol_into_got_ref (orig, RELOC_GOT, reg);
14954 + pic_ref = m68k_move_to_reg (pic_ref, orig, reg);
14956 else if (GET_CODE (orig) == CONST)
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)
14967 @@ -2124,13 +2428,257 @@
14968 base == reg ? 0 : reg);
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));
14976 + pic_ref = gen_rtx_PLUS (Pmode, base, orig);
14982 +/* The __tls_get_addr symbol. */
14983 +static GTY(()) rtx m68k_tls_get_addr;
14985 +/* Return SYMBOL_REF for __tls_get_addr. */
14988 +m68k_get_tls_get_addr (void)
14990 + if (m68k_tls_get_addr == NULL_RTX)
14991 + m68k_tls_get_addr = init_one_libfunc ("__tls_get_addr");
14993 + return m68k_tls_get_addr;
14996 +/* Return libcall result in A0 instead of usual D0. */
14997 +static bool m68k_libcall_value_in_a0_p = false;
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
15006 +m68k_call_tls_get_addr (rtx x, rtx eqv, enum m68k_reloc reloc)
15012 + /* Emit the call sequence. */
15013 + start_sequence ();
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);
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. */
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;
15037 + insns = get_insns ();
15040 + gcc_assert (can_create_pseudo_p ());
15041 + dest = gen_reg_rtx (Pmode);
15042 + emit_libcall_block (insns, dest, a0, eqv);
15047 +/* The __tls_get_addr symbol. */
15048 +static GTY(()) rtx m68k_read_tp;
15050 +/* Return SYMBOL_REF for __m68k_read_tp. */
15053 +m68k_get_m68k_read_tp (void)
15055 + if (m68k_read_tp == NULL_RTX)
15056 + m68k_read_tp = init_one_libfunc ("__m68k_read_tp");
15058 + return m68k_read_tp;
15061 +/* Emit instruction sequence that calls __m68k_read_tp.
15062 + A pseudo register with result of __m68k_read_tp call is returned. */
15065 +m68k_call_m68k_read_tp (void)
15072 + start_sequence ();
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. */
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,
15084 + m68k_libcall_value_in_a0_p = false;
15085 + insns = get_insns ();
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);
15092 + gcc_assert (can_create_pseudo_p ());
15093 + dest = gen_reg_rtx (Pmode);
15094 + emit_libcall_block (insns, dest, a0, eqv);
15099 +/* Return a legitimized address for accessing TLS SYMBOL_REF X.
15100 + For explanations on instructions sequences see TLS/NPTL ABI for m68k and
15104 +m68k_legitimize_tls_address (rtx orig)
15106 + switch (SYMBOL_REF_TLS_MODEL (orig))
15108 + case TLS_MODEL_GLOBAL_DYNAMIC:
15109 + orig = m68k_call_tls_get_addr (orig, orig, RELOC_TLSGD);
15112 + case TLS_MODEL_LOCAL_DYNAMIC:
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),
15123 + a0 = m68k_call_tls_get_addr (orig, eqv, RELOC_TLSLDM);
15125 + x = m68k_wrap_symbol (orig, RELOC_TLSLDO, a0, NULL_RTX);
15127 + if (can_create_pseudo_p ())
15128 + x = m68k_move_to_reg (x, orig, NULL_RTX);
15134 + case TLS_MODEL_INITIAL_EXEC:
15139 + a0 = m68k_call_m68k_read_tp ();
15141 + x = m68k_wrap_symbol_into_got_ref (orig, RELOC_TLSIE, NULL_RTX);
15142 + x = gen_rtx_PLUS (Pmode, x, a0);
15144 + if (can_create_pseudo_p ())
15145 + x = m68k_move_to_reg (x, orig, NULL_RTX);
15151 + case TLS_MODEL_LOCAL_EXEC:
15156 + a0 = m68k_call_m68k_read_tp ();
15158 + x = m68k_wrap_symbol (orig, RELOC_TLSLE, a0, NULL_RTX);
15160 + if (can_create_pseudo_p ())
15161 + x = m68k_move_to_reg (x, orig, NULL_RTX);
15168 + gcc_unreachable ();
15174 +/* Return true if X is a TLS symbol. */
15177 +m68k_tls_symbol_p (rtx x)
15179 + if (!TARGET_HAVE_TLS)
15182 + if (GET_CODE (x) != SYMBOL_REF)
15185 + return SYMBOL_REF_TLS_MODEL (x) != 0;
15188 +/* Helper for m68k_tls_referenced_p. */
15191 +m68k_tls_reference_p_1 (rtx *x_ptr, void *data ATTRIBUTE_UNUSED)
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;
15197 + /* Don't recurse into legitimate TLS references. */
15198 + if (m68k_tls_reference_p (*x_ptr, true))
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. */
15209 +m68k_tls_reference_p (rtx x, bool legitimate_p)
15211 + if (!TARGET_HAVE_TLS)
15214 + if (!legitimate_p)
15215 + return for_each_rtx (&x, m68k_tls_reference_p_1, NULL) == 1 ? true : false;
15218 + enum m68k_reloc reloc = RELOC_GOT;
15220 + return (m68k_unwrap_symbol_1 (x, true, &reloc) != x
15221 + && TLS_RELOC_P (reloc));
15227 #define USE_MOVQ(i) ((unsigned) ((i) + 128) <= 255)
15228 @@ -3918,18 +4466,92 @@
15232 +/* Return string for TLS relocation RELOC. */
15234 +static const char *
15235 +m68k_get_reloc_decoration (enum m68k_reloc reloc)
15237 + /* To my knowledge, !MOTOROLA assemblers don't support TLS. */
15238 + gcc_assert (MOTOROLA || reloc == RELOC_GOT);
15245 + if (flag_pic == 1 && TARGET_68020)
15252 + if (TARGET_68020)
15254 + switch (flag_pic)
15266 + case RELOC_TLSGD:
15269 + case RELOC_TLSLDM:
15270 + return "@TLSLDM";
15272 + case RELOC_TLSLDO:
15273 + return "@TLSLDO";
15275 + case RELOC_TLSIE:
15278 + case RELOC_TLSLE:
15282 + gcc_unreachable ();
15286 /* m68k implementation of OUTPUT_ADDR_CONST_EXTRA. */
15289 m68k_output_addr_const_extra (FILE *file, rtx x)
15291 - if (GET_CODE (x) != UNSPEC || XINT (x, 1) != UNSPEC_GOTOFF)
15293 + if (GET_CODE (x) == UNSPEC)
15295 + switch (XINT (x, 1))
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);
15303 - output_addr_const (file, XVECEXP (x, 0, 0));
15304 - /* ??? What is the non-MOTOROLA syntax? */
15305 - fputs ("@GOT", file);
15315 +/* M68K implementation of TARGET_ASM_OUTPUT_DWARF_DTPREL. */
15318 +m68k_output_dwarf_dtprel (FILE *file, int size, rtx x)
15320 + gcc_assert (size == 4);
15321 + fputs ("\t.long\t", file);
15322 + output_addr_const (file, x);
15323 + fputs ("@TLSLDO+0x8000", file);
15327 @@ -4019,15 +4641,8 @@
15330 if (address.offset)
15332 - output_addr_const (file, address.offset);
15333 - if (flag_pic && address.base == pic_offset_table_rtx)
15335 - fprintf (file, "@GOT");
15336 - if (flag_pic == 1 && TARGET_68020)
15337 - fprintf (file, ".w");
15340 + output_addr_const (file, address.offset);
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)
15350 - output_addr_const (file, address.offset);
15351 - if (address.base == pic_offset_table_rtx && TARGET_68020)
15352 - switch (flag_pic)
15355 - fprintf (file, ":w"); break;
15357 - fprintf (file, ":l"); break;
15362 + output_addr_const (file, address.offset);
15364 /* Print the ",index" component, if any. */
15366 @@ -4580,7 +5183,8 @@
15370 - return gen_rtx_REG (mode, D0_REG);
15372 + return gen_rtx_REG (mode, m68k_libcall_value_in_a0_p ? A0_REG : D0_REG);
15376 @@ -4846,9 +5450,8 @@
15377 return OP_TYPE_IMM_L;
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;
15387 return OP_TYPE_IMM_L;
15388 @@ -5793,3 +6396,5 @@
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
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)
15409 M68K_DEVICE ("cpu32", cpu32, "cpu32", "cpu32", cpu32, isa_cpu32, FL_MMU)
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)
15421 /* ColdFire CFV2 processors. */
15422 M68K_DEVICE ("5202", mcf5202, "5206", "5206", cfv2, isa_a, 0)
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)
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 @@
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. */
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 @@
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
15504 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
15505 @@ -644,7 +646,7 @@
15506 (though the operand list is empty). */
15507 #define TRANSFER_FROM_TRAMPOLINE \
15509 -__transfer_from_trampoline () \
15510 +__transfer_from_trampoline (void) \
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
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)
15522 /* Macros to check register numbers against specific register classes. */
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)
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])))
15537 #define REGNO_OK_FOR_BASE_P(REGNO) \
15538 (ADDRESS_REGNO_P (REGNO) \
15539 @@ -751,13 +758,14 @@
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))
15547 #define REG_OK_FOR_BASE_P(X) \
15548 m68k_legitimate_base_reg_p (X, REG_STRICT_P)
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)
15555 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
15557 @@ -770,52 +778,19 @@
15558 /* This address is OK as it stands. */
15559 #define PIC_CASE_VECTOR_ADDRESS(index) index
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);} \
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); \
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); \
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); \
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); \
15607 +#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
15611 + __x = m68k_legitimize_address (X, OLDX, MODE); \
15612 + if (__x != NULL_RTX) \
15616 + if (memory_address_p (MODE, X)) \
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)))
15627 +#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
15628 + m68k_final_prescan_insn (INSN, OPVEC, NOPERANDS)
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 @@
15640 - (UNSPEC_GOTOFF 6)
15641 + (UNSPEC_RELOC16 6)
15642 + (UNSPEC_RELOC32 7)
15645 ;; UNSPEC_VOLATILE usage:
15646 @@ -414,7 +415,7 @@
15648 (define_insn "tst<mode>_cf"
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"
15654 cc_status.flags = CC_IN_68881;
15655 @@ -570,8 +571,8 @@
15657 (define_insn "*cmp<mode>_cf"
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 @@
15668 rtx tmp, base, offset;
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))
15675 + rtx tmp = operands[1];
15676 + rtx addend = NULL;
15678 + if (GET_CODE (tmp) == CONST && GET_CODE (XEXP (tmp, 0)) == PLUS)
15680 + addend = XEXP (XEXP (tmp, 0), 1);
15681 + tmp = XEXP (XEXP (tmp, 0), 0);
15684 + gcc_assert (GET_CODE (tmp) == SYMBOL_REF);
15685 + gcc_assert (SYMBOL_REF_TLS_MODEL (tmp) != 0);
15687 + tmp = m68k_legitimize_tls_address (tmp);
15691 + if (!REG_P (tmp))
15695 + reg = gen_reg_rtx (Pmode);
15696 + emit_move_insn (reg, tmp);
15700 + tmp = gen_rtx_PLUS (SImode, tmp, addend);
15703 + operands[1] = tmp;
15705 + else if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
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
15715 - (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
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"
15721 if (which_alternative == 4 || which_alternative == 5) {
15722 @@ -1215,8 +1248,8 @@
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"
15733 @@ -1857,7 +1890,7 @@
15734 (define_insn "extendsfdf2_cf"
15735 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
15737 - (match_operand:SF 1 "general_operand" "f,<Q>U")))]
15738 + (match_operand:SF 1 "general_operand" "f,m")))]
15739 "TARGET_COLDFIRE_FPU"
15741 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
15742 @@ -1897,9 +1930,9 @@
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")
15749 - (match_operand:DF 1 "general_operand" "<Q>U,f")))]
15750 + (match_operand:DF 1 "general_operand" "m,f")))]
15751 "TARGET_COLDFIRE_FPU"
15754 @@ -2045,7 +2078,7 @@
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"
15762 if (FP_REG_P (operands[1]))
15763 @@ -2338,9 +2371,9 @@
15764 "* return output_addsi3 (operands);")
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")))]
15775 switch (which_alternative)
15776 @@ -2382,9 +2415,9 @@
15777 (plus:SI (match_dup 0)
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")])
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"
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"
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"
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"
15824 if (FP_REG_P (operands[2]))
15825 @@ -4163,7 +4196,7 @@
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"
15833 if (DATA_REG_P (operands[0]))
15834 @@ -4197,7 +4230,7 @@
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"
15842 if (FP_REG_P (operands[1]))
15843 @@ -4316,7 +4349,7 @@
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"
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 @@
15857 Target Report Mask(XGOT)
15858 Support more than 8192 GOT entries on ColdFire
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);
15888 +/* Functions from m68k.c used in constraints.md. */
15889 +extern rtx m68k_unwrap_symbol (rtx, bool);
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"))
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.
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
15913 # crti and crtn are provided by uClibc.
15914 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
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"))
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 @@
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"))
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")
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")
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")
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")
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")
15976 +(define_bypass 1 "r74k_int_mul3" "r74k_int_madd"
15977 + "mips_mult_madd_chain_bypass_p")
15980 +;; --------------------------------------------------------------
15981 +;; DSP instructins
15982 +;; --------------------------------------------------------------
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"))
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"))
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")
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")
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")
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")
16024 +;; dspalu ->load/store base
16025 +;; dspalusat->load/store base
16026 +;; - we should never see these in real life.
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")
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")
16038 +(define_bypass 1 "r74k_int_mult" "r74k_dsp_mac")
16039 +(define_bypass 1 "r74k_int_mult" "r74k_dsp_mac_sat")
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")
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")
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")
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
16072 +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
16074 + This file is part of GCC.
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.
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.
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.
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/>. */
16095 +#ifdef __mips_hard_float
16097 +/* flush denormalized numbers to zero */
16098 +#define _FPU_FLUSH_TZ 0x1000000
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
16106 +/* enable interrupts for IEEE exceptions */
16107 +#define _FPU_IEEE 0x00000F80
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))
16113 +static void __attribute__((constructor))
16114 +set_fast_math (void)
16116 + unsigned int fcr;
16118 + /* fastmath: flush to zero, round to nearest, ieee exceptions disabled */
16119 + fcr = _FPU_FLUSH_TZ | _FPU_RC_NEAREST;
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
16129 +/* MIPS SourceryG++ GNU/Linux Configuration.
16130 + Copyright (C) 2008
16131 + Free Software Foundation, Inc.
16133 +This file is part of GCC.
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.
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.
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/>. */
16149 +/* We do not need to provide an explicit big-endian multilib. */
16150 +#undef MULTILIB_DEFAULTS
16151 +#define MULTILIB_DEFAULTS \
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}"
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
16177 +/* MIPS SourceryG++ GNU/Linux Configuration.
16178 + Copyright (C) 2008
16179 + Free Software Foundation, Inc.
16181 +This file is part of GCC.
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.
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.
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/>. */
16197 +/* We do not need to provide an explicit big-endian multilib. */
16198 +#undef MULTILIB_DEFAULTS
16199 +#define MULTILIB_DEFAULTS \
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}"
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
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
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
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"
16237 +#undef SUBTARGET_OVERRIDE_OPTIONS
16238 +#define SUBTARGET_OVERRIDE_OPTIONS \
16240 + /* __thread_support is not supported by uClibc. */ \
16241 + if (linux_uclibc) \
16242 + targetm.have_tls = 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;
16251 - /* The number of GPRs and FPRs saved. */
16252 + /* Likewise doubleword accumulator X ($acX). */
16253 + unsigned int acc_mask;
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;
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
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;
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;
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;
16285 + /* True if this is an interrupt handler. */
16286 + bool interrupt_handler_p;
16288 + /* True if this is an interrupt handler that uses shadow registers. */
16289 + bool use_shadow_register_set_p;
16291 + /* True if this is an interrupt handler that should keep interrupts
16293 + bool keep_interrupts_masked_p;
16295 + /* True if this is an interrupt handler that should use DERET
16296 + instead of ERET. */
16297 + bool use_debug_exception_return_p;
16300 /* Information about a single argument. */
16301 @@ -542,9 +567,16 @@
16302 ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS
16305 +#ifdef CVMX_SHARED_BSS_FLAGS
16306 +static tree octeon_handle_cvmx_shared_attribute (tree *, tree, tree, int, bool *);
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 },
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 }
16330 @@ -659,6 +696,11 @@
16331 { "74kx", PROCESSOR_74KF1_1, 33, 0 },
16332 { "74kf3_2", PROCESSOR_74KF3_2, 33, 0 },
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 },
16339 /* MIPS64 processors. */
16340 { "5kc", PROCESSOR_5KC, 64, 0 },
16341 { "5kf", PROCESSOR_5KF, 64, 0 },
16342 @@ -1064,13 +1106,7 @@
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 */
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;
16361 +/* Check if the interrupt attribute is set for a function. */
16364 +mips_interrupt_type_p (tree type)
16366 + return lookup_attribute ("interrupt", TYPE_ATTRIBUTES (type)) != NULL;
16369 +/* Check if the attribute to use shadow register set is set for a function. */
16372 +mips_use_shadow_register_set_p (tree type)
16374 + return lookup_attribute ("use_shadow_register_set",
16375 + TYPE_ATTRIBUTES (type)) != NULL;
16378 +/* Check if the attribute to keep interrupts masked is set for a function. */
16381 +mips_keep_interrupts_masked_p (tree type)
16383 + return lookup_attribute ("keep_interrupts_masked",
16384 + TYPE_ATTRIBUTES (type)) != NULL;
16387 +/* Check if the attribute to use debug exception return is set for
16391 +mips_use_debug_exception_return_p (tree type)
16393 + return lookup_attribute ("use_debug_exception_return",
16394 + TYPE_ATTRIBUTES (type)) != NULL;
16397 /* Return true if function DECL is a MIPS16 function. Return the ambient
16398 setting if DECL is null. */
16400 @@ -2795,7 +2867,7 @@
16401 mips_legitimize_address (rtx *xloc, enum machine_mode mode)
16404 - HOST_WIDE_INT offset;
16405 + HOST_WIDE_INT intval, high, offset;
16407 if (mips_tls_symbol_p (*xloc))
16409 @@ -2820,6 +2892,32 @@
16410 *xloc = mips_force_address (addr, mode);
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)
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.
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))
16434 + base = mips_force_temporary (NULL, GEN_INT (high));
16435 + *xloc = plus_constant (base, offset);
16442 @@ -6188,6 +6286,11 @@
16443 if (!TARGET_SIBCALLS)
16446 + /* Interrupt handlers need special epilogue code and therefore can't
16448 + if (mips_interrupt_type_p (TREE_TYPE (current_function_decl)))
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))
16458 + if (ISA_HAS_UL_US)
16460 + if (GET_MODE (dest) == DImode)
16461 + emit_insn (gen_mov_uld (dest, src, left));
16463 + emit_insn (gen_mov_ulw (dest, src, left));
16467 temp = gen_reg_rtx (GET_MODE (dest));
16468 if (GET_MODE (dest) == DImode)
16470 @@ -6642,6 +6754,16 @@
16472 mode = mode_for_size (width, MODE_INT, 0);
16473 src = gen_lowpart (mode, src);
16475 + if (ISA_HAS_UL_US)
16477 + if (GET_MODE (src) == DImode)
16478 + emit_insn (gen_mov_usd (dest, src, left));
16480 + emit_insn (gen_mov_usw (dest, src, left));
16484 if (mode == DImode)
16486 emit_insn (gen_mov_sdl (dest, src, left));
16487 @@ -7229,7 +7351,11 @@
16488 || (letter == 'L' && TARGET_BIG_ENDIAN)
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", ®_names[regno][4]);
16496 + fprintf (file, "%s", reg_names[regno]);
16500 @@ -7369,6 +7495,12 @@
16501 if (TARGET_ABICALLS || TARGET_VXWORKS_RTP)
16504 +#ifdef CVMX_SHARED_BSS_FLAGS
16505 + if (TARGET_OCTEON && TREE_CODE (decl) == VAR_DECL
16506 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (decl)))
16510 if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl) != 0)
16513 @@ -7595,6 +7727,37 @@
16517 +/* DSP ALU can bypass data with no delays for the following pairs. */
16518 +enum insn_code dspalu_bypass_table[][2] =
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}
16531 +mips_dspalu_bypass_p (rtx out_insn, rtx in_insn)
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);
16539 + for (i = 0; i < num_bypass; i++)
16541 + if (out_icode == dspalu_bypass_table[i][0]
16542 + && in_icode == dspalu_bypass_table[i][1])
16548 /* Implement ASM_OUTPUT_ASCII. */
16551 @@ -7819,11 +7982,19 @@
16552 "\t.previous\n", TARGET_LONG64 ? 64 : 32);
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));
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));
16570 /* If TARGET_ABICALLS, tell GAS to generate -KPIC code. */
16571 @@ -8436,12 +8607,53 @@
16572 return GLOBAL_POINTER_REGNUM;
16575 +/* Return true if REGNO is a register that is ordinarily call-clobbered
16576 + but must nevertheless be preserved by an interrupt handler. */
16579 +mips_interrupt_extra_call_saved_reg_p (unsigned int regno)
16581 + if (MD_REG_P (regno))
16584 + if (TARGET_DSP && DSP_ACC_REG_P (regno))
16587 + if (GP_REG_P (regno) && !cfun->machine->use_shadow_register_set_p)
16589 + /* $0 is hard-wired. */
16590 + if (regno == GP_REG_FIRST)
16593 + /* The interrupt handler can treat kernel registers as
16594 + scratch registers. */
16595 + if (KERNEL_REG_P (regno))
16598 + /* The function will return the stack pointer to its original value
16600 + if (regno == STACK_POINTER_REGNUM)
16603 + /* Otherwise, return true for registers that aren't ordinarily
16604 + call-clobbered. */
16605 + return call_really_used_regs[regno];
16611 /* Return true if the current function should treat register REGNO
16615 mips_cfun_call_saved_reg_p (unsigned int regno)
16617 + /* Interrupt handlers need to save extra registers. */
16618 + if (cfun->machine->interrupt_handler_p
16619 + && mips_interrupt_extra_call_saved_reg_p (regno))
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 ())
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))
16639 @@ -8545,6 +8764,14 @@
16640 C | callee-allocated save area |
16641 | for register varargs |
16643 + +-------------------------------+ <-- frame_pointer_rtx
16644 + | | + cop0_sp_offset
16645 + | COP0 reg save area | + UNITS_PER_WORD
16647 + +-------------------------------+ <-- frame_pointer_rtx + acc_sp_offset
16648 + | | + UNITS_PER_WORD
16649 + | accumulator save area |
16651 +-------------------------------+ <-- frame_pointer_rtx + fp_sp_offset
16652 | | + UNITS_PER_HWFPVALUE
16654 @@ -8588,6 +8815,28 @@
16655 HOST_WIDE_INT offset, size;
16656 unsigned int regno, i;
16658 + /* Set this function's interrupt properties. */
16659 + if (mips_interrupt_type_p (TREE_TYPE (current_function_decl)))
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");
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));
16680 frame = &cfun->machine->frame;
16681 memset (frame, 0, sizeof (*frame));
16682 size = get_frame_size ();
16683 @@ -8657,7 +8906,7 @@
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;
16696 + /* Add in space for the interrupt context information. */
16697 + if (cfun->machine->interrupt_handler_p)
16699 + /* Check HI/LO. */
16700 + if (mips_save_reg_p (LO_REGNUM) || mips_save_reg_p (HI_REGNUM))
16702 + frame->num_acc++;
16703 + frame->acc_mask |= (1 << 0);
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))
16710 + frame->num_acc++;
16711 + frame->acc_mask |= 1 << (((i - DSP_ACC_REG_FIRST) / 2) + 1);
16714 + /* All interrupt context functions need space to preserve STATUS. */
16715 + frame->num_cop0_regs++;
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++;
16722 + /* Move above the accumulator save area. */
16723 + if (frame->num_acc > 0)
16725 + /* Each accumulator needs 2 words. */
16726 + offset += frame->num_acc * 2 * UNITS_PER_WORD;
16727 + frame->acc_sp_offset = offset - UNITS_PER_WORD;
16730 + /* Move above the COP0 register save area. */
16731 + if (frame->num_cop0_regs > 0)
16733 + offset += frame->num_cop0_regs * UNITS_PER_WORD;
16734 + frame->cop0_sp_offset = offset - UNITS_PER_WORD;
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;
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);
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
16760 +mips_for_each_saved_acc (HOST_WIDE_INT sp_offset, mips_save_restore_fn fn)
16762 + HOST_WIDE_INT offset;
16765 + offset = cfun->machine->frame.acc_sp_offset - sp_offset;
16766 + if (BITSET_P (cfun->machine->frame.acc_mask, 0))
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;
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))
16778 + mips_save_restore_reg (word_mode, regno, offset, fn);
16779 + offset -= UNITS_PER_WORD;
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
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)
16792 enum machine_mode fpr_mode;
16793 HOST_WIDE_INT offset;
16794 @@ -9075,13 +9398,24 @@
16798 - if (TARGET_MIPS16
16799 - && REGNO (reg) != GP_REG_FIRST + 31
16800 - && !M16_REG_P (REGNO (reg)))
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)
16807 + if (TARGET_64BIT)
16808 + emit_insn (gen_mfhidi_ti (MIPS_PROLOGUE_TEMP (DImode),
16809 + gen_rtx_REG (TImode, MD_REG_FIRST)));
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)));
16815 + else if ((TARGET_MIPS16
16816 + && REGNO (reg) != GP_REG_FIRST + 31
16817 + && !M16_REG_P (REGNO (reg)))
16818 + || ACC_REG_P (REGNO (reg)))
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)));
16826 @@ -9153,6 +9487,14 @@
16827 emit_insn (gen_loadgp_blockage ());
16830 +/* A for_each_rtx callback. Stop the search if *X is a kernel register. */
16833 +mips_kernel_reg_p (rtx *x, void *data ATTRIBUTE_UNUSED)
16835 + return GET_CODE (*x) == REG && KERNEL_REG_P (REGNO (*x));
16838 /* Expand the "prologue" pattern. */
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)
16849 HOST_WIDE_INT step1;
16851 @@ -9203,12 +9546,97 @@
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;
16860 - mips_for_each_saved_reg (size, mips_save_reg);
16861 + if (cfun->machine->interrupt_handler_p)
16863 + HOST_WIDE_INT offset;
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));
16872 + if (!cfun->machine->keep_interrupts_masked_p)
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)));
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;
16890 + /* Start at the uppermost location for saving. */
16891 + offset = frame->cop0_sp_offset - size;
16892 + if (!cfun->machine->keep_interrupts_masked_p)
16894 + /* Push EPC into its stack slot. */
16895 + mem = gen_frame_mem (word_mode,
16896 + plus_constant (stack_pointer_rtx,
16898 + mips_emit_move (mem, gen_rtx_REG (word_mode, K1_REG_NUM));
16899 + offset -= UNITS_PER_WORD;
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)));
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)));
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;
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),
16923 + GEN_INT (SR_IPL),
16924 + gen_rtx_REG (SImode, K0_REG_NUM)));
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),
16932 + GEN_INT (SR_EXL),
16933 + gen_rtx_REG (SImode, GP_REG_FIRST)));
16935 + /* Disable interrupts by clearing the KSU, ERL, EXL,
16937 + emit_insn (gen_insvsi (gen_rtx_REG (SImode, K1_REG_NUM),
16940 + gen_rtx_REG (SImode, GP_REG_FIRST)));
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;
16950 + mips_for_each_saved_acc (size, mips_save_reg);
16951 + mips_for_each_saved_gpr_and_fpr (size, mips_save_reg);
16955 @@ -9293,6 +9721,20 @@
16956 pic_offset_table_rtx);
16959 + /* We need to search back to the last use of K0 or K1. */
16960 + if (cfun->machine->interrupt_handler_p)
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))
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)),
16973 /* If we are profiling, make sure no instructions are scheduled before
16974 the call to mcount. */
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);
16980 - if (TARGET_MIPS16 && !M16_REG_P (REGNO (reg)))
16981 + if (REGNO (reg) == HI_REGNUM)
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)));
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)));
16993 + else if ((TARGET_MIPS16 && !M16_REG_P (REGNO (reg)))
16994 + || ACC_REG_P (REGNO (reg)))
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 @@
17000 const struct mips_frame_info *frame;
17001 HOST_WIDE_INT step1, step2;
17002 - rtx base, target;
17003 + rtx base, target, insn;
17005 if (!sibcall_p && mips_can_use_return_insn ())
17007 @@ -9378,7 +9833,8 @@
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)
17015 step2 = MIN (step1, MIPS_MAX_FIRST_STACK_STEP);
17017 @@ -9440,13 +9896,53 @@
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);
17026 - /* Deallocate the final bit of the frame. */
17028 - emit_insn (gen_add3_insn (stack_pointer_rtx,
17029 - stack_pointer_rtx,
17030 - GEN_INT (step2)));
17031 + if (cfun->machine->interrupt_handler_p)
17033 + HOST_WIDE_INT offset;
17036 + offset = frame->cop0_sp_offset - (frame->total_size - step2);
17037 + if (!cfun->machine->keep_interrupts_masked_p)
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;
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)));
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;
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)));
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)));
17068 + /* Deallocate the final bit of the frame. */
17070 + emit_insn (gen_add3_insn (stack_pointer_rtx,
17071 + stack_pointer_rtx,
17072 + GEN_INT (step2)));
17076 /* Add in the __builtin_eh_return stack adjustment. We need to
17077 @@ -9469,18 +9965,44 @@
17081 - unsigned int regno;
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;
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)
17095 + /* Interrupt handlers generate eret or deret. */
17096 + if (cfun->machine->use_debug_exception_return_p)
17097 + emit_jump_insn (gen_mips_deret ());
17099 + emit_jump_insn (gen_mips_eret ());
17103 + unsigned int regno;
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;
17113 + regno = GP_REG_FIRST + 31;
17114 + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, regno)));
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)
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))
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);
17133 @@ -9491,6 +10013,10 @@
17135 mips_can_use_return_insn (void)
17137 + /* Interrupt handlers need to go through the epilogue. */
17138 + if (cfun->machine->interrupt_handler_p)
17141 if (!reload_completed)
17144 @@ -10422,10 +10948,15 @@
17145 s = "bnez\t%2,1f\n\tbreak\t7\n1:";
17147 else if (GENERATE_DIVIDE_TRAPS)
17149 - output_asm_insn (s, operands);
17150 - s = "teq\t%2,%.,7";
17154 + output_asm_insn ("teq\t%2,%.,7", operands);
17157 + output_asm_insn (s, operands);
17158 + s = "teq\t%2,%.,7";
17163 output_asm_insn ("%(bne\t%2,%.,1f", operands);
17164 @@ -10737,7 +11268,17 @@
17165 ready[pos2] = temp;
17171 +mips_mult_madd_chain_bypass_p (rtx out_insn ATTRIBUTE_UNUSED,
17172 + rtx in_insn ATTRIBUTE_UNUSED)
17174 + if (reload_completed)
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. */
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;
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
17198 @@ -13984,26 +14533,46 @@
17200 target_flags |= MASK_DSP;
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.
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.
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:
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.
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.
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.
17244 + - .cfi* directives generate read-only .eh_frame sections.
17245 + However, MIPS has traditionally not allowed directives like:
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.
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.
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;
17263 mips_init_print_operand_punct ();
17265 @@ -14242,6 +14811,178 @@
17266 reg_alloc_order[24] = 0;
17270 +/* Implement EPILOGUE_USES. */
17273 +mips_epilogue_uses (unsigned int regno)
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. */
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)
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))
17295 +#ifdef CVMX_SHARED_BSS_FLAGS
17296 +/* Handle a "cvmx_shared" attribute; arguments as in
17297 + struct attribute_spec.handler. */
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)
17305 + if (TREE_CODE (*node) != VAR_DECL)
17307 + warning (OPT_Wattributes, "%qs attribute only applies to variables",
17308 + IDENTIFIER_POINTER (name));
17309 + *no_add_attrs = true;
17312 + return NULL_TREE;
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. */
17321 +octeon_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
17323 + if (decl && TREE_CODE (decl) == VAR_DECL
17324 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (decl)))
17326 + const char *sname = NULL;
17327 + unsigned int flags = SECTION_WRITE;
17329 + switch (categorize_decl_for_section (decl, reloc))
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";
17345 + case SECCAT_SBSS:
17346 + sname = ".cvmx_shared_bss";
17347 + flags |= SECTION_BSS;
17349 + case SECCAT_TEXT:
17350 + case SECCAT_TDATA:
17351 + case SECCAT_TBSS:
17356 + return get_section (sname, flags, decl);
17359 + return default_elf_select_section (decl, reloc, align);
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. */
17368 +octeon_unique_section (tree decl, int reloc)
17370 + if (decl && TREE_CODE (decl) == VAR_DECL
17371 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (decl)))
17373 + const char *sname = NULL;
17375 + if (! DECL_ONE_ONLY (decl))
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);
17384 + switch (categorize_decl_for_section (decl, reloc))
17387 + case SECCAT_SBSS:
17388 + sname = ".cvmx_shared_bss.linkonce.";
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.";
17403 + case SECCAT_TEXT:
17404 + case SECCAT_TDATA:
17405 + case SECCAT_TBSS:
17410 + const char *name;
17411 + size_t plen, nlen;
17413 + plen = strlen (sname);
17415 + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
17416 + name = targetm.strip_name_encoding (name);
17417 + nlen = strlen (name);
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);
17426 + default_unique_section (decl, reloc);
17429 +/* Emit an uninitialized cvmx_shared variable. */
17431 +octeon_output_shared_variable (FILE *stream, tree decl, const char *name,
17432 + unsigned HOST_WIDE_INT size, int align)
17434 + switch_to_section (get_section (".cvmx_shared_bss", CVMX_SHARED_BSS_FLAGS,
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);
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
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))])]
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")])
17458 (define_insn "mips_add<DSP:dspfmt1>_s_<DSP:dspfmt2>"
17461 (set (reg:CCDSP CCDSP_OU_REGNUM)
17462 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDQ_S))])]
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")])
17472 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBQ))])]
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")])
17479 (define_insn "mips_sub<DSP:dspfmt1>_s_<DSP:dspfmt2>"
17481 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBQ_S))])]
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")])
17490 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDSC))])]
17493 - [(set_attr "type" "arith")
17494 + [(set_attr "type" "dspalu")
17495 (set_attr "mode" "SI")])
17498 @@ -112,7 +112,7 @@
17499 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDWC))])]
17502 - [(set_attr "type" "arith")
17503 + [(set_attr "type" "dspalu")
17504 (set_attr "mode" "SI")])
17507 @@ -123,7 +123,7 @@
17511 - [(set_attr "type" "arith")
17512 + [(set_attr "type" "dspalu")
17513 (set_attr "mode" "SI")])
17516 @@ -133,7 +133,7 @@
17517 UNSPEC_RADDU_W_QB))]
17519 "raddu.w.qb\t%0,%1"
17520 - [(set_attr "type" "arith")
17521 + [(set_attr "type" "dspalu")
17522 (set_attr "mode" "SI")])
17525 @@ -146,7 +146,7 @@
17526 (unspec:CCDSP [(match_dup 1)] UNSPEC_ABSQ_S))])]
17528 "absq_s.<DSPQ:dspfmt2>\t%0,%1"
17529 - [(set_attr "type" "arith")
17530 + [(set_attr "type" "dspalusat")
17531 (set_attr "mode" "SI")])
17534 @@ -157,7 +157,7 @@
17535 UNSPEC_PRECRQ_QB_PH))]
17537 "precrq.qb.ph\t%0,%1,%2"
17538 - [(set_attr "type" "arith")
17539 + [(set_attr "type" "dspalu")
17540 (set_attr "mode" "SI")])
17542 (define_insn "mips_precrq_ph_w"
17543 @@ -167,7 +167,7 @@
17544 UNSPEC_PRECRQ_PH_W))]
17546 "precrq.ph.w\t%0,%1,%2"
17547 - [(set_attr "type" "arith")
17548 + [(set_attr "type" "dspalu")
17549 (set_attr "mode" "SI")])
17551 (define_insn "mips_precrq_rs_ph_w"
17552 @@ -181,7 +181,7 @@
17553 UNSPEC_PRECRQ_RS_PH_W))])]
17555 "precrq_rs.ph.w\t%0,%1,%2"
17556 - [(set_attr "type" "arith")
17557 + [(set_attr "type" "dspalu")
17558 (set_attr "mode" "SI")])
17561 @@ -196,7 +196,7 @@
17562 UNSPEC_PRECRQU_S_QB_PH))])]
17564 "precrqu_s.qb.ph\t%0,%1,%2"
17565 - [(set_attr "type" "arith")
17566 + [(set_attr "type" "dspalusat")
17567 (set_attr "mode" "SI")])
17570 @@ -206,7 +206,7 @@
17571 UNSPEC_PRECEQ_W_PHL))]
17573 "preceq.w.phl\t%0,%1"
17574 - [(set_attr "type" "arith")
17575 + [(set_attr "type" "dspalu")
17576 (set_attr "mode" "SI")])
17578 (define_insn "mips_preceq_w_phr"
17579 @@ -215,7 +215,7 @@
17580 UNSPEC_PRECEQ_W_PHR))]
17582 "preceq.w.phr\t%0,%1"
17583 - [(set_attr "type" "arith")
17584 + [(set_attr "type" "dspalu")
17585 (set_attr "mode" "SI")])
17588 @@ -225,7 +225,7 @@
17589 UNSPEC_PRECEQU_PH_QBL))]
17591 "precequ.ph.qbl\t%0,%1"
17592 - [(set_attr "type" "arith")
17593 + [(set_attr "type" "dspalu")
17594 (set_attr "mode" "SI")])
17596 (define_insn "mips_precequ_ph_qbr"
17597 @@ -234,7 +234,7 @@
17598 UNSPEC_PRECEQU_PH_QBR))]
17600 "precequ.ph.qbr\t%0,%1"
17601 - [(set_attr "type" "arith")
17602 + [(set_attr "type" "dspalu")
17603 (set_attr "mode" "SI")])
17605 (define_insn "mips_precequ_ph_qbla"
17606 @@ -243,7 +243,7 @@
17607 UNSPEC_PRECEQU_PH_QBLA))]
17609 "precequ.ph.qbla\t%0,%1"
17610 - [(set_attr "type" "arith")
17611 + [(set_attr "type" "dspalu")
17612 (set_attr "mode" "SI")])
17614 (define_insn "mips_precequ_ph_qbra"
17615 @@ -252,7 +252,7 @@
17616 UNSPEC_PRECEQU_PH_QBRA))]
17618 "precequ.ph.qbra\t%0,%1"
17619 - [(set_attr "type" "arith")
17620 + [(set_attr "type" "dspalu")
17621 (set_attr "mode" "SI")])
17624 @@ -262,7 +262,7 @@
17625 UNSPEC_PRECEU_PH_QBL))]
17627 "preceu.ph.qbl\t%0,%1"
17628 - [(set_attr "type" "arith")
17629 + [(set_attr "type" "dspalu")
17630 (set_attr "mode" "SI")])
17632 (define_insn "mips_preceu_ph_qbr"
17633 @@ -271,7 +271,7 @@
17634 UNSPEC_PRECEU_PH_QBR))]
17636 "preceu.ph.qbr\t%0,%1"
17637 - [(set_attr "type" "arith")
17638 + [(set_attr "type" "dspalu")
17639 (set_attr "mode" "SI")])
17641 (define_insn "mips_preceu_ph_qbla"
17642 @@ -280,7 +280,7 @@
17643 UNSPEC_PRECEU_PH_QBLA))]
17645 "preceu.ph.qbla\t%0,%1"
17646 - [(set_attr "type" "arith")
17647 + [(set_attr "type" "dspalu")
17648 (set_attr "mode" "SI")])
17650 (define_insn "mips_preceu_ph_qbra"
17651 @@ -289,7 +289,7 @@
17652 UNSPEC_PRECEU_PH_QBRA))]
17654 "preceu.ph.qbra\t%0,%1"
17655 - [(set_attr "type" "arith")
17656 + [(set_attr "type" "dspalu")
17657 (set_attr "mode" "SI")])
17659 ;; Table 2-2. MIPS DSP ASE Instructions: Shift
17660 @@ -313,7 +313,7 @@
17662 return "shllv.<DSPV:dspfmt2>\t%0,%1,%2";
17664 - [(set_attr "type" "shift")
17665 + [(set_attr "type" "dspalu")
17666 (set_attr "mode" "SI")])
17668 (define_insn "mips_shll_s_<DSPQ:dspfmt2>"
17669 @@ -335,7 +335,7 @@
17671 return "shllv_s.<DSPQ:dspfmt2>\t%0,%1,%2";
17673 - [(set_attr "type" "shift")
17674 + [(set_attr "type" "dspalusat")
17675 (set_attr "mode" "SI")])
17678 @@ -354,7 +354,7 @@
17680 return "shrlv.qb\t%0,%1,%2";
17682 - [(set_attr "type" "shift")
17683 + [(set_attr "type" "dspalu")
17684 (set_attr "mode" "SI")])
17687 @@ -373,7 +373,7 @@
17689 return "shrav.ph\t%0,%1,%2";
17691 - [(set_attr "type" "shift")
17692 + [(set_attr "type" "dspalu")
17693 (set_attr "mode" "SI")])
17695 (define_insn "mips_shra_r_<DSPQ:dspfmt2>"
17696 @@ -392,7 +392,7 @@
17698 return "shrav_r.<DSPQ:dspfmt2>\t%0,%1,%2";
17700 - [(set_attr "type" "shift")
17701 + [(set_attr "type" "dspalu")
17702 (set_attr "mode" "SI")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
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")])
17821 ;; Table 2-4. MIPS DSP ASE Instructions: General Bit/Manipulation
17822 @@ -665,7 +665,7 @@
17826 - [(set_attr "type" "arith")
17827 + [(set_attr "type" "dspalu")
17828 (set_attr "mode" "SI")])
17831 @@ -678,7 +678,7 @@
17835 - [(set_attr "type" "arith")
17836 + [(set_attr "type" "dspalu")
17837 (set_attr "mode" "SI")])
17840 @@ -696,7 +696,7 @@
17842 return "replv.qb\t%0,%1";
17844 - [(set_attr "type" "arith")
17845 + [(set_attr "type" "dspalu")
17846 (set_attr "mode" "SI")])
17848 (define_insn "mips_repl_ph"
17849 @@ -707,7 +707,7 @@
17853 - [(set_attr "type" "arith")
17854 + [(set_attr "type" "dspalu")
17855 (set_attr "mode" "SI")])
17857 ;; Table 2-5. MIPS DSP ASE Instructions: Compare-Pick
17858 @@ -720,7 +720,7 @@
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")])
17866 (define_insn "mips_cmp<DSPV:dspfmt1_1>_lt_<DSPV:dspfmt2>"
17867 @@ -731,7 +731,7 @@
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")])
17875 (define_insn "mips_cmp<DSPV:dspfmt1_1>_le_<DSPV:dspfmt2>"
17876 @@ -742,7 +742,7 @@
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")])
17884 (define_insn "mips_cmpgu_eq_qb"
17885 @@ -752,7 +752,7 @@
17886 UNSPEC_CMPGU_EQ_QB))]
17888 "cmpgu.eq.qb\t%0,%1,%2"
17889 - [(set_attr "type" "arith")
17890 + [(set_attr "type" "dspalu")
17891 (set_attr "mode" "SI")])
17893 (define_insn "mips_cmpgu_lt_qb"
17894 @@ -762,7 +762,7 @@
17895 UNSPEC_CMPGU_LT_QB))]
17897 "cmpgu.lt.qb\t%0,%1,%2"
17898 - [(set_attr "type" "arith")
17899 + [(set_attr "type" "dspalu")
17900 (set_attr "mode" "SI")])
17902 (define_insn "mips_cmpgu_le_qb"
17903 @@ -772,7 +772,7 @@
17904 UNSPEC_CMPGU_LE_QB))]
17906 "cmpgu.le.qb\t%0,%1,%2"
17907 - [(set_attr "type" "arith")
17908 + [(set_attr "type" "dspalu")
17909 (set_attr "mode" "SI")])
17912 @@ -784,7 +784,7 @@
17915 "pick.<DSPV:dspfmt2>\t%0,%1,%2"
17916 - [(set_attr "type" "arith")
17917 + [(set_attr "type" "dspalu")
17918 (set_attr "mode" "SI")])
17921 @@ -795,7 +795,7 @@
17922 UNSPEC_PACKRL_PH))]
17924 "packrl.ph\t%0,%1,%2"
17925 - [(set_attr "type" "arith")
17926 + [(set_attr "type" "dspalu")
17927 (set_attr "mode" "SI")])
17929 ;; Table 2-6. MIPS DSP ASE Instructions: Accumulator and DSPControl Access
17930 @@ -818,7 +818,7 @@
17932 return "extrv.w\t%0,%q1,%2";
17934 - [(set_attr "type" "mfhilo")
17935 + [(set_attr "type" "accext")
17936 (set_attr "mode" "SI")])
17938 (define_insn "mips_extr_r_w"
17939 @@ -839,7 +839,7 @@
17941 return "extrv_r.w\t%0,%q1,%2";
17943 - [(set_attr "type" "mfhilo")
17944 + [(set_attr "type" "accext")
17945 (set_attr "mode" "SI")])
17947 (define_insn "mips_extr_rs_w"
17948 @@ -860,7 +860,7 @@
17950 return "extrv_rs.w\t%0,%q1,%2";
17952 - [(set_attr "type" "mfhilo")
17953 + [(set_attr "type" "accext")
17954 (set_attr "mode" "SI")])
17957 @@ -882,7 +882,7 @@
17959 return "extrv_s.h\t%0,%q1,%2";
17961 - [(set_attr "type" "mfhilo")
17962 + [(set_attr "type" "accext")
17963 (set_attr "mode" "SI")])
17966 @@ -905,7 +905,7 @@
17968 return "extpv\t%0,%q1,%2";
17970 - [(set_attr "type" "mfhilo")
17971 + [(set_attr "type" "accext")
17972 (set_attr "mode" "SI")])
17974 (define_insn "mips_extpdp"
17975 @@ -930,7 +930,7 @@
17977 return "extpdpv\t%0,%q1,%2";
17979 - [(set_attr "type" "mfhilo")
17980 + [(set_attr "type" "accext")
17981 (set_attr "mode" "SI")])
17984 @@ -949,7 +949,7 @@
17986 return "shilov\t%q0,%2";
17988 - [(set_attr "type" "mfhilo")
17989 + [(set_attr "type" "accmod")
17990 (set_attr "mode" "SI")])
17993 @@ -965,7 +965,7 @@
17994 (reg:CCDSP CCDSP_PO_REGNUM)] UNSPEC_MTHLIP))])]
17995 "ISA_HAS_DSP && !TARGET_64BIT"
17997 - [(set_attr "type" "mfhilo")
17998 + [(set_attr "type" "accmod")
17999 (set_attr "mode" "SI")])
18002 @@ -987,7 +987,7 @@
18003 (unspec:CCDSP [(match_dup 0) (match_dup 1)] UNSPEC_WRDSP))])]
18006 - [(set_attr "type" "arith")
18007 + [(set_attr "type" "dspalu")
18008 (set_attr "mode" "SI")])
18011 @@ -1003,7 +1003,7 @@
18015 - [(set_attr "type" "arith")
18016 + [(set_attr "type" "dspalu")
18017 (set_attr "mode" "SI")])
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
18024 (unspec:CCDSP [(match_dup 1)] UNSPEC_ABSQ_S_QB))])]
18026 "absq_s.qb\t%0,%z1"
18027 - [(set_attr "type" "arith")
18028 + [(set_attr "type" "dspalusat")
18029 (set_attr "mode" "SI")])
18031 (define_insn "mips_addu_ph"
18033 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDU_PH))])]
18035 "addu.ph\t%0,%z1,%z2"
18036 - [(set_attr "type" "arith")
18037 + [(set_attr "type" "dspalu")
18038 (set_attr "mode" "SI")])
18040 (define_insn "mips_addu_s_ph"
18042 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_ADDU_S_PH))])]
18044 "addu_s.ph\t%0,%z1,%z2"
18045 - [(set_attr "type" "arith")
18046 + [(set_attr "type" "dspalusat")
18047 (set_attr "mode" "SI")])
18049 (define_insn "mips_adduh_qb"
18053 "adduh.qb\t%0,%z1,%z2"
18054 - [(set_attr "type" "arith")
18055 + [(set_attr "type" "dspalu")
18056 (set_attr "mode" "SI")])
18058 (define_insn "mips_adduh_r_qb"
18060 UNSPEC_ADDUH_R_QB))]
18062 "adduh_r.qb\t%0,%z1,%z2"
18063 - [(set_attr "type" "arith")
18064 + [(set_attr "type" "dspalusat")
18065 (set_attr "mode" "SI")])
18067 (define_insn "mips_append"
18069 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
18070 return "append\t%0,%z2,%3";
18072 - [(set_attr "type" "arith")
18073 + [(set_attr "type" "dspalu")
18074 (set_attr "mode" "SI")])
18076 (define_insn "mips_balign"
18078 operands[2] = GEN_INT (INTVAL (operands[2]) & 3);
18079 return "balign\t%0,%z2,%3";
18081 - [(set_attr "type" "arith")
18082 + [(set_attr "type" "dspalu")
18083 (set_attr "mode" "SI")])
18085 (define_insn "mips_cmpgdu_eq_qb"
18087 UNSPEC_CMPGDU_EQ_QB))])]
18089 "cmpgdu.eq.qb\t%0,%z1,%z2"
18090 - [(set_attr "type" "arith")
18091 + [(set_attr "type" "dspalu")
18092 (set_attr "mode" "SI")])
18094 (define_insn "mips_cmpgdu_lt_qb"
18095 @@ -114,7 +114,7 @@
18096 UNSPEC_CMPGDU_LT_QB))])]
18098 "cmpgdu.lt.qb\t%0,%z1,%z2"
18099 - [(set_attr "type" "arith")
18100 + [(set_attr "type" "dspalu")
18101 (set_attr "mode" "SI")])
18103 (define_insn "mips_cmpgdu_le_qb"
18104 @@ -129,7 +129,7 @@
18105 UNSPEC_CMPGDU_LE_QB))])]
18107 "cmpgdu.le.qb\t%0,%z1,%z2"
18108 - [(set_attr "type" "arith")
18109 + [(set_attr "type" "dspalu")
18110 (set_attr "mode" "SI")])
18112 (define_insn "mips_dpa_w_ph"
18113 @@ -140,7 +140,7 @@
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")])
18121 (define_insn "mips_dps_w_ph"
18122 @@ -151,7 +151,7 @@
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")])
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")])
18139 (define_insn "mips_mult"
18140 @@ -277,7 +277,7 @@
18141 UNSPEC_PRECR_QB_PH))]
18143 "precr.qb.ph\t%0,%z1,%z2"
18144 - [(set_attr "type" "arith")
18145 + [(set_attr "type" "dspalu")
18146 (set_attr "mode" "SI")])
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";
18153 - [(set_attr "type" "arith")
18154 + [(set_attr "type" "dspalu")
18155 (set_attr "mode" "SI")])
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";
18162 - [(set_attr "type" "arith")
18163 + [(set_attr "type" "dspalu")
18164 (set_attr "mode" "SI")])
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";
18171 - [(set_attr "type" "arith")
18172 + [(set_attr "type" "dspalu")
18173 (set_attr "mode" "SI")])
18175 (define_insn "mips_shra_qb"
18176 @@ -340,7 +340,7 @@
18178 return "shrav.qb\t%0,%z1,%2";
18180 - [(set_attr "type" "shift")
18181 + [(set_attr "type" "dspalu")
18182 (set_attr "mode" "SI")])
18185 @@ -359,7 +359,7 @@
18187 return "shrav_r.qb\t%0,%z1,%2";
18189 - [(set_attr "type" "shift")
18190 + [(set_attr "type" "dspalu")
18191 (set_attr "mode" "SI")])
18193 (define_insn "mips_shrl_ph"
18194 @@ -377,7 +377,7 @@
18196 return "shrlv.ph\t%0,%z1,%2";
18198 - [(set_attr "type" "shift")
18199 + [(set_attr "type" "dspalu")
18200 (set_attr "mode" "SI")])
18202 (define_insn "mips_subu_ph"
18203 @@ -390,7 +390,7 @@
18204 (unspec:CCDSP [(match_dup 1) (match_dup 2)] UNSPEC_SUBU_PH))])]
18206 "subu.ph\t%0,%z1,%z2"
18207 - [(set_attr "type" "arith")
18208 + [(set_attr "type" "dspalu")
18209 (set_attr "mode" "SI")])
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))])]
18215 "subu_s.ph\t%0,%z1,%z2"
18216 - [(set_attr "type" "arith")
18217 + [(set_attr "type" "dspalusat")
18218 (set_attr "mode" "SI")])
18220 (define_insn "mips_subuh_qb"
18221 @@ -413,7 +413,7 @@
18224 "subuh.qb\t%0,%z1,%z2"
18225 - [(set_attr "type" "arith")
18226 + [(set_attr "type" "dspalu")
18227 (set_attr "mode" "SI")])
18229 (define_insn "mips_subuh_r_qb"
18230 @@ -423,7 +423,7 @@
18231 UNSPEC_SUBUH_R_QB))]
18233 "subuh_r.qb\t%0,%z1,%z2"
18234 - [(set_attr "type" "arith")
18235 + [(set_attr "type" "dspalu")
18236 (set_attr "mode" "SI")])
18238 (define_insn "mips_addqh_ph"
18239 @@ -433,7 +433,7 @@
18242 "addqh.ph\t%0,%z1,%z2"
18243 - [(set_attr "type" "arith")
18244 + [(set_attr "type" "dspalu")
18245 (set_attr "mode" "SI")])
18247 (define_insn "mips_addqh_r_ph"
18248 @@ -443,7 +443,7 @@
18249 UNSPEC_ADDQH_R_PH))]
18251 "addqh_r.ph\t%0,%z1,%z2"
18252 - [(set_attr "type" "arith")
18253 + [(set_attr "type" "dspalu")
18254 (set_attr "mode" "SI")])
18256 (define_insn "mips_addqh_w"
18257 @@ -453,7 +453,7 @@
18260 "addqh.w\t%0,%z1,%z2"
18261 - [(set_attr "type" "arith")
18262 + [(set_attr "type" "dspalu")
18263 (set_attr "mode" "SI")])
18265 (define_insn "mips_addqh_r_w"
18266 @@ -463,7 +463,7 @@
18267 UNSPEC_ADDQH_R_W))]
18269 "addqh_r.w\t%0,%z1,%z2"
18270 - [(set_attr "type" "arith")
18271 + [(set_attr "type" "dspalu")
18272 (set_attr "mode" "SI")])
18274 (define_insn "mips_subqh_ph"
18275 @@ -473,7 +473,7 @@
18278 "subqh.ph\t%0,%z1,%z2"
18279 - [(set_attr "type" "arith")
18280 + [(set_attr "type" "dspalu")
18281 (set_attr "mode" "SI")])
18283 (define_insn "mips_subqh_r_ph"
18284 @@ -483,7 +483,7 @@
18285 UNSPEC_SUBQH_R_PH))]
18287 "subqh_r.ph\t%0,%z1,%z2"
18288 - [(set_attr "type" "arith")
18289 + [(set_attr "type" "dspalu")
18290 (set_attr "mode" "SI")])
18292 (define_insn "mips_subqh_w"
18293 @@ -493,7 +493,7 @@
18296 "subqh.w\t%0,%z1,%z2"
18297 - [(set_attr "type" "arith")
18298 + [(set_attr "type" "dspalu")
18299 (set_attr "mode" "SI")])
18301 (define_insn "mips_subqh_r_w"
18302 @@ -503,7 +503,7 @@
18303 UNSPEC_SUBQH_R_W))]
18305 "subqh_r.w\t%0,%z1,%z2"
18306 - [(set_attr "type" "arith")
18307 + [(set_attr "type" "dspalu")
18308 (set_attr "mode" "SI")])
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")])
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")])
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")])
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")])
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")])
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")])
18364 +;; Convert mtlo $ac[1-3],$0 => mult $ac[1-3],$0,$0
18365 +;; mthi $ac[1-3],$0
18367 + [(set (match_operand:SI 0 "register_operand" "")
18369 + (set (match_operand:SI 1 "register_operand" "")
18372 + && !TARGET_MIPS16
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))])]
18390 +(define_insn "*mips_acc_init"
18391 + [(parallel [(set (match_operand:SI 0 "register_operand" "=a")
18393 + (set (match_operand:SI 1 "register_operand" "=a")
18394 + (const_int 0))])]
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
18408 +/* SDE specific stuff. */
18409 +#define TARGET_MIPS_SDE 0
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 "}}"
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}"
18435 /* A spec condition that matches 32-bit options. It only works if
18436 @@ -731,8 +736,9 @@
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
18448 @@ -740,7 +746,11 @@
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 @@
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}}"
18467 #define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS
18469 @@ -1038,6 +1048,11 @@
18470 /* ISA includes the bbit* instructions. */
18471 #define ISA_HAS_BBIT (TARGET_OCTEON && !TARGET_MIPS16)
18473 +/* ISA has single-instruction unaligned load/store support. */
18474 +#define ISA_HAS_UL_US (TARGET_OCTEON \
18475 + && TARGET_OCTEON_UNALIGNED \
18476 + && !TARGET_MIPS16)
18478 /* ISA includes the cins instruction. */
18479 #define ISA_HAS_CINS (TARGET_OCTEON && !TARGET_MIPS16)
18481 @@ -1055,6 +1070,7 @@
18483 /* The CACHE instruction is available. */
18484 #define ISA_HAS_CACHE (TARGET_CACHE_BUILTIN && !TARGET_MIPS16)
18487 /* Add -G xx support. */
18489 @@ -1152,6 +1168,7 @@
18490 %{mshared} %{mno-shared} \
18491 %{msym32} %{mno-sym32} \
18493 +%{mocteon-useun} %{mno-octeon-useun} \
18494 %(subtarget_asm_spec)"
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))
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)
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)
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)
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. */
18541 +/* Exception Level is at bit 1 of the status register. */
18543 +/* Interrupt Enable is at bit 0 of the status register. */
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.
18555 + If we're generating interrupt handlers, we use K0 as a temporary register
18556 + in prologue/epilogue code. */
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 \
18566 + : GP_REG_FIRST + (TARGET_MIPS16 ? 6 : 8))
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)
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.
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)
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
18590 (UNSPEC_SET_GOT_VERSION 46)
18591 (UNSPEC_UPDATE_GOT_VERSION 47)
18594 + (UNSPEC_DERET 50)
18597 + (UNSPEC_RDPGPR 53)
18600 + (UNSPEC_UNALIGNED_LOAD 60)
18601 + (UNSPEC_UNALIGNED_STORE 61)
18603 (UNSPEC_ADDRESS_FIRST 100)
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")
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])"
18634 + && !ISA_HAS_UL_US
18635 + && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
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])"
18645 + && !ISA_HAS_UL_US
18646 + && mips_mem_fits_mode_p (<MODE>mode, operands[1])"
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])"
18656 + && !ISA_HAS_UL_US
18657 + && mips_mem_fits_mode_p (<MODE>mode, operands[0])"
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>")])
18665 +;; Unaligned load and store patterns.
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])"
18674 + [(set_attr "type" "load")
18675 + (set_attr "mode" "<MODE>")])
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>")])
18687 ;; An instruction to calculate the high part of a 64-bit SYMBOL_ABSOLUTE.
18688 ;; The required value is:
18690 @@ -5472,6 +5515,26 @@
18691 return "%*b\t%l0%/";
18694 + if (final_sequence && (mips_abi == ABI_32 || mips_abi == ABI_O64))
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))
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)
18708 + ops[0] = SET_DEST (pat);
18709 + ops[1] = SET_SRC (pat);
18710 + output_asm_insn (mips_output_move (ops[0], ops[1]), ops);
18714 output_asm_insn (mips_output_load_label (), operands);
18715 return "%*jr\t%@%/%]";
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)))])
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")))
18728 + (const_int 16))))])
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")])
18736 +;; Exception return.
18737 +(define_insn "mips_eret"
18739 + (unspec_volatile [(const_int 0)] UNSPEC_ERET)]
18742 + [(set_attr "type" "trap")
18743 + (set_attr "mode" "none")])
18745 +;; Debug exception return.
18746 +(define_insn "mips_deret"
18748 + (unspec_volatile [(const_int 0)] UNSPEC_DERET)]
18751 + [(set_attr "type" "trap")
18752 + (set_attr "mode" "none")])
18754 +;; Disable interrupts.
18755 +(define_insn "mips_di"
18756 + [(unspec_volatile [(const_int 0)] UNSPEC_DI)]
18759 + [(set_attr "type" "trap")
18760 + (set_attr "mode" "none")])
18762 +;; Execution hazard barrier.
18763 +(define_insn "mips_ehb"
18764 + [(unspec_volatile [(const_int 0)] UNSPEC_EHB)]
18767 + [(set_attr "type" "trap")
18768 + (set_attr "mode" "none")])
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")]
18777 + [(set_attr "type" "move")
18778 + (set_attr "mode" "SI")])
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")]
18786 +{ return mips_output_move (operands[0], operands[1]); }
18787 + [(set_attr "type" "mtc,mfc")
18788 + (set_attr "mode" "SI")])
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
18801 +Target Report RejectNegative Mask(MIPS16) MaskExists
18802 +Deprecated; alias for -mips16
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
18812 +Target Report Mask(OCTEON_UNALIGNED)
18813 +Use Octeon-specific unaligned loads/stores for 32/64-bit data
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,
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);
18837 extern void irix_asm_output_align (FILE *, unsigned);
18838 extern const char *current_section_name (void);
18839 @@ -332,4 +336,6 @@
18841 extern void mips_expand_vector_init (rtx, rtx);
18843 +extern bool mips_epilogue_uses (unsigned int);
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
18850 +/* MontaVista GNU/Linux Configuration.
18851 + Copyright (C) 2009
18852 + Free Software Foundation, Inc.
18854 +This file is part of GCC.
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.
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.
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/>. */
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}"
18877 +/* We do not need to provide an explicit big-endian multilib. */
18878 +#undef MULTILIB_DEFAULTS
18879 +#define MULTILIB_DEFAULTS \
18880 + { "meb", "mabi=32" }
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 ; \
18887 + msoft-float:/soft-float}"
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
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
18908 +/* Macros for mips*-octeon-elf target.
18909 + Copyright (C) 2004, 2005, 2006 Cavium Networks.
18911 +This file is part of GCC.
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.
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.
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. */
18928 +/* Add MASK_SOFT_FLOAT and MASK_OCTEON_UNALIGNED. */
18930 +#undef TARGET_DEFAULT
18931 +#define TARGET_DEFAULT (MASK_SOFT_FLOAT_ABI | MASK_OCTEON_UNALIGNED)
18933 +/* Forward -m*octeon-useun. */
18935 +#undef SUBTARGET_ASM_SPEC
18936 +#define SUBTARGET_ASM_SPEC "%{mno-octeon-useun} %{!mno-octeon-useun:-mocteon-useun}"
18938 +/* Enable backtrace including on machine exceptions by default. */
18940 +#undef SUBTARGET_CC1_SPEC
18941 +#define SUBTARGET_CC1_SPEC "%{!fno-asynchronous-unwind-tables:-fasynchronous-unwind-tables}"
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. */
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)
18956 +/* Link to libc library. */
18959 +#define LIB_SPEC "-lc"
18961 +/* Link to startup file. */
18963 +#undef STARTFILE_SPEC
18964 +#define STARTFILE_SPEC "crti%O%s crtbegin%O%s crt0%O%s"
18966 +/* Default our test-only n64 configuration to -G0 since that is what
18967 + the kernel uses. */
18969 +#undef SUBTARGET_SELF_SPECS
18970 +#define SUBTARGET_SELF_SPECS \
18971 +"%{mabi=64:%{!G*: -G0}}"
18973 +/* Pass linker emulation mode for N32. */
18976 +#define LINK_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}"
18983 +/* Override because of N32. */
18985 +#undef LOCAL_LABEL_PREFIX
18986 +#define LOCAL_LABEL_PREFIX ((mips_abi == ABI_N32) ? "." : "$")
18988 +/* Append the core number to the GCOV filename FN. */
18990 +#define GCOV_TARGET_SUFFIX_LENGTH 2
18991 +#define ADD_GCOV_TARGET_SUFFIX(FN) \
18998 + asm ("rdhwr %0, $0" : "=r"(core)); \
18999 + sprintf (s, "%d", core); \
19000 + strcat (fn, s); \
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
19010 +/* Stack unwinding support through the first exception frame.
19011 + Copyright (C) 2007 Cavium Networks.
19013 +This file is part of GCC.
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.
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.
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. */
19030 +#define MD_FALLBACK_FRAME_STATE_FOR octeon_elf_fallback_frame_state
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. */
19037 +static _Unwind_Reason_Code
19038 +octeon_elf_fallback_frame_state (struct _Unwind_Context *context,
19039 + _Unwind_FrameState *fs)
19042 + unsigned *pc = context->ra;
19044 + /* Look for "jalr k0". */
19045 + if (pc[-2] != 0x0340f809)
19046 + return _URC_END_OF_STACK;
19048 + for (i = 0; i < 32; i++)
19050 + fs->regs.reg[i].how = REG_SAVED_OFFSET;
19051 + fs->regs.reg[i].loc.offset = 8 * i;
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;
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;
19065 + return _URC_NO_REASON;
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
19071 +/* Macros for mips*-octeon-* target.
19072 + Copyright (C) 2004, 2005, 2006 Cavium Networks.
19074 +This file is part of GCC.
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.
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.
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. */
19091 +#define CVMX_SHARED_BSS_FLAGS (SECTION_WRITE | SECTION_BSS)
19093 +#undef TARGET_ASM_SELECT_SECTION
19094 +#define TARGET_ASM_SELECT_SECTION octeon_select_section
19096 +#undef TARGET_ASM_UNIQUE_SECTION
19097 +#define TARGET_ASM_UNIQUE_SECTION octeon_unique_section
19099 +/* Implement ASM_OUTPUT_ALIGNED_DECL_LOCAL. This differs from the
19100 + generic version only in the use of cvmx_shared attribute. */
19102 +#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
19103 +#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
19106 + if ((DECL) && TREE_CODE ((DECL)) == VAR_DECL \
19107 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES (DECL))) \
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)); \
19116 + ASM_OUTPUT_ALIGNED_LOCAL (STREAM, NAME, SIZE, ALIGN); \
19121 +/* Implement ASM_OUTPUT_ALIGNED_DECL_COMMON. This differs from the mips
19122 + version only in the use of cvmx_shared attribute. */
19124 +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
19125 +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
19127 + if (TREE_CODE ((DECL)) == VAR_DECL \
19128 + && lookup_attribute ("cvmx_shared", DECL_ATTRIBUTES ((DECL)))) \
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)); \
19136 + mips_output_aligned_decl_common ((STREAM), (DECL), (NAME), (SIZE), \
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 @@
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"))
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;
19160 (define_predicate "consttable_operand"
19161 (match_test "CONSTANT_P (op)"))
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
19167 along with GCC; see the file COPYING3. If not see
19168 <http://www.gnu.org/licenses/>. */
19170 +#undef TARGET_MIPS_SDE
19171 +#define TARGET_MIPS_SDE 1
19173 #undef DRIVER_SELF_SPECS
19174 #define DRIVER_SELF_SPECS \
19175 /* Make sure a -mips option is present. This helps us to pick \
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)
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
19190 along with GCC; see the file COPYING3. If not see
19191 <http://www.gnu.org/licenses/>. */
19193 +#define TARGET_MIPS_SDEMTK 1
19195 #define TARGET_OS_CPP_BUILTINS() \
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)
19203 +/* From mips.h, with mno-float option added. */
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
19216 +EXTRA_MULTILIB_PARTS += crtfastmath.o
19218 +EXTRA_PARTS += crtfastmath.o
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
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
19228 +# MontaVista ELF Configuration.
19229 +# Copyright (C) 2009
19230 +# Free Software Foundation, Inc.
19232 +# This file is part of GCC.
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.
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.
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/>.
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
19254 +# MontaVista GNU/Linux Configuration.
19255 +# Copyright (C) 2009
19256 +# Free Software Foundation, Inc.
19258 +# This file is part of GCC.
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.
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.
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/>.
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
19281 +# These files must be built for each multilib.
19282 +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
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
19301 +# Don't let CTOR_LIST end up in sdata section.
19303 +CRTSTUFF_T_CFLAGS = -G 0 -fno-asynchronous-unwind-tables
19305 +# Assemble startup files.
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
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
19315 +# N32 uses TFmode for long double.
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
19329 +# We must build libgcc2.a with -G 0, in case the user wants to link
19330 +# without the $gp register.
19332 +TARGET_LIBGCC2_CFLAGS = -G 0
19334 +# Build both ABIs.
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
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
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
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
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
19372 +# SourceryG++ overrides for SDE builds
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
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
19391 +# Wind River GNU/Linux Configuration.
19392 +# Copyright (C) 2006, 2007
19393 +# Free Software Foundation, Inc.
19395 +# This file is part of GCC.
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.
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.
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/>.
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
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
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
19450 +/* Wind River GNU/Linux Configuration.
19451 + Copyright (C) 2006, 2007
19452 + Free Software Foundation, Inc.
19454 +This file is part of GCC.
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.
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.
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/>. */
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}"
19478 +/* We do not need to provide an explicit big-endian multilib. */
19479 +#undef MULTILIB_DEFAULTS
19480 +#define MULTILIB_DEFAULTS \
19481 + { "meb", "mabi=32" }
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}"
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 ; \
19494 + mel:%{mhard-float:/mel/hard-float ; \
19496 + march=octeon:/octeon ; \
19497 + march=vr5500:%{mhard-float:/hard-float/vr5500} ; \
19498 + mhard-float:/hard-float}"
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
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
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.
19523 ;; xlr.md Machine Description for the RMI XLR Microprocessor
19524 ;; This file is part of GCC.
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"))
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
19539 +# Script to generate SYSROOT_SUFFIX_SPEC equivalent to MULTILIB_OSDIRNAMES
19540 +# Arguments are MULTILIB_OSDIRNAMES, MULTILIB_OPTIONS, MULTILIB_MATCHES
19541 +# and MULTILIB_ALIASES.
19543 +# Copyright (C) 2009 Free Software Foundation, Inc.
19545 +# This file is part of GCC.
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
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.
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/>.
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.
19566 +# print-sysroot-suffix.sh \
19567 +# MULTILIB_OSDIRNAMES \
19568 +# MULTILIB_OPTIONS \
19569 +# MULTILIB_MATCHES \
19570 +# > t-sysroot-suffix.h
19572 +# The three options exactly correspond to the variables of the same
19573 +# names defined in the tmake_file fragments.
19576 +# sh ./gcc/config/print-sysroot-suffix.sh "a=A" "a b/c/d" ""
19578 +# #undef SYSROOT_SUFFIX_SPEC
19579 +# #define SYSROOT_SUFFIX_SPEC "" \
19587 +# The script uses temporary subscripts in order to permit a recursive
19588 +# algorithm without the use of functions.
19597 +cat > print-sysroot-suffix3.sh <<\EOF
19599 +# Print all the multilib matches for this option
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
19607 +echo 'echo $result' >> print-sysroot-suffix3.sh
19608 +chmod +x print-sysroot-suffix3.sh
19610 +cat > print-sysroot-suffix2.sh <<\EOF
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.
19621 +if [ $# = 0 ]; then
19622 + case $optstring in
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
19629 +echo " esac" >> print-sysroot-suffix2.sh
19632 +for x in $dirnames; do
19633 + p=`echo $x | sed -e 's,=!,/$=/,'`
19634 + pat="$pat -e 's=^//$p='"
19636 +echo ' optstring=`echo "/$optstring" | sed '"$pat\`" >> print-sysroot-suffix2.sh
19637 +cat >> print-sysroot-suffix2.sh <<\EOF
19638 + case $optstring in
19642 + echo "$optstring"
19651 + for x in `echo "$thisopt" | sed -e 's,/, ,g'`; do
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
19658 +cat >> print-sysroot-suffix2.sh <<\EOF
19660 + bit=`"$0" "$padding " "$optstring$x/" "$@"`
19661 + if [ -z "$lastopt" ]; then
19662 + lastopt="$optmatch"
19664 + if [ "$lastbit" = "$bit" ]; then
19665 + lastopt="$lastopt|$optmatch"
19667 + result="$result$lastopt:$lastbit;$n"
19668 + lastopt="$optmatch"
19673 + bit=`"$0" "$padding " "$optstring" "$@"`
19674 + if [ "$bit" = "$lastbit" ]; then
19675 + if [ -z "$result" ]; then
19678 + echo "$n%{$result:$bit}"
19681 + echo "$n%{$result$lastopt:$lastbit;$n:$bit}"
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
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.
19701 + This file is part of GCC.
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.
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.
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/>. */
19717 +/* Add -meabi to target flags. */
19718 +#undef TARGET_DEFAULT
19719 +#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
19721 +#undef TARGET_VERSION
19722 +#define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded)");
19724 +#undef TARGET_OS_CPP_BUILTINS
19725 +#define TARGET_OS_CPP_BUILTINS() \
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 (); \
19737 +#undef CC1_EXTRA_SPEC
19738 +#define CC1_EXTRA_SPEC "-maix-struct-return"
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 */
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 @@
19757 FUNC_END(__eabi_uconvert)
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
19765 /* Head of __init function used for static constructors. */
19766 .section ".init","ax"
19772 @@ -106,6 +107,7 @@
19773 /* Head of __fini function used for static destructors. */
19774 .section ".fini","ax"
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
19784 #undef TARGET_DEFAULT
19785 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
19787 -/* Invoke an initializer function to set up the GOT. */
19788 -#define NAME__MAIN "__eabi"
19789 -#define INVOKE__main
19791 #undef TARGET_VERSION
19792 #define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded)");
19795 TARGET_OS_SYSV_CPP_BUILTINS (); \
19799 +/* Add -te500v1 and -te500v2 options for convenience in generating
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}"
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
19823 +/* Add -te500v1 and -te500v2 options for convenience in generating
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}"
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}}"
19840 +/* The various C libraries each have their own subdirectory. */
19841 +#undef SYSROOT_SUFFIX_SPEC
19842 +#define SYSROOT_SUFFIX_SPEC \
19843 + "%{msoft-float:/nof ; \
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
19852 +/* MontaVista GNU/Linux Configuration.
19853 + Copyright (C) 2009
19854 + Free Software Foundation, Inc.
19856 +This file is part of GCC.
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.
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.
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/>. */
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}"
19879 +#undef ASM_DEFAULT_SPEC
19880 +#define ASM_DEFAULT_SPEC \
19881 + "%{te500v2:-mppc -mspe -me500 ; \
19882 + te600:-mppc -maltivec ; \
19883 + te500mc:-me500mc ; \
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 ; \
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
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.
19902 + This file is part of GCC.
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.
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.
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.
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/>. */
19923 +/* This header needs to be included after any other headers affecting
19924 + TARGET_DEFAULT. */
19927 +#define OPT_64 "maix64"
19928 +#define OPT_32 "maix32"
19930 +#define OPT_64 "m64"
19931 +#define OPT_32 "m32"
19934 +#ifndef MASK_64BIT
19935 +#define MASK_64BIT 0
19938 +#if TARGET_DEFAULT & MASK_64BIT
19939 +#define OPT_ARCH64 "!"OPT_32
19940 +#define OPT_ARCH32 OPT_32
19942 +#define OPT_ARCH64 OPT_64
19943 +#define OPT_ARCH32 "!"OPT_64
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
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
19965 (UNSPEC_EXTODD_V2SF 333)
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"
19975 [(set_attr "type" "fp")])
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"
19984 [(set_attr "type" "fp")])
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")))]
19993 [(set_attr "type" "fp")])
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")))]
20002 [(set_attr "type" "fp")])
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")))]
20011 [(set_attr "type" "fp")])
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
20033 +#undef TARGET_COMMUTATIVE_OPERAND_PRECEDENCE
20034 +#define TARGET_COMMUTATIVE_OPERAND_PRECEDENCE \
20035 + rs6000_commutative_operand_precedence
20037 #undef TARGET_DWARF_REGISTER_SPAN
20038 #define TARGET_DWARF_REGISTER_SPAN rs6000_dwarf_register_span
20040 @@ -4682,16 +4687,19 @@
20041 if (TARGET_ALTIVEC)
20042 global_regs[VSCR_REGNO] = 1;
20044 - if (TARGET_ALTIVEC_ABI)
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;
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;
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;
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 },
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 },
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 @@
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 },
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 }
20119 @@ -9370,6 +9378,8 @@
20121 rs6000_init_builtins (void)
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;
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);
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);
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));
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));
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));
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);
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"),
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);
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"),
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);
20241 + tdecl = build_decl (TYPE_DECL, get_identifier ("__vector float"),
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);
20250 if (TARGET_PAIRED_FLOAT)
20251 paired_init_builtins ();
20252 @@ -15843,7 +15868,7 @@
20253 no_global_regs_above (int first, bool gpr)
20256 - for (i = first; i < gpr ? 32 : 64 ; i++)
20257 + for (i = first; i < (gpr ? 32 : 64); i++)
20258 if (global_regs[i])
20261 @@ -15869,11 +15894,11 @@
20262 int regno = gpr ? info->first_gp_reg_save : (info->first_fp_reg_save - 32);
20264 int select = ((savep ? 1 : 0) << 2
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)
20271 + ? (info->spe_64bit_regs_used ? 1 : 0)
20272 + : (gpr ? 1 : 0)) << 1
20275 /* Don't generate bogus routine names. */
20276 @@ -15908,6 +15933,7 @@
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;
20284 @@ -16098,6 +16124,14 @@
20285 savres_gprs_inline = savres_gprs_inline || using_multiple_p;
20288 + /* Code intended for use in shared libraries cannot be reliably linked
20289 + with out-of-line prologues and epilogues. */
20292 + savres_gprs_inline = 1;
20293 + savres_fprs_inline = 1;
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;
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)));
20318 if (WORLD_SAVE_P (info))
20320 @@ -17197,7 +17232,7 @@
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. */
20325 + if (restore_lr && restoring_GPRs_inline)
20327 rtx mem = gen_frame_mem_offset (Pmode, frame_reg_rtx,
20328 info->lr_save_offset + sp_offset);
20329 @@ -17216,7 +17251,7 @@
20332 /* Set LR here to try to overlap restores below. */
20334 + if (restore_lr && restoring_GPRs_inline)
20335 emit_move_insn (gen_rtx_REG (Pmode, LR_REGNO),
20336 gen_rtx_REG (Pmode, 0));
20338 @@ -17396,6 +17431,18 @@
20342 + if (restore_lr && !restoring_GPRs_inline)
20344 + rtx mem = gen_frame_mem_offset (Pmode, frame_reg_rtx,
20345 + info->lr_save_offset + sp_offset);
20347 + emit_move_insn (gen_rtx_REG (Pmode, 0), mem);
20350 + if (restore_lr && !restoring_GPRs_inline)
20351 + emit_move_insn (gen_rtx_REG (Pmode, LR_REGNO),
20352 + gen_rtx_REG (Pmode, 0));
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);
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. */
20370 +rs6000_commutative_operand_precedence (const_rtx op, int value)
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 */;
20385 /* Returns a code for a target-specific builtin that implements
20386 reciprocal of the function, or NULL_TREE if not available. */
20388 @@ -22686,12 +22757,16 @@
20390 rs6000_dwarf_register_span (rtx reg)
20395 + unsigned regno = REGNO (reg);
20396 + enum machine_mode mode = GET_MODE (reg);
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)))
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
20413 - gen_rtx_PARALLEL (VOIDmode,
20416 - gen_rtx_REG (SImode, regno + 1200),
20417 - gen_rtx_REG (SImode, regno))
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++)
20425 + if (BYTES_BIG_ENDIAN)
20427 + parts[2 * i] = gen_rtx_REG (SImode, regno + 1200);
20428 + parts[2 * i + 1] = gen_rtx_REG (SImode, regno);
20432 + parts[2 * i] = gen_rtx_REG (SImode, regno);
20433 + parts[2 * i + 1] = gen_rtx_REG (SImode, regno + 1200);
20437 + return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (words * 2, parts));
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 @@
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
20453 -#define OPTION_DEFAULT_SPECS \
20454 - {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }, \
20455 - {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
20456 - {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }
20458 /* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
20459 struct rs6000_cpu_select
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, \
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, \
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"))])]
20494 + (set (match_operand:P 2 "memory_operand" "=m")
20495 + (match_operand:P 3 "gpc_reg_operand" "r"))])]
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"))])]
20507 + (set (match_operand:DF 2 "memory_operand" "=m")
20508 + (match_operand:DF 3 "gpc_reg_operand" "f"))])]
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"))])]
20520 + (set (match_operand:P 3 "gpc_reg_operand" "=r")
20521 + (match_operand:P 4 "memory_operand" "m"))])]
20524 [(set_attr "type" "branch")
20525 @@ -14823,9 +14823,9 @@
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"))])]
20533 + (set (match_operand:P 3 "gpc_reg_operand" "=r")
20534 + (match_operand:P 4 "memory_operand" "m"))])]
20537 [(set_attr "type" "branch")
20538 @@ -14836,9 +14836,9 @@
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"))])]
20546 + (set (match_operand:DF 3 "gpc_reg_operand" "=f")
20547 + (match_operand:DF 4 "memory_operand" "m"))])]
20550 [(set_attr "type" "branch")
20551 @@ -14889,6 +14889,120 @@
20553 [(set_attr "type" "load")])
20555 +;;; Expanders for vector insn patterns shared between the SPE and TARGET_PAIRED systems.
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"
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)));
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"
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)));
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"
20598 + /* We need to make a note that we clobber SPEFSCR. */
20599 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
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));
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"
20618 + /* We need to make a note that we clobber SPEFSCR. */
20619 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
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));
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"
20638 + /* We need to make a note that we clobber SPEFSCR. */
20639 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
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));
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"
20658 + /* We need to make a note that we clobber SPEFSCR. */
20659 + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (2));
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));
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 @@
20677 ;; SPE SIMD instructions
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")))]
20684 @@ -181,7 +181,7 @@
20685 [(set_attr "type" "vecsimple")
20686 (set_attr "length" "4")])
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")])
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")])
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"))])]
20719 + (set (match_operand:V2SI 2 "memory_operand" "=m")
20720 + (match_operand:V2SI 3 "gpc_reg_operand" "r"))])]
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"))])]
20732 + (set (match_operand:V2SI 2 "gpc_reg_operand" "=r")
20733 + (match_operand:V2SI 3 "memory_operand" "m"))])]
20736 [(set_attr "type" "branch")
20737 @@ -3181,9 +3181,9 @@
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"))])]
20745 + (set (match_operand:V2SI 2 "gpc_reg_operand" "=r")
20746 + (match_operand:V2SI 3 "memory_operand" "m"))])]
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 ""
20757 +#undef CC1_EXTRA_SPEC
20758 +#define CC1_EXTRA_SPEC ""
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)}} \
20768 +%{profile: -p}" CC1_EXTRA_SPEC
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 ""
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
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"
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"
20785 #define LINK_START_SIM_SPEC ""
20787 -#define LINK_OS_SIM_SPEC "-m elf32ppcsim"
20788 +#define LINK_OS_SIM_SPEC ""
20790 #define CPP_OS_SIM_SPEC ""
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
20796 +# Multilibs for powerpc embedded ELF targets.
20798 +MULTILIB_OPTIONS = te500v1/te500v2/te600/te500mc \
20801 +MULTILIB_DIRNAMES = te500v1 te500v2 te600 te500mc \
20804 +MULTILIB_EXCEPTIONS = *te600*/*msoft-float* \
20805 + *te500v1*/*msoft-float* \
20806 + *te500v2*/*msoft-float* \
20807 + *te500mc*/*msoft-float*
20809 +MULTILIB_EXTRA_OPTS = mno-eabi mstrict-align
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
20817 +# Multilibs for powerpc embedded ELF targets.
20819 +MULTILIB_OPTIONS = te500v1/te500v2/te600 \
20822 +MULTILIB_DIRNAMES = te500v1 te500v2 te600 \
20825 +MULTILIB_EXCEPTIONS = *te600*/*msoft-float* \
20826 + *te500v1*/*msoft-float* \
20827 + *te500v2*/*msoft-float*
20829 +MULTILIB_EXTRA_OPTS = mno-eabi mstrict-align
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
20837 +# Multilibs for powerpc-linux-gnu targets.
20839 +MULTILIB_OPTIONS = te500v1/te500v2/te600/te500mc \
20842 +MULTILIB_DIRNAMES = te500v1 te500v2 te600 te500mc \
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
20853 +# MontaVista GNU/Linux Configuration.
20854 +# Copyright (C) 2009
20855 +# Free Software Foundation, Inc.
20857 +# This file is part of GCC.
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.
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.
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/>.
20873 +# Build hard-float, soft-float, E500mc, E500v2 and E600
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
20883 LIB2FUNCS_EXTRA += tramp.S $(srcdir)/config/rs6000/darwin-ldouble.c
20885 # These can't end up in shared libgcc
20886 -LIB2FUNCS_STATIC_EXTRA = eabi.S
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
20908 tramp.S: $(srcdir)/config/rs6000/tramp.asm
20909 cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
20911 ncrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
20912 cat $(srcdir)/config/rs6000/sol-cn.asm >ncrtn.S
20914 +crtsavfpr.S: $(srcdir)/config/rs6000/crtsavfpr.asm
20915 + cat $(srcdir)/config/rs6000/crtsavfpr.asm >crtsavfpr.S
20917 +crtresfpr.S: $(srcdir)/config/rs6000/crtresfpr.asm
20918 + cat $(srcdir)/config/rs6000/crtresfpr.asm >crtresfpr.S
20920 +crtsavgpr.S: $(srcdir)/config/rs6000/crtsavgpr.asm
20921 + cat $(srcdir)/config/rs6000/crtsavgpr.asm >crtsavgpr.S
20923 +crtresgpr.S: $(srcdir)/config/rs6000/crtresgpr.asm
20924 + cat $(srcdir)/config/rs6000/crtresgpr.asm >crtresgpr.S
20926 +crtresxfpr.S: $(srcdir)/config/rs6000/crtresxfpr.asm
20927 + cat $(srcdir)/config/rs6000/crtresxfpr.asm >crtresxfpr.S
20929 +crtresxgpr.S: $(srcdir)/config/rs6000/crtresxgpr.asm
20930 + cat $(srcdir)/config/rs6000/crtresxgpr.asm >crtresxgpr.S
20932 +e500crtres32gpr.S: $(srcdir)/config/rs6000/e500crtres32gpr.asm
20933 + cat $(srcdir)/config/rs6000/e500crtres32gpr.asm >e500crtres32gpr.S
20935 +e500crtres64gpr.S: $(srcdir)/config/rs6000/e500crtres64gpr.asm
20936 + cat $(srcdir)/config/rs6000/e500crtres64gpr.asm >e500crtres64gpr.S
20938 +e500crtres64gprctr.S: $(srcdir)/config/rs6000/e500crtres64gprctr.asm
20939 + cat $(srcdir)/config/rs6000/e500crtres64gprctr.asm >e500crtres64gprctr.S
20941 +e500crtrest32gpr.S: $(srcdir)/config/rs6000/e500crtrest32gpr.asm
20942 + cat $(srcdir)/config/rs6000/e500crtrest32gpr.asm >e500crtrest32gpr.S
20944 +e500crtrest64gpr.S: $(srcdir)/config/rs6000/e500crtrest64gpr.asm
20945 + cat $(srcdir)/config/rs6000/e500crtrest64gpr.asm >e500crtrest64gpr.S
20947 +e500crtresx32gpr.S: $(srcdir)/config/rs6000/e500crtresx32gpr.asm
20948 + cat $(srcdir)/config/rs6000/e500crtresx32gpr.asm >e500crtresx32gpr.S
20950 +e500crtresx64gpr.S: $(srcdir)/config/rs6000/e500crtresx64gpr.asm
20951 + cat $(srcdir)/config/rs6000/e500crtresx64gpr.asm >e500crtresx64gpr.S
20953 +e500crtsav32gpr.S: $(srcdir)/config/rs6000/e500crtsav32gpr.asm
20954 + cat $(srcdir)/config/rs6000/e500crtsav32gpr.asm >e500crtsav32gpr.S
20956 +e500crtsav64gpr.S: $(srcdir)/config/rs6000/e500crtsav64gpr.asm
20957 + cat $(srcdir)/config/rs6000/e500crtsav64gpr.asm >e500crtsav64gpr.S
20959 +e500crtsav64gprctr.S: $(srcdir)/config/rs6000/e500crtsav64gprctr.asm
20960 + cat $(srcdir)/config/rs6000/e500crtsav64gprctr.asm >e500crtsav64gprctr.S
20962 +e500crtsavg32gpr.S: $(srcdir)/config/rs6000/e500crtsavg32gpr.asm
20963 + cat $(srcdir)/config/rs6000/e500crtsavg32gpr.asm >e500crtsavg32gpr.S
20965 +e500crtsavg64gpr.S: $(srcdir)/config/rs6000/e500crtsavg64gpr.asm
20966 + cat $(srcdir)/config/rs6000/e500crtsavg64gpr.asm >e500crtsavg64gpr.S
20968 +e500crtsavg64gprctr.S: $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm
20969 + cat $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm >e500crtsavg64gprctr.S
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)
20978 +$(T)crtsavfpr$(objext): crtsavfpr.S
20979 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavfpr.S -o $(T)crtsavfpr$(objext)
20981 +$(T)crtresfpr$(objext): crtresfpr.S
20982 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresfpr.S -o $(T)crtresfpr$(objext)
20984 +$(T)crtsavgpr$(objext): crtsavgpr.S
20985 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavgpr.S -o $(T)crtsavgpr$(objext)
20987 +$(T)crtresgpr$(objext): crtresgpr.S
20988 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresgpr.S -o $(T)crtresgpr$(objext)
20990 +$(T)crtresxfpr$(objext): crtresxfpr.S
20991 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxfpr.S -o $(T)crtresxfpr$(objext)
20993 +$(T)crtresxgpr$(objext): crtresxgpr.S
20994 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxgpr.S -o $(T)crtresxgpr$(objext)
20996 +$(T)e500crtres32gpr$(objext): e500crtres32gpr.S
20997 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres32gpr.S -o $(T)e500crtres32gpr$(objext)
20999 +$(T)e500crtres64gpr$(objext): e500crtres64gpr.S
21000 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gpr.S -o $(T)e500crtres64gpr$(objext)
21002 +$(T)e500crtres64gprctr$(objext): e500crtres64gprctr.S
21003 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gprctr.S -o $(T)e500crtres64gprctr$(objext)
21005 +$(T)e500crtrest32gpr$(objext): e500crtrest32gpr.S
21006 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest32gpr.S -o $(T)e500crtrest32gpr$(objext)
21008 +$(T)e500crtrest64gpr$(objext): e500crtrest64gpr.S
21009 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest64gpr.S -o $(T)e500crtrest64gpr$(objext)
21011 +$(T)e500crtresx32gpr$(objext): e500crtresx32gpr.S
21012 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx32gpr.S -o $(T)e500crtresx32gpr$(objext)
21014 +$(T)e500crtresx64gpr$(objext): e500crtresx64gpr.S
21015 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx64gpr.S -o $(T)e500crtresx64gpr$(objext)
21017 +$(T)e500crtsav32gpr$(objext): e500crtsav32gpr.S
21018 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav32gpr.S -o $(T)e500crtsav32gpr$(objext)
21020 +$(T)e500crtsav64gpr$(objext): e500crtsav64gpr.S
21021 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gpr.S -o $(T)e500crtsav64gpr$(objext)
21023 +$(T)e500crtsav64gprctr$(objext): e500crtsav64gprctr.S
21024 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gprctr.S -o $(T)e500crtsav64gprctr$(objext)
21026 +$(T)e500crtsavg32gpr$(objext): e500crtsavg32gpr.S
21027 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg32gpr.S -o $(T)e500crtsavg32gpr$(objext)
21029 +$(T)e500crtsavg64gpr$(objext): e500crtsavg64gpr.S
21030 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gpr.S -o $(T)e500crtsavg64gpr$(objext)
21032 +$(T)e500crtsavg64gprctr$(objext): e500crtsavg64gprctr.S
21033 + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gprctr.S -o $(T)e500crtsavg64gprctr$(objext)
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
21042 +# Multilibs for powerpc embedded ELF targets.
21044 +MULTILIB_OPTIONS =
21046 +MULTILIB_DIRNAMES =
21048 +MULTILIB_EXCEPTIONS =
21050 +MULTILIB_EXTRA_OPTS = mno-eabi mstrict-align
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
21058 +# Wind River GNU/Linux Configuration.
21059 +# Copyright (C) 2006, 2007
21060 +# Free Software Foundation, Inc.
21062 +# This file is part of GCC.
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.
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.
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/>.
21078 +# Build hard-float (32-bit and 64-bit), soft-float, E500v1 and E500v2
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
21092 +/* Wind River GNU/Linux Configuration.
21093 + Copyright (C) 2006, 2007
21094 + Free Software Foundation, Inc.
21096 +This file is part of GCC.
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.
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.
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/>. */
21112 +/* Add -te500v1 and -te500v2 options for convenience in generating
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}"
21117 +#undef ASM_DEFAULT_SPEC
21118 +#define ASM_DEFAULT_SPEC \
21119 + "%{te500v1:-mppc -mspe -me500 ; \
21120 + te500v2:-mppc -mspe -me500 ; \
21121 + :-mppc%{m64:64}}"
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}"
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
21140 +/* SH SourceryG++ GNU/Linux Configuration.
21141 + Copyright (C) 2008
21142 + Free Software Foundation, Inc.
21144 +This file is part of GCC.
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.
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.
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/>. */
21160 +#undef SYSROOT_HEADERS_SUFFIX_SPEC
21161 +#define SYSROOT_HEADERS_SUFFIX_SPEC \
21162 + "%{muclibc:/uclibc}"
21164 +#undef SUBTARGET_OVERRIDE_OPTIONS
21165 +#define SUBTARGET_OVERRIDE_OPTIONS \
21167 + /* __thread_support is not supported by uClibc. */ \
21168 + if (linux_uclibc) \
21169 + targetm.have_tls = 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
21175 +; Options for SH SourceryG++ GNU/Linux
21177 +; Copyright (C) 2009 Free Software Foundation, Inc.
21179 +; This file is part of GCC.
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
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.
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/>.
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):
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):
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
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. */
21235 +#ifndef inhibit_libc
21237 #include <signal.h>
21238 #include <sys/ucontext.h>
21239 @@ -248,3 +251,5 @@
21240 return _URC_NO_REASON;
21242 #endif /* defined (__SH5__) */
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; \
21264 + else if (flag_schedule_insns == 2) \
21265 + flag_schedule_insns = 0; \
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
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
21281 -MULTILIB_EXCEPTIONS=
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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))
21423 -MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) $(MULTILIB_CPUS:/=)
21424 +MULTILIB_OPTIONS= $(OTHER_ENDIAN) $(TM_MULTILIB_CONFIG)
21427 # The separate entries for m2a-nofpu and m2a-single-only with
21431 # SH1 only supports big endian.
21432 -MULTILIB_EXCEPTIONS = ml/m1 ml/m2a*
21433 +MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
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
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 @@
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} \
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}}}}"
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. */
21491 #undef TARGET_DEFAULT
21492 +#ifdef BIARCH_32BIT_DEFAULT
21493 +#define TARGET_DEFAULT \
21494 + (MASK_APP_REGS + MASK_FPU)
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)
21502 /* This must be v9a not just v9 because by default we enable
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 @@
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} \
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}}}}"
21523 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
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)
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;
21537 @@ -6183,7 +6183,8 @@
21538 emit_move_insn (slot1, y);
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,
21545 XEXP (slot0, 0), Pmode,
21546 XEXP (slot1, 0), Pmode);
21547 @@ -6191,7 +6192,8 @@
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,
21555 x, TFmode, y, TFmode);
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));
21564 switch (comparison)
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 @@
21571 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LINK_REGISTER_REGNUM)
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)
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
21583 +# multilibs -*- mode:Makefile -*-
21585 +MULTILIB_EXCEPTIONS :=
21586 +MULTILIB_MATCHES :=
21587 +MULTILIB_ALIASES :=
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) \
21593 + N=split ($$0, configs, ","); \
21594 + for (i = 1; i < N; ++i) $1; \
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]))
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
21612 +# Generate SYSROOT_SUFFIX_SPEC from MULTILIB_OSDIRNAMES
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
21623 /* We occasionally need to distinguish between the VxWorks variants. */
21624 #define VXWORKS_KIND_NORMAL 1
21625 #define VXWORKS_KIND_AE 2
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"
21642 + arm-montavista*-linux-gnueabi)
21643 + tm_file="$tm_file arm/montavista-linux.h"
21644 + tmake_file="$tmake_file arm/t-montavista-linux"
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"
21654 + tm_file="$tm_file ./sysroot-suffix.h"
21655 + tmake_file="$tmake_file t-sysroot-suffix"
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"
21670 + tm_file="$tm_file ./sysroot-suffix.h"
21671 + tmake_file="$tmake_file t-sysroot-suffix"
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 @@
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"
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)
21698 if test x$with_cpu_64 = x; then
21699 @@ -1097,13 +1132,29 @@
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
21709 tm_file="${tm_file} i386/linux.h"
21711 + case ${target} in
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"
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"
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)
21738 if test x$with_cpu_64 = x; then
21739 @@ -1211,7 +1262,7 @@
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
21748 @@ -1566,6 +1617,7 @@
21749 tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
21752 + tmake_file="$tmake_file mips/t-crtfm"
21755 test x$with_llsc != x || with_llsc=yes
21756 @@ -1579,8 +1631,28 @@
21759 tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32"
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"
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"
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"
21780 test x$with_llsc != x || with_llsc=yes
21781 + tmake_file="$tmake_file mips/t-crtfm"
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"
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"
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
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
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"
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"
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}"
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"
21844 + powerpc-montavista*-linux-gnu)
21845 + tm_file="$tm_file rs6000/montavista-linux.h"
21846 + tmake_file="$tmake_file rs6000/t-montavista-linux"
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"
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 ;;
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 ;;
21877 case ${with_endian} in
21878 @@ -2118,7 +2243,7 @@
21879 *) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
21881 sh_multilibs=${with_multilib_list}
21882 - if test x${sh_multilibs} = x ; then
21883 + if test "$sh_multilibs" = "default" ; then
21885 sh64-superh-linux* | \
21886 sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
21887 @@ -2134,28 +2259,43 @@
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"
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"
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/^!//'`" ;;
21922 echo "with_multilib_list=${sh_multilib} not supported."
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"
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"
21937 + tm_file="$tm_file ./sysroot-suffix.h"
21938 + tmake_file="$tmake_file t-sysroot-suffix"
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"
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"
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"
21958 +powerpc*-*-* | rs6000-*-*)
21959 + tm_file="${tm_file} rs6000/option-defaults.h"
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)
21969 + | iwmmxt | ep9312 | marvell-f )
21973 echo "Unknown arch used in --with-arch=$with_arch" 1>&2
21974 @@ -2668,7 +2815,10 @@
21976 case "$with_fpu" in
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 )
21986 @@ -2805,7 +2955,7 @@
21990 - "" | amdfam10 | barcelona | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic)
21991 + "" | amdfam10 | barcelona | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | atom | generic)
21995 @@ -2817,7 +2967,7 @@
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"
22002 case ${with_float} in
22004 @@ -2882,12 +3032,20 @@
22007 powerpc*-*-* | rs6000-*-*)
22008 - supported_defaults="cpu float tune"
22009 + supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
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"
22015 default32 | default64)
22020 + echo "$val only valid for --with-cpu and --with-tune." 1>&2
22024 with_which="with_$which"
22027 @@ -3133,6 +3291,22 @@
22033 + tmake_file="${tmake_file} t-eglibc"
22035 + case ${target} in
22037 + # ARM already includes below.
22040 + tmake_file="${tmake_file} t-sysroot-suffix"
22041 + tm_file="${tm_file} ./sysroot-suffix.h"
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
22057 +/* Required license feature */
22058 +#ifndef USED_FOR_TARGET
22059 +#undef CSL_LICENSE_FEATURE
22063 +/* Required license version */
22064 +#ifndef USED_FOR_TARGET
22065 +#undef CSL_LICENSE_VERSION
22069 /* Define to enable the use of a default assembler. */
22070 #ifndef USED_FOR_TARGET
22071 #undef DEFAULT_ASSEMBLER
22072 @@ -108,6 +120,12 @@
22076 +/* Define to warn for use of native system header directories */
22077 +#ifndef USED_FOR_TARGET
22078 +#undef ENABLE_POISON_SYSTEM_DIRECTORIES
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 @@
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
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>
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'
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
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 @@
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" ;;
22159 + CSL_LICENSE_VERSION=""
22162 + if test x"$CSL_LICENSE_VERSION" != x; then
22164 +cat >>confdefs.h <<_ACEOF
22165 +#define CSL_LICENSE_VERSION "$CSL_LICENSE_VERSION"
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= ;;
22185 + licensedir=$with_license
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" ;;
22201 + CSL_LICENSE_FEATURE=""
22204 + if test x"$CSL_LICENSE_FEATURE" != x; then
22206 +cat >>confdefs.h <<_ACEOF
22207 +#define CSL_LICENSE_FEATURE "$CSL_LICENSE_FEATURE"
22213 # Determine the target- and build-specific subdirectories
22215 # post-stage1 host modules use a different CC_FOR_BUILD so, in order to
22216 @@ -8042,6 +8120,28 @@
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
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
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 @@
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"
22255 + with_multilib_list=default
22258 # -------------------------
22259 # Checks for other programs
22260 # -------------------------
22261 @@ -14509,13 +14618,13 @@
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 @@
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
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)
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)
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)
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
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)
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
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"
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"
22361 @@ -22108,6 +22217,22 @@
22363 tls_as_opt='-32 --fatal-warnings'
22367 + .section .tdata,"awT",@progbits
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'
22383 .section ".tdata","awT",@progbits
22384 @@ -22739,6 +22864,44 @@
22385 i[34567]86-*-* | x86_64-*-*)
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
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
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
22407 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
22408 + (exit $ac_status); }; }
22410 + gcc_cv_as_comm_has_align=yes
22412 + echo "configure: failed program was" >&5
22413 + cat conftest.s >&5
22415 + rm -f conftest.o conftest.s
22418 +echo "$as_me:$LINENO: result: $gcc_cv_as_comm_has_align" >&5
22419 +echo "${ECHO_T}$gcc_cv_as_comm_has_align" >&6
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`
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 @@
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"
22438 + enable_poison_system_directories=no
22440 +if test "x${enable_poison_system_directories}" = "xyes"; then
22442 +cat >>confdefs.h <<\_ACEOF
22443 +#define ENABLE_POISON_SYSTEM_DIRECTORIES 1
22448 # Substitute configuration variables
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
22482 # Determine the noncanonical target name, for directory use.
22483 ACX_NONCANONICAL_TARGET
22485 +CSL_AC_LICENSE_VERSION
22487 +CSL_AC_LICENSE_FEATURE
22489 # Determine the target- and build-specific subdirectories
22492 @@ -770,6 +774,22 @@
22493 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
22494 AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
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=]
22502 +AC_SUBST(EGLIBC_CONFIGS)
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=]
22510 +AC_SUBST(CONFIGURE_SPECS)
22512 # Build with intermodule optimisations
22513 AC_ARG_ENABLE(intermodule,
22514 [ --enable-intermodule build the compiler in one step],
22515 @@ -810,6 +830,11 @@
22519 +AC_ARG_WITH(multilib-list,
22520 +[ --with-multilib-list Select multilibs (SH only)],
22522 +with_multilib_list=default)
22524 # -------------------------
22525 # Checks for other programs
22526 # -------------------------
22527 @@ -2576,6 +2601,22 @@
22529 tls_as_opt='-32 --fatal-warnings'
22533 + .section .tdata,"awT",@progbits
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'
22549 .section ".tdata","awT",@progbits
22550 @@ -2944,6 +2985,15 @@
22551 changequote([,])dnl
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)')
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],
22577 + [Define to warn for use of native system header directories])
22580 # Substitute configuration variables
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 @@
22598 Treat the input file as already preprocessed
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
22604 freplace-objc-classes
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
22611 #include "mkdeps.h"
22612 #include "target.h"
22614 +#include "c-tree.h" /* For c_cpp_error. */
22616 #ifndef DOLLARS_IN_IDENTIFIERS
22617 # define DOLLARS_IN_IDENTIFIERS true
22618 @@ -201,6 +202,7 @@
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;
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 @@
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;
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;
22644 cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM: DEPS_USER);
22645 + cpp_opts->deps.need_preprocessor_output = true;
22649 @@ -444,7 +448,6 @@
22653 - cpp_opts->warnings_are_errors = value;
22654 global_dc->warning_as_error_requested = value;
22657 @@ -503,10 +506,6 @@
22658 warn_strict_null_sentinel = value;
22661 - case OPT_Wsystem_headers:
22662 - cpp_opts->warn_system_headers = value;
22665 case OPT_Wtraditional:
22666 cpp_opts->warn_traditional = value;
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. */
22675 cpp_opts->pedantic = 1;
22676 cpp_opts->warn_endif_labels = 1;
22677 @@ -971,10 +968,6 @@
22682 - cpp_opts->inhibit_warnings = 1;
22688 @@ -1159,10 +1152,6 @@
22690 input_location = UNKNOWN_LOCATION;
22692 - /* If an error has occurred in cpplib, note it so we fail
22694 - errorcount += cpp_errors (parse_in);
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 @@
22701 FILE *deps_stream = NULL;
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)
22707 /* If -M or -MM was seen without -MF, default output to the
22709 @@ -1290,7 +1280,7 @@
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);
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)
22724 error ("no matches converting function %qD to type %q#T",
22725 - DECL_NAME (OVL_FUNCTION (overload)),
22726 + DECL_NAME (OVL_CURRENT (overload)),
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));
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));
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,
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;
22760 - TREE_TYPE (rhs) = lhstype;
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
22771 #define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
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
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 @@
22784 enum tree_code code = TREE_CODE (type);
22785 const char *invalid_conv_diag;
22788 if (error_operand_p (e) || type == error_mark_node)
22789 return error_mark_node;
22790 @@ -629,6 +630,10 @@
22794 + e1 = targetm.convert_to_type (type, e);
22798 if (code == VOID_TYPE && (convtype & CONV_STATIC))
22800 e = convert_to_void (e, /*implicit=*/NULL, tf_warning_or_error);
22801 @@ -1231,11 +1236,18 @@
22803 type_promotes_to (tree type)
22805 + tree promoted_type;
22807 if (type == error_mark_node)
22808 return error_mark_node;
22810 type = TYPE_MAIN_VARIANT (type);
22812 + /* Check for promotions of target-defined types first. */
22813 + promoted_type = targetm.promoted_type (type);
22814 + if (promoted_type)
22815 + return promoted_type;
22817 /* bool always promotes to int (not unsigned), even if it's the same
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))))
22827 + /* Functions marked "dllexport" must be emitted so that they are
22828 + visible to other DLLs. */
22829 + if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
22831 /* Otherwise, DECL does not need to be emitted -- yet. A subsequent
22832 reference to DECL might cause it to be emitted later. */
22834 @@ -3802,6 +3806,15 @@
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))
22843 + tree context = decl_function_context (decl);
22844 + if (context != NULL_TREE && context != current_function_decl)
22845 + DECL_NONLOCAL (decl) = 1;
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 @@
22855 cp_apply_type_quals_to_decl (cp_type_quals (TREE_TYPE (decl)), decl);
22857 - layout_decl (decl, 0);
22858 + relayout_decl (decl);
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;
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;
22874 + errmsg = targetm.invalid_return_type (type);
22878 + type = integer_type_node;
22881 /* Error about some types functions can't return. */
22883 @@ -8841,8 +8848,13 @@
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;
22890 + if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
22892 + debug_hooks->set_name (t, decl);
22893 + TYPE_NAME (t) = decl;
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;
22905 if (parm == void_list_node)
22907 @@ -9712,6 +9725,14 @@
22911 + if (type != error_mark_node
22912 + && (errmsg = targetm.invalid_parameter_type (type)))
22915 + type = error_mark_node;
22916 + TREE_TYPE (decl) = error_mark_node;
22919 if (type != error_mark_node)
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 @@
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. */
22934 -cp_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
22935 - const char *msg, va_list *ap)
22937 - diagnostic_info diagnostic;
22938 - diagnostic_t dlevel;
22941 - case CPP_DL_WARNING:
22942 - case CPP_DL_WARNING_SYSHDR:
22943 - dlevel = DK_WARNING;
22945 - case CPP_DL_PEDWARN:
22946 - dlevel = DK_PEDWARN;
22948 - case CPP_DL_ERROR:
22949 - dlevel = DK_ERROR;
22955 - gcc_unreachable ();
22957 - diagnostic_set_info_translated (&diagnostic, msg, ap,
22958 - input_location, dlevel);
22959 - report_diagnostic (&diagnostic);
22962 /* Warn about the use of C++0x features when appropriate. */
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 @@
22970 build_eh_type_type (tree type)
22972 - tree exp = eh_type_info (type);
22973 + bool is_ref = TREE_CODE (type) == REFERENCE_TYPE;
22977 + type = TREE_TYPE (type);
22979 + exp = eh_type_info (type);
22986 - return convert (ptr_type_node, build_address (exp));
22987 + exp = build_address (exp);
22990 + exp = targetm.cxx.ttype_ref_encode (exp);
22992 + exp = convert (ptr_type_node, exp);
22997 @@ -495,6 +507,16 @@
22998 initialize_handler_parm (decl, exp);
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);
23014 @@ -538,10 +560,20 @@
23015 raw_raises && TREE_VALUE (raw_raises);
23016 raw_raises = TREE_CHAIN (raw_raises))
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);
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);
23036 @@ -956,24 +988,40 @@
23038 can_convert_eh (tree to, tree from)
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;
23046 - if (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE)
23048 + to = TREE_TYPE (to);
23049 + from = non_reference (from);
23051 + while (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE)
23053 + unsigned to_quals, from_quals;
23057 to = TREE_TYPE (to);
23058 from = TREE_TYPE (from);
23059 + to_quals = TYPE_QUALS (to);
23060 + from_quals = TYPE_QUALS (from);
23062 - if (! at_least_as_qualified_p (to, from))
23063 + if ((from_quals & ~to_quals)
23064 + || (!outer_const && to_quals & ~from_quals))
23067 - if (TREE_CODE (to) == VOID_TYPE)
23070 - /* Else fall through. */
23072 + if (!(to_quals & TYPE_QUAL_CONST))
23073 + outer_const = false;
23076 - if (CLASS_TYPE_P (to) && CLASS_TYPE_P (from)
23077 + if (same_type_ignoring_top_level_qualifiers_p (from, to))
23080 + if (depth == to_ref + 1 && TREE_CODE (to) == VOID_TYPE)
23083 + if (depth < 2 && CLASS_TYPE_P (to) && CLASS_TYPE_P (from)
23084 && PUBLICLY_UNIQUELY_DERIVED_P (to, from))
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 @@
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;
23098 gcc_assert (lexer->next_token->type != CPP_PURGED);
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 @@
23107 + gcc_assert (TREE_CODE (type) != REFERENCE_TYPE);
23108 name = mangle_typeinfo_for_type (type);
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));
23120 + if (TREE_CODE (type) == REFERENCE_TYPE)
23121 + type = TREE_TYPE (type);
23122 + mark_used (eh_type_info (type));
23126 /* Finish a handler, which may be given by HANDLER. The BLOCKs are
23127 @@ -3243,8 +3247,10 @@
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)))
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 @@
23145 default_conversion (tree exp)
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;
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
23180 + warning (OPT_Wpointer_arith, "NULL used in arithmetic");
23185 @@ -3979,25 +4002,6 @@
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
23205 - warning (OPT_Wpointer_arith, "NULL used in arithmetic");
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 @@
23215 + if (type_unknown_p (rhs))
23217 + error ("no context to resolve type of %qE", rhs);
23218 + return error_mark_node;
23221 return build2 (COMPOUND_EXPR, TREE_TYPE (rhs), lhs, rhs);
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 @@
23231 + input_location = map->start_location;
23232 if (print.first_time)
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);
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)));
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);
23257 +extern bool c_cpp_error (cpp_reader *, int, location_t, unsigned int,
23258 + const char *, va_list *)
23259 + ATTRIBUTE_GCC_CDIAG(5,0);
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 @@
23267 tree type = TREE_TYPE (exp);
23268 enum tree_code code = TREE_CODE (type);
23269 + tree promoted_type;
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;
23277 + promoted_type = targetm.promoted_type (type);
23278 + if (promoted_type)
23279 + return convert (promoted_type, exp);
23281 if (INTEGRAL_TYPE_P (type))
23282 return perform_integral_promotions (exp);
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 */
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 */
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
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 */
23318 +debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED,
23319 + tree t2 ATTRIBUTE_UNUSED)
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 @@
23332 void (* switch_text_section) (void);
23334 + /* Called from grokdeclarator. Replaces the anonymous name with the
23336 + void (* set_name) (tree, tree);
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 @@
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)
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;
23373 @@ -153,6 +154,8 @@
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);
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
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 @@
23395 #define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D)
23397 +/* Override the column number to be used for reporting a
23399 +#define diagnostic_override_column(DI, COL) (DI)->override_column = (COL)
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);
23410 dwarf2out_frame_debug_expr (insn, label);
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 ();
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);
23426 /* The debug hooks structure. */
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 */
23436 @@ -5975,12 +5983,9 @@
23437 (const char *)x2) == 0;
23440 -/* Add a string attribute value to a DIE. */
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)
23447 - dw_attr_node attr;
23448 struct indirect_string_node *node;
23451 @@ -6001,6 +6006,18 @@
23452 node = (struct indirect_string_node *) *slot;
23458 +/* Add a string attribute value to a DIE. */
23460 +static inline void
23461 +add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
23463 + dw_attr_node attr;
23464 + struct indirect_string_node *node;
23466 + node = find_AT_string (str);
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)
23474 + if (!decl_loc_table)
23476 return (var_loc_list *)
23477 htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
23479 @@ -13471,6 +13490,7 @@
23482 int was_abstract = DECL_ABSTRACT (decl);
23483 + htab_t old_decl_loc_table;
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. */
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;
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);
23503 current_function_decl = save_fn;
23504 + decl_loc_table = old_decl_loc_table;
23508 @@ -15796,6 +15823,31 @@
23509 return fd->emitted_number;
23512 +/* Replace DW_AT_name for the decl with name. */
23515 +dwarf2out_set_name (tree decl, tree name)
23518 + dw_attr_ref attr;
23520 + die = TYPE_SYMTAB_DIE (decl);
23524 + attr = get_AT (die, DW_AT_name);
23527 + struct indirect_string_node *node;
23529 + node = find_AT_string (dwarf2_name (name, 0));
23530 + /* replace the string. */
23531 + attr->dw_attr_val.v.val_str = node;
23535 + add_name_attribute (die, dwarf2_name (name, 0));
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. */
23547 + if (TREE_CODE (type) == POINTER_PLUS_EXPR)
23549 + gcc_assert (TREE_CODE (TREE_OPERAND (type, 1)) == INTEGER_CST);
23550 + type = TREE_OPERAND (type, 0);
23551 + STRIP_NOPS (type);
23553 if (TREE_CODE (type) == ADDR_EXPR)
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. */
23563 -hard_libcall_value (enum machine_mode mode)
23564 +hard_libcall_value (enum machine_mode mode, rtx fun)
23566 - return LIBCALL_VALUE (mode);
23567 + return targetm.calls.libcall_value (mode, fun);
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;
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;
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;
23605 + PUT_CODE (&all.shift_sub1, MINUS);
23606 + XEXP (&all.shift_sub1, 0) = &all.reg;
23607 + XEXP (&all.shift_sub1, 1) = &all.shift_mult;
23609 for (speed = 0; speed < 2; speed++)
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);
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 @@
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];
23630 n = MIN (MAX_BITS_PER_WORD, GET_MODE_BITSIZE (mode));
23631 for (m = 1; m < n; m++)
23632 @@ -265,7 +272,8 @@
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);
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));
23650 @@ -2542,6 +2551,38 @@
23651 best_alg->log[best_alg->ops] = m;
23652 best_alg->op[best_alg->ops] = alg_shift;
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)
23660 + /* Shift ORIG_T as follows because a right shift of a
23661 + negative-valued signed type is implementation
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);
23675 + alg_in->cost.cost += op_cost;
23676 + alg_in->cost.latency += op_cost;
23677 + if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
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;
23689 @@ -2604,6 +2645,29 @@
23690 best_alg->op[best_alg->ops] = alg_add_t_m2;
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)
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);
23704 + alg_in->cost.cost += op_cost;
23705 + alg_in->cost.latency += op_cost;
23706 + if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
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;
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)
23726 - op_cost = shiftsub_cost[speed][mode][m];
23727 + op_cost = shiftsub0_cost[speed][mode][m];
23728 op_latency = op_cost;
23731 @@ -2738,7 +2802,7 @@
23732 m = exact_log2 (q);
23733 if (m >= 0 && m < maxm)
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 @@
23745 /* Compute FROM and store the value in the rtx we got. */
23747 + if (TREE_CODE (to) == MISALIGNED_INDIRECT_REF)
23751 + enum insn_code icode;
23752 + enum machine_mode mode = GET_MODE (to_rtx);
23754 + icode = optab_handler (movmisalign_optab, mode)->insn_code;
23755 + gcc_assert (icode != CODE_FOR_nothing);
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. */
23762 + from_rtx = copy_to_mode_reg(mode, from_rtx);
23763 + insn = GEN_FCN (icode) (to_rtx, from_rtx);
23764 + gcc_assert(insn);
23766 + emit_insn (insn);
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)
23781 + int i = REGNO(decl_rtl);
23782 + int nregs = hard_regno_nregs[i][GET_MODE(decl_rtl)];
23785 + SET_HARD_REG_BIT(crtl->asm_clobbers, i);
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 @@
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)
23805 + /* For writes produce a MEM, and expand_assignment will DTRT. */
23806 + if (modifier == EXPAND_WRITE)
23809 gcc_assert (modifier == EXPAND_NORMAL
23810 || modifier == EXPAND_STACK_PARM);
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 @@
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);
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))
23831 + bool next_is_jumptable;
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);
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)
23846 - max_skip = LABEL_ALIGN_MAX_SKIP;
23847 + log = LABEL_ALIGN (insn);
23848 + if (max_log < log)
23851 + max_skip = LABEL_ALIGN_MAX_SKIP;
23854 - next = next_nonnote_insn (insn);
23855 /* ADDR_VECs only take room if read-only data goes into the text
23857 - if (JUMP_TABLES_IN_TEXT_SECTION
23858 - || readonly_data_section == text_section)
23859 - if (next && JUMP_P (next))
23861 - rtx nextbody = PATTERN (next);
23862 - if (GET_CODE (nextbody) == ADDR_VEC
23863 - || GET_CODE (nextbody) == ADDR_DIFF_VEC)
23865 - log = ADDR_VEC_ALIGN (next);
23866 - if (max_log < log)
23869 - max_skip = LABEL_ALIGN_MAX_SKIP;
23873 + if ((JUMP_TABLES_IN_TEXT_SECTION
23874 + || readonly_data_section == text_section)
23875 + && next_is_jumptable)
23877 + log = ADDR_VEC_ALIGN (next);
23878 + if (max_log < log)
23881 + max_skip = LABEL_ALIGN_MAX_SKIP;
23884 LABEL_TO_ALIGNMENT (insn) = max_log;
23885 LABEL_TO_MAX_SKIP (insn) = max_skip;
23887 @@ -2013,48 +2013,41 @@
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))
23897 - rtx nextbody = PATTERN (next);
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. */
23903 - if (GET_CODE (nextbody) == ADDR_VEC
23904 - || GET_CODE (nextbody) == ADDR_DIFF_VEC)
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. */
23914 - if (! JUMP_TABLES_IN_TEXT_SECTION)
23917 + if (! JUMP_TABLES_IN_TEXT_SECTION)
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));
23926 #ifdef ADDR_VEC_ALIGN
23927 - log_align = ADDR_VEC_ALIGN (next);
23928 + log_align = ADDR_VEC_ALIGN (next);
23930 - log_align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
23931 + log_align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
23933 - ASM_OUTPUT_ALIGN (file, log_align);
23936 - switch_to_section (current_function_section ());
23937 + ASM_OUTPUT_ALIGN (file, log_align);
23940 + switch_to_section (current_function_section ());
23942 #ifdef ASM_OUTPUT_CASE_LABEL
23943 - ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
23945 + ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
23948 - targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
23949 + targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
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);
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;
23983 + TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
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 *);
23999 static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
24000 @@ -452,7 +455,6 @@
24001 cpp_option->cplusplus_comments = 0;
24003 cpp_option->pedantic = pedantic;
24004 - cpp_option->inhibit_warnings = inhibit_warnings;
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 @@
24010 cpp_post_options (cpp_in);
24012 - /* If an error has occurred in cpplib, note it so we fail immediately. */
24013 - errorcount += cpp_errors (cpp_in);
24015 gfc_cpp_register_include_paths ();
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;
24024 if (gfc_cpp_option.dump_includes)
24025 cb->include = cb_include;
24026 @@ -961,6 +961,57 @@
24027 cpp_define_queue = q;
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. */
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)
24041 + diagnostic_info diagnostic;
24042 + diagnostic_t dlevel;
24043 + int save_warn_system_headers = warn_system_headers;
24048 + case CPP_DL_WARNING_SYSHDR:
24049 + warn_system_headers = 1;
24050 + /* Fall through. */
24051 + case CPP_DL_WARNING:
24052 + dlevel = DK_WARNING;
24054 + case CPP_DL_PEDWARN:
24055 + dlevel = DK_PEDWARN;
24057 + case CPP_DL_ERROR:
24058 + dlevel = DK_ERROR;
24063 + case CPP_DL_NOTE:
24064 + dlevel = DK_NOTE;
24066 + case CPP_DL_FATAL:
24067 + dlevel = DK_FATAL;
24070 + gcc_unreachable ();
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;
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.
24091 -Copyright (C) 1999-2008 Free Software Foundation, Inc.
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".
24101 - (a) The FSF's Front-Cover Text is:
24105 - (b) The FSF's Back-Cover Text is:
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.
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').
24118 - Published by the Free Software Foundation 51 Franklin Street, Fifth
24119 -Floor Boston, MA 02110-1301 USA
24121 - Copyright (C) 1999-2008 Free Software Foundation, Inc.
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".
24131 - (a) The FSF's Front-Cover Text is:
24135 - (b) The FSF's Back-Cover Text is:
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.
24142 -File: gfortran.info, Node: Top, Next: Introduction, Up: (dir)
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.
24155 -Part I: Invoking GNU Fortran
24156 -* Invoking GNU Fortran:: Command options supported by `gfortran'.
24157 -* Runtime:: Influencing runtime behavior with environment variables.
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.
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
24176 -File: gfortran.info, Node: Introduction, Next: Invoking GNU Fortran, Prev: Top, Up: Top
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.
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.
24195 -File: gfortran.info, Node: About GNU Fortran, Next: GNU Fortran and GCC, Up: Introduction
24197 -1.1 About GNU Fortran
24198 -=====================
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.
24204 - When the GNU Fortran compiler is finished, it will do everything you
24205 -expect from any decent compiler:
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".
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.
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".
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".
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
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').
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.
24248 - The GNU Fortran compiler consists of several components:
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.
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.
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.
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.
24277 -File: gfortran.info, Node: GNU Fortran and GCC, Next: Preprocessing and conditional compilation, Prev: About GNU Fortran, Up: Introduction
24279 -1.2 GNU Fortran and GCC
24280 -=======================
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.
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.
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.
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.
24317 -File: gfortran.info, Node: Preprocessing and conditional compilation, Next: GNU Fortran and G77, Prev: GNU Fortran and GCC, Up: Introduction
24319 -1.3 Preprocessing and conditional compilation
24320 -=============================================
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
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
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.
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').
24350 -File: gfortran.info, Node: GNU Fortran and G77, Next: Project Status, Prev: Preprocessing and conditional compilation, Up: Introduction
24352 -1.4 GNU Fortran and G77
24353 -=======================
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'.
24363 -File: gfortran.info, Node: Project Status, Next: Standards, Prev: GNU Fortran and G77, Up: Introduction
24365 -1.5 Project Status
24366 -==================
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....
24373 - -Andy Vaught, April 2000
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).
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.
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
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.
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.
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.
24414 -File: gfortran.info, Node: Standards, Prev: Project Status, Up: Introduction
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)
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
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
24441 -File: gfortran.info, Node: Invoking GNU Fortran, Next: Runtime, Prev: Introduction, Up: Top
24443 -2 GNU Fortran Command Options
24444 -*****************************
24446 -The `gfortran' command supports all the options supported by the `gcc'
24447 -command. Only options specific to GNU Fortran are documented here.
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).
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.
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.
24464 -* Option Summary:: Brief list of all `gfortran' options,
24465 - without explanations.
24466 -* Fortran Dialect Options:: Controlling the variant of Fortran language
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'.
24479 -File: gfortran.info, Node: Option Summary, Next: Fortran Dialect Options, Up: Invoking GNU Fortran
24481 -2.1 Option summary
24482 -==================
24484 -Here is a summary of all the options specific to GNU Fortran, grouped
24485 -by type. Explanations are in the following sections.
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
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
24505 -_Error and Warning Options_
24506 - *Note Options to request or suppress errors and warnings: Error
24507 - and Warning Options.
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
24515 -_Debugging Options_
24516 - *Note Options for debugging your program or GNU Fortran: Debugging
24518 - -fdump-parse-tree -ffpe-trap=LIST
24519 - -fdump-core -fbacktrace
24521 -_Directory Options_
24522 - *Note Options for directory search: Directory Options.
24523 - -IDIR -JDIR -MDIR
24524 - -fintrinsic-modules-path DIR
24527 - *Note Options for influencing the linking step: Link Options.
24528 - -static-libgfortran
24531 - *Note Options for influencing runtime behavior: Runtime Options.
24532 - -fconvert=CONVERSION -fno-range-check
24533 - -frecord-marker=LENGTH -fmax-subrecord-length=LENGTH
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
24550 -* Fortran Dialect Options:: Controlling the variant of Fortran language
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.
24562 -File: gfortran.info, Node: Fortran Dialect Options, Next: Preprocessing Options, Prev: Option Summary, Up: Invoking GNU Fortran
24564 -2.2 Options controlling Fortran dialect
24565 -=======================================
24567 -The following options control the details of the Fortran dialect
24568 -accepted by the compiler:
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.
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'.
24587 -`-fd-lines-as-code'
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
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.
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'.
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.
24617 - Allow `$' as a valid character in a symbol name.
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.
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'.
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.
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'.
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'.
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).
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.
24666 - Enable the Cray pointer extension, which provides C-like pointer
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'.
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.
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.
24706 -File: gfortran.info, Node: Preprocessing Options, Next: Error and Warning Options, Prev: Fortran Dialect Options, Up: Invoking GNU Fortran
24708 -2.3 Enable and customize preprocessing
24709 -======================================
24711 -Preprocessor related options. See section *note Preprocessing and
24712 -conditional compilation:: for more detailed information on
24713 -preprocessing in `gfortran'.
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.
24723 - To disable preprocessing of files with any of the above listed
24724 - extensions, use the negative form: `-nocpp'.
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.
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.
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.
24746 - Like `-dD', but emit only the macro names, not their expansions.
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.
24756 - Output `'#include'' directives in addition to the result of
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.
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'.
24782 - Use DIR as a subdirectory of the directory containing
24783 - target-specific C++ headers.
24786 - Specify PREFIX as the prefix for subsequent `-iwithprefix'
24787 - options. If the PREFIX represents a directory, you should include
24791 - This option is like the `--sysroot' option, but applies only to
24792 - header files. See the `--sysroot' option for more information.
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'.
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'.
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.
24815 - Do not predefine any system-specific or GCC-specific macros. The
24816 - standard predefined macros remain defined.
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
24824 -`-A-PREDICATE=ANSWER'
24825 - Cancel an assertion with the predicate PREDICATE and answer ANSWER.
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.
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
24839 - Warning: this currently handles C-Style comments only. The
24840 - preprocessor does not yet recognize Fortran-style comments.
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.
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
24854 - Warning: this currently handles C- and C++-Style comments only. The
24855 - preprocessor does not yet recognize Fortran-style comments.
24858 - Predefine name as a macro, with definition `1'.
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
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.
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.
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.
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.
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.
24892 - Cancel any previous definition of NAME, either built in or provided
24893 - with a `-D' option.
24896 -File: gfortran.info, Node: Error and Warning Options, Next: Debugging Options, Prev: Preprocessing Options, Up: Invoking GNU Fortran
24898 -2.4 Options to request or suppress errors and warnings
24899 -======================================================
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.
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.
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
24918 - These options control the amount and kinds of errors and warnings
24919 -produced by GNU Fortran:
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.
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.
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'.
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.
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.
24948 - This should be used in conjunction with `-std=f95', `-std=f2003'
24951 -`-pedantic-errors'
24952 - Like `-pedantic', except that errors are produced rather than
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'.
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.
24968 - The following example will trigger the warning.
24970 - subroutine bar(a,b)
24971 - integer, intent(in) :: a
24972 - integer, intent(out) :: b
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.
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.
24992 -`-Wcharacter-truncation'
24993 - Warn when a character assignment will truncate the assigned string.
24995 -`-Wline-truncation'
24996 - Warn when a source code line will be truncated.
24999 - Warn about implicit conversions between different types.
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
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.
25015 - Produce a warning when "suspicious" code constructs are
25016 - encountered. While technically legal these usually indicate that
25017 - an error has been made.
25019 - This currently produces a warning under the following
25022 - * An INTEGER SELECT construct has a CASE that can never be
25023 - matched as its lower value is greater than its upper value.
25025 - * A LOGICAL SELECT construct has three CASE statements.
25027 - * A TRANSFER specifies a source that is shorter than the
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.
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'.
25043 - Produce a warning when numerical constant expressions are
25044 - encountered, which yield an UNDERFLOW during compilation.
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.
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
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'.
25066 - Turns all warnings into errors.
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.
25072 - Some of these have no effect when compiling programs written in
25076 -File: gfortran.info, Node: Debugging Options, Next: Directory Options, Prev: Error and Warning Options, Up: Invoking GNU Fortran
25078 -2.5 Options for debugging your program or GNU Fortran
25079 -=====================================================
25081 -GNU Fortran has various special options that are used for debugging
25082 -either your program or the GNU Fortran compiler.
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.
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).
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.
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.
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
25118 - *Note Options for Debugging Your Program or GCC: (gcc)Debugging
25119 -Options, for more information on debugging options.
25122 -File: gfortran.info, Node: Directory Options, Next: Link Options, Prev: Debugging Options, Up: Invoking GNU Fortran
25124 -2.6 Options for directory search
25125 -================================
25127 -These options affect how GNU Fortran searches for files specified by
25128 -the `INCLUDE' directive and where it searches for previously compiled
25131 - It also affects the search paths used by `cpp' when used to
25132 -preprocess Fortran source.
25135 - These affect interpretation of the `INCLUDE' directive (as well as
25136 - of the `#include' directive of the `cpp' preprocessor).
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.
25143 - This path is also used to search for `.mod' files when previously
25144 - compiled modules are required by a `USE' statement.
25146 - *Note Options for Directory Search: (gcc)Directory Options, for
25147 - information on the `-I' option.
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.
25156 - The default is the current directory.
25158 - `-M' is deprecated to avoid conflicts with existing GCC options.
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
25166 -File: gfortran.info, Node: Link Options, Next: Runtime Options, Prev: Directory Options, Up: Invoking GNU Fortran
25168 -2.7 Influencing the linking step
25169 -================================
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.
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.
25182 -File: gfortran.info, Node: Runtime Options, Next: Code Gen Options, Prev: Link Options, Up: Invoking GNU Fortran
25184 -2.8 Influencing runtime behavior
25185 -================================
25187 -These options affect the runtime behavior of programs compiled with GNU
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.
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'._
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.
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'.
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.
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.
25228 -File: gfortran.info, Node: Code Gen Options, Next: Environment Variables, Prev: Runtime Options, Up: Invoking GNU Fortran
25230 -2.9 Options for code generation conventions
25231 -===========================================
25233 -These machine-independent options control the interface conventions
25234 -used in code generation.
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.
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
25252 - Generate code designed to be compatible with code generated by
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.
25267 - This does not affect the generation of code that interfaces with
25268 - the `libgfortran' library.
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.
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.
25280 -`-fno-underscoring'
25281 - Do not transform names of entities specified in the Fortran source
25282 - file by appending underscores to them.
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
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.
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,
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
25303 - I = J() + MAX_COUNT (MY_VAR, LVAR)
25304 - is implemented as something akin to:
25305 - i = j_() + max_count__(&my_var__, &lvar);
25307 - With `-fno-underscoring', the same statement is implemented as:
25309 - i = j() + max_count(&my_var, &lvar);
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.
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.
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.
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.
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
25347 - This option has no effect if `-fno-underscoring' is in effect. It
25348 - is implied by the `-ff2c' option.
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
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
25364 - Some checks require that `-fbounds-check' is set for the
25365 - compilation of the main program.
25367 - Note: In the future this may also include other forms of checking,
25368 - e.g., checking substring references.
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.
25376 - Note: The warning is only printed once per location.
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.
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'
25391 - _Caution: This option can lead to long compile times and
25392 - excessively large object files._
25394 - The default value for N is 65535.
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.
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.
25408 - The default value for N is 32768.
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
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.
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.
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.
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.
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
25449 - The default value for N is 30.
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'.
25456 -`-finit-local-zero'
25458 -`-finit-integer=N'
25460 -`-finit-real=<ZERO|INF|-INF|NAN>'
25462 -`-finit-logical=<TRUE|FALSE>'
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).
25478 - Note that the `-finit-real=nan' option initializes `REAL' and
25479 - `COMPLEX' variables with a quiet NaN.
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.
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.
25497 -File: gfortran.info, Node: Environment Variables, Prev: Code Gen Options, Up: Invoking GNU Fortran
25499 -2.10 Environment variables affecting `gfortran'
25500 -===============================================
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'.
25506 - *Note Environment Variables Affecting GCC: (gcc)Environment
25507 -Variables, for information on environment variables.
25509 - *Note Runtime::, for environment variables that affect the run-time
25510 -behavior of programs compiled with GNU Fortran.
25513 -File: gfortran.info, Node: Runtime, Next: Fortran 2003 and 2008 status, Prev: Invoking GNU Fortran, Up: Top
25515 -3 Runtime: Influencing runtime behavior with environment variables
25516 -*******************************************************************
25518 -The behavior of the `gfortran' can be influenced by environment
25521 - Malformed environment variables are silently ignored.
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
25541 -File: gfortran.info, Node: GFORTRAN_STDIN_UNIT, Next: GFORTRAN_STDOUT_UNIT, Up: Runtime
25543 -3.1 `GFORTRAN_STDIN_UNIT'--Unit number for standard input
25544 -=========================================================
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.
25551 -File: gfortran.info, Node: GFORTRAN_STDOUT_UNIT, Next: GFORTRAN_STDERR_UNIT, Prev: GFORTRAN_STDIN_UNIT, Up: Runtime
25553 -3.2 `GFORTRAN_STDOUT_UNIT'--Unit number for standard output
25554 -===========================================================
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.
25561 -File: gfortran.info, Node: GFORTRAN_STDERR_UNIT, Next: GFORTRAN_USE_STDERR, Prev: GFORTRAN_STDOUT_UNIT, Up: Runtime
25563 -3.3 `GFORTRAN_STDERR_UNIT'--Unit number for standard error
25564 -==========================================================
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.
25571 -File: gfortran.info, Node: GFORTRAN_USE_STDERR, Next: GFORTRAN_TMPDIR, Prev: GFORTRAN_STDERR_UNIT, Up: Runtime
25573 -3.4 `GFORTRAN_USE_STDERR'--Send library output to standard error
25574 -================================================================
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.
25581 -File: gfortran.info, Node: GFORTRAN_TMPDIR, Next: GFORTRAN_UNBUFFERED_ALL, Prev: GFORTRAN_USE_STDERR, Up: Runtime
25583 -3.5 `GFORTRAN_TMPDIR'--Directory for scratch files
25584 -==================================================
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
25592 -File: gfortran.info, Node: GFORTRAN_UNBUFFERED_ALL, Next: GFORTRAN_UNBUFFERED_PRECONNECTED, Prev: GFORTRAN_TMPDIR, Up: Runtime
25594 -3.6 `GFORTRAN_UNBUFFERED_ALL'--Don't buffer I/O on all units
25595 -============================================================
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.
25603 -File: gfortran.info, Node: GFORTRAN_UNBUFFERED_PRECONNECTED, Next: GFORTRAN_SHOW_LOCUS, Prev: GFORTRAN_UNBUFFERED_ALL, Up: Runtime
25605 -3.7 `GFORTRAN_UNBUFFERED_PRECONNECTED'--Don't buffer I/O on preconnected units
25606 -==============================================================================
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.
25615 -File: gfortran.info, Node: GFORTRAN_SHOW_LOCUS, Next: GFORTRAN_OPTIONAL_PLUS, Prev: GFORTRAN_UNBUFFERED_PRECONNECTED, Up: Runtime
25617 -3.8 `GFORTRAN_SHOW_LOCUS'--Show location for runtime errors
25618 -===========================================================
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.
25626 -File: gfortran.info, Node: GFORTRAN_OPTIONAL_PLUS, Next: GFORTRAN_DEFAULT_RECL, Prev: GFORTRAN_SHOW_LOCUS, Up: Runtime
25628 -3.9 `GFORTRAN_OPTIONAL_PLUS'--Print leading + where permitted
25629 -=============================================================
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
25637 -File: gfortran.info, Node: GFORTRAN_DEFAULT_RECL, Next: GFORTRAN_LIST_SEPARATOR, Prev: GFORTRAN_OPTIONAL_PLUS, Up: Runtime
25639 -3.10 `GFORTRAN_DEFAULT_RECL'--Default record length for new files
25640 -=================================================================
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).
25648 -File: gfortran.info, Node: GFORTRAN_LIST_SEPARATOR, Next: GFORTRAN_CONVERT_UNIT, Prev: GFORTRAN_DEFAULT_RECL, Up: Runtime
25650 -3.11 `GFORTRAN_LIST_SEPARATOR'--Separator for list output
25651 -=========================================================
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
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.
25662 -File: gfortran.info, Node: GFORTRAN_CONVERT_UNIT, Next: GFORTRAN_ERROR_DUMPCORE, Prev: GFORTRAN_LIST_SEPARATOR, Up: Runtime
25664 -3.12 `GFORTRAN_CONVERT_UNIT'--Set endianness for unformatted I/O
25665 -================================================================
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:
25681 - `NATIVE' Use the native format. This is the default.
25683 - `SWAP' Swap between little- and big-endian.
25685 - `LITTLE_ENDIAN' Use the little-endian format for unformatted files.
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.
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
25696 - `'10-20'' Units 10 to 20 are big-endian, the rest is native.
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.
25702 - Example for `sh':
25703 - $ gfortran foo.f90
25704 - $ GFORTRAN_CONVERT_UNIT='big_endian;native:10-20' ./a.out
25706 - Example code for `csh':
25707 - % gfortran foo.f90
25708 - % setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20'
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.
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.
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.
25726 -File: gfortran.info, Node: GFORTRAN_ERROR_DUMPCORE, Next: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_CONVERT_UNIT, Up: Runtime
25728 -3.13 `GFORTRAN_ERROR_DUMPCORE'--Dump core on run-time errors
25729 -============================================================
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
25738 -File: gfortran.info, Node: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_ERROR_DUMPCORE, Up: Runtime
25740 -3.14 `GFORTRAN_ERROR_BACKTRACE'--Show backtrace on run-time errors
25741 -==================================================================
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.
25750 -File: gfortran.info, Node: Fortran 2003 and 2008 status, Next: Compiler Characteristics, Prev: Runtime, Up: Top
25752 -4 Fortran 2003 and 2008 Status
25753 -******************************
25757 -* Fortran 2003 status::
25758 -* Fortran 2008 status::
25761 -File: gfortran.info, Node: Fortran 2003 status, Next: Fortran 2008 status, Up: Fortran 2003 and 2008 status
25763 -4.1 Fortran 2003 status
25764 -=======================
25766 -Although GNU Fortran focuses on implementing the Fortran 95 standard
25767 -for the time being, a few Fortran 2003 features are currently available.
25769 - * Intrinsics `command_argument_count', `get_command',
25770 - `get_command_argument', `get_environment_variable', and
25773 - * Array constructors using square brackets. That is, `[...]' rather
25776 - * `FLUSH' statement.
25778 - * `IOMSG=' specifier for I/O statements.
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.
25786 - * `ALLOCATABLE' dummy arguments.
25788 - * `ALLOCATABLE' function results
25790 - * `ALLOCATABLE' components of derived types
25792 - * The `OPEN' statement supports the `ACCESS='STREAM'' specifier,
25793 - allowing I/O without any record structure.
25795 - * Namelist input/output for internal files.
25797 - * The `PROTECTED' statement and attribute.
25799 - * The `VALUE' statement and attribute.
25801 - * The `VOLATILE' statement and attribute.
25803 - * The `IMPORT' statement, allowing to import host-associated derived
25806 - * `USE' statement with `INTRINSIC' and `NON_INTRINSIC' attribute;
25807 - supported intrinsic modules: `ISO_FORTRAN_ENV', `OMP_LIB' and
25810 - * Renaming of operators in the `USE' statement.
25812 - * Interoperability with C (ISO C Bindings)
25814 - * BOZ as argument of INT, REAL, DBLE and CMPLX.
25818 -File: gfortran.info, Node: Fortran 2008 status, Prev: Fortran 2003 status, Up: Fortran 2003 and 2008 status
25820 -4.2 Fortran 2008 status
25821 -=======================
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.
25837 -File: gfortran.info, Node: Compiler Characteristics, Next: Extensions, Prev: Fortran 2003 and 2008 status, Up: Top
25839 -5 Compiler Characteristics
25840 -**************************
25842 -This chapter describes certain characteristics of the GNU Fortran
25843 -compiler, namely the KIND type parameter values supported.
25847 -* KIND Type Parameters::
25850 -File: gfortran.info, Node: KIND Type Parameters, Up: Compiler Characteristics
25852 -5.1 KIND Type Parameters
25853 -========================
25855 -The `KIND' type parameters supported by GNU Fortran for the primitive
25859 - 1, 2, 4, 8*, 16*, default: 4 (1)
25862 - 1, 2, 4, 8*, 16*, default: 4 (1)
25865 - 4, 8, 10**, 16**, default: 4 (2)
25868 - 4, 8, 10**, 16**, default: 4 (2)
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
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.
25886 -File: gfortran.info, Node: Extensions, Next: Intrinsic Procedures, Prev: Compiler Characteristics, Up: Top
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
25900 -* Extensions implemented in GNU Fortran::
25901 -* Extensions not implemented in GNU Fortran::
25904 -File: gfortran.info, Node: Extensions implemented in GNU Fortran, Next: Extensions not implemented in GNU Fortran, Up: Extensions
25906 -6.1 Extensions implemented in GNU Fortran
25907 -=========================================
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
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::
25935 -* CONVERT specifier::
25937 -* Argument list functions::
25940 -File: gfortran.info, Node: Old-style kind specifications, Next: Old-style variable initialization, Up: Extensions implemented in GNU Fortran
25942 -6.1.1 Old-style kind specifications
25943 ------------------------------------
25945 -GNU Fortran allows old-style kind specifications in declarations. These
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
25963 -File: gfortran.info, Node: Old-style variable initialization, Next: Extensions to namelist, Prev: Old-style kind specifications, Up: Extensions implemented in GNU Fortran
25965 -6.1.2 Old-style variable initialization
25966 ----------------------------------------
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
25980 - Examples of standard-conforming code equivalent to the above example
25983 - INTEGER :: i = 1, j = 2
25984 - REAL :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x))
25988 - DATA i/1/, j/2/, x/3*0.,1./
25990 - Note that variables which are explicitly initialized in declarations
25991 -or in `DATA' statements automatically acquire the `SAVE' attribute.
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
25996 -6.1.3 Extensions to namelist
25997 -----------------------------
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:
26005 - Old-style use of `$' instead of `&'
26007 - X(:)%Y(2) = 1.0 2.0 3.0
26011 - It should be noted that the default terminator is `/' rather than
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:
26025 - Entering `=?' outputs the namelist to stdout, as if `WRITE(*,NML =
26026 -mynml)' had been called:
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 ,
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.
26038 - `PRINT' namelist is permitted. This causes an error if `-std=f95'
26040 - PROGRAM test_print
26041 - REAL, dimension (4) :: x = (/1.0, 2.0, 3.0, 4.0/)
26042 - NAMELIST /mynml/ x
26044 - END PROGRAM test_print
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.
26051 - X(1,1) = 0.00 , 1.00 , 2.00
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
26057 -6.1.4 `X' format descriptor without count field
26058 ------------------------------------------------
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.
26065 - 10 FORMAT (I1, X, I1)
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
26070 -6.1.5 Commas in `FORMAT' specifications
26071 ----------------------------------------
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.
26078 - 10 FORMAT ('FOO='I1' BAR='I2)
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
26083 -6.1.6 Missing period in `FORMAT' specifications
26084 ------------------------------------------------
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.
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
26097 -6.1.7 I/O item lists
26098 ---------------------
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.
26105 -File: gfortran.info, Node: BOZ literal constants, Next: Real array indices, Prev: I/O item lists, Up: Extensions implemented in GNU Fortran
26107 -6.1.8 BOZ literal constants
26108 ----------------------------
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''.)
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.
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.
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.
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
26152 -File: gfortran.info, Node: Real array indices, Next: Unary operators, Prev: BOZ literal constants, Up: Extensions implemented in GNU Fortran
26154 -6.1.9 Real array indices
26155 -------------------------
26157 -As an extension, GNU Fortran allows the use of `REAL' expressions or
26158 -variables as array indices.
26161 -File: gfortran.info, Node: Unary operators, Next: Implicitly convert LOGICAL and INTEGER values, Prev: Real array indices, Up: Extensions implemented in GNU Fortran
26163 -6.1.10 Unary operators
26164 -----------------------
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.
26173 -File: gfortran.info, Node: Implicitly convert LOGICAL and INTEGER values, Next: Hollerith constants support, Prev: Unary operators, Up: Extensions implemented in GNU Fortran
26175 -6.1.11 Implicitly convert `LOGICAL' and `INTEGER' values
26176 ---------------------------------------------------------
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.'.
26192 - However, there is no implicit conversion of `INTEGER' values in
26193 -`if'-statements, nor of `LOGICAL' or `INTEGER' values in I/O operations.
26196 -File: gfortran.info, Node: Hollerith constants support, Next: Cray pointers, Prev: Implicitly convert LOGICAL and INTEGER values, Up: Extensions implemented in GNU Fortran
26198 -6.1.12 Hollerith constants support
26199 -----------------------------------
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.
26209 - Examples of valid uses of Hollerith constants:
26211 - data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
26212 - x(1) = 16HABCDEFGHIJKLMNOP
26213 - call foo (4h abc)
26215 - Invalid Hollerith constants examples:
26217 - a = 8H12345678 ! Valid, but the Hollerith constant will be truncated.
26218 - a = 0H ! At least one character is needed.
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
26232 -File: gfortran.info, Node: Cray pointers, Next: CONVERT specifier, Prev: Hollerith constants support, Up: Extensions implemented in GNU Fortran
26234 -6.1.13 Cray pointers
26235 ---------------------
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.
26242 - Pointer/pointee pairs are declared in statements of the form:
26243 - pointer ( <pointer> , <pointee> )
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.
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:
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.
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
26274 - pointer (ipt, pointee)
26275 - ipt = loc (target)
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'.
26281 - Any expression involving the pointee will be translated to use the
26282 -value stored in the pointer as the base address.
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:
26288 - pointer(ipt, arpte(10))
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
26295 - Cray pointees often are used to alias an existing variable. For
26297 - integer target(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.
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.)
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
26326 - A Cray pointer may also point to a function or a subroutine. For
26327 -example, the following excerpt is valid:
26330 - pointer (subptr,subpte)
26332 - subptr = loc(sub)
26337 - end subroutine sub
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.
26346 -File: gfortran.info, Node: CONVERT specifier, Next: OpenMP, Prev: Cray pointers, Up: Extensions implemented in GNU Fortran
26348 -6.1.14 `CONVERT' specifier
26349 ---------------------------
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
26358 - Valid values for `CONVERT' are:
26359 - `CONVERT='NATIVE'' Use the native format. This is the default.
26361 - `CONVERT='SWAP'' Swap between little- and big-endian.
26363 - `CONVERT='LITTLE_ENDIAN'' Use the little-endian representation for
26364 - unformatted files.
26366 - `CONVERT='BIG_ENDIAN'' Use the big-endian representation for
26367 - unformatted files.
26369 - Using the option could look like this:
26370 - open(file='big.dat',form='unformatted',access='sequential', &
26371 - convert='big_endian')
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''.
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.
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.
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.
26393 -File: gfortran.info, Node: OpenMP, Next: Argument list functions, Prev: CONVERT specifier, Up: Extensions implemented in GNU Fortran
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.
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).
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.
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'.
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)
26425 - !$OMP PARALLEL DO !I is private by default
26427 - B(I) = (A(I) + A(I-1)) / 2.0
26429 - !$OMP END PARALLEL DO
26430 - END SUBROUTINE A1
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.
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.
26446 -File: gfortran.info, Node: Argument list functions, Prev: OpenMP, Up: Extensions implemented in GNU Fortran
26448 -6.1.16 Argument list functions `%VAL', `%REF' and `%LOC'
26449 ---------------------------------------------------------
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.
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.
26467 - An example of passing an argument by value to a C subroutine foo.:
26469 - C prototype void foo_ (float x);
26474 - call foo (%VAL (x))
26477 - For details refer to the g77 manual
26478 -`http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top'.
26480 - Also, the gfortran testsuite c_by_val.f and its partner c_by_val.c
26484 -File: gfortran.info, Node: Extensions not implemented in GNU Fortran, Prev: Extensions implemented in GNU Fortran, Up: Extensions
26486 -6.2 Extensions not implemented in GNU Fortran
26487 -=============================================
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.
26500 -* STRUCTURE and RECORD::
26501 -* ENCODE and DECODE statements::
26504 -File: gfortran.info, Node: STRUCTURE and RECORD, Next: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran
26506 -6.2.1 `STRUCTURE' and `RECORD'
26507 -------------------------------
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
26514 - ! Declaring a structure named ``item'' and containing three fields:
26515 - ! an integer ID, an description string and a floating-point price.
26518 - CHARACTER(LEN=200) description
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)
26526 - ! We can directly access the fields of both variables
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
26534 - ! We can also manipulate the whole structure
26535 - store_catalog(12) = pear
26536 - print *, store_catalog(12)
26538 -This code can easily be rewritten in the Fortran 90 syntax as following:
26540 - ! ``STRUCTURE /name/ ... END STRUCTURE'' becomes
26541 - ! ``TYPE name ... END TYPE''
26544 - CHARACTER(LEN=200) description
26548 - ! ``RECORD /name/ variable'' becomes ``TYPE(name) variable''
26549 - TYPE(item) pear, store_catalog(100)
26551 - ! Instead of using a dot (.) to access fields of a record, the
26552 - ! standard syntax uses a percent sign (%)
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
26560 - ! Assignments of a whole variable don't change
26561 - store_catalog(12) = pear
26562 - print *, store_catalog(12)
26565 -File: gfortran.info, Node: ENCODE and DECODE statements, Prev: STRUCTURE and RECORD, Up: Extensions not implemented in GNU Fortran
26567 -6.2.2 `ENCODE' and `DECODE' statements
26568 ---------------------------------------
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
26576 - INTEGER*1 LINE(80)
26578 - c ... Code that sets LINE
26579 - DECODE (80, 9000, LINE) A, B, C
26580 - 9000 FORMAT (1X, 3(F10.5))
26582 -with the following:
26584 - CHARACTER(LEN=80) LINE
26586 - c ... Code that sets LINE
26587 - READ (UNIT=LINE, FMT=9000) A, B, C
26588 - 9000 FORMAT (1X, 3(F10.5))
26590 - Similarly, replace a code fragment like
26592 - INTEGER*1 LINE(80)
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))
26598 -with the following:
26600 - INTEGER*1 LINE(80)
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))
26607 -File: gfortran.info, Node: Intrinsic Procedures, Next: Intrinsic Modules, Prev: Extensions, Up: Top
26609 -7 Intrinsic Procedures
26610 -**********************
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
26842 -File: gfortran.info, Node: Introduction to Intrinsics, Next: ABORT, Up: Intrinsic Procedures
26844 -7.1 Introduction to intrinsic procedures
26845 -========================================
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
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.
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.
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.
26885 -File: gfortran.info, Node: ABORT, Next: ABS, Prev: Introduction to Intrinsics, Up: Intrinsic Procedures
26887 -7.2 `ABORT' -- Abort the program
26888 -================================
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.
26909 - program test_abort
26910 - integer :: i = 1, j = 2
26911 - if (i /= j) call abort
26912 - end program test_abort
26915 - *note EXIT::, *note KILL::
26919 -File: gfortran.info, Node: ABS, Next: ACCESS, Prev: ABORT, Up: Intrinsic Procedures
26921 -7.3 `ABS' -- Absolute value
26922 -===========================
26925 - `ABS(A)' computes the absolute value of `A'.
26928 - Fortran 77 and later, has overloads that are GNU extensions
26931 - Elemental function
26934 - `RESULT = ABS(A)'
26937 - A The type of the argument shall be an `INTEGER',
26938 - `REAL', or `COMPLEX'.
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.
26946 - integer :: i = -1
26947 - real :: x = -1.e0
26948 - complex :: z = (-1.e0,0.e0)
26952 - end program test_abs
26955 - Name Argument Return type Standard
26956 - `CABS(A)' `COMPLEX(4) `REAL(4)' Fortran 77 and
26958 - `DABS(A)' `REAL(8) `REAL(8)' Fortran 77 and
26960 - `IABS(A)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
26962 - `ZABS(A)' `COMPLEX(8) `COMPLEX(8)' GNU extension
26964 - `CDABS(A)' `COMPLEX(8) `COMPLEX(8)' GNU extension
26968 -File: gfortran.info, Node: ACCESS, Next: ACHAR, Prev: ABS, Up: Intrinsic Procedures
26970 -7.4 `ACCESS' -- Checks file access modes
26971 -========================================
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'.
26985 - `RESULT = ACCESS(NAME, MODE)'
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.
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.
27004 - program access_test
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
27021 -File: gfortran.info, Node: ACHAR, Next: ACOS, Prev: ACCESS, Up: Intrinsic Procedures
27023 -7.5 `ACHAR' -- Character in ASCII collating sequence
27024 -====================================================
27027 - `ACHAR(I)' returns the character located at position `I' in the
27028 - ASCII collating sequence.
27031 - Fortran 77 and later, with KIND argument Fortran 2003 and later
27034 - Elemental function
27037 - `RESULT = ACHAR(I [, KIND])'
27040 - I The type shall be `INTEGER'.
27041 - KIND (Optional) An `INTEGER' initialization
27042 - expression indicating the kind parameter of
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.
27051 - program test_achar
27054 - end program test_achar
27057 - See *note ICHAR:: for a discussion of converting between numerical
27058 - values and formatted string representations.
27061 - *note CHAR::, *note IACHAR::, *note ICHAR::
27065 -File: gfortran.info, Node: ACOS, Next: ACOSH, Prev: ACHAR, Up: Intrinsic Procedures
27067 -7.6 `ACOS' -- Arccosine function
27068 -================================
27071 - `ACOS(X)' computes the arccosine of X (inverse of `COS(X)').
27074 - Fortran 77 and later
27077 - Elemental function
27080 - `RESULT = ACOS(X)'
27083 - X The type shall be `REAL' with a magnitude that
27084 - is less than or equal to one.
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.
27091 - program test_acos
27092 - real(8) :: x = 0.866_8
27094 - end program test_acos
27097 - Name Argument Return type Standard
27098 - `DACOS(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27102 - Inverse function: *note COS::
27106 -File: gfortran.info, Node: ACOSH, Next: ADJUSTL, Prev: ACOS, Up: Intrinsic Procedures
27108 -7.7 `ACOSH' -- Hyperbolic arccosine function
27109 -============================================
27112 - `ACOSH(X)' computes the hyperbolic arccosine of X (inverse of
27116 - Fortran 2008 and later
27119 - Elemental function
27122 - `RESULT = ACOSH(X)'
27125 - X The type shall be `REAL' or `COMPLEX'.
27128 - The return value has the same type and kind as X
27131 - PROGRAM test_acosh
27132 - REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
27133 - WRITE (*,*) ACOSH(x)
27137 - Name Argument Return type Standard
27138 - `DACOSH(X)' `REAL(8) X' `REAL(8)' GNU extension
27141 - Inverse function: *note COSH::
27144 -File: gfortran.info, Node: ADJUSTL, Next: ADJUSTR, Prev: ACOSH, Up: Intrinsic Procedures
27146 -7.8 `ADJUSTL' -- Left adjust a string
27147 -=====================================
27150 - `ADJUSTL(STRING)' will left adjust a string by removing leading
27151 - spaces. Spaces are inserted at the end of the string as needed.
27154 - Fortran 90 and later
27157 - Elemental function
27160 - `RESULT = ADJUSTL(STRING)'
27163 - STRING The type shall be `CHARACTER'.
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.
27171 - program test_adjustl
27172 - character(len=20) :: str = ' gfortran'
27173 - str = adjustl(str)
27175 - end program test_adjustl
27178 - *note ADJUSTR::, *note TRIM::
27181 -File: gfortran.info, Node: ADJUSTR, Next: AIMAG, Prev: ADJUSTL, Up: Intrinsic Procedures
27183 -7.9 `ADJUSTR' -- Right adjust a string
27184 -======================================
27187 - `ADJUSTR(STRING)' will right adjust a string by removing trailing
27188 - spaces. Spaces are inserted at the start of the string as needed.
27191 - Fortran 95 and later
27194 - Elemental function
27197 - `RESULT = ADJUSTR(STRING)'
27200 - STR The type shall be `CHARACTER'.
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.
27208 - program test_adjustr
27209 - character(len=20) :: str = 'gfortran'
27210 - str = adjustr(str)
27212 - end program test_adjustr
27215 - *note ADJUSTL::, *note TRIM::
27218 -File: gfortran.info, Node: AIMAG, Next: AINT, Prev: ADJUSTR, Up: Intrinsic Procedures
27220 -7.10 `AIMAG' -- Imaginary part of complex number
27221 -================================================
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
27230 - Fortran 77 and later, has overloads that are GNU extensions
27233 - Elemental function
27236 - `RESULT = AIMAG(Z)'
27239 - Z The type of the argument shall be `COMPLEX'.
27242 - The return value is of type `REAL' with the kind type parameter of
27246 - program test_aimag
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
27255 - Name Argument Return type Standard
27256 - `DIMAG(Z)' `COMPLEX(8) `REAL(8)' GNU extension
27258 - `IMAG(Z)' `COMPLEX Z' `REAL' GNU extension
27259 - `IMAGPART(Z)' `COMPLEX Z' `REAL' GNU extension
27262 -File: gfortran.info, Node: AINT, Next: ALARM, Prev: AIMAG, Up: Intrinsic Procedures
27264 -7.11 `AINT' -- Truncate to a whole number
27265 -=========================================
27268 - `AINT(A [, KIND])' truncates its argument to a whole number.
27271 - Fortran 77 and later
27274 - Elemental function
27277 - `RESULT = AINT(A [, KIND])'
27280 - A The type of the argument shall be `REAL'.
27281 - KIND (Optional) An `INTEGER' initialization
27282 - expression indicating the kind parameter of
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
27295 - program test_aint
27300 - print *, aint(x4), dint(x8)
27302 - end program test_aint
27305 - Name Argument Return type Standard
27306 - `DINT(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27310 -File: gfortran.info, Node: ALARM, Next: ALL, Prev: AINT, Up: Intrinsic Procedures
27312 -7.12 `ALARM' -- Execute a routine after a given delay
27313 -=====================================================
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.
27330 - `CALL ALARM(SECONDS, HANDLER [, STATUS])'
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
27341 - STATUS (Optional) STATUS shall be a scalar variable
27342 - of the default `INTEGER' kind. It is
27346 - program test_alarm
27347 - external handler_print
27349 - call alarm (3, handler_print, i)
27352 - end program test_alarm
27353 - This will cause the external routine HANDLER_PRINT to be called
27357 -File: gfortran.info, Node: ALL, Next: ALLOCATED, Prev: ALARM, Up: Intrinsic Procedures
27359 -7.13 `ALL' -- All values in MASK along DIM are true
27360 -===================================================
27363 - `ALL(MASK [, DIM])' determines if all the values are true in MASK
27364 - in the array along dimension DIM.
27367 - Fortran 95 and later
27370 - Transformational function
27373 - `RESULT = ALL(MASK [, DIM])'
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
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.
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.
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
27402 - l = all((/.true., .true., .true./))
27406 - subroutine section
27407 - integer a(2,3), b(2,3)
27411 - print *, all(a .eq. b, 1)
27412 - print *, all(a .eq. b, 2)
27413 - end subroutine section
27414 - end program test_all
27417 -File: gfortran.info, Node: ALLOCATED, Next: AND, Prev: ALL, Up: Intrinsic Procedures
27419 -7.14 `ALLOCATED' -- Status of an allocatable entity
27420 -===================================================
27423 - `ALLOCATED(ARRAY)' checks the status of whether X is allocated.
27426 - Fortran 95 and later
27432 - `RESULT = ALLOCATED(ARRAY)'
27435 - ARRAY The argument shall be an `ALLOCATABLE' array.
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.'
27443 - program test_allocated
27445 - real(4), allocatable :: x(:)
27446 - if (.not. allocated(x)) allocate(x(i))
27447 - end program test_allocated
27450 -File: gfortran.info, Node: AND, Next: ANINT, Prev: ALLOCATED, Up: Intrinsic Procedures
27452 -7.15 `AND' -- Bitwise logical AND
27453 -=================================
27456 - Bitwise logical `AND'.
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
27470 - `RESULT = AND(I, J)'
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.
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.
27485 - LOGICAL :: T = .TRUE., F = .FALSE.
27487 - DATA a / Z'F' /, b / Z'3' /
27489 - WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
27490 - WRITE (*,*) AND(a, b)
27494 - Fortran 95 elemental function: *note IAND::
27497 -File: gfortran.info, Node: ANINT, Next: ANY, Prev: AND, Up: Intrinsic Procedures
27499 -7.16 `ANINT' -- Nearest whole number
27500 -====================================
27503 - `ANINT(A [, KIND])' rounds its argument to the nearest whole
27507 - Fortran 77 and later
27510 - Elemental function
27513 - `RESULT = ANINT(A [, KIND])'
27516 - A The type of the argument shall be `REAL'.
27517 - KIND (Optional) An `INTEGER' initialization
27518 - expression indicating the kind parameter of
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)'.
27529 - program test_anint
27534 - print *, anint(x4), dnint(x8)
27536 - end program test_anint
27539 - Name Argument Return type Standard
27540 - `DNINT(A)' `REAL(8) A' `REAL(8)' Fortran 77 and
27544 -File: gfortran.info, Node: ANY, Next: ASIN, Prev: ANINT, Up: Intrinsic Procedures
27546 -7.17 `ANY' -- Any value in MASK along DIM is true
27547 -=================================================
27550 - `ANY(MASK [, DIM])' determines if any of the values in the logical
27551 - array MASK along dimension DIM are `.TRUE.'.
27554 - Fortran 95 and later
27557 - Transformational function
27560 - `RESULT = ANY(MASK [, DIM])'
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
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.
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
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
27590 - l = any((/.true., .true., .true./))
27594 - subroutine section
27595 - integer a(2,3), b(2,3)
27599 - print *, any(a .eq. b, 1)
27600 - print *, any(a .eq. b, 2)
27601 - end subroutine section
27602 - end program test_any
27605 -File: gfortran.info, Node: ASIN, Next: ASINH, Prev: ANY, Up: Intrinsic Procedures
27607 -7.18 `ASIN' -- Arcsine function
27608 -===============================
27611 - `ASIN(X)' computes the arcsine of its X (inverse of `SIN(X)').
27614 - Fortran 77 and later
27617 - Elemental function
27620 - `RESULT = ASIN(X)'
27623 - X The type shall be `REAL', and a magnitude that
27624 - is less than or equal to one.
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
27632 - program test_asin
27633 - real(8) :: x = 0.866_8
27635 - end program test_asin
27638 - Name Argument Return type Standard
27639 - `DASIN(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27643 - Inverse function: *note SIN::
27647 -File: gfortran.info, Node: ASINH, Next: ASSOCIATED, Prev: ASIN, Up: Intrinsic Procedures
27649 -7.19 `ASINH' -- Hyperbolic arcsine function
27650 -===========================================
27653 - `ASINH(X)' computes the hyperbolic arcsine of X (inverse of
27657 - Fortran 2008 and later
27660 - Elemental function
27663 - `RESULT = ASINH(X)'
27666 - X The type shall be `REAL' or `COMPLEX'.
27669 - The return value is of the same type and kind as X.
27672 - PROGRAM test_asinh
27673 - REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
27674 - WRITE (*,*) ASINH(x)
27678 - Name Argument Return type Standard
27679 - `DASINH(X)' `REAL(8) X' `REAL(8)' GNU extension.
27682 - Inverse function: *note SINH::
27685 -File: gfortran.info, Node: ASSOCIATED, Next: ATAN, Prev: ASINH, Up: Intrinsic Procedures
27687 -7.20 `ASSOCIATED' -- Status of a pointer or pointer/target pair
27688 -===============================================================
27691 - `ASSOCIATED(POINTER [, TARGET])' determines the status of the
27692 - pointer POINTER or if POINTER is associated with the target TARGET.
27695 - Fortran 95 and later
27701 - `RESULT = ASSOCIATED(POINTER [, TARGET])'
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
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.
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.
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.
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.
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.
27746 - program test_associated
27748 - real, target :: tgt(2) = (/1., 2./)
27749 - real, pointer :: ptr(:)
27751 - if (associated(ptr) .eqv. .false.) call abort
27752 - if (associated(ptr,tgt) .eqv. .false.) call abort
27753 - end program test_associated
27759 -File: gfortran.info, Node: ATAN, Next: ATAN2, Prev: ASSOCIATED, Up: Intrinsic Procedures
27761 -7.21 `ATAN' -- Arctangent function
27762 -==================================
27765 - `ATAN(X)' computes the arctangent of X.
27768 - Fortran 77 and later
27771 - Elemental function
27774 - `RESULT = ATAN(X)'
27777 - X The type shall be `REAL'.
27780 - The return value is of type `REAL' and it lies in the range - \pi
27781 - / 2 \leq \atan (x) \leq \pi / 2.
27784 - program test_atan
27785 - real(8) :: x = 2.866_8
27787 - end program test_atan
27790 - Name Argument Return type Standard
27791 - `DATAN(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27795 - Inverse function: *note TAN::
27799 -File: gfortran.info, Node: ATAN2, Next: ATANH, Prev: ATAN, Up: Intrinsic Procedures
27801 -7.22 `ATAN2' -- Arctangent function
27802 -===================================
27805 - `ATAN2(Y, X)' computes the arctangent of the complex number X + i
27809 - Fortran 77 and later
27812 - Elemental function
27815 - `RESULT = ATAN2(Y, X)'
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
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.
27832 - program test_atan2
27833 - real(4) :: x = 1.e0_4, y = 0.5e0_4
27835 - end program test_atan2
27838 - Name Argument Return type Standard
27839 - `DATAN2(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
27843 -File: gfortran.info, Node: ATANH, Next: BESSEL_J0, Prev: ATAN2, Up: Intrinsic Procedures
27845 -7.23 `ATANH' -- Hyperbolic arctangent function
27846 -==============================================
27849 - `ATANH(X)' computes the hyperbolic arctangent of X (inverse of
27853 - Fortran 2008 and later
27856 - Elemental function
27859 - `RESULT = ATANH(X)'
27862 - X The type shall be `REAL' or `COMPLEX'.
27865 - The return value has same type and kind as X.
27868 - PROGRAM test_atanh
27869 - REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
27870 - WRITE (*,*) ATANH(x)
27874 - Name Argument Return type Standard
27875 - `DATANH(X)' `REAL(8) X' `REAL(8)' GNU extension
27878 - Inverse function: *note TANH::
27881 -File: gfortran.info, Node: BESSEL_J0, Next: BESSEL_J1, Prev: ATANH, Up: Intrinsic Procedures
27883 -7.24 `BESSEL_J0' -- Bessel function of the first kind of order 0
27884 -================================================================
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
27892 - Fortran 2008 and later
27895 - Elemental function
27898 - `RESULT = BESSEL_J0(X)'
27901 - X The type shall be `REAL', and it shall be
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.
27909 - program test_besj0
27910 - real(8) :: x = 0.0_8
27912 - end program test_besj0
27915 - Name Argument Return type Standard
27916 - `DBESJ0(X)' `REAL(8) X' `REAL(8)' GNU extension
27919 -File: gfortran.info, Node: BESSEL_J1, Next: BESSEL_JN, Prev: BESSEL_J0, Up: Intrinsic Procedures
27921 -7.25 `BESSEL_J1' -- Bessel function of the first kind of order 1
27922 -================================================================
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
27933 - Elemental function
27936 - `RESULT = BESSEL_J1(X)'
27939 - X The type shall be `REAL', and it shall be
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
27948 - program test_besj1
27949 - real(8) :: x = 1.0_8
27951 - end program test_besj1
27954 - Name Argument Return type Standard
27955 - `DBESJ1(X)' `REAL(8) X' `REAL(8)' GNU extension
27958 -File: gfortran.info, Node: BESSEL_JN, Next: BESSEL_Y0, Prev: BESSEL_J1, Up: Intrinsic Procedures
27960 -7.26 `BESSEL_JN' -- Bessel function of the first kind
27961 -=====================================================
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
27968 - If both arguments are arrays, their ranks and shapes shall conform.
27971 - Fortran 2008 and later
27974 - Elemental function
27977 - `RESULT = BESSEL_JN(N, X)'
27980 - N Shall be a scalar or an array of type
27982 - X Shall be a scalar or an array of type `REAL'.
27985 - The return value is a scalar of type `REAL'. It has the same kind
27989 - program test_besjn
27990 - real(8) :: x = 1.0_8
27991 - x = bessel_jn(5,x)
27992 - end program test_besjn
27995 - Name Argument Return type Standard
27996 - `DBESJN(X)' `INTEGER N' `REAL(8)' GNU extension
28000 -File: gfortran.info, Node: BESSEL_Y0, Next: BESSEL_Y1, Prev: BESSEL_JN, Up: Intrinsic Procedures
28002 -7.27 `BESSEL_Y0' -- Bessel function of the second kind of order 0
28003 -=================================================================
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
28011 - Fortran 2008 and later
28014 - Elemental function
28017 - `RESULT = BESSEL_Y0(X)'
28020 - X The type shall be `REAL', and it shall be
28024 - The return value is a scalar of type `REAL'. It has the same kind
28028 - program test_besy0
28029 - real(8) :: x = 0.0_8
28031 - end program test_besy0
28034 - Name Argument Return type Standard
28035 - `DBESY0(X)' `REAL(8) X' `REAL(8)' GNU extension
28038 -File: gfortran.info, Node: BESSEL_Y1, Next: BESSEL_YN, Prev: BESSEL_Y0, Up: Intrinsic Procedures
28040 -7.28 `BESSEL_Y1' -- Bessel function of the second kind of order 1
28041 -=================================================================
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
28049 - Fortran 2008 and later
28052 - Elemental function
28055 - `RESULT = BESSEL_Y1(X)'
28058 - X The type shall be `REAL', and it shall be
28062 - The return value is a scalar of type `REAL'. It has the same kind
28066 - program test_besy1
28067 - real(8) :: x = 1.0_8
28069 - end program test_besy1
28072 - Name Argument Return type Standard
28073 - `DBESY1(X)' `REAL(8) X' `REAL(8)' GNU extension
28076 -File: gfortran.info, Node: BESSEL_YN, Next: BIT_SIZE, Prev: BESSEL_Y1, Up: Intrinsic Procedures
28078 -7.29 `BESSEL_YN' -- Bessel function of the second kind
28079 -======================================================
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.
28086 - If both arguments are arrays, their ranks and shapes shall conform.
28089 - Fortran 2008 and later
28092 - Elemental function
28095 - `RESULT = BESSEL_YN(N, X)'
28098 - N Shall be a scalar or an array of type
28100 - X Shall be a scalar or an array of type `REAL'.
28103 - The return value is a scalar of type `REAL'. It has the same kind
28107 - program test_besyn
28108 - real(8) :: x = 1.0_8
28109 - x = bessel_yn(5,x)
28110 - end program test_besyn
28113 - Name Argument Return type Standard
28114 - `DBESYN(N,X)' `INTEGER N' `REAL(8)' GNU extension
28119 -File: gfortran.info, Node: BIT_SIZE, Next: BTEST, Prev: BESSEL_YN, Up: Intrinsic Procedures
28121 -7.30 `BIT_SIZE' -- Bit size inquiry function
28122 -============================================
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.
28130 - Fortran 95 and later
28136 - `RESULT = BIT_SIZE(I)'
28139 - I The type shall be `INTEGER'.
28142 - The return value is of type `INTEGER'
28145 - program test_bit_size
28146 - integer :: i = 123
28148 - size = bit_size(i)
28150 - end program test_bit_size
28153 -File: gfortran.info, Node: BTEST, Next: C_ASSOCIATED, Prev: BIT_SIZE, Up: Intrinsic Procedures
28155 -7.31 `BTEST' -- Bit test function
28156 -=================================
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.
28163 - Fortran 95 and later
28166 - Elemental function
28169 - `RESULT = BTEST(I, POS)'
28172 - I The type shall be `INTEGER'.
28173 - POS The type shall be `INTEGER'.
28176 - The return value is of type `LOGICAL'
28179 - program test_btest
28180 - integer :: i = 32768 + 1024 + 64
28184 - bool = btest(i, pos)
28185 - print *, pos, bool
28187 - end program test_btest
28190 -File: gfortran.info, Node: C_ASSOCIATED, Next: C_F_POINTER, Prev: BTEST, Up: Intrinsic Procedures
28192 -7.32 `C_ASSOCIATED' -- Status of a C pointer
28193 -============================================
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
28201 - Fortran 2003 and later
28207 - `RESULT = C_ASSOCIATED(c_prt_1[, c_ptr_2])'
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.
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.
28219 - subroutine association_test(a,b)
28220 - use iso_c_binding, only: c_associated, c_loc, c_ptr
28222 - real, pointer :: a
28224 - if(c_associated(b, c_loc(a))) &
28225 - stop 'b and a do not point to same target'
28226 - end subroutine association_test
28229 - *note C_LOC::, *note C_FUNLOC::
28232 -File: gfortran.info, Node: C_FUNLOC, Next: C_LOC, Prev: C_F_PROCPOINTER, Up: Intrinsic Procedures
28234 -7.33 `C_FUNLOC' -- Obtain the C address of a procedure
28235 -======================================================
28238 - `C_FUNLOC(x)' determines the C address of the argument.
28241 - Fortran 2003 and later
28247 - `RESULT = C_FUNLOC(x)'
28250 - X Interoperable function or pointer to such
28254 - The return value is of type `C_FUNPTR' and contains the C address
28259 - use iso_c_binding
28262 - subroutine sub(a) bind(c)
28263 - real(c_float) :: a
28265 - end subroutine sub
28268 - use iso_c_binding
28272 - subroutine my_routine(p) bind(c,name='myC_func')
28273 - import :: c_funptr
28274 - type(c_funptr), intent(in) :: p
28277 - call my_routine(c_funloc(sub))
28281 - *note C_ASSOCIATED::, *note C_LOC::, *note C_F_POINTER::, *note
28282 - C_F_PROCPOINTER::
28285 -File: gfortran.info, Node: C_F_PROCPOINTER, Next: C_FUNLOC, Prev: C_F_POINTER, Up: Intrinsic Procedures
28287 -7.34 `C_F_PROCPOINTER' -- Convert C into Fortran procedure pointer
28288 -==================================================================
28291 - `C_F_PROCPOINTER(CPTR, FPTR)' Assign the target of the C function
28292 - pointer CPTR to the Fortran procedure pointer FPTR.
28294 - Note: Due to the currently lacking support of procedure pointers
28295 - in GNU Fortran this function is not fully operable.
28298 - Fortran 2003 and later
28304 - `CALL C_F_PROCPOINTER(cptr, fptr)'
28307 - CPTR scalar of the type `C_FUNPTR'. It is
28309 - FPTR procedure pointer interoperable with CPTR. It
28310 - is `INTENT(OUT)'.
28314 - use iso_c_binding
28316 - abstract interface
28318 - import :: c_float
28319 - real(c_float), intent(in) :: a
28320 - real(c_float) :: func
28324 - function getIterFunc() bind(c,name="getIterFunc")
28325 - import :: c_funptr
28326 - type(c_funptr) :: getIterFunc
28329 - type(c_funptr) :: cfunptr
28330 - procedure(func), pointer :: myFunc
28331 - cfunptr = getIterFunc()
28332 - call c_f_procpointer(cfunptr, myFunc)
28336 - *note C_LOC::, *note C_F_POINTER::
28339 -File: gfortran.info, Node: C_F_POINTER, Next: C_F_PROCPOINTER, Prev: C_ASSOCIATED, Up: Intrinsic Procedures
28341 -7.35 `C_F_POINTER' -- Convert C into Fortran pointer
28342 -====================================================
28345 - `C_F_POINTER(CPTR, FPTR[, SHAPE])' Assign the target the C pointer
28346 - CPTR to the Fortran pointer FPTR and specify its shape.
28349 - Fortran 2003 and later
28355 - `CALL C_F_POINTER(CPTR, FPTR[, SHAPE])'
28358 - CPTR scalar of the type `C_PTR'. It is `INTENT(IN)'.
28359 - FPTR pointer interoperable with CPTR. It is
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.
28368 - use iso_c_binding
28371 - subroutine my_routine(p) bind(c,name='myC_func')
28373 - type(c_ptr), intent(out) :: p
28376 - type(c_ptr) :: cptr
28377 - real,pointer :: a(:)
28378 - call my_routine(cptr)
28379 - call c_f_pointer(cptr, a, [12])
28383 - *note C_LOC::, *note C_F_PROCPOINTER::
28386 -File: gfortran.info, Node: C_LOC, Next: C_SIZEOF, Prev: C_FUNLOC, Up: Intrinsic Procedures
28388 -7.36 `C_LOC' -- Obtain the C address of an object
28389 -=================================================
28392 - `C_LOC(X)' determines the C address of the argument.
28395 - Fortran 2003 and later
28401 - `RESULT = C_LOC(X)'
28404 - X Associated scalar pointer or interoperable
28405 - scalar or allocated allocatable variable with
28406 - `TARGET' attribute.
28409 - The return value is of type `C_PTR' and contains the C address of
28413 - subroutine association_test(a,b)
28414 - use iso_c_binding, only: c_associated, c_loc, c_ptr
28416 - real, pointer :: a
28418 - if(c_associated(b, c_loc(a))) &
28419 - stop 'b and a do not point to same target'
28420 - end subroutine association_test
28423 - *note C_ASSOCIATED::, *note C_FUNLOC::, *note C_F_POINTER::, *note
28424 - C_F_PROCPOINTER::
28427 -File: gfortran.info, Node: C_SIZEOF, Next: CEILING, Prev: C_LOC, Up: Intrinsic Procedures
28429 -7.37 `C_SIZEOF' -- Size in bytes of an expression
28430 -=================================================
28433 - `C_SIZEOF(X)' calculates the number of bytes of storage the
28434 - expression `X' occupies.
28440 - Intrinsic function
28443 - `N = C_SIZEOF(X)'
28446 - X The argument shall be of any type, rank or
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.
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)
28464 - The example will print `.TRUE.' unless you are using a platform
28465 - where default `REAL' variables are unusually padded.
28471 -File: gfortran.info, Node: CEILING, Next: CHAR, Prev: C_SIZEOF, Up: Intrinsic Procedures
28473 -7.38 `CEILING' -- Integer ceiling function
28474 -==========================================
28477 - `CEILING(A)' returns the least integer greater than or equal to A.
28480 - Fortran 95 and later
28483 - Elemental function
28486 - `RESULT = CEILING(A [, KIND])'
28489 - A The type shall be `REAL'.
28490 - KIND (Optional) An `INTEGER' initialization
28491 - expression indicating the kind parameter of
28495 - The return value is of type `INTEGER(KIND)' if KIND is present and
28496 - a default-kind `INTEGER' otherwise.
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
28507 - *note FLOOR::, *note NINT::
28511 -File: gfortran.info, Node: CHAR, Next: CHDIR, Prev: CEILING, Up: Intrinsic Procedures
28513 -7.39 `CHAR' -- Character conversion function
28514 -============================================
28517 - `CHAR(I [, KIND])' returns the character represented by the
28521 - Fortran 77 and later
28524 - Elemental function
28527 - `RESULT = CHAR(I [, KIND])'
28530 - I The type shall be `INTEGER'.
28531 - KIND (Optional) An `INTEGER' initialization
28532 - expression indicating the kind parameter of
28536 - The return value is of type `CHARACTER(1)'
28539 - program test_char
28540 - integer :: i = 74
28541 - character(1) :: c
28543 - print *, i, c ! returns 'J'
28544 - end program test_char
28547 - See *note ICHAR:: for a discussion of converting between numerical
28548 - values and formatted string representations.
28551 - *note ACHAR::, *note IACHAR::, *note ICHAR::
28555 -File: gfortran.info, Node: CHDIR, Next: CHMOD, Prev: CHAR, Up: Intrinsic Procedures
28557 -7.40 `CHDIR' -- Change working directory
28558 -========================================
28561 - Change current working directory to a specified path.
28563 - This intrinsic is provided in both subroutine and function forms;
28564 - however, only one form can be used in any given program unit.
28570 - Subroutine, function
28573 - `CALL CHDIR(NAME [, STATUS])'
28574 - `STATUS = CHDIR(NAME)'
28577 - NAME The type shall be `CHARACTER' of default kind
28578 - and shall specify a valid path within the file
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.
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)
28598 -File: gfortran.info, Node: CHMOD, Next: CMPLX, Prev: CHDIR, Up: Intrinsic Procedures
28600 -7.41 `CHMOD' -- Change access permissions of files
28601 -==================================================
28604 - `CHMOD' changes the permissions of a file. This function invokes
28605 - `/bin/chmod' and might therefore not work on all platforms.
28607 - This intrinsic is provided in both subroutine and function forms;
28608 - however, only one form can be used in any given program unit.
28614 - Subroutine, function
28617 - `CALL CHMOD(NAME, MODE[, STATUS])'
28618 - `STATUS = CHMOD(NAME, MODE)'
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.
28633 - In either syntax, STATUS is set to `0' on success and nonzero
28637 - `CHMOD' as subroutine
28638 - program chmod_test
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
28647 - integer :: status
28648 - status = chmod('test.dat','u+x')
28649 - print *, 'Status: ', status
28650 - end program chmod_test
28654 -File: gfortran.info, Node: CMPLX, Next: COMMAND_ARGUMENT_COUNT, Prev: CHMOD, Up: Intrinsic Procedures
28656 -7.42 `CMPLX' -- Complex conversion function
28657 -===========================================
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
28667 - Fortran 77 and later
28670 - Elemental function
28673 - `RESULT = CMPLX(X [, Y [, KIND]])'
28676 - X The type may be `INTEGER', `REAL', or
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
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.
28690 - program test_cmplx
28691 - integer :: i = 42
28695 - print *, z, cmplx(x)
28696 - end program test_cmplx
28702 -File: gfortran.info, Node: COMMAND_ARGUMENT_COUNT, Next: COMPLEX, Prev: CMPLX, Up: Intrinsic Procedures
28704 -7.43 `COMMAND_ARGUMENT_COUNT' -- Get number of command line arguments
28705 -=====================================================================
28708 - `COMMAND_ARGUMENT_COUNT()' returns the number of arguments passed
28709 - on the command line when the containing program was invoked.
28712 - Fortran 2003 and later
28718 - `RESULT = COMMAND_ARGUMENT_COUNT()'
28724 - The return value is of type `INTEGER(4)'
28727 - program test_command_argument_count
28729 - count = command_argument_count()
28731 - end program test_command_argument_count
28734 - *note GET_COMMAND::, *note GET_COMMAND_ARGUMENT::
28737 -File: gfortran.info, Node: COMPLEX, Next: CONJG, Prev: COMMAND_ARGUMENT_COUNT, Up: Intrinsic Procedures
28739 -7.44 `COMPLEX' -- Complex conversion function
28740 -=============================================
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.
28750 - Elemental function
28753 - `RESULT = COMPLEX(X, Y)'
28756 - X The type may be `INTEGER' or `REAL'.
28757 - Y The type may be `INTEGER' or `REAL'.
28760 - If X and Y are both of `INTEGER' type, then the return value is of
28761 - default `COMPLEX' type.
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
28769 - program test_complex
28770 - integer :: i = 42
28772 - print *, complex(i, x)
28773 - end program test_complex
28779 -File: gfortran.info, Node: CONJG, Next: COS, Prev: COMPLEX, Up: Intrinsic Procedures
28781 -7.45 `CONJG' -- Complex conjugate function
28782 -==========================================
28785 - `CONJG(Z)' returns the conjugate of Z. If Z is `(x, y)' then the
28786 - result is `(x, -y)'
28789 - Fortran 77 and later, has overloads that are GNU extensions
28792 - Elemental function
28798 - Z The type shall be `COMPLEX'.
28801 - The return value is of type `COMPLEX'.
28804 - program test_conjg
28805 - complex :: z = (2.0, 3.0)
28806 - complex(8) :: dz = (2.71_8, -3.14_8)
28811 - end program test_conjg
28814 - Name Argument Return type Standard
28815 - `DCONJG(Z)' `COMPLEX(8) `COMPLEX(8)' GNU extension
28819 -File: gfortran.info, Node: COS, Next: COSH, Prev: CONJG, Up: Intrinsic Procedures
28821 -7.46 `COS' -- Cosine function
28822 -=============================
28825 - `COS(X)' computes the cosine of X.
28828 - Fortran 77 and later, has overloads that are GNU extensions
28831 - Elemental function
28834 - `RESULT = COS(X)'
28837 - X The type shall be `REAL' or `COMPLEX'.
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.
28847 - end program test_cos
28850 - Name Argument Return type Standard
28851 - `DCOS(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
28853 - `CCOS(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 77 and
28855 - `ZCOS(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
28857 - `CDCOS(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
28861 - Inverse function: *note ACOS::
28865 -File: gfortran.info, Node: COSH, Next: COUNT, Prev: COS, Up: Intrinsic Procedures
28867 -7.47 `COSH' -- Hyperbolic cosine function
28868 -=========================================
28871 - `COSH(X)' computes the hyperbolic cosine of X.
28874 - Fortran 77 and later
28877 - Elemental function
28883 - X The type shall be `REAL'.
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.
28891 - program test_cosh
28892 - real(8) :: x = 1.0_8
28894 - end program test_cosh
28897 - Name Argument Return type Standard
28898 - `DCOSH(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
28902 - Inverse function: *note ACOSH::
28906 -File: gfortran.info, Node: COUNT, Next: CPU_TIME, Prev: COSH, Up: Intrinsic Procedures
28908 -7.48 `COUNT' -- Count function
28909 -==============================
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.
28918 - Fortran 95 and later, with KIND argument Fortran 2003 and later
28921 - Transformational function
28924 - `RESULT = COUNT(MASK [, DIM [, KIND]])'
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
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.
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,:)
28947 - print '(3i3)', b(1,:)
28948 - print '(3i3)', b(2,:)
28951 - print '(3l3)', mask(1,:)
28952 - print '(3l3)', mask(2,:)
28954 - print '(3i3)', count(mask)
28956 - print '(3i3)', count(mask, 1)
28958 - print '(3i3)', count(mask, 2)
28959 - end program test_count
28962 -File: gfortran.info, Node: CPU_TIME, Next: CSHIFT, Prev: COUNT, Up: Intrinsic Procedures
28964 -7.49 `CPU_TIME' -- CPU elapsed time in seconds
28965 -==============================================
28968 - Returns a `REAL' value representing the elapsed CPU time in
28969 - seconds. This is useful for testing segments of code to determine
28972 - If a time source is available, time will be reported with
28973 - microsecond resolution. If no time source is available, TIME is
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.
28982 - Fortran 95 and later
28988 - `CALL CPU_TIME(TIME)'
28991 - TIME The type shall be `REAL' with `INTENT(OUT)'.
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
29006 - *note SYSTEM_CLOCK::, *note DATE_AND_TIME::
29009 -File: gfortran.info, Node: CSHIFT, Next: CTIME, Prev: CPU_TIME, Up: Intrinsic Procedures
29011 -7.50 `CSHIFT' -- Circular shift elements of an array
29012 -====================================================
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.
29026 - Fortran 95 and later
29029 - Transformational function
29032 - `RESULT = CSHIFT(ARRAY, SHIFT [, DIM])'
29035 - ARRAY Shall be an array of any type.
29036 - SHIFT The type shall be `INTEGER'.
29037 - DIM The type shall be `INTEGER'.
29040 - Returns an array of same type and rank as the ARRAY argument.
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)
29051 - print '(3i3)', a(1,:)
29052 - print '(3i3)', a(2,:)
29053 - print '(3i3)', a(3,:)
29054 - end program test_cshift
29057 -File: gfortran.info, Node: CTIME, Next: DATE_AND_TIME, Prev: CSHIFT, Up: Intrinsic Procedures
29059 -7.51 `CTIME' -- Convert a time into a string
29060 -============================================
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'.
29066 - This intrinsic is provided in both subroutine and function forms;
29067 - however, only one form can be used in any given program unit.
29073 - Subroutine, function
29076 - `CALL CTIME(TIME, RESULT)'.
29077 - `RESULT = CTIME(TIME)', (not recommended).
29080 - TIME The type shall be of type `INTEGER(KIND=8)'.
29081 - RESULT The type shall be of type `CHARACTER' and of
29085 - The converted date and time as a string.
29088 - program test_ctime
29090 - character(len=30) :: date
29093 - ! Do something, main part of the program
29095 - call ctime(i,date)
29096 - print *, 'Program was started on ', date
29097 - end program test_ctime
29100 - *note GMTIME::, *note LTIME::, *note TIME::, *note TIME8::
29103 -File: gfortran.info, Node: DATE_AND_TIME, Next: DBLE, Prev: CTIME, Up: Intrinsic Procedures
29105 -7.52 `DATE_AND_TIME' -- Date and time subroutine
29106 -================================================
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.
29116 - VALUES is `INTENT(OUT)' and provides the following:
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
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
29130 - Fortran 95 and later
29136 - `CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])'
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
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)'.
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
29167 - *note CPU_TIME::, *note SYSTEM_CLOCK::
29170 -File: gfortran.info, Node: DBLE, Next: DCMPLX, Prev: DATE_AND_TIME, Up: Intrinsic Procedures
29172 -7.53 `DBLE' -- Double conversion function
29173 -=========================================
29176 - `DBLE(A)' Converts A to double precision real type.
29179 - Fortran 77 and later
29182 - Elemental function
29185 - `RESULT = DBLE(A)'
29188 - A The type shall be `INTEGER', `REAL', or
29192 - The return value is of type double precision real.
29195 - program test_dble
29198 - complex :: z = (2.3,1.14)
29199 - print *, dble(x), dble(i), dble(z)
29200 - end program test_dble
29203 - *note DFLOAT::, *note FLOAT::, *note REAL::
29206 -File: gfortran.info, Node: DCMPLX, Next: DFLOAT, Prev: DBLE, Up: Intrinsic Procedures
29208 -7.54 `DCMPLX' -- Double complex conversion function
29209 -===================================================
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
29222 - Elemental function
29225 - `RESULT = DCMPLX(X [, Y])'
29228 - X The type may be `INTEGER', `REAL', or
29230 - Y (Optional if X is not `COMPLEX'.) May be
29231 - `INTEGER' or `REAL'.
29234 - The return value is of type `COMPLEX(8)'
29237 - program test_dcmplx
29238 - integer :: i = 42
29242 - print *, dcmplx(i)
29243 - print *, dcmplx(x)
29244 - print *, dcmplx(z)
29245 - print *, dcmplx(x,i)
29246 - end program test_dcmplx
29249 -File: gfortran.info, Node: DFLOAT, Next: DIGITS, Prev: DCMPLX, Up: Intrinsic Procedures
29251 -7.55 `DFLOAT' -- Double conversion function
29252 -===========================================
29255 - `DFLOAT(A)' Converts A to double precision real type.
29261 - Elemental function
29264 - `RESULT = DFLOAT(A)'
29267 - A The type shall be `INTEGER'.
29270 - The return value is of type double precision real.
29273 - program test_dfloat
29275 - print *, dfloat(i)
29276 - end program test_dfloat
29279 - *note DBLE::, *note FLOAT::, *note REAL::
29282 -File: gfortran.info, Node: DIGITS, Next: DIM, Prev: DFLOAT, Up: Intrinsic Procedures
29284 -7.56 `DIGITS' -- Significant binary digits function
29285 -===================================================
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.
29294 - Fortran 95 and later
29300 - `RESULT = DIGITS(X)'
29303 - X The type may be `INTEGER' or `REAL'.
29306 - The return value is of type `INTEGER'.
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
29319 -File: gfortran.info, Node: DIM, Next: DOT_PRODUCT, Prev: DIGITS, Up: Intrinsic Procedures
29321 -7.57 `DIM' -- Positive difference
29322 -=================================
29325 - `DIM(X,Y)' returns the difference `X-Y' if the result is positive;
29326 - otherwise returns zero.
29329 - Fortran 77 and later
29332 - Elemental function
29335 - `RESULT = DIM(X, Y)'
29338 - X The type shall be `INTEGER' or `REAL'
29339 - Y The type shall be the same type and kind as X.
29342 - The return value is of type `INTEGER' or `REAL'.
29349 - x = dim(4.345_8, 2.111_8)
29352 - end program test_dim
29355 - Name Argument Return type Standard
29356 - `IDIM(X,Y)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
29358 - `DDIM(X,Y)' `REAL(8) `REAL(8)' Fortran 77 and
29362 -File: gfortran.info, Node: DOT_PRODUCT, Next: DPROD, Prev: DIM, Up: Intrinsic Procedures
29364 -7.58 `DOT_PRODUCT' -- Dot product function
29365 -==========================================
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.
29378 - Fortran 95 and later
29381 - Transformational function
29384 - `RESULT = DOT_PRODUCT(VECTOR_A, VECTOR_B)'
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
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.'.
29399 - program test_dot_prod
29400 - integer, dimension(3) :: a, b
29401 - a = (/ 1, 2, 3 /)
29402 - b = (/ 4, 5, 6 /)
29407 - print *, dot_product(a,b)
29408 - end program test_dot_prod
29411 -File: gfortran.info, Node: DPROD, Next: DREAL, Prev: DOT_PRODUCT, Up: Intrinsic Procedures
29413 -7.59 `DPROD' -- Double product function
29414 -=======================================
29417 - `DPROD(X,Y)' returns the product `X*Y'.
29420 - Fortran 77 and later
29423 - Elemental function
29426 - `RESULT = DPROD(X, Y)'
29429 - X The type shall be `REAL'.
29430 - Y The type shall be `REAL'.
29433 - The return value is of type `REAL(8)'.
29436 - program test_dprod
29442 - end program test_dprod
29445 -File: gfortran.info, Node: DREAL, Next: DTIME, Prev: DPROD, Up: Intrinsic Procedures
29447 -7.60 `DREAL' -- Double real part function
29448 -=========================================
29451 - `DREAL(Z)' returns the real part of complex variable Z.
29457 - Elemental function
29460 - `RESULT = DREAL(A)'
29463 - A The type shall be `COMPLEX(8)'.
29466 - The return value is of type `REAL(8)'.
29469 - program test_dreal
29470 - complex(8) :: z = (1.3_8,7.2_8)
29471 - print *, dreal(z)
29472 - end program test_dreal
29479 -File: gfortran.info, Node: DTIME, Next: EOSHIFT, Prev: DREAL, Up: Intrinsic Procedures
29481 -7.61 `DTIME' -- Execution time subroutine (or function)
29482 -=======================================================
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)'.
29491 - Subsequent invocations of `DTIME' return values accumulated since
29492 - the previous invocation.
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
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.
29508 - This intrinsic is provided in both subroutine and function forms;
29509 - however, only one form can be used in any given program unit.
29511 - TARRAY and RESULT are `INTENT(OUT)' and provide the following:
29513 - `TARRAY(1)': User time in seconds.
29514 - `TARRAY(2)': System time in seconds.
29515 - `RESULT': Run time since start in
29522 - Subroutine, function
29525 - `CALL DTIME(TARRAY, RESULT)'.
29526 - `RESULT = DTIME(TARRAY)', (not recommended).
29529 - TARRAY The type shall be `REAL, DIMENSION(2)'.
29530 - RESULT The type shall be `REAL'.
29533 - Elapsed time in seconds since the last invocation or since the
29534 - start of program execution if not called before.
29537 - program test_dtime
29538 - integer(8) :: i, j
29539 - real, dimension(2) :: tarray
29541 - call dtime(tarray, result)
29543 - print *, tarray(1)
29544 - print *, tarray(2)
29545 - do i=1,100000000 ! Just a delay
29548 - call dtime(tarray, result)
29550 - print *, tarray(1)
29551 - print *, tarray(2)
29552 - end program test_dtime
29559 -File: gfortran.info, Node: EOSHIFT, Next: EPSILON, Prev: DTIME, Up: Intrinsic Procedures
29561 -7.62 `EOSHIFT' -- End-off shift elements of an array
29562 -====================================================
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
29578 - _Array _Boundary Value_
29580 - Numeric 0 of the type and kind of ARRAY.
29581 - Logical `.FALSE.'.
29582 - Character(LEN)LEN blanks.
29585 - Fortran 95 and later
29588 - Transformational function
29591 - `RESULT = EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])'
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'.
29600 - Returns an array of same type and rank as the ARRAY argument.
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)
29611 - print '(3i3)', a(1,:)
29612 - print '(3i3)', a(2,:)
29613 - print '(3i3)', a(3,:)
29614 - end program test_eoshift
29617 -File: gfortran.info, Node: EPSILON, Next: ERF, Prev: EOSHIFT, Up: Intrinsic Procedures
29619 -7.63 `EPSILON' -- Epsilon function
29620 -==================================
29623 - `EPSILON(X)' returns the smallest number E of the same kind as X
29624 - such that 1 + E > 1.
29627 - Fortran 95 and later
29633 - `RESULT = EPSILON(X)'
29636 - X The type shall be `REAL'.
29639 - The return value is of same type as the argument.
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
29650 -File: gfortran.info, Node: ERF, Next: ERFC, Prev: EPSILON, Up: Intrinsic Procedures
29652 -7.64 `ERF' -- Error function
29653 -============================
29656 - `ERF(X)' computes the error function of X.
29659 - Fortran 2008 and later
29662 - Elemental function
29665 - `RESULT = ERF(X)'
29668 - X The type shall be `REAL'.
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 .
29676 - real(8) :: x = 0.17_8
29678 - end program test_erf
29681 - Name Argument Return type Standard
29682 - `DERF(X)' `REAL(8) X' `REAL(8)' GNU extension
29685 -File: gfortran.info, Node: ERFC, Next: ERFC_SCALED, Prev: ERF, Up: Intrinsic Procedures
29687 -7.65 `ERFC' -- Error function
29688 -=============================
29691 - `ERFC(X)' computes the complementary error function of X.
29694 - Fortran 2008 and later
29697 - Elemental function
29700 - `RESULT = ERFC(X)'
29703 - X The type shall be `REAL'.
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 .
29710 - program test_erfc
29711 - real(8) :: x = 0.17_8
29713 - end program test_erfc
29716 - Name Argument Return type Standard
29717 - `DERFC(X)' `REAL(8) X' `REAL(8)' GNU extension
29720 -File: gfortran.info, Node: ERFC_SCALED, Next: ETIME, Prev: ERFC, Up: Intrinsic Procedures
29722 -7.66 `ERFC_SCALED' -- Error function
29723 -====================================
29726 - `ERFC_SCALED(X)' computes the exponentially-scaled complementary
29727 - error function of X.
29730 - Fortran 2008 and later
29733 - Elemental function
29736 - `RESULT = ERFC_SCALED(X)'
29739 - X The type shall be `REAL'.
29742 - The return value is of type `REAL' and of the same kind as X.
29745 - program test_erfc_scaled
29746 - real(8) :: x = 0.17_8
29747 - x = erfc_scaled(x)
29748 - end program test_erfc_scaled
29751 -File: gfortran.info, Node: ETIME, Next: EXIT, Prev: ERFC_SCALED, Up: Intrinsic Procedures
29753 -7.67 `ETIME' -- Execution time subroutine (or function)
29754 -=======================================================
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) +
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
29770 - This intrinsic is provided in both subroutine and function forms;
29771 - however, only one form can be used in any given program unit.
29773 - TARRAY and RESULT are `INTENT(OUT)' and provide the following:
29775 - `TARRAY(1)': User time in seconds.
29776 - `TARRAY(2)': System time in seconds.
29777 - `RESULT': Run time since start in seconds.
29783 - Subroutine, function
29786 - `CALL ETIME(TARRAY, RESULT)'.
29787 - `RESULT = ETIME(TARRAY)', (not recommended).
29790 - TARRAY The type shall be `REAL, DIMENSION(2)'.
29791 - RESULT The type shall be `REAL'.
29794 - Elapsed time in seconds since the start of program execution.
29797 - program test_etime
29798 - integer(8) :: i, j
29799 - real, dimension(2) :: tarray
29801 - call ETIME(tarray, result)
29803 - print *, tarray(1)
29804 - print *, tarray(2)
29805 - do i=1,100000000 ! Just a delay
29808 - call ETIME(tarray, result)
29810 - print *, tarray(1)
29811 - print *, tarray(2)
29812 - end program test_etime
29819 -File: gfortran.info, Node: EXIT, Next: EXP, Prev: ETIME, Up: Intrinsic Procedures
29821 -7.68 `EXIT' -- Exit the program with status.
29822 -============================================
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.
29836 - `CALL EXIT([STATUS])'
29839 - STATUS Shall be an `INTEGER' of the default kind.
29842 - `STATUS' is passed to the parent process on exit.
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
29852 - *note ABORT::, *note KILL::
29855 -File: gfortran.info, Node: EXP, Next: EXPONENT, Prev: EXIT, Up: Intrinsic Procedures
29857 -7.69 `EXP' -- Exponential function
29858 -==================================
29861 - `EXP(X)' computes the base e exponential of X.
29864 - Fortran 77 and later, has overloads that are GNU extensions
29867 - Elemental function
29870 - `RESULT = EXP(X)'
29873 - X The type shall be `REAL' or `COMPLEX'.
29876 - The return value has same type and kind as X.
29882 - end program test_exp
29885 - Name Argument Return type Standard
29886 - `DEXP(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
29888 - `CEXP(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 77 and
29890 - `ZEXP(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
29892 - `CDEXP(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
29896 -File: gfortran.info, Node: EXPONENT, Next: FDATE, Prev: EXP, Up: Intrinsic Procedures
29898 -7.70 `EXPONENT' -- Exponent function
29899 -====================================
29902 - `EXPONENT(X)' returns the value of the exponent part of X. If X is
29903 - zero the value returned is zero.
29906 - Fortran 95 and later
29909 - Elemental function
29912 - `RESULT = EXPONENT(X)'
29915 - X The type shall be `REAL'.
29918 - The return value is of type default `INTEGER'.
29921 - program test_exponent
29926 - print *, exponent(0.0)
29927 - end program test_exponent
29930 -File: gfortran.info, Node: FDATE, Next: FGET, Prev: EXPONENT, Up: Intrinsic Procedures
29932 -7.71 `FDATE' -- Get the current time as a string
29933 -================================================
29936 - `FDATE(DATE)' returns the current date (using the same format as
29937 - `CTIME') in DATE. It is equivalent to `CALL CTIME(DATE, TIME())'.
29939 - This intrinsic is provided in both subroutine and function forms;
29940 - however, only one form can be used in any given program unit.
29942 - DATE is an `INTENT(OUT)' `CHARACTER' variable of the default kind.
29948 - Subroutine, function
29951 - `CALL FDATE(DATE)'.
29952 - `DATE = FDATE()', (not recommended).
29955 - DATE The type shall be of type `CHARACTER' of the
29959 - The current date as a string.
29962 - program test_fdate
29963 - integer(8) :: i, j
29964 - character(len=30) :: date
29966 - print *, 'Program started on ', date
29967 - do i = 1, 100000000 ! Just a delay
29971 - print *, 'Program ended on ', date
29972 - end program test_fdate
29975 -File: gfortran.info, Node: FLOAT, Next: FLOOR, Prev: FGETC, Up: Intrinsic Procedures
29977 -7.72 `FLOAT' -- Convert integer to default real
29978 -===============================================
29981 - `FLOAT(A)' converts the integer A to a default real value.
29984 - Fortran 77 and later
29987 - Elemental function
29990 - `RESULT = FLOAT(A)'
29993 - A The type shall be `INTEGER'.
29996 - The return value is of type default `REAL'.
29999 - program test_float
30001 - if (float(i) /= 1.) call abort
30002 - end program test_float
30005 - *note DBLE::, *note DFLOAT::, *note REAL::
30008 -File: gfortran.info, Node: FGET, Next: FGETC, Prev: FDATE, Up: Intrinsic Procedures
30010 -7.73 `FGET' -- Read a single character in stream mode from stdin
30011 -================================================================
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.
30019 - This intrinsic is provided in both subroutine and function forms;
30020 - however, only one form can be used in any given program unit.
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::.
30032 - Subroutine, function
30035 - `CALL FGET(C [, STATUS])'
30038 - C The type shall be `CHARACTER' and of default
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.
30045 - PROGRAM test_fget
30046 - INTEGER, PARAMETER :: strlen = 100
30047 - INTEGER :: status, i = 1
30048 - CHARACTER(len=strlen) :: str = ""
30050 - WRITE (*,*) 'Enter text:'
30052 - CALL fget(str(i:i), status)
30053 - if (status /= 0 .OR. i > strlen) exit
30056 - WRITE (*,*) TRIM(str)
30060 - *note FGETC::, *note FPUT::, *note FPUTC::
30063 -File: gfortran.info, Node: FGETC, Next: FLOAT, Prev: FGET, Up: Intrinsic Procedures
30065 -7.74 `FGETC' -- Read a single character in stream mode
30066 -======================================================
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.
30074 - This intrinsic is provided in both subroutine and function forms;
30075 - however, only one form can be used in any given program unit.
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::.
30087 - Subroutine, function
30090 - `CALL FGETC(UNIT, C [, STATUS])'
30093 - UNIT The type shall be `INTEGER'.
30094 - C The type shall be `CHARACTER' and of default
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.
30101 - PROGRAM test_fgetc
30102 - INTEGER :: fd = 42, status
30105 - OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
30107 - CALL fgetc(fd, c, status)
30108 - IF (status /= 0) EXIT
30115 - *note FGET::, *note FPUT::, *note FPUTC::
30118 -File: gfortran.info, Node: FLOOR, Next: FLUSH, Prev: FLOAT, Up: Intrinsic Procedures
30120 -7.75 `FLOOR' -- Integer floor function
30121 -======================================
30124 - `FLOOR(A)' returns the greatest integer less than or equal to X.
30127 - Fortran 95 and later
30130 - Elemental function
30133 - `RESULT = FLOOR(A [, KIND])'
30136 - A The type shall be `REAL'.
30137 - KIND (Optional) An `INTEGER' initialization
30138 - expression indicating the kind parameter of
30142 - The return value is of type `INTEGER(KIND)' if KIND is present and
30143 - of default-kind `INTEGER' otherwise.
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
30154 - *note CEILING::, *note NINT::
30158 -File: gfortran.info, Node: FLUSH, Next: FNUM, Prev: FLOOR, Up: Intrinsic Procedures
30160 -7.76 `FLUSH' -- Flush I/O unit(s)
30161 -=================================
30164 - Flushes Fortran unit(s) currently open for output. Without the
30165 - optional argument, all units are flushed, otherwise just the unit
30175 - `CALL FLUSH(UNIT)'
30178 - UNIT (Optional) The type shall be `INTEGER'.
30181 - Beginning with the Fortran 2003 standard, there is a `FLUSH'
30182 - statement that should be preferred over the `FLUSH' intrinsic.
30186 -File: gfortran.info, Node: FNUM, Next: FPUT, Prev: FLUSH, Up: Intrinsic Procedures
30188 -7.77 `FNUM' -- File number function
30189 -===================================
30192 - `FNUM(UNIT)' returns the POSIX file descriptor number
30193 - corresponding to the open Fortran I/O unit `UNIT'.
30202 - `RESULT = FNUM(UNIT)'
30205 - UNIT The type shall be `INTEGER'.
30208 - The return value is of type `INTEGER'
30211 - program test_fnum
30213 - open (unit=10, status = "scratch")
30217 - end program test_fnum
30220 -File: gfortran.info, Node: FPUT, Next: FPUTC, Prev: FNUM, Up: Intrinsic Procedures
30222 -7.78 `FPUT' -- Write a single character in stream mode to stdout
30223 -================================================================
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.
30231 - This intrinsic is provided in both subroutine and function forms;
30232 - however, only one form can be used in any given program unit.
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::.
30244 - Subroutine, function
30247 - `CALL FPUT(C [, STATUS])'
30250 - C The type shall be `CHARACTER' and of default
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.
30257 - PROGRAM test_fput
30258 - CHARACTER(len=10) :: str = "gfortran"
30260 - DO i = 1, len_trim(str)
30261 - CALL fput(str(i:i))
30266 - *note FPUTC::, *note FGET::, *note FGETC::
30269 -File: gfortran.info, Node: FPUTC, Next: FRACTION, Prev: FPUT, Up: Intrinsic Procedures
30271 -7.79 `FPUTC' -- Write a single character in stream mode
30272 -=======================================================
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.
30280 - This intrinsic is provided in both subroutine and function forms;
30281 - however, only one form can be used in any given program unit.
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::.
30293 - Subroutine, function
30296 - `CALL FPUTC(UNIT, C [, STATUS])'
30299 - UNIT The type shall be `INTEGER'.
30300 - C The type shall be `CHARACTER' and of default
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.
30307 - PROGRAM test_fputc
30308 - CHARACTER(len=10) :: str = "gfortran"
30309 - INTEGER :: fd = 42, i
30311 - OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
30312 - DO i = 1, len_trim(str)
30313 - CALL fputc(fd, str(i:i))
30319 - *note FPUT::, *note FGET::, *note FGETC::
30322 -File: gfortran.info, Node: FRACTION, Next: FREE, Prev: FPUTC, Up: Intrinsic Procedures
30324 -7.80 `FRACTION' -- Fractional part of the model representation
30325 -==============================================================
30328 - `FRACTION(X)' returns the fractional part of the model
30329 - representation of `X'.
30332 - Fortran 95 and later
30335 - Elemental function
30338 - `Y = FRACTION(X)'
30341 - X The type of the argument shall be a `REAL'.
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))'.
30349 - program test_fraction
30352 - print *, fraction(x), x * radix(x)**(-exponent(x))
30353 - end program test_fraction
30357 -File: gfortran.info, Node: FREE, Next: FSEEK, Prev: FRACTION, Up: Intrinsic Procedures
30359 -7.81 `FREE' -- Frees memory
30360 -===========================
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'.
30379 - PTR The type shall be `INTEGER'. It represents the
30380 - location of the memory that should be
30387 - See `MALLOC' for an example.
30393 -File: gfortran.info, Node: FSEEK, Next: FSTAT, Prev: FREE, Up: Intrinsic Procedures
30395 -7.82 `FSEEK' -- Low level file positioning subroutine
30396 -=====================================================
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
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)
30411 - INTEGER :: status
30412 - CALL FSEEK(UNIT, OFFSET, WHENCE, status)
30413 - IF (status /= 0) GOTO label
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
30427 - `CALL FSEEK(UNIT, OFFSET, WHENCE[, STATUS])'
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
30438 - PROGRAM test_fseek
30439 - INTEGER, PARAMETER :: SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2
30440 - INTEGER :: fd, offset, ierr
30446 - OPEN(UNIT=fd, FILE="fseek.test")
30447 - CALL FSEEK(fd, offset, SEEK_SET, ierr) ! move to OFFSET
30448 - print *, FTELL(fd), ierr
30450 - CALL FSEEK(fd, 0, SEEK_END, ierr) ! move to end
30451 - print *, FTELL(fd), ierr
30453 - CALL FSEEK(fd, 0, SEEK_SET, ierr) ! move to beginning
30454 - print *, FTELL(fd), ierr
30463 -File: gfortran.info, Node: FSTAT, Next: FTELL, Prev: FSEEK, Up: Intrinsic Procedures
30465 -7.83 `FSTAT' -- Get file status
30466 -===============================
30469 - `FSTAT' is identical to *note STAT::, except that information
30470 - about an already opened file is obtained.
30472 - The elements in `BUFF' are the same as described by *note STAT::.
30474 - This intrinsic is provided in both subroutine and function forms;
30475 - however, only one form can be used in any given program unit.
30481 - Subroutine, function
30484 - `CALL FSTAT(UNIT, BUFF [, STATUS])'
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.
30494 - See *note STAT:: for an example.
30497 - To stat a link: *note LSTAT::, to stat a file: *note STAT::
30500 -File: gfortran.info, Node: FTELL, Next: GAMMA, Prev: FSTAT, Up: Intrinsic Procedures
30502 -7.84 `FTELL' -- Current stream position
30503 -=======================================
30506 - Retrieves the current position within an open file.
30508 - This intrinsic is provided in both subroutine and function forms;
30509 - however, only one form can be used in any given program unit.
30515 - Subroutine, function
30518 - `CALL FTELL(UNIT, OFFSET)'
30519 - `OFFSET = FTELL(UNIT)'
30522 - OFFSET Shall of type `INTEGER'.
30523 - UNIT Shall of type `INTEGER'.
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.
30530 - PROGRAM test_ftell
30532 - OPEN(10, FILE="temp.dat")
30541 -File: gfortran.info, Node: GAMMA, Next: GERROR, Prev: FTELL, Up: Intrinsic Procedures
30543 -7.85 `GAMMA' -- Gamma function
30544 -==============================
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)!.
30552 - Fortran 2008 and later
30555 - Elemental function
30561 - X Shall be of type `REAL' and neither zero nor a
30562 - negative integer.
30565 - The return value is of type `REAL' of the same kind as X.
30568 - program test_gamma
30570 - x = gamma(x) ! returns 1.0
30571 - end program test_gamma
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
30579 - Logarithm of the Gamma function: *note LOG_GAMMA::
30583 -File: gfortran.info, Node: GERROR, Next: GETARG, Prev: GAMMA, Up: Intrinsic Procedures
30585 -7.86 `GERROR' -- Get last system error message
30586 -==============================================
30589 - Returns the system error message corresponding to the last system
30590 - error. This resembles the functionality of `strerror(3)' in C.
30599 - `CALL GERROR(RESULT)'
30602 - RESULT Shall of type `CHARACTER' and of default
30605 - PROGRAM test_gerror
30606 - CHARACTER(len=100) :: msg
30612 - *note IERRNO::, *note PERROR::
30615 -File: gfortran.info, Node: GETARG, Next: GET_COMMAND, Prev: GERROR, Up: Intrinsic Procedures
30617 -7.87 `GETARG' -- Get command line arguments
30618 -===========================================
30621 - Retrieve the POS-th argument that was passed on the command line
30622 - when the containing program was invoked.
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.
30636 - `CALL GETARG(POS, VALUE)'
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
30643 - VALUE Shall be of type `CHARACTER'.
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).
30654 - PROGRAM test_getarg
30656 - CHARACTER(len=32) :: arg
30658 - DO i = 1, iargc()
30659 - CALL getarg(i, arg)
30665 - GNU Fortran 77 compatibility function: *note IARGC::
30667 - Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note
30668 - GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
30671 -File: gfortran.info, Node: GET_COMMAND, Next: GET_COMMAND_ARGUMENT, Prev: GETARG, Up: Intrinsic Procedures
30673 -7.88 `GET_COMMAND' -- Get the entire command line
30674 -=================================================
30677 - Retrieve the entire command line that was used to invoke the
30681 - Fortran 2003 and later
30687 - `CALL GET_COMMAND(COMMAND)'
30690 - COMMAND Shall be of type `CHARACTER' and of default
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
30699 - PROGRAM test_get_command
30700 - CHARACTER(len=255) :: cmd
30701 - CALL get_command(cmd)
30702 - WRITE (*,*) TRIM(cmd)
30706 - *note GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
30709 -File: gfortran.info, Node: GET_COMMAND_ARGUMENT, Next: GETCWD, Prev: GET_COMMAND, Up: Intrinsic Procedures
30711 -7.89 `GET_COMMAND_ARGUMENT' -- Get command line arguments
30712 -=========================================================
30715 - Retrieve the NUMBER-th argument that was passed on the command
30716 - line when the containing program was invoked.
30719 - Fortran 2003 and later
30725 - `CALL GET_COMMAND_ARGUMENT(NUMBER [, VALUE, LENGTH, STATUS])'
30728 - NUMBER Shall be a scalar of type `INTEGER(4)', NUMBER
30730 - VALUE Shall be a scalar of type `CHARACTER' and of
30732 - LENGTH (Option) Shall be a scalar of type
30734 - STATUS (Option) Shall be a scalar of type
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.
30750 - PROGRAM test_get_command_argument
30752 - CHARACTER(len=32) :: arg
30756 - CALL get_command_argument(i, arg)
30757 - IF (LEN_TRIM(arg) == 0) EXIT
30759 - WRITE (*,*) TRIM(arg)
30765 - *note GET_COMMAND::, *note COMMAND_ARGUMENT_COUNT::
30768 -File: gfortran.info, Node: GETCWD, Next: GETENV, Prev: GET_COMMAND_ARGUMENT, Up: Intrinsic Procedures
30770 -7.90 `GETCWD' -- Get current working directory
30771 -==============================================
30774 - Get current working directory.
30776 - This intrinsic is provided in both subroutine and function forms;
30777 - however, only one form can be used in any given program unit.
30783 - Subroutine, function
30786 - `CALL GETCWD(C [, STATUS])'
30789 - C The type shall be `CHARACTER' and of default
30791 - STATUS (Optional) status flag. Returns 0 on success,
30792 - a system specific and nonzero error code
30796 - PROGRAM test_getcwd
30797 - CHARACTER(len=255) :: cwd
30799 - WRITE(*,*) TRIM(cwd)
30806 -File: gfortran.info, Node: GETENV, Next: GET_ENVIRONMENT_VARIABLE, Prev: GETCWD, Up: Intrinsic Procedures
30808 -7.91 `GETENV' -- Get an environmental variable
30809 -==============================================
30812 - Get the VALUE of the environmental variable NAME.
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.
30826 - `CALL GETENV(NAME, VALUE)'
30829 - NAME Shall be of type `CHARACTER' and of default
30831 - VALUE Shall be of type `CHARACTER' and of default
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.
30840 - PROGRAM test_getenv
30841 - CHARACTER(len=255) :: homedir
30842 - CALL getenv("HOME", homedir)
30843 - WRITE (*,*) TRIM(homedir)
30847 - *note GET_ENVIRONMENT_VARIABLE::
30850 -File: gfortran.info, Node: GET_ENVIRONMENT_VARIABLE, Next: GETGID, Prev: GETENV, Up: Intrinsic Procedures
30852 -7.92 `GET_ENVIRONMENT_VARIABLE' -- Get an environmental variable
30853 -================================================================
30856 - Get the VALUE of the environmental variable NAME.
30859 - Fortran 2003 and later
30865 - `CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS,
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)'.
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
30889 - PROGRAM test_getenv
30890 - CHARACTER(len=255) :: homedir
30891 - CALL get_environment_variable("HOME", homedir)
30892 - WRITE (*,*) TRIM(homedir)
30896 -File: gfortran.info, Node: GETGID, Next: GETLOG, Prev: GET_ENVIRONMENT_VARIABLE, Up: Intrinsic Procedures
30898 -7.93 `GETGID' -- Group ID function
30899 -==================================
30902 - Returns the numerical group ID of the current process.
30911 - `RESULT = GETGID()'
30914 - The return value of `GETGID' is an `INTEGER' of the default kind.
30917 - See `GETPID' for an example.
30920 - *note GETPID::, *note GETUID::
30923 -File: gfortran.info, Node: GETLOG, Next: GETPID, Prev: GETGID, Up: Intrinsic Procedures
30925 -7.94 `GETLOG' -- Get login name
30926 -===============================
30929 - Gets the username under which the program is running.
30941 - C Shall be of type `CHARACTER' and of default
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
30951 - PROGRAM TEST_GETLOG
30952 - CHARACTER(32) :: login
30953 - CALL GETLOG(login)
30961 -File: gfortran.info, Node: GETPID, Next: GETUID, Prev: GETLOG, Up: Intrinsic Procedures
30963 -7.95 `GETPID' -- Process ID function
30964 -====================================
30967 - Returns the numerical process identifier of the current process.
30976 - `RESULT = GETPID()'
30979 - The return value of `GETPID' is an `INTEGER' of the default kind.
30983 - print *, "The current process ID is ", getpid()
30984 - print *, "Your numerical user ID is ", getuid()
30985 - print *, "Your numerical group ID is ", getgid()
30989 - *note GETGID::, *note GETUID::
30992 -File: gfortran.info, Node: GETUID, Next: GMTIME, Prev: GETPID, Up: Intrinsic Procedures
30994 -7.96 `GETUID' -- User ID function
30995 -=================================
30998 - Returns the numerical user ID of the current process.
31007 - `RESULT = GETUID()'
31010 - The return value of `GETUID' is an `INTEGER' of the default kind.
31013 - See `GETPID' for an example.
31016 - *note GETPID::, *note GETLOG::
31019 -File: gfortran.info, Node: GMTIME, Next: HOSTNM, Prev: GETUID, Up: Intrinsic Procedures
31021 -7.97 `GMTIME' -- Convert time to GMT info
31022 -=========================================
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)'.
31037 - `CALL GMTIME(TIME, VALUES)'
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)'.
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
31050 - 2. Minutes after the hour, range 0-59
31052 - 3. Hours past midnight, range 0-23
31054 - 4. Day of month, range 0-31
31056 - 5. Number of months since January, range 0-12
31058 - 6. Years since 1900
31060 - 7. Number of days since Sunday, range 0-6
31062 - 8. Days since January 1
31064 - 9. Daylight savings indicator: positive if daylight savings is in
31065 - effect, zero if not, and negative if the information is not
31069 - *note CTIME::, *note LTIME::, *note TIME::, *note TIME8::
31073 -File: gfortran.info, Node: HOSTNM, Next: HUGE, Prev: GMTIME, Up: Intrinsic Procedures
31075 -7.98 `HOSTNM' -- Get system host name
31076 -=====================================
31079 - Retrieves the host name of the system on which the program is
31082 - This intrinsic is provided in both subroutine and function forms;
31083 - however, only one form can be used in any given program unit.
31089 - Subroutine, function
31092 - `CALL HOSTNM(C [, STATUS])'
31093 - `STATUS = HOSTNM(NAME)'
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.
31102 - In either syntax, NAME is set to the current hostname if it can be
31103 - obtained, or to a blank string otherwise.
31107 -File: gfortran.info, Node: HUGE, Next: HYPOT, Prev: HOSTNM, Up: Intrinsic Procedures
31109 -7.99 `HUGE' -- Largest number of a kind
31110 -=======================================
31113 - `HUGE(X)' returns the largest number that is not an infinity in
31114 - the model of the type of `X'.
31117 - Fortran 95 and later
31123 - `RESULT = HUGE(X)'
31126 - X Shall be of type `REAL' or `INTEGER'.
31129 - The return value is of the same type and kind as X
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
31138 -File: gfortran.info, Node: HYPOT, Next: IACHAR, Prev: HUGE, Up: Intrinsic Procedures
31140 -7.100 `HYPOT' -- Euclidean distance function
31141 -============================================
31144 - `HYPOT(X,Y)' is the Euclidean distance function. It is equal to
31145 - \sqrtX^2 + Y^2, without undue underflow or overflow.
31148 - Fortran 2008 and later
31151 - Elemental function
31154 - `RESULT = HYPOT(X, Y)'
31157 - X The type shall be `REAL'.
31158 - Y The type and kind type parameter shall be the
31162 - The return value has the same type and kind type parameter as X.
31165 - program test_hypot
31166 - real(4) :: x = 1.e0_4, y = 0.5e0_4
31168 - end program test_hypot
31171 -File: gfortran.info, Node: IACHAR, Next: IAND, Prev: HYPOT, Up: Intrinsic Procedures
31173 -7.101 `IACHAR' -- Code in ASCII collating sequence
31174 -==================================================
31177 - `IACHAR(C)' returns the code for the ASCII character in the first
31178 - character position of `C'.
31181 - Fortran 95 and later, with KIND argument Fortran 2003 and later
31184 - Elemental function
31187 - `RESULT = IACHAR(C [, KIND])'
31190 - C Shall be a scalar `CHARACTER', with
31192 - KIND (Optional) An `INTEGER' initialization
31193 - expression indicating the kind parameter of
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.
31201 - program test_iachar
31204 - end program test_iachar
31207 - See *note ICHAR:: for a discussion of converting between numerical
31208 - values and formatted string representations.
31211 - *note ACHAR::, *note CHAR::, *note ICHAR::
31215 -File: gfortran.info, Node: IAND, Next: IARGC, Prev: IACHAR, Up: Intrinsic Procedures
31217 -7.102 `IAND' -- Bitwise logical and
31218 -===================================
31221 - Bitwise logical `AND'.
31224 - Fortran 95 and later
31227 - Elemental function
31230 - `RESULT = IAND(I, J)'
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.)
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.)
31244 - PROGRAM test_iand
31246 - DATA a / Z'F' /, b / Z'3' /
31247 - WRITE (*,*) IAND(a, b)
31251 - *note IOR::, *note IEOR::, *note IBITS::, *note IBSET::, *note
31252 - IBCLR::, *note NOT::
31256 -File: gfortran.info, Node: IARGC, Next: IBCLR, Prev: IAND, Up: Intrinsic Procedures
31258 -7.103 `IARGC' -- Get the number of command line arguments
31259 -=========================================================
31262 - `IARGC()' returns the number of arguments passed on the command
31263 - line when the containing program was invoked.
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.
31277 - `RESULT = IARGC()'
31283 - The number of command line arguments, type `INTEGER(4)'.
31286 - See *note GETARG::
31289 - GNU Fortran 77 compatibility subroutine: *note GETARG::
31291 - Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note
31292 - GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
31295 -File: gfortran.info, Node: IBCLR, Next: IBITS, Prev: IARGC, Up: Intrinsic Procedures
31297 -7.104 `IBCLR' -- Clear bit
31298 -==========================
31301 - `IBCLR' returns the value of I with the bit at position POS set to
31305 - Fortran 95 and later
31308 - Elemental function
31311 - `RESULT = IBCLR(I, POS)'
31314 - I The type shall be `INTEGER'.
31315 - POS The type shall be `INTEGER'.
31318 - The return value is of type `INTEGER' and of the same kind as I.
31321 - *note IBITS::, *note IBSET::, *note IAND::, *note IOR::, *note
31322 - IEOR::, *note MVBITS::
31326 -File: gfortran.info, Node: IBITS, Next: IBSET, Prev: IBCLR, Up: Intrinsic Procedures
31328 -7.105 `IBITS' -- Bit extraction
31329 -===============================
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)'.
31338 - Fortran 95 and later
31341 - Elemental function
31344 - `RESULT = IBITS(I, POS, LEN)'
31347 - I The type shall be `INTEGER'.
31348 - POS The type shall be `INTEGER'.
31349 - LEN The type shall be `INTEGER'.
31352 - The return value is of type `INTEGER' and of the same kind as I.
31355 - *note BIT_SIZE::, *note IBCLR::, *note IBSET::, *note IAND::,
31356 - *note IOR::, *note IEOR::
31359 -File: gfortran.info, Node: IBSET, Next: ICHAR, Prev: IBITS, Up: Intrinsic Procedures
31361 -7.106 `IBSET' -- Set bit
31362 -========================
31365 - `IBSET' returns the value of I with the bit at position POS set to
31369 - Fortran 95 and later
31372 - Elemental function
31375 - `RESULT = IBSET(I, POS)'
31378 - I The type shall be `INTEGER'.
31379 - POS The type shall be `INTEGER'.
31382 - The return value is of type `INTEGER' and of the same kind as I.
31385 - *note IBCLR::, *note IBITS::, *note IAND::, *note IOR::, *note
31386 - IEOR::, *note MVBITS::
31390 -File: gfortran.info, Node: ICHAR, Next: IDATE, Prev: IBSET, Up: Intrinsic Procedures
31392 -7.107 `ICHAR' -- Character-to-integer conversion function
31393 -=========================================================
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.
31402 - Fortan 95 and later, with KIND argument Fortran 2003 and later
31405 - Elemental function
31408 - `RESULT = ICHAR(C [, KIND])'
31411 - C Shall be a scalar `CHARACTER', with
31413 - KIND (Optional) An `INTEGER' initialization
31414 - expression indicating the kind parameter of
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.
31422 - program test_ichar
31425 - end program test_ichar
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:
31435 - character(len=10) string, string2
31438 - ! Convert a string to a numeric value
31439 - read (string,'(I10)') value
31442 - ! Convert a value to a formatted string
31443 - write (string2,'(I10)') value
31445 - end program read_val
31448 - *note ACHAR::, *note CHAR::, *note IACHAR::
31452 -File: gfortran.info, Node: IDATE, Next: IEOR, Prev: ICHAR, Up: Intrinsic Procedures
31454 -7.108 `IDATE' -- Get current local time subroutine (day/month/year)
31455 -===================================================================
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.
31470 - `CALL IDATE(VALUES)'
31473 - VALUES The type shall be `INTEGER, DIMENSION(3)' and
31474 - the kind shall be the default integer kind.
31477 - Does not return anything.
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
31489 -File: gfortran.info, Node: IEOR, Next: IERRNO, Prev: IDATE, Up: Intrinsic Procedures
31491 -7.109 `IEOR' -- Bitwise logical exclusive or
31492 -============================================
31495 - `IEOR' returns the bitwise boolean exclusive-OR of I and J.
31498 - Fortran 95 and later
31501 - Elemental function
31504 - `RESULT = IEOR(I, J)'
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.)
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.)
31518 - *note IOR::, *note IAND::, *note IBITS::, *note IBSET::, *note
31519 - IBCLR::, *note NOT::
31522 -File: gfortran.info, Node: IERRNO, Next: INDEX intrinsic, Prev: IEOR, Up: Intrinsic Procedures
31524 -7.110 `IERRNO' -- Get the last system error number
31525 -==================================================
31528 - Returns the last system error number, as given by the C `errno()'
31538 - `RESULT = IERRNO()'
31544 - The return value is of type `INTEGER' and of the default integer
31551 -File: gfortran.info, Node: INDEX intrinsic, Next: INT, Prev: IERRNO, Up: Intrinsic Procedures
31553 -7.111 `INDEX' -- Position of a substring within a string
31554 -========================================================
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.
31564 - Fortran 77 and later, with KIND argument Fortran 2003 and later
31567 - Elemental function
31570 - `RESULT = INDEX(STRING, SUBSTRING [, BACK [, KIND]])'
31573 - STRING Shall be a scalar `CHARACTER', with
31575 - SUBSTRING Shall be a scalar `CHARACTER', with
31577 - BACK (Optional) Shall be a scalar `LOGICAL', with
31579 - KIND (Optional) An `INTEGER' initialization
31580 - expression indicating the kind parameter of
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.
31588 - *note SCAN::, *note VERIFY::
31591 -File: gfortran.info, Node: INT, Next: INT2, Prev: INDEX intrinsic, Up: Intrinsic Procedures
31593 -7.112 `INT' -- Convert to integer type
31594 -======================================
31597 - Convert to integer type
31600 - Fortran 77 and later
31603 - Elemental function
31606 - `RESULT = INT(A [, KIND))'
31609 - A Shall be of type `INTEGER', `REAL', or
31611 - KIND (Optional) An `INTEGER' initialization
31612 - expression indicating the kind parameter of
31616 - These functions return a `INTEGER' variable or array under the
31620 - If A is of type `INTEGER', `INT(A) = A'
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
31629 - If A is of type `COMPLEX', rule B is applied to the real part
31634 - integer :: i = 42
31635 - complex :: z = (-3.7, 1.0)
31637 - print *, int(z), int(z,8)
31641 - Name Argument Return type Standard
31642 - `IFIX(A)' `REAL(4) A' `INTEGER' Fortran 77 and
31644 - `IDINT(A)' `REAL(8) A' `INTEGER' Fortran 77 and
31649 -File: gfortran.info, Node: INT2, Next: INT8, Prev: INT, Up: Intrinsic Procedures
31651 -7.113 `INT2' -- Convert to 16-bit integer type
31652 -==============================================
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.
31659 - The `SHORT' intrinsic is equivalent to `INT2'.
31665 - Elemental function
31668 - `RESULT = INT2(A)'
31671 - A Shall be of type `INTEGER', `REAL', or
31675 - The return value is a `INTEGER(2)' variable.
31678 - *note INT::, *note INT8::, *note LONG::
31681 -File: gfortran.info, Node: INT8, Next: IOR, Prev: INT2, Up: Intrinsic Procedures
31683 -7.114 `INT8' -- Convert to 64-bit integer type
31684 -==============================================
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.
31695 - Elemental function
31698 - `RESULT = INT8(A)'
31701 - A Shall be of type `INTEGER', `REAL', or
31705 - The return value is a `INTEGER(8)' variable.
31708 - *note INT::, *note INT2::, *note LONG::
31711 -File: gfortran.info, Node: IOR, Next: IRAND, Prev: INT8, Up: Intrinsic Procedures
31713 -7.115 `IOR' -- Bitwise logical or
31714 -=================================
31717 - `IOR' returns the bitwise boolean inclusive-OR of I and J.
31720 - Fortran 95 and later
31723 - Elemental function
31726 - `RESULT = IOR(I, J)'
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.)
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.)
31740 - *note IEOR::, *note IAND::, *note IBITS::, *note IBSET::, *note
31741 - IBCLR::, *note NOT::
31744 -File: gfortran.info, Node: IRAND, Next: IS_IOSTAT_END, Prev: IOR, Up: Intrinsic Procedures
31746 -7.116 `IRAND' -- Integer pseudo-random number
31747 -=============================================
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'.
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.
31769 - `RESULT = IRAND(I)'
31772 - I Shall be a scalar `INTEGER' of kind 4.
31775 - The return value is of `INTEGER(kind=4)' type.
31778 - program test_irand
31779 - integer,parameter :: seed = 86456
31782 - print *, irand(), irand(), irand(), irand()
31783 - print *, irand(seed), irand(), irand(), irand()
31784 - end program test_irand
31788 -File: gfortran.info, Node: IS_IOSTAT_END, Next: IS_IOSTAT_EOR, Prev: IRAND, Up: Intrinsic Procedures
31790 -7.117 `IS_IOSTAT_END' -- Test for end-of-file value
31791 -===================================================
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'.
31800 - Fortran 2003 and later
31803 - Elemental function
31806 - `RESULT = IS_IOSTAT_END(I)'
31809 - I Shall be of the type `INTEGER'.
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.
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'
31826 -File: gfortran.info, Node: IS_IOSTAT_EOR, Next: ISATTY, Prev: IS_IOSTAT_END, Up: Intrinsic Procedures
31828 -7.118 `IS_IOSTAT_EOR' -- Test for end-of-record value
31829 -=====================================================
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'.
31838 - Fortran 2003 and later
31841 - Elemental function
31844 - `RESULT = IS_IOSTAT_EOR(I)'
31847 - I Shall be of the type `INTEGER'.
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.
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'
31864 -File: gfortran.info, Node: ISATTY, Next: ISHFT, Prev: IS_IOSTAT_EOR, Up: Intrinsic Procedures
31866 -7.119 `ISATTY' -- Whether a unit is a terminal device.
31867 -======================================================
31870 - Determine whether a unit is connected to a terminal device.
31879 - `RESULT = ISATTY(UNIT)'
31882 - UNIT Shall be a scalar `INTEGER'.
31885 - Returns `.TRUE.' if the UNIT is connected to a terminal device,
31886 - `.FALSE.' otherwise.
31889 - PROGRAM test_isatty
31890 - INTEGER(kind=1) :: unit
31892 - write(*,*) isatty(unit=unit)
31900 -File: gfortran.info, Node: ISHFT, Next: ISHFTC, Prev: ISATTY, Up: Intrinsic Procedures
31902 -7.120 `ISHFT' -- Shift bits
31903 -===========================
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.
31915 - Fortran 95 and later
31918 - Elemental function
31921 - `RESULT = ISHFT(I, SHIFT)'
31924 - I The type shall be `INTEGER'.
31925 - SHIFT The type shall be `INTEGER'.
31928 - The return value is of type `INTEGER' and of the same kind as I.
31934 -File: gfortran.info, Node: ISHFTC, Next: ISNAN, Prev: ISHFT, Up: Intrinsic Procedures
31936 -7.121 `ISHFTC' -- Shift bits circularly
31937 -=======================================
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)'.
31950 - Fortran 95 and later
31953 - Elemental function
31956 - `RESULT = ISHFTC(I, SHIFT [, SIZE])'
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)'.
31966 - The return value is of type `INTEGER' and of the same kind as I.
31972 -File: gfortran.info, Node: ISNAN, Next: ITIME, Prev: ISHFTC, Up: Intrinsic Procedures
31974 -7.122 `ISNAN' -- Test for a NaN
31975 -===============================
31978 - `ISNAN' tests whether a floating-point value is an IEEE
31979 - Not-a-Number (NaN).
31985 - Elemental function
31991 - X Variable of the type `REAL'.
31994 - Returns a default-kind `LOGICAL'. The returned value is `TRUE' if
31995 - X is a NaN and `FALSE' otherwise.
32003 - if (isnan(x)) stop '"x" is a NaN'
32004 - end program test_nan
32007 -File: gfortran.info, Node: ITIME, Next: KILL, Prev: ISNAN, Up: Intrinsic Procedures
32009 -7.123 `ITIME' -- Get current local time subroutine (hour/minutes/seconds)
32010 -=========================================================================
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.
32025 - `CALL ITIME(VALUES)'
32028 - VALUES The type shall be `INTEGER, DIMENSION(3)' and
32029 - the kind shall be the default integer kind.
32032 - Does not return anything.
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
32044 -File: gfortran.info, Node: KILL, Next: KIND, Prev: ITIME, Up: Intrinsic Procedures
32046 -7.124 `KILL' -- Send a signal to a process
32047 -==========================================
32052 - Sends the signal specified by SIGNAL to the process PID. See
32055 - This intrinsic is provided in both subroutine and function forms;
32056 - however, only one form can be used in any given program unit.
32059 - Subroutine, function
32062 - `CALL KILL(C, VALUE [, STATUS])'
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.
32072 - *note ABORT::, *note EXIT::
32075 -File: gfortran.info, Node: KIND, Next: LBOUND, Prev: KILL, Up: Intrinsic Procedures
32077 -7.125 `KIND' -- Kind of an entity
32078 -=================================
32081 - `KIND(X)' returns the kind value of the entity X.
32084 - Fortran 95 and later
32093 - X Shall be of type `LOGICAL', `INTEGER', `REAL',
32094 - `COMPLEX' or `CHARACTER'.
32097 - The return value is a scalar of type `INTEGER' and of the default
32101 - program test_kind
32102 - integer,parameter :: kc = kind(' ')
32103 - integer,parameter :: kl = kind(.true.)
32105 - print *, "The default character kind is ", kc
32106 - print *, "The default logical kind is ", kl
32107 - end program test_kind
32111 -File: gfortran.info, Node: LBOUND, Next: LEADZ, Prev: KIND, Up: Intrinsic Procedures
32113 -7.126 `LBOUND' -- Lower dimension bounds of an array
32114 -====================================================
32117 - Returns the lower bounds of an array, or a single lower bound
32118 - along the DIM dimension.
32121 - Fortran 95 and later, with KIND argument Fortran 2003 and later
32127 - `RESULT = LBOUND(ARRAY [, DIM [, KIND]])'
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
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.
32150 -File: gfortran.info, Node: LEADZ, Next: LEN, Prev: LBOUND, Up: Intrinsic Procedures
32152 -7.127 `LEADZ' -- Number of leading zero bits of an integer
32153 -==========================================================
32156 - `LEADZ' returns the number of leading zero bits of an integer.
32159 - Fortran 2008 and later
32162 - Elemental function
32165 - `RESULT = LEADZ(I)'
32168 - I Shall be of type `INTEGER'.
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)'.
32175 - PROGRAM test_leadz
32176 - WRITE (*,*) LEADZ(1) ! prints 8 if BITSIZE(I) has the value 32
32180 - *note BIT_SIZE::, *note TRAILZ::
32183 -File: gfortran.info, Node: LEN, Next: LEN_TRIM, Prev: LEADZ, Up: Intrinsic Procedures
32185 -7.128 `LEN' -- Length of a character entity
32186 -===========================================
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.
32195 - Fortran 77 and later, with KIND argument Fortran 2003 and later
32201 - `L = LEN(STRING [, KIND])'
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
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.
32215 - *note LEN_TRIM::, *note ADJUSTL::, *note ADJUSTR::
32218 -File: gfortran.info, Node: LEN_TRIM, Next: LOG_GAMMA, Prev: LEN, Up: Intrinsic Procedures
32220 -7.129 `LEN_TRIM' -- Length of a character entity without trailing blank characters
32221 -==================================================================================
32224 - Returns the length of a character string, ignoring any trailing
32228 - Fortran 95 and later, with KIND argument Fortran 2003 and later
32231 - Elemental function
32234 - `RESULT = LEN_TRIM(STRING [, KIND])'
32237 - STRING Shall be a scalar of type `CHARACTER', with
32239 - KIND (Optional) An `INTEGER' initialization
32240 - expression indicating the kind parameter of
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.
32248 - *note LEN::, *note ADJUSTL::, *note ADJUSTR::
32251 -File: gfortran.info, Node: LGE, Next: LGT, Prev: LOG_GAMMA, Up: Intrinsic Procedures
32253 -7.130 `LGE' -- Lexical greater than or equal
32254 -============================================
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.
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.
32270 - Fortran 77 and later
32273 - Elemental function
32276 - `RESULT = LGE(STRING_A, STRING_B)'
32279 - STRING_A Shall be of default `CHARACTER' type.
32280 - STRING_B Shall be of default `CHARACTER' type.
32283 - Returns `.TRUE.' if `STRING_A >= STRING_B', and `.FALSE.'
32284 - otherwise, based on the ASCII ordering.
32287 - *note LGT::, *note LLE::, *note LLT::
32290 -File: gfortran.info, Node: LGT, Next: LINK, Prev: LGE, Up: Intrinsic Procedures
32292 -7.131 `LGT' -- Lexical greater than
32293 -===================================
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.
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.
32309 - Fortran 77 and later
32312 - Elemental function
32315 - `RESULT = LGT(STRING_A, STRING_B)'
32318 - STRING_A Shall be of default `CHARACTER' type.
32319 - STRING_B Shall be of default `CHARACTER' type.
32322 - Returns `.TRUE.' if `STRING_A > STRING_B', and `.FALSE.'
32323 - otherwise, based on the ASCII ordering.
32326 - *note LGE::, *note LLE::, *note LLT::
32329 -File: gfortran.info, Node: LINK, Next: LLE, Prev: LGT, Up: Intrinsic Procedures
32331 -7.132 `LINK' -- Create a hard link
32332 -==================================
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)'.
32341 - This intrinsic is provided in both subroutine and function forms;
32342 - however, only one form can be used in any given program unit.
32348 - Subroutine, function
32351 - `CALL LINK(PATH1, PATH2 [, STATUS])'
32352 - `STATUS = LINK(PATH1, PATH2)'
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.
32360 - *note SYMLNK::, *note UNLINK::
32363 -File: gfortran.info, Node: LLE, Next: LLT, Prev: LINK, Up: Intrinsic Procedures
32365 -7.133 `LLE' -- Lexical less than or equal
32366 -=========================================
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
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.
32383 - Fortran 77 and later
32386 - Elemental function
32389 - `RESULT = LLE(STRING_A, STRING_B)'
32392 - STRING_A Shall be of default `CHARACTER' type.
32393 - STRING_B Shall be of default `CHARACTER' type.
32396 - Returns `.TRUE.' if `STRING_A <= STRING_B', and `.FALSE.'
32397 - otherwise, based on the ASCII ordering.
32400 - *note LGE::, *note LGT::, *note LLT::
32403 -File: gfortran.info, Node: LLT, Next: LNBLNK, Prev: LLE, Up: Intrinsic Procedures
32405 -7.134 `LLT' -- Lexical less than
32406 -================================
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.
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.
32422 - Fortran 77 and later
32425 - Elemental function
32428 - `RESULT = LLT(STRING_A, STRING_B)'
32431 - STRING_A Shall be of default `CHARACTER' type.
32432 - STRING_B Shall be of default `CHARACTER' type.
32435 - Returns `.TRUE.' if `STRING_A < STRING_B', and `.FALSE.'
32436 - otherwise, based on the ASCII ordering.
32439 - *note LGE::, *note LGT::, *note LLE::
32442 -File: gfortran.info, Node: LNBLNK, Next: LOC, Prev: LLT, Up: Intrinsic Procedures
32444 -7.135 `LNBLNK' -- Index of the last non-blank character in a string
32445 -===================================================================
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.
32456 - Elemental function
32459 - `RESULT = LNBLNK(STRING)'
32462 - STRING Shall be a scalar of type `CHARACTER', with
32466 - The return value is of `INTEGER(kind=4)' type.
32469 - *note INDEX intrinsic::, *note LEN_TRIM::
32472 -File: gfortran.info, Node: LOC, Next: LOG, Prev: LNBLNK, Up: Intrinsic Procedures
32474 -7.136 `LOC' -- Returns the address of a variable
32475 -================================================
32478 - `LOC(X)' returns the address of X as an integer.
32487 - `RESULT = LOC(X)'
32490 - X Variable of any type.
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.
32502 - end program test_loc
32505 -File: gfortran.info, Node: LOG, Next: LOG10, Prev: LOC, Up: Intrinsic Procedures
32507 -7.137 `LOG' -- Logarithm function
32508 -=================================
32511 - `LOG(X)' computes the logarithm of X.
32514 - Fortran 77 and later
32517 - Elemental function
32520 - `RESULT = LOG(X)'
32523 - X The type shall be `REAL' or `COMPLEX'.
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.
32532 - real(8) :: x = 1.0_8
32533 - complex :: z = (1.0, 2.0)
32536 - end program test_log
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
32544 - `ZLOG(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
32546 - `CDLOG(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
32550 -File: gfortran.info, Node: LOG10, Next: LOGICAL, Prev: LOG, Up: Intrinsic Procedures
32552 -7.138 `LOG10' -- Base 10 logarithm function
32553 -===========================================
32556 - `LOG10(X)' computes the base 10 logarithm of X.
32559 - Fortran 77 and later
32562 - Elemental function
32565 - `RESULT = LOG10(X)'
32568 - X The type shall be `REAL'.
32571 - The return value is of type `REAL' or `COMPLEX'. The kind type
32572 - parameter is the same as X.
32575 - program test_log10
32576 - real(8) :: x = 10.0_8
32578 - end program test_log10
32581 - Name Argument Return type Standard
32582 - `ALOG10(X)' `REAL(4) X' `REAL(4)' Fortran 95 and
32584 - `DLOG10(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
32588 -File: gfortran.info, Node: LOG_GAMMA, Next: LGE, Prev: LEN_TRIM, Up: Intrinsic Procedures
32590 -7.139 `LOG_GAMMA' -- Logarithm of the Gamma function
32591 -====================================================
32594 - `LOG_GAMMA(X)' computes the natural logarithm of the absolute value
32595 - of the Gamma (\Gamma) function.
32598 - Fortran 2008 and later
32601 - Elemental function
32604 - `X = LOG_GAMMA(X)'
32607 - X Shall be of type `REAL' and neither zero nor a
32608 - negative integer.
32611 - The return value is of type `REAL' of the same kind as X.
32614 - program test_log_gamma
32616 - x = lgamma(x) ! returns 0.0
32617 - end program test_log_gamma
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
32626 - Gamma function: *note GAMMA::
32630 -File: gfortran.info, Node: LOGICAL, Next: LONG, Prev: LOG10, Up: Intrinsic Procedures
32632 -7.140 `LOGICAL' -- Convert to logical type
32633 -==========================================
32636 - Converts one kind of `LOGICAL' variable to another.
32639 - Fortran 95 and later
32642 - Elemental function
32645 - `RESULT = LOGICAL(L [, KIND])'
32648 - L The type shall be `LOGICAL'.
32649 - KIND (Optional) An `INTEGER' initialization
32650 - expression indicating the kind parameter of
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
32659 - *note INT::, *note REAL::, *note CMPLX::
32662 -File: gfortran.info, Node: LONG, Next: LSHIFT, Prev: LOGICAL, Up: Intrinsic Procedures
32664 -7.141 `LONG' -- Convert to integer type
32665 -=======================================
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.
32677 - Elemental function
32680 - `RESULT = LONG(A)'
32683 - A Shall be of type `INTEGER', `REAL', or
32687 - The return value is a `INTEGER(4)' variable.
32690 - *note INT::, *note INT2::, *note INT8::
32693 -File: gfortran.info, Node: LSHIFT, Next: LSTAT, Prev: LONG, Up: Intrinsic Procedures
32695 -7.142 `LSHIFT' -- Left shift bits
32696 -=================================
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
32705 - This function has been superseded by the `ISHFT' intrinsic, which
32706 - is standard in Fortran 95 and later.
32712 - Elemental function
32715 - `RESULT = LSHIFT(I, SHIFT)'
32718 - I The type shall be `INTEGER'.
32719 - SHIFT The type shall be `INTEGER'.
32722 - The return value is of type `INTEGER' and of the same kind as I.
32725 - *note ISHFT::, *note ISHFTC::, *note RSHIFT::
32729 -File: gfortran.info, Node: LSTAT, Next: LTIME, Prev: LSHIFT, Up: Intrinsic Procedures
32731 -7.143 `LSTAT' -- Get file status
32732 -================================
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
32739 - The elements in `BUFF' are the same as described by *note STAT::.
32741 - This intrinsic is provided in both subroutine and function forms;
32742 - however, only one form can be used in any given program unit.
32748 - Subroutine, function
32751 - `CALL LSTAT(FILE, BUFF [, STATUS])'
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.
32762 - See *note STAT:: for an example.
32765 - To stat an open file: *note FSTAT::, to stat a file: *note STAT::
32768 -File: gfortran.info, Node: LTIME, Next: MALLOC, Prev: LSTAT, Up: Intrinsic Procedures
32770 -7.144 `LTIME' -- Convert time to local time info
32771 -================================================
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)'.
32785 - `CALL LTIME(STIME, TARRAY)'
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)'.
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
32798 - 2. Minutes after the hour, range 0-59
32800 - 3. Hours past midnight, range 0-23
32802 - 4. Day of month, range 0-31
32804 - 5. Number of months since January, range 0-12
32806 - 6. Years since 1900
32808 - 7. Number of days since Sunday, range 0-6
32810 - 8. Days since January 1
32812 - 9. Daylight savings indicator: positive if daylight savings is in
32813 - effect, zero if not, and negative if the information is not
32817 - *note CTIME::, *note GMTIME::, *note TIME::, *note TIME8::
32821 -File: gfortran.info, Node: MALLOC, Next: MATMUL, Prev: LTIME, Up: Intrinsic Procedures
32823 -7.145 `MALLOC' -- Allocate dynamic memory
32824 -=========================================
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
32841 - `PTR = MALLOC(SIZE)'
32844 - SIZE The type shall be `INTEGER'.
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 *)').
32852 - The following example demonstrates the use of `MALLOC' and `FREE'
32853 - with Cray pointers.
32855 - program test_malloc
32861 - ptr_x = malloc(20*8)
32863 - x(i) = sqrt(1.0d0 / i)
32871 - end program test_malloc
32877 -File: gfortran.info, Node: MATMUL, Next: MAX, Prev: MALLOC, Up: Intrinsic Procedures
32879 -7.146 `MATMUL' -- matrix multiplication
32880 -=======================================
32883 - Performs a matrix multiplication on numeric or logical arguments.
32886 - Fortran 95 and later
32889 - Transformational function
32892 - `RESULT = MATMUL(MATRIX_A, MATRIX_B)'
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.
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.
32912 -File: gfortran.info, Node: MAX, Next: MAXEXPONENT, Prev: MATMUL, Up: Intrinsic Procedures
32914 -7.147 `MAX' -- Maximum value of an argument list
32915 -================================================
32918 - Returns the argument with the largest (most positive) value.
32921 - Fortran 77 and later
32924 - Elemental function
32927 - `RESULT = MAX(A1, A2 [, A3 [, ...]])'
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.)
32936 - The return value corresponds to the maximum value among the
32937 - arguments, and has the same type and kind as the first argument.
32940 - Name Argument Return type Standard
32941 - `MAX0(I)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
32943 - `AMAX0(I)' `INTEGER(4) `REAL(MAX(X))'Fortran 77 and
32945 - `MAX1(X)' `REAL X' `INT(MAX(X))' Fortran 77 and
32947 - `AMAX1(X)' `REAL(4) `REAL(4)' Fortran 77 and
32949 - `DMAX1(X)' `REAL(8) `REAL(8)' Fortran 77 and
32953 - *note MAXLOC:: *note MAXVAL::, *note MIN::
32957 -File: gfortran.info, Node: MAXEXPONENT, Next: MAXLOC, Prev: MAX, Up: Intrinsic Procedures
32959 -7.148 `MAXEXPONENT' -- Maximum exponent of a real kind
32960 -======================================================
32963 - `MAXEXPONENT(X)' returns the maximum exponent in the model of the
32967 - Fortran 95 and later
32973 - `RESULT = MAXEXPONENT(X)'
32976 - X Shall be of type `REAL'.
32979 - The return value is of type `INTEGER' and of the default integer
32983 - program exponents
32984 - real(kind=4) :: x
32985 - real(kind=8) :: y
32987 - print *, minexponent(x), maxexponent(x)
32988 - print *, minexponent(y), maxexponent(y)
32989 - end program exponents
32992 -File: gfortran.info, Node: MAXLOC, Next: MAXVAL, Prev: MAXEXPONENT, Up: Intrinsic Procedures
32994 -7.149 `MAXLOC' -- Location of the maximum value within an array
32995 -===============================================================
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.
33011 - Fortran 95 and later
33014 - Transformational function
33017 - `RESULT = MAXLOC(ARRAY, DIM [, MASK])'
33018 - `RESULT = MAXLOC(ARRAY [, MASK])'
33021 - ARRAY Shall be an array of type `INTEGER', `REAL',
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.
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.
33039 - *note MAX::, *note MAXVAL::
33043 -File: gfortran.info, Node: MAXVAL, Next: MCLOCK, Prev: MAXLOC, Up: Intrinsic Procedures
33045 -7.150 `MAXVAL' -- Maximum value of an array
33046 -===========================================
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.
33058 - Fortran 95 and later
33061 - Transformational function
33064 - `RESULT = MAXVAL(ARRAY, DIM [, MASK])'
33065 - `RESULT = MAXVAL(ARRAY [, MASK])'
33068 - ARRAY Shall be an array of type `INTEGER', `REAL',
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.
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.
33085 - *note MAX::, *note MAXLOC::
33088 -File: gfortran.info, Node: MCLOCK, Next: MCLOCK8, Prev: MAXVAL, Up: Intrinsic Procedures
33090 -7.151 `MCLOCK' -- Time function
33091 -===============================
33094 - Returns the number of clock ticks since the start of the process,
33095 - based on the UNIX function `clock(3)'.
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.
33110 - `RESULT = MCLOCK()'
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)'.
33118 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
33123 -File: gfortran.info, Node: MCLOCK8, Next: MERGE, Prev: MCLOCK, Up: Intrinsic Procedures
33125 -7.152 `MCLOCK8' -- Time function (64-bit)
33126 -=========================================
33129 - Returns the number of clock ticks since the start of the process,
33130 - based on the UNIX function `clock(3)'.
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.
33148 - `RESULT = MCLOCK8()'
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)'.
33156 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
33161 -File: gfortran.info, Node: MERGE, Next: MIN, Prev: MCLOCK8, Up: Intrinsic Procedures
33163 -7.153 `MERGE' -- Merge variables
33164 -================================
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.'.
33172 - Fortran 95 and later
33175 - Elemental function
33178 - `RESULT = MERGE(TSOURCE, FSOURCE, MASK)'
33181 - TSOURCE May be of any type.
33182 - FSOURCE Shall be of the same type and type parameters
33184 - MASK Shall be of type `LOGICAL'.
33187 - The result is of the same type and type parameters as TSOURCE.
33191 -File: gfortran.info, Node: MIN, Next: MINEXPONENT, Prev: MERGE, Up: Intrinsic Procedures
33193 -7.154 `MIN' -- Minimum value of an argument list
33194 -================================================
33197 - Returns the argument with the smallest (most negative) value.
33200 - Fortran 77 and later
33203 - Elemental function
33206 - `RESULT = MIN(A1, A2 [, A3, ...])'
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.)
33215 - The return value corresponds to the maximum value among the
33216 - arguments, and has the same type and kind as the first argument.
33219 - Name Argument Return type Standard
33220 - `MIN0(I)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
33222 - `AMIN0(I)' `INTEGER(4) `REAL(MIN(X))'Fortran 77 and
33224 - `MIN1(X)' `REAL X' `INT(MIN(X))' Fortran 77 and
33226 - `AMIN1(X)' `REAL(4) `REAL(4)' Fortran 77 and
33228 - `DMIN1(X)' `REAL(8) `REAL(8)' Fortran 77 and
33232 - *note MAX::, *note MINLOC::, *note MINVAL::
33235 -File: gfortran.info, Node: MINEXPONENT, Next: MINLOC, Prev: MIN, Up: Intrinsic Procedures
33237 -7.155 `MINEXPONENT' -- Minimum exponent of a real kind
33238 -======================================================
33241 - `MINEXPONENT(X)' returns the minimum exponent in the model of the
33245 - Fortran 95 and later
33251 - `RESULT = MINEXPONENT(X)'
33254 - X Shall be of type `REAL'.
33257 - The return value is of type `INTEGER' and of the default integer
33261 - See `MAXEXPONENT' for an example.
33264 -File: gfortran.info, Node: MINLOC, Next: MINVAL, Prev: MINEXPONENT, Up: Intrinsic Procedures
33266 -7.156 `MINLOC' -- Location of the minimum value within an array
33267 -===============================================================
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.
33283 - Fortran 95 and later
33286 - Transformational function
33289 - `RESULT = MINLOC(ARRAY, DIM [, MASK])'
33290 - `RESULT = MINLOC(ARRAY [, MASK])'
33293 - ARRAY Shall be an array of type `INTEGER', `REAL',
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.
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.
33311 - *note MIN::, *note MINVAL::
33315 -File: gfortran.info, Node: MINVAL, Next: MOD, Prev: MINLOC, Up: Intrinsic Procedures
33317 -7.157 `MINVAL' -- Minimum value of an array
33318 -===========================================
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
33331 - Fortran 95 and later
33334 - Transformational function
33337 - `RESULT = MINVAL(ARRAY, DIM [, MASK])'
33338 - `RESULT = MINVAL(ARRAY [, MASK])'
33341 - ARRAY Shall be an array of type `INTEGER', `REAL',
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.
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.
33358 - *note MIN::, *note MINLOC::
33362 -File: gfortran.info, Node: MOD, Next: MODULO, Prev: MINVAL, Up: Intrinsic Procedures
33364 -7.158 `MOD' -- Remainder function
33365 -=================================
33368 - `MOD(A,P)' computes the remainder of the division of A by P. It is
33369 - calculated as `A - (INT(A/P) * P)'.
33372 - Fortran 77 and later
33375 - Elemental function
33378 - `RESULT = MOD(A, P)'
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
33386 - The kind of the return value is the result of cross-promoting the
33387 - kinds of the arguments.
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)
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)
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
33408 - Name Arguments Return type Standard
33409 - `AMOD(A,P)' `REAL(4)' `REAL(4)' Fortran 95 and
33411 - `DMOD(A,P)' `REAL(8)' `REAL(8)' Fortran 95 and
33415 -File: gfortran.info, Node: MODULO, Next: MOVE_ALLOC, Prev: MOD, Up: Intrinsic Procedures
33417 -7.159 `MODULO' -- Modulo function
33418 -=================================
33421 - `MODULO(A,P)' computes the A modulo P.
33424 - Fortran 95 and later
33427 - Elemental function
33430 - `RESULT = MODULO(A, P)'
33433 - A Shall be a scalar of type `INTEGER' or `REAL'
33434 - P Shall be a scalar of the same type and kind as
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).
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.
33448 - program test_modulo
33449 - print *, modulo(17,3)
33450 - print *, modulo(17.5,5.5)
33452 - print *, modulo(-17,3)
33453 - print *, modulo(-17.5,5.5)
33455 - print *, modulo(17,-3)
33456 - print *, modulo(17.5,-5.5)
33461 -File: gfortran.info, Node: MOVE_ALLOC, Next: MVBITS, Prev: MODULO, Up: Intrinsic Procedures
33463 -7.160 `MOVE_ALLOC' -- Move allocation from one object to another
33464 -================================================================
33467 - `MOVE_ALLOC(SRC, DEST)' moves the allocation from SRC to DEST.
33468 - SRC will become deallocated in the process.
33471 - Fortran 2003 and later
33477 - `CALL MOVE_ALLOC(SRC, DEST)'
33480 - SRC `ALLOCATABLE', `INTENT(INOUT)', may be of any
33482 - DEST `ALLOCATABLE', `INTENT(OUT)', shall be of the
33483 - same type, kind and rank as SRC.
33489 - program test_move_alloc
33490 - integer, allocatable :: a(:), b(:)
33494 - call move_alloc(a, b)
33495 - print *, allocated(a), allocated(b)
33497 - end program test_move_alloc
33500 -File: gfortran.info, Node: MVBITS, Next: NEAREST, Prev: MOVE_ALLOC, Up: Intrinsic Procedures
33502 -7.161 `MVBITS' -- Move bits from one integer to another
33503 -=======================================================
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)'.
33513 - Fortran 95 and later
33516 - Elemental subroutine
33519 - `CALL MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)'
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
33527 - TOPOS The type shall be `INTEGER'.
33530 - *note IBCLR::, *note IBSET::, *note IBITS::, *note IAND::, *note
33531 - IOR::, *note IEOR::
33534 -File: gfortran.info, Node: NEAREST, Next: NEW_LINE, Prev: MVBITS, Up: Intrinsic Procedures
33536 -7.162 `NEAREST' -- Nearest representable number
33537 -===============================================
33540 - `NEAREST(X, S)' returns the processor-representable number nearest
33541 - to `X' in the direction indicated by the sign of `S'.
33544 - Fortran 95 and later
33547 - Elemental function
33550 - `RESULT = NEAREST(X, S)'
33553 - X Shall be of type `REAL'.
33554 - S (Optional) shall be of type `REAL' and not
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.
33564 - program test_nearest
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
33572 -File: gfortran.info, Node: NEW_LINE, Next: NINT, Prev: NEAREST, Up: Intrinsic Procedures
33574 -7.163 `NEW_LINE' -- New line character
33575 -======================================
33578 - `NEW_LINE(C)' returns the new-line character.
33581 - Fortran 2003 and later
33587 - `RESULT = NEW_LINE(C)'
33590 - C The argument shall be a scalar or array of the
33591 - type `CHARACTER'.
33594 - Returns a CHARACTER scalar of length one with the new-line
33595 - character of the same kind as parameter C.
33600 - write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
33601 - end program newline
33604 -File: gfortran.info, Node: NINT, Next: NOT, Prev: NEW_LINE, Up: Intrinsic Procedures
33606 -7.164 `NINT' -- Nearest whole number
33607 -====================================
33610 - `NINT(X)' rounds its argument to the nearest whole number.
33613 - Fortran 77 and later, with KIND argument Fortran 90 and later
33616 - Elemental function
33619 - `RESULT = NINT(X [, KIND])'
33622 - X The type of the argument shall be `REAL'.
33623 - KIND (Optional) An `INTEGER' initialization
33624 - expression indicating the kind parameter of
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.
33633 - program test_nint
33638 - print *, nint(x4), idnint(x8)
33639 - end program test_nint
33642 - Name Argument Standard
33643 - `IDNINT(X)' `REAL(8)' Fortran 95 and
33647 - *note CEILING::, *note FLOOR::
33651 -File: gfortran.info, Node: NOT, Next: NULL, Prev: NINT, Up: Intrinsic Procedures
33653 -7.165 `NOT' -- Logical negation
33654 -===============================
33657 - `NOT' returns the bitwise boolean inverse of I.
33660 - Fortran 95 and later
33663 - Elemental function
33666 - `RESULT = NOT(I)'
33669 - I The type shall be `INTEGER'.
33672 - The return type is `INTEGER', of the same kind as the argument.
33675 - *note IAND::, *note IEOR::, *note IOR::, *note IBITS::, *note
33676 - IBSET::, *note IBCLR::
33680 -File: gfortran.info, Node: NULL, Next: OR, Prev: NOT, Up: Intrinsic Procedures
33682 -7.166 `NULL' -- Function that returns an disassociated pointer
33683 -==============================================================
33686 - Returns a disassociated pointer.
33688 - If MOLD is present, a dissassociated pointer of the same type is
33689 - returned, otherwise the type is determined by context.
33691 - In Fortran 95, MOLD is optional. Please note that Fortran 2003
33692 - includes cases where it is required.
33695 - Fortran 95 and later
33698 - Transformational function
33701 - `PTR => NULL([MOLD])'
33704 - MOLD (Optional) shall be a pointer of any
33705 - association status and of any type.
33708 - A disassociated pointer.
33711 - REAL, POINTER, DIMENSION(:) :: VEC => NULL ()
33714 - *note ASSOCIATED::
33717 -File: gfortran.info, Node: OR, Next: PACK, Prev: NULL, Up: Intrinsic Procedures
33719 -7.167 `OR' -- Bitwise logical OR
33720 -================================
33723 - Bitwise logical `OR'.
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
33737 - `RESULT = OR(X, Y)'
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.
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.
33752 - LOGICAL :: T = .TRUE., F = .FALSE.
33754 - DATA a / Z'F' /, b / Z'3' /
33756 - WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
33757 - WRITE (*,*) OR(a, b)
33761 - Fortran 95 elemental function: *note IOR::
33764 -File: gfortran.info, Node: PACK, Next: PERROR, Prev: OR, Up: Intrinsic Procedures
33766 -7.168 `PACK' -- Pack an array into an array of rank one
33767 -=======================================================
33770 - Stores the elements of ARRAY in an array of rank one.
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.
33777 - Fortran 95 and later
33780 - Transformational function
33783 - `RESULT = PACK(ARRAY, MASK[,VECTOR]'
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.
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.
33804 - Gathering nonzero elements from an array:
33805 - PROGRAM test_pack_1
33807 - m = (/ 1, 0, 0, 0, 5, 0 /)
33808 - WRITE(*, FMT="(6(I0, ' '))") pack(m, m /= 0) ! "1 5"
33811 - Gathering nonzero elements from an array and appending elements
33813 - PROGRAM test_pack_2
33815 - m = (/ 1, 0, 0, 2 /)
33816 - WRITE(*, FMT="(4(I0, ' '))") pack(m, m /= 0, (/ 0, 0, 3, 4 /)) ! "1 2 3 4"
33823 -File: gfortran.info, Node: PERROR, Next: PRECISION, Prev: PACK, Up: Intrinsic Procedures
33825 -7.169 `PERROR' -- Print system error message
33826 -============================================
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)'.
33840 - `CALL PERROR(STRING)'
33843 - STRING A scalar of type `CHARACTER' and of the
33850 -File: gfortran.info, Node: PRECISION, Next: PRESENT, Prev: PERROR, Up: Intrinsic Procedures
33852 -7.170 `PRECISION' -- Decimal precision of a real kind
33853 -=====================================================
33856 - `PRECISION(X)' returns the decimal precision in the model of the
33860 - Fortran 95 and later
33866 - `RESULT = PRECISION(X)'
33869 - X Shall be of type `REAL' or `COMPLEX'.
33872 - The return value is of type `INTEGER' and of the default integer
33876 - program prec_and_range
33877 - real(kind=4) :: x(2)
33878 - complex(kind=8) :: y
33880 - print *, precision(x), range(x)
33881 - print *, precision(y), range(y)
33882 - end program prec_and_range
33885 -File: gfortran.info, Node: PRESENT, Next: PRODUCT, Prev: PRECISION, Up: Intrinsic Procedures
33887 -7.171 `PRESENT' -- Determine whether an optional dummy argument is specified
33888 -============================================================================
33891 - Determines whether an optional dummy argument is present.
33894 - Fortran 95 and later
33900 - `RESULT = PRESENT(A)'
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.
33910 - Returns either `TRUE' if the optional argument A is present, or
33911 - `FALSE' otherwise.
33914 - PROGRAM test_present
33915 - WRITE(*,*) f(), f(42) ! "F T"
33917 - LOGICAL FUNCTION f(x)
33918 - INTEGER, INTENT(IN), OPTIONAL :: x
33924 -File: gfortran.info, Node: PRODUCT, Next: RADIX, Prev: PRESENT, Up: Intrinsic Procedures
33926 -7.172 `PRODUCT' -- Product of array elements
33927 -============================================
33930 - Multiplies the elements of ARRAY along dimension DIM if the
33931 - corresponding element in MASK is `TRUE'.
33934 - Fortran 95 and later
33937 - Transformational function
33940 - `RESULT = PRODUCT(ARRAY[, MASK])' `RESULT = PRODUCT(ARRAY, DIM[,
33944 - ARRAY Shall be an array of type `INTEGER', `REAL' or
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
33954 - The result is of the same type as ARRAY.
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.
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
33972 -File: gfortran.info, Node: RADIX, Next: RANDOM_NUMBER, Prev: PRODUCT, Up: Intrinsic Procedures
33974 -7.173 `RADIX' -- Base of a model number
33975 -=======================================
33978 - `RADIX(X)' returns the base of the model representing the entity X.
33981 - Fortran 95 and later
33987 - `RESULT = RADIX(X)'
33990 - X Shall be of type `INTEGER' or `REAL'
33993 - The return value is a scalar of type `INTEGER' and of the default
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
34004 -File: gfortran.info, Node: RAN, Next: REAL, Prev: RANGE, Up: Intrinsic Procedures
34006 -7.174 `RAN' -- Real pseudo-random number
34007 -========================================
34010 - For compatibility with HP FORTRAN 77/iX, the `RAN' intrinsic is
34011 - provided as an alias for `RAND'. See *note RAND:: for complete
34021 - *note RAND::, *note RANDOM_NUMBER::
34024 -File: gfortran.info, Node: RAND, Next: RANGE, Prev: RANDOM_SEED, Up: Intrinsic Procedures
34026 -7.175 `RAND' -- Real pseudo-random number
34027 -=========================================
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'.
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.
34048 - `RESULT = RAND(FLAG)'
34051 - FLAG Shall be a scalar `INTEGER' of kind 4.
34054 - The return value is of `REAL' type and the default kind.
34057 - program test_rand
34058 - integer,parameter :: seed = 86456
34061 - print *, rand(), rand(), rand(), rand()
34062 - print *, rand(seed), rand(), rand(), rand()
34063 - end program test_rand
34066 - *note SRAND::, *note RANDOM_NUMBER::
34070 -File: gfortran.info, Node: RANDOM_NUMBER, Next: RANDOM_SEED, Prev: RADIX, Up: Intrinsic Procedures
34072 -7.176 `RANDOM_NUMBER' -- Pseudo-random number
34073 -=============================================
34076 - Returns a single pseudorandom number or an array of pseudorandom
34077 - numbers from the uniform distribution over the range 0 \leq x < 1.
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,
34084 - 2. A 3-shift shift-register generator with a period of 2^32 - 1,
34086 - 3. Two 16-bit multiply-with-carry generators with a period of
34087 - 597273182964842497 > 2^59.
34088 - The overall period exceeds 2^123.
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.
34099 - Fortran 95 and later
34105 - `RANDOM_NUMBER(HARVEST)'
34108 - HARVEST Shall be a scalar or an array of type `REAL'.
34111 - program test_random_number
34113 - CALL init_random_seed() ! see example of RANDOM_SEED
34114 - CALL RANDOM_NUMBER(r)
34118 - *note RANDOM_SEED::
34121 -File: gfortran.info, Node: RANDOM_SEED, Next: RAND, Prev: RANDOM_NUMBER, Up: Intrinsic Procedures
34123 -7.177 `RANDOM_SEED' -- Initialize a pseudo-random number sequence
34124 -=================================================================
34127 - Restarts or queries the state of the pseudorandom number generator
34128 - used by `RANDOM_NUMBER'.
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.
34135 - Fortran 95 and later
34141 - `CALL RANDOM_SEED(SIZE, PUT, GET)'
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
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
34160 - SUBROUTINE init_random_seed()
34161 - INTEGER :: i, n, clock
34162 - INTEGER, DIMENSION(:), ALLOCATABLE :: seed
34164 - CALL RANDOM_SEED(size = n)
34165 - ALLOCATE(seed(n))
34167 - CALL SYSTEM_CLOCK(COUNT=clock)
34169 - seed = clock + 37 * (/ (i - 1, i = 1, n) /)
34170 - CALL RANDOM_SEED(PUT = seed)
34176 - *note RANDOM_NUMBER::
34179 -File: gfortran.info, Node: RANGE, Next: RAN, Prev: RAND, Up: Intrinsic Procedures
34181 -7.178 `RANGE' -- Decimal exponent range
34182 -=======================================
34185 - `RANGE(X)' returns the decimal exponent range in the model of the
34189 - Fortran 95 and later
34195 - `RESULT = RANGE(X)'
34198 - X Shall be of type `INTEGER', `REAL' or
34202 - The return value is of type `INTEGER' and of the default integer
34206 - See `PRECISION' for an example.
34209 -File: gfortran.info, Node: REAL, Next: RENAME, Prev: RAN, Up: Intrinsic Procedures
34211 -7.179 `REAL' -- Convert to real type
34212 -====================================
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.
34220 - Fortran 77 and later
34223 - Elemental function
34226 - `RESULT = REAL(X [, KIND])'
34227 - `RESULT = REALPART(Z)'
34230 - X Shall be `INTEGER', `REAL', or `COMPLEX'.
34231 - KIND (Optional) An `INTEGER' initialization
34232 - expression indicating the kind parameter of
34236 - These functions return a `REAL' variable or array under the
34240 - `REAL(X)' is converted to a default real type if X is an
34241 - integer or real variable.
34244 - `REAL(X)' is converted to a real type with the kind type
34245 - parameter of X if X is a complex variable.
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.
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
34258 - *note DBLE::, *note DFLOAT::, *note FLOAT::
34262 -File: gfortran.info, Node: RENAME, Next: REPEAT, Prev: REAL, Up: Intrinsic Procedures
34264 -7.180 `RENAME' -- Rename a file
34265 -===============================
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)'.
34274 - This intrinsic is provided in both subroutine and function forms;
34275 - however, only one form can be used in any given program unit.
34281 - Subroutine, function
34284 - `CALL RENAME(PATH1, PATH2 [, STATUS])'
34285 - `STATUS = RENAME(PATH1, PATH2)'
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.
34297 -File: gfortran.info, Node: REPEAT, Next: RESHAPE, Prev: RENAME, Up: Intrinsic Procedures
34299 -7.181 `REPEAT' -- Repeated string concatenation
34300 -===============================================
34303 - Concatenates NCOPIES copies of a string.
34306 - Fortran 95 and later
34309 - Transformational function
34312 - `RESULT = REPEAT(STRING, NCOPIES)'
34315 - STRING Shall be scalar and of type `CHARACTER'.
34316 - NCOPIES Shall be scalar and of type `INTEGER'.
34319 - A new scalar of type `CHARACTER' built up from NCOPIES copies of
34323 - program test_repeat
34324 - write(*,*) repeat("x", 5) ! "xxxxx"
34328 -File: gfortran.info, Node: RESHAPE, Next: RRSPACING, Prev: REPEAT, Up: Intrinsic Procedures
34330 -7.182 `RESHAPE' -- Function to reshape an array
34331 -===============================================
34334 - Reshapes SOURCE to correspond to SHAPE. If necessary, the new
34335 - array may be padded with elements from PAD or permuted as defined
34339 - Fortran 95 and later
34342 - Transformational function
34345 - `RESULT = RESHAPE(SOURCE, SHAPE[, PAD, ORDER])'
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
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
34361 - The result is an array of shape SHAPE with the same type as SOURCE.
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"
34374 -File: gfortran.info, Node: RRSPACING, Next: RSHIFT, Prev: RESHAPE, Up: Intrinsic Procedures
34376 -7.183 `RRSPACING' -- Reciprocal of the relative spacing
34377 -=======================================================
34380 - `RRSPACING(X)' returns the reciprocal of the relative spacing of
34381 - model numbers near X.
34384 - Fortran 95 and later
34387 - Elemental function
34390 - `RESULT = RRSPACING(X)'
34393 - X Shall be of type `REAL'.
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)'.
34404 -File: gfortran.info, Node: RSHIFT, Next: SCALE, Prev: RRSPACING, Up: Intrinsic Procedures
34406 -7.184 `RSHIFT' -- Right shift bits
34407 -==================================
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
34416 - This function has been superseded by the `ISHFT' intrinsic, which
34417 - is standard in Fortran 95 and later.
34423 - Elemental function
34426 - `RESULT = RSHIFT(I, SHIFT)'
34429 - I The type shall be `INTEGER'.
34430 - SHIFT The type shall be `INTEGER'.
34433 - The return value is of type `INTEGER' and of the same kind as I.
34436 - *note ISHFT::, *note ISHFTC::, *note LSHIFT::
34440 -File: gfortran.info, Node: SCALE, Next: SCAN, Prev: RSHIFT, Up: Intrinsic Procedures
34442 -7.185 `SCALE' -- Scale a real value
34443 -===================================
34446 - `SCALE(X,I)' returns `X * RADIX(X)**I'.
34449 - Fortran 95 and later
34452 - Elemental function
34455 - `RESULT = SCALE(X, I)'
34458 - X The type of the argument shall be a `REAL'.
34459 - I The type of the argument shall be a `INTEGER'.
34462 - The return value is of the same type and kind as X. Its value is
34463 - `X * RADIX(X)**I'.
34466 - program test_scale
34467 - real :: x = 178.1387e-4
34469 - print *, scale(x,i), x*radix(x)**i
34470 - end program test_scale
34474 -File: gfortran.info, Node: SCAN, Next: SECNDS, Prev: SCALE, Up: Intrinsic Procedures
34476 -7.186 `SCAN' -- Scan a string for the presence of a set of characters
34477 -=====================================================================
34480 - Scans a STRING for any of the characters in a SET of characters.
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.
34488 - Fortran 95 and later, with KIND argument Fortran 2003 and later
34491 - Elemental function
34494 - `RESULT = SCAN(STRING, SET[, BACK [, KIND]])'
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
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.
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
34516 - *note INDEX intrinsic::, *note VERIFY::
34519 -File: gfortran.info, Node: SECNDS, Next: SECOND, Prev: SCAN, Up: Intrinsic Procedures
34521 -7.187 `SECNDS' -- Time function
34522 -===============================
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.
34537 - `RESULT = SECNDS (X)'
34540 - T Shall be of type `REAL(4)'.
34541 - X Shall be of type `REAL(4)'.
34547 - program test_secnds
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
34554 - t2 = secnds (t1) ! elapsed time
34555 - print *, "Something took ", t2, " seconds."
34556 - end program test_secnds
34559 -File: gfortran.info, Node: SECOND, Next: SELECTED_CHAR_KIND, Prev: SECNDS, Up: Intrinsic Procedures
34561 -7.188 `SECOND' -- CPU time function
34562 -===================================
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
34570 - This intrinsic is provided in both subroutine and function forms;
34571 - however, only one form can be used in any given program unit.
34577 - Subroutine, function
34580 - `CALL SECOND(TIME)'
34581 - `TIME = SECOND()'
34584 - TIME Shall be of type `REAL(4)'.
34587 - In either syntax, TIME is set to the process's current runtime in
34595 -File: gfortran.info, Node: SELECTED_CHAR_KIND, Next: SELECTED_INT_KIND, Prev: SECOND, Up: Intrinsic Procedures
34597 -7.189 `SELECTED_CHAR_KIND' -- Choose character kind
34598 -===================================================
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.
34607 - Fortran 2003 and later
34610 - Transformational function
34613 - `RESULT = SELECTED_CHAR_KIND(NAME)'
34616 - NAME Shall be a scalar and of the default character
34620 - program ascii_kind
34621 - integer,parameter :: ascii = selected_char_kind("ascii")
34622 - character(kind=ascii, len=26) :: s
34624 - s = ascii_"abcdefghijklmnopqrstuvwxyz"
34626 - end program ascii_kind
34629 -File: gfortran.info, Node: SELECTED_INT_KIND, Next: SELECTED_REAL_KIND, Prev: SELECTED_CHAR_KIND, Up: Intrinsic Procedures
34631 -7.190 `SELECTED_INT_KIND' -- Choose integer kind
34632 -================================================
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.
34641 - Fortran 95 and later
34644 - Transformational function
34647 - `RESULT = SELECTED_INT_KIND(I)'
34650 - I Shall be a scalar and of type `INTEGER'.
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
34659 - print *, huge(i5), huge(i15)
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
34667 -File: gfortran.info, Node: SELECTED_REAL_KIND, Next: SET_EXPONENT, Prev: SELECTED_INT_KIND, Up: Intrinsic Procedures
34669 -7.191 `SELECTED_REAL_KIND' -- Choose real kind
34670 -==============================================
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'.
34678 - Fortran 95 and later
34681 - Transformational function
34684 - `RESULT = SELECTED_REAL_KIND(P, R)'
34687 - P (Optional) shall be a scalar and of type
34689 - R (Optional) shall be a scalar and of type
34691 - At least one argument shall be present.
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'
34703 - -2 if the processor does not support a real type with an exponent
34704 - range greater than or equal to `R'
34706 - -3 if neither is supported.
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
34717 - print *, precision(x), range(x)
34718 - print *, precision(y), range(y)
34719 - print *, precision(z), range(z)
34720 - end program real_kinds
34723 -File: gfortran.info, Node: SET_EXPONENT, Next: SHAPE, Prev: SELECTED_REAL_KIND, Up: Intrinsic Procedures
34725 -7.192 `SET_EXPONENT' -- Set the exponent of the model
34726 -=====================================================
34729 - `SET_EXPONENT(X, I)' returns the real number whose fractional part
34730 - is that that of X and whose exponent part is I.
34733 - Fortran 95 and later
34736 - Elemental function
34739 - `RESULT = SET_EXPONENT(X, I)'
34742 - X Shall be of type `REAL'.
34743 - I Shall be of type `INTEGER'.
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'.
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
34759 -File: gfortran.info, Node: SHAPE, Next: SIGN, Prev: SET_EXPONENT, Up: Intrinsic Procedures
34761 -7.193 `SHAPE' -- Determine the shape of an array
34762 -================================================
34765 - Determines the shape of an array.
34768 - Fortran 95 and later
34774 - `RESULT = SHAPE(SOURCE)'
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.
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.
34788 - PROGRAM test_shape
34789 - INTEGER, DIMENSION(-1:1, -1:2) :: A
34790 - WRITE(*,*) SHAPE(A) ! (/ 3, 4 /)
34791 - WRITE(*,*) SIZE(SHAPE(42)) ! (/ /)
34795 - *note RESHAPE::, *note SIZE::
34798 -File: gfortran.info, Node: SIGN, Next: SIGNAL, Prev: SHAPE, Up: Intrinsic Procedures
34800 -7.194 `SIGN' -- Sign copying function
34801 -=====================================
34804 - `SIGN(A,B)' returns the value of A with the sign of B.
34807 - Fortran 77 and later
34810 - Elemental function
34813 - `RESULT = SIGN(A, B)'
34816 - A Shall be of type `INTEGER' or `REAL'
34817 - B Shall be of the same type and kind as A
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)'.
34824 - program test_sign
34825 - print *, sign(-12,1)
34826 - print *, sign(-12,0)
34827 - print *, sign(-12,-1)
34829 - print *, sign(-12.,1.)
34830 - print *, sign(-12.,0.)
34831 - print *, sign(-12.,-1.)
34832 - end program test_sign
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
34840 -File: gfortran.info, Node: SIGNAL, Next: SIN, Prev: SIGN, Up: Intrinsic Procedures
34842 -7.195 `SIGNAL' -- Signal handling subroutine (or function)
34843 -==========================================================
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.
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)'.
34859 - Subroutine, function
34862 - `CALL SIGNAL(NUMBER, HANDLER [, STATUS])'
34863 - `STATUS = SIGNAL(NUMBER, HANDLER)'
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)'.
34874 - The `SIGNAL' function returns the value returned by `signal(2)'.
34877 - program test_signal
34879 - external handler_print
34881 - call signal (12, handler_print)
34882 - call signal (10, 1)
34885 - end program test_signal
34888 -File: gfortran.info, Node: SIN, Next: SINH, Prev: SIGNAL, Up: Intrinsic Procedures
34890 -7.196 `SIN' -- Sine function
34891 -============================
34894 - `SIN(X)' computes the sine of X.
34897 - Fortran 77 and later
34900 - Elemental function
34903 - `RESULT = SIN(X)'
34906 - X The type shall be `REAL' or `COMPLEX'.
34909 - The return value has same type and kind as X.
34915 - end program test_sin
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
34922 - `ZSIN(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
34924 - `CDSIN(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
34931 -File: gfortran.info, Node: SINH, Next: SIZE, Prev: SIN, Up: Intrinsic Procedures
34933 -7.197 `SINH' -- Hyperbolic sine function
34934 -========================================
34937 - `SINH(X)' computes the hyperbolic sine of X.
34940 - Fortran 95 and later
34943 - Elemental function
34946 - `RESULT = SINH(X)'
34949 - X The type shall be `REAL'.
34952 - The return value is of type `REAL'.
34955 - program test_sinh
34956 - real(8) :: x = - 1.0_8
34958 - end program test_sinh
34961 - Name Argument Return type Standard
34962 - `DSINH(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
34969 -File: gfortran.info, Node: SIZE, Next: SIZEOF, Prev: SINH, Up: Intrinsic Procedures
34971 -7.198 `SIZE' -- Determine the size of an array
34972 -==============================================
34975 - Determine the extent of ARRAY along a specified dimension DIM, or
34976 - the total number of elements in ARRAY if DIM is absent.
34979 - Fortran 95 and later, with KIND argument Fortran 2003 and later
34985 - `RESULT = SIZE(ARRAY[, DIM [, KIND]])'
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
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.
35003 - PROGRAM test_size
35004 - WRITE(*,*) SIZE((/ 1, 2 /)) ! 2
35008 - *note SHAPE::, *note RESHAPE::
35011 -File: gfortran.info, Node: SIZEOF, Next: SLEEP, Prev: SIZE, Up: Intrinsic Procedures
35013 -7.199 `SIZEOF' -- Size in bytes of an expression
35014 -================================================
35017 - `SIZEOF(X)' calculates the number of bytes of storage the
35018 - expression `X' occupies.
35024 - Intrinsic function
35030 - X The argument shall be of any type, rank or
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.
35045 - print *, (sizeof(s)/sizeof(r) == 5)
35047 - The example will print `.TRUE.' unless you are using a platform
35048 - where default `REAL' variables are unusually padded.
35054 -File: gfortran.info, Node: SLEEP, Next: SNGL, Prev: SIZEOF, Up: Intrinsic Procedures
35056 -7.200 `SLEEP' -- Sleep for the specified number of seconds
35057 -==========================================================
35060 - Calling this subroutine causes the process to pause for SECONDS
35070 - `CALL SLEEP(SECONDS)'
35073 - SECONDS The type shall be of default `INTEGER'.
35076 - program test_sleep
35081 -File: gfortran.info, Node: SNGL, Next: SPACING, Prev: SLEEP, Up: Intrinsic Procedures
35083 -7.201 `SNGL' -- Convert double precision real to default real
35084 -=============================================================
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
35092 - Fortran 77 and later
35095 - Elemental function
35098 - `RESULT = SNGL(A)'
35101 - A The type shall be a double precision `REAL'.
35104 - The return value is of type default `REAL'.
35110 -File: gfortran.info, Node: SPACING, Next: SPREAD, Prev: SNGL, Up: Intrinsic Procedures
35112 -7.202 `SPACING' -- Smallest distance between two numbers of a given type
35113 -========================================================================
35116 - Determines the distance between the argument X and the nearest
35117 - adjacent number of the same type.
35120 - Fortran 95 and later
35123 - Elemental function
35126 - `RESULT = SPACING(X)'
35129 - X Shall be of type `REAL'.
35132 - The result is of the same type as the input argument X.
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)
35139 - WRITE(*,*) spacing(1.0_SGL) ! "1.1920929E-07" on i686
35140 - WRITE(*,*) spacing(1.0_DBL) ! "2.220446049250313E-016" on i686
35144 - *note RRSPACING::
35147 -File: gfortran.info, Node: SPREAD, Next: SQRT, Prev: SPACING, Up: Intrinsic Procedures
35149 -7.203 `SPREAD' -- Add a dimension to an array
35150 -=============================================
35153 - Replicates a SOURCE array NCOPIES times along a specified
35157 - Fortran 95 and later
35160 - Transformational function
35163 - `RESULT = SPREAD(SOURCE, DIM, NCOPIES)'
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'.
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.
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"
35188 -File: gfortran.info, Node: SQRT, Next: SRAND, Prev: SPREAD, Up: Intrinsic Procedures
35190 -7.204 `SQRT' -- Square-root function
35191 -====================================
35194 - `SQRT(X)' computes the square root of X.
35197 - Fortran 77 and later
35200 - Elemental function
35203 - `RESULT = SQRT(X)'
35206 - X The type shall be `REAL' or `COMPLEX'.
35209 - The return value is of type `REAL' or `COMPLEX'. The kind type
35210 - parameter is the same as X.
35213 - program test_sqrt
35214 - real(8) :: x = 2.0_8
35215 - complex :: z = (1.0, 2.0)
35218 - end program test_sqrt
35221 - Name Argument Return type Standard
35222 - `DSQRT(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
35224 - `CSQRT(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 95 and
35226 - `ZSQRT(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
35228 - `CDSQRT(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
35232 -File: gfortran.info, Node: SRAND, Next: STAT, Prev: SQRT, Up: Intrinsic Procedures
35234 -7.205 `SRAND' -- Reinitialize the random number generator
35235 -=========================================================
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.
35249 - `CALL SRAND(SEED)'
35252 - SEED Shall be a scalar `INTEGER(kind=4)'.
35255 - Does not return anything.
35258 - See `RAND' and `IRAND' for examples.
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.
35269 - *note RAND::, *note RANDOM_SEED::, *note RANDOM_NUMBER::
35273 -File: gfortran.info, Node: STAT, Next: SUM, Prev: SRAND, Up: Intrinsic Procedures
35275 -7.206 `STAT' -- Get file status
35276 -===============================
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.
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
35300 - Not all these elements are relevant on all systems. If an element
35301 - is not relevant, it is returned as 0.
35303 - This intrinsic is provided in both subroutine and function forms;
35304 - however, only one form can be used in any given program unit.
35310 - Subroutine, function
35313 - `CALL STAT(FILE,BUFF[,STATUS])'
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.
35324 - PROGRAM test_stat
35325 - INTEGER, DIMENSION(13) :: buff
35326 - INTEGER :: status
35328 - CALL STAT("/etc/passwd", buff, status)
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)
35348 - To stat an open file: *note FSTAT::, to stat a link: *note LSTAT::
35351 -File: gfortran.info, Node: SUM, Next: SYMLNK, Prev: STAT, Up: Intrinsic Procedures
35353 -7.207 `SUM' -- Sum of array elements
35354 -====================================
35357 - Adds the elements of ARRAY along dimension DIM if the
35358 - corresponding element in MASK is `TRUE'.
35361 - Fortran 95 and later
35364 - Transformational function
35367 - `RESULT = SUM(ARRAY[, MASK])' `RESULT = SUM(ARRAY, DIM[, MASK])'
35370 - ARRAY Shall be an array of type `INTEGER', `REAL' or
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
35380 - The result is of the same type as ARRAY.
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.
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
35398 -File: gfortran.info, Node: SYMLNK, Next: SYSTEM, Prev: SUM, Up: Intrinsic Procedures
35400 -7.208 `SYMLNK' -- Create a symbolic link
35401 -========================================
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.
35411 - This intrinsic is provided in both subroutine and function forms;
35412 - however, only one form can be used in any given program unit.
35418 - Subroutine, function
35421 - `CALL SYMLNK(PATH1, PATH2 [, STATUS])'
35422 - `STATUS = SYMLNK(PATH1, PATH2)'
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.
35430 - *note LINK::, *note UNLINK::
35434 -File: gfortran.info, Node: SYSTEM, Next: SYSTEM_CLOCK, Prev: SYMLNK, Up: Intrinsic Procedures
35436 -7.209 `SYSTEM' -- Execute a shell command
35437 -=========================================
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.
35446 - This intrinsic is provided in both subroutine and function forms;
35447 - however, only one form can be used in any given program unit.
35453 - Subroutine, function
35456 - `CALL SYSTEM(COMMAND [, STATUS])'
35457 - `STATUS = SYSTEM(COMMAND)'
35460 - COMMAND Shall be of default `CHARACTER' type.
35461 - STATUS (Optional) Shall be of default `INTEGER' type.
35466 -File: gfortran.info, Node: SYSTEM_CLOCK, Next: TAN, Prev: SYSTEM, Up: Intrinsic Procedures
35468 -7.210 `SYSTEM_CLOCK' -- Time function
35469 -=====================================
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'.
35477 - If there is no clock, COUNT is set to `-HUGE(COUNT)', and
35478 - COUNT_RATE and COUNT_MAX are set to zero
35481 - Fortran 95 and later
35487 - `CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])'
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)'.
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
35507 - *note DATE_AND_TIME::, *note CPU_TIME::
35510 -File: gfortran.info, Node: TAN, Next: TANH, Prev: SYSTEM_CLOCK, Up: Intrinsic Procedures
35512 -7.211 `TAN' -- Tangent function
35513 -===============================
35516 - `TAN(X)' computes the tangent of X.
35519 - Fortran 77 and later
35522 - Elemental function
35525 - `RESULT = TAN(X)'
35528 - X The type shall be `REAL'.
35531 - The return value is of type `REAL'. The kind type parameter is
35536 - real(8) :: x = 0.165_8
35538 - end program test_tan
35541 - Name Argument Return type Standard
35542 - `DTAN(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
35549 -File: gfortran.info, Node: TANH, Next: TIME, Prev: TAN, Up: Intrinsic Procedures
35551 -7.212 `TANH' -- Hyperbolic tangent function
35552 -===========================================
35555 - `TANH(X)' computes the hyperbolic tangent of X.
35558 - Fortran 77 and later
35561 - Elemental function
35567 - X The type shall be `REAL'.
35570 - The return value is of type `REAL' and lies in the range - 1 \leq
35574 - program test_tanh
35575 - real(8) :: x = 2.1_8
35577 - end program test_tanh
35580 - Name Argument Return type Standard
35581 - `DTANH(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
35588 -File: gfortran.info, Node: TIME, Next: TIME8, Prev: TANH, Up: Intrinsic Procedures
35590 -7.213 `TIME' -- Time function
35591 -=============================
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()'.
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.
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.
35615 - `RESULT = TIME()'
35618 - The return value is a scalar of type `INTEGER(4)'.
35621 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
35626 -File: gfortran.info, Node: TIME8, Next: TINY, Prev: TIME, Up: Intrinsic Procedures
35628 -7.214 `TIME8' -- Time function (64-bit)
35629 -=======================================
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()'.
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.
35651 - `RESULT = TIME8()'
35654 - The return value is a scalar of type `INTEGER(8)'.
35657 - *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK8::,
35662 -File: gfortran.info, Node: TINY, Next: TRAILZ, Prev: TIME8, Up: Intrinsic Procedures
35664 -7.215 `TINY' -- Smallest positive number of a real kind
35665 -=======================================================
35668 - `TINY(X)' returns the smallest positive (non zero) number in the
35669 - model of the type of `X'.
35672 - Fortran 95 and later
35678 - `RESULT = TINY(X)'
35681 - X Shall be of type `REAL'.
35684 - The return value is of the same type and kind as X
35687 - See `HUGE' for an example.
35690 -File: gfortran.info, Node: TRAILZ, Next: TRANSFER, Prev: TINY, Up: Intrinsic Procedures
35692 -7.216 `TRAILZ' -- Number of trailing zero bits of an integer
35693 -============================================================
35696 - `TRAILZ' returns the number of trailing zero bits of an integer.
35699 - Fortran 2008 and later
35702 - Elemental function
35705 - `RESULT = TRAILZ(I)'
35708 - I Shall be of type `INTEGER'.
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)'.
35715 - PROGRAM test_trailz
35716 - WRITE (*,*) TRAILZ(8) ! prints 3
35720 - *note BIT_SIZE::, *note LEADZ::
35723 -File: gfortran.info, Node: TRANSFER, Next: TRANSPOSE, Prev: TRAILZ, Up: Intrinsic Procedures
35725 -7.217 `TRANSFER' -- Transfer bit patterns
35726 -=========================================
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.
35733 - This is approximately equivalent to the C concept of _casting_ one
35737 - Fortran 95 and later
35740 - Transformational function
35743 - `RESULT = TRANSFER(SOURCE, MOLD[, SIZE])'
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'.
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.
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.
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.
35771 - PROGRAM test_transfer
35772 - integer :: x = 2143289344
35773 - print *, transfer(x, 1.0) ! prints "NaN" on i686
35777 -File: gfortran.info, Node: TRANSPOSE, Next: TRIM, Prev: TRANSFER, Up: Intrinsic Procedures
35779 -7.218 `TRANSPOSE' -- Transpose an array of rank two
35780 -===================================================
35783 - Transpose an array of rank two. Element (i, j) of the result has
35784 - the value `MATRIX(j, i)', for all i, j.
35787 - Fortran 95 and later
35790 - Transformational function
35793 - `RESULT = TRANSPOSE(MATRIX)'
35796 - MATRIX Shall be an array of any type and have a rank
35800 - The result has the same type as MATRIX, and has shape `(/ m, n /)'
35801 - if MATRIX has shape `(/ n, m /)'.
35804 -File: gfortran.info, Node: TRIM, Next: TTYNAM, Prev: TRANSPOSE, Up: Intrinsic Procedures
35806 -7.219 `TRIM' -- Remove trailing blank characters of a string
35807 -============================================================
35810 - Removes trailing blank characters of a string.
35813 - Fortran 95 and later
35816 - Transformational function
35819 - `RESULT = TRIM(STRING)'
35822 - STRING Shall be a scalar of type `CHARACTER'.
35825 - A scalar of type `CHARACTER' which length is that of STRING less
35826 - the number of trailing blanks.
35829 - PROGRAM test_trim
35830 - CHARACTER(len=10), PARAMETER :: s = "GFORTRAN "
35831 - WRITE(*,*) LEN(s), LEN(TRIM(s)) ! "10 8", with/without trailing blanks
35835 - *note ADJUSTL::, *note ADJUSTR::
35838 -File: gfortran.info, Node: TTYNAM, Next: UBOUND, Prev: TRIM, Up: Intrinsic Procedures
35840 -7.220 `TTYNAM' -- Get the name of a terminal device.
35841 -====================================================
35844 - Get the name of a terminal device. For more information, see
35847 - This intrinsic is provided in both subroutine and function forms;
35848 - however, only one form can be used in any given program unit.
35854 - Subroutine, function
35857 - `CALL TTYNAM(UNIT, NAME)'
35858 - `NAME = TTYNAM(UNIT)'
35861 - UNIT Shall be a scalar `INTEGER'.
35862 - NAME Shall be of type `CHARACTER'.
35865 - PROGRAM test_ttynam
35868 - IF (isatty(unit=unit)) write(*,*) ttynam(unit)
35876 -File: gfortran.info, Node: UBOUND, Next: UMASK, Prev: TTYNAM, Up: Intrinsic Procedures
35878 -7.221 `UBOUND' -- Upper dimension bounds of an array
35879 -====================================================
35882 - Returns the upper bounds of an array, or a single upper bound
35883 - along the DIM dimension.
35886 - Fortran 95 and later, with KIND argument Fortran 2003 and later
35892 - `RESULT = UBOUND(ARRAY [, DIM [, KIND]])'
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
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
35916 -File: gfortran.info, Node: UMASK, Next: UNLINK, Prev: UBOUND, Up: Intrinsic Procedures
35918 -7.222 `UMASK' -- Set the file creation mask
35919 -===========================================
35922 - Sets the file creation mask to MASK and returns the old value in
35923 - argument OLD if it is supplied. See `umask(2)'.
35932 - `CALL UMASK(MASK [, OLD])'
35935 - MASK Shall be a scalar of type `INTEGER'.
35936 - MASK (Optional) Shall be a scalar of type `INTEGER'.
35940 -File: gfortran.info, Node: UNLINK, Next: UNPACK, Prev: UMASK, Up: Intrinsic Procedures
35942 -7.223 `UNLINK' -- Remove a file from the file system
35943 -====================================================
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
35952 - This intrinsic is provided in both subroutine and function forms;
35953 - however, only one form can be used in any given program unit.
35959 - Subroutine, function
35962 - `CALL UNLINK(PATH [, STATUS])'
35963 - `STATUS = UNLINK(PATH)'
35966 - PATH Shall be of default `CHARACTER' type.
35967 - STATUS (Optional) Shall be of default `INTEGER' type.
35970 - *note LINK::, *note SYMLNK::
35973 -File: gfortran.info, Node: UNPACK, Next: VERIFY, Prev: UNLINK, Up: Intrinsic Procedures
35975 -7.224 `UNPACK' -- Unpack an array of rank one into an array
35976 -===========================================================
35979 - Store the elements of VECTOR in an array of higher rank.
35982 - Fortran 95 and later
35985 - Transformational function
35988 - `RESULT = UNPACK(VECTOR, MASK, FIELD)'
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.
35999 - The resulting array corresponds to FIELD with `TRUE' elements of
36000 - MASK replaced by values from VECTOR in array element order.
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)
36008 - ! result: unity matrix
36009 - unity = unpack(vector, reshape(mask, (/2,2/)), field)
36013 - *note PACK::, *note SPREAD::
36016 -File: gfortran.info, Node: VERIFY, Next: XOR, Prev: UNPACK, Up: Intrinsic Procedures
36018 -7.225 `VERIFY' -- Scan a string for the absence of a set of characters
36019 -======================================================================
36022 - Verifies that all the characters in a SET are present in a STRING.
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.
36030 - Fortran 95 and later, with KIND argument Fortran 2003 and later
36033 - Elemental function
36036 - `RESULT = VERIFY(STRING, SET[, BACK [, KIND]])'
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
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.
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
36060 - *note SCAN::, *note INDEX intrinsic::
36063 -File: gfortran.info, Node: XOR, Prev: VERIFY, Up: Intrinsic Procedures
36065 -7.226 `XOR' -- Bitwise logical exclusive OR
36066 -===========================================
36069 - Bitwise logical exclusive or.
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
36083 - `RESULT = XOR(X, Y)'
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.
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.
36098 - LOGICAL :: T = .TRUE., F = .FALSE.
36100 - DATA a / Z'F' /, b / Z'3' /
36102 - WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
36103 - WRITE (*,*) XOR(a, b)
36107 - Fortran 95 elemental function: *note IEOR::
36110 -File: gfortran.info, Node: Intrinsic Modules, Next: Contributing, Prev: Intrinsic Procedures, Up: Top
36112 -8 Intrinsic Modules
36113 -*******************
36115 -8.1 `ISO_FORTRAN_ENV'
36116 -=====================
36119 - Fortran 2003 and later
36121 - The `ISO_FORTRAN_ENV' module provides the following scalar
36122 -default-integer named constants:
36124 -`CHARACTER_STORAGE_SIZE':
36125 - Size in bits of the character storage unit.
36128 - Identifies the preconnected unit used for error reporting.
36130 -`FILE_STORAGE_SIZE':
36131 - Size in bits of the file-storage unit.
36134 - Identifies the preconnected unit identified by the asterisk (`*')
36135 - in `READ' statement.
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.
36142 - The value assigned to the variable passed to the IOSTAT= specifier
36143 - of an input/output statement if an end-of-record condition
36146 -`NUMERIC_STORAGE_SIZE':
36147 - The size in bits of the numeric storage unit.
36150 - Identifies the preconnected unit identified by the asterisk (`*')
36151 - in `WRITE' statement.
36153 -8.2 `ISO_C_BINDING'
36154 -===================
36157 - Fortran 2003 and later, GNU extensions
36159 - The following intrinsic procedures are provided by the module; their
36160 -definition can be found in the section Intrinsic Procedures of this
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.
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'.
36185 -Fortran Named constant C type Extension
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
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'
36220 - Additionally, the following `(CHARACTER(KIND=C_CHAR))' are defined.
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''
36232 -8.3 OpenMP Modules `OMP_LIB' and `OMP_LIB_KINDS'
36233 -================================================
36236 - OpenMP Application Program Interface v3.0
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.
36245 - For details refer to the actual OpenMP Application Program Interface
36246 -v3.0 (http://www.openmp.org/mp-documents/spec30.pdf).
36248 - `OMP_LIB_KINDS' provides the following scalar default-integer named
36251 -`omp_integer_kind'
36253 -`omp_logical_kind'
36257 -`omp_nest_lock_kind'
36262 -File: gfortran.info, Node: Contributing, Next: Copying, Prev: Intrinsic Modules, Up: Top
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.
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.
36283 -* Proposed Extensions::
36286 -File: gfortran.info, Node: Contributors, Next: Projects, Up: Contributing
36288 -Contributors to GNU Fortran
36289 -===========================
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_.
36295 - The following individuals have contributed code and/or ideas and
36296 -significant help to the GNU Fortran project (in alphabetical order):
36298 - - Janne Blomqvist
36300 - - Steven Bosscher
36306 - - Franc,ois-Xavier Coudert
36314 - - Bernhard Fischer
36318 - - Richard Guenther
36320 - - Richard Henderson
36322 - - Katherine Holcomb
36326 - - Niels Kristian Bech Jensen
36330 - - Steven G. Kargl
36346 - - Christopher D. Rickett
36348 - - Richard Sandiford
36350 - - Tobias Schlu"ter
36362 - The following people have contributed bug reports, smaller or larger
36363 -patches, and much needed feedback and encouragement for the GNU Fortran
36368 - - Dominique d'Humie`res
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.
36380 -File: gfortran.info, Node: Projects, Next: Proposed Extensions, Prev: Contributors, Up: Contributing
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.
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
36401 -File: gfortran.info, Node: Proposed Extensions, Prev: Projects, Up: Contributing
36403 -Proposed Extensions
36404 -===================
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.
36411 -Compiler extensions:
36412 ---------------------
36414 - * User-specified alignment rules for structures.
36416 - * Flag to generate `Makefile' info.
36418 - * Automatically extend single precision constants to double.
36420 - * Compile code that conserves memory by dynamically allocating
36421 - common and module storage either on stack or heap.
36423 - * Compile flag to generate code for array conformance checking
36426 - * User control of symbol names (underscores, etc).
36428 - * Compile setting for maximum size of stack frame size before
36429 - spilling parts to static or heap.
36431 - * Flag to force local variables into static space.
36433 - * Flag to force local variables onto stack.
36435 -Environment Options
36436 --------------------
36438 - * Pluggable library modules for random numbers, linear algebra. LA
36439 - should use BLAS calling conventions.
36441 - * Environment variables controlling actions on arithmetic exceptions
36442 - like overflow, underflow, precision loss--Generate NaN, abort,
36445 - * Set precision for fp units that support it (i387).
36447 - * Variable for setting fp rounding mode.
36449 - * Variable to fill uninitialized variables with a user-defined bit
36452 - * Environment variable controlling filename that is opened for that
36455 - * Environment variable to clear/trash memory being freed.
36457 - * Environment variable to control tracing of allocations and frees.
36459 - * Environment variable to display allocated memory at normal program
36462 - * Environment variable for filename for * IO-unit.
36464 - * Environment variable for temporary file directory.
36466 - * Environment variable forcing standard output to be line buffered
36471 -File: gfortran.info, Node: Copying, Next: GNU Free Documentation License, Prev: Contributing, Up: Top
36473 -GNU General Public License
36474 -**************************
36476 - Version 3, 29 June 2007
36478 - Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'
36480 - Everyone is permitted to copy and distribute verbatim copies of this
36481 - license document, but changing it is not allowed.
36486 -The GNU General Public License is a free, copyleft license for software
36487 -and other kinds of works.
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.
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.
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.
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.
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.
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.
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
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.
36545 - The precise terms and conditions for copying, distribution and
36546 -modification follow.
36548 -TERMS AND CONDITIONS
36549 -====================
36553 - "This License" refers to version 3 of the GNU General Public
36556 - "Copyright" also means copyright-like laws that apply to other
36557 - kinds of works, such as semiconductor masks.
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.
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.
36568 - A "covered work" means either the unmodified Program or a work
36569 - based on the Program.
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
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
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
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.
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
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.
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.
36632 - The Corresponding Source need not include anything that users can
36633 - regenerate automatically from other parts of the Corresponding
36636 - The Corresponding Source for a work in source code form is that
36639 - 2. Basic Permissions.
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.
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.
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.
36666 - 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
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
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.
36682 - 4. Conveying Verbatim Copies.
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.
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.
36695 - 5. Conveying Modified Source Versions.
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
36702 - a. The work must carry prominent notices stating that you
36703 - modified it, and giving a relevant date.
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".
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
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.
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.
36734 - 6. Conveying Non-Source Forms.
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:
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.
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
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.
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.
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.
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.
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.
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.
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).
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.
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.
36837 - 7. Additional Terms.
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.
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.
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
36861 - a. Disclaiming warranty or limiting liability differently from
36862 - the terms of sections 15 and 16 of this License; or
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
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
36873 - d. Limiting the use for publicity purposes of names of licensors
36874 - or authors of the material; or
36876 - e. Declining to grant rights under trademark law for use of some
36877 - trade names, trademarks, or service marks; or
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.
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
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.
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.
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).
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.
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.
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.
36933 - 9. Acceptance Not Required for Having Copies.
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.
36945 - 10. Automatic Licensing of Downstream Recipients.
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
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.
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
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
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.
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.
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.
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.
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.
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.
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.
37046 - 12. No Surrender of Others' Freedom.
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
37060 - 13. Use with the GNU Affero General Public License.
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.
37071 - 14. Revised Versions of this License.
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
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.
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.
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
37098 - 15. Disclaimer of Warranty.
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.
37110 - 16. Limitation of Liability.
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.
37123 - 17. Interpretation of Sections 15 and 16.
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.
37133 -END OF TERMS AND CONDITIONS
37134 -===========================
37136 -How to Apply These Terms to Your New Programs
37137 -=============================================
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
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.
37149 - ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
37150 - Copyright (C) YEAR NAME OF AUTHOR
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.
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.
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/'.
37165 - Also add information on how to contact you by electronic and paper
37168 - If the program does terminal interaction, make it output a short
37169 -notice like this when it starts in an interactive mode:
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.
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".
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/'.
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'.
37194 -File: gfortran.info, Node: GNU Free Documentation License, Next: Funding, Prev: Copying, Up: Top
37196 -GNU Free Documentation License
37197 -******************************
37199 - Version 1.2, November 2002
37201 - Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
37202 - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
37204 - Everyone is permitted to copy and distribute verbatim copies
37205 - of this license document, but changing it is not allowed.
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.
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.
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.
37231 - 1. APPLICABILITY AND DEFINITIONS
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.
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.
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
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.
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.
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".
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.
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.
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.
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.
37320 - 2. VERBATIM COPYING
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.
37333 - You may also lend copies, under the same conditions stated above,
37334 - and you may publicly display copies.
37336 - 3. COPYING IN QUANTITY
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
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
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.
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.
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:
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.
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.
37400 - C. State on the Title page the name of the publisher of the
37401 - Modified Version, as the publisher.
37403 - D. Preserve all the copyright notices of the Document.
37405 - E. Add an appropriate copyright notice for your modifications
37406 - adjacent to the other copyright notices.
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.
37413 - G. Preserve in that license notice the full lists of Invariant
37414 - Sections and required Cover Texts given in the Document's
37417 - H. Include an unaltered copy of this License.
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.
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.
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.
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
37447 - M. Delete any section Entitled "Endorsements". Such a section
37448 - may not be included in the Modified Version.
37450 - N. Do not retitle any existing section to be Entitled
37451 - "Endorsements" or to conflict in title with any Invariant
37454 - O. Preserve any Warranty Disclaimers.
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.
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.
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.
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.
37485 - 5. COMBINING DOCUMENTS
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.
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
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."
37511 - 6. COLLECTIONS OF DOCUMENTS
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.
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
37526 - 7. AGGREGATION WITH INDEPENDENT WORKS
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.
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.
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
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
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.
37576 - 10. FUTURE REVISIONS OF THIS LICENSE
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/'.
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.
37594 -ADDENDUM: How to use this License for your documents
37595 -====================================================
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:
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''.
37609 - If you have Invariant Sections, Front-Cover Texts and Back-Cover
37610 -Texts, replace the "with...Texts." line with this:
37612 - with the Invariant Sections being LIST THEIR TITLES, with
37613 - the Front-Cover Texts being LIST, and with the Back-Cover Texts
37616 - If you have Invariant Sections without Cover Texts, or some other
37617 -combination of the three, merge those two alternatives to suit the
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.
37626 -File: gfortran.info, Node: Funding, Next: Option Index, Prev: GNU Free Documentation License, Up: Top
37628 -Funding Free Software
37629 -*********************
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.
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.
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.
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
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.
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.
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.
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.
37676 -File: gfortran.info, Node: Option Index, Next: Keyword Index, Prev: Funding, Up: Top
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.