summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-03-18 10:41:39 +0000
committerRichard Purdie <richard@openedhand.com>2008-03-18 10:41:39 +0000
commit1255ee64ee58fb5f0acd0bdbf4f0a54afd5ceeaf (patch)
tree293d34ede70b906b04967ac077e32a8fee4e855b /meta/packages/gcc
parent402c7dcb2790bd51de9436befe8c273e538be441 (diff)
downloadpoky-1255ee64ee58fb5f0acd0bdbf4f0a54afd5ceeaf.tar.gz
gcc: Merge in the major cleanup I made in OE.dev
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4038 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gcc')
-rw-r--r--meta/packages/gcc/gcc-3.4.3/15342.patch22
-rw-r--r--meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff1100
-rw-r--r--meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch30
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch70
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch24
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch256
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch442
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch3246
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch14
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch79
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch119
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch9
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch22
-rw-r--r--meta/packages/gcc/gcc-3.4.4.inc24
-rw-r--r--meta/packages/gcc/gcc-3.4.4/GCOV_PREFIX_STRIP-cross-profile_3.4.patch389
-rw-r--r--meta/packages/gcc/gcc-3.4.4/zecke-no-host-includes.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.4/zecke-xgcc-cpp.patch13
-rw-r--r--meta/packages/gcc/gcc-4.0.2.inc29
-rw-r--r--meta/packages/gcc/gcc-4.0.2/GCOV_PREFIX_STRIP-cross-profile_4.1.patch371
-rw-r--r--meta/packages/gcc/gcc-4.0.2/gcc-4.0.2-atmel.0.99.2.patch21330
-rw-r--r--meta/packages/gcc/gcc-4.0.2/libstdc++-configure.patch10
-rw-r--r--meta/packages/gcc/gcc-4.0.2/zecke-no-host-includes.patch (renamed from meta/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch)0
-rw-r--r--meta/packages/gcc/gcc-4.0.2/zecke-xgcc-cpp.patch (renamed from meta/packages/gcc/gcc-4.1.1/zecke-xgcc-cpp.patch)10
-rw-r--r--meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch544
-rw-r--r--meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch27
-rw-r--r--meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch3261
-rw-r--r--meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch46
-rw-r--r--meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch11
-rw-r--r--meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch11
-rw-r--r--meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch12
-rw-r--r--meta/packages/gcc/gcc-4.1.1/304-index_macro.patch24
-rw-r--r--meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch20
-rw-r--r--meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch25
-rw-r--r--meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch67
-rw-r--r--meta/packages/gcc/gcc-4.1.1/801-arm-bigendian-eabi.patch14
-rw-r--r--meta/packages/gcc/gcc-4.1.1/README4
-rw-r--r--meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch16
-rw-r--r--meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch29
-rw-r--r--meta/packages/gcc/gcc-4.1.1/arm-thumb.patch64
-rw-r--r--meta/packages/gcc/gcc-4.1.1/cse.patch75
-rw-r--r--meta/packages/gcc/gcc-4.1.1/fix-ICE-in-arm_unwind_emit_set.diff18
-rw-r--r--meta/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch26
-rw-r--r--meta/packages/gcc/gcc-4.1.1/gcc-ignore-cache.patch15
-rw-r--r--meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch22
-rw-r--r--meta/packages/gcc/gcc-4.1.1/ldflags.patch22
-rw-r--r--meta/packages/gcc/gcc-4.1.1/ppc-gcc-41-20060515.patch2225
-rw-r--r--meta/packages/gcc/gcc-4.1.1/ppc-sfp-long-double-gcc411-7.patch4271
-rw-r--r--meta/packages/gcc/gcc-4.1.1/sh3-installfix-fixheaders.patch11
-rw-r--r--meta/packages/gcc/gcc-4.1.1/unbreak-armv4t.patch12
-rw-r--r--meta/packages/gcc/gcc-4.1.2.inc60
-rw-r--r--meta/packages/gcc/gcc-4.2.2.inc74
-rw-r--r--meta/packages/gcc/gcc-common.inc35
-rw-r--r--meta/packages/gcc/gcc-configure-common.inc (renamed from meta/packages/gcc/gcc3-build.inc)50
-rw-r--r--meta/packages/gcc/gcc-configure-cross.inc (renamed from meta/packages/gcc/gcc3-build-cross.inc)20
-rw-r--r--meta/packages/gcc/gcc-configure-sdk.inc51
-rw-r--r--meta/packages/gcc/gcc-configure-target.inc6
-rw-r--r--meta/packages/gcc/gcc-cross-initial.inc6
-rw-r--r--meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3-2.bb2
-rw-r--r--meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb2
-rw-r--r--meta/packages/gcc/gcc-cross-kernel-3.4.4+csl-arm-2005q3-2/gcc-3.4.4-makefile-fix.patch29
-rw-r--r--meta/packages/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb10
-rw-r--r--meta/packages/gcc/gcc-cross-kernel.inc6
-rw-r--r--meta/packages/gcc/gcc-cross-kernel_csl-arm-2005q3-2.bb5
-rw-r--r--meta/packages/gcc/gcc-cross-sdk_3.4.4.bb18
-rw-r--r--meta/packages/gcc/gcc-cross-sdk_4.1.2.bb15
-rw-r--r--meta/packages/gcc/gcc-cross-sdk_4.2.2.bb15
-rw-r--r--meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3-2.bb11
-rw-r--r--meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3.bb8
-rw-r--r--meta/packages/gcc/gcc-cross_csl-arm-2005q3-2.bb15
-rw-r--r--meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb6
-rw-r--r--meta/packages/gcc/gcc-cross_csl-arm-2006q1.bb19
-rw-r--r--meta/packages/gcc/gcc-csl-arm-2005q3.inc22
-rw-r--r--meta/packages/gcc/gcc-csl-arm-2006q1.inc19
-rw-r--r--meta/packages/gcc/gcc-fpu.inc6
-rw-r--r--meta/packages/gcc/gcc-native.inc2
-rw-r--r--meta/packages/gcc/gcc-native_3.4.4.bb5
-rw-r--r--meta/packages/gcc/gcc-package-cross.inc80
-rw-r--r--meta/packages/gcc/gcc-package-sdk.inc14
-rw-r--r--meta/packages/gcc/gcc-package-target.inc157
-rw-r--r--meta/packages/gcc/gcc-paths-cross.inc7
-rw-r--r--meta/packages/gcc/gcc3-build-sdk.inc27
-rw-r--r--meta/packages/gcc/gcc4-build-cross.inc6
-rw-r--r--meta/packages/gcc/gcc4-build-sdk.inc20
-rw-r--r--meta/packages/gcc/gcc4-build.inc6
-rw-r--r--meta/packages/gcc/gcc_3.4.4.bb33
-rw-r--r--meta/packages/gcc/gcc_4.0.2.bb30
-rw-r--r--meta/packages/gcc/gcc_4.1.2.bb57
-rw-r--r--meta/packages/gcc/gcc_4.2.2.bb98
-rw-r--r--meta/packages/gcc/gcc_csl-arm-2005q3-2.bb27
-rw-r--r--meta/packages/gcc/gcc_csl-arm-2005q3.bb5
-rw-r--r--meta/packages/gcc/gcc_csl-arm-2006q1.bb32
95 files changed, 22779 insertions, 16962 deletions
diff --git a/meta/packages/gcc/gcc-3.4.3/15342.patch b/meta/packages/gcc/gcc-3.4.3/15342.patch
deleted file mode 100644
index d0f3e72d47..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/15342.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1--- gcc/gcc/regrename.c~ 2004-01-14 17:55:20.000000000 +0000
2+++ gcc/gcc/regrename.c 2005-02-28 07:24:25.893015200 +0000
3@@ -671,7 +671,8 @@
4
5 case SET:
6 scan_rtx (insn, &SET_SRC (x), class, action, OP_IN, 0);
7- scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 0);
8+ scan_rtx (insn, &SET_DEST (x), class, action,
9+ GET_CODE (PATTERN (insn)) == COND_EXEC ? OP_INOUT : OP_OUT, 0);
10 return;
11
12 case STRICT_LOW_PART:
13@@ -696,7 +697,8 @@
14 abort ();
15
16 case CLOBBER:
17- scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 1);
18+ scan_rtx (insn, &SET_DEST (x), class, action,
19+ GET_CODE (PATTERN (insn)) == COND_EXEC ? OP_INOUT : OP_OUT, 0);
20 return;
21
22 case EXPR_LIST:
diff --git a/meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff b/meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff
deleted file mode 100644
index d51da7157d..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff
+++ /dev/null
@@ -1,1100 +0,0 @@
1
2diff -aur gcc-3.4.0orig/gcc/c-common.c gcc-3.4.0/gcc/c-common.c
3--- gcc-3.4.0orig/gcc/c-common.c 2004-03-19 01:32:59.000000000 +0000
4+++ gcc-3.4.0/gcc/c-common.c 2004-05-10 21:05:33.000000000 +0100
5@@ -833,7 +833,7 @@
6 handle_deprecated_attribute },
7 { "vector_size", 1, 1, false, true, false,
8 handle_vector_size_attribute },
9- { "visibility", 1, 1, true, false, false,
10+ { "visibility", 1, 1, false, false, false,
11 handle_visibility_attribute },
12 { "tls_model", 1, 1, true, false, false,
13 handle_tls_model_attribute },
14@@ -4886,7 +4886,16 @@
15
16 *no_add_attrs = true;
17
18- if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
19+ if (TYPE_P (*node))
20+ {
21+ if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
22+ {
23+ warning ("`%s' attribute ignored on non-class types",
24+ IDENTIFIER_POINTER (name));
25+ return NULL_TREE;
26+ }
27+ }
28+ else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
29 {
30 warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
31 return NULL_TREE;
32@@ -4897,6 +4906,14 @@
33 error ("visibility arg not a string");
34 return NULL_TREE;
35 }
36+
37+ /* If this is a type, set the visibility on the type decl. */
38+ if (TYPE_P (decl))
39+ {
40+ decl = TYPE_NAME (decl);
41+ if (! decl)
42+ return NULL_TREE;
43+ }
44
45 if (strcmp (TREE_STRING_POINTER (id), "default") == 0)
46 DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
47@@ -4908,6 +4925,14 @@
48 DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED;
49 else
50 error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\"");
51+ DECL_VISIBILITYSPECIFIED (decl) = 1;
52+
53+ /* For decls only, go ahead and attach the attribute to the node as well.
54+ This is needed so we can determine whether we have VISIBILITY_DEFAULT
55+ because the visibility was not specified, or because it was explicitly
56+ overridden from the class visibility. */
57+ if (DECL_P (*node))
58+ *no_add_attrs = false;
59
60 return NULL_TREE;
61 }
62
63diff -aur gcc-3.4.0orig/gcc/c-decl.c gcc-3.4.0/gcc/c-decl.c
64--- gcc-3.4.0orig/gcc/c-decl.c 2004-03-22 17:58:18.000000000 +0000
65+++ gcc-3.4.0/gcc/c-decl.c 2004-05-10 15:16:27.000000000 +0100
66@@ -1164,9 +1164,8 @@
67 }
68
69 /* warnings */
70- /* All decls must agree on a non-default visibility. */
71- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
72- && DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT
73+ /* All decls must agree on a visibility. */
74+ if (DECL_VISIBILITYSPECIFIED (newdecl) && DECL_VISIBILITYSPECIFIED (olddecl)
75 && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
76 {
77 warning ("%Jredeclaration of '%D' with different visibility "
78@@ -1361,9 +1360,12 @@
79 Currently, it can only be defined in the prototype. */
80 COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
81
82- /* If either declaration has a nondefault visibility, use it. */
83- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
84- DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
85+ /* Use visibility of whichever declaration had it specified */
86+ if (DECL_VISIBILITYSPECIFIED (olddecl))
87+ {
88+ DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
89+ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
90+ }
91
92 if (TREE_CODE (newdecl) == FUNCTION_DECL)
93 {
94
95diff -aur gcc-3.4.0orig/gcc/common.opt gcc-3.4.0/gcc/common.opt
96--- gcc-3.4.0orig/gcc/common.opt 2004-02-18 00:09:04.000000000 +0000
97+++ gcc-3.4.0/gcc/common.opt 2004-05-09 08:10:50.000000000 +0100
98@@ -718,6 +718,11 @@
99 Common
100 Add extra commentary to assembler output
101
102+fvisibility=
103+Common Joined RejectNegative
104+-fvisibility=[default|internal|hidden|protected] Set the default symbol visibility
105+
106+
107 fvpt
108 Common
109 Use expression value profiles in optimizations
110
111diff -aur gcc-3.4.0orig/gcc/c.opt gcc-3.4.0/gcc/c.opt
112--- gcc-3.4.0orig/gcc/c.opt 2004-02-18 00:09:03.000000000 +0000
113+++ gcc-3.4.0/gcc/c.opt 2004-05-09 08:10:50.000000000 +0100
114@@ -656,6 +656,10 @@
115 C++ ObjC++
116 Use __cxa_atexit to register destructors
117
118+fvisibility-inlines-hidden
119+C++
120+Marks all inlined methods as having hidden visibility
121+
122 fvtable-gc
123 C++ ObjC++
124 Discard unused virtual functions
125diff -aur gcc-3.4.0orig/gcc/c-opts.c gcc-3.4.0/gcc/c-opts.c
126--- gcc-3.4.0orig/gcc/c-opts.c 2004-02-18 00:09:03.000000000 +0000
127+++ gcc-3.4.0/gcc/c-opts.c 2004-05-09 08:10:50.000000000 +0100
128@@ -912,6 +912,10 @@
129 case OPT_fuse_cxa_atexit:
130 flag_use_cxa_atexit = value;
131 break;
132+
133+ case OPT_fvisibility_inlines_hidden:
134+ visibility_options.inlineshidden = value;
135+ break;
136
137 case OPT_fweak:
138 flag_weak = value;
139
140diff -aur gcc-3.4.0orig/gcc/cp/class.c gcc-3.4.0/gcc/cp/class.c
141--- gcc-3.4.0orig/gcc/cp/class.c 2004-03-09 07:27:23.000000000 +0000
142+++ gcc-3.4.0/gcc/cp/class.c 2004-05-10 21:06:50.000000000 +0100
143@@ -524,6 +524,10 @@
144 DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
145 DECL_ALIGN (decl));
146
147+ /* The vtable's visibility is the class visibility. There is no way
148+ to override the visibility for just the vtable. */
149+ DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
150+ DECL_VISIBILITYSPECIFIED (decl) = CLASSTYPE_VISIBILITYSPECIFIED (class_type);
151 import_export_vtable (decl, class_type, 0);
152
153 return decl;
154@@ -2971,7 +2975,25 @@
155 continue;
156
157 if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
158- continue;
159+ {
160+ /* Apply the class's visibility attribute to static members
161+ which do not have a visibility attribute. */
162+ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
163+ {
164+ if (visibility_options.inlineshidden && DECL_INLINE (x))
165+ {
166+ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
167+ DECL_VISIBILITYSPECIFIED (x) = 1;
168+ }
169+ else
170+ {
171+ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
172+ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
173+ }
174+ }
175+
176+ continue;
177+ }
178
179 /* Now it can only be a FIELD_DECL. */
180
181@@ -3708,6 +3730,22 @@
182 check_for_override (x, t);
183 if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
184 cp_error_at ("initializer specified for non-virtual method `%D'", x);
185+
186+ /* Apply the class's visibility attribute to methods which do
187+ not have a visibility attribute. */
188+ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
189+ {
190+ if (visibility_options.inlineshidden && DECL_INLINE (x))
191+ {
192+ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
193+ DECL_VISIBILITYSPECIFIED (x) = 1;
194+ }
195+ else
196+ {
197+ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
198+ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
199+ }
200+ }
201
202 /* The name of the field is the original field name
203 Save this in auxiliary field for later overloading. */
204@@ -7830,3 +7868,4 @@
205 *vid->last_init = build_tree_list (NULL_TREE, init);
206 vid->last_init = &TREE_CHAIN (*vid->last_init);
207 }
208+
209
210diff -aur gcc-3.4.0orig/gcc/cp/cp-tree.h gcc-3.4.0/gcc/cp/cp-tree.h
211--- gcc-3.4.0orig/gcc/cp/cp-tree.h 2004-03-20 00:13:08.000000000 +0000
212+++ gcc-3.4.0/gcc/cp/cp-tree.h 2004-05-10 20:56:56.000000000 +0100
213@@ -1008,7 +1008,12 @@
214 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
215 (lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL) \
216 != NULL_TREE)
217-
218+
219+/* Gives the visibility specification for a class type. */
220+#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE))
221+#define CLASSTYPE_VISIBILITYSPECIFIED(TYPE) DECL_VISIBILITYSPECIFIED (TYPE_NAME (TYPE))
222+
223+
224 /* This is a few header flags for 'struct lang_type'. Actually,
225 all but the first are used only for lang_type_class; they
226 are put in this structure to save space. */
227
228diff -aur gcc-3.4.0orig/gcc/cp/decl.c gcc-3.4.0/gcc/cp/decl.c
229--- gcc-3.4.0orig/gcc/cp/decl.c 2004-04-01 21:47:21.000000000 +0100
230+++ gcc-3.4.0/gcc/cp/decl.c 2004-05-28 21:16:11.000000000 +0100
231@@ -1869,17 +1869,34 @@
232 DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
233 COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
234
235- /* If either declaration has a nondefault visibility, use it. */
236- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
237+ /* Warn about conflicting visibility specifications. */
238+ if (DECL_VISIBILITYSPECIFIED (olddecl) && DECL_VISIBILITYSPECIFIED (newdecl)
239+ && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
240+ {
241+ warning ("%J'%D': visibility attribute ignored because it",
242+ newdecl, newdecl);
243+ warning ("%Jconflicts with previous declaration here", olddecl);
244+ }
245+ /* Choose the declaration which specified visibility. */
246+ if (DECL_VISIBILITYSPECIFIED (olddecl))
247 {
248- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
249- && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
250- {
251- warning ("%J'%D': visibility attribute ignored because it",
252- newdecl, newdecl);
253- warning ("%Jconflicts with previous declaration here", olddecl);
254- }
255 DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
256+ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
257+ }
258+ /* If it's a definition of a global operator new or operator
259+ delete, it must be default visibility. */
260+ if (NEW_DELETE_OPNAME_P (DECL_NAME (newdecl)) && DECL_INITIAL (newdecl) != NULL_TREE)
261+ {
262+ if (!DECL_FUNCTION_MEMBER_P (newdecl) && VISIBILITY_DEFAULT != DECL_VISIBILITY (newdecl))
263+ {
264+ warning ("%J`%D': ignoring non-default symbol",
265+ newdecl, newdecl);
266+ warning ("%Jvisibility on global operator new or delete", newdecl);
267+ DECL_VISIBILITY (olddecl) = VISIBILITY_DEFAULT;
268+ DECL_VISIBILITYSPECIFIED (olddecl) = 1;
269+ DECL_VISIBILITY (newdecl) = VISIBILITY_DEFAULT;
270+ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
271+ }
272 }
273
274 if (TREE_CODE (newdecl) == FUNCTION_DECL)
275
276diff -aur gcc-3.4.0orig/gcc/cp/method.c gcc-3.4.0/gcc/cp/method.c
277--- gcc-3.4.0orig/gcc/cp/method.c 2004-04-08 23:15:58.000000000 +0100
278+++ gcc-3.4.0/gcc/cp/method.c 2004-05-09 08:10:52.000000000 +0100
279@@ -394,6 +394,7 @@
280 rewrite. */
281 TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
282 DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
283+ DECL_VISIBILITYSPECIFIED (thunk_fndecl) = DECL_VISIBILITYSPECIFIED (function);
284
285 if (flag_syntax_only)
286 {
287
288diff -aur gcc-3.4.0orig/gcc/cp/optimize.c gcc-3.4.0/gcc/cp/optimize.c
289--- gcc-3.4.0orig/gcc/cp/optimize.c 2004-02-08 01:52:50.000000000 +0000
290+++ gcc-3.4.0/gcc/cp/optimize.c 2004-05-09 08:10:52.000000000 +0100
291@@ -155,6 +155,7 @@
292 DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
293 TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
294 DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
295+ DECL_VISIBILITYSPECIFIED (clone) = DECL_VISIBILITYSPECIFIED (fn);
296
297 /* Adjust the parameter names and locations. */
298 parm = DECL_ARGUMENTS (fn);
299
300diff -aur gcc-3.4.0orig/gcc/cp/rtti.c gcc-3.4.0/gcc/cp/rtti.c
301--- gcc-3.4.0orig/gcc/cp/rtti.c 2004-03-08 23:00:26.000000000 +0000
302+++ gcc-3.4.0/gcc/cp/rtti.c 2004-05-10 21:09:21.000000000 +0100
303@@ -361,7 +361,11 @@
304 pushdecl_top_level_and_finish (d, NULL_TREE);
305
306 if (CLASS_TYPE_P (type))
307- CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
308+ {
309+ CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
310+ DECL_VISIBILITY (d) = CLASSTYPE_VISIBILITY (type);
311+ DECL_VISIBILITYSPECIFIED (d) = CLASSTYPE_VISIBILITYSPECIFIED (type);
312+ }
313
314 /* Remember the type it is for. */
315 TREE_TYPE (name) = type;
316@@ -759,6 +763,11 @@
317 TREE_STATIC (name_decl) = 1;
318 DECL_EXTERNAL (name_decl) = 0;
319 TREE_PUBLIC (name_decl) = 1;
320+ if (CLASS_TYPE_P (target))
321+ {
322+ DECL_VISIBILITY (name_decl) = CLASSTYPE_VISIBILITY (target);
323+ DECL_VISIBILITYSPECIFIED (name_decl) = CLASSTYPE_VISIBILITYSPECIFIED (target);
324+ }
325 import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target));
326 /* External name of the string containing the type's name has a
327 special name. */
328
329diff -aur gcc-3.4.0orig/gcc/c-pragma.c gcc-3.4.0/gcc/c-pragma.c
330--- gcc-3.4.0orig/gcc/c-pragma.c 2004-01-23 23:35:53.000000000 +0000
331+++ gcc-3.4.0/gcc/c-pragma.c 2004-05-09 08:10:52.000000000 +0100
332@@ -480,6 +480,86 @@
333 return asmname;
334 }
335
336+
337+#ifdef HANDLE_PRAGMA_VISIBILITY
338+static void handle_pragma_visibility (cpp_reader *);
339+
340+/* Sets the default visibility for symbols to something other than that
341+ specified on the command line. */
342+static void
343+handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
344+{ /* Form is #pragma GCC visibility push(hidden)|pop */
345+ static int visstack [16], visidx;
346+ tree x;
347+ enum cpp_ttype token;
348+ enum { bad, push, pop } action = bad;
349+
350+ token = c_lex (&x);
351+ if (token == CPP_NAME)
352+ {
353+ const char *op = IDENTIFIER_POINTER (x);
354+ if (!strcmp (op, "push"))
355+ action = push;
356+ else if (!strcmp (op, "pop"))
357+ action = pop;
358+ }
359+ if (bad == action)
360+ GCC_BAD ("#pragma GCC visibility must be followed by push or pop");
361+ else
362+ {
363+ if (pop == action)
364+ {
365+ if (!visidx)
366+ {
367+ GCC_BAD ("No matching push for '#pragma GCC visibility pop'");
368+ }
369+ else
370+ {
371+ default_visibility = visstack[--visidx];
372+ visibility_options.inpragma = (visidx>0);
373+ }
374+ }
375+ else
376+ {
377+ if (c_lex (&x) != CPP_OPEN_PAREN)
378+ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
379+ token = c_lex (&x);
380+ if (token != CPP_NAME)
381+ {
382+ GCC_BAD ("malformed #pragma GCC visibility push");
383+ }
384+ else if (visidx >= 16)
385+ {
386+ GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once");
387+ }
388+ else
389+ {
390+ const char *str = IDENTIFIER_POINTER (x);
391+ visstack[visidx++] = default_visibility;
392+ if (!strcmp (str, "default"))
393+ default_visibility = VISIBILITY_DEFAULT;
394+ else if (!strcmp (str, "internal"))
395+ default_visibility = VISIBILITY_INTERNAL;
396+ else if (!strcmp (str, "hidden"))
397+ default_visibility = VISIBILITY_HIDDEN;
398+ else if (!strcmp (str, "protected"))
399+ default_visibility = VISIBILITY_PROTECTED;
400+ else
401+ {
402+ GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected");
403+ }
404+ visibility_options.inpragma = 1;
405+ }
406+ if (c_lex (&x) != CPP_CLOSE_PAREN)
407+ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
408+ }
409+ }
410+ if (c_lex (&x) != CPP_EOF)
411+ warning ("junk at end of '#pragma GCC visibility'");
412+}
413+
414+#endif
415+
416 /* Front-end wrapper for pragma registration to avoid dragging
417 cpplib.h in almost everywhere. */
418 void
419@@ -505,6 +585,9 @@
420 #ifdef HANDLE_PRAGMA_EXTERN_PREFIX
421 c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
422 #endif
423+#ifdef HANDLE_PRAGMA_VISIBILITY
424+ c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
425+#endif
426
427 #ifdef REGISTER_TARGET_PRAGMAS
428 REGISTER_TARGET_PRAGMAS ();
429diff -aur gcc-3.4.0orig/gcc/c-pragma.h gcc-3.4.0/gcc/c-pragma.h
430--- gcc-3.4.0orig/gcc/c-pragma.h 2004-01-31 06:18:05.000000000 +0000
431+++ gcc-3.4.0/gcc/c-pragma.h 2004-05-09 08:10:53.000000000 +0100
432@@ -44,6 +44,11 @@
433 #define HANDLE_PRAGMA_PACK 1
434 #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
435
436+/* It's safe to always leave visibility pragma enabled as if
437+ visibility is not supported on the host OS platform the
438+ statements are ignored. */
439+#define HANDLE_PRAGMA_VISIBILITY 1
440+
441 extern void init_pragma (void);
442
443 /* Front-end wrapper for pragma registration to avoid dragging
444
445
446diff -aur gcc-3.4.0orig/gcc/doc/invoke.texi gcc-3.4.0/gcc/doc/invoke.texi
447--- gcc-3.4.0orig/gcc/doc/invoke.texi 2004-04-19 00:05:36.000000000 +0100
448+++ gcc-3.4.0/gcc/doc/invoke.texi 2004-05-28 21:29:36.000000000 +0100
449@@ -183,7 +183,8 @@
450 -fno-optional-diags -fpermissive @gol
451 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
452 -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
453--fno-default-inline -Wabi -Wctor-dtor-privacy @gol
454+-fno-default-inline -fvisibility-inlines-hidden @gol
455+-Wabi -Wctor-dtor-privacy @gol
456 -Wnon-virtual-dtor -Wreorder @gol
457 -Weffc++ -Wno-deprecated @gol
458 -Wno-non-template-friend -Wold-style-cast @gol
459@@ -674,7 +675,8 @@
460 -fargument-alias -fargument-noalias @gol
461 -fargument-noalias-global -fleading-underscore @gol
462 -ftls-model=@var{model} @gol
463--ftrapv -fwrapv -fbounds-check}
464+-ftrapv -fwrapv -fbounds-check @gol
465+-fvisibility}
466 @end table
467
468 @menu
469@@ -1433,6 +1435,20 @@
470 destructors, but will only work if your C library supports
471 @code{__cxa_atexit}.
472
473+@item -fvisibility-inlines-hidden
474+@opindex fvisibility-inlines-hidden
475+Causes all inlined methods to be marked with
476+@code{__attribute__ ((visibility ("hidden")))} so that they do not
477+appear in the export table of a DSO and do not require a PLT indirection
478+when used within the DSO. Enabling this option can have a dramatic effect
479+on load and link times of a DSO as it massively reduces the size of the
480+dynamic export table when the library makes heavy use of templates. While
481+it can cause bloating through duplication of code within each DSO where
482+it is used, often the wastage is less than the considerable space occupied
483+by a long symbol name in the export table which is typical when using
484+templates and namespaces. For even more savings, combine with the
485+@code{-fvisibility=hidden} switch.
486+
487 @item -fno-weak
488 @opindex fno-weak
489 Do not use weak symbol support, even if it is provided by the linker.
490@@ -11198,6 +11214,54 @@
491
492 The default without @option{-fpic} is @code{initial-exec}; with
493 @option{-fpic} the default is @code{global-dynamic}.
494+
495+@item -fvisibility=@var{default|internal|hidden|protected}
496+@opindex fvisibility
497+Set the default ELF image symbol visibility to the specified option - all
498+symbols will be marked with this unless overrided within the code.
499+Using this feature can very substantially improve linking and
500+load times of shared object libraries, produce more optimised
501+code, provide near-perfect API export and prevent symbol clashes.
502+It is @strong{strongly} recommended that you use this in any shared objects
503+you distribute.
504+
505+Despite the nomenclature, @code{default} always means public ie;
506+available to be linked against from outside the shared object.
507+@code{protected} and @code{internal} are pretty useless in real-world
508+usage so the only other commonly used option will be @code{hidden}.
509+The default if -fvisibility isn't specified is @code{default} ie; make every
510+symbol public - this causes the same behaviour as previous versions of
511+GCC.
512+
513+A good explanation of the benefits offered by ensuring ELF
514+symbols have the correct visibility is given by ``How To Write
515+Shared Libraries'' by Ulrich Drepper (which can be found at
516+@w{@uref{http://people.redhat.com/~drepper/}}) - however a superior
517+solution made possible by this option to marking things hidden when
518+the default is public is to make the default hidden and mark things
519+public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
520+and @code{__attribute__ ((visibility("default")))} instead of
521+@code{__declspec(dllexport)} you get almost identical semantics with
522+identical syntax. This is a great boon to those working with
523+cross-platform projects.
524+
525+For those adding visibility support to existing code, you may find
526+@samp{#pragma GCC visibility} of use. This works by you enclosing
527+the declarations you wish to set visibility for with (for example)
528+@samp{#pragma GCC visibility push(hidden)} and
529+@samp{#pragma GCC visibility pop}. These can be nested up to sixteen
530+times. Bear in mind that symbol visibility should be viewed @strong{as
531+part of the API interface contract} and thus all new code should
532+always specify visibility when it is not the default ie; declarations
533+only for use within the local DSO should @strong{always} be marked explicitly
534+as hidden as so to avoid PLT indirection overheads - making this
535+abundantly clear also aids readability and self-documentation of the code.
536+Note that due to ISO C++ specification requirements, operator new and
537+operator delete must always be of default visibility.
538+
539+An overview of these techniques, their benefits and how to use them
540+is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}.
541+
542 @end table
543
544 @c man end
545
546diff -aur gcc-3.4.0orig/gcc/flags.h gcc-3.4.0/gcc/flags.h
547--- gcc-3.4.0orig/gcc/flags.h 2004-02-18 00:09:04.000000000 +0000
548+++ gcc-3.4.0/gcc/flags.h 2004-05-09 08:10:53.000000000 +0100
549@@ -60,6 +60,30 @@
550 /* Nonzero means emit debugging information only for symbols which are used. */
551 extern int flag_debug_only_used_symbols;
552
553+/* Enumerate visibility settings. */
554+#ifndef SYMBOL_VISIBILITY_DEFINED
555+#define SYMBOL_VISIBILITY_DEFINED
556+enum symbol_visibility
557+{
558+ VISIBILITY_DEFAULT,
559+ VISIBILITY_INTERNAL,
560+ VISIBILITY_HIDDEN,
561+ VISIBILITY_PROTECTED
562+};
563+#endif
564+
565+/* The default visibility for all symbols (unless overridden). */
566+extern enum symbol_visibility default_visibility;
567+
568+struct visibility_flags
569+{
570+ unsigned inpragma : 1; /* True when in #pragma GCC visibility. */
571+ unsigned inlineshidden : 1; /* True when -finlineshidden in effect. */
572+};
573+
574+/* Global visibility options. */
575+extern struct visibility_flags visibility_options;
576+
577 /* Nonzero means do optimizations. -opt. */
578
579 extern int optimize;
580
581diff -aur gcc-3.4.0orig/gcc/opts.c gcc-3.4.0/gcc/opts.c
582--- gcc-3.4.0orig/gcc/opts.c 2004-02-18 00:09:04.000000000 +0000
583+++ gcc-3.4.0/gcc/opts.c 2004-05-09 08:10:53.000000000 +0100
584@@ -142,6 +142,12 @@
585 write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
586 bool use_gnu_debug_info_extensions;
587
588+/* The default visibility for all symbols (unless overridden) */
589+enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
590+
591+/* Global visibility options. */
592+struct visibility_flags visibility_options;
593+
594 /* Columns of --help display. */
595 static unsigned int columns = 80;
596
597@@ -1440,6 +1446,21 @@
598 flag_verbose_asm = value;
599 break;
600
601+ case OPT_fvisibility_:
602+ {
603+ if(!strcmp(arg, "default"))
604+ default_visibility=VISIBILITY_DEFAULT;
605+ else if(!strcmp(arg, "internal"))
606+ default_visibility=VISIBILITY_INTERNAL;
607+ else if(!strcmp(arg, "hidden"))
608+ default_visibility=VISIBILITY_HIDDEN;
609+ else if(!strcmp(arg, "protected"))
610+ default_visibility=VISIBILITY_PROTECTED;
611+ else
612+ error("unrecognised visibility value \"%s\"", arg);
613+ }
614+ break;
615+
616 case OPT_fweb:
617 flag_web = value;
618 break;
619
620diff -aur gcc-3.4.0orig/gcc/tree.c gcc-3.4.0/gcc/tree.c
621--- gcc-3.4.0orig/gcc/tree.c 2004-02-05 22:01:35.000000000 +0000
622+++ gcc-3.4.0/gcc/tree.c 2004-05-10 15:22:52.000000000 +0100
623@@ -2563,6 +2563,11 @@
624 layout_decl (t, 0);
625 else if (code == FUNCTION_DECL)
626 DECL_MODE (t) = FUNCTION_MODE;
627+
628+ /* Set default visibility to whatever the user supplied with
629+ visibility_specified depending on #pragma GCC visibility. */
630+ DECL_VISIBILITY (t) = default_visibility;
631+ DECL_VISIBILITYSPECIFIED (t) = visibility_options.inpragma;
632
633 return t;
634 }
635
636diff -aur gcc-3.4.0orig/gcc/tree.h gcc-3.4.0/gcc/tree.h
637--- gcc-3.4.0orig/gcc/tree.h 2004-02-08 01:52:43.000000000 +0000
638+++ gcc-3.4.0/gcc/tree.h 2004-05-09 08:10:54.000000000 +0100
639@@ -1499,6 +1499,10 @@
640 /* Value of the decls's visibility attribute */
641 #define DECL_VISIBILITY(NODE) (DECL_CHECK (NODE)->decl.visibility)
642
643+/* Nonzero means that the decl had its visibility specified rather than
644+ being inferred. */
645+#define DECL_VISIBILITYSPECIFIED(NODE) (DECL_CHECK (NODE)->decl.visibility_specified)
646+
647 /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
648 #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable)
649
650@@ -1633,7 +1637,8 @@
651 || TREE_CODE (DECL_CONTEXT (EXP)) == TRANSLATION_UNIT_DECL)
652
653 /* Enumerate visibility settings. */
654-
655+#ifndef SYMBOL_VISIBILITY_DEFINED
656+#define SYMBOL_VISIBILITY_DEFINED
657 enum symbol_visibility
658 {
659 VISIBILITY_DEFAULT,
660@@ -1641,6 +1646,7 @@
661 VISIBILITY_HIDDEN,
662 VISIBILITY_PROTECTED
663 };
664+#endif
665
666 struct function;
667
668@@ -1684,8 +1690,7 @@
669 unsigned thread_local_flag : 1;
670 unsigned declared_inline_flag : 1;
671 ENUM_BITFIELD(symbol_visibility) visibility : 2;
672- unsigned unused : 1;
673- /* one unused bit. */
674+ unsigned visibility_specified : 1;
675
676 unsigned lang_flag_0 : 1;
677 unsigned lang_flag_1 : 1;
678
679diff -aur gcc-3.4.0orig/gcc/varasm.c gcc-3.4.0/gcc/varasm.c
680--- gcc-3.4.0orig/gcc/varasm.c 2004-04-14 22:14:08.000000000 +0100
681+++ gcc-3.4.0/gcc/varasm.c 2004-05-09 08:10:54.000000000 +0100
682@@ -5150,8 +5150,8 @@
683 /* Static variables are always local. */
684 else if (! TREE_PUBLIC (exp))
685 local_p = true;
686- /* A variable is local if the user tells us so. */
687- else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
688+ /* A variable is local if the user explicitly tells us so. */
689+ else if (DECL_VISIBILITYSPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
690 local_p = true;
691 /* Otherwise, variables defined outside this object may not be local. */
692 else if (DECL_EXTERNAL (exp))
693@@ -5159,6 +5159,9 @@
694 /* Linkonce and weak data are never local. */
695 else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp))
696 local_p = false;
697+ /* If none of the above and visibility is not default, make local. */
698+ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
699+ local_p = true;
700 /* If PIC, then assume that any global name can be overridden by
701 symbols resolved from other modules. */
702 else if (shlib)
703
704diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c
705--- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c 1970-01-01 01:00:00.000000000 +0100
706+++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c 2004-05-09 12:40:39.000000000 +0100
707@@ -0,0 +1,9 @@
708+/* Test that -fvisibility works. */
709+/* { dg-do compile } */
710+/* { dg-require-visibility "" } */
711+/* { dg-options "-fvisibility=hidden" } */
712+/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
713+
714+void foo();
715+
716+void foo() { }
717diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c
718--- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c 1970-01-01 01:00:00.000000000 +0100
719+++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c 2004-05-09 12:55:04.000000000 +0100
720@@ -0,0 +1,10 @@
721+/* Test that #pragma GCC visibility works. */
722+/* { dg-do compile } */
723+/* { dg-require-visibility "" } */
724+/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
725+
726+#pragma GCC visibility push(hidden)
727+void foo();
728+#pragma GCC visibility pop
729+
730+void foo() { }
731diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C
732--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 1970-01-01 01:00:00.000000000 +0100
733+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 2004-05-09 19:17:13.000000000 +0100
734@@ -0,0 +1,12 @@
735+/* Test that -fvisibility affects class members. */
736+/* { dg-do compile } */
737+/* { dg-require-visibility "" } */
738+/* { dg-options "-fvisibility=hidden" } */
739+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
740+
741+class Foo
742+{
743+ void method();
744+};
745+
746+void Foo::method() { }
747diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C
748--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 1970-01-01 01:00:00.000000000 +0100
749+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 2004-05-09 19:17:59.000000000 +0100
750@@ -0,0 +1,18 @@
751+/* Test that -fvisibility-inlines-hidden affects class members. */
752+/* { dg-do compile } */
753+/* { dg-require-visibility "" } */
754+/* { dg-options "-fvisibility-inlines-hidden" } */
755+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
756+
757+class Foo
758+{
759+public:
760+ void method() { }
761+};
762+
763+int main(void)
764+{
765+ Foo f;
766+ f.method();
767+ return 0;
768+}
769diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C
770--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 1970-01-01 01:00:00.000000000 +0100
771+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 2004-05-09 19:18:06.000000000 +0100
772@@ -0,0 +1,12 @@
773+/* Test that -fvisibility does not override class member specific settings. */
774+/* { dg-do compile } */
775+/* { dg-require-visibility "" } */
776+/* { dg-options "-fvisibility=hidden" } */
777+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
778+
779+class __attribute__ ((visibility ("internal"))) Foo
780+{
781+ void method();
782+};
783+
784+void Foo::method() { }
785diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C
786--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 1970-01-01 01:00:00.000000000 +0100
787+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 2004-05-09 19:18:12.000000000 +0100
788@@ -0,0 +1,12 @@
789+/* Test that -fvisibility does not override class member specific settings. */
790+/* { dg-do compile } */
791+/* { dg-require-visibility "" } */
792+/* { dg-options "-fvisibility=hidden" } */
793+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
794+
795+class Foo
796+{
797+ __attribute__ ((visibility ("internal"))) void method();
798+};
799+
800+void Foo::method() { }
801diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C
802--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 1970-01-01 01:00:00.000000000 +0100
803+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 2004-05-09 19:18:19.000000000 +0100
804@@ -0,0 +1,11 @@
805+/* Test that setting visibility for class member functions works. */
806+/* { dg-do compile } */
807+/* { dg-require-visibility "" } */
808+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
809+
810+class __attribute__ ((visibility ("hidden"))) Foo
811+{
812+ void method();
813+};
814+
815+void Foo::method() { }
816diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C
817--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 1970-01-01 01:00:00.000000000 +0100
818+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 2004-05-09 19:21:49.000000000 +0100
819@@ -0,0 +1,20 @@
820+/* Test that -fvisibility=hidden prevents PLT. */
821+/* { dg-do compile } */
822+/* { dg-require-visibility "" } */
823+/* { dg-options "-fPIC -fvisibility=hidden" } */
824+/* { dg-final { scan-assembler-not "methodEv@PLT" } } */
825+
826+class Foo
827+{
828+public:
829+ void method();
830+};
831+
832+void Foo::method() { }
833+
834+int main(void)
835+{
836+ Foo f;
837+ f.method();
838+ return 0;
839+}
840diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C
841--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C 1970-01-01 01:00:00.000000000 +0100
842+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C 2004-05-09 19:18:30.000000000 +0100
843@@ -0,0 +1,13 @@
844+/* Test that #pragma GCC visibility affects class members. */
845+/* { dg-do compile } */
846+/* { dg-require-visibility "" } */
847+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
848+
849+#pragma GCC visibility push(hidden)
850+class Foo
851+{
852+ void method();
853+};
854+#pragma GCC visibility pop
855+
856+void Foo::method() { }
857diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C
858--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 1970-01-01 01:00:00.000000000 +0100
859+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 2004-05-09 19:18:36.000000000 +0100
860@@ -0,0 +1,13 @@
861+/* Test that #pragma GCC visibility does not override class member specific settings. */
862+/* { dg-do compile } */
863+/* { dg-require-visibility "" } */
864+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
865+
866+#pragma GCC visibility push(hidden)
867+class __attribute__ ((visibility ("internal"))) Foo
868+{
869+ void method();
870+};
871+#pragma GCC visibility pop
872+
873+void Foo::method() { }
874diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C
875--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 1970-01-01 01:00:00.000000000 +0100
876+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 2004-05-09 19:18:44.000000000 +0100
877@@ -0,0 +1,13 @@
878+/* Test that #pragma GCC visibility does not override class member specific settings. */
879+/* { dg-do compile } */
880+/* { dg-require-visibility "" } */
881+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
882+
883+#pragma GCC visibility push(hidden)
884+class Foo
885+{
886+ __attribute__ ((visibility ("internal"))) void method();
887+};
888+#pragma GCC visibility pop
889+
890+void Foo::method() { }
891diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C
892--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 1970-01-01 01:00:00.000000000 +0100
893+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 2004-05-09 19:18:50.000000000 +0100
894@@ -0,0 +1,11 @@
895+/* Test that setting visibility for static class member functions works. */
896+/* { dg-do compile } */
897+/* { dg-require-visibility "" } */
898+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
899+
900+class __attribute__ ((visibility ("hidden"))) Foo
901+{
902+ static void method();
903+};
904+
905+void Foo::method() { }
906diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C
907--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C 1970-01-01 01:00:00.000000000 +0100
908+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C 2004-05-09 13:24:06.000000000 +0100
909@@ -0,0 +1,11 @@
910+/* Test that setting visibility for class affects virtual table. */
911+/* { dg-do compile } */
912+/* { dg-require-visibility "" } */
913+/* { dg-final { scan-assembler "\\.hidden.*ZTV3Foo" } } */
914+
915+class __attribute__ ((visibility ("hidden"))) Foo
916+{
917+ virtual void method();
918+};
919+
920+void Foo::method() { }
921diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C
922--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 1970-01-01 01:00:00.000000000 +0100
923+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 2003-12-10 06:34:44.000000000 +0000
924@@ -0,0 +1,8 @@
925+/* Test visibility attribute on function definition. */
926+/* { dg-do compile { target *86-*-linux* } } */
927+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
928+
929+void
930+__attribute__((visibility ("hidden")))
931+foo()
932+{ }
933diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C
934--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 1970-01-01 01:00:00.000000000 +0100
935+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 2003-12-10 06:34:44.000000000 +0000
936@@ -0,0 +1,7 @@
937+/* Test that visibility attribute on declaration extends to definition. */
938+/* { dg-do compile { target *86-*-linux* } } */
939+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
940+
941+void __attribute__((visibility ("hidden"))) foo();
942+
943+void foo() { }
944diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C
945--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 1970-01-01 01:00:00.000000000 +0100
946+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 2003-12-10 06:34:45.000000000 +0000
947@@ -0,0 +1,7 @@
948+/* Test visibility attribute on forward declaration of global variable */
949+/* { dg-do compile { target *86-*-linux* } } */
950+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
951+
952+int
953+__attribute__((visibility ("hidden")))
954+xyzzy = 5;
955diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C
956--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 1970-01-01 01:00:00.000000000 +0100
957+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 2003-12-10 06:34:45.000000000 +0000
958@@ -0,0 +1,8 @@
959+/* Test visibility attribute on forward declaration of global variable */
960+/* { dg-do compile { target *86-*-linux* } } */
961+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
962+
963+extern int __attribute__ ((visibility ("hidden")))
964+xyzzy;
965+
966+int xyzzy = 5;
967diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C
968--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 1970-01-01 01:00:00.000000000 +0100
969+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 2003-12-10 06:34:45.000000000 +0000
970@@ -0,0 +1,11 @@
971+/* Test visibility attribute on definition of a function that has
972+ already had a forward declaration. */
973+/* { dg-do compile { target *86-*-linux* } } */
974+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
975+
976+void foo();
977+
978+void
979+ __attribute__((visibility ("hidden")))
980+foo()
981+{ }
982diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C
983--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 1970-01-01 01:00:00.000000000 +0100
984+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 2003-12-10 06:34:45.000000000 +0000
985@@ -0,0 +1,10 @@
986+/* Test visibility attribute on definition of global variable that has
987+ already had a forward declaration. */
988+/* { dg-do compile { target *86-*-linux* } } */
989+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
990+
991+extern int xyzzy;
992+
993+int
994+__attribute__((visibility ("hidden")))
995+xyzzy = 5;
996diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C
997--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 1970-01-01 01:00:00.000000000 +0100
998+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 2003-12-10 06:34:45.000000000 +0000
999@@ -0,0 +1,11 @@
1000+/* Test warning from conflicting visibility specifications. */
1001+/* { dg-do compile { target *86-*-linux* } } */
1002+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1003+
1004+extern int
1005+__attribute__((visibility ("hidden")))
1006+xyzzy; /* { dg-warning "previous declaration here" "" } */
1007+
1008+int
1009+__attribute__((visibility ("protected")))
1010+xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
1011diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C
1012--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C 2003-12-10 06:34:44.000000000 +0000
1013+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C 1970-01-01 01:00:00.000000000 +0100
1014@@ -1,8 +0,0 @@
1015-/* Test visibility attribute on function definition. */
1016-/* { dg-do compile { target *86-*-linux* } } */
1017-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1018-
1019-void
1020-__attribute__((visibility ("hidden")))
1021-foo()
1022-{ }
1023diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C
1024--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C 2003-12-10 06:34:44.000000000 +0000
1025+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C 1970-01-01 01:00:00.000000000 +0100
1026@@ -1,7 +0,0 @@
1027-/* Test that visibility attribute on declaration extends to definition. */
1028-/* { dg-do compile { target *86-*-linux* } } */
1029-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1030-
1031-void __attribute__((visibility ("hidden"))) foo();
1032-
1033-void foo() { }
1034diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C
1035--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C 2003-12-10 06:34:45.000000000 +0000
1036+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C 1970-01-01 01:00:00.000000000 +0100
1037@@ -1,7 +0,0 @@
1038-/* Test visibility attribute on forward declaration of global variable */
1039-/* { dg-do compile { target *86-*-linux* } } */
1040-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1041-
1042-int
1043-__attribute__((visibility ("hidden")))
1044-xyzzy = 5;
1045diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C
1046--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C 2003-12-10 06:34:45.000000000 +0000
1047+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C 1970-01-01 01:00:00.000000000 +0100
1048@@ -1,8 +0,0 @@
1049-/* Test visibility attribute on forward declaration of global variable */
1050-/* { dg-do compile { target *86-*-linux* } } */
1051-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1052-
1053-extern int __attribute__ ((visibility ("hidden")))
1054-xyzzy;
1055-
1056-int xyzzy = 5;
1057diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C
1058--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C 2003-12-10 06:34:45.000000000 +0000
1059+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C 1970-01-01 01:00:00.000000000 +0100
1060@@ -1,11 +0,0 @@
1061-/* Test visibility attribute on definition of a function that has
1062- already had a forward declaration. */
1063-/* { dg-do compile { target *86-*-linux* } } */
1064-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1065-
1066-void foo();
1067-
1068-void
1069- __attribute__((visibility ("hidden")))
1070-foo()
1071-{ }
1072diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C
1073--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C 2003-12-10 06:34:45.000000000 +0000
1074+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C 1970-01-01 01:00:00.000000000 +0100
1075@@ -1,10 +0,0 @@
1076-/* Test visibility attribute on definition of global variable that has
1077- already had a forward declaration. */
1078-/* { dg-do compile { target *86-*-linux* } } */
1079-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1080-
1081-extern int xyzzy;
1082-
1083-int
1084-__attribute__((visibility ("hidden")))
1085-xyzzy = 5;
1086diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C
1087--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C 2003-12-10 06:34:45.000000000 +0000
1088+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C 1970-01-01 01:00:00.000000000 +0100
1089@@ -1,11 +0,0 @@
1090-/* Test warning from conflicting visibility specifications. */
1091-/* { dg-do compile { target *86-*-linux* } } */
1092-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1093-
1094-extern int
1095-__attribute__((visibility ("hidden")))
1096-xyzzy; /* { dg-warning "previous declaration here" "" } */
1097-
1098-int
1099-__attribute__((visibility ("protected")))
1100-xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
diff --git a/meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch b/meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch
deleted file mode 100644
index 59e5e2edeb..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1Index: gcc-3.4.3/gcc/configure
2===================================================================
3--- gcc-3.4.3.orig/gcc/configure 2004-11-04 23:14:05.000000000 -0500
4+++ gcc-3.4.3/gcc/configure 2005-03-11 14:41:06.373910320 -0500
5@@ -9916,11 +9916,6 @@
6 BUILD_PREFIX=build-
7 BUILD_PREFIX_1=build-
8 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
9-
10- if test "x$TARGET_SYSTEM_ROOT" = x; then
11- STMP_FIXINC=
12- STMP_FIXPROTO=
13- fi
14 fi
15
16 # Expand extra_headers to include complete path.
17Index: gcc-3.4.3/gcc/configure.ac
18===================================================================
19--- gcc-3.4.3.orig/gcc/configure.ac 2004-09-23 20:43:53.000000000 -0400
20+++ gcc-3.4.3/gcc/configure.ac 2005-03-11 14:40:55.256600408 -0500
21@@ -1524,11 +1524,6 @@
22 BUILD_PREFIX=build-
23 BUILD_PREFIX_1=build-
24 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
25-
26- if test "x$TARGET_SYSTEM_ROOT" = x; then
27- STMP_FIXINC=
28- STMP_FIXPROTO=
29- fi
30 fi
31
32 # Expand extra_headers to include complete path.
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch
deleted file mode 100644
index 8fa9af880a..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- gcc-3.4.1/gcc/config.gcc~gcc-3.4.0-arm-bigendian-uclibc
7+++ gcc-3.4.1/gcc/config.gcc
8@@ -666,6 +666,11 @@
9 ;;
10 arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
11 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
12+ case $target in
13+ arm*b-*)
14+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
15+ ;;
16+ esac
17 tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
18 extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
19 gnu_ld=yes
20--- gcc-3.4.1/gcc/config/arm/linux-elf.h~gcc-3.4.0-arm-bigendian-uclibc
21+++ gcc-3.4.1/gcc/config/arm/linux-elf.h
22@@ -120,7 +120,7 @@
23 %{rdynamic:-export-dynamic} \
24 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
25 -X \
26- %{mbig-endian:-EB}" \
27+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
28 SUBTARGET_EXTRA_LINK_SPEC
29 #endif
30
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch
deleted file mode 100644
index c9288c6c15..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch
+++ /dev/null
@@ -1,70 +0,0 @@
1By Lennert Buytenhek <buytenh@wantstofly.org>
2Adds support for arm*b-linux* big-endian ARM targets
3
4See http://gcc.gnu.org/PR16350
5
6diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
7--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
8+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200
9@@ -30,17 +30,34 @@
10 /* Do not assume anything about header files. */
11 #define NO_IMPLICIT_EXTERN_C
12
13+/*
14+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
15+ * (big endian) configurations.
16+ */
17+#if TARGET_BIG_ENDIAN_DEFAULT
18+#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
19+#define TARGET_ENDIAN_OPTION "mbig-endian"
20+#define TARGET_LINKER_EMULATION "armelfb_linux"
21+#else
22+#define TARGET_ENDIAN_DEFAULT 0
23+#define TARGET_ENDIAN_OPTION "mlittle-endian"
24+#define TARGET_LINKER_EMULATION "armelf_linux"
25+#endif
26+
27 /* Default is to use APCS-32 mode. */
28 #undef TARGET_DEFAULT
29-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
30+#define TARGET_DEFAULT \
31+ ( ARM_FLAG_APCS_32 | \
32+ ARM_FLAG_MMU_TRAPS | \
33+ TARGET_ENDIAN_DEFAULT )
34
35 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
36
37-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
38+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
39
40 #undef MULTILIB_DEFAULTS
41 #define MULTILIB_DEFAULTS \
42- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
43+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
44
45 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
46
47@@ -89,7 +106,7 @@
48 %{rdynamic:-export-dynamic} \
49 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
50 -X \
51- %{mbig-endian:-EB}" \
52+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
53 SUBTARGET_EXTRA_LINK_SPEC
54
55 #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
56diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc
57--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200
58+++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200
59@@ -666,6 +666,11 @@
60 ;;
61 arm*-*-linux*) # ARM GNU/Linux with ELF
62 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
63+ case $target in
64+ arm*b-*)
65+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
66+ ;;
67+ esac
68 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
69 extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
70 gnu_ld=yes
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch
deleted file mode 100644
index ca42bfbc0a..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1# Fixes errors like the following when building glibc (or any other executable
2# or shared library) when using gcc 3.4.0 for ARM with softfloat:
3#
4# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3'
5# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3'
6# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3'
7# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2'
8# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi'
9
10diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux
11--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200
12+++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200
13@@ -4,7 +4,10 @@
14 LIBGCC2_DEBUG_CFLAGS = -g0
15
16 LIB1ASMSRC = arm/lib1funcs.asm
17-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
18+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
19+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
20+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
21+ _fixsfsi _fixunssfsi
22
23 # MULTILIB_OPTIONS = mhard-float/msoft-float
24 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch
deleted file mode 100644
index 43eed3ef28..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1# Dimitry Andric <dimitry@andric.com>, 2004-05-01
2#
3# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
4# anymore. (The required functions are now in libgcc.)
5#
6# Fixes errors like
7# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
8# collect2: ld returned 1 exit status
9# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
10# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat
11
12diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
13--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
14+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200
15@@ -55,7 +73,7 @@
16 %{shared:-lc} \
17 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
18
19-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
20+#define LIBGCC_SPEC "-lgcc"
21
22 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
23 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
24
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch
deleted file mode 100644
index f53d64b374..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch
+++ /dev/null
@@ -1,256 +0,0 @@
1#
2# Submitted:
3#
4# Dimitry Andric <dimitry@andric.com>, 2004-05-01
5#
6# Description:
7#
8# Nicholas Pitre released this patch for gcc soft-float support here:
9# http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html
10#
11# This version has been adapted to work with gcc 3.4.0.
12#
13# The original patch doesn't distinguish between softfpa and softvfp modes
14# in the way Nicholas Pitre probably meant. His description is:
15#
16# "Default is to use APCS-32 mode with soft-vfp. The old Linux default for
17# floats can be achieved with -mhard-float or with the configure
18# --with-float=hard option. If -msoft-float or --with-float=soft is used then
19# software float support will be used just like the default but with the legacy
20# big endian word ordering for double float representation instead."
21#
22# Which means the following:
23#
24# * If you compile without -mhard-float or -msoft-float, you should get
25# software floating point, using the VFP format. The produced object file
26# should have these flags in its header:
27#
28# private flags = 600: [APCS-32] [VFP float format] [software FP]
29#
30# * If you compile with -mhard-float, you should get hardware floating point,
31# which always uses the FPA format. Object file header flags should be:
32#
33# private flags = 0: [APCS-32] [FPA float format]
34#
35# * If you compile with -msoft-float, you should get software floating point,
36# using the FPA format. This is done for compatibility reasons with many
37# existing distributions. Object file header flags should be:
38#
39# private flags = 200: [APCS-32] [FPA float format] [software FP]
40#
41# The original patch from Nicholas Pitre contained the following constructs:
42#
43# #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
44# %{mhard-float:-mfpu=fpa} \
45# %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
46#
47# However, gcc doesn't accept this ";:" notation, used in the 3rd line. This
48# is probably the reason Robert Schwebel modified it to:
49#
50# #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
51# %{mhard-float:-mfpu=fpa} \
52# %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
53#
54# But this causes the following behaviour:
55#
56# * If you compile without -mhard-float or -msoft-float, the compiler generates
57# software floating point instructions, but *nothing* is passed to the
58# assembler, which results in an object file which has flags:
59#
60# private flags = 0: [APCS-32] [FPA float format]
61#
62# This is not correct!
63#
64# * If you compile with -mhard-float, the compiler generates hardware floating
65# point instructions, and passes "-mfpu=fpa" to the assembler, which results
66# in an object file which has the same flags as in the previous item, but now
67# those *are* correct.
68#
69# * If you compile with -msoft-float, the compiler generates software floating
70# point instructions, and passes "-mfpu=softfpa -mfpu=softvfp" (in that
71# order) to the assembler, which results in an object file with flags:
72#
73# private flags = 600: [APCS-32] [VFP float format] [software FP]
74#
75# This is not correct, because the last "-mfpu=" option on the assembler
76# command line determines the actual FPU convention used (which should be FPA
77# in this case).
78#
79# Therefore, I modified this patch to get the desired behaviour. Every
80# instance of the notation:
81#
82# %{msoft-float:-mfpu=softfpa -mfpu=softvfp}
83#
84# was changed to:
85#
86# %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}
87#
88# I also did the following:
89#
90# * Modified all TARGET_DEFAULT macros I could find to include ARM_FLAG_VFP, to
91# be consistent with Nicholas' original patch.
92# * Removed any "msoft-float" or "mhard-float" from all MULTILIB_DEFAULTS
93# macros I could find. I think that if you compile without any options, you
94# would like to get the defaults. :)
95# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
96# anymore. (The required functions are now in libgcc.)
97
98diff -urNd gcc-3.4.0-orig/gcc/config/arm/coff.h gcc-3.4.0/gcc/config/arm/coff.h
99--- gcc-3.4.0-orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100
100+++ gcc-3.4.0/gcc/config/arm/coff.h 2004-05-01 19:07:06.059409600 +0200
101@@ -31,11 +31,16 @@
102 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
103
104 #undef TARGET_DEFAULT
105-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
106+#define TARGET_DEFAULT \
107+ ( ARM_FLAG_SOFT_FLOAT \
108+ | ARM_FLAG_VFP \
109+ | ARM_FLAG_APCS_32 \
110+ | ARM_FLAG_APCS_FRAME \
111+ | ARM_FLAG_MMU_TRAPS )
112
113 #ifndef MULTILIB_DEFAULTS
114 #define MULTILIB_DEFAULTS \
115- { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
116+ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
117 #endif
118
119 /* This is COFF, but prefer stabs. */
120diff -urNd gcc-3.4.0-orig/gcc/config/arm/elf.h gcc-3.4.0/gcc/config/arm/elf.h
121--- gcc-3.4.0-orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100
122+++ gcc-3.4.0/gcc/config/arm/elf.h 2004-05-01 19:12:16.976486400 +0200
123@@ -46,7 +46,9 @@
124
125 #ifndef SUBTARGET_ASM_FLOAT_SPEC
126 #define SUBTARGET_ASM_FLOAT_SPEC "\
127-%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
128+%{mapcs-float:-mfloat} \
129+%{mhard-float:-mfpu=fpa} \
130+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
131 #endif
132
133 #ifndef ASM_SPEC
134@@ -106,12 +108,17 @@
135 #endif
136
137 #ifndef TARGET_DEFAULT
138-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
139+#define TARGET_DEFAULT \
140+ ( ARM_FLAG_SOFT_FLOAT \
141+ | ARM_FLAG_VFP \
142+ | ARM_FLAG_APCS_32 \
143+ | ARM_FLAG_APCS_FRAME \
144+ | ARM_FLAG_MMU_TRAPS )
145 #endif
146
147 #ifndef MULTILIB_DEFAULTS
148 #define MULTILIB_DEFAULTS \
149- { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
150+ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
151 #endif
152
153 #define TARGET_ASM_FILE_START_APP_OFF true
154diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
155--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
156+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200
157@@ -30,9 +30,27 @@
158 /* Do not assume anything about header files. */
159 #define NO_IMPLICIT_EXTERN_C
160
161-/* Default is to use APCS-32 mode. */
162+/*
163+ * Default is to use APCS-32 mode with soft-vfp.
164+ * The old Linux default for floats can be achieved with -mhard-float
165+ * or with the configure --with-float=hard option.
166+ * If -msoft-float or --with-float=soft is used then software float
167+ * support will be used just like the default but with the legacy
168+ * big endian word ordering for double float representation instead.
169+ */
170+
171 #undef TARGET_DEFAULT
172-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
173+#define TARGET_DEFAULT \
174+ ( ARM_FLAG_APCS_32 \
175+ | ARM_FLAG_SOFT_FLOAT \
176+ | ARM_FLAG_VFP \
177+ | ARM_FLAG_MMU_TRAPS )
178+
179+#undef SUBTARGET_EXTRA_ASM_SPEC
180+#define SUBTARGET_EXTRA_ASM_SPEC "\
181+%{!mcpu=*:-mcpu=xscale} \
182+%{mhard-float:-mfpu=fpa} \
183+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
184
185 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
186
187@@ -40,7 +58,7 @@
188
189 #undef MULTILIB_DEFAULTS
190 #define MULTILIB_DEFAULTS \
191- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
192+ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
193
194 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
195
196@@ -55,7 +73,7 @@
197 %{shared:-lc} \
198 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
199
200-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
201+#define LIBGCC_SPEC "-lgcc"
202
203 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
204 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
205diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux
206--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200
207+++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200
208@@ -4,7 +4,10 @@
209 LIBGCC2_DEBUG_CFLAGS = -g0
210
211 LIB1ASMSRC = arm/lib1funcs.asm
212-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
213+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
214+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
215+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
216+ _fixsfsi _fixunssfsi
217
218 # MULTILIB_OPTIONS = mhard-float/msoft-float
219 # MULTILIB_DIRNAMES = hard-float soft-float
220diff -urNd gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h gcc-3.4.0/gcc/config/arm/unknown-elf.h
221--- gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100
222+++ gcc-3.4.0/gcc/config/arm/unknown-elf.h 2004-05-01 19:09:09.016212800 +0200
223@@ -30,7 +30,12 @@
224
225 /* Default to using APCS-32 and software floating point. */
226 #ifndef TARGET_DEFAULT
227-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
228+#define TARGET_DEFAULT \
229+ ( ARM_FLAG_SOFT_FLOAT \
230+ | ARM_FLAG_VFP \
231+ | ARM_FLAG_APCS_32 \
232+ | ARM_FLAG_APCS_FRAME \
233+ | ARM_FLAG_MMU_TRAPS )
234 #endif
235
236 /* Now we define the strings used to build the spec file. */
237diff -urNd gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h gcc-3.4.0/gcc/config/arm/xscale-elf.h
238--- gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200
239+++ gcc-3.4.0/gcc/config/arm/xscale-elf.h 2004-05-01 20:15:36.620105600 +0200
240@@ -49,11 +49,12 @@
241 endian, regardless of the endian-ness of the memory
242 system. */
243
244-#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
245- %{mhard-float:-mfpu=fpa} \
246- %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
247+#define SUBTARGET_EXTRA_ASM_SPEC "\
248+%{!mcpu=*:-mcpu=xscale} \
249+%{mhard-float:-mfpu=fpa} \
250+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
251
252 #ifndef MULTILIB_DEFAULTS
253 #define MULTILIB_DEFAULTS \
254- { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" }
255+ { "mlittle-endian", "mno-thumb-interwork", "marm" }
256 #endif
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch
deleted file mode 100644
index 29e4c802e2..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch
+++ /dev/null
@@ -1,442 +0,0 @@
1diff -urN gcc-3.4.1-dist/boehm-gc/configure gcc-3.4.1/boehm-gc/configure
2--- gcc-3.4.1-dist/boehm-gc/configure 2004-07-01 14:14:03.000000000 -0500
3+++ gcc-3.4.1/boehm-gc/configure 2004-08-12 16:22:57.000000000 -0500
4@@ -1947,6 +1947,11 @@
5 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
6 ;;
7
8+linux-uclibc*)
9+ lt_cv_deplibs_check_method=pass_all
10+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
11+ ;;
12+
13 netbsd*)
14 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
15 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
16diff -urN gcc-3.4.1-dist/boehm-gc/ltconfig gcc-3.4.1/boehm-gc/ltconfig
17--- gcc-3.4.1-dist/boehm-gc/ltconfig 2002-11-20 09:59:06.000000000 -0600
18+++ gcc-3.4.1/boehm-gc/ltconfig 2004-08-12 15:54:42.000000000 -0500
19@@ -1981,6 +1981,23 @@
20 fi
21 ;;
22
23+linux-uclibc*)
24+ version_type=linux
25+ need_lib_prefix=no
26+ need_version=no
27+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
28+ soname_spec='${libname}${release}.so$major'
29+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
30+ shlibpath_var=LD_LIBRARY_PATH
31+ shlibpath_overrides_runpath=no
32+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
33+ file_magic_cmd=/usr/bin/file
34+ file_magic_test_file=`echo /lib/libuClibc-*.so`
35+
36+ # Assume using the uClibc dynamic linker.
37+ dynamic_linker="uClibc ld.so"
38+ ;;
39+
40 netbsd*)
41 version_type=sunos
42 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
43diff -urN gcc-3.4.1-dist/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h
44--- gcc-3.4.1-dist/gcc/config/arm/linux-elf.h 2004-01-31 00:18:11.000000000 -0600
45+++ gcc-3.4.1/gcc/config/arm/linux-elf.h 2004-08-12 15:54:42.000000000 -0500
46@@ -81,6 +81,18 @@
47 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
48
49 #undef LINK_SPEC
50+#ifdef USE_UCLIBC
51+#define LINK_SPEC "%{h*} %{version:-v} \
52+ %{b} %{Wl,*:%*} \
53+ %{static:-Bstatic} \
54+ %{shared:-shared} \
55+ %{symbolic:-Bsymbolic} \
56+ %{rdynamic:-export-dynamic} \
57+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
58+ -X \
59+ %{mbig-endian:-EB}" \
60+ SUBTARGET_EXTRA_LINK_SPEC
61+#else
62 #define LINK_SPEC "%{h*} %{version:-v} \
63 %{b} %{Wl,*:%*} \
64 %{static:-Bstatic} \
65@@ -91,6 +103,7 @@
66 -X \
67 %{mbig-endian:-EB}" \
68 SUBTARGET_EXTRA_LINK_SPEC
69+#endif
70
71 #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
72
73diff -urN gcc-3.4.1-dist/gcc/config/cris/linux.h gcc-3.4.1/gcc/config/cris/linux.h
74--- gcc-3.4.1-dist/gcc/config/cris/linux.h 2003-11-28 21:08:09.000000000 -0600
75+++ gcc-3.4.1/gcc/config/cris/linux.h 2004-08-12 15:54:43.000000000 -0500
76@@ -79,6 +79,25 @@
77 #undef CRIS_DEFAULT_CPU_VERSION
78 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
79
80+#ifdef USE_UCLIBC
81+
82+#undef CRIS_SUBTARGET_VERSION
83+#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
84+
85+#undef CRIS_LINK_SUBTARGET_SPEC
86+#define CRIS_LINK_SUBTARGET_SPEC \
87+ "-mcrislinux\
88+ -rpath-link include/asm/../..%s\
89+ %{shared} %{static}\
90+ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
91+ %{!shared: \
92+ %{!static: \
93+ %{rdynamic:-export-dynamic} \
94+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
95+ %{!r:%{O2|O3: --gc-sections}}"
96+
97+#else /* USE_UCLIBC */
98+
99 #undef CRIS_SUBTARGET_VERSION
100 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
101
102@@ -93,6 +112,8 @@
103 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
104 %{!r:%{O2|O3: --gc-sections}}"
105
106+#endif /* USE_UCLIBC */
107+
108
109 /* Node: Run-time Target */
110
111diff -urN gcc-3.4.1-dist/gcc/config/cris/t-linux-uclibc gcc-3.4.1/gcc/config/cris/t-linux-uclibc
112--- gcc-3.4.1-dist/gcc/config/cris/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
113+++ gcc-3.4.1/gcc/config/cris/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500
114@@ -0,0 +1,3 @@
115+T_CFLAGS = -DUSE_UCLIBC
116+TARGET_LIBGCC2_CFLAGS += -fPIC
117+CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
118diff -urN gcc-3.4.1-dist/gcc/config/i386/linux.h gcc-3.4.1/gcc/config/i386/linux.h
119--- gcc-3.4.1-dist/gcc/config/i386/linux.h 2003-11-28 21:08:10.000000000 -0600
120+++ gcc-3.4.1/gcc/config/i386/linux.h 2004-08-12 15:54:43.000000000 -0500
121@@ -118,6 +118,15 @@
122 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
123 %{static:-static}}}"
124 #else
125+#if defined USE_UCLIBC
126+#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
127+ %{!shared: \
128+ %{!ibcs: \
129+ %{!static: \
130+ %{rdynamic:-export-dynamic} \
131+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
132+ %{static:-static}}}"
133+#else
134 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
135 %{!shared: \
136 %{!ibcs: \
137@@ -126,6 +135,7 @@
138 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
139 %{static:-static}}}"
140 #endif
141+#endif
142
143 /* A C statement (sans semicolon) to output to the stdio stream
144 FILE the assembler definition of uninitialized global DECL named
145diff -urN gcc-3.4.1-dist/gcc/config/mips/linux.h gcc-3.4.1/gcc/config/mips/linux.h
146--- gcc-3.4.1-dist/gcc/config/mips/linux.h 2004-06-15 20:42:24.000000000 -0500
147+++ gcc-3.4.1/gcc/config/mips/linux.h 2004-08-12 15:54:43.000000000 -0500
148@@ -109,6 +109,17 @@
149
150 /* Borrowed from sparc/linux.h */
151 #undef LINK_SPEC
152+#ifdef USE_UCLIBC
153+#define LINK_SPEC \
154+ "%(endian_spec) \
155+ %{shared:-shared} \
156+ %{!shared: \
157+ %{!ibcs: \
158+ %{!static: \
159+ %{rdynamic:-export-dynamic} \
160+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
161+ %{static:-static}}}"
162+#else
163 #define LINK_SPEC \
164 "%(endian_spec) \
165 %{shared:-shared} \
166@@ -118,6 +129,7 @@
167 %{rdynamic:-export-dynamic} \
168 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
169 %{static:-static}}}"
170+#endif
171
172 #undef SUBTARGET_ASM_SPEC
173 #define SUBTARGET_ASM_SPEC "\
174diff -urN gcc-3.4.1-dist/gcc/config/rs6000/linux.h gcc-3.4.1/gcc/config/rs6000/linux.h
175--- gcc-3.4.1-dist/gcc/config/rs6000/linux.h 2004-02-25 09:11:19.000000000 -0600
176+++ gcc-3.4.1/gcc/config/rs6000/linux.h 2004-08-12 15:54:43.000000000 -0500
177@@ -61,7 +61,11 @@
178 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
179
180 #undef LINK_OS_DEFAULT_SPEC
181+#ifdef USE_UCLIBC
182+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
183+#else
184 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
185+#endif
186
187 #define LINK_GCC_C_SEQUENCE_SPEC \
188 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
189diff -urN gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h gcc-3.4.1/gcc/config/rs6000/sysv4.h
190--- gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h 2004-06-10 01:39:50.000000000 -0500
191+++ gcc-3.4.1/gcc/config/rs6000/sysv4.h 2004-08-12 15:54:43.000000000 -0500
192@@ -947,6 +947,7 @@
193 mcall-linux : %(link_os_linux) ; \
194 mcall-gnu : %(link_os_gnu) ; \
195 mcall-netbsd : %(link_os_netbsd) ; \
196+ mcall-linux-uclibc : %(link_os_linux_uclibc); \
197 mcall-openbsd: %(link_os_openbsd) ; \
198 : %(link_os_default) }"
199
200@@ -1124,6 +1125,10 @@
201 %{rdynamic:-export-dynamic} \
202 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
203
204+#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
205+ %{rdynamic:-export-dynamic} \
206+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
207+
208 #if defined(HAVE_LD_EH_FRAME_HDR)
209 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
210 #endif
211@@ -1290,6 +1295,7 @@
212 { "link_os_sim", LINK_OS_SIM_SPEC }, \
213 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
214 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
215+ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
216 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
217 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
218 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
219diff -urN gcc-3.4.1-dist/gcc/config/sh/linux.h gcc-3.4.1/gcc/config/sh/linux.h
220--- gcc-3.4.1-dist/gcc/config/sh/linux.h 2004-01-11 20:29:13.000000000 -0600
221+++ gcc-3.4.1/gcc/config/sh/linux.h 2004-08-12 15:54:43.000000000 -0500
222@@ -73,12 +73,21 @@
223 #undef SUBTARGET_LINK_EMUL_SUFFIX
224 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
225 #undef SUBTARGET_LINK_SPEC
226+#ifdef USE_UCLIBC
227+#define SUBTARGET_LINK_SPEC \
228+ "%{shared:-shared} \
229+ %{!static: \
230+ %{rdynamic:-export-dynamic} \
231+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
232+ %{static:-static}"
233+#else
234 #define SUBTARGET_LINK_SPEC \
235 "%{shared:-shared} \
236 %{!static: \
237 %{rdynamic:-export-dynamic} \
238 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
239 %{static:-static}"
240+#endif
241
242 #undef LIB_SPEC
243 #define LIB_SPEC \
244diff -urN gcc-3.4.1-dist/gcc/config/sh/t-linux-uclibc gcc-3.4.1/gcc/config/sh/t-linux-uclibc
245--- gcc-3.4.1-dist/gcc/config/sh/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
246+++ gcc-3.4.1/gcc/config/sh/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500
247@@ -0,0 +1,13 @@
248+T_CFLAGS = -DUSE_UCLIBC
249+
250+TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES
251+LIB1ASMFUNCS_CACHE = _ic_invalidate
252+
253+LIB2FUNCS_EXTRA=
254+
255+MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4
256+MULTILIB_DIRNAMES=
257+MULTILIB_MATCHES =
258+MULTILIB_EXCEPTIONS=
259+
260+EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
261diff -urN gcc-3.4.1-dist/gcc/config/sh/t-sh64-uclibc gcc-3.4.1/gcc/config/sh/t-sh64-uclibc
262--- gcc-3.4.1-dist/gcc/config/sh/t-sh64-uclibc 1969-12-31 18:00:00.000000000 -0600
263+++ gcc-3.4.1/gcc/config/sh/t-sh64-uclibc 2004-08-12 15:54:43.000000000 -0500
264@@ -0,0 +1,13 @@
265+EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o
266+
267+LIB1ASMFUNCS = \
268+ _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
269+ _shcompact_call_trampoline _shcompact_return_trampoline \
270+ _shcompact_incoming_args _ic_invalidate _nested_trampoline \
271+ _push_pop_shmedia_regs \
272+ _udivdi3 _divdi3 _umoddi3 _moddi3
273+
274+MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
275+MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64
276+MULTILIB_MATCHES=
277+MULTILIB_EXCEPTIONS=
278diff -urN gcc-3.4.1-dist/gcc/config/t-linux-uclibc gcc-3.4.1/gcc/config/t-linux-uclibc
279--- gcc-3.4.1-dist/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
280+++ gcc-3.4.1/gcc/config/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500
281@@ -0,0 +1,15 @@
282+T_CFLAGS = -DUSE_UCLIBC
283+
284+# Compile crtbeginS.o and crtendS.o with pic.
285+CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
286+# Compile libgcc2.a with pic.
287+TARGET_LIBGCC2_CFLAGS = -fPIC
288+
289+# Override t-slibgcc-elf-ver to export some libgcc symbols with
290+# the symbol versions that glibc used.
291+#SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
292+
293+# Use unwind-dw2-fde
294+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
295+ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
296+LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h
297diff -urN gcc-3.4.1-dist/gcc/config.gcc gcc-3.4.1/gcc/config.gcc
298--- gcc-3.4.1-dist/gcc/config.gcc 2004-04-21 10:12:35.000000000 -0500
299+++ gcc-3.4.1/gcc/config.gcc 2004-08-12 15:59:46.000000000 -0500
300@@ -664,6 +664,12 @@
301 extra_parts=""
302 use_collect2=yes
303 ;;
304+arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
305+ tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
306+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
307+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
308+ gnu_ld=yes
309+ ;;
310 arm*-*-linux*) # ARM GNU/Linux with ELF
311 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
312 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
313@@ -725,6 +731,10 @@
314 tmake_file="cris/t-cris cris/t-elfmulti"
315 gas=yes
316 ;;
317+cris-*-linux-uclibc*)
318+ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
319+ tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc"
320+ ;;
321 cris-*-linux*)
322 tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
323 tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
324@@ -988,6 +998,11 @@
325 thread_file='single'
326 fi
327 ;;
328+i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux
329+ # with ELF format using uClibc
330+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h"
331+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc i386/t-crtstuff"
332+ ;;
333 i[34567]86-*-linux*) # Intel 80386's running GNU/Linux
334 # with ELF format using glibc 2
335 # aka GNU/Linux C library 6
336@@ -1547,6 +1562,16 @@
337 gnu_ld=yes
338 gas=yes
339 ;;
340+mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc
341+ tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
342+ case ${target} in
343+ mipsisa32*-*)
344+ target_cpu_default="MASK_SOFT_FLOAT"
345+ tm_defines="MIPS_ISA_DEFAULT=32"
346+ ;;
347+ esac
348+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc"
349+ ;;
350 mips*-*-linux*) # Linux MIPS, either endian.
351 tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
352 case ${target} in
353@@ -1764,6 +1789,10 @@
354 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h"
355 tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
356 ;;
357+powerpc-*-linux-uclibc*)
358+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
359+ tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm"
360+ ;;
361 powerpc-*-linux*)
362 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
363 tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
364@@ -1916,7 +1945,7 @@
365 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h"
366 ;;
367 sh-*-linux* | sh[2346lbe]*-*-linux*)
368- tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux"
369+ tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver"
370 case ${target} in
371 sh*be-*-* | sh*eb-*-*) ;;
372 *)
373@@ -1924,9 +1953,17 @@
374 tmake_file="${tmake_file} sh/t-le"
375 ;;
376 esac
377- tmake_file="${tmake_file} sh/t-linux"
378+ case ${target} in
379+ *-*-linux-uclibc*) tmake_file="${tmake_file} t-linux-uclibc sh/t-linux-uclibc" ;;
380+ *) tmake_file="${tmake_file} t-linux sh/t-linux" ;;
381+ esac
382 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h"
383 case ${target} in
384+ sh64*-*-linux-uclibc*)
385+ tmake_file="${tmake_file} sh/t-sh64-uclibc"
386+ tm_file="${tm_file} sh/sh64.h"
387+ extra_headers="shmedia.h ushmedia.h sshmedia.h"
388+ ;;
389 sh64*)
390 tmake_file="${tmake_file} sh/t-sh64"
391 tm_file="${tm_file} sh/sh64.h"
392diff -urN gcc-3.4.1-dist/libtool.m4 gcc-3.4.1/libtool.m4
393--- gcc-3.4.1-dist/libtool.m4 2004-05-18 04:08:37.000000000 -0500
394+++ gcc-3.4.1/libtool.m4 2004-08-12 15:54:43.000000000 -0500
395@@ -689,6 +689,11 @@
396 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
397 ;;
398
399+linux-uclibc*)
400+ lt_cv_deplibs_check_method=pass_all
401+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
402+ ;;
403+
404 netbsd*)
405 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
406 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
407diff -urN gcc-3.4.1-dist/ltconfig gcc-3.4.1/ltconfig
408--- gcc-3.4.1-dist/ltconfig 2004-03-05 15:05:41.000000000 -0600
409+++ gcc-3.4.1/ltconfig 2004-08-12 15:55:48.000000000 -0500
410@@ -602,6 +602,7 @@
411
412 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
413 case $host_os in
414+linux-uclibc*) ;;
415 linux-gnu*) ;;
416 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
417 esac
418@@ -1262,6 +1263,24 @@
419 dynamic_linker='GNU/Linux ld.so'
420 ;;
421
422+linux-uclibc*)
423+ version_type=linux
424+ need_lib_prefix=no
425+ need_version=no
426+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
427+ soname_spec='${libname}${release}.so$major'
428+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
429+ shlibpath_var=LD_LIBRARY_PATH
430+ shlibpath_overrides_runpath=no
431+ # This implies no fast_install, which is unacceptable.
432+ # Some rework will be needed to allow for fast_install
433+ # before this can be enabled.
434+ # Note: copied from linux-gnu, and may not be appropriate.
435+ hardcode_into_libs=yes
436+ # Assume using the uClibc dynamic linker.
437+ dynamic_linker="uClibc ld.so"
438+ ;;
439+
440 netbsd*)
441 need_lib_prefix=no
442 need_version=no
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch
deleted file mode 100644
index 3fc4900b06..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch
+++ /dev/null
@@ -1,3246 +0,0 @@
1diff -urN gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 gcc-3.4.2/libstdc++-v3/acinclude.m4
2--- gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 2004-07-15 12:42:45.000000000 -0500
3+++ gcc-3.4.2/libstdc++-v3/acinclude.m4 2004-09-10 10:47:40.000000000 -0500
4@@ -996,7 +996,7 @@
5 AC_MSG_CHECKING([for C locale to use])
6 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
7 [use MODEL for target locale package],
8- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
9+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
10
11 # If they didn't use this option switch, or if they specified --enable
12 # with no specific model, we'll have to look for one. If they
13@@ -1012,6 +1012,9 @@
14 # Default to "generic".
15 if test $enable_clocale_flag = auto; then
16 case x${target_os} in
17+ x*-uclibc*)
18+ enable_clocale_flag=uclibc
19+ ;;
20 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
21 AC_EGREP_CPP([_GLIBCXX_ok], [
22 #include <features.h>
23@@ -1138,6 +1141,41 @@
24 CTIME_CC=config/locale/generic/time_members.cc
25 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
26 ;;
27+ uclibc)
28+ AC_MSG_RESULT(uclibc)
29+
30+ # Declare intention to use gettext, and add support for specific
31+ # languages.
32+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
33+ ALL_LINGUAS="de fr"
34+
35+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
36+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
37+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
38+ USE_NLS=yes
39+ fi
40+ # Export the build objects.
41+ for ling in $ALL_LINGUAS; do \
42+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
43+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
44+ done
45+ AC_SUBST(glibcxx_MOFILES)
46+ AC_SUBST(glibcxx_POFILES)
47+
48+ CLOCALE_H=config/locale/uclibc/c_locale.h
49+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
50+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
51+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
52+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
53+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
54+ CMESSAGES_H=config/locale/uclibc/messages_members.h
55+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
56+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
57+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
58+ CTIME_H=config/locale/uclibc/time_members.h
59+ CTIME_CC=config/locale/uclibc/time_members.cc
60+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
61+ ;;
62 esac
63
64 # This is where the testsuite looks for locale catalogs, using the
65diff -urN gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 gcc-3.4.2/libstdc++-v3/aclocal.m4
66--- gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 2004-08-13 15:44:03.000000000 -0500
67+++ gcc-3.4.2/libstdc++-v3/aclocal.m4 2004-09-10 10:47:40.000000000 -0500
68@@ -1025,6 +1025,9 @@
69 # Default to "generic".
70 if test $enable_clocale_flag = auto; then
71 case x${target_os} in
72+ x*-uclibc*)
73+ enable_clocale_flag=uclibc
74+ ;;
75 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
76 AC_EGREP_CPP([_GLIBCXX_ok], [
77 #include <features.h>
78@@ -1151,6 +1154,41 @@
79 CTIME_CC=config/locale/generic/time_members.cc
80 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
81 ;;
82+ uclibc)
83+ AC_MSG_RESULT(uclibc)
84+
85+ # Declare intention to use gettext, and add support for specific
86+ # languages.
87+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
88+ ALL_LINGUAS="de fr"
89+
90+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
91+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
92+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
93+ USE_NLS=yes
94+ fi
95+ # Export the build objects.
96+ for ling in $ALL_LINGUAS; do \
97+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
98+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
99+ done
100+ AC_SUBST(glibcxx_MOFILES)
101+ AC_SUBST(glibcxx_POFILES)
102+
103+ CLOCALE_H=config/locale/uclibc/c_locale.h
104+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
105+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
106+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
107+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
108+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
109+ CMESSAGES_H=config/locale/uclibc/messages_members.h
110+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
111+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
112+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
113+ CTIME_H=config/locale/uclibc/time_members.h
114+ CTIME_CC=config/locale/uclibc/time_members.cc
115+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
116+ ;;
117 esac
118
119 # This is where the testsuite looks for locale catalogs, using the
120diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
121--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600
122+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2004-09-10 10:47:40.000000000 -0500
123@@ -0,0 +1,59 @@
124+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
125+
126+// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
127+//
128+// This file is part of the GNU ISO C++ Library. This library is free
129+// software; you can redistribute it and/or modify it under the
130+// terms of the GNU General Public License as published by the
131+// Free Software Foundation; either version 2, or (at your option)
132+// any later version.
133+
134+// This library is distributed in the hope that it will be useful,
135+// but WITHOUT ANY WARRANTY; without even the implied warranty of
136+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
137+// GNU General Public License for more details.
138+
139+// You should have received a copy of the GNU General Public License along
140+// with this library; see the file COPYING. If not, write to the Free
141+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
142+// USA.
143+
144+// As a special exception, you may use this file as part of a free software
145+// library without restriction. Specifically, if other files instantiate
146+// templates or use macros or inline functions from this file, or you compile
147+// this file and link it with other files to produce an executable, this
148+// file does not by itself cause the resulting executable to be covered by
149+// the GNU General Public License. This exception does not however
150+// invalidate any other reasons why the executable file might be covered by
151+// the GNU General Public License.
152+
153+// Written by Jakub Jelinek <jakub@redhat.com>
154+
155+#include <clocale>
156+
157+#ifdef __UCLIBC_MJN3_ONLY__
158+#warning clean this up
159+#endif
160+
161+#ifdef __UCLIBC_HAS_XLOCALE__
162+
163+extern "C" __typeof(iswctype_l) __iswctype_l;
164+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
165+extern "C" __typeof(strcoll_l) __strcoll_l;
166+extern "C" __typeof(strftime_l) __strftime_l;
167+extern "C" __typeof(strtod_l) __strtod_l;
168+extern "C" __typeof(strtof_l) __strtof_l;
169+extern "C" __typeof(strtold_l) __strtold_l;
170+extern "C" __typeof(strxfrm_l) __strxfrm_l;
171+extern "C" __typeof(towlower_l) __towlower_l;
172+extern "C" __typeof(towupper_l) __towupper_l;
173+extern "C" __typeof(wcscoll_l) __wcscoll_l;
174+extern "C" __typeof(wcsftime_l) __wcsftime_l;
175+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
176+extern "C" __typeof(wctype_l) __wctype_l;
177+extern "C" __typeof(newlocale) __newlocale;
178+extern "C" __typeof(freelocale) __freelocale;
179+extern "C" __typeof(duplocale) __duplocale;
180+extern "C" __typeof(uselocale) __uselocale;
181+
182+#endif // GLIBC 2.3 and later
183diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc
184--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600
185+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2004-09-10 10:47:40.000000000 -0500
186@@ -0,0 +1,160 @@
187+// Wrapper for underlying C-language localization -*- C++ -*-
188+
189+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
190+//
191+// This file is part of the GNU ISO C++ Library. This library is free
192+// software; you can redistribute it and/or modify it under the
193+// terms of the GNU General Public License as published by the
194+// Free Software Foundation; either version 2, or (at your option)
195+// any later version.
196+
197+// This library is distributed in the hope that it will be useful,
198+// but WITHOUT ANY WARRANTY; without even the implied warranty of
199+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200+// GNU General Public License for more details.
201+
202+// You should have received a copy of the GNU General Public License along
203+// with this library; see the file COPYING. If not, write to the Free
204+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
205+// USA.
206+
207+// As a special exception, you may use this file as part of a free software
208+// library without restriction. Specifically, if other files instantiate
209+// templates or use macros or inline functions from this file, or you compile
210+// this file and link it with other files to produce an executable, this
211+// file does not by itself cause the resulting executable to be covered by
212+// the GNU General Public License. This exception does not however
213+// invalidate any other reasons why the executable file might be covered by
214+// the GNU General Public License.
215+
216+//
217+// ISO C++ 14882: 22.8 Standard locale categories.
218+//
219+
220+// Written by Benjamin Kosnik <bkoz@redhat.com>
221+
222+#include <cerrno> // For errno
223+#include <locale>
224+#include <stdexcept>
225+#include <langinfo.h>
226+#include <bits/c++locale_internal.h>
227+
228+#ifndef __UCLIBC_HAS_XLOCALE__
229+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
230+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
231+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
232+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
233+#define __strtof_l(S, E, L) strtof((S), (E))
234+#define __strtod_l(S, E, L) strtod((S), (E))
235+#define __strtold_l(S, E, L) strtold((S), (E))
236+#warning should dummy __newlocale check for C|POSIX ?
237+#define __newlocale(a, b, c) NULL
238+#define __freelocale(a) ((void)0)
239+#define __duplocale(a) __c_locale()
240+#endif
241+
242+namespace std
243+{
244+ template<>
245+ void
246+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
247+ const __c_locale& __cloc)
248+ {
249+ if (!(__err & ios_base::failbit))
250+ {
251+ char* __sanity;
252+ errno = 0;
253+ float __f = __strtof_l(__s, &__sanity, __cloc);
254+ if (__sanity != __s && errno != ERANGE)
255+ __v = __f;
256+ else
257+ __err |= ios_base::failbit;
258+ }
259+ }
260+
261+ template<>
262+ void
263+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
264+ const __c_locale& __cloc)
265+ {
266+ if (!(__err & ios_base::failbit))
267+ {
268+ char* __sanity;
269+ errno = 0;
270+ double __d = __strtod_l(__s, &__sanity, __cloc);
271+ if (__sanity != __s && errno != ERANGE)
272+ __v = __d;
273+ else
274+ __err |= ios_base::failbit;
275+ }
276+ }
277+
278+ template<>
279+ void
280+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
281+ const __c_locale& __cloc)
282+ {
283+ if (!(__err & ios_base::failbit))
284+ {
285+ char* __sanity;
286+ errno = 0;
287+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
288+ if (__sanity != __s && errno != ERANGE)
289+ __v = __ld;
290+ else
291+ __err |= ios_base::failbit;
292+ }
293+ }
294+
295+ void
296+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
297+ __c_locale __old)
298+ {
299+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
300+#ifdef __UCLIBC_HAS_XLOCALE__
301+ if (!__cloc)
302+ {
303+ // This named locale is not supported by the underlying OS.
304+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
305+ "name not valid"));
306+ }
307+#endif
308+ }
309+
310+ void
311+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
312+ {
313+ if (_S_get_c_locale() != __cloc)
314+ __freelocale(__cloc);
315+ }
316+
317+ __c_locale
318+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
319+ { return __duplocale(__cloc); }
320+} // namespace std
321+
322+namespace __gnu_cxx
323+{
324+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
325+ {
326+ "LC_CTYPE",
327+ "LC_NUMERIC",
328+ "LC_TIME",
329+ "LC_COLLATE",
330+ "LC_MONETARY",
331+ "LC_MESSAGES",
332+#if _GLIBCXX_NUM_CATEGORIES != 0
333+ "LC_PAPER",
334+ "LC_NAME",
335+ "LC_ADDRESS",
336+ "LC_TELEPHONE",
337+ "LC_MEASUREMENT",
338+ "LC_IDENTIFICATION"
339+#endif
340+ };
341+}
342+
343+namespace std
344+{
345+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
346+} // namespace std
347diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h
348--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
349+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2004-09-10 10:48:08.000000000 -0500
350@@ -0,0 +1,115 @@
351+// Wrapper for underlying C-language localization -*- C++ -*-
352+
353+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
354+//
355+// This file is part of the GNU ISO C++ Library. This library is free
356+// software; you can redistribute it and/or modify it under the
357+// terms of the GNU General Public License as published by the
358+// Free Software Foundation; either version 2, or (at your option)
359+// any later version.
360+
361+// This library is distributed in the hope that it will be useful,
362+// but WITHOUT ANY WARRANTY; without even the implied warranty of
363+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
364+// GNU General Public License for more details.
365+
366+// You should have received a copy of the GNU General Public License along
367+// with this library; see the file COPYING. If not, write to the Free
368+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
369+// USA.
370+
371+// As a special exception, you may use this file as part of a free software
372+// library without restriction. Specifically, if other files instantiate
373+// templates or use macros or inline functions from this file, or you compile
374+// this file and link it with other files to produce an executable, this
375+// file does not by itself cause the resulting executable to be covered by
376+// the GNU General Public License. This exception does not however
377+// invalidate any other reasons why the executable file might be covered by
378+// the GNU General Public License.
379+
380+//
381+// ISO C++ 14882: 22.8 Standard locale categories.
382+//
383+
384+// Written by Benjamin Kosnik <bkoz@redhat.com>
385+
386+#ifndef _C_LOCALE_H
387+#define _C_LOCALE_H 1
388+
389+#pragma GCC system_header
390+
391+#include <cstring> // get std::strlen
392+#include <cstdio> // get std::snprintf or std::sprintf
393+#include <clocale>
394+#include <langinfo.h> // For codecvt
395+#ifdef __UCLIBC_MJN3_ONLY__
396+#warning fix this
397+#endif
398+#ifdef __UCLIBC_HAS_LOCALE__
399+#include <iconv.h> // For codecvt using iconv, iconv_t
400+#endif
401+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
402+#include <libintl.h> // For messages
403+#endif
404+
405+#ifdef __UCLIBC_MJN3_ONLY__
406+#warning what is _GLIBCXX_C_LOCALE_GNU for
407+#endif
408+#define _GLIBCXX_C_LOCALE_GNU 1
409+
410+#ifdef __UCLIBC_MJN3_ONLY__
411+#warning fix categories
412+#endif
413+// #define _GLIBCXX_NUM_CATEGORIES 6
414+#define _GLIBCXX_NUM_CATEGORIES 0
415+
416+#ifdef __UCLIBC_HAS_XLOCALE__
417+namespace __gnu_cxx
418+{
419+ extern "C" __typeof(uselocale) __uselocale;
420+}
421+#endif
422+
423+namespace std
424+{
425+#ifdef __UCLIBC_HAS_XLOCALE__
426+ typedef __locale_t __c_locale;
427+#else
428+ typedef int* __c_locale;
429+#endif
430+
431+ // Convert numeric value of type _Tv to string and return length of
432+ // string. If snprintf is available use it, otherwise fall back to
433+ // the unsafe sprintf which, in general, can be dangerous and should
434+ // be avoided.
435+ template<typename _Tv>
436+ int
437+ __convert_from_v(char* __out, const int __size, const char* __fmt,
438+#ifdef __UCLIBC_HAS_XLOCALE__
439+ _Tv __v, const __c_locale& __cloc, int __prec)
440+ {
441+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
442+#else
443+ _Tv __v, const __c_locale&, int __prec)
444+ {
445+# ifdef __UCLIBC_HAS_LOCALE__
446+ char* __old = std::setlocale(LC_ALL, NULL);
447+ char* __sav = new char[std::strlen(__old) + 1];
448+ std::strcpy(__sav, __old);
449+ std::setlocale(LC_ALL, "C");
450+# endif
451+#endif
452+
453+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
454+
455+#ifdef __UCLIBC_HAS_XLOCALE__
456+ __gnu_cxx::__uselocale(__old);
457+#elif defined __UCLIBC_HAS_LOCALE__
458+ std::setlocale(LC_ALL, __sav);
459+ delete [] __sav;
460+#endif
461+ return __ret;
462+ }
463+}
464+
465+#endif
466diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
467--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
468+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2004-09-10 10:47:40.000000000 -0500
469@@ -0,0 +1,306 @@
470+// std::codecvt implementation details, GNU version -*- C++ -*-
471+
472+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
473+//
474+// This file is part of the GNU ISO C++ Library. This library is free
475+// software; you can redistribute it and/or modify it under the
476+// terms of the GNU General Public License as published by the
477+// Free Software Foundation; either version 2, or (at your option)
478+// any later version.
479+
480+// This library is distributed in the hope that it will be useful,
481+// but WITHOUT ANY WARRANTY; without even the implied warranty of
482+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
483+// GNU General Public License for more details.
484+
485+// You should have received a copy of the GNU General Public License along
486+// with this library; see the file COPYING. If not, write to the Free
487+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
488+// USA.
489+
490+// As a special exception, you may use this file as part of a free software
491+// library without restriction. Specifically, if other files instantiate
492+// templates or use macros or inline functions from this file, or you compile
493+// this file and link it with other files to produce an executable, this
494+// file does not by itself cause the resulting executable to be covered by
495+// the GNU General Public License. This exception does not however
496+// invalidate any other reasons why the executable file might be covered by
497+// the GNU General Public License.
498+
499+//
500+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
501+//
502+
503+// Written by Benjamin Kosnik <bkoz@redhat.com>
504+
505+#include <locale>
506+#include <bits/c++locale_internal.h>
507+
508+namespace std
509+{
510+ // Specializations.
511+#ifdef _GLIBCXX_USE_WCHAR_T
512+ codecvt_base::result
513+ codecvt<wchar_t, char, mbstate_t>::
514+ do_out(state_type& __state, const intern_type* __from,
515+ const intern_type* __from_end, const intern_type*& __from_next,
516+ extern_type* __to, extern_type* __to_end,
517+ extern_type*& __to_next) const
518+ {
519+ result __ret = ok;
520+ state_type __tmp_state(__state);
521+
522+#ifdef __UCLIBC_HAS_XLOCALE__
523+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
524+#endif
525+
526+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
527+ // in case we fall back to wcrtomb and then continue, in a loop.
528+ // NB: wcsnrtombs is a GNU extension
529+ for (__from_next = __from, __to_next = __to;
530+ __from_next < __from_end && __to_next < __to_end
531+ && __ret == ok;)
532+ {
533+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
534+ __from_end - __from_next);
535+ if (!__from_chunk_end)
536+ __from_chunk_end = __from_end;
537+
538+ __from = __from_next;
539+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
540+ __from_chunk_end - __from_next,
541+ __to_end - __to_next, &__state);
542+ if (__conv == static_cast<size_t>(-1))
543+ {
544+ // In case of error, in order to stop at the exact place we
545+ // have to start again from the beginning with a series of
546+ // wcrtomb.
547+ for (; __from < __from_next; ++__from)
548+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
549+ __state = __tmp_state;
550+ __ret = error;
551+ }
552+ else if (__from_next && __from_next < __from_chunk_end)
553+ {
554+ __to_next += __conv;
555+ __ret = partial;
556+ }
557+ else
558+ {
559+ __from_next = __from_chunk_end;
560+ __to_next += __conv;
561+ }
562+
563+ if (__from_next < __from_end && __ret == ok)
564+ {
565+ extern_type __buf[MB_LEN_MAX];
566+ __tmp_state = __state;
567+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
568+ if (__conv > static_cast<size_t>(__to_end - __to_next))
569+ __ret = partial;
570+ else
571+ {
572+ memcpy(__to_next, __buf, __conv);
573+ __state = __tmp_state;
574+ __to_next += __conv;
575+ ++__from_next;
576+ }
577+ }
578+ }
579+
580+#ifdef __UCLIBC_HAS_XLOCALE__
581+ __uselocale(__old);
582+#endif
583+
584+ return __ret;
585+ }
586+
587+ codecvt_base::result
588+ codecvt<wchar_t, char, mbstate_t>::
589+ do_in(state_type& __state, const extern_type* __from,
590+ const extern_type* __from_end, const extern_type*& __from_next,
591+ intern_type* __to, intern_type* __to_end,
592+ intern_type*& __to_next) const
593+ {
594+ result __ret = ok;
595+ state_type __tmp_state(__state);
596+
597+#ifdef __UCLIBC_HAS_XLOCALE__
598+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
599+#endif
600+
601+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
602+ // in case we store a L'\0' and then continue, in a loop.
603+ // NB: mbsnrtowcs is a GNU extension
604+ for (__from_next = __from, __to_next = __to;
605+ __from_next < __from_end && __to_next < __to_end
606+ && __ret == ok;)
607+ {
608+ const extern_type* __from_chunk_end;
609+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
610+ __from_end
611+ - __from_next));
612+ if (!__from_chunk_end)
613+ __from_chunk_end = __from_end;
614+
615+ __from = __from_next;
616+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
617+ __from_chunk_end - __from_next,
618+ __to_end - __to_next, &__state);
619+ if (__conv == static_cast<size_t>(-1))
620+ {
621+ // In case of error, in order to stop at the exact place we
622+ // have to start again from the beginning with a series of
623+ // mbrtowc.
624+ for (;; ++__to_next, __from += __conv)
625+ {
626+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
627+ &__tmp_state);
628+ if (__conv == static_cast<size_t>(-1)
629+ || __conv == static_cast<size_t>(-2))
630+ break;
631+ }
632+ __from_next = __from;
633+ __state = __tmp_state;
634+ __ret = error;
635+ }
636+ else if (__from_next && __from_next < __from_chunk_end)
637+ {
638+ // It is unclear what to return in this case (see DR 382).
639+ __to_next += __conv;
640+ __ret = partial;
641+ }
642+ else
643+ {
644+ __from_next = __from_chunk_end;
645+ __to_next += __conv;
646+ }
647+
648+ if (__from_next < __from_end && __ret == ok)
649+ {
650+ if (__to_next < __to_end)
651+ {
652+ // XXX Probably wrong for stateful encodings
653+ __tmp_state = __state;
654+ ++__from_next;
655+ *__to_next++ = L'\0';
656+ }
657+ else
658+ __ret = partial;
659+ }
660+ }
661+
662+#ifdef __UCLIBC_HAS_XLOCALE__
663+ __uselocale(__old);
664+#endif
665+
666+ return __ret;
667+ }
668+
669+ int
670+ codecvt<wchar_t, char, mbstate_t>::
671+ do_encoding() const throw()
672+ {
673+ // XXX This implementation assumes that the encoding is
674+ // stateless and is either single-byte or variable-width.
675+ int __ret = 0;
676+#ifdef __UCLIBC_HAS_XLOCALE__
677+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
678+#endif
679+ if (MB_CUR_MAX == 1)
680+ __ret = 1;
681+#ifdef __UCLIBC_HAS_XLOCALE__
682+ __uselocale(__old);
683+#endif
684+ return __ret;
685+ }
686+
687+ int
688+ codecvt<wchar_t, char, mbstate_t>::
689+ do_max_length() const throw()
690+ {
691+#ifdef __UCLIBC_HAS_XLOCALE__
692+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
693+#endif
694+ // XXX Probably wrong for stateful encodings.
695+ int __ret = MB_CUR_MAX;
696+#ifdef __UCLIBC_HAS_XLOCALE__
697+ __uselocale(__old);
698+#endif
699+ return __ret;
700+ }
701+
702+ int
703+ codecvt<wchar_t, char, mbstate_t>::
704+ do_length(state_type& __state, const extern_type* __from,
705+ const extern_type* __end, size_t __max) const
706+ {
707+ int __ret = 0;
708+ state_type __tmp_state(__state);
709+
710+#ifdef __UCLIBC_HAS_XLOCALE__
711+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
712+#endif
713+
714+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
715+ // in case we advance past it and then continue, in a loop.
716+ // NB: mbsnrtowcs is a GNU extension
717+
718+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
719+ // its fourth parameter (it wouldn't with NULL as first parameter).
720+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
721+ * __max));
722+ while (__from < __end && __max)
723+ {
724+ const extern_type* __from_chunk_end;
725+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
726+ __end
727+ - __from));
728+ if (!__from_chunk_end)
729+ __from_chunk_end = __end;
730+
731+ const extern_type* __tmp_from = __from;
732+ size_t __conv = mbsnrtowcs(__to, &__from,
733+ __from_chunk_end - __from,
734+ __max, &__state);
735+ if (__conv == static_cast<size_t>(-1))
736+ {
737+ // In case of error, in order to stop at the exact place we
738+ // have to start again from the beginning with a series of
739+ // mbrtowc.
740+ for (__from = __tmp_from;; __from += __conv)
741+ {
742+ __conv = mbrtowc(NULL, __from, __end - __from,
743+ &__tmp_state);
744+ if (__conv == static_cast<size_t>(-1)
745+ || __conv == static_cast<size_t>(-2))
746+ break;
747+ }
748+ __state = __tmp_state;
749+ __ret += __from - __tmp_from;
750+ break;
751+ }
752+ if (!__from)
753+ __from = __from_chunk_end;
754+
755+ __ret += __from - __tmp_from;
756+ __max -= __conv;
757+
758+ if (__from < __end && __max)
759+ {
760+ // XXX Probably wrong for stateful encodings
761+ __tmp_state = __state;
762+ ++__from;
763+ ++__ret;
764+ --__max;
765+ }
766+ }
767+
768+#ifdef __UCLIBC_HAS_XLOCALE__
769+ __uselocale(__old);
770+#endif
771+
772+ return __ret;
773+ }
774+#endif
775+}
776diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/collate_members.cc
777--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
778+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 2004-09-10 10:47:40.000000000 -0500
779@@ -0,0 +1,80 @@
780+// std::collate implementation details, GNU version -*- C++ -*-
781+
782+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
783+//
784+// This file is part of the GNU ISO C++ Library. This library is free
785+// software; you can redistribute it and/or modify it under the
786+// terms of the GNU General Public License as published by the
787+// Free Software Foundation; either version 2, or (at your option)
788+// any later version.
789+
790+// This library is distributed in the hope that it will be useful,
791+// but WITHOUT ANY WARRANTY; without even the implied warranty of
792+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
793+// GNU General Public License for more details.
794+
795+// You should have received a copy of the GNU General Public License along
796+// with this library; see the file COPYING. If not, write to the Free
797+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
798+// USA.
799+
800+// As a special exception, you may use this file as part of a free software
801+// library without restriction. Specifically, if other files instantiate
802+// templates or use macros or inline functions from this file, or you compile
803+// this file and link it with other files to produce an executable, this
804+// file does not by itself cause the resulting executable to be covered by
805+// the GNU General Public License. This exception does not however
806+// invalidate any other reasons why the executable file might be covered by
807+// the GNU General Public License.
808+
809+//
810+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
811+//
812+
813+// Written by Benjamin Kosnik <bkoz@redhat.com>
814+
815+#include <locale>
816+#include <bits/c++locale_internal.h>
817+
818+#ifndef __UCLIBC_HAS_XLOCALE__
819+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
820+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
821+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
822+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
823+#endif
824+
825+namespace std
826+{
827+ // These are basically extensions to char_traits, and perhaps should
828+ // be put there instead of here.
829+ template<>
830+ int
831+ collate<char>::_M_compare(const char* __one, const char* __two) const
832+ {
833+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
834+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
835+ }
836+
837+ template<>
838+ size_t
839+ collate<char>::_M_transform(char* __to, const char* __from,
840+ size_t __n) const
841+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
842+
843+#ifdef _GLIBCXX_USE_WCHAR_T
844+ template<>
845+ int
846+ collate<wchar_t>::_M_compare(const wchar_t* __one,
847+ const wchar_t* __two) const
848+ {
849+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
850+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
851+ }
852+
853+ template<>
854+ size_t
855+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
856+ size_t __n) const
857+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
858+#endif
859+}
860diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc
861--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600
862+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2004-09-10 10:47:40.000000000 -0500
863@@ -0,0 +1,300 @@
864+// std::ctype implementation details, GNU version -*- C++ -*-
865+
866+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
867+//
868+// This file is part of the GNU ISO C++ Library. This library is free
869+// software; you can redistribute it and/or modify it under the
870+// terms of the GNU General Public License as published by the
871+// Free Software Foundation; either version 2, or (at your option)
872+// any later version.
873+
874+// This library is distributed in the hope that it will be useful,
875+// but WITHOUT ANY WARRANTY; without even the implied warranty of
876+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
877+// GNU General Public License for more details.
878+
879+// You should have received a copy of the GNU General Public License along
880+// with this library; see the file COPYING. If not, write to the Free
881+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
882+// USA.
883+
884+// As a special exception, you may use this file as part of a free software
885+// library without restriction. Specifically, if other files instantiate
886+// templates or use macros or inline functions from this file, or you compile
887+// this file and link it with other files to produce an executable, this
888+// file does not by itself cause the resulting executable to be covered by
889+// the GNU General Public License. This exception does not however
890+// invalidate any other reasons why the executable file might be covered by
891+// the GNU General Public License.
892+
893+//
894+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
895+//
896+
897+// Written by Benjamin Kosnik <bkoz@redhat.com>
898+
899+#define _LIBC
900+#include <locale>
901+#undef _LIBC
902+#include <bits/c++locale_internal.h>
903+
904+#ifndef __UCLIBC_HAS_XLOCALE__
905+#define __wctype_l(S, L) wctype((S))
906+#define __towupper_l(C, L) towupper((C))
907+#define __towlower_l(C, L) towlower((C))
908+#define __iswctype_l(C, M, L) iswctype((C), (M))
909+#endif
910+
911+namespace std
912+{
913+ // NB: The other ctype<char> specializations are in src/locale.cc and
914+ // various /config/os/* files.
915+ template<>
916+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
917+ : ctype<char>(0, false, __refs)
918+ {
919+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
920+ {
921+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
922+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
923+#ifdef __UCLIBC_HAS_XLOCALE__
924+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
925+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
926+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
927+#endif
928+ }
929+ }
930+
931+#ifdef _GLIBCXX_USE_WCHAR_T
932+ ctype<wchar_t>::__wmask_type
933+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
934+ {
935+ __wmask_type __ret;
936+ switch (__m)
937+ {
938+ case space:
939+ __ret = __wctype_l("space", _M_c_locale_ctype);
940+ break;
941+ case print:
942+ __ret = __wctype_l("print", _M_c_locale_ctype);
943+ break;
944+ case cntrl:
945+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
946+ break;
947+ case upper:
948+ __ret = __wctype_l("upper", _M_c_locale_ctype);
949+ break;
950+ case lower:
951+ __ret = __wctype_l("lower", _M_c_locale_ctype);
952+ break;
953+ case alpha:
954+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
955+ break;
956+ case digit:
957+ __ret = __wctype_l("digit", _M_c_locale_ctype);
958+ break;
959+ case punct:
960+ __ret = __wctype_l("punct", _M_c_locale_ctype);
961+ break;
962+ case xdigit:
963+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
964+ break;
965+ case alnum:
966+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
967+ break;
968+ case graph:
969+ __ret = __wctype_l("graph", _M_c_locale_ctype);
970+ break;
971+ default:
972+ __ret = 0;
973+ }
974+ return __ret;
975+ }
976+
977+ wchar_t
978+ ctype<wchar_t>::do_toupper(wchar_t __c) const
979+ { return __towupper_l(__c, _M_c_locale_ctype); }
980+
981+ const wchar_t*
982+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
983+ {
984+ while (__lo < __hi)
985+ {
986+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
987+ ++__lo;
988+ }
989+ return __hi;
990+ }
991+
992+ wchar_t
993+ ctype<wchar_t>::do_tolower(wchar_t __c) const
994+ { return __towlower_l(__c, _M_c_locale_ctype); }
995+
996+ const wchar_t*
997+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
998+ {
999+ while (__lo < __hi)
1000+ {
1001+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
1002+ ++__lo;
1003+ }
1004+ return __hi;
1005+ }
1006+
1007+ bool
1008+ ctype<wchar_t>::
1009+ do_is(mask __m, wchar_t __c) const
1010+ {
1011+ // Highest bitmask in ctype_base == 10, but extra in "C"
1012+ // library for blank.
1013+ bool __ret = false;
1014+ const size_t __bitmasksize = 11;
1015+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1016+ if (__m & _M_bit[__bitcur]
1017+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1018+ {
1019+ __ret = true;
1020+ break;
1021+ }
1022+ return __ret;
1023+ }
1024+
1025+ const wchar_t*
1026+ ctype<wchar_t>::
1027+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1028+ {
1029+ for (; __lo < __hi; ++__vec, ++__lo)
1030+ {
1031+ // Highest bitmask in ctype_base == 10, but extra in "C"
1032+ // library for blank.
1033+ const size_t __bitmasksize = 11;
1034+ mask __m = 0;
1035+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1036+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1037+ __m |= _M_bit[__bitcur];
1038+ *__vec = __m;
1039+ }
1040+ return __hi;
1041+ }
1042+
1043+ const wchar_t*
1044+ ctype<wchar_t>::
1045+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1046+ {
1047+ while (__lo < __hi && !this->do_is(__m, *__lo))
1048+ ++__lo;
1049+ return __lo;
1050+ }
1051+
1052+ const wchar_t*
1053+ ctype<wchar_t>::
1054+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1055+ {
1056+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1057+ ++__lo;
1058+ return __lo;
1059+ }
1060+
1061+ wchar_t
1062+ ctype<wchar_t>::
1063+ do_widen(char __c) const
1064+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1065+
1066+ const char*
1067+ ctype<wchar_t>::
1068+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1069+ {
1070+ while (__lo < __hi)
1071+ {
1072+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1073+ ++__lo;
1074+ ++__dest;
1075+ }
1076+ return __hi;
1077+ }
1078+
1079+ char
1080+ ctype<wchar_t>::
1081+ do_narrow(wchar_t __wc, char __dfault) const
1082+ {
1083+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1084+ return _M_narrow[__wc];
1085+#ifdef __UCLIBC_HAS_XLOCALE__
1086+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1087+#endif
1088+ const int __c = wctob(__wc);
1089+#ifdef __UCLIBC_HAS_XLOCALE__
1090+ __uselocale(__old);
1091+#endif
1092+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1093+ }
1094+
1095+ const wchar_t*
1096+ ctype<wchar_t>::
1097+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1098+ char* __dest) const
1099+ {
1100+#ifdef __UCLIBC_HAS_XLOCALE__
1101+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1102+#endif
1103+ if (_M_narrow_ok)
1104+ while (__lo < __hi)
1105+ {
1106+ if (*__lo >= 0 && *__lo < 128)
1107+ *__dest = _M_narrow[*__lo];
1108+ else
1109+ {
1110+ const int __c = wctob(*__lo);
1111+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1112+ }
1113+ ++__lo;
1114+ ++__dest;
1115+ }
1116+ else
1117+ while (__lo < __hi)
1118+ {
1119+ const int __c = wctob(*__lo);
1120+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1121+ ++__lo;
1122+ ++__dest;
1123+ }
1124+#ifdef __UCLIBC_HAS_XLOCALE__
1125+ __uselocale(__old);
1126+#endif
1127+ return __hi;
1128+ }
1129+
1130+ void
1131+ ctype<wchar_t>::_M_initialize_ctype()
1132+ {
1133+#ifdef __UCLIBC_HAS_XLOCALE__
1134+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1135+#endif
1136+ wint_t __i;
1137+ for (__i = 0; __i < 128; ++__i)
1138+ {
1139+ const int __c = wctob(__i);
1140+ if (__c == EOF)
1141+ break;
1142+ else
1143+ _M_narrow[__i] = static_cast<char>(__c);
1144+ }
1145+ if (__i == 128)
1146+ _M_narrow_ok = true;
1147+ else
1148+ _M_narrow_ok = false;
1149+ for (size_t __j = 0;
1150+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1151+ _M_widen[__j] = btowc(__j);
1152+
1153+ for (size_t __k = 0; __k <= 11; ++__k)
1154+ {
1155+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1156+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1157+ }
1158+#ifdef __UCLIBC_HAS_XLOCALE__
1159+ __uselocale(__old);
1160+#endif
1161+ }
1162+#endif // _GLIBCXX_USE_WCHAR_T
1163+}
1164diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.cc
1165--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600
1166+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 2004-09-10 10:47:40.000000000 -0500
1167@@ -0,0 +1,100 @@
1168+// std::messages implementation details, GNU version -*- C++ -*-
1169+
1170+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1171+//
1172+// This file is part of the GNU ISO C++ Library. This library is free
1173+// software; you can redistribute it and/or modify it under the
1174+// terms of the GNU General Public License as published by the
1175+// Free Software Foundation; either version 2, or (at your option)
1176+// any later version.
1177+
1178+// This library is distributed in the hope that it will be useful,
1179+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1180+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1181+// GNU General Public License for more details.
1182+
1183+// You should have received a copy of the GNU General Public License along
1184+// with this library; see the file COPYING. If not, write to the Free
1185+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1186+// USA.
1187+
1188+// As a special exception, you may use this file as part of a free software
1189+// library without restriction. Specifically, if other files instantiate
1190+// templates or use macros or inline functions from this file, or you compile
1191+// this file and link it with other files to produce an executable, this
1192+// file does not by itself cause the resulting executable to be covered by
1193+// the GNU General Public License. This exception does not however
1194+// invalidate any other reasons why the executable file might be covered by
1195+// the GNU General Public License.
1196+
1197+//
1198+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1199+//
1200+
1201+// Written by Benjamin Kosnik <bkoz@redhat.com>
1202+
1203+#include <locale>
1204+#include <bits/c++locale_internal.h>
1205+
1206+#ifdef __UCLIBC_MJN3_ONLY__
1207+#warning fix gettext stuff
1208+#endif
1209+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1210+extern "C" char *__dcgettext(const char *domainname,
1211+ const char *msgid, int category);
1212+#undef gettext
1213+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1214+#else
1215+#undef gettext
1216+#define gettext(msgid) (msgid)
1217+#endif
1218+
1219+namespace std
1220+{
1221+ // Specializations.
1222+ template<>
1223+ string
1224+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1225+ {
1226+#ifdef __UCLIBC_HAS_XLOCALE__
1227+ __c_locale __old = __uselocale(_M_c_locale_messages);
1228+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1229+ __uselocale(__old);
1230+ return string(__msg);
1231+#elif defined __UCLIBC_HAS_LOCALE__
1232+ char* __old = strdup(setlocale(LC_ALL, NULL));
1233+ setlocale(LC_ALL, _M_name_messages);
1234+ const char* __msg = gettext(__dfault.c_str());
1235+ setlocale(LC_ALL, __old);
1236+ free(__old);
1237+ return string(__msg);
1238+#else
1239+ const char* __msg = gettext(__dfault.c_str());
1240+ return string(__msg);
1241+#endif
1242+ }
1243+
1244+#ifdef _GLIBCXX_USE_WCHAR_T
1245+ template<>
1246+ wstring
1247+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1248+ {
1249+# ifdef __UCLIBC_HAS_XLOCALE__
1250+ __c_locale __old = __uselocale(_M_c_locale_messages);
1251+ char* __msg = gettext(_M_convert_to_char(__dfault));
1252+ __uselocale(__old);
1253+ return _M_convert_from_char(__msg);
1254+# elif defined __UCLIBC_HAS_LOCALE__
1255+ char* __old = strdup(setlocale(LC_ALL, NULL));
1256+ setlocale(LC_ALL, _M_name_messages);
1257+ char* __msg = gettext(_M_convert_to_char(__dfault));
1258+ setlocale(LC_ALL, __old);
1259+ free(__old);
1260+ return _M_convert_from_char(__msg);
1261+# else
1262+ char* __msg = gettext(_M_convert_to_char(__dfault));
1263+ return _M_convert_from_char(__msg);
1264+# endif
1265+ }
1266+#endif
1267+}
1268diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.h
1269--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
1270+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2004-09-10 10:47:40.000000000 -0500
1271@@ -0,0 +1,118 @@
1272+// std::messages implementation details, GNU version -*- C++ -*-
1273+
1274+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1275+//
1276+// This file is part of the GNU ISO C++ Library. This library is free
1277+// software; you can redistribute it and/or modify it under the
1278+// terms of the GNU General Public License as published by the
1279+// Free Software Foundation; either version 2, or (at your option)
1280+// any later version.
1281+
1282+// This library is distributed in the hope that it will be useful,
1283+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1284+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1285+// GNU General Public License for more details.
1286+
1287+// You should have received a copy of the GNU General Public License along
1288+// with this library; see the file COPYING. If not, write to the Free
1289+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1290+// USA.
1291+
1292+// As a special exception, you may use this file as part of a free software
1293+// library without restriction. Specifically, if other files instantiate
1294+// templates or use macros or inline functions from this file, or you compile
1295+// this file and link it with other files to produce an executable, this
1296+// file does not by itself cause the resulting executable to be covered by
1297+// the GNU General Public License. This exception does not however
1298+// invalidate any other reasons why the executable file might be covered by
1299+// the GNU General Public License.
1300+
1301+//
1302+// ISO C++ 14882: 22.2.7.1.2 messages functions
1303+//
1304+
1305+// Written by Benjamin Kosnik <bkoz@redhat.com>
1306+
1307+#ifdef __UCLIBC_MJN3_ONLY__
1308+#warning fix prototypes for *textdomain funcs
1309+#endif
1310+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1311+extern "C" char *__textdomain(const char *domainname);
1312+extern "C" char *__bindtextdomain(const char *domainname,
1313+ const char *dirname);
1314+#else
1315+#undef __textdomain
1316+#undef __bindtextdomain
1317+#define __textdomain(D) ((void)0)
1318+#define __bindtextdomain(D,P) ((void)0)
1319+#endif
1320+
1321+ // Non-virtual member functions.
1322+ template<typename _CharT>
1323+ messages<_CharT>::messages(size_t __refs)
1324+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1325+ _M_name_messages(_S_get_c_name())
1326+ { }
1327+
1328+ template<typename _CharT>
1329+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1330+ size_t __refs)
1331+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1332+ _M_name_messages(__s)
1333+ {
1334+ char* __tmp = new char[std::strlen(__s) + 1];
1335+ std::strcpy(__tmp, __s);
1336+ _M_name_messages = __tmp;
1337+ }
1338+
1339+ template<typename _CharT>
1340+ typename messages<_CharT>::catalog
1341+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1342+ const char* __dir) const
1343+ {
1344+ __bindtextdomain(__s.c_str(), __dir);
1345+ return this->do_open(__s, __loc);
1346+ }
1347+
1348+ // Virtual member functions.
1349+ template<typename _CharT>
1350+ messages<_CharT>::~messages()
1351+ {
1352+ if (_M_name_messages != _S_get_c_name())
1353+ delete [] _M_name_messages;
1354+ _S_destroy_c_locale(_M_c_locale_messages);
1355+ }
1356+
1357+ template<typename _CharT>
1358+ typename messages<_CharT>::catalog
1359+ messages<_CharT>::do_open(const basic_string<char>& __s,
1360+ const locale&) const
1361+ {
1362+ // No error checking is done, assume the catalog exists and can
1363+ // be used.
1364+ __textdomain(__s.c_str());
1365+ return 0;
1366+ }
1367+
1368+ template<typename _CharT>
1369+ void
1370+ messages<_CharT>::do_close(catalog) const
1371+ { }
1372+
1373+ // messages_byname
1374+ template<typename _CharT>
1375+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1376+ : messages<_CharT>(__refs)
1377+ {
1378+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1379+ delete [] this->_M_name_messages;
1380+ char* __tmp = new char[std::strlen(__s) + 1];
1381+ std::strcpy(__tmp, __s);
1382+ this->_M_name_messages = __tmp;
1383+
1384+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1385+ {
1386+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1387+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1388+ }
1389+ }
1390diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1391--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600
1392+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2004-09-10 10:47:40.000000000 -0500
1393@@ -0,0 +1,698 @@
1394+// std::moneypunct implementation details, GNU version -*- C++ -*-
1395+
1396+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1397+//
1398+// This file is part of the GNU ISO C++ Library. This library is free
1399+// software; you can redistribute it and/or modify it under the
1400+// terms of the GNU General Public License as published by the
1401+// Free Software Foundation; either version 2, or (at your option)
1402+// any later version.
1403+
1404+// This library is distributed in the hope that it will be useful,
1405+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1406+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1407+// GNU General Public License for more details.
1408+
1409+// You should have received a copy of the GNU General Public License along
1410+// with this library; see the file COPYING. If not, write to the Free
1411+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1412+// USA.
1413+
1414+// As a special exception, you may use this file as part of a free software
1415+// library without restriction. Specifically, if other files instantiate
1416+// templates or use macros or inline functions from this file, or you compile
1417+// this file and link it with other files to produce an executable, this
1418+// file does not by itself cause the resulting executable to be covered by
1419+// the GNU General Public License. This exception does not however
1420+// invalidate any other reasons why the executable file might be covered by
1421+// the GNU General Public License.
1422+
1423+//
1424+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1425+//
1426+
1427+// Written by Benjamin Kosnik <bkoz@redhat.com>
1428+
1429+#define _LIBC
1430+#include <locale>
1431+#undef _LIBC
1432+#include <bits/c++locale_internal.h>
1433+
1434+#ifdef __UCLIBC_MJN3_ONLY__
1435+#warning optimize this for uclibc
1436+#warning tailor for stub locale support
1437+#endif
1438+
1439+#ifndef __UCLIBC_HAS_XLOCALE__
1440+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1441+#endif
1442+
1443+namespace std
1444+{
1445+ // Construct and return valid pattern consisting of some combination of:
1446+ // space none symbol sign value
1447+ money_base::pattern
1448+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1449+ {
1450+ pattern __ret;
1451+
1452+ // This insanely complicated routine attempts to construct a valid
1453+ // pattern for use with monyepunct. A couple of invariants:
1454+
1455+ // if (__precedes) symbol -> value
1456+ // else value -> symbol
1457+
1458+ // if (__space) space
1459+ // else none
1460+
1461+ // none == never first
1462+ // space never first or last
1463+
1464+ // Any elegant implementations of this are welcome.
1465+ switch (__posn)
1466+ {
1467+ case 0:
1468+ case 1:
1469+ // 1 The sign precedes the value and symbol.
1470+ __ret.field[0] = sign;
1471+ if (__space)
1472+ {
1473+ // Pattern starts with sign.
1474+ if (__precedes)
1475+ {
1476+ __ret.field[1] = symbol;
1477+ __ret.field[3] = value;
1478+ }
1479+ else
1480+ {
1481+ __ret.field[1] = value;
1482+ __ret.field[3] = symbol;
1483+ }
1484+ __ret.field[2] = space;
1485+ }
1486+ else
1487+ {
1488+ // Pattern starts with sign and ends with none.
1489+ if (__precedes)
1490+ {
1491+ __ret.field[1] = symbol;
1492+ __ret.field[2] = value;
1493+ }
1494+ else
1495+ {
1496+ __ret.field[1] = value;
1497+ __ret.field[2] = symbol;
1498+ }
1499+ __ret.field[3] = none;
1500+ }
1501+ break;
1502+ case 2:
1503+ // 2 The sign follows the value and symbol.
1504+ if (__space)
1505+ {
1506+ // Pattern either ends with sign.
1507+ if (__precedes)
1508+ {
1509+ __ret.field[0] = symbol;
1510+ __ret.field[2] = value;
1511+ }
1512+ else
1513+ {
1514+ __ret.field[0] = value;
1515+ __ret.field[2] = symbol;
1516+ }
1517+ __ret.field[1] = space;
1518+ __ret.field[3] = sign;
1519+ }
1520+ else
1521+ {
1522+ // Pattern ends with sign then none.
1523+ if (__precedes)
1524+ {
1525+ __ret.field[0] = symbol;
1526+ __ret.field[1] = value;
1527+ }
1528+ else
1529+ {
1530+ __ret.field[0] = value;
1531+ __ret.field[1] = symbol;
1532+ }
1533+ __ret.field[2] = sign;
1534+ __ret.field[3] = none;
1535+ }
1536+ break;
1537+ case 3:
1538+ // 3 The sign immediately precedes the symbol.
1539+ if (__precedes)
1540+ {
1541+ __ret.field[0] = sign;
1542+ __ret.field[1] = symbol;
1543+ if (__space)
1544+ {
1545+ __ret.field[2] = space;
1546+ __ret.field[3] = value;
1547+ }
1548+ else
1549+ {
1550+ __ret.field[2] = value;
1551+ __ret.field[3] = none;
1552+ }
1553+ }
1554+ else
1555+ {
1556+ __ret.field[0] = value;
1557+ if (__space)
1558+ {
1559+ __ret.field[1] = space;
1560+ __ret.field[2] = sign;
1561+ __ret.field[3] = symbol;
1562+ }
1563+ else
1564+ {
1565+ __ret.field[1] = sign;
1566+ __ret.field[2] = symbol;
1567+ __ret.field[3] = none;
1568+ }
1569+ }
1570+ break;
1571+ case 4:
1572+ // 4 The sign immediately follows the symbol.
1573+ if (__precedes)
1574+ {
1575+ __ret.field[0] = symbol;
1576+ __ret.field[1] = sign;
1577+ if (__space)
1578+ {
1579+ __ret.field[2] = space;
1580+ __ret.field[3] = value;
1581+ }
1582+ else
1583+ {
1584+ __ret.field[2] = value;
1585+ __ret.field[3] = none;
1586+ }
1587+ }
1588+ else
1589+ {
1590+ __ret.field[0] = value;
1591+ if (__space)
1592+ {
1593+ __ret.field[1] = space;
1594+ __ret.field[2] = symbol;
1595+ __ret.field[3] = sign;
1596+ }
1597+ else
1598+ {
1599+ __ret.field[1] = symbol;
1600+ __ret.field[2] = sign;
1601+ __ret.field[3] = none;
1602+ }
1603+ }
1604+ break;
1605+ default:
1606+ ;
1607+ }
1608+ return __ret;
1609+ }
1610+
1611+ template<>
1612+ void
1613+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1614+ const char*)
1615+ {
1616+ if (!_M_data)
1617+ _M_data = new __moneypunct_cache<char, true>;
1618+
1619+ if (!__cloc)
1620+ {
1621+ // "C" locale
1622+ _M_data->_M_decimal_point = '.';
1623+ _M_data->_M_thousands_sep = ',';
1624+ _M_data->_M_grouping = "";
1625+ _M_data->_M_grouping_size = 0;
1626+ _M_data->_M_curr_symbol = "";
1627+ _M_data->_M_curr_symbol_size = 0;
1628+ _M_data->_M_positive_sign = "";
1629+ _M_data->_M_positive_sign_size = 0;
1630+ _M_data->_M_negative_sign = "";
1631+ _M_data->_M_negative_sign_size = 0;
1632+ _M_data->_M_frac_digits = 0;
1633+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1634+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1635+
1636+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1637+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1638+ }
1639+ else
1640+ {
1641+ // Named locale.
1642+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1643+ __cloc));
1644+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1645+ __cloc));
1646+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1647+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1648+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1649+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1650+
1651+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1652+ if (!__nposn)
1653+ _M_data->_M_negative_sign = "()";
1654+ else
1655+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1656+ __cloc);
1657+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1658+
1659+ // _Intl == true
1660+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1661+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1662+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1663+ __cloc));
1664+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1665+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1666+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1667+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1668+ __pposn);
1669+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1670+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1671+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1672+ __nposn);
1673+ }
1674+ }
1675+
1676+ template<>
1677+ void
1678+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1679+ const char*)
1680+ {
1681+ if (!_M_data)
1682+ _M_data = new __moneypunct_cache<char, false>;
1683+
1684+ if (!__cloc)
1685+ {
1686+ // "C" locale
1687+ _M_data->_M_decimal_point = '.';
1688+ _M_data->_M_thousands_sep = ',';
1689+ _M_data->_M_grouping = "";
1690+ _M_data->_M_grouping_size = 0;
1691+ _M_data->_M_curr_symbol = "";
1692+ _M_data->_M_curr_symbol_size = 0;
1693+ _M_data->_M_positive_sign = "";
1694+ _M_data->_M_positive_sign_size = 0;
1695+ _M_data->_M_negative_sign = "";
1696+ _M_data->_M_negative_sign_size = 0;
1697+ _M_data->_M_frac_digits = 0;
1698+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1699+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1700+
1701+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1702+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1703+ }
1704+ else
1705+ {
1706+ // Named locale.
1707+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1708+ __cloc));
1709+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1710+ __cloc));
1711+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1712+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1713+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1714+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1715+
1716+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1717+ if (!__nposn)
1718+ _M_data->_M_negative_sign = "()";
1719+ else
1720+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1721+ __cloc);
1722+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1723+
1724+ // _Intl == false
1725+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1726+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1727+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1728+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1729+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1730+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1731+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1732+ __pposn);
1733+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1734+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1735+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1736+ __nposn);
1737+ }
1738+ }
1739+
1740+ template<>
1741+ moneypunct<char, true>::~moneypunct()
1742+ { delete _M_data; }
1743+
1744+ template<>
1745+ moneypunct<char, false>::~moneypunct()
1746+ { delete _M_data; }
1747+
1748+#ifdef _GLIBCXX_USE_WCHAR_T
1749+ template<>
1750+ void
1751+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1752+#ifdef __UCLIBC_HAS_XLOCALE__
1753+ const char*)
1754+#else
1755+ const char* __name)
1756+#endif
1757+ {
1758+ if (!_M_data)
1759+ _M_data = new __moneypunct_cache<wchar_t, true>;
1760+
1761+ if (!__cloc)
1762+ {
1763+ // "C" locale
1764+ _M_data->_M_decimal_point = L'.';
1765+ _M_data->_M_thousands_sep = L',';
1766+ _M_data->_M_grouping = "";
1767+ _M_data->_M_grouping_size = 0;
1768+ _M_data->_M_curr_symbol = L"";
1769+ _M_data->_M_curr_symbol_size = 0;
1770+ _M_data->_M_positive_sign = L"";
1771+ _M_data->_M_positive_sign_size = 0;
1772+ _M_data->_M_negative_sign = L"";
1773+ _M_data->_M_negative_sign_size = 0;
1774+ _M_data->_M_frac_digits = 0;
1775+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1776+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1777+
1778+ // Use ctype::widen code without the facet...
1779+ unsigned char uc;
1780+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1781+ {
1782+ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
1783+ _M_data->_M_atoms[__i] = btowc(uc);
1784+ }
1785+ }
1786+ else
1787+ {
1788+ // Named locale.
1789+#ifdef __UCLIBC_HAS_XLOCALE__
1790+ __c_locale __old = __uselocale(__cloc);
1791+#else
1792+ // Switch to named locale so that mbsrtowcs will work.
1793+ char* __old = strdup(setlocale(LC_ALL, NULL));
1794+ setlocale(LC_ALL, __name);
1795+#endif
1796+
1797+#ifdef __UCLIBC_MJN3_ONLY__
1798+#warning fix this... should be monetary
1799+#endif
1800+#ifdef __UCLIBC__
1801+# ifdef __UCLIBC_HAS_XLOCALE__
1802+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1803+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1804+# else
1805+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1806+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1807+# endif
1808+#else
1809+ union __s_and_w { const char *__s; unsigned int __w; } __u;
1810+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1811+ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
1812+
1813+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1814+ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
1815+#endif
1816+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1817+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1818+
1819+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1820+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1821+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1822+
1823+ wchar_t* __wcs_ps = 0;
1824+ wchar_t* __wcs_ns = 0;
1825+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1826+ try
1827+ {
1828+ mbstate_t __state;
1829+ size_t __len = strlen(__cpossign);
1830+ if (__len)
1831+ {
1832+ ++__len;
1833+ memset(&__state, 0, sizeof(mbstate_t));
1834+ __wcs_ps = new wchar_t[__len];
1835+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1836+ _M_data->_M_positive_sign = __wcs_ps;
1837+ }
1838+ else
1839+ _M_data->_M_positive_sign = L"";
1840+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1841+
1842+ __len = strlen(__cnegsign);
1843+ if (!__nposn)
1844+ _M_data->_M_negative_sign = L"()";
1845+ else if (__len)
1846+ {
1847+ ++__len;
1848+ memset(&__state, 0, sizeof(mbstate_t));
1849+ __wcs_ns = new wchar_t[__len];
1850+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1851+ _M_data->_M_negative_sign = __wcs_ns;
1852+ }
1853+ else
1854+ _M_data->_M_negative_sign = L"";
1855+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1856+
1857+ // _Intl == true.
1858+ __len = strlen(__ccurr);
1859+ if (__len)
1860+ {
1861+ ++__len;
1862+ memset(&__state, 0, sizeof(mbstate_t));
1863+ wchar_t* __wcs = new wchar_t[__len];
1864+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1865+ _M_data->_M_curr_symbol = __wcs;
1866+ }
1867+ else
1868+ _M_data->_M_curr_symbol = L"";
1869+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1870+ }
1871+ catch (...)
1872+ {
1873+ delete _M_data;
1874+ _M_data = 0;
1875+ delete __wcs_ps;
1876+ delete __wcs_ns;
1877+#ifdef __UCLIBC_HAS_XLOCALE__
1878+ __uselocale(__old);
1879+#else
1880+ setlocale(LC_ALL, __old);
1881+ free(__old);
1882+#endif
1883+ __throw_exception_again;
1884+ }
1885+
1886+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1887+ __cloc));
1888+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1889+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1890+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1891+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1892+ __pposn);
1893+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1894+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1895+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1896+ __nposn);
1897+
1898+#ifdef __UCLIBC_HAS_XLOCALE__
1899+ __uselocale(__old);
1900+#else
1901+ setlocale(LC_ALL, __old);
1902+ free(__old);
1903+#endif
1904+ }
1905+ }
1906+
1907+ template<>
1908+ void
1909+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1910+#ifdef __UCLIBC_HAS_XLOCALE__
1911+ const char*)
1912+#else
1913+ const char* __name)
1914+#endif
1915+ {
1916+ if (!_M_data)
1917+ _M_data = new __moneypunct_cache<wchar_t, false>;
1918+
1919+ if (!__cloc)
1920+ {
1921+ // "C" locale
1922+ _M_data->_M_decimal_point = L'.';
1923+ _M_data->_M_thousands_sep = L',';
1924+ _M_data->_M_grouping = "";
1925+ _M_data->_M_grouping_size = 0;
1926+ _M_data->_M_curr_symbol = L"";
1927+ _M_data->_M_curr_symbol_size = 0;
1928+ _M_data->_M_positive_sign = L"";
1929+ _M_data->_M_positive_sign_size = 0;
1930+ _M_data->_M_negative_sign = L"";
1931+ _M_data->_M_negative_sign_size = 0;
1932+ _M_data->_M_frac_digits = 0;
1933+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1934+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1935+
1936+ // Use ctype::widen code without the facet...
1937+ unsigned char uc;
1938+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1939+ {
1940+ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
1941+ _M_data->_M_atoms[__i] = btowc(uc);
1942+ }
1943+ }
1944+ else
1945+ {
1946+ // Named locale.
1947+#ifdef __UCLIBC_HAS_XLOCALE__
1948+ __c_locale __old = __uselocale(__cloc);
1949+#else
1950+ // Switch to named locale so that mbsrtowcs will work.
1951+ char* __old = strdup(setlocale(LC_ALL, NULL));
1952+ setlocale(LC_ALL, __name);
1953+#endif
1954+
1955+#ifdef __UCLIBC_MJN3_ONLY__
1956+#warning fix this... should be monetary
1957+#endif
1958+#ifdef __UCLIBC__
1959+# ifdef __UCLIBC_HAS_XLOCALE__
1960+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1961+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1962+# else
1963+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1964+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1965+# endif
1966+#else
1967+ union __s_and_w { const char *__s; unsigned int __w; } __u;
1968+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1969+ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
1970+
1971+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1972+ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
1973+#endif
1974+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1975+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1976+
1977+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1978+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1979+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1980+
1981+ wchar_t* __wcs_ps = 0;
1982+ wchar_t* __wcs_ns = 0;
1983+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1984+ try
1985+ {
1986+ mbstate_t __state;
1987+ size_t __len;
1988+ __len = strlen(__cpossign);
1989+ if (__len)
1990+ {
1991+ ++__len;
1992+ memset(&__state, 0, sizeof(mbstate_t));
1993+ __wcs_ps = new wchar_t[__len];
1994+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1995+ _M_data->_M_positive_sign = __wcs_ps;
1996+ }
1997+ else
1998+ _M_data->_M_positive_sign = L"";
1999+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
2000+
2001+ __len = strlen(__cnegsign);
2002+ if (!__nposn)
2003+ _M_data->_M_negative_sign = L"()";
2004+ else if (__len)
2005+ {
2006+ ++__len;
2007+ memset(&__state, 0, sizeof(mbstate_t));
2008+ __wcs_ns = new wchar_t[__len];
2009+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2010+ _M_data->_M_negative_sign = __wcs_ns;
2011+ }
2012+ else
2013+ _M_data->_M_negative_sign = L"";
2014+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2015+
2016+ // _Intl == true.
2017+ __len = strlen(__ccurr);
2018+ if (__len)
2019+ {
2020+ ++__len;
2021+ memset(&__state, 0, sizeof(mbstate_t));
2022+ wchar_t* __wcs = new wchar_t[__len];
2023+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2024+ _M_data->_M_curr_symbol = __wcs;
2025+ }
2026+ else
2027+ _M_data->_M_curr_symbol = L"";
2028+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2029+ }
2030+ catch (...)
2031+ {
2032+ delete _M_data;
2033+ _M_data = 0;
2034+ delete __wcs_ps;
2035+ delete __wcs_ns;
2036+#ifdef __UCLIBC_HAS_XLOCALE__
2037+ __uselocale(__old);
2038+#else
2039+ setlocale(LC_ALL, __old);
2040+ free(__old);
2041+#endif
2042+ __throw_exception_again;
2043+ }
2044+
2045+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2046+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2047+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2048+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2049+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2050+ __pposn);
2051+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2052+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2053+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2054+ __nposn);
2055+
2056+#ifdef __UCLIBC_HAS_XLOCALE__
2057+ __uselocale(__old);
2058+#else
2059+ setlocale(LC_ALL, __old);
2060+ free(__old);
2061+#endif
2062+ }
2063+ }
2064+
2065+ template<>
2066+ moneypunct<wchar_t, true>::~moneypunct()
2067+ {
2068+ if (_M_data->_M_positive_sign_size)
2069+ delete [] _M_data->_M_positive_sign;
2070+ if (_M_data->_M_negative_sign_size
2071+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2072+ delete [] _M_data->_M_negative_sign;
2073+ if (_M_data->_M_curr_symbol_size)
2074+ delete [] _M_data->_M_curr_symbol;
2075+ delete _M_data;
2076+ }
2077+
2078+ template<>
2079+ moneypunct<wchar_t, false>::~moneypunct()
2080+ {
2081+ if (_M_data->_M_positive_sign_size)
2082+ delete [] _M_data->_M_positive_sign;
2083+ if (_M_data->_M_negative_sign_size
2084+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2085+ delete [] _M_data->_M_negative_sign;
2086+ if (_M_data->_M_curr_symbol_size)
2087+ delete [] _M_data->_M_curr_symbol;
2088+ delete _M_data;
2089+ }
2090+#endif
2091+}
2092diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2093--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
2094+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2004-09-10 10:47:40.000000000 -0500
2095@@ -0,0 +1,183 @@
2096+// std::numpunct implementation details, GNU version -*- C++ -*-
2097+
2098+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2099+//
2100+// This file is part of the GNU ISO C++ Library. This library is free
2101+// software; you can redistribute it and/or modify it under the
2102+// terms of the GNU General Public License as published by the
2103+// Free Software Foundation; either version 2, or (at your option)
2104+// any later version.
2105+
2106+// This library is distributed in the hope that it will be useful,
2107+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2108+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2109+// GNU General Public License for more details.
2110+
2111+// You should have received a copy of the GNU General Public License along
2112+// with this library; see the file COPYING. If not, write to the Free
2113+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2114+// USA.
2115+
2116+// As a special exception, you may use this file as part of a free software
2117+// library without restriction. Specifically, if other files instantiate
2118+// templates or use macros or inline functions from this file, or you compile
2119+// this file and link it with other files to produce an executable, this
2120+// file does not by itself cause the resulting executable to be covered by
2121+// the GNU General Public License. This exception does not however
2122+// invalidate any other reasons why the executable file might be covered by
2123+// the GNU General Public License.
2124+
2125+//
2126+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2127+//
2128+
2129+// Written by Benjamin Kosnik <bkoz@redhat.com>
2130+
2131+#define _LIBC
2132+#include <locale>
2133+#undef _LIBC
2134+#include <bits/c++locale_internal.h>
2135+
2136+#ifdef __UCLIBC_MJN3_ONLY__
2137+#warning tailor for stub locale support
2138+#endif
2139+#ifndef __UCLIBC_HAS_XLOCALE__
2140+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2141+#endif
2142+
2143+namespace std
2144+{
2145+ template<>
2146+ void
2147+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2148+ {
2149+ if (!_M_data)
2150+ _M_data = new __numpunct_cache<char>;
2151+
2152+ if (!__cloc)
2153+ {
2154+ // "C" locale
2155+ _M_data->_M_grouping = "";
2156+ _M_data->_M_grouping_size = 0;
2157+ _M_data->_M_use_grouping = false;
2158+
2159+ _M_data->_M_decimal_point = '.';
2160+ _M_data->_M_thousands_sep = ',';
2161+
2162+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2163+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2164+
2165+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2166+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2167+ }
2168+ else
2169+ {
2170+ // Named locale.
2171+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2172+ __cloc));
2173+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2174+ __cloc));
2175+
2176+ // Check for NULL, which implies no grouping.
2177+ if (_M_data->_M_thousands_sep == '\0')
2178+ _M_data->_M_grouping = "";
2179+ else
2180+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2181+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2182+ }
2183+
2184+ // NB: There is no way to extact this info from posix locales.
2185+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2186+ _M_data->_M_truename = "true";
2187+ _M_data->_M_truename_size = strlen(_M_data->_M_truename);
2188+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2189+ _M_data->_M_falsename = "false";
2190+ _M_data->_M_falsename_size = strlen(_M_data->_M_falsename);
2191+ }
2192+
2193+ template<>
2194+ numpunct<char>::~numpunct()
2195+ { delete _M_data; }
2196+
2197+#ifdef _GLIBCXX_USE_WCHAR_T
2198+ template<>
2199+ void
2200+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2201+ {
2202+ if (!_M_data)
2203+ _M_data = new __numpunct_cache<wchar_t>;
2204+
2205+ if (!__cloc)
2206+ {
2207+ // "C" locale
2208+ _M_data->_M_grouping = "";
2209+ _M_data->_M_grouping_size = 0;
2210+ _M_data->_M_use_grouping = false;
2211+
2212+ _M_data->_M_decimal_point = L'.';
2213+ _M_data->_M_thousands_sep = L',';
2214+
2215+#ifdef __UCLIBC_HAS_XLOCALE__
2216+ __c_locale __old = __uselocale(_S_get_c_locale());
2217+#endif
2218+ // Use ctype::widen code without the facet...
2219+ unsigned char uc;
2220+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2221+ {
2222+ uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]);
2223+ _M_data->_M_atoms_out[__i] = btowc(uc);
2224+ }
2225+
2226+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2227+ {
2228+ uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__j]);
2229+ _M_data->_M_atoms_in[__j] = btowc(uc);
2230+ }
2231+#ifdef __UCLIBC_HAS_XLOCALE__
2232+ __uselocale(__old);
2233+#endif
2234+ }
2235+ else
2236+ {
2237+ // Named locale.
2238+#ifdef __UCLIBC_MJN3_ONLY__
2239+#warning fix this
2240+#endif
2241+#ifdef __UCLIBC__
2242+# ifdef __UCLIBC_HAS_XLOCALE__
2243+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2244+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2245+# else
2246+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2247+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2248+# endif
2249+#else
2250+ union __s_and_w { const char *__s; unsigned int __w; } __u;
2251+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2252+ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
2253+
2254+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2255+ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
2256+#endif
2257+
2258+ if (_M_data->_M_thousands_sep == L'\0')
2259+ _M_data->_M_grouping = "";
2260+ else
2261+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2262+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2263+ }
2264+
2265+ // NB: There is no way to extact this info from posix locales.
2266+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2267+ _M_data->_M_truename = L"true";
2268+ _M_data->_M_truename_size = wcslen(_M_data->_M_truename);
2269+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2270+ _M_data->_M_falsename = L"false";
2271+ _M_data->_M_falsename_size = wcslen(_M_data->_M_falsename);
2272+ }
2273+
2274+ template<>
2275+ numpunct<wchar_t>::~numpunct()
2276+ { delete _M_data; }
2277+ #endif
2278+}
2279diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.cc
2280--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600
2281+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2004-09-10 10:48:00.000000000 -0500
2282@@ -0,0 +1,356 @@
2283+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2284+
2285+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2286+//
2287+// This file is part of the GNU ISO C++ Library. This library is free
2288+// software; you can redistribute it and/or modify it under the
2289+// terms of the GNU General Public License as published by the
2290+// Free Software Foundation; either version 2, or (at your option)
2291+// any later version.
2292+
2293+// This library is distributed in the hope that it will be useful,
2294+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2295+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2296+// GNU General Public License for more details.
2297+
2298+// You should have received a copy of the GNU General Public License along
2299+// with this library; see the file COPYING. If not, write to the Free
2300+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2301+// USA.
2302+
2303+// As a special exception, you may use this file as part of a free software
2304+// library without restriction. Specifically, if other files instantiate
2305+// templates or use macros or inline functions from this file, or you compile
2306+// this file and link it with other files to produce an executable, this
2307+// file does not by itself cause the resulting executable to be covered by
2308+// the GNU General Public License. This exception does not however
2309+// invalidate any other reasons why the executable file might be covered by
2310+// the GNU General Public License.
2311+
2312+//
2313+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2314+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2315+//
2316+
2317+// Written by Benjamin Kosnik <bkoz@redhat.com>
2318+
2319+#include <locale>
2320+#include <bits/c++locale_internal.h>
2321+
2322+#ifdef __UCLIBC_MJN3_ONLY__
2323+#warning tailor for stub locale support
2324+#endif
2325+#ifndef __UCLIBC_HAS_XLOCALE__
2326+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2327+#endif
2328+
2329+namespace std
2330+{
2331+ template<>
2332+ void
2333+ __timepunct<char>::
2334+ _M_put(char* __s, size_t __maxlen, const char* __format,
2335+ const tm* __tm) const
2336+ {
2337+#ifdef __UCLIBC_HAS_XLOCALE__
2338+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2339+ _M_c_locale_timepunct);
2340+#else
2341+ char* __old = strdup(setlocale(LC_ALL, NULL));
2342+ setlocale(LC_ALL, _M_name_timepunct);
2343+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2344+ setlocale(LC_ALL, __old);
2345+ free(__old);
2346+#endif
2347+ // Make sure __s is null terminated.
2348+ if (__len == 0)
2349+ __s[0] = '\0';
2350+ }
2351+
2352+ template<>
2353+ void
2354+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2355+ {
2356+ if (!_M_data)
2357+ _M_data = new __timepunct_cache<char>;
2358+
2359+ if (!__cloc)
2360+ {
2361+ // "C" locale
2362+ _M_c_locale_timepunct = _S_get_c_locale();
2363+
2364+ _M_data->_M_date_format = "%m/%d/%y";
2365+ _M_data->_M_date_era_format = "%m/%d/%y";
2366+ _M_data->_M_time_format = "%H:%M:%S";
2367+ _M_data->_M_time_era_format = "%H:%M:%S";
2368+ _M_data->_M_date_time_format = "";
2369+ _M_data->_M_date_time_era_format = "";
2370+ _M_data->_M_am = "AM";
2371+ _M_data->_M_pm = "PM";
2372+ _M_data->_M_am_pm_format = "";
2373+
2374+ // Day names, starting with "C"'s Sunday.
2375+ _M_data->_M_day1 = "Sunday";
2376+ _M_data->_M_day2 = "Monday";
2377+ _M_data->_M_day3 = "Tuesday";
2378+ _M_data->_M_day4 = "Wednesday";
2379+ _M_data->_M_day5 = "Thursday";
2380+ _M_data->_M_day6 = "Friday";
2381+ _M_data->_M_day7 = "Saturday";
2382+
2383+ // Abbreviated day names, starting with "C"'s Sun.
2384+ _M_data->_M_aday1 = "Sun";
2385+ _M_data->_M_aday2 = "Mon";
2386+ _M_data->_M_aday3 = "Tue";
2387+ _M_data->_M_aday4 = "Wed";
2388+ _M_data->_M_aday5 = "Thu";
2389+ _M_data->_M_aday6 = "Fri";
2390+ _M_data->_M_aday7 = "Sat";
2391+
2392+ // Month names, starting with "C"'s January.
2393+ _M_data->_M_month01 = "January";
2394+ _M_data->_M_month02 = "February";
2395+ _M_data->_M_month03 = "March";
2396+ _M_data->_M_month04 = "April";
2397+ _M_data->_M_month05 = "May";
2398+ _M_data->_M_month06 = "June";
2399+ _M_data->_M_month07 = "July";
2400+ _M_data->_M_month08 = "August";
2401+ _M_data->_M_month09 = "September";
2402+ _M_data->_M_month10 = "October";
2403+ _M_data->_M_month11 = "November";
2404+ _M_data->_M_month12 = "December";
2405+
2406+ // Abbreviated month names, starting with "C"'s Jan.
2407+ _M_data->_M_amonth01 = "Jan";
2408+ _M_data->_M_amonth02 = "Feb";
2409+ _M_data->_M_amonth03 = "Mar";
2410+ _M_data->_M_amonth04 = "Apr";
2411+ _M_data->_M_amonth05 = "May";
2412+ _M_data->_M_amonth06 = "Jun";
2413+ _M_data->_M_amonth07 = "Jul";
2414+ _M_data->_M_amonth08 = "Aug";
2415+ _M_data->_M_amonth09 = "Sep";
2416+ _M_data->_M_amonth10 = "Oct";
2417+ _M_data->_M_amonth11 = "Nov";
2418+ _M_data->_M_amonth12 = "Dec";
2419+ }
2420+ else
2421+ {
2422+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2423+
2424+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2425+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2426+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2427+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2428+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2429+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc);
2430+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2431+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2432+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2433+
2434+ // Day names, starting with "C"'s Sunday.
2435+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2436+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2437+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2438+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2439+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2440+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2441+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2442+
2443+ // Abbreviated day names, starting with "C"'s Sun.
2444+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2445+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2446+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2447+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2448+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2449+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2450+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2451+
2452+ // Month names, starting with "C"'s January.
2453+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2454+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2455+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2456+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2457+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2458+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2459+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2460+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2461+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2462+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2463+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2464+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2465+
2466+ // Abbreviated month names, starting with "C"'s Jan.
2467+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2468+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2469+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2470+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2471+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2472+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2473+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2474+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2475+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2476+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2477+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2478+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2479+ }
2480+ }
2481+
2482+#ifdef _GLIBCXX_USE_WCHAR_T
2483+ template<>
2484+ void
2485+ __timepunct<wchar_t>::
2486+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2487+ const tm* __tm) const
2488+ {
2489+#ifdef __UCLIBC_HAS_XLOCALE__
2490+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2491+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2492+ _M_c_locale_timepunct);
2493+#else
2494+ char* __old = strdup(setlocale(LC_ALL, NULL));
2495+ setlocale(LC_ALL, _M_name_timepunct);
2496+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2497+ setlocale(LC_ALL, __old);
2498+ free(__old);
2499+#endif
2500+ // Make sure __s is null terminated.
2501+ if (__len == 0)
2502+ __s[0] = L'\0';
2503+ }
2504+
2505+ template<>
2506+ void
2507+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2508+ {
2509+ if (!_M_data)
2510+ _M_data = new __timepunct_cache<wchar_t>;
2511+
2512+#warning wide time stuff
2513+// if (!__cloc)
2514+ {
2515+ // "C" locale
2516+ _M_c_locale_timepunct = _S_get_c_locale();
2517+
2518+ _M_data->_M_date_format = L"%m/%d/%y";
2519+ _M_data->_M_date_era_format = L"%m/%d/%y";
2520+ _M_data->_M_time_format = L"%H:%M:%S";
2521+ _M_data->_M_time_era_format = L"%H:%M:%S";
2522+ _M_data->_M_date_time_format = L"";
2523+ _M_data->_M_date_time_era_format = L"";
2524+ _M_data->_M_am = L"AM";
2525+ _M_data->_M_pm = L"PM";
2526+ _M_data->_M_am_pm_format = L"";
2527+
2528+ // Day names, starting with "C"'s Sunday.
2529+ _M_data->_M_day1 = L"Sunday";
2530+ _M_data->_M_day2 = L"Monday";
2531+ _M_data->_M_day3 = L"Tuesday";
2532+ _M_data->_M_day4 = L"Wednesday";
2533+ _M_data->_M_day5 = L"Thursday";
2534+ _M_data->_M_day6 = L"Friday";
2535+ _M_data->_M_day7 = L"Saturday";
2536+
2537+ // Abbreviated day names, starting with "C"'s Sun.
2538+ _M_data->_M_aday1 = L"Sun";
2539+ _M_data->_M_aday2 = L"Mon";
2540+ _M_data->_M_aday3 = L"Tue";
2541+ _M_data->_M_aday4 = L"Wed";
2542+ _M_data->_M_aday5 = L"Thu";
2543+ _M_data->_M_aday6 = L"Fri";
2544+ _M_data->_M_aday7 = L"Sat";
2545+
2546+ // Month names, starting with "C"'s January.
2547+ _M_data->_M_month01 = L"January";
2548+ _M_data->_M_month02 = L"February";
2549+ _M_data->_M_month03 = L"March";
2550+ _M_data->_M_month04 = L"April";
2551+ _M_data->_M_month05 = L"May";
2552+ _M_data->_M_month06 = L"June";
2553+ _M_data->_M_month07 = L"July";
2554+ _M_data->_M_month08 = L"August";
2555+ _M_data->_M_month09 = L"September";
2556+ _M_data->_M_month10 = L"October";
2557+ _M_data->_M_month11 = L"November";
2558+ _M_data->_M_month12 = L"December";
2559+
2560+ // Abbreviated month names, starting with "C"'s Jan.
2561+ _M_data->_M_amonth01 = L"Jan";
2562+ _M_data->_M_amonth02 = L"Feb";
2563+ _M_data->_M_amonth03 = L"Mar";
2564+ _M_data->_M_amonth04 = L"Apr";
2565+ _M_data->_M_amonth05 = L"May";
2566+ _M_data->_M_amonth06 = L"Jun";
2567+ _M_data->_M_amonth07 = L"Jul";
2568+ _M_data->_M_amonth08 = L"Aug";
2569+ _M_data->_M_amonth09 = L"Sep";
2570+ _M_data->_M_amonth10 = L"Oct";
2571+ _M_data->_M_amonth11 = L"Nov";
2572+ _M_data->_M_amonth12 = L"Dec";
2573+ }
2574+#if 0
2575+ else
2576+ {
2577+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2578+
2579+ _M_data->_M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc));
2580+ _M_data->_M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc));
2581+ _M_data->_M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc));
2582+ _M_data->_M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc));
2583+ _M_data->_M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc));
2584+ _M_data->_M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc));
2585+ _M_data->_M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc));
2586+ _M_data->_M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc));
2587+ _M_data->_M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc));
2588+
2589+ // Day names, starting with "C"'s Sunday.
2590+ _M_data->_M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc));
2591+ _M_data->_M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc));
2592+ _M_data->_M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc));
2593+ _M_data->_M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc));
2594+ _M_data->_M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc));
2595+ _M_data->_M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc));
2596+ _M_data->_M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc));
2597+
2598+ // Abbreviated day names, starting with "C"'s Sun.
2599+ _M_data->_M_aday1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc));
2600+ _M_data->_M_aday2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc));
2601+ _M_data->_M_aday3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc));
2602+ _M_data->_M_aday4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc));
2603+ _M_data->_M_aday5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc));
2604+ _M_data->_M_aday6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc));
2605+ _M_data->_M_aday7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc));
2606+
2607+ // Month names, starting with "C"'s January.
2608+ _M_data->_M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc));
2609+ _M_data->_M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc));
2610+ _M_data->_M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc));
2611+ _M_data->_M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc));
2612+ _M_data->_M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc));
2613+ _M_data->_M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc));
2614+ _M_data->_M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc));
2615+ _M_data->_M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc));
2616+ _M_data->_M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc));
2617+ _M_data->_M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc));
2618+ _M_data->_M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc));
2619+ _M_data->_M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc));
2620+
2621+ // Abbreviated month names, starting with "C"'s Jan.
2622+ _M_data->_M_amonth01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc));
2623+ _M_data->_M_amonth02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc));
2624+ _M_data->_M_amonth03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc));
2625+ _M_data->_M_amonth04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc));
2626+ _M_data->_M_amonth05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc));
2627+ _M_data->_M_amonth06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc));
2628+ _M_data->_M_amonth07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc));
2629+ _M_data->_M_amonth08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc));
2630+ _M_data->_M_amonth09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc));
2631+ _M_data->_M_amonth10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc));
2632+ _M_data->_M_amonth11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc));
2633+ _M_data->_M_amonth12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc));
2634+ }
2635+#endif // 0
2636+ }
2637+#endif
2638+}
2639diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.h
2640--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600
2641+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2004-09-10 10:47:40.000000000 -0500
2642@@ -0,0 +1,68 @@
2643+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2644+
2645+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2646+//
2647+// This file is part of the GNU ISO C++ Library. This library is free
2648+// software; you can redistribute it and/or modify it under the
2649+// terms of the GNU General Public License as published by the
2650+// Free Software Foundation; either version 2, or (at your option)
2651+// any later version.
2652+
2653+// This library is distributed in the hope that it will be useful,
2654+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2655+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2656+// GNU General Public License for more details.
2657+
2658+// You should have received a copy of the GNU General Public License along
2659+// with this library; see the file COPYING. If not, write to the Free
2660+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2661+// USA.
2662+
2663+// As a special exception, you may use this file as part of a free software
2664+// library without restriction. Specifically, if other files instantiate
2665+// templates or use macros or inline functions from this file, or you compile
2666+// this file and link it with other files to produce an executable, this
2667+// file does not by itself cause the resulting executable to be covered by
2668+// the GNU General Public License. This exception does not however
2669+// invalidate any other reasons why the executable file might be covered by
2670+// the GNU General Public License.
2671+
2672+//
2673+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2674+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2675+//
2676+
2677+// Written by Benjamin Kosnik <bkoz@redhat.com>
2678+
2679+ template<typename _CharT>
2680+ __timepunct<_CharT>::__timepunct(size_t __refs)
2681+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2682+ _M_name_timepunct(_S_get_c_name())
2683+ { _M_initialize_timepunct(); }
2684+
2685+ template<typename _CharT>
2686+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2687+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2688+ _M_name_timepunct(_S_get_c_name())
2689+ { _M_initialize_timepunct(); }
2690+
2691+ template<typename _CharT>
2692+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2693+ size_t __refs)
2694+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2695+ _M_name_timepunct(__s)
2696+ {
2697+ char* __tmp = new char[std::strlen(__s) + 1];
2698+ std::strcpy(__tmp, __s);
2699+ _M_name_timepunct = __tmp;
2700+ _M_initialize_timepunct(__cloc);
2701+ }
2702+
2703+ template<typename _CharT>
2704+ __timepunct<_CharT>::~__timepunct()
2705+ {
2706+ if (_M_name_timepunct != _S_get_c_name())
2707+ delete [] _M_name_timepunct;
2708+ delete _M_data;
2709+ _S_destroy_c_locale(_M_c_locale_timepunct);
2710+ }
2711diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_base.h
2712--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600
2713+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_base.h 2004-09-10 10:47:40.000000000 -0500
2714@@ -0,0 +1,58 @@
2715+// Locale support -*- C++ -*-
2716+
2717+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
2718+// Free Software Foundation, Inc.
2719+//
2720+// This file is part of the GNU ISO C++ Library. This library is free
2721+// software; you can redistribute it and/or modify it under the
2722+// terms of the GNU General Public License as published by the
2723+// Free Software Foundation; either version 2, or (at your option)
2724+// any later version.
2725+
2726+// This library is distributed in the hope that it will be useful,
2727+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2728+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2729+// GNU General Public License for more details.
2730+
2731+// You should have received a copy of the GNU General Public License along
2732+// with this library; see the file COPYING. If not, write to the Free
2733+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2734+// USA.
2735+
2736+// As a special exception, you may use this file as part of a free software
2737+// library without restriction. Specifically, if other files instantiate
2738+// templates or use macros or inline functions from this file, or you compile
2739+// this file and link it with other files to produce an executable, this
2740+// file does not by itself cause the resulting executable to be covered by
2741+// the GNU General Public License. This exception does not however
2742+// invalidate any other reasons why the executable file might be covered by
2743+// the GNU General Public License.
2744+
2745+//
2746+// ISO C++ 14882: 22.1 Locales
2747+//
2748+
2749+// Information as gleaned from /usr/include/ctype.h
2750+
2751+ struct ctype_base
2752+ {
2753+ // Note: In uClibc, the following two types depend on configuration.
2754+
2755+ // Non-standard typedefs.
2756+ typedef const __ctype_touplow_t* __to_type;
2757+
2758+ // NB: Offsets into ctype<char>::_M_table force a particular size
2759+ // on the mask type. Because of this, we don't use an enum.
2760+ typedef __ctype_mask_t mask;
2761+ static const mask upper = _ISupper;
2762+ static const mask lower = _ISlower;
2763+ static const mask alpha = _ISalpha;
2764+ static const mask digit = _ISdigit;
2765+ static const mask xdigit = _ISxdigit;
2766+ static const mask space = _ISspace;
2767+ static const mask print = _ISprint;
2768+ static const mask graph = _ISalpha | _ISdigit | _ISpunct;
2769+ static const mask cntrl = _IScntrl;
2770+ static const mask punct = _ISpunct;
2771+ static const mask alnum = _ISalpha | _ISdigit;
2772+ };
2773diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_inline.h
2774--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
2775+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 2004-09-10 10:47:40.000000000 -0500
2776@@ -0,0 +1,69 @@
2777+// Locale support -*- C++ -*-
2778+
2779+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2780+//
2781+// This file is part of the GNU ISO C++ Library. This library is free
2782+// software; you can redistribute it and/or modify it under the
2783+// terms of the GNU General Public License as published by the
2784+// Free Software Foundation; either version 2, or (at your option)
2785+// any later version.
2786+
2787+// This library is distributed in the hope that it will be useful,
2788+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2789+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2790+// GNU General Public License for more details.
2791+
2792+// You should have received a copy of the GNU General Public License along
2793+// with this library; see the file COPYING. If not, write to the Free
2794+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2795+// USA.
2796+
2797+// As a special exception, you may use this file as part of a free software
2798+// library without restriction. Specifically, if other files instantiate
2799+// templates or use macros or inline functions from this file, or you compile
2800+// this file and link it with other files to produce an executable, this
2801+// file does not by itself cause the resulting executable to be covered by
2802+// the GNU General Public License. This exception does not however
2803+// invalidate any other reasons why the executable file might be covered by
2804+// the GNU General Public License.
2805+
2806+//
2807+// ISO C++ 14882: 22.1 Locales
2808+//
2809+
2810+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2811+// functions go in ctype.cc
2812+
2813+ bool
2814+ ctype<char>::
2815+ is(mask __m, char __c) const
2816+ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2817+
2818+ const char*
2819+ ctype<char>::
2820+ is(const char* __low, const char* __high, mask* __vec) const
2821+ {
2822+ while (__low < __high)
2823+ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2824+ return __high;
2825+ }
2826+
2827+ const char*
2828+ ctype<char>::
2829+ scan_is(mask __m, const char* __low, const char* __high) const
2830+ {
2831+ while (__low < __high
2832+ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2833+ ++__low;
2834+ return __low;
2835+ }
2836+
2837+ const char*
2838+ ctype<char>::
2839+ scan_not(mask __m, const char* __low, const char* __high) const
2840+ {
2841+ while (__low < __high
2842+ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2843+ ++__low;
2844+ return __low;
2845+ }
2846diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2847--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600
2848+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2004-09-10 10:47:40.000000000 -0500
2849@@ -0,0 +1,92 @@
2850+// Locale support -*- C++ -*-
2851+
2852+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
2853+// Free Software Foundation, Inc.
2854+//
2855+// This file is part of the GNU ISO C++ Library. This library is free
2856+// software; you can redistribute it and/or modify it under the
2857+// terms of the GNU General Public License as published by the
2858+// Free Software Foundation; either version 2, or (at your option)
2859+// any later version.
2860+
2861+// This library is distributed in the hope that it will be useful,
2862+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2863+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2864+// GNU General Public License for more details.
2865+
2866+// You should have received a copy of the GNU General Public License along
2867+// with this library; see the file COPYING. If not, write to the Free
2868+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2869+// USA.
2870+
2871+// As a special exception, you may use this file as part of a free software
2872+// library without restriction. Specifically, if other files instantiate
2873+// templates or use macros or inline functions from this file, or you compile
2874+// this file and link it with other files to produce an executable, this
2875+// file does not by itself cause the resulting executable to be covered by
2876+// the GNU General Public License. This exception does not however
2877+// invalidate any other reasons why the executable file might be covered by
2878+// the GNU General Public License.
2879+
2880+//
2881+// ISO C++ 14882: 22.1 Locales
2882+//
2883+
2884+// Information as gleaned from /usr/include/ctype.h
2885+
2886+ const ctype_base::mask*
2887+ ctype<char>::classic_table() throw()
2888+ { return __C_ctype_b; }
2889+
2890+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
2891+ size_t __refs)
2892+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2893+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2894+ {
2895+ _M_toupper = __C_ctype_toupper;
2896+ _M_tolower = __C_ctype_tolower;
2897+ _M_table = __table ? __table : __C_ctype_b;
2898+ memset(_M_widen, 0, sizeof(_M_widen));
2899+ memset(_M_narrow, 0, sizeof(_M_narrow));
2900+ }
2901+
2902+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
2903+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2904+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2905+ {
2906+ _M_toupper = __C_ctype_toupper;
2907+ _M_tolower = __C_ctype_tolower;
2908+ _M_table = __table ? __table : __C_ctype_b;
2909+ memset(_M_widen, 0, sizeof(_M_widen));
2910+ memset(_M_narrow, 0, sizeof(_M_narrow));
2911+ }
2912+
2913+ char
2914+ ctype<char>::do_toupper(char __c) const
2915+ { return _M_toupper[static_cast<unsigned char>(__c)]; }
2916+
2917+ const char*
2918+ ctype<char>::do_toupper(char* __low, const char* __high) const
2919+ {
2920+ while (__low < __high)
2921+ {
2922+ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2923+ ++__low;
2924+ }
2925+ return __high;
2926+ }
2927+
2928+ char
2929+ ctype<char>::do_tolower(char __c) const
2930+ { return _M_tolower[static_cast<unsigned char>(__c)]; }
2931+
2932+ const char*
2933+ ctype<char>::do_tolower(char* __low, const char* __high) const
2934+ {
2935+ while (__low < __high)
2936+ {
2937+ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2938+ ++__low;
2939+ }
2940+ return __high;
2941+ }
2942diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/os_defines.h
2943--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600
2944+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/os_defines.h 2004-09-10 10:47:40.000000000 -0500
2945@@ -0,0 +1,44 @@
2946+// Specific definitions for GNU/Linux -*- C++ -*-
2947+
2948+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2949+//
2950+// This file is part of the GNU ISO C++ Library. This library is free
2951+// software; you can redistribute it and/or modify it under the
2952+// terms of the GNU General Public License as published by the
2953+// Free Software Foundation; either version 2, or (at your option)
2954+// any later version.
2955+
2956+// This library is distributed in the hope that it will be useful,
2957+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2958+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2959+// GNU General Public License for more details.
2960+
2961+// You should have received a copy of the GNU General Public License along
2962+// with this library; see the file COPYING. If not, write to the Free
2963+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2964+// USA.
2965+
2966+// As a special exception, you may use this file as part of a free software
2967+// library without restriction. Specifically, if other files instantiate
2968+// templates or use macros or inline functions from this file, or you compile
2969+// this file and link it with other files to produce an executable, this
2970+// file does not by itself cause the resulting executable to be covered by
2971+// the GNU General Public License. This exception does not however
2972+// invalidate any other reasons why the executable file might be covered by
2973+// the GNU General Public License.
2974+
2975+#ifndef _GLIBCXX_OS_DEFINES
2976+#define _GLIBCXX_OS_DEFINES 1
2977+
2978+// System-specific #define, typedefs, corrections, etc, go here. This
2979+// file will come before all others.
2980+
2981+// This keeps isanum, et al from being propagated as macros.
2982+#define __NO_CTYPE 1
2983+
2984+#include <features.h>
2985+
2986+// We must not see the optimized string functions GNU libc defines.
2987+#define __NO_STRING_INLINES
2988+
2989+#endif
2990diff -urN gcc-3.4.2-dist/libstdc++-v3/configure gcc-3.4.2/libstdc++-v3/configure
2991--- gcc-3.4.2-dist/libstdc++-v3/configure 2004-08-13 15:44:04.000000000 -0500
2992+++ gcc-3.4.2/libstdc++-v3/configure 2004-09-10 10:47:40.000000000 -0500
2993@@ -3878,6 +3878,11 @@
2994 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
2995 ;;
2996
2997+linux-uclibc*)
2998+ lt_cv_deplibs_check_method=pass_all
2999+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
3000+ ;;
3001+
3002 netbsd*)
3003 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
3004 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
3005@@ -5545,6 +5550,9 @@
3006 # Default to "generic".
3007 if test $enable_clocale_flag = auto; then
3008 case x${target_os} in
3009+ xlinux-uclibc*)
3010+ enable_clocale_flag=uclibc
3011+ ;;
3012 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
3013 cat >conftest.$ac_ext <<_ACEOF
3014 #line $LINENO "configure"
3015@@ -5759,6 +5767,77 @@
3016 CTIME_CC=config/locale/generic/time_members.cc
3017 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3018 ;;
3019+ uclibc)
3020+ echo "$as_me:$LINENO: result: uclibc" >&5
3021+echo "${ECHO_T}uclibc" >&6
3022+
3023+ # Declare intention to use gettext, and add support for specific
3024+ # languages.
3025+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3026+ ALL_LINGUAS="de fr"
3027+
3028+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3029+ # Extract the first word of "msgfmt", so it can be a program name with args.
3030+set dummy msgfmt; ac_word=$2
3031+echo "$as_me:$LINENO: checking for $ac_word" >&5
3032+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3033+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3034+ echo $ECHO_N "(cached) $ECHO_C" >&6
3035+else
3036+ if test -n "$check_msgfmt"; then
3037+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3038+else
3039+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3040+for as_dir in $PATH
3041+do
3042+ IFS=$as_save_IFS
3043+ test -z "$as_dir" && as_dir=.
3044+ for ac_exec_ext in '' $ac_executable_extensions; do
3045+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3046+ ac_cv_prog_check_msgfmt="yes"
3047+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3048+ break 2
3049+ fi
3050+done
3051+done
3052+
3053+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3054+fi
3055+fi
3056+check_msgfmt=$ac_cv_prog_check_msgfmt
3057+if test -n "$check_msgfmt"; then
3058+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3059+echo "${ECHO_T}$check_msgfmt" >&6
3060+else
3061+ echo "$as_me:$LINENO: result: no" >&5
3062+echo "${ECHO_T}no" >&6
3063+fi
3064+
3065+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3066+ USE_NLS=yes
3067+ fi
3068+ # Export the build objects.
3069+ for ling in $ALL_LINGUAS; do \
3070+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3071+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3072+ done
3073+
3074+
3075+
3076+ CLOCALE_H=config/locale/uclibc/c_locale.h
3077+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3078+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
3079+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3080+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3081+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3082+ CMESSAGES_H=config/locale/uclibc/messages_members.h
3083+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3084+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3085+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3086+ CTIME_H=config/locale/uclibc/time_members.h
3087+ CTIME_CC=config/locale/uclibc/time_members.cc
3088+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3089+ ;;
3090 esac
3091
3092 # This is where the testsuite looks for locale catalogs, using the
3093diff -urN gcc-3.4.2-dist/libstdc++-v3/configure.host gcc-3.4.2/libstdc++-v3/configure.host
3094--- gcc-3.4.2-dist/libstdc++-v3/configure.host 2004-08-27 14:52:30.000000000 -0500
3095+++ gcc-3.4.2/libstdc++-v3/configure.host 2004-09-10 10:47:40.000000000 -0500
3096@@ -217,6 +217,12 @@
3097 ;;
3098 esac
3099
3100+# Override for uClibc since linux-uclibc gets mishandled above.
3101+case "${host_os}" in
3102+ *-uclibc*)
3103+ os_include_dir="os/uclibc"
3104+ ;;
3105+esac
3106
3107 # Set any OS-dependent and CPU-dependent bits.
3108 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
3109diff -urN gcc-3.4.2-dist/libstdc++-v3/crossconfig.m4 gcc-3.4.2/libstdc++-v3/crossconfig.m4
3110--- gcc-3.4.2-dist/libstdc++-v3/crossconfig.m4 2004-07-06 20:23:49.000000000 -0500
3111+++ gcc-3.4.2/libstdc++-v3/crossconfig.m4 2004-09-10 10:47:40.000000000 -0500
3112@@ -138,6 +138,99 @@
3113 ;;
3114 esac
3115 ;;
3116+ *-uclibc*)
3117+# Temporary hack until we implement the float versions of the libm funcs
3118+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3119+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
3120+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3121+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
3122+ AC_SUBST(SECTION_FLAGS)
3123+ GLIBCXX_CHECK_LINKER_FEATURES
3124+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3125+ GLIBCXX_CHECK_WCHAR_T_SUPPORT
3126+
3127+ # For LFS.
3128+ AC_DEFINE(HAVE_INT64_T)
3129+ case "$target" in
3130+ *-uclinux*)
3131+ # Don't enable LFS with uClinux
3132+ ;;
3133+ *)
3134+ AC_DEFINE(_GLIBCXX_USE_LFS)
3135+ esac
3136+
3137+ # For showmanyc_helper().
3138+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3139+ GLIBCXX_CHECK_POLL
3140+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3141+
3142+ # For xsputn_2().
3143+ AC_CHECK_HEADERS(sys/uio.h)
3144+ GLIBCXX_CHECK_WRITEV
3145+
3146+# AC_DEFINE(HAVE_ACOSF)
3147+# AC_DEFINE(HAVE_ASINF)
3148+# AC_DEFINE(HAVE_ATANF)
3149+# AC_DEFINE(HAVE_ATAN2F)
3150+ AC_DEFINE(HAVE_CEILF)
3151+ AC_DEFINE(HAVE_COPYSIGN)
3152+# AC_DEFINE(HAVE_COPYSIGNF)
3153+# AC_DEFINE(HAVE_COSF)
3154+# AC_DEFINE(HAVE_COSHF)
3155+# AC_DEFINE(HAVE_EXPF)
3156+# AC_DEFINE(HAVE_FABSF)
3157+ AC_DEFINE(HAVE_FINITE)
3158+ AC_DEFINE(HAVE_FINITEF)
3159+ AC_DEFINE(HAVE_FLOORF)
3160+# AC_DEFINE(HAVE_FMODF)
3161+# AC_DEFINE(HAVE_FREXPF)
3162+ AC_DEFINE(HAVE_HYPOT)
3163+# AC_DEFINE(HAVE_HYPOTF)
3164+ AC_DEFINE(HAVE_ISINF)
3165+ AC_DEFINE(HAVE_ISINFF)
3166+ AC_DEFINE(HAVE_ISNAN)
3167+ AC_DEFINE(HAVE_ISNANF)
3168+# AC_DEFINE(HAVE_LOGF)
3169+# AC_DEFINE(HAVE_LOG10F)
3170+# AC_DEFINE(HAVE_MODFF)
3171+# AC_DEFINE(HAVE_SINF)
3172+# AC_DEFINE(HAVE_SINHF)
3173+# AC_DEFINE(HAVE_SINCOS)
3174+# AC_DEFINE(HAVE_SINCOSF)
3175+ AC_DEFINE(HAVE_SQRTF)
3176+# AC_DEFINE(HAVE_TANF)
3177+# AC_DEFINE(HAVE_TANHF)
3178+ if test x"long_double_math_on_this_cpu" = x"yes"; then
3179+ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
3180+# AC_DEFINE(HAVE_ACOSL)
3181+# AC_DEFINE(HAVE_ASINL)
3182+# AC_DEFINE(HAVE_ATANL)
3183+# AC_DEFINE(HAVE_ATAN2L)
3184+# AC_DEFINE(HAVE_CEILL)
3185+# AC_DEFINE(HAVE_COPYSIGNL)
3186+# AC_DEFINE(HAVE_COSL)
3187+# AC_DEFINE(HAVE_COSHL)
3188+# AC_DEFINE(HAVE_EXPL)
3189+# AC_DEFINE(HAVE_FABSL)
3190+# AC_DEFINE(HAVE_FINITEL)
3191+# AC_DEFINE(HAVE_FLOORL)
3192+# AC_DEFINE(HAVE_FMODL)
3193+# AC_DEFINE(HAVE_FREXPL)
3194+# AC_DEFINE(HAVE_HYPOTL)
3195+# AC_DEFINE(HAVE_ISINFL)
3196+# AC_DEFINE(HAVE_ISNANL)
3197+# AC_DEFINE(HAVE_LOGL)
3198+# AC_DEFINE(HAVE_LOG10L)
3199+# AC_DEFINE(HAVE_MODFL)
3200+# AC_DEFINE(HAVE_POWL)
3201+# AC_DEFINE(HAVE_SINL)
3202+# AC_DEFINE(HAVE_SINHL)
3203+# AC_DEFINE(HAVE_SINCOSL)
3204+# AC_DEFINE(HAVE_SQRTL)
3205+# AC_DEFINE(HAVE_TANL)
3206+# AC_DEFINE(HAVE_TANHL)
3207+ fi
3208+ ;;
3209 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3210 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3211 machine/endian.h machine/param.h sys/machine.h sys/types.h \
3212@@ -152,7 +245,7 @@
3213 AC_DEFINE(HAVE_INT64_T)
3214 case "$target" in
3215 *-uclinux*)
3216- # Don't enable LFS with uClibc
3217+ # Don't enable LFS with uClinux
3218 ;;
3219 *)
3220 AC_DEFINE(_GLIBCXX_USE_LFS)
3221diff -urN gcc-3.4.2-dist/libstdc++-v3/include/c_compatibility/wchar.h gcc-3.4.2/libstdc++-v3/include/c_compatibility/wchar.h
3222--- gcc-3.4.2-dist/libstdc++-v3/include/c_compatibility/wchar.h 2003-12-08 21:51:45.000000000 -0600
3223+++ gcc-3.4.2/libstdc++-v3/include/c_compatibility/wchar.h 2004-09-10 10:47:40.000000000 -0500
3224@@ -101,7 +101,9 @@
3225 using std::wmemcpy;
3226 using std::wmemmove;
3227 using std::wmemset;
3228+#if _GLIBCXX_HAVE_WCSFTIME
3229 using std::wcsftime;
3230+#endif
3231
3232 #if _GLIBCXX_USE_C99
3233 using std::wcstold;
3234diff -urN gcc-3.4.2-dist/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.4.2/libstdc++-v3/include/c_std/std_cwchar.h
3235--- gcc-3.4.2-dist/libstdc++-v3/include/c_std/std_cwchar.h 2004-07-20 03:52:12.000000000 -0500
3236+++ gcc-3.4.2/libstdc++-v3/include/c_std/std_cwchar.h 2004-09-10 10:47:40.000000000 -0500
3237@@ -179,7 +179,9 @@
3238 using ::wcscoll;
3239 using ::wcscpy;
3240 using ::wcscspn;
3241+#if _GLIBCXX_HAVE_WCSFTIME
3242 using ::wcsftime;
3243+#endif
3244 using ::wcslen;
3245 using ::wcsncat;
3246 using ::wcsncmp;
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch b/meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch
deleted file mode 100644
index f2431896cf..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1--- gcc-3.3.2-old/configure.in 2003-08-09 01:57:21.000000000 -0500
2+++ gcc-3.3.2/configure.in 2004-01-15 12:46:29.000000000 -0600
3@@ -1418,6 +1418,11 @@
4 fi
5
6 FLAGS_FOR_TARGET=
7+case " $targargs " in
8+ *" --nfp "* | *" --without-float "*)
9+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -msoft-float'
10+ ;;
11+esac
12 case " $target_configdirs " in
13 *" newlib "*)
14 case " $targargs " in
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch
deleted file mode 100644
index fb317e1537..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1--- gcc-3.4.0/gcc/config/arm/arm.md.arm-ldm-peephole 2004-01-13 08:24:37.000000000 -0500
2+++ gcc-3.4.0/gcc/config/arm/arm.md 2004-04-24 18:18:04.000000000 -0400
3@@ -8810,13 +8810,16 @@
4 (set_attr "length" "4,8,8")]
5 )
6
7+; Try to convert LDR+LDR+arith into [add+]LDM+arith
8+; On XScale, LDM is always slower than two LDRs, so only do this if
9+; optimising for size.
10 (define_insn "*arith_adjacentmem"
11 [(set (match_operand:SI 0 "s_register_operand" "=r")
12 (match_operator:SI 1 "shiftable_operator"
13 [(match_operand:SI 2 "memory_operand" "m")
14 (match_operand:SI 3 "memory_operand" "m")]))
15 (clobber (match_scratch:SI 4 "=r"))]
16- "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
17+ "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])"
18 "*
19 {
20 rtx ldm[3];
21@@ -8851,6 +8854,8 @@
22 }
23 if (val1 && val2)
24 {
25+ /* This would be a loss on a Harvard core, but adjacent_mem_locations()
26+ will prevent it from happening. */
27 rtx ops[3];
28 ldm[0] = ops[0] = operands[4];
29 ops[1] = XEXP (XEXP (operands[2], 0), 0);
30--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm-peephole 2004-04-24 18:16:25.000000000 -0400
31+++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:18:04.000000000 -0400
32@@ -4593,8 +4593,11 @@
33 arith_adjacentmem pattern to output an overlong sequence. */
34 if (!const_ok_for_op (PLUS, val0) || !const_ok_for_op (PLUS, val1))
35 return 0;
36-
37- return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4);
38+
39+ /* For Harvard cores, only accept pairs where one offset is zero.
40+ See comment in load_multiple_sequence. */
41+ return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4)
42+ && (!arm_ld_sched || val0 == 0 || val1 == 0);
43 }
44 return 0;
45 }
46@@ -4838,6 +4841,11 @@
47 *load_offset = unsorted_offsets[order[0]];
48 }
49
50+ /* For XScale a two-word LDM is a performance loss, so only do this if
51+ size is more important. See comments in arm_gen_load_multiple. */
52+ if (nops == 2 && arm_tune_xscale && !optimize_size)
53+ return 0;
54+
55 if (unsorted_offsets[order[0]] == 0)
56 return 1; /* ldmia */
57
58@@ -5064,6 +5072,11 @@
59 *load_offset = unsorted_offsets[order[0]];
60 }
61
62+ /* For XScale a two-word LDM is a performance loss, so only do this if
63+ size is more important. See comments in arm_gen_load_multiple. */
64+ if (nops == 2 && arm_tune_xscale && !optimize_size)
65+ return 0;
66+
67 if (unsorted_offsets[order[0]] == 0)
68 return 1; /* stmia */
69
70--- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole 2003-07-05 01:27:22.000000000 -0400
71+++ gcc-3.4.0/gcc/genpeep.c 2004-04-24 18:18:04.000000000 -0400
72@@ -381,6 +381,7 @@
73 printf ("#include \"recog.h\"\n");
74 printf ("#include \"except.h\"\n\n");
75 printf ("#include \"function.h\"\n\n");
76+ printf ("#include \"flags.h\"\n\n");
77
78 printf ("#ifdef HAVE_peephole\n");
79 printf ("extern rtx peep_operand[];\n\n");
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch
deleted file mode 100644
index 142052fdf0..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch
+++ /dev/null
@@ -1,119 +0,0 @@
1--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm 2004-02-27 09:51:05.000000000 -0500
2+++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:16:25.000000000 -0400
3@@ -8520,6 +8520,26 @@
4 return_used_this_function = 0;
5 }
6
7+/* Return the number (counting from 0) of
8+ the least significant set bit in MASK. */
9+
10+#ifdef __GNUC__
11+inline
12+#endif
13+static int
14+number_of_first_bit_set (mask)
15+ int mask;
16+{
17+ int bit;
18+
19+ for (bit = 0;
20+ (mask & (1 << bit)) == 0;
21+ ++bit)
22+ continue;
23+
24+ return bit;
25+}
26+
27 const char *
28 arm_output_epilogue (rtx sibling)
29 {
30@@ -8753,27 +8773,47 @@
31 saved_regs_mask |= (1 << PC_REGNUM);
32 }
33
34- /* Load the registers off the stack. If we only have one register
35- to load use the LDR instruction - it is faster. */
36- if (saved_regs_mask == (1 << LR_REGNUM))
37- {
38- /* The exception handler ignores the LR, so we do
39- not really need to load it off the stack. */
40- if (eh_ofs)
41- asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
42- else
43- asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
44- }
45- else if (saved_regs_mask)
46+ if (saved_regs_mask)
47 {
48- if (saved_regs_mask & (1 << SP_REGNUM))
49- /* Note - write back to the stack register is not enabled
50- (ie "ldmfd sp!..."). We know that the stack pointer is
51- in the list of registers and if we add writeback the
52- instruction becomes UNPREDICTABLE. */
53- print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
54+ /* Load the registers off the stack. If we only have one register
55+ to load use the LDR instruction - it is faster. */
56+ if (bit_count (saved_regs_mask) == 1)
57+ {
58+ int reg = number_of_first_bit_set (saved_regs_mask);
59+
60+ switch (reg)
61+ {
62+ case SP_REGNUM:
63+ /* Mustn't use base writeback when loading SP. */
64+ asm_fprintf (f, "\tldr\t%r, [%r]\n", SP_REGNUM, SP_REGNUM);
65+ break;
66+
67+ case LR_REGNUM:
68+ if (eh_ofs)
69+ {
70+ /* The exception handler ignores the LR, so we do
71+ not really need to load it off the stack. */
72+ asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
73+ break;
74+ }
75+ /* else fall through */
76+
77+ default:
78+ asm_fprintf (f, "\tldr\t%r, [%r], #4\n", reg, SP_REGNUM);
79+ break;
80+ }
81+ }
82 else
83- print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
84+ {
85+ if (saved_regs_mask & (1 << SP_REGNUM))
86+ /* Note - write back to the stack register is not enabled
87+ (ie "ldmfd sp!..."). We know that the stack pointer is
88+ in the list of registers and if we add writeback the
89+ instruction becomes UNPREDICTABLE. */
90+ print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
91+ else
92+ print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
93+ }
94 }
95
96 if (current_function_pretend_args_size)
97@@ -11401,22 +11441,6 @@
98 }
99 }
100
101-/* Return the number (counting from 0) of
102- the least significant set bit in MASK. */
103-
104-inline static int
105-number_of_first_bit_set (int mask)
106-{
107- int bit;
108-
109- for (bit = 0;
110- (mask & (1 << bit)) == 0;
111- ++bit)
112- continue;
113-
114- return bit;
115-}
116-
117 /* Generate code to return from a thumb function.
118 If 'reg_containing_return_addr' is -1, then the return address is
119 actually on the stack, at the stack pointer. */
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch
deleted file mode 100644
index cdb20bef9b..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch
+++ /dev/null
@@ -1,9 +0,0 @@
1--- gcc-3.4.0/gcc/config/arm/linux-elf.h.arm-tune 2004-01-31 01:18:11.000000000 -0500
2+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-04-24 18:19:10.000000000 -0400
3@@ -126,3 +126,6 @@
4
5 #define LINK_GCC_C_SEQUENCE_SPEC \
6 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
7+
8+/* Tune for XScale. */
9+#define TARGET_TUNE_DEFAULT TARGET_CPU_xscale
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch
deleted file mode 100644
index c3c40dd183..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1--- gcc-3.4.0/gcc/flow.c.reverse-compare 2004-02-27 22:39:19.000000000 -0500
2+++ gcc-3.4.0/gcc/flow.c 2004-04-24 16:36:00.000000000 -0400
3@@ -1843,6 +1843,7 @@
4 regset_head diff_head;
5 regset diff = INITIALIZE_REG_SET (diff_head);
6 basic_block bb_true, bb_false;
7+ enum rtx_code reversed_code;
8 int i;
9
10 /* Identify the successor blocks. */
11@@ -1889,8 +1890,11 @@
12 if (GET_CODE (reg) == REG
13 && XEXP (cond_true, 1) == const0_rtx)
14 {
15- rtx cond_false
16- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)),
17+ rtx cond_false;
18+ reversed_code = reverse_condition (GET_CODE (cond_true));
19+ if (reversed_code == UNKNOWN)
20+ goto skip;
21+ cond_false = gen_rtx_fmt_ee (reversed_code,
22 GET_MODE (cond_true), XEXP (cond_true, 0),
23 XEXP (cond_true, 1));
24 if (GET_CODE (XEXP (set_src, 1)) == PC)
25@@ -1925,6 +1929,7 @@
26 }
27 }
28
29+ skip:
30 FREE_REG_SET (diff);
31 }
32 #endif
diff --git a/meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch
deleted file mode 100644
index 4377c2143b..0000000000
--- a/meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1--- gcc-3.4.1/libstdc++-v3/libmath/Makefile.am~ 2003-08-27 22:29:42.000000000 +0100
2+++ gcc-3.4.1/libstdc++-v3/libmath/Makefile.am 2004-07-22 16:41:45.152130128 +0100
3@@ -32,7 +32,7 @@
4
5 libmath_la_SOURCES = stubs.c
6
7-AM_CPPFLAGS = $(CANADIAN_INCLUDES)
8+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include
9
10 # Only compiling "C" sources in this directory.
11 LIBTOOL = @LIBTOOL@ --tag CC
12--- gcc-3.4.1/libstdc++-v3/fragment.am.old 2004-07-22 18:24:58.024083656 +0100
13+++ gcc-3.4.1/libstdc++-v3/fragment.am 2004-07-22 18:24:59.019932264 +0100
14@@ -18,7 +18,7 @@
15 $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
16
17 # -I/-D flags to pass when compiling.
18-AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
19+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include
20
21
22
diff --git a/meta/packages/gcc/gcc-3.4.4.inc b/meta/packages/gcc/gcc-3.4.4.inc
new file mode 100644
index 0000000000..704d9bc5c8
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4.inc
@@ -0,0 +1,24 @@
1require gcc-common.inc
2
3SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
4 file://gcc34-reverse-compare.patch;patch=1 \
5 file://gcc34-arm-ldm.patch;patch=1 \
6 file://gcc34-arm-ldm-peephole.patch;patch=1 \
7 file://gcc34-arm-tune.patch;patch=1 \
8 file://gcc-3.4.1-uclibc-100-conf.patch;patch=1 \
9 file://gcc-3.4.1-uclibc-200-locale.patch;patch=1 \
10 file://gcc-3.4.0-arm-lib1asm.patch;patch=1 \
11 file://gcc-3.4.0-arm-nolibfloat.patch;patch=1 \
12 file://gcc-3.4.0-arm-bigendian.patch;patch=1 \
13 file://gcc-3.4.0-arm-bigendian-uclibc.patch;patch=1 \
14 file://GCC3.4.0VisibilityPatch.diff;patch=1 \
15 file://15342.patch;patch=1 \
16 file://jarfix.patch;patch=1 \
17 file://always-fixincperm.patch;patch=1 \
18 file://GCOV_PREFIX_STRIP-cross-profile_3.4.patch;patch=1 \
19 file://zecke-xgcc-cpp.patch;patch=1 \
20 file://gcc4-mtune-compat.patch;patch=1"
21
22SRC_URI += "file://gcc34-configure.in.patch;patch=1"
23SRC_URI += "file://gcc34-thumb-support.patch;patch=1"
24SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 "
diff --git a/meta/packages/gcc/gcc-3.4.4/GCOV_PREFIX_STRIP-cross-profile_3.4.patch b/meta/packages/gcc/gcc-3.4.4/GCOV_PREFIX_STRIP-cross-profile_3.4.patch
new file mode 100644
index 0000000000..701a687e05
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/GCOV_PREFIX_STRIP-cross-profile_3.4.patch
@@ -0,0 +1,389 @@
12005-05-04 Grigory Zagorodnev <grigory.zagorodnev@intel.com>
2 H.J. Lu <hongjiu.lu@intel.com>
3
4
5 Cross-profiling support: relocate .gcda files when
6 running at system other than executable been built on.
7
8
9 * gcov-io.c (gcov_open): When in libgcov library
10 use given data file relocation prefix to build file name.
11 * gcov-io.h (gcov_open): Updated proto to accept
12 data file relocation prefix.
13 * libgcov.c (create_file_directory): New function.
14 (gcov_prefix): New static variable to hold data file
15 relocation prefix.
16 (gcov_version): Use relocation prefix.
17 (gcov_exit): Always try to create directory for output
18 file. Relocate filename at each use.
19 (__gcov_init): Initialize directory relocation prefix
20 if required. Strip off leading directories from
21 the initial filename.
22 * tsystem.h: include filenames.h
23 (DIR_SEPARATOR): Macro copied from system.h.
24 (DIR_SEPARATOR_2): Likewise.
25 * doc/gcov.texi (Cross-profiling): New node documenting
26 cross-profiling management.
27 * doc/invoke.texi (-fprofile-arcs): xref to cross-profiling.
28
29Grigory Zagorodnev
30Intel Corporation
31
32--- gcc-3.4/gcc/gcov-io.c.prefix 2004-02-26 13:54:47.000000000 -0800
33+++ gcc-3.4/gcc/gcov-io.c 2005-05-04 11:46:01.000000000 -0700
34@@ -55,13 +55,14 @@ static inline gcov_unsigned_t from_file
35
36 GCOV_LINKAGE int
37 #if IN_LIBGCOV
38-gcov_open (const char *name)
39+gcov_open (const char *prefix, const char *name)
40 #else
41 gcov_open (const char *name, int mode)
42 #endif
43 {
44 #if IN_LIBGCOV
45 const int mode = 0;
46+ char *tmp;
47 #endif
48 #if GCOV_LOCKED
49 struct flock s_flock;
50@@ -83,6 +84,14 @@ gcov_open (const char *name, int mode)
51 #if !IN_LIBGCOV
52 gcov_var.endian = 0;
53 #endif
54+
55+#if IN_LIBGCOV
56+ /* Build complete filename with prefix */
57+ tmp = alloca( strlen(prefix) + strlen(name) + 1);
58+ *tmp = '\0';
59+ name = strcat( strcat(tmp, prefix), name);
60+#endif
61+
62 #if GCOV_LOCKED
63 if (mode > 0)
64 fd = open (name, O_RDWR);
65--- gcc-3.4/gcc/gcov-io.h.prefix 2005-05-02 15:37:58.000000000 -0700
66+++ gcc-3.4/gcc/gcov-io.h 2005-05-04 11:46:01.000000000 -0700
67@@ -502,7 +502,7 @@ GCOV_LINKAGE struct gcov_var
68 functions for writing. Your file may become corrupted if you break
69 these invariants. */
70 #if IN_LIBGCOV
71-GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN;
72+GCOV_LINKAGE int gcov_open (const char */*prefix*/, const char */*name*/) ATTRIBUTE_HIDDEN;
73 #else
74 GCOV_LINKAGE int gcov_open (const char */*name*/, int /*direction*/);
75 GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t);
76--- gcc-3.4/gcc/libgcov.c.prefix 2004-02-26 13:54:47.000000000 -0800
77+++ gcc-3.4/gcc/libgcov.c 2005-05-04 12:01:58.000000000 -0700
78@@ -92,6 +92,70 @@ static struct gcov_info *gcov_list;
79 object file included in multiple programs. */
80 static gcov_unsigned_t gcov_crc32;
81
82+/* Directory prefix to relocate coverage data file names */
83+static char *gcov_prefix = 0;
84+
85+/* Level of dirs to strip off the initial filename to relocate */
86+static int gcov_prefix_strip = 0;
87+
88+static int
89+create_file_directory (const char *prefix, const char *filename)
90+{
91+ char *dname;
92+ char sep, *r, *s;
93+ size_t plen, flen;
94+
95+ /* Detect directory separator */
96+ s = strrchr (prefix, DIR_SEPARATOR);
97+#ifdef DIR_SEPARATOR_2
98+ if (! s)
99+ s = strrchr (prefix, DIR_SEPARATOR_2);
100+#endif
101+ if (s)
102+ sep = *s;
103+ else
104+ sep = DIR_SEPARATOR;
105+
106+ /* join prefix and filename, split path */
107+ plen = strlen(prefix);
108+ flen = strlen(filename);
109+ r = alloca(plen + flen + 1);
110+ strncpy(r, prefix, plen);
111+ strncpy(r + plen, filename, flen);
112+ r[plen + flen] = '\0';
113+ s = strrchr(r, sep);
114+ if (s)
115+ *(s + 1) = '\0';
116+
117+ if (access (r, F_OK) == 0)
118+ return 0;
119+
120+ /* Skip consecutive separators. */
121+ for (dname = r; *dname && *dname == sep; ++dname);
122+ while (1)
123+ {
124+ char *s = strchr (dname, sep);
125+ if (s == 0)
126+ break;
127+ *s = '\0';
128+ /* Try to make directory if it doesn't already exist. */
129+ if (access (r, F_OK) == -1
130+ && mkdir (r, 0755) == -1
131+ /* The directory might have been made by another process. */
132+ && errno != EEXIST)
133+ {
134+ *s = sep;
135+ fprintf (stderr, "profiling:%s:Cannot create directory\n", r);
136+ return -1;
137+ };
138+ *s = sep;
139+ /* Skip consecutive separators. */
140+ for (dname = s + 1; *dname && *dname == sep; ++dname)
141+ ;
142+ }
143+ return 0;
144+}
145+
146 static int
147 gcov_version (struct gcov_info *ptr, gcov_unsigned_t version)
148 {
149@@ -103,8 +167,8 @@ gcov_version (struct gcov_info *ptr, gco
150 GCOV_UNSIGNED2STRING (e, GCOV_VERSION);
151
152 fprintf (stderr,
153- "profiling:%s:Version mismatch - expected %.4s got %.4s\n",
154- ptr->filename, e, v);
155+ "profiling:%s%s:Version mismatch - expected %.4s got %.4s\n",
156+ gcov_prefix, ptr->filename, e, v);
157 return 0;
158 }
159 return 1;
160@@ -204,9 +268,14 @@ gcov_exit (void)
161 fi_stride &= ~(__alignof__ (struct gcov_fn_info) - 1);
162 }
163
164- if (!gcov_open (gi_ptr->filename))
165+ if (create_file_directory (gcov_prefix, gi_ptr->filename))
166 {
167- fprintf (stderr, "profiling:%s:Cannot open\n", gi_ptr->filename);
168+ fprintf (stderr, "profiling:%s%s:Skip\n", gcov_prefix, gi_ptr->filename);
169+ continue;
170+ }
171+ else if (!gcov_open (gcov_prefix, gi_ptr->filename))
172+ {
173+ fprintf (stderr, "profiling:%s%s:Cannot open\n", gcov_prefix, gi_ptr->filename);
174 continue;
175 }
176
177@@ -216,8 +285,8 @@ gcov_exit (void)
178 /* Merge data from file. */
179 if (tag != GCOV_DATA_MAGIC)
180 {
181- fprintf (stderr, "profiling:%s:Not a gcov data file\n",
182- gi_ptr->filename);
183+ fprintf (stderr, "profiling:%s%s:Not a gcov data file\n",
184+ gcov_prefix, gi_ptr->filename);
185 read_fatal:;
186 gcov_close ();
187 continue;
188@@ -250,8 +319,8 @@ gcov_exit (void)
189 || gcov_read_unsigned () != fi_ptr->checksum)
190 {
191 read_mismatch:;
192- fprintf (stderr, "profiling:%s:Merge mismatch for %s\n",
193- gi_ptr->filename,
194+ fprintf (stderr, "profiling:%s%s:Merge mismatch for %s\n",
195+ gcov_prefix, gi_ptr->filename,
196 f_ix + 1 ? "function" : "summaries");
197 goto read_fatal;
198 }
199@@ -309,8 +378,8 @@ gcov_exit (void)
200 if (!gcov_is_eof ())
201 {
202 read_error:;
203- fprintf (stderr, error < 0 ? "profiling:%s:Overflow merging\n"
204- : "profiling:%s:Error merging\n", gi_ptr->filename);
205+ fprintf (stderr, error < 0 ? "profiling:%s%s:Overflow merging\n"
206+ : "profiling:%s%s:Error merging\n", gcov_prefix, gi_ptr->filename);
207 goto read_fatal;
208 }
209 rewrite:;
210@@ -357,8 +426,8 @@ gcov_exit (void)
211 && (!GCOV_LOCKED || cs_all->runs == cs_prg->runs)
212 && memcmp (cs_all, cs_prg, sizeof (*cs_all)))
213 {
214- fprintf (stderr, "profiling:%s:Invocation mismatch - some data files may have been removed%s",
215- gi_ptr->filename, GCOV_LOCKED
216+ fprintf (stderr, "profiling:%s%s:Invocation mismatch - some data files may have been removed%s",
217+ gcov_prefix, gi_ptr->filename, GCOV_LOCKED
218 ? "" : " or concurrent update without locking support");
219 all.checksum = ~0u;
220 }
221@@ -418,9 +487,9 @@ gcov_exit (void)
222 gcov_write_summary (GCOV_TAG_PROGRAM_SUMMARY, &program);
223 if ((error = gcov_close ()))
224 fprintf (stderr, error < 0 ?
225- "profiling:%s:Overflow writing\n" :
226- "profiling:%s:Error writing\n",
227- gi_ptr->filename);
228+ "profiling:%s%s:Overflow writing\n" :
229+ "profiling:%s%s:Error writing\n",
230+ gcov_prefix, gi_ptr->filename);
231 }
232 }
233
234@@ -430,11 +499,69 @@ gcov_exit (void)
235 void
236 __gcov_init (struct gcov_info *info)
237 {
238+ /* Save initial filename pointer to calculate CRC. */
239+ const char *ptr = info->filename;
240+
241 if (!info->version)
242 return;
243+
244+ /* Initialize directory prefix if requred */
245+ if (gcov_prefix == 0)
246+ {
247+ if ((gcov_prefix = getenv("GCOV_PREFIX")))
248+ {
249+ char *tmp;
250+
251+ /* Normalize prefix: take off trailing separator. */
252+ tmp = gcov_prefix + strlen(gcov_prefix) - 1;
253+ if (IS_DIR_SEPARATOR(*tmp))
254+ *tmp = '\0';
255+
256+ /* Check if the level of dirs to strip off specified */
257+ if ((tmp = getenv("GCOV_PREFIX_STRIP")))
258+ {
259+ gcov_prefix_strip = atoi (tmp);
260+ /* Do not consider negative values. */
261+ if (gcov_prefix_strip < 0)
262+ gcov_prefix_strip = 0;
263+ };
264+ }
265+ else
266+ gcov_prefix = (char *) "";
267+ };
268+
269+ /* Strip off leading directories from the initial filename */
270+ if (gcov_prefix_strip > 0)
271+ {
272+ char sep, *s;
273+ int level;
274+ const char *fname = info->filename;
275+
276+ /* Detect directory separator */
277+ s = strrchr (fname, DIR_SEPARATOR);
278+#ifdef DIR_SEPARATOR_2
279+ if (! s)
280+ s = strrchr (fname, DIR_SEPARATOR_2);
281+#endif
282+ if (s)
283+ sep = *s;
284+ else
285+ sep = DIR_SEPARATOR;
286+
287+ /* Skip selected directory levels */
288+ for ( level = gcov_prefix_strip; level > 0; level--)
289+ if ((s = strchr(fname + 1, sep)))
290+ fname = s;
291+ else
292+ break;
293+
294+ /* From this point info block refers stripped file name and
295+ further operations must add prefix to get complete name.*/
296+ info->filename = fname;
297+ };
298+
299 if (gcov_version (info, info->version))
300 {
301- const char *ptr = info->filename;
302 gcov_unsigned_t crc32 = gcov_crc32;
303
304 do
305--- gcc-3.4/gcc/tsystem.h.prefix 2003-11-12 16:07:48.000000000 -0800
306+++ gcc-3.4/gcc/tsystem.h 2005-05-04 12:12:08.000000000 -0700
307@@ -106,4 +106,15 @@ extern int errno;
308 #define NULL 0
309 #endif
310
311+/* Filename handling macros. */
312+#include "filenames.h"
313+
314+/* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */
315+#ifndef DIR_SEPARATOR
316+# define DIR_SEPARATOR '/'
317+# ifdef HAVE_DOS_BASED_FILE_SYSTEM
318+# define DIR_SEPARATOR_2 '\\'
319+# endif
320+#endif
321+
322 #endif /* ! GCC_TSYSTEM_H */
323Index: gcc-3.4/gcc/doc/gcov.texi
324===================================================================
325RCS file: /cvsroot/gcc/gcc/gcc/doc/gcov.texi,v
326retrieving revision 1.19.4.3
327diff -u -p -r1.19.4.3 gcov.texi
328--- gcc-3.4/gcc/doc/gcov.texi 14 Mar 2004 22:31:20 -0000 1.19.4.3
329+++ gcc-3.4/gcc/doc/gcov.texi 4 May 2005 13:44:25 -0000
330@@ -42,6 +42,7 @@ test code coverage in your programs.
331 * Invoking Gcov:: How to use gcov.
332 * Gcov and Optimization:: Using gcov with GCC optimization.
333 * Gcov Data Files:: The files used by gcov.
334+* Cross-profiling:: Data files relocation.
335 @end menu
336
337 @node Gcov Intro
338@@ -510,3 +511,36 @@ information.
339 The full details of the file format is specified in @file{gcov-io.h},
340 and functions provided in that header file should be used to access the
341 coverage files.
342+
343+@node Cross-profiling
344+@section Data files relocation to support cross-profiling
345+
346+Running the program will cause profile output to be generated. For each
347+source file compiled with @option{-fprofile-arcs}, an accompanying @file{.gcda}
348+file will be placed in the object file directory. That implicitly requires
349+running the program at the same system as it was build or having same
350+absolute directory structure on the target system (program will try
351+to create needed directory structure).
352+
353+To support cross-profiling, program compiled with @option{-fprofile-arcs}
354+performs data file relocation basing on two environment variables:
355+
356+@itemize @bullet
357+@item
358+GCOV_PREFIX contains the prefix to add to the absolute paths
359+in the object file.
360+
361+@item
362+GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off
363+the hardwired absolute paths. Default value is 0.
364+@end itemize
365+
366+For example, if object file @file{/user/build/foo.o} was build with
367+@option{-fprofile-arcs}, the final executable will try to create data file
368+@file{/user/build/foo.gcda} when running at the target system and will
369+fail if corresponding directory does not exists and is not allowed to create.
370+
371+In this case, manipulating environment variables you can relocate data file
372+to the suitable local directory. For our example, setting @samp{GCOV_PREFIX=/target/run}
373+and @samp{GCOV_PREFIX_STRIP=1} values will force use of @file{/target/run/build/foo.gcda}
374+file name.
375Index: gcc-3.4/gcc/doc/invoke.texi
376===================================================================
377RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v
378retrieving revision 1.390.2.40
379diff -u -p -r1.390.2.40 invoke.texi
380--- gcc-3.4/gcc/doc/invoke.texi 22 Apr 2005 06:49:59 -0000 1.390.2.40
381+++ gcc-3.4/gcc/doc/invoke.texi 4 May 2005 13:44:25 -0000
382@@ -3158,6 +3158,7 @@ explicitly specified and it is not the f
383 the basename of the source file. In both cases any suffix is removed
384 (e.g. @file{foo.gcda} for input file @file{dir/foo.c}, or
385 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
386+@xref{Cross-profiling}.
387
388 @itemize
389
diff --git a/meta/packages/gcc/gcc-3.4.4/zecke-no-host-includes.patch b/meta/packages/gcc/gcc-3.4.4/zecke-no-host-includes.patch
new file mode 100644
index 0000000000..069a965012
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/zecke-no-host-includes.patch
@@ -0,0 +1,32 @@
1Index: gcc-3.4.4/gcc/c-incpath.c
2===================================================================
3--- gcc-3.4.4.orig/gcc/c-incpath.c 2004-05-31 12:37:47.000000000 +0200
4+++ gcc-3.4.4/gcc/c-incpath.c 2006-05-15 20:07:31.000000000 +0200
5@@ -328,6 +328,27 @@
6 else
7 heads[chain] = p;
8 tails[chain] = p;
9+
10+
11+#ifdef CROSS_COMPILE
12+ /* A common error when cross compiling is including
13+ host headers. This code below will try to fail fast
14+ for cross compiling. Currently we consider /usr/include,
15+ /opt/include and /sw/include as harmful. */
16+ {
17+ /* printf("Adding Path: %s\n", p->name ); */
18+ if( strstr(p->name, "/usr/include" ) == p->name ) {
19+ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name);
20+ abort();
21+ } else if( strstr(p->name, "/sw/include") == p->name ) {
22+ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name);
23+ abort();
24+ } else if( strstr(p->name, "/opt/include") == p->name ) {
25+ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name);
26+ abort();
27+ }
28+ }
29+#endif
30 }
31
32 /* Exported function to handle include chain merging, duplicate
diff --git a/meta/packages/gcc/gcc-3.4.4/zecke-xgcc-cpp.patch b/meta/packages/gcc/gcc-3.4.4/zecke-xgcc-cpp.patch
new file mode 100644
index 0000000000..ab6a3fd771
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/zecke-xgcc-cpp.patch
@@ -0,0 +1,13 @@
1Index: gcc-3.4.4/Makefile.in
2===================================================================
3--- gcc-3.4.4.orig/Makefile.in 2005-05-19 11:58:00.000000000 +0200
4+++ gcc-3.4.4/Makefile.in 2006-08-06 13:08:14.000000000 +0200
5@@ -21964,6 +21964,8 @@
6 AS="$(AS_FOR_TARGET)"; export AS; \
7 CC="$(CC_FOR_TARGET)"; export CC; \
8 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
9+ CPP="$(CC_FOR_TARGET) -E"; export CCP; \
10+ CPPFLAGS=""; export CPPFLAGS; \
11 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
12 CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
13 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
diff --git a/meta/packages/gcc/gcc-4.0.2.inc b/meta/packages/gcc/gcc-4.0.2.inc
new file mode 100644
index 0000000000..a0a6a6ae66
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2.inc
@@ -0,0 +1,29 @@
1require gcc-common.inc
2
3DEPENDS = "mpfr gmp"
4
5SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
6 file://arm-nolibfloat.patch;patch=1 \
7 file://arm-softfloat.patch;patch=1 \
8 file://ldflags.patch;patch=1 \
9 file://GCOV_PREFIX_STRIP-cross-profile_4.1.patch;patch=1 \
10 file://zecke-xgcc-cpp.patch;patch=1 "
11
12# uclibc patches below
13SRC_URI_append = " file://100-uclibc-conf.patch;patch=1 \
14 file://200-uclibc-locale.patch;patch=1 \
15 file://301-missing-execinfo_h.patch;patch=1 \
16 file://302-c99-snprintf.patch;patch=1 \
17 file://303-c99-complex-ugly-hack.patch;patch=1 \
18 file://800-arm-bigendian.patch;patch=1 \
19 file://zecke-host-cpp-ac-hack.patch;patch=1 \
20 file://gcc-4.0.2-atmel.0.99.2.patch;patch=1 \
21 "
22
23SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 "
24
25# Language Overrides
26FORTRAN = ""
27
28EXTRA_OECONF += "--disable-libssp"
29
diff --git a/meta/packages/gcc/gcc-4.0.2/GCOV_PREFIX_STRIP-cross-profile_4.1.patch b/meta/packages/gcc/gcc-4.0.2/GCOV_PREFIX_STRIP-cross-profile_4.1.patch
new file mode 100644
index 0000000000..92ce00a1e3
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/GCOV_PREFIX_STRIP-cross-profile_4.1.patch
@@ -0,0 +1,371 @@
12005-05-04 Grigory Zagorodnev <grigory.zagorodnev@intel.com>
2 H.J. Lu <hongjiu.lu@intel.com>
3
4 * gcov-io.c (gcov_open): When in libgcov library
5 use given data file relocation prefix to build file name.
6 * gcov-io.h (gcov_open): Updated proto to accept
7 data file relocation prefix.
8 * libgcov.c (create_file_directory): New function.
9 (gcov_prefix): New static variable to hold data file
10 relocation prefix.
11 (gcov_version): Use relocation prefix.
12 (gcov_exit): Always try to create directory for output
13 file. Relocate filename at each use.
14 (__gcov_init): Initialize directory relocation prefix
15 if required. Strip off leading directories from
16 the initial filename.
17 * tsystem.h: include filenames.h
18 (DIR_SEPARATOR): Macro copied from system.h.
19 (DIR_SEPARATOR_2): Likewise.
20 * doc/gcov.texi (Cross-profiling): New node documenting
21 cross-profiling management.
22 * doc/invoke.texi (-fprofile-arcs): xref to cross-profiling.
23
24--- gcc-4/gcc/doc/gcov.texi.prefix 2005-03-28 11:56:34.000000000 -0800
25+++ gcc-4/gcc/doc/gcov.texi 2005-05-04 15:07:44.000000000 -0700
26@@ -42,6 +42,7 @@ test code coverage in your programs.
27 * Invoking Gcov:: How to use gcov.
28 * Gcov and Optimization:: Using gcov with GCC optimization.
29 * Gcov Data Files:: The files used by gcov.
30+* Cross-profiling:: Data files relocation.
31 @end menu
32
33 @node Gcov Intro
34@@ -531,3 +532,36 @@ information.
35 The full details of the file format is specified in @file{gcov-io.h},
36 and functions provided in that header file should be used to access the
37 coverage files.
38+
39+@node Cross-profiling
40+@section Data files relocation to support cross-profiling
41+
42+Running the program will cause profile output to be generated. For each
43+source file compiled with @option{-fprofile-arcs}, an accompanying @file{.gcda}
44+file will be placed in the object file directory. That implicitly requires
45+running the program at the same system as it was build or having same
46+absolute directory structure on the target system (program will try
47+to create needed directory structure).
48+
49+To support cross-profiling, program compiled with @option{-fprofile-arcs}
50+performs data file relocation basing on two environment variables:
51+
52+@itemize @bullet
53+@item
54+GCOV_PREFIX contains the prefix to add to the absolute paths
55+in the object file.
56+
57+@item
58+GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off
59+the hardwired absolute paths. Default value is 0.
60+@end itemize
61+
62+For example, if object file @file{/user/build/foo.o} was build with
63+@option{-fprofile-arcs}, the final executable will try to create data file
64+@file{/user/build/foo.gcda} when running at the target system and will
65+fail if corresponding directory does not exists and is not allowed to create.
66+
67+In this case, manipulating environment variables you can relocate data file
68+to the suitable local directory. For our example, setting @samp{GCOV_PREFIX=/target/run}
69+and @samp{GCOV_PREFIX_STRIP=1} values will force use of @file{/target/run/build/foo.gcda}
70+file name.
71--- gcc-4/gcc/doc/invoke.texi.prefix 2005-05-04 11:21:00.000000000 -0700
72+++ gcc-4/gcc/doc/invoke.texi 2005-05-04 15:07:44.000000000 -0700
73@@ -3420,6 +3420,7 @@ explicitly specified and it is not the f
74 the basename of the source file. In both cases any suffix is removed
75 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
76 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
77+@xref{Cross-profiling}.
78
79 @cindex @command{gcov}
80 @item --coverage
81--- gcc-4/gcc/gcov-io.c.prefix 2005-04-28 16:11:30.000000000 -0700
82+++ gcc-4/gcc/gcov-io.c 2005-05-04 20:02:35.000000000 -0700
83@@ -55,13 +55,14 @@ static inline gcov_unsigned_t from_file
84
85 GCOV_LINKAGE int
86 #if IN_LIBGCOV
87-gcov_open (const char *name)
88+gcov_open (const char *prefix, const char *name)
89 #else
90 gcov_open (const char *name, int mode)
91 #endif
92 {
93 #if IN_LIBGCOV
94 const int mode = 0;
95+ char *tmp;
96 #endif
97 #if GCOV_LOCKED
98 struct flock s_flock;
99@@ -82,6 +83,13 @@ gcov_open (const char *name, int mode)
100 #if !IN_LIBGCOV
101 gcov_var.endian = 0;
102 #endif
103+
104+#if IN_LIBGCOV
105+ /* Build complete filename with prefix */
106+ tmp = alloca (strlen (prefix) + strlen (name) + 1);
107+ name = strcat (strcpy (tmp, prefix), name);
108+#endif
109+
110 #if GCOV_LOCKED
111 if (mode > 0)
112 fd = open (name, O_RDWR);
113--- gcc-4/gcc/gcov-io.h.prefix 2005-05-02 17:43:08.000000000 -0700
114+++ gcc-4/gcc/gcov-io.h 2005-05-04 15:07:44.000000000 -0700
115@@ -515,7 +515,7 @@ GCOV_LINKAGE struct gcov_var
116 functions for writing. Your file may become corrupted if you break
117 these invariants. */
118 #if IN_LIBGCOV
119-GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN;
120+GCOV_LINKAGE int gcov_open (const char */*prefix*/, const char */*name*/) ATTRIBUTE_HIDDEN;
121 #else
122 GCOV_LINKAGE int gcov_open (const char */*name*/, int /*direction*/);
123 GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t);
124--- gcc-4/gcc/libgcov.c.prefix 2005-04-28 16:11:30.000000000 -0700
125+++ gcc-4/gcc/libgcov.c 2005-05-04 15:07:44.000000000 -0700
126@@ -92,6 +92,70 @@ static struct gcov_info *gcov_list;
127 object file included in multiple programs. */
128 static gcov_unsigned_t gcov_crc32;
129
130+/* Directory prefix to relocate coverage data file names */
131+static char *gcov_prefix = 0;
132+
133+/* Level of dirs to strip off the initial filename to relocate */
134+static int gcov_prefix_strip = 0;
135+
136+static int
137+create_file_directory (const char *prefix, const char *filename)
138+{
139+ char *dname;
140+ char sep, *r, *s;
141+ size_t plen, flen;
142+
143+ /* Detect directory separator */
144+ s = strrchr (prefix, DIR_SEPARATOR);
145+#ifdef DIR_SEPARATOR_2
146+ if (! s)
147+ s = strrchr (prefix, DIR_SEPARATOR_2);
148+#endif
149+ if (s)
150+ sep = *s;
151+ else
152+ sep = DIR_SEPARATOR;
153+
154+ /* join prefix and filename, split path */
155+ plen = strlen(prefix);
156+ flen = strlen(filename);
157+ r = alloca(plen + flen + 1);
158+ strncpy(r, prefix, plen);
159+ strncpy(r + plen, filename, flen);
160+ r[plen + flen] = '\0';
161+ s = strrchr(r, sep);
162+ if (s)
163+ *(s + 1) = '\0';
164+
165+ if (access (r, F_OK) == 0)
166+ return 0;
167+
168+ /* Skip consecutive separators. */
169+ for (dname = r; *dname && *dname == sep; ++dname);
170+ while (1)
171+ {
172+ char *s = strchr (dname, sep);
173+ if (s == 0)
174+ break;
175+ *s = '\0';
176+ /* Try to make directory if it doesn't already exist. */
177+ if (access (r, F_OK) == -1
178+ && mkdir (r, 0755) == -1
179+ /* The directory might have been made by another process. */
180+ && errno != EEXIST)
181+ {
182+ *s = sep;
183+ fprintf (stderr, "profiling:%s:Cannot create directory\n", r);
184+ return -1;
185+ };
186+ *s = sep;
187+ /* Skip consecutive separators. */
188+ for (dname = s + 1; *dname && *dname == sep; ++dname)
189+ ;
190+ }
191+ return 0;
192+}
193+
194 static int
195 gcov_version (struct gcov_info *ptr, gcov_unsigned_t version)
196 {
197@@ -103,8 +167,8 @@ gcov_version (struct gcov_info *ptr, gco
198 GCOV_UNSIGNED2STRING (e, GCOV_VERSION);
199
200 fprintf (stderr,
201- "profiling:%s:Version mismatch - expected %.4s got %.4s\n",
202- ptr->filename, e, v);
203+ "profiling:%s%s:Version mismatch - expected %.4s got %.4s\n",
204+ gcov_prefix, ptr->filename, e, v);
205 return 0;
206 }
207 return 1;
208@@ -205,9 +269,16 @@ gcov_exit (void)
209 fi_stride &= ~(__alignof__ (struct gcov_fn_info) - 1);
210 }
211
212- if (!gcov_open (gi_ptr->filename))
213+ if (create_file_directory (gcov_prefix, gi_ptr->filename))
214+ {
215+ fprintf (stderr, "profiling:%s%s:Skip\n", gcov_prefix,
216+ gi_ptr->filename);
217+ continue;
218+ }
219+ else if (!gcov_open (gcov_prefix, gi_ptr->filename))
220 {
221- fprintf (stderr, "profiling:%s:Cannot open\n", gi_ptr->filename);
222+ fprintf (stderr, "profiling:%s%s:Cannot open\n", gcov_prefix,
223+ gi_ptr->filename);
224 continue;
225 }
226
227@@ -217,8 +288,8 @@ gcov_exit (void)
228 /* Merge data from file. */
229 if (tag != GCOV_DATA_MAGIC)
230 {
231- fprintf (stderr, "profiling:%s:Not a gcov data file\n",
232- gi_ptr->filename);
233+ fprintf (stderr, "profiling:%s%s:Not a gcov data file\n",
234+ gcov_prefix, gi_ptr->filename);
235 goto read_fatal;
236 }
237 length = gcov_read_unsigned ();
238@@ -245,8 +316,8 @@ gcov_exit (void)
239 || gcov_read_unsigned () != fi_ptr->checksum)
240 {
241 read_mismatch:;
242- fprintf (stderr, "profiling:%s:Merge mismatch for %s\n",
243- gi_ptr->filename,
244+ fprintf (stderr, "profiling:%s%s:Merge mismatch for %s\n",
245+ gcov_prefix, gi_ptr->filename,
246 f_ix + 1 ? "function" : "summaries");
247 goto read_fatal;
248 }
249@@ -305,7 +376,8 @@ gcov_exit (void)
250
251 read_error:;
252 fprintf (stderr, error < 0 ? "profiling:%s:Overflow merging\n"
253- : "profiling:%s:Error merging\n", gi_ptr->filename);
254+ : "profiling:%s%s:Error merging\n", gcov_prefix,
255+ gi_ptr->filename);
256
257 read_fatal:;
258 gcov_close ();
259@@ -355,8 +427,8 @@ gcov_exit (void)
260 && (!GCOV_LOCKED || cs_all->runs == cs_prg->runs)
261 && memcmp (cs_all, cs_prg, sizeof (*cs_all)))
262 {
263- fprintf (stderr, "profiling:%s:Invocation mismatch - some data files may have been removed%s",
264- gi_ptr->filename, GCOV_LOCKED
265+ fprintf (stderr, "profiling:%s%s:Invocation mismatch - some data files may have been removed%s",
266+ gcov_prefix, gi_ptr->filename, GCOV_LOCKED
267 ? "" : " or concurrent update without locking support");
268 all.checksum = ~0u;
269 }
270@@ -419,9 +491,9 @@ gcov_exit (void)
271 gcov_write_unsigned (0);
272 if ((error = gcov_close ()))
273 fprintf (stderr, error < 0 ?
274- "profiling:%s:Overflow writing\n" :
275- "profiling:%s:Error writing\n",
276- gi_ptr->filename);
277+ "profiling:%s%s:Overflow writing\n" :
278+ "profiling:%s%s:Error writing\n",
279+ gcov_prefix, gi_ptr->filename);
280 }
281 }
282
283@@ -431,11 +503,69 @@ gcov_exit (void)
284 void
285 __gcov_init (struct gcov_info *info)
286 {
287+ /* Save initial filename pointer to calculate CRC. */
288+ const char *ptr = info->filename;
289+
290 if (!info->version)
291 return;
292+
293+ /* Initialize directory prefix if requred */
294+ if (gcov_prefix == 0)
295+ {
296+ if ((gcov_prefix = getenv("GCOV_PREFIX")))
297+ {
298+ char *tmp;
299+
300+ /* Normalize prefix: take off trailing separator. */
301+ tmp = gcov_prefix + strlen(gcov_prefix) - 1;
302+ if (IS_DIR_SEPARATOR(*tmp))
303+ *tmp = '\0';
304+
305+ /* Check if the level of dirs to strip off specified */
306+ if ((tmp = getenv("GCOV_PREFIX_STRIP")))
307+ {
308+ gcov_prefix_strip = atoi (tmp);
309+ /* Do not consider negative values. */
310+ if (gcov_prefix_strip < 0)
311+ gcov_prefix_strip = 0;
312+ };
313+ }
314+ else
315+ gcov_prefix = (char *) "";
316+ };
317+
318+ /* Strip off leading directories from the initial filename */
319+ if (gcov_prefix_strip > 0)
320+ {
321+ char sep, *s;
322+ int level;
323+ const char *fname = info->filename;
324+
325+ /* Detect directory separator */
326+ s = strrchr (fname, DIR_SEPARATOR);
327+#ifdef DIR_SEPARATOR_2
328+ if (! s)
329+ s = strrchr (fname, DIR_SEPARATOR_2);
330+#endif
331+ if (s)
332+ sep = *s;
333+ else
334+ sep = DIR_SEPARATOR;
335+
336+ /* Skip selected directory levels */
337+ for ( level = gcov_prefix_strip; level > 0; level--)
338+ if ((s = strchr(fname + 1, sep)))
339+ fname = s;
340+ else
341+ break;
342+
343+ /* From this point info block refers stripped file name and
344+ further operations must add prefix to get complete name.*/
345+ info->filename = fname;
346+ };
347+
348 if (gcov_version (info, info->version))
349 {
350- const char *ptr = info->filename;
351 gcov_unsigned_t crc32 = gcov_crc32;
352
353 do
354--- gcc-4/gcc/tsystem.h.prefix 2005-03-29 16:06:26.000000000 -0800
355+++ gcc-4/gcc/tsystem.h 2005-05-04 15:07:44.000000000 -0700
356@@ -131,4 +131,15 @@ extern int errno;
357 unreachable default case of a switch. Do not use gcc_assert(0). */
358 #define gcc_unreachable() (abort ())
359
360+/* Filename handling macros. */
361+#include "filenames.h"
362+
363+/* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */
364+#ifndef DIR_SEPARATOR
365+# define DIR_SEPARATOR '/'
366+# ifdef HAVE_DOS_BASED_FILE_SYSTEM
367+# define DIR_SEPARATOR_2 '\\'
368+# endif
369+#endif
370+
371 #endif /* ! GCC_TSYSTEM_H */
diff --git a/meta/packages/gcc/gcc-4.0.2/gcc-4.0.2-atmel.0.99.2.patch b/meta/packages/gcc/gcc-4.0.2/gcc-4.0.2-atmel.0.99.2.patch
new file mode 100644
index 0000000000..273846f565
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/gcc-4.0.2-atmel.0.99.2.patch
@@ -0,0 +1,21330 @@
1diff -Nrup --ignore-space-change gcc-4.0.2/config.sub gcc-4.0.2-atmel.0.99.2/config.sub
2--- gcc-4.0.2/config.sub 2005-04-25 12:36:56.000000000 +0200
3+++ gcc-4.0.2-atmel.0.99.2/config.sub 2005-06-07 14:59:22.000000000 +0200
4@@ -1,9 +1,9 @@
5 #! /bin/sh
6 # Configuration validation subroutine script.
7 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
8-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
9+# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
10
11-timestamp='2005-04-22'
12+timestamp='2005-06-07'
13
14 # This file is (in principle) common to ALL GNU software.
15 # The presence of a machine in this file suggests that SOME GNU software
16@@ -70,7 +70,7 @@ Report bugs and patches to <config-patch
17 version="\
18 GNU config.sub ($timestamp)
19
20-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
21+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
22 Free Software Foundation, Inc.
23
24 This is free software; see the source for copying conditions. There is NO
25@@ -230,8 +230,7 @@ case $basic_machine in
26 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
27 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
28 | am33_2.0 \
29- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
30- | bfin \
31+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
32 | c4x | clipper \
33 | d10v | d30v | dlx | dsp16xx \
34 | fr30 | frv \
35@@ -263,8 +262,7 @@ case $basic_machine in
36 | pyramid \
37 | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
38 | sh64 | sh64le \
39- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
40- | sparcv8 | sparcv9 | sparcv9b \
41+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
42 | strongarm \
43 | tahoe | thumb | tic4x | tic80 | tron \
44 | v850 | v850e \
45@@ -299,8 +297,8 @@ case $basic_machine in
46 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
47 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
48 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
49- | avr-* \
50- | bfin-* | bs2000-* \
51+ | avr-* | avr32-* \
52+ | bs2000-* \
53 | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
54 | clipper-* | craynv-* | cydra-* \
55 | d10v-* | d30v-* | dlx-* \
56@@ -338,8 +336,7 @@ case $basic_machine in
57 | romp-* | rs6000-* \
58 | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
59 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
60- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
61- | sparclite-* \
62+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
63 | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
64 | tahoe-* | thumb-* \
65 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
66diff -Nrup --ignore-space-change gcc-4.0.2/configure gcc-4.0.2-atmel.0.99.2/configure
67--- gcc-4.0.2/configure 2005-09-13 09:01:28.000000000 +0200
68+++ gcc-4.0.2-atmel.0.99.2/configure 2006-01-20 14:31:15.000000000 +0100
69@@ -1284,6 +1284,9 @@ case "${target}" in
70 arm-*-riscix*)
71 noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
72 ;;
73+ avr32-*-*)
74+ noconfigdirs="$noconfigdirs target-libiberty target-libmudflap target-libffi ${libgcj}"
75+ ;;
76 avr-*-*)
77 noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
78 ;;
79@@ -1804,7 +1807,7 @@ else
80 # Extract the first word of "gcc", so it can be a program name with args.
81 set dummy gcc; ac_word=$2
82 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
83-echo "configure:1808: checking for $ac_word" >&5
84+echo "configure:1811: checking for $ac_word" >&5
85 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
86 echo $ac_n "(cached) $ac_c" 1>&6
87 else
88@@ -1834,7 +1837,7 @@ if test -z "$CC"; then
89 # Extract the first word of "cc", so it can be a program name with args.
90 set dummy cc; ac_word=$2
91 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
92-echo "configure:1838: checking for $ac_word" >&5
93+echo "configure:1841: checking for $ac_word" >&5
94 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
95 echo $ac_n "(cached) $ac_c" 1>&6
96 else
97@@ -1885,7 +1888,7 @@ fi
98 # Extract the first word of "cl", so it can be a program name with args.
99 set dummy cl; ac_word=$2
100 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
101-echo "configure:1889: checking for $ac_word" >&5
102+echo "configure:1892: checking for $ac_word" >&5
103 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
104 echo $ac_n "(cached) $ac_c" 1>&6
105 else
106@@ -1917,7 +1920,7 @@ fi
107 fi
108
109 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
110-echo "configure:1921: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
111+echo "configure:1924: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
112
113 ac_ext=c
114 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
115@@ -1928,12 +1931,12 @@ cross_compiling=$ac_cv_prog_cc_cross
116
117 cat > conftest.$ac_ext << EOF
118
119-#line 1932 "configure"
120+#line 1935 "configure"
121 #include "confdefs.h"
122
123 main(){return(0);}
124 EOF
125-if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
126+if { (eval echo configure:1940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
127 ac_cv_prog_cc_works=yes
128 # If we can't run a trivial program, we are probably using a cross compiler.
129 if (./conftest; exit) 2>/dev/null; then
130@@ -1959,12 +1962,12 @@ if test $ac_cv_prog_cc_works = no; then
131 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
132 fi
133 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
134-echo "configure:1963: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
135+echo "configure:1966: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
136 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
137 cross_compiling=$ac_cv_prog_cc_cross
138
139 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
140-echo "configure:1968: checking whether we are using GNU C" >&5
141+echo "configure:1971: checking whether we are using GNU C" >&5
142 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
143 echo $ac_n "(cached) $ac_c" 1>&6
144 else
145@@ -1973,7 +1976,7 @@ else
146 yes;
147 #endif
148 EOF
149-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
150+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
151 ac_cv_prog_gcc=yes
152 else
153 ac_cv_prog_gcc=no
154@@ -1992,7 +1995,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
155 ac_save_CFLAGS="$CFLAGS"
156 CFLAGS=
157 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
158-echo "configure:1996: checking whether ${CC-cc} accepts -g" >&5
159+echo "configure:1999: checking whether ${CC-cc} accepts -g" >&5
160 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
161 echo $ac_n "(cached) $ac_c" 1>&6
162 else
163@@ -2059,7 +2062,7 @@ fi
164 # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args.
165 set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
166 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
167-echo "configure:2063: checking for $ac_word" >&5
168+echo "configure:2066: checking for $ac_word" >&5
169 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
170 echo $ac_n "(cached) $ac_c" 1>&6
171 else
172@@ -2091,7 +2094,7 @@ if test -n "$ac_tool_prefix"; then
173 # Extract the first word of "gnatbind", so it can be a program name with args.
174 set dummy gnatbind; ac_word=$2
175 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
176-echo "configure:2095: checking for $ac_word" >&5
177+echo "configure:2098: checking for $ac_word" >&5
178 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then
179 echo $ac_n "(cached) $ac_c" 1>&6
180 else
181@@ -2124,7 +2127,7 @@ fi
182 fi
183
184 echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6
185-echo "configure:2128: checking whether compiler driver understands Ada" >&5
186+echo "configure:2131: checking whether compiler driver understands Ada" >&5
187 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then
188 echo $ac_n "(cached) $ac_c" 1>&6
189 else
190@@ -2156,7 +2159,7 @@ else
191 fi
192
193 echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6
194-echo "configure:2160: checking how to compare bootstrapped objects" >&5
195+echo "configure:2163: checking how to compare bootstrapped objects" >&5
196 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then
197 echo $ac_n "(cached) $ac_c" 1>&6
198 else
199@@ -2254,9 +2257,9 @@ saved_CFLAGS="$CFLAGS"
200 CFLAGS="$CFLAGS $gmpinc"
201 # Check GMP actually works
202 echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6
203-echo "configure:2258: checking for correct version of gmp.h" >&5
204+echo "configure:2261: checking for correct version of gmp.h" >&5
205 cat > conftest.$ac_ext <<EOF
206-#line 2260 "configure"
207+#line 2263 "configure"
208 #include "confdefs.h"
209 #include "gmp.h"
210 int main() {
211@@ -2267,7 +2270,7 @@ choke me
212
213 ; return 0; }
214 EOF
215-if { (eval echo configure:2271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
216+if { (eval echo configure:2274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
217 rm -rf conftest*
218 echo "$ac_t""yes" 1>&6
219 else
220@@ -2280,12 +2283,12 @@ rm -f conftest*
221
222 if test x"$have_gmp" = xyes; then
223 echo $ac_n "checking for MPFR""... $ac_c" 1>&6
224-echo "configure:2284: checking for MPFR" >&5
225+echo "configure:2287: checking for MPFR" >&5
226
227 saved_LIBS="$LIBS"
228 LIBS="$LIBS $gmplibs"
229 cat > conftest.$ac_ext <<EOF
230-#line 2289 "configure"
231+#line 2292 "configure"
232 #include "confdefs.h"
233 #include <gmp.h>
234 #include <mpfr.h>
235@@ -2293,7 +2296,7 @@ int main() {
236 mpfr_t n; mpfr_init(n);
237 ; return 0; }
238 EOF
239-if { (eval echo configure:2297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
240+if { (eval echo configure:2300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
241 rm -rf conftest*
242 echo "$ac_t""yes" 1>&6
243 else
244@@ -2789,7 +2792,7 @@ do
245 # Extract the first word of "$ac_prog", so it can be a program name with args.
246 set dummy $ac_prog; ac_word=$2
247 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
248-echo "configure:2793: checking for $ac_word" >&5
249+echo "configure:2796: checking for $ac_word" >&5
250 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_BISON'+set}'`\" = set"; then
251 echo $ac_n "(cached) $ac_c" 1>&6
252 else
253@@ -2824,7 +2827,7 @@ do
254 # Extract the first word of "$ac_prog", so it can be a program name with args.
255 set dummy $ac_prog; ac_word=$2
256 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
257-echo "configure:2828: checking for $ac_word" >&5
258+echo "configure:2831: checking for $ac_word" >&5
259 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_YACC'+set}'`\" = set"; then
260 echo $ac_n "(cached) $ac_c" 1>&6
261 else
262@@ -2859,7 +2862,7 @@ do
263 # Extract the first word of "$ac_prog", so it can be a program name with args.
264 set dummy $ac_prog; ac_word=$2
265 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
266-echo "configure:2863: checking for $ac_word" >&5
267+echo "configure:2866: checking for $ac_word" >&5
268 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_M4'+set}'`\" = set"; then
269 echo $ac_n "(cached) $ac_c" 1>&6
270 else
271@@ -2894,7 +2897,7 @@ do
272 # Extract the first word of "$ac_prog", so it can be a program name with args.
273 set dummy $ac_prog; ac_word=$2
274 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
275-echo "configure:2898: checking for $ac_word" >&5
276+echo "configure:2901: checking for $ac_word" >&5
277 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_FLEX'+set}'`\" = set"; then
278 echo $ac_n "(cached) $ac_c" 1>&6
279 else
280@@ -2929,7 +2932,7 @@ do
281 # Extract the first word of "$ac_prog", so it can be a program name with args.
282 set dummy $ac_prog; ac_word=$2
283 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
284-echo "configure:2933: checking for $ac_word" >&5
285+echo "configure:2936: checking for $ac_word" >&5
286 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LEX'+set}'`\" = set"; then
287 echo $ac_n "(cached) $ac_c" 1>&6
288 else
289@@ -2964,7 +2967,7 @@ do
290 # Extract the first word of "$ac_prog", so it can be a program name with args.
291 set dummy $ac_prog; ac_word=$2
292 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
293-echo "configure:2968: checking for $ac_word" >&5
294+echo "configure:2971: checking for $ac_word" >&5
295 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_MAKEINFO'+set}'`\" = set"; then
296 echo $ac_n "(cached) $ac_c" 1>&6
297 else
298@@ -3611,7 +3614,7 @@ test -n "$target_alias" && ncn_target_to
299 # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args.
300 set dummy ${ncn_tool_prefix}ar; ac_word=$2
301 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
302-echo "configure:3615: checking for $ac_word" >&5
303+echo "configure:3618: checking for $ac_word" >&5
304 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
305 echo $ac_n "(cached) $ac_c" 1>&6
306 else
307@@ -3644,7 +3647,7 @@ if test -z "$ac_cv_prog_AR" ; then
308 # Extract the first word of "ar", so it can be a program name with args.
309 set dummy ar; ac_word=$2
310 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
311-echo "configure:3648: checking for $ac_word" >&5
312+echo "configure:3651: checking for $ac_word" >&5
313 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then
314 echo $ac_n "(cached) $ac_c" 1>&6
315 else
316@@ -3683,7 +3686,7 @@ fi
317 # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args.
318 set dummy ${ncn_tool_prefix}as; ac_word=$2
319 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
320-echo "configure:3687: checking for $ac_word" >&5
321+echo "configure:3690: checking for $ac_word" >&5
322 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
323 echo $ac_n "(cached) $ac_c" 1>&6
324 else
325@@ -3716,7 +3719,7 @@ if test -z "$ac_cv_prog_AS" ; then
326 # Extract the first word of "as", so it can be a program name with args.
327 set dummy as; ac_word=$2
328 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
329-echo "configure:3720: checking for $ac_word" >&5
330+echo "configure:3723: checking for $ac_word" >&5
331 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then
332 echo $ac_n "(cached) $ac_c" 1>&6
333 else
334@@ -3755,7 +3758,7 @@ fi
335 # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args.
336 set dummy ${ncn_tool_prefix}dlltool; ac_word=$2
337 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
338-echo "configure:3759: checking for $ac_word" >&5
339+echo "configure:3762: checking for $ac_word" >&5
340 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
341 echo $ac_n "(cached) $ac_c" 1>&6
342 else
343@@ -3788,7 +3791,7 @@ if test -z "$ac_cv_prog_DLLTOOL" ; then
344 # Extract the first word of "dlltool", so it can be a program name with args.
345 set dummy dlltool; ac_word=$2
346 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
347-echo "configure:3792: checking for $ac_word" >&5
348+echo "configure:3795: checking for $ac_word" >&5
349 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then
350 echo $ac_n "(cached) $ac_c" 1>&6
351 else
352@@ -3827,7 +3830,7 @@ fi
353 # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args.
354 set dummy ${ncn_tool_prefix}ld; ac_word=$2
355 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
356-echo "configure:3831: checking for $ac_word" >&5
357+echo "configure:3834: checking for $ac_word" >&5
358 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
359 echo $ac_n "(cached) $ac_c" 1>&6
360 else
361@@ -3860,7 +3863,7 @@ if test -z "$ac_cv_prog_LD" ; then
362 # Extract the first word of "ld", so it can be a program name with args.
363 set dummy ld; ac_word=$2
364 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
365-echo "configure:3864: checking for $ac_word" >&5
366+echo "configure:3867: checking for $ac_word" >&5
367 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then
368 echo $ac_n "(cached) $ac_c" 1>&6
369 else
370@@ -3899,7 +3902,7 @@ fi
371 # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args.
372 set dummy ${ncn_tool_prefix}nm; ac_word=$2
373 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
374-echo "configure:3903: checking for $ac_word" >&5
375+echo "configure:3906: checking for $ac_word" >&5
376 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
377 echo $ac_n "(cached) $ac_c" 1>&6
378 else
379@@ -3932,7 +3935,7 @@ if test -z "$ac_cv_prog_NM" ; then
380 # Extract the first word of "nm", so it can be a program name with args.
381 set dummy nm; ac_word=$2
382 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
383-echo "configure:3936: checking for $ac_word" >&5
384+echo "configure:3939: checking for $ac_word" >&5
385 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then
386 echo $ac_n "(cached) $ac_c" 1>&6
387 else
388@@ -3971,7 +3974,7 @@ fi
389 # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args.
390 set dummy ${ncn_tool_prefix}ranlib; ac_word=$2
391 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
392-echo "configure:3975: checking for $ac_word" >&5
393+echo "configure:3978: checking for $ac_word" >&5
394 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
395 echo $ac_n "(cached) $ac_c" 1>&6
396 else
397@@ -4004,7 +4007,7 @@ if test -z "$ac_cv_prog_RANLIB" ; then
398 # Extract the first word of "ranlib", so it can be a program name with args.
399 set dummy ranlib; ac_word=$2
400 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
401-echo "configure:4008: checking for $ac_word" >&5
402+echo "configure:4011: checking for $ac_word" >&5
403 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then
404 echo $ac_n "(cached) $ac_c" 1>&6
405 else
406@@ -4043,7 +4046,7 @@ fi
407 # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args.
408 set dummy ${ncn_tool_prefix}windres; ac_word=$2
409 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
410-echo "configure:4047: checking for $ac_word" >&5
411+echo "configure:4050: checking for $ac_word" >&5
412 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
413 echo $ac_n "(cached) $ac_c" 1>&6
414 else
415@@ -4076,7 +4079,7 @@ if test -z "$ac_cv_prog_WINDRES" ; then
416 # Extract the first word of "windres", so it can be a program name with args.
417 set dummy windres; ac_word=$2
418 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
419-echo "configure:4080: checking for $ac_word" >&5
420+echo "configure:4083: checking for $ac_word" >&5
421 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then
422 echo $ac_n "(cached) $ac_c" 1>&6
423 else
424@@ -4115,7 +4118,7 @@ fi
425 # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args.
426 set dummy ${ncn_tool_prefix}objcopy; ac_word=$2
427 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
428-echo "configure:4119: checking for $ac_word" >&5
429+echo "configure:4122: checking for $ac_word" >&5
430 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
431 echo $ac_n "(cached) $ac_c" 1>&6
432 else
433@@ -4148,7 +4151,7 @@ if test -z "$ac_cv_prog_OBJCOPY" ; then
434 # Extract the first word of "objcopy", so it can be a program name with args.
435 set dummy objcopy; ac_word=$2
436 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
437-echo "configure:4152: checking for $ac_word" >&5
438+echo "configure:4155: checking for $ac_word" >&5
439 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then
440 echo $ac_n "(cached) $ac_c" 1>&6
441 else
442@@ -4187,7 +4190,7 @@ fi
443 # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args.
444 set dummy ${ncn_tool_prefix}objdump; ac_word=$2
445 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
446-echo "configure:4191: checking for $ac_word" >&5
447+echo "configure:4194: checking for $ac_word" >&5
448 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
449 echo $ac_n "(cached) $ac_c" 1>&6
450 else
451@@ -4220,7 +4223,7 @@ if test -z "$ac_cv_prog_OBJDUMP" ; then
452 # Extract the first word of "objdump", so it can be a program name with args.
453 set dummy objdump; ac_word=$2
454 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
455-echo "configure:4224: checking for $ac_word" >&5
456+echo "configure:4227: checking for $ac_word" >&5
457 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then
458 echo $ac_n "(cached) $ac_c" 1>&6
459 else
460@@ -4266,7 +4269,7 @@ fi
461 # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args.
462 set dummy ${ncn_target_tool_prefix}ar; ac_word=$2
463 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
464-echo "configure:4270: checking for $ac_word" >&5
465+echo "configure:4273: checking for $ac_word" >&5
466 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then
467 echo $ac_n "(cached) $ac_c" 1>&6
468 else
469@@ -4299,7 +4302,7 @@ if test -z "$ac_cv_prog_CONFIGURED_AR_FO
470 # Extract the first word of "ar", so it can be a program name with args.
471 set dummy ar; ac_word=$2
472 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
473-echo "configure:4303: checking for $ac_word" >&5
474+echo "configure:4306: checking for $ac_word" >&5
475 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then
476 echo $ac_n "(cached) $ac_c" 1>&6
477 else
478@@ -4338,7 +4341,7 @@ fi
479 # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args.
480 set dummy ${ncn_target_tool_prefix}as; ac_word=$2
481 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
482-echo "configure:4342: checking for $ac_word" >&5
483+echo "configure:4345: checking for $ac_word" >&5
484 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then
485 echo $ac_n "(cached) $ac_c" 1>&6
486 else
487@@ -4371,7 +4374,7 @@ if test -z "$ac_cv_prog_CONFIGURED_AS_FO
488 # Extract the first word of "as", so it can be a program name with args.
489 set dummy as; ac_word=$2
490 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
491-echo "configure:4375: checking for $ac_word" >&5
492+echo "configure:4378: checking for $ac_word" >&5
493 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then
494 echo $ac_n "(cached) $ac_c" 1>&6
495 else
496@@ -4410,7 +4413,7 @@ fi
497 # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args.
498 set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2
499 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
500-echo "configure:4414: checking for $ac_word" >&5
501+echo "configure:4417: checking for $ac_word" >&5
502 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
503 echo $ac_n "(cached) $ac_c" 1>&6
504 else
505@@ -4443,7 +4446,7 @@ if test -z "$ac_cv_prog_CONFIGURED_DLLTO
506 # Extract the first word of "dlltool", so it can be a program name with args.
507 set dummy dlltool; ac_word=$2
508 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
509-echo "configure:4447: checking for $ac_word" >&5
510+echo "configure:4450: checking for $ac_word" >&5
511 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
512 echo $ac_n "(cached) $ac_c" 1>&6
513 else
514@@ -4482,7 +4485,7 @@ fi
515 # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args.
516 set dummy ${ncn_target_tool_prefix}ld; ac_word=$2
517 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
518-echo "configure:4486: checking for $ac_word" >&5
519+echo "configure:4489: checking for $ac_word" >&5
520 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then
521 echo $ac_n "(cached) $ac_c" 1>&6
522 else
523@@ -4515,7 +4518,7 @@ if test -z "$ac_cv_prog_CONFIGURED_LD_FO
524 # Extract the first word of "ld", so it can be a program name with args.
525 set dummy ld; ac_word=$2
526 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
527-echo "configure:4519: checking for $ac_word" >&5
528+echo "configure:4522: checking for $ac_word" >&5
529 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then
530 echo $ac_n "(cached) $ac_c" 1>&6
531 else
532@@ -4554,7 +4557,7 @@ fi
533 # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args.
534 set dummy ${ncn_target_tool_prefix}nm; ac_word=$2
535 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
536-echo "configure:4558: checking for $ac_word" >&5
537+echo "configure:4561: checking for $ac_word" >&5
538 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then
539 echo $ac_n "(cached) $ac_c" 1>&6
540 else
541@@ -4587,7 +4590,7 @@ if test -z "$ac_cv_prog_CONFIGURED_NM_FO
542 # Extract the first word of "nm", so it can be a program name with args.
543 set dummy nm; ac_word=$2
544 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
545-echo "configure:4591: checking for $ac_word" >&5
546+echo "configure:4594: checking for $ac_word" >&5
547 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then
548 echo $ac_n "(cached) $ac_c" 1>&6
549 else
550@@ -4626,7 +4629,7 @@ fi
551 # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args.
552 set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2
553 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
554-echo "configure:4630: checking for $ac_word" >&5
555+echo "configure:4633: checking for $ac_word" >&5
556 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then
557 echo $ac_n "(cached) $ac_c" 1>&6
558 else
559@@ -4659,7 +4662,7 @@ if test -z "$ac_cv_prog_CONFIGURED_RANLI
560 # Extract the first word of "ranlib", so it can be a program name with args.
561 set dummy ranlib; ac_word=$2
562 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
563-echo "configure:4663: checking for $ac_word" >&5
564+echo "configure:4666: checking for $ac_word" >&5
565 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then
566 echo $ac_n "(cached) $ac_c" 1>&6
567 else
568@@ -4698,7 +4701,7 @@ fi
569 # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args.
570 set dummy ${ncn_target_tool_prefix}windres; ac_word=$2
571 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
572-echo "configure:4702: checking for $ac_word" >&5
573+echo "configure:4705: checking for $ac_word" >&5
574 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then
575 echo $ac_n "(cached) $ac_c" 1>&6
576 else
577@@ -4731,7 +4734,7 @@ if test -z "$ac_cv_prog_CONFIGURED_WINDR
578 # Extract the first word of "windres", so it can be a program name with args.
579 set dummy windres; ac_word=$2
580 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
581-echo "configure:4735: checking for $ac_word" >&5
582+echo "configure:4738: checking for $ac_word" >&5
583 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then
584 echo $ac_n "(cached) $ac_c" 1>&6
585 else
586@@ -4816,7 +4819,7 @@ RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${
587 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
588
589 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
590-echo "configure:4820: checking whether to enable maintainer-specific portions of Makefiles" >&5
591+echo "configure:4823: checking whether to enable maintainer-specific portions of Makefiles" >&5
592 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
593 if test "${enable_maintainer_mode+set}" = set; then
594 enableval="$enable_maintainer_mode"
595@@ -4863,7 +4866,7 @@ esac
596 # gcc for stageN-gcc and stagePREV-gcc for stage(N-1). In case this is not
597 # possible, however, we can resort to mv.
598 echo $ac_n "checking if symbolic links between directories work""... $ac_c" 1>&6
599-echo "configure:4867: checking if symbolic links between directories work" >&5
600+echo "configure:4870: checking if symbolic links between directories work" >&5
601 if eval "test \"`echo '$''{'gcc_cv_prog_ln_s_dir'+set}'`\" = set"; then
602 echo $ac_n "(cached) $ac_c" 1>&6
603 else
604@@ -4997,15 +5000,34 @@ trap 'rm -f $CONFIG_STATUS conftest*; ex
605 # Transform confdefs.h into DEFS.
606 # Protect against shell expansion while executing Makefile rules.
607 # Protect against Makefile macro expansion.
608-cat > conftest.defs <<\EOF
609-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
610-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
611-s%\[%\\&%g
612-s%\]%\\&%g
613-s%\$%$$%g
614-EOF
615-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
616-rm -f conftest.defs
617+#
618+# If the first sed substitution is executed (which looks for macros that
619+# take arguments), then we branch to the quote section. Otherwise,
620+# look for a macro that doesn't take arguments.
621+cat >confdef2opt.sed <<\_ACEOF
622+t clear
623+: clear
624+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
625+t quote
626+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
627+t quote
628+d
629+: quote
630+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
631+s,\[,\\&,g
632+s,\],\\&,g
633+s,\$,$$,g
634+p
635+_ACEOF
636+# We use echo to avoid assuming a particular line-breaking character.
637+# The extra dot is to prevent the shell from consuming trailing
638+# line-breaks from the sub-command output. A line-break within
639+# single-quotes doesn't work because, if this script is created in a
640+# platform that uses two characters for line-breaks (e.g., DOS), tr
641+# would break.
642+ac_LF_and_DOT=`echo; echo .`
643+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
644+rm -f confdef2opt.sed
645
646
647 # Without the "./", some shells look in PATH for config.status.
648diff -Nrup --ignore-space-change gcc-4.0.2/configure.in gcc-4.0.2-atmel.0.99.2/configure.in
649--- gcc-4.0.2/configure.in 2005-09-13 09:01:28.000000000 +0200
650+++ gcc-4.0.2-atmel.0.99.2/configure.in 2006-01-20 14:31:15.000000000 +0100
651@@ -493,6 +493,9 @@ case "${target}" in
652 arm-*-riscix*)
653 noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
654 ;;
655+ avr32-*-*)
656+ noconfigdirs="$noconfigdirs target-libiberty target-libmudflap target-libffi ${libgcj}"
657+ ;;
658 avr-*-*)
659 noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
660 ;;
661diff -Nrup --ignore-space-change gcc-4.0.2/gcc/ada/s-tpopsp-rtems.adb gcc-4.0.2-atmel.0.99.2/gcc/ada/s-tpopsp-rtems.adb
662--- gcc-4.0.2/gcc/ada/s-tpopsp-rtems.adb 2005-01-27 12:56:57.000000000 +0100
663+++ gcc-4.0.2-atmel.0.99.2/gcc/ada/s-tpopsp-rtems.adb 2005-07-15 16:26:03.000000000 +0200
664@@ -7,7 +7,7 @@
665 -- --
666 -- B o d y --
667 -- --
668--- $Revision: 1.2 $
669+-- $Revision: 3484 $
670 -- --
671 -- Copyright (C) 1991-2003, Florida State University --
672 -- --
673diff -Nrup --ignore-space-change gcc-4.0.2/gcc/builtins.c gcc-4.0.2-atmel.0.99.2/gcc/builtins.c
674--- gcc-4.0.2/gcc/builtins.c 2005-08-28 13:08:55.000000000 +0200
675+++ gcc-4.0.2-atmel.0.99.2/gcc/builtins.c 2006-03-23 13:29:00.000000000 +0100
676@@ -8387,7 +8387,7 @@ validate_arglist (tree arglist, ...)
677
678 do
679 {
680- code = va_arg (ap, enum tree_code);
681+ code = va_arg (ap, int);
682 switch (code)
683 {
684 case 0:
685diff -Nrup --ignore-space-change gcc-4.0.2/gcc/calls.c gcc-4.0.2-atmel.0.99.2/gcc/calls.c
686--- gcc-4.0.2/gcc/calls.c 2005-07-25 18:36:33.000000000 +0200
687+++ gcc-4.0.2-atmel.0.99.2/gcc/calls.c 2006-03-23 13:29:00.000000000 +0100
688@@ -3353,7 +3353,7 @@ emit_library_call_value_1 (int retval, r
689 for (; count < nargs; count++)
690 {
691 rtx val = va_arg (p, rtx);
692- enum machine_mode mode = va_arg (p, enum machine_mode);
693+ enum machine_mode mode = va_arg (p, int);
694
695 /* We cannot convert the arg value to the mode the library wants here;
696 must do it earlier where we know the signedness of the arg. */
697diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/avr32.c gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32.c
698--- gcc-4.0.2/gcc/config/avr32/avr32.c 1970-01-01 01:00:00.000000000 +0100
699+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32.c 2006-11-24 17:13:09.000000000 +0100
700@@ -0,0 +1,7276 @@
701+/*
702+ Target hooks and helper functions for AVR32.
703+ Copyright 2003-2006 Atmel Corporation.
704+
705+ Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
706+ Initial porting by Anders Ådland.
707+
708+ This file is part of GCC.
709+
710+ This program is free software; you can redistribute it and/or modify
711+ it under the terms of the GNU General Public License as published by
712+ the Free Software Foundation; either version 2 of the License, or
713+ (at your option) any later version.
714+
715+ This program is distributed in the hope that it will be useful,
716+ but WITHOUT ANY WARRANTY; without even the implied warranty of
717+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
718+ GNU General Public License for more details.
719+
720+ You should have received a copy of the GNU General Public License
721+ along with this program; if not, write to the Free Software
722+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
723+
724+#include "config.h"
725+#include "system.h"
726+#include "coretypes.h"
727+#include "tm.h"
728+#include "rtl.h"
729+#include "tree.h"
730+#include "obstack.h"
731+#include "regs.h"
732+#include "hard-reg-set.h"
733+#include "real.h"
734+#include "insn-config.h"
735+#include "conditions.h"
736+#include "output.h"
737+#include "insn-attr.h"
738+#include "flags.h"
739+#include "reload.h"
740+#include "function.h"
741+#include "expr.h"
742+#include "optabs.h"
743+#include "toplev.h"
744+#include "recog.h"
745+#include "ggc.h"
746+#include "except.h"
747+#include "c-pragma.h"
748+#include "integrate.h"
749+#include "tm_p.h"
750+#include "langhooks.h"
751+
752+#include "target.h"
753+#include "target-def.h"
754+
755+#include <ctype.h>
756+
757+/* Forward definitions of types. */
758+typedef struct minipool_node Mnode;
759+typedef struct minipool_fixup Mfix;
760+
761+/* Obstack for minipool constant handling. */
762+static struct obstack minipool_obstack;
763+static char *minipool_startobj;
764+static rtx minipool_vector_label;
765+
766+/* True if we are currently building a constant table. */
767+int making_const_table;
768+
769+/* Some forward function declarations */
770+static unsigned long avr32_isr_value (tree);
771+static unsigned long avr32_compute_func_type (void);
772+static tree avr32_handle_isr_attribute (tree *, tree, tree, int, bool *);
773+static tree avr32_handle_acall_attribute (tree *, tree, tree, int, bool *);
774+static tree avr32_handle_fndecl_attribute (tree * node, tree name, tree args,
775+ int flags, bool * no_add_attrs);
776+static void avr32_reorg (void);
777+bool avr32_return_in_msb (tree type);
778+bool avr32_vector_mode_supported (enum machine_mode mode);
779+static void avr32_init_libfuncs (void);
780+void avr32_load_pic_register (void);
781+
782+
783+static void
784+avr32_add_gc_roots (void)
785+{
786+ gcc_obstack_init (&minipool_obstack);
787+ minipool_startobj = (char *) obstack_alloc (&minipool_obstack, 0);
788+}
789+
790+
791+/* List of all known AVR32 parts */
792+static const struct part_type_s avr32_part_types[] = {
793+ /* name, part_type, architecture type, macro */
794+ {"none", PART_TYPE_AVR32_NONE, ARCH_TYPE_AVR32_AP, "__AVR32__"},
795+ {"ap7000", PART_TYPE_AVR32_AP7000, ARCH_TYPE_AVR32_AP, "__AVR32_AP7000__"},
796+ {"ap7010", PART_TYPE_AVR32_AP7010, ARCH_TYPE_AVR32_AP, "__AVR32_AP7010__"},
797+ {"ap7020", PART_TYPE_AVR32_AP7020, ARCH_TYPE_AVR32_AP, "__AVR32_AP7020__"},
798+ {"uc3a0256", PART_TYPE_AVR32_UC3A0256, ARCH_TYPE_AVR32_UC, "__AVR32_UC3A0256__"},
799+ {"uc3a0512", PART_TYPE_AVR32_UC3A0512, ARCH_TYPE_AVR32_UC, "__AVR32_UC3A0512__"},
800+ {"uc3a1128", PART_TYPE_AVR32_UC3A1128, ARCH_TYPE_AVR32_UC, "__AVR32_UC3A1128__"},
801+ {"uc3a1256", PART_TYPE_AVR32_UC3A1256, ARCH_TYPE_AVR32_UC, "__AVR32_UC3A1256__"},
802+ {"uc3a1512", PART_TYPE_AVR32_UC3A1512, ARCH_TYPE_AVR32_UC, "__AVR32_UC3A1512__"},
803+ {NULL, 0, 0, NULL}
804+};
805+
806+/* List of all known AVR32 architectures */
807+static const struct arch_type_s avr32_arch_types[] = {
808+ /* name, architecture type, microarchitecture type, feature flags, macro */
809+ {"ap", ARCH_TYPE_AVR32_AP, UARCH_TYPE_AVR32B, FLAG_AVR32_HAS_DSP |
810+ FLAG_AVR32_HAS_SIMD | FLAG_AVR32_HAS_UNALIGNED_WORD |
811+ FLAG_AVR32_HAS_BRANCH_PRED, "__AVR32_AP__"},
812+ {"uc", ARCH_TYPE_AVR32_UC, UARCH_TYPE_AVR32A,
813+ FLAG_AVR32_HAS_DSP | FLAG_AVR32_HAS_RMW, "__AVR32_UC__"},
814+ {NULL, 0, 0, 0, NULL}
815+};
816+
817+/* Default arch name */
818+const char *avr32_arch_name = "ap";
819+const char *avr32_part_name = "none";
820+
821+const struct part_type_s *avr32_part;
822+const struct arch_type_s *avr32_arch;
823+
824+
825+/* Override command line options */
826+void
827+avr32_override_options (void)
828+{
829+ const struct part_type_s *part;
830+ const struct arch_type_s *arch;
831+
832+ /* Check if part type is set. */
833+ for (part = avr32_part_types; part->name; part++)
834+ if (strcmp (part->name, avr32_part_name) == 0)
835+ break;
836+
837+ avr32_part = part;
838+
839+ if (!part->name)
840+ {
841+ fprintf (stderr, "Unknown part `%s' specified\nKnown part names:\n",
842+ avr32_part_name);
843+ for (part = avr32_part_types; part->name; part++)
844+ fprintf (stderr, "\t%s\n", part->name);
845+ avr32_part = &avr32_part_types[PART_TYPE_AVR32_NONE];
846+ }
847+
848+ avr32_arch = &avr32_arch_types[avr32_part->arch_type];
849+
850+ /* If part was set to "none" then check if arch was set. */
851+ if (strcmp (avr32_part->name, "none") == 0)
852+ {
853+ /* Check if arch type is set. */
854+ for (arch = avr32_arch_types; arch->name; arch++)
855+ if (strcmp (arch->name, avr32_arch_name) == 0)
856+ break;
857+
858+ avr32_arch = arch;
859+
860+ if (!arch->name)
861+ {
862+ fprintf (stderr, "Unknown arch `%s' specified\nKnown arch names:\n",
863+ avr32_arch_name);
864+ for (arch = avr32_arch_types; arch->name; arch++)
865+ fprintf (stderr, "\t%s\n", arch->name);
866+ avr32_arch = &avr32_arch_types[ARCH_TYPE_AVR32_AP];
867+ }
868+ }
869+
870+ /* If optimization level is two or greater, then align start of loops to a
871+ word boundary since this will allow folding the first insn of the loop.
872+ Do this only for targets supporting branch prediction. */
873+ if (optimize >= 2 && TARGET_BRANCH_PRED)
874+ align_loops = 2;
875+
876+ if (AVR32_ALWAYS_PIC)
877+ flag_pic = 1;
878+
879+ if (target_flags & AVR32_FLAG_NO_PIC)
880+ flag_pic = 0;
881+
882+ avr32_add_gc_roots ();
883+}
884+
885+
886+/*
887+If defined, a function that outputs the assembler code for entry to a
888+function. The prologue is responsible for setting up the stack frame,
889+initializing the frame pointer register, saving registers that must be
890+saved, and allocating size additional bytes of storage for the
891+local variables. size is an integer. file is a stdio
892+stream to which the assembler code should be output.
893+
894+The label for the beginning of the function need not be output by this
895+macro. That has already been done when the macro is run.
896+
897+To determine which registers to save, the macro can refer to the array
898+regs_ever_live: element r is nonzero if hard register
899+r is used anywhere within the function. This implies the function
900+prologue should save register r, provided it is not one of the
901+call-used registers. (TARGET_ASM_FUNCTION_EPILOGUE must likewise use
902+regs_ever_live.)
903+
904+On machines that have ``register windows'', the function entry code does
905+not save on the stack the registers that are in the windows, even if
906+they are supposed to be preserved by function calls; instead it takes
907+appropriate steps to ``push'' the register stack, if any non-call-used
908+registers are used in the function.
909+
910+On machines where functions may or may not have frame-pointers, the
911+function entry code must vary accordingly; it must set up the frame
912+pointer if one is wanted, and not otherwise. To determine whether a
913+frame pointer is in wanted, the macro can refer to the variable
914+frame_pointer_needed. The variable's value will be 1 at run
915+time in a function that needs a frame pointer. (see Elimination).
916+
917+The function entry code is responsible for allocating any stack space
918+required for the function. This stack space consists of the regions
919+listed below. In most cases, these regions are allocated in the
920+order listed, with the last listed region closest to the top of the
921+stack (the lowest address if STACK_GROWS_DOWNWARD is defined, and
922+the highest address if it is not defined). You can use a different order
923+for a machine if doing so is more convenient or required for
924+compatibility reasons. Except in cases where required by standard
925+or by a debugger, there is no reason why the stack layout used by GCC
926+need agree with that used by other compilers for a machine.
927+*/
928+
929+#undef TARGET_ASM_FUNCTION_PROLOGUE
930+#define TARGET_ASM_FUNCTION_PROLOGUE avr32_target_asm_function_prologue
931+
932+
933+#undef TARGET_DEFAULT_SHORT_ENUMS
934+#define TARGET_DEFAULT_SHORT_ENUMS hook_bool_void_false
935+
936+#undef TARGET_PROMOTE_FUNCTION_ARGS
937+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
938+
939+#undef TARGET_PROMOTE_FUNCTION_RETURN
940+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
941+
942+#undef TARGET_PROMOTE_PROTOTYPES
943+#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
944+
945+#undef TARGET_MUST_PASS_IN_STACK
946+#define TARGET_MUST_PASS_IN_STACK avr32_must_pass_in_stack
947+
948+#undef TARGET_PASS_BY_REFERENCE
949+#define TARGET_PASS_BY_REFERENCE avr32_pass_by_reference
950+
951+#undef TARGET_STRICT_ARGUMENT_NAMING
952+#define TARGET_STRICT_ARGUMENT_NAMING avr32_strict_argument_naming
953+
954+#undef TARGET_VECTOR_MODE_SUPPORTED_P
955+#define TARGET_VECTOR_MODE_SUPPORTED_P avr32_vector_mode_supported
956+
957+#undef TARGET_RETURN_IN_MEMORY
958+#define TARGET_RETURN_IN_MEMORY avr32_return_in_memory
959+
960+#undef TARGET_RETURN_IN_MSB
961+#define TARGET_RETURN_IN_MSB avr32_return_in_msb
962+
963+#undef TARGET_ARG_PARTIAL_BYTES
964+#define TARGET_ARG_PARTIAL_BYTES avr32_arg_partial_bytes
965+
966+#undef TARGET_STRIP_NAME_ENCODING
967+#define TARGET_STRIP_NAME_ENCODING avr32_strip_name_encoding
968+
969+#define streq(string1, string2) (strcmp (string1, string2) == 0)
970+
971+#undef TARGET_ATTRIBUTE_TABLE
972+#define TARGET_ATTRIBUTE_TABLE avr32_attribute_table
973+
974+#undef TARGET_COMP_TYPE_ATTRIBUTES
975+#define TARGET_COMP_TYPE_ATTRIBUTES avr32_comp_type_attributes
976+
977+
978+#undef TARGET_RTX_COSTS
979+#define TARGET_RTX_COSTS avr32_rtx_costs
980+
981+#undef TARGET_CANNOT_FORCE_CONST_MEM
982+#define TARGET_CANNOT_FORCE_CONST_MEM avr32_cannot_force_const_mem
983+
984+#undef TARGET_ASM_INTEGER
985+#define TARGET_ASM_INTEGER avr32_assemble_integer
986+
987+/*
988+ * Switches to the appropriate section for output of constant pool
989+ * entry x in mode. You can assume that x is some kind of constant in
990+ * RTL. The argument mode is redundant except in the case of a
991+ * const_int rtx. Select the section by calling readonly_data_ section
992+ * or one of the alternatives for other sections. align is the
993+ * constant alignment in bits.
994+ *
995+ * The default version of this function takes care of putting symbolic
996+ * constants in flag_ pic mode in data_section and everything else in
997+ * readonly_data_section.
998+ */
999+#undef TARGET_ASM_SELECT_RTX_SECTION
1000+#define TARGET_ASM_SELECT_RTX_SECTION avr32_select_rtx_section
1001+
1002+
1003+/*
1004+ * If non-null, this hook performs a target-specific pass over the
1005+ * instruction stream. The compiler will run it at all optimization
1006+ * levels, just before the point at which it normally does
1007+ * delayed-branch scheduling.
1008+ *
1009+ * The exact purpose of the hook varies from target to target. Some
1010+ * use it to do transformations that are necessary for correctness,
1011+ * such as laying out in-function constant pools or avoiding hardware
1012+ * hazards. Others use it as an opportunity to do some
1013+ * machine-dependent optimizations.
1014+ *
1015+ * You need not implement the hook if it has nothing to do. The
1016+ * default definition is null.
1017+ */
1018+#undef TARGET_MACHINE_DEPENDENT_REORG
1019+#define TARGET_MACHINE_DEPENDENT_REORG avr32_reorg
1020+
1021+/* Target hook for assembling integer objects.
1022+ Need to handle integer vectors */
1023+static bool
1024+avr32_assemble_integer (rtx x, unsigned int size, int aligned_p)
1025+{
1026+ if (avr32_vector_mode_supported (GET_MODE (x)))
1027+ {
1028+ int i, units;
1029+
1030+ if (GET_CODE (x) != CONST_VECTOR)
1031+ abort ();
1032+
1033+ units = CONST_VECTOR_NUNITS (x);
1034+
1035+ switch (GET_MODE (x))
1036+ {
1037+ case V2HImode:
1038+ size = 2;
1039+ break;
1040+ case V4QImode:
1041+ size = 1;
1042+ break;
1043+ default:
1044+ abort ();
1045+ }
1046+
1047+ for (i = 0; i < units; i++)
1048+ {
1049+ rtx elt;
1050+
1051+ elt = CONST_VECTOR_ELT (x, i);
1052+ assemble_integer (elt, size, i == 0 ? 32 : size * BITS_PER_UNIT, 1);
1053+ }
1054+
1055+ return true;
1056+ }
1057+
1058+ return default_assemble_integer (x, size, aligned_p);
1059+}
1060+
1061+/*
1062+ * This target hook describes the relative costs of RTL expressions.
1063+ *
1064+ * The cost may depend on the precise form of the expression, which is
1065+ * available for examination in x, and the rtx code of the expression
1066+ * in which it is contained, found in outer_code. code is the
1067+ * expression code--redundant, since it can be obtained with GET_CODE
1068+ * (x).
1069+ *
1070+ * In implementing this hook, you can use the construct COSTS_N_INSNS
1071+ * (n) to specify a cost equal to n fast instructions.
1072+ *
1073+ * On entry to the hook, *total contains a default estimate for the
1074+ * cost of the expression. The hook should modify this value as
1075+ * necessary. Traditionally, the default costs are COSTS_N_INSNS (5)
1076+ * for multiplications, COSTS_N_INSNS (7) for division and modulus
1077+ * operations, and COSTS_N_INSNS (1) for all other operations.
1078+ *
1079+ * When optimizing for code size, i.e. when optimize_size is non-zero,
1080+ * this target hook should be used to estimate the relative size cost
1081+ * of an expression, again relative to COSTS_N_INSNS.
1082+ *
1083+ * The hook returns true when all subexpressions of x have been
1084+ * processed, and false when rtx_cost should recurse.
1085+ */
1086+
1087+/* Worker routine for avr32_rtx_costs. */
1088+static inline int
1089+avr32_rtx_costs_1 (rtx x, enum rtx_code code ATTRIBUTE_UNUSED,
1090+ enum rtx_code outer ATTRIBUTE_UNUSED)
1091+{
1092+ enum machine_mode mode = GET_MODE (x);
1093+
1094+ switch (GET_CODE (x))
1095+ {
1096+ case MEM:
1097+ /* Using pre decrement / post increment memory operations on the
1098+ avr32_uc architecture means that two writebacks must be performed
1099+ and hence two cycles are needed. */
1100+ if (!optimize_size
1101+ && GET_MODE_SIZE (mode) <= 2 * UNITS_PER_WORD
1102+ && avr32_arch->arch_type == ARCH_TYPE_AVR32_UC
1103+ && (GET_CODE (XEXP (x, 0)) == PRE_DEC
1104+ || GET_CODE (XEXP (x, 0)) == POST_INC))
1105+ return COSTS_N_INSNS (4);
1106+
1107+ /* Memory costs quite a lot for the first word, but subsequent words
1108+ load at the equivalent of a single insn each. */
1109+ if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
1110+ return COSTS_N_INSNS (2 + (GET_MODE_SIZE (mode) / UNITS_PER_WORD));
1111+
1112+ return COSTS_N_INSNS (3);
1113+ case SYMBOL_REF:
1114+ case CONST:
1115+ /* These are valid for the pseudo insns: lda.w and call which operates
1116+ on direct addresses. We assume that the cost of a lda.w is the same
1117+ as the cost of a ld.w insn. */
1118+ return (outer == SET) ? COSTS_N_INSNS (3) : COSTS_N_INSNS (1);
1119+ case DIV:
1120+ case MOD:
1121+ case UDIV:
1122+ case UMOD:
1123+ return optimize_size ? COSTS_N_INSNS (1) : COSTS_N_INSNS (16);
1124+
1125+ case ROTATE:
1126+ case ROTATERT:
1127+ if (mode == TImode)
1128+ return COSTS_N_INSNS (100);
1129+
1130+ if (mode == DImode)
1131+ return COSTS_N_INSNS (10);
1132+ return COSTS_N_INSNS (4);
1133+ case ASHIFT:
1134+ case LSHIFTRT:
1135+ case ASHIFTRT:
1136+ case NOT:
1137+ if (mode == TImode)
1138+ return COSTS_N_INSNS (10);
1139+
1140+ if (mode == DImode)
1141+ return COSTS_N_INSNS (4);
1142+ return COSTS_N_INSNS (1);
1143+ case PLUS:
1144+ case MINUS:
1145+ case NEG:
1146+ case COMPARE:
1147+ case ABS:
1148+ if (GET_MODE_CLASS (mode) == MODE_FLOAT)
1149+ return COSTS_N_INSNS (100);
1150+
1151+ if (mode == TImode)
1152+ return COSTS_N_INSNS (50);
1153+
1154+ if (mode == DImode)
1155+ return COSTS_N_INSNS (2);
1156+ return COSTS_N_INSNS (1);
1157+
1158+ case MULT:
1159+ {
1160+ if (GET_MODE_CLASS (mode) == MODE_FLOAT)
1161+ return COSTS_N_INSNS (300);
1162+
1163+ if (mode == TImode)
1164+ return COSTS_N_INSNS (16);
1165+
1166+ if (mode == DImode)
1167+ return COSTS_N_INSNS (4);
1168+
1169+ if (mode == HImode)
1170+ return COSTS_N_INSNS (2);
1171+
1172+ return COSTS_N_INSNS (3);
1173+ }
1174+ case IF_THEN_ELSE:
1175+ if (GET_CODE (XEXP (x, 1)) == PC || GET_CODE (XEXP (x, 2)) == PC)
1176+ return COSTS_N_INSNS (4);
1177+ return COSTS_N_INSNS (1);
1178+ case SIGN_EXTEND:
1179+ case ZERO_EXTEND:
1180+ /* Sign/Zero extensions of registers cost quite much since these
1181+ instrcutions only take one register operand which means that gcc
1182+ often must insert some move instrcutions */
1183+ if (mode == QImode || mode == HImode)
1184+ return (COSTS_N_INSNS (GET_CODE (XEXP (x, 0)) == MEM ? 0 : 1));
1185+ return COSTS_N_INSNS (4);
1186+ case UNSPEC:
1187+ /* divmod operations */
1188+ if (XINT (x, 1) == UNSPEC_UDIVMODSI4_INTERNAL
1189+ || XINT (x, 1) == UNSPEC_DIVMODSI4_INTERNAL)
1190+ {
1191+ return optimize_size ? COSTS_N_INSNS (1) : COSTS_N_INSNS (16);
1192+ }
1193+ /* Fallthrough */
1194+ default:
1195+ return COSTS_N_INSNS (1);
1196+ }
1197+}
1198+
1199+static bool
1200+avr32_rtx_costs (rtx x, int code, int outer_code, int *total)
1201+{
1202+ *total = avr32_rtx_costs_1 (x, code, outer_code);
1203+ return true;
1204+}
1205+
1206+
1207+bool
1208+avr32_cannot_force_const_mem (rtx x ATTRIBUTE_UNUSED)
1209+{
1210+ /* Do not want symbols in the constant pool when compiling pic or if using
1211+ address pseudo instructions. */
1212+ return ((flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS)
1213+ && avr32_find_symbol (x) != NULL_RTX);
1214+}
1215+
1216+
1217+/* Table of machine attributes. */
1218+const struct attribute_spec avr32_attribute_table[] = {
1219+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
1220+ /* Interrupt Service Routines have special prologue and epilogue
1221+ requirements. */
1222+ {"isr", 0, 1, false, false, false, avr32_handle_isr_attribute},
1223+ {"interrupt", 0, 1, false, false, false, avr32_handle_isr_attribute},
1224+ {"acall", 0, 1, false, true, true, avr32_handle_acall_attribute},
1225+ {"naked", 0, 0, true, false, false, avr32_handle_fndecl_attribute},
1226+ {NULL, 0, 0, false, false, false, NULL}
1227+};
1228+
1229+
1230+typedef struct
1231+{
1232+ const char *const arg;
1233+ const unsigned long return_value;
1234+}
1235+isr_attribute_arg;
1236+
1237+static const isr_attribute_arg isr_attribute_args[] = {
1238+ {"FULL", AVR32_FT_ISR_FULL},
1239+ {"full", AVR32_FT_ISR_FULL},
1240+ {"HALF", AVR32_FT_ISR_HALF},
1241+ {"half", AVR32_FT_ISR_HALF},
1242+ {"NONE", AVR32_FT_ISR_NONE},
1243+ {"none", AVR32_FT_ISR_NONE},
1244+ {"UNDEF", AVR32_FT_ISR_NONE},
1245+ {"undef", AVR32_FT_ISR_NONE},
1246+ {"SWI", AVR32_FT_ISR_NONE},
1247+ {"swi", AVR32_FT_ISR_NONE},
1248+ {NULL, AVR32_FT_ISR_NONE}
1249+};
1250+
1251+/* Returns the (interrupt) function type of the current
1252+ function, or AVR32_FT_UNKNOWN if the type cannot be determined. */
1253+
1254+static unsigned long
1255+avr32_isr_value (tree argument)
1256+{
1257+ const isr_attribute_arg *ptr;
1258+ const char *arg;
1259+
1260+ /* No argument - default to ISR_NONE. */
1261+ if (argument == NULL_TREE)
1262+ return AVR32_FT_ISR_NONE;
1263+
1264+ /* Get the value of the argument. */
1265+ if (TREE_VALUE (argument) == NULL_TREE
1266+ || TREE_CODE (TREE_VALUE (argument)) != STRING_CST)
1267+ return AVR32_FT_UNKNOWN;
1268+
1269+ arg = TREE_STRING_POINTER (TREE_VALUE (argument));
1270+
1271+ /* Check it against the list of known arguments. */
1272+ for (ptr = isr_attribute_args; ptr->arg != NULL; ptr++)
1273+ if (streq (arg, ptr->arg))
1274+ return ptr->return_value;
1275+
1276+ /* An unrecognized interrupt type. */
1277+ return AVR32_FT_UNKNOWN;
1278+}
1279+
1280+
1281+
1282+/*
1283+These hooks specify assembly directives for creating certain kinds
1284+of integer object. The TARGET_ASM_BYTE_OP directive creates a
1285+byte-sized object, the TARGET_ASM_ALIGNED_HI_OP one creates an
1286+aligned two-byte object, and so on. Any of the hooks may be
1287+NULL, indicating that no suitable directive is available.
1288+
1289+The compiler will print these strings at the start of a new line,
1290+followed immediately by the object's initial value. In most cases,
1291+the string should contain a tab, a pseudo-op, and then another tab.
1292+*/
1293+#undef TARGET_ASM_BYTE_OP
1294+#define TARGET_ASM_BYTE_OP "\t.byte\t"
1295+#undef TARGET_ASM_ALIGNED_HI_OP
1296+#define TARGET_ASM_ALIGNED_HI_OP "\t.align 1\n\t.short\t"
1297+#undef TARGET_ASM_ALIGNED_SI_OP
1298+#define TARGET_ASM_ALIGNED_SI_OP "\t.align 2\n\t.int\t"
1299+#undef TARGET_ASM_ALIGNED_DI_OP
1300+#define TARGET_ASM_ALIGNED_DI_OP NULL
1301+#undef TARGET_ASM_ALIGNED_TI_OP
1302+#define TARGET_ASM_ALIGNED_TI_OP NULL
1303+#undef TARGET_ASM_UNALIGNED_HI_OP
1304+#define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t"
1305+#undef TARGET_ASM_UNALIGNED_SI_OP
1306+#define TARGET_ASM_UNALIGNED_SI_OP "\t.int\t"
1307+#undef TARGET_ASM_UNALIGNED_DI_OP
1308+#define TARGET_ASM_UNALIGNED_DI_OP NULL
1309+#undef TARGET_ASM_UNALIGNED_TI_OP
1310+#define TARGET_ASM_UNALIGNED_TI_OP NULL
1311+
1312+#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE
1313+#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE avr32_sched_use_dfa_pipeline_interface
1314+
1315+#undef TARGET_ASM_OUTPUT_MI_THUNK
1316+#define TARGET_ASM_OUTPUT_MI_THUNK avr32_output_mi_thunk
1317+
1318+
1319+static void
1320+avr32_output_mi_thunk (FILE * file,
1321+ tree thunk ATTRIBUTE_UNUSED,
1322+ HOST_WIDE_INT delta,
1323+ HOST_WIDE_INT vcall_offset, tree function)
1324+{
1325+ int mi_delta = delta;
1326+ int this_regno =
1327+ (avr32_return_in_memory (DECL_RESULT (function), TREE_TYPE (function)) ?
1328+ INTERNAL_REGNUM (11) : INTERNAL_REGNUM (12));
1329+
1330+
1331+ if (!avr32_const_ok_for_constraint_p (mi_delta, 'I', "Is21")
1332+ || vcall_offset)
1333+ {
1334+ fprintf (file, "\tpushm\tr10\n");
1335+ }
1336+
1337+
1338+ if (mi_delta != 0)
1339+ {
1340+ if (avr32_const_ok_for_constraint_p (mi_delta, 'I', "Is21"))
1341+ {
1342+ fprintf (file, "\tsub\t%s, -0x%x\n", reg_names[this_regno],
1343+ mi_delta);
1344+ }
1345+ else
1346+ {
1347+ /* Immediate is larger than k21 we must make us a temp register by
1348+ pushing a register to the stack. */
1349+ fprintf (file, "\tmov\tr10, lo(%x)\n", mi_delta);
1350+ fprintf (file, "\torh\tr10, hi(%x)\n", mi_delta);
1351+ fprintf (file, "\tadd\t%s, r10\n", reg_names[this_regno]);
1352+ }
1353+ }
1354+
1355+
1356+ if (vcall_offset != 0)
1357+ {
1358+ fprintf (file, "\tld.w\tr10, %s[0]\n", reg_names[this_regno]);
1359+ fprintf (file, "\tld.w\tr10, r10[%i]\n", (int) vcall_offset);
1360+ fprintf (file, "\tadd\t%s, r10\n", reg_names[this_regno]);
1361+ }
1362+
1363+
1364+ if (!avr32_const_ok_for_constraint_p (mi_delta, 'I', "Is21")
1365+ || vcall_offset)
1366+ {
1367+ fprintf (file, "\tpopm\tr10\n");
1368+ }
1369+
1370+ if (flag_pic)
1371+ {
1372+ /* Don't know how we should do this!!! For now we'll just use an
1373+ extended branch instruction and hope that the function will be
1374+ reached. */
1375+ fprintf (file, "\tbral\t");
1376+ assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
1377+ fputc ('\n', file);
1378+ }
1379+ else
1380+ {
1381+ fprintf (file, "\tlddpc\tpc, 0f\n");
1382+ fprintf (file, "\t.align 2\n");
1383+ fputs ("0:\t.long\t", file);
1384+ assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
1385+ fputc ('\n', file);
1386+ }
1387+}
1388+
1389+/* Implements target hook vector_mode_supported. */
1390+bool
1391+avr32_vector_mode_supported (enum machine_mode mode)
1392+{
1393+ if ((mode == V2HImode) || (mode == V4QImode))
1394+ return true;
1395+
1396+ return false;
1397+}
1398+
1399+
1400+#undef TARGET_INIT_LIBFUNCS
1401+#define TARGET_INIT_LIBFUNCS avr32_init_libfuncs
1402+
1403+#undef TARGET_INIT_BUILTINS
1404+#define TARGET_INIT_BUILTINS avr32_init_builtins
1405+
1406+#undef TARGET_EXPAND_BUILTIN
1407+#define TARGET_EXPAND_BUILTIN avr32_expand_builtin
1408+
1409+tree int_ftype_int, int_ftype_void, short_ftype_short, void_ftype_int_int,
1410+ void_ftype_ptr_int;
1411+tree void_ftype_int, void_ftype_void, int_ftype_ptr_int;
1412+tree short_ftype_short, int_ftype_int_short, int_ftype_short_short,
1413+ short_ftype_short_short;
1414+tree int_ftype_int_int, longlong_ftype_int_short, longlong_ftype_short_short;
1415+tree void_ftype_int_int_int_int_int, void_ftype_int_int_int;
1416+tree longlong_ftype_int_int, void_ftype_int_int_longlong;
1417+tree int_ftype_int_int_int, longlong_ftype_longlong_int_short;
1418+tree longlong_ftype_longlong_short_short, int_ftype_int_short_short;
1419+
1420+#define def_builtin(NAME, TYPE, CODE) \
1421+ lang_hooks.builtin_function ((NAME), (TYPE), (CODE), \
1422+ BUILT_IN_MD, NULL, NULL_TREE)
1423+
1424+#define def_mbuiltin(MASK, NAME, TYPE, CODE) \
1425+ do \
1426+ { \
1427+ if ((MASK)) \
1428+ lang_hooks.builtin_function ((NAME), (TYPE), (CODE), \
1429+ BUILT_IN_MD, NULL, NULL_TREE); \
1430+ } \
1431+ while (0)
1432+
1433+struct builtin_description
1434+{
1435+ const unsigned int mask;
1436+ const enum insn_code icode;
1437+ const char *const name;
1438+ const int code;
1439+ const enum rtx_code comparison;
1440+ const unsigned int flag;
1441+ const tree *ftype;
1442+};
1443+
1444+static const struct builtin_description bdesc_2arg[] = {
1445+#define DSP_BUILTIN(code, builtin, ftype) \
1446+ { 1, CODE_FOR_##code, "__builtin_" #code , \
1447+ AVR32_BUILTIN_##builtin, 0, 0, ftype }
1448+
1449+ DSP_BUILTIN (mulsathh_h, MULSATHH_H, &short_ftype_short_short),
1450+ DSP_BUILTIN (mulsathh_w, MULSATHH_W, &int_ftype_short_short),
1451+ DSP_BUILTIN (mulsatrndhh_h, MULSATRNDHH_H, &short_ftype_short_short),
1452+ DSP_BUILTIN (mulsatrndwh_w, MULSATRNDWH_W, &int_ftype_int_short),
1453+ DSP_BUILTIN (mulsatwh_w, MULSATWH_W, &int_ftype_int_short),
1454+ DSP_BUILTIN (satadd_h, SATADD_H, &short_ftype_short_short),
1455+ DSP_BUILTIN (satsub_h, SATSUB_H, &short_ftype_short_short),
1456+ DSP_BUILTIN (satadd_w, SATADD_W, &int_ftype_int_int),
1457+ DSP_BUILTIN (satsub_w, SATSUB_W, &int_ftype_int_int),
1458+ DSP_BUILTIN (mulwh_d, MULWH_D, &longlong_ftype_int_short),
1459+ DSP_BUILTIN (mulnwh_d, MULNWH_D, &longlong_ftype_int_short)
1460+};
1461+
1462+
1463+void
1464+avr32_init_builtins (void)
1465+{
1466+ unsigned int i;
1467+ const struct builtin_description *d;
1468+ tree endlink = void_list_node;
1469+ tree int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
1470+ tree longlong_endlink =
1471+ tree_cons (NULL_TREE, long_long_integer_type_node, endlink);
1472+ tree short_endlink =
1473+ tree_cons (NULL_TREE, short_integer_type_node, endlink);
1474+ tree void_endlink = tree_cons (NULL_TREE, void_type_node, endlink);
1475+
1476+ /* int func (int) */
1477+ int_ftype_int = build_function_type (integer_type_node, int_endlink);
1478+
1479+ /* short func (short) */
1480+ short_ftype_short
1481+ = build_function_type (short_integer_type_node, short_endlink);
1482+
1483+ /* short func (short, short) */
1484+ short_ftype_short_short
1485+ = build_function_type (short_integer_type_node,
1486+ tree_cons (NULL_TREE, short_integer_type_node,
1487+ short_endlink));
1488+
1489+ /* long long func (long long, short, short) */
1490+ longlong_ftype_longlong_short_short
1491+ = build_function_type (long_long_integer_type_node,
1492+ tree_cons (NULL_TREE, long_long_integer_type_node,
1493+ tree_cons (NULL_TREE,
1494+ short_integer_type_node,
1495+ short_endlink)));
1496+
1497+ /* long long func (short, short) */
1498+ longlong_ftype_short_short
1499+ = build_function_type (long_long_integer_type_node,
1500+ tree_cons (NULL_TREE, short_integer_type_node,
1501+ short_endlink));
1502+
1503+ /* int func (int, int) */
1504+ int_ftype_int_int
1505+ = build_function_type (integer_type_node,
1506+ tree_cons (NULL_TREE, integer_type_node,
1507+ int_endlink));
1508+
1509+ /* long long func (int, int) */
1510+ longlong_ftype_int_int
1511+ = build_function_type (long_long_integer_type_node,
1512+ tree_cons (NULL_TREE, integer_type_node,
1513+ int_endlink));
1514+
1515+ /* long long int func (long long, int, short) */
1516+ longlong_ftype_longlong_int_short
1517+ = build_function_type (long_long_integer_type_node,
1518+ tree_cons (NULL_TREE, long_long_integer_type_node,
1519+ tree_cons (NULL_TREE, integer_type_node,
1520+ short_endlink)));
1521+
1522+ /* long long int func (int, short) */
1523+ longlong_ftype_int_short
1524+ = build_function_type (long_long_integer_type_node,
1525+ tree_cons (NULL_TREE, integer_type_node,
1526+ short_endlink));
1527+
1528+ /* int func (int, short, short) */
1529+ int_ftype_int_short_short
1530+ = build_function_type (integer_type_node,
1531+ tree_cons (NULL_TREE, integer_type_node,
1532+ tree_cons (NULL_TREE,
1533+ short_integer_type_node,
1534+ short_endlink)));
1535+
1536+ /* int func (short, short) */
1537+ int_ftype_short_short
1538+ = build_function_type (integer_type_node,
1539+ tree_cons (NULL_TREE, short_integer_type_node,
1540+ short_endlink));
1541+
1542+ /* int func (int, short) */
1543+ int_ftype_int_short
1544+ = build_function_type (integer_type_node,
1545+ tree_cons (NULL_TREE, integer_type_node,
1546+ short_endlink));
1547+
1548+ /* void func (int, int) */
1549+ void_ftype_int_int
1550+ = build_function_type (void_type_node,
1551+ tree_cons (NULL_TREE, integer_type_node,
1552+ int_endlink));
1553+
1554+ /* void func (int, int, int) */
1555+ void_ftype_int_int_int
1556+ = build_function_type (void_type_node,
1557+ tree_cons (NULL_TREE, integer_type_node,
1558+ tree_cons (NULL_TREE, integer_type_node,
1559+ int_endlink)));
1560+
1561+ /* void func (int, int, long long) */
1562+ void_ftype_int_int_longlong
1563+ = build_function_type (void_type_node,
1564+ tree_cons (NULL_TREE, integer_type_node,
1565+ tree_cons (NULL_TREE, integer_type_node,
1566+ longlong_endlink)));
1567+
1568+ /* void func (int, int, int, int, int) */
1569+ void_ftype_int_int_int_int_int
1570+ = build_function_type (void_type_node,
1571+ tree_cons (NULL_TREE, integer_type_node,
1572+ tree_cons (NULL_TREE, integer_type_node,
1573+ tree_cons (NULL_TREE,
1574+ integer_type_node,
1575+ tree_cons
1576+ (NULL_TREE,
1577+ integer_type_node,
1578+ int_endlink)))));
1579+
1580+ /* void func (void *, int) */
1581+ void_ftype_ptr_int
1582+ = build_function_type (void_type_node,
1583+ tree_cons (NULL_TREE, ptr_type_node, int_endlink));
1584+
1585+ /* void func (int) */
1586+ void_ftype_int = build_function_type (void_type_node, int_endlink);
1587+
1588+ /* void func (void) */
1589+ void_ftype_void = build_function_type (void_type_node, void_endlink);
1590+
1591+ /* int func (void) */
1592+ int_ftype_void = build_function_type (integer_type_node, void_endlink);
1593+
1594+ /* int func (void *, int) */
1595+ int_ftype_ptr_int
1596+ = build_function_type (integer_type_node,
1597+ tree_cons (NULL_TREE, ptr_type_node, int_endlink));
1598+
1599+ /* int func (int, int, int) */
1600+ int_ftype_int_int_int
1601+ = build_function_type (integer_type_node,
1602+ tree_cons (NULL_TREE, integer_type_node,
1603+ tree_cons (NULL_TREE, integer_type_node,
1604+ int_endlink)));
1605+
1606+ /* Initialize avr32 builtins. */
1607+ def_builtin ("__builtin_mfsr", int_ftype_int, AVR32_BUILTIN_MFSR);
1608+ def_builtin ("__builtin_mtsr", void_ftype_int_int, AVR32_BUILTIN_MTSR);
1609+ def_builtin ("__builtin_mfdr", int_ftype_int, AVR32_BUILTIN_MFDR);
1610+ def_builtin ("__builtin_mtdr", void_ftype_int_int, AVR32_BUILTIN_MTDR);
1611+ def_builtin ("__builtin_cache", void_ftype_ptr_int, AVR32_BUILTIN_CACHE);
1612+ def_builtin ("__builtin_sync", void_ftype_int, AVR32_BUILTIN_SYNC);
1613+ def_builtin ("__builtin_tlbr", void_ftype_void, AVR32_BUILTIN_TLBR);
1614+ def_builtin ("__builtin_tlbs", void_ftype_void, AVR32_BUILTIN_TLBS);
1615+ def_builtin ("__builtin_tlbw", void_ftype_void, AVR32_BUILTIN_TLBW);
1616+ def_builtin ("__builtin_breakpoint", void_ftype_void,
1617+ AVR32_BUILTIN_BREAKPOINT);
1618+ def_builtin ("__builtin_xchg", int_ftype_ptr_int, AVR32_BUILTIN_XCHG);
1619+ def_builtin ("__builtin_ldxi", int_ftype_ptr_int, AVR32_BUILTIN_LDXI);
1620+ def_builtin ("__builtin_bswap_16", short_ftype_short,
1621+ AVR32_BUILTIN_BSWAP16);
1622+ def_builtin ("__builtin_bswap_32", int_ftype_int, AVR32_BUILTIN_BSWAP32);
1623+ def_builtin ("__builtin_cop", void_ftype_int_int_int_int_int,
1624+ AVR32_BUILTIN_COP);
1625+ def_builtin ("__builtin_mvcr_w", int_ftype_int_int, AVR32_BUILTIN_MVCR_W);
1626+ def_builtin ("__builtin_mvrc_w", void_ftype_int_int_int,
1627+ AVR32_BUILTIN_MVRC_W);
1628+ def_builtin ("__builtin_mvcr_d", longlong_ftype_int_int,
1629+ AVR32_BUILTIN_MVCR_D);
1630+ def_builtin ("__builtin_mvrc_d", void_ftype_int_int_longlong,
1631+ AVR32_BUILTIN_MVRC_D);
1632+ def_builtin ("__builtin_sats", int_ftype_int_int_int, AVR32_BUILTIN_SATS);
1633+ def_builtin ("__builtin_satu", int_ftype_int_int_int, AVR32_BUILTIN_SATU);
1634+ def_builtin ("__builtin_satrnds", int_ftype_int_int_int,
1635+ AVR32_BUILTIN_SATRNDS);
1636+ def_builtin ("__builtin_satrndu", int_ftype_int_int_int,
1637+ AVR32_BUILTIN_SATRNDU);
1638+ def_builtin ("__builtin_musfr", void_ftype_int, AVR32_BUILTIN_MUSFR);
1639+ def_builtin ("__builtin_mustr", int_ftype_void, AVR32_BUILTIN_MUSTR);
1640+ def_builtin ("__builtin_macsathh_w", int_ftype_int_short_short,
1641+ AVR32_BUILTIN_MACSATHH_W);
1642+ def_builtin ("__builtin_macwh_d", longlong_ftype_longlong_int_short,
1643+ AVR32_BUILTIN_MACWH_D);
1644+ def_builtin ("__builtin_machh_d", longlong_ftype_longlong_short_short,
1645+ AVR32_BUILTIN_MACHH_D);
1646+
1647+ /* Add all builtins that are more or less simple operations on two
1648+ operands. */
1649+ for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
1650+ {
1651+ /* Use one of the operands; the target can have a different mode for
1652+ mask-generating compares. */
1653+
1654+ if (d->name == 0)
1655+ continue;
1656+
1657+ def_mbuiltin (d->mask, d->name, *(d->ftype), d->code);
1658+ }
1659+}
1660+
1661+
1662+/* Subroutine of avr32_expand_builtin to take care of binop insns. */
1663+
1664+static rtx
1665+avr32_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
1666+{
1667+ rtx pat;
1668+ tree arg0 = TREE_VALUE (arglist);
1669+ tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1670+ rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1671+ rtx op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1672+ enum machine_mode tmode = insn_data[icode].operand[0].mode;
1673+ enum machine_mode mode0 = insn_data[icode].operand[1].mode;
1674+ enum machine_mode mode1 = insn_data[icode].operand[2].mode;
1675+
1676+ if (!target
1677+ || GET_MODE (target) != tmode
1678+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1679+ target = gen_reg_rtx (tmode);
1680+
1681+ /* In case the insn wants input operands in modes different from the
1682+ result, abort. */
1683+ if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1684+ {
1685+ /* If op0 is already a reg we must cast it to the correct mode. */
1686+ if (REG_P (op0))
1687+ op0 = convert_to_mode (mode0, op0, 1);
1688+ else
1689+ op0 = copy_to_mode_reg (mode0, op0);
1690+ }
1691+ if (!(*insn_data[icode].operand[2].predicate) (op1, mode1))
1692+ {
1693+ /* If op1 is already a reg we must cast it to the correct mode. */
1694+ if (REG_P (op1))
1695+ op1 = convert_to_mode (mode1, op1, 1);
1696+ else
1697+ op1 = copy_to_mode_reg (mode1, op1);
1698+ }
1699+ pat = GEN_FCN (icode) (target, op0, op1);
1700+ if (!pat)
1701+ return 0;
1702+ emit_insn (pat);
1703+ return target;
1704+}
1705+
1706+/* Expand an expression EXP that calls a built-in function,
1707+ with result going to TARGET if that's convenient
1708+ (and in mode MODE if that's convenient).
1709+ SUBTARGET may be used as the target for computing one of EXP's operands.
1710+ IGNORE is nonzero if the value is to be ignored. */
1711+
1712+rtx
1713+avr32_expand_builtin (tree exp,
1714+ rtx target,
1715+ rtx subtarget ATTRIBUTE_UNUSED,
1716+ enum machine_mode mode ATTRIBUTE_UNUSED,
1717+ int ignore ATTRIBUTE_UNUSED)
1718+{
1719+ const struct builtin_description *d;
1720+ unsigned int i;
1721+ enum insn_code icode;
1722+ tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
1723+ tree arglist = TREE_OPERAND (exp, 1);
1724+ tree arg0, arg1, arg2;
1725+ rtx op0, op1, op2, pat;
1726+ enum machine_mode tmode, mode0, mode1;
1727+ enum machine_mode arg0_mode;
1728+ int fcode = DECL_FUNCTION_CODE (fndecl);
1729+
1730+ switch (fcode)
1731+ {
1732+ default:
1733+ break;
1734+
1735+ case AVR32_BUILTIN_SATS:
1736+ case AVR32_BUILTIN_SATU:
1737+ case AVR32_BUILTIN_SATRNDS:
1738+ case AVR32_BUILTIN_SATRNDU:
1739+ {
1740+ const char *fname;
1741+ switch (fcode)
1742+ {
1743+ default:
1744+ case AVR32_BUILTIN_SATS:
1745+ icode = CODE_FOR_sats;
1746+ fname = "sats";
1747+ break;
1748+ case AVR32_BUILTIN_SATU:
1749+ icode = CODE_FOR_satu;
1750+ fname = "satu";
1751+ break;
1752+ case AVR32_BUILTIN_SATRNDS:
1753+ icode = CODE_FOR_satrnds;
1754+ fname = "satrnds";
1755+ break;
1756+ case AVR32_BUILTIN_SATRNDU:
1757+ icode = CODE_FOR_satrndu;
1758+ fname = "satrndu";
1759+ break;
1760+ }
1761+
1762+ arg0 = TREE_VALUE (arglist);
1763+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1764+ arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
1765+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1766+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1767+ op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
1768+
1769+ tmode = insn_data[icode].operand[0].mode;
1770+
1771+
1772+ if (target == 0
1773+ || GET_MODE (target) != tmode
1774+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1775+ target = gen_reg_rtx (tmode);
1776+
1777+
1778+ if (!(*insn_data[icode].operand[0].predicate) (op0, GET_MODE (op0)))
1779+ {
1780+ op0 = copy_to_mode_reg (insn_data[icode].operand[0].mode, op0);
1781+ }
1782+
1783+ if (!(*insn_data[icode].operand[1].predicate) (op1, SImode))
1784+ {
1785+ error ("Parameter 2 to __builtin_%s should be a constant number.",
1786+ fname);
1787+ return NULL_RTX;
1788+ }
1789+
1790+ if (!(*insn_data[icode].operand[1].predicate) (op2, SImode))
1791+ {
1792+ error ("Parameter 3 to __builtin_%s should be a constant number.",
1793+ fname);
1794+ return NULL_RTX;
1795+ }
1796+
1797+ emit_move_insn (target, op0);
1798+ pat = GEN_FCN (icode) (target, op1, op2);
1799+ if (!pat)
1800+ return 0;
1801+ emit_insn (pat);
1802+
1803+ return target;
1804+ }
1805+ case AVR32_BUILTIN_MUSTR:
1806+ icode = CODE_FOR_mustr;
1807+ tmode = insn_data[icode].operand[0].mode;
1808+
1809+ if (target == 0
1810+ || GET_MODE (target) != tmode
1811+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1812+ target = gen_reg_rtx (tmode);
1813+ pat = GEN_FCN (icode) (target);
1814+ if (!pat)
1815+ return 0;
1816+ emit_insn (pat);
1817+ return target;
1818+
1819+ case AVR32_BUILTIN_MFSR:
1820+ icode = CODE_FOR_mfsr;
1821+ arg0 = TREE_VALUE (arglist);
1822+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1823+ tmode = insn_data[icode].operand[0].mode;
1824+ mode0 = insn_data[icode].operand[1].mode;
1825+
1826+ if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1827+ {
1828+ error ("Parameter 1 to __builtin_mfsr must be a constant number");
1829+ }
1830+
1831+ if (target == 0
1832+ || GET_MODE (target) != tmode
1833+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1834+ target = gen_reg_rtx (tmode);
1835+ pat = GEN_FCN (icode) (target, op0);
1836+ if (!pat)
1837+ return 0;
1838+ emit_insn (pat);
1839+ return target;
1840+ case AVR32_BUILTIN_MTSR:
1841+ icode = CODE_FOR_mtsr;
1842+ arg0 = TREE_VALUE (arglist);
1843+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1844+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1845+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1846+ mode0 = insn_data[icode].operand[0].mode;
1847+ mode1 = insn_data[icode].operand[1].mode;
1848+
1849+ if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1850+ {
1851+ error ("Parameter 1 to __builtin_mtsr must be a constant number");
1852+ return gen_reg_rtx (mode0);
1853+ }
1854+ if (!(*insn_data[icode].operand[1].predicate) (op1, mode1))
1855+ op1 = copy_to_mode_reg (mode1, op1);
1856+ pat = GEN_FCN (icode) (op0, op1);
1857+ if (!pat)
1858+ return 0;
1859+ emit_insn (pat);
1860+ return NULL_RTX;
1861+ case AVR32_BUILTIN_MFDR:
1862+ icode = CODE_FOR_mfdr;
1863+ arg0 = TREE_VALUE (arglist);
1864+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1865+ tmode = insn_data[icode].operand[0].mode;
1866+ mode0 = insn_data[icode].operand[1].mode;
1867+
1868+ if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
1869+ {
1870+ error ("Parameter 1 to __builtin_mfdr must be a constant number");
1871+ }
1872+
1873+ if (target == 0
1874+ || GET_MODE (target) != tmode
1875+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
1876+ target = gen_reg_rtx (tmode);
1877+ pat = GEN_FCN (icode) (target, op0);
1878+ if (!pat)
1879+ return 0;
1880+ emit_insn (pat);
1881+ return target;
1882+ case AVR32_BUILTIN_MTDR:
1883+ icode = CODE_FOR_mtdr;
1884+ arg0 = TREE_VALUE (arglist);
1885+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1886+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1887+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1888+ mode0 = insn_data[icode].operand[0].mode;
1889+ mode1 = insn_data[icode].operand[1].mode;
1890+
1891+ if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1892+ {
1893+ error ("Parameter 1 to __builtin_mtdr must be a constant number");
1894+ return gen_reg_rtx (mode0);
1895+ }
1896+ if (!(*insn_data[icode].operand[1].predicate) (op1, mode1))
1897+ op1 = copy_to_mode_reg (mode1, op1);
1898+ pat = GEN_FCN (icode) (op0, op1);
1899+ if (!pat)
1900+ return 0;
1901+ emit_insn (pat);
1902+ return NULL_RTX;
1903+ case AVR32_BUILTIN_CACHE:
1904+ icode = CODE_FOR_cache;
1905+ arg0 = TREE_VALUE (arglist);
1906+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1907+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1908+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1909+ mode0 = insn_data[icode].operand[0].mode;
1910+ mode1 = insn_data[icode].operand[1].mode;
1911+
1912+ if (!(*insn_data[icode].operand[1].predicate) (op1, mode1))
1913+ {
1914+ error ("Parameter 2 to __builtin_cache must be a constant number");
1915+ return gen_reg_rtx (mode1);
1916+ }
1917+
1918+ if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1919+ op0 = copy_to_mode_reg (mode0, op0);
1920+
1921+ pat = GEN_FCN (icode) (op0, op1);
1922+ if (!pat)
1923+ return 0;
1924+ emit_insn (pat);
1925+ return NULL_RTX;
1926+ case AVR32_BUILTIN_SYNC:
1927+ case AVR32_BUILTIN_MUSFR:
1928+ {
1929+ const char *fname;
1930+ switch (fcode)
1931+ {
1932+ default:
1933+ case AVR32_BUILTIN_SYNC:
1934+ icode = CODE_FOR_sync;
1935+ fname = "sync";
1936+ break;
1937+ case AVR32_BUILTIN_MUSFR:
1938+ icode = CODE_FOR_musfr;
1939+ fname = "musfr";
1940+ break;
1941+ }
1942+
1943+ arg0 = TREE_VALUE (arglist);
1944+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1945+ mode0 = insn_data[icode].operand[0].mode;
1946+
1947+ if (!(*insn_data[icode].operand[0].predicate) (op0, mode0))
1948+ {
1949+ if (icode == CODE_FOR_musfr)
1950+ op0 = copy_to_mode_reg (mode0, op0);
1951+ else
1952+ {
1953+ error ("Parameter to __builtin_%s is illegal.", fname);
1954+ return gen_reg_rtx (mode0);
1955+ }
1956+ }
1957+ pat = GEN_FCN (icode) (op0);
1958+ if (!pat)
1959+ return 0;
1960+ emit_insn (pat);
1961+ return NULL_RTX;
1962+ }
1963+ case AVR32_BUILTIN_TLBR:
1964+ icode = CODE_FOR_tlbr;
1965+ pat = GEN_FCN (icode) (NULL_RTX);
1966+ if (!pat)
1967+ return 0;
1968+ emit_insn (pat);
1969+ return NULL_RTX;
1970+ case AVR32_BUILTIN_TLBS:
1971+ icode = CODE_FOR_tlbs;
1972+ pat = GEN_FCN (icode) (NULL_RTX);
1973+ if (!pat)
1974+ return 0;
1975+ emit_insn (pat);
1976+ return NULL_RTX;
1977+ case AVR32_BUILTIN_TLBW:
1978+ icode = CODE_FOR_tlbw;
1979+ pat = GEN_FCN (icode) (NULL_RTX);
1980+ if (!pat)
1981+ return 0;
1982+ emit_insn (pat);
1983+ return NULL_RTX;
1984+ case AVR32_BUILTIN_BREAKPOINT:
1985+ icode = CODE_FOR_breakpoint;
1986+ pat = GEN_FCN (icode) (NULL_RTX);
1987+ if (!pat)
1988+ return 0;
1989+ emit_insn (pat);
1990+ return NULL_RTX;
1991+ case AVR32_BUILTIN_XCHG:
1992+ icode = CODE_FOR_xchg;
1993+ arg0 = TREE_VALUE (arglist);
1994+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
1995+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
1996+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
1997+ tmode = insn_data[icode].operand[0].mode;
1998+ mode0 = insn_data[icode].operand[1].mode;
1999+ mode1 = insn_data[icode].operand[3].mode;
2000+
2001+ if (!(*insn_data[icode].operand[3].predicate) (op1, mode1))
2002+ {
2003+ op1 = copy_to_mode_reg (mode1, op1);
2004+ }
2005+
2006+ if (!(*insn_data[icode].operand[2].predicate) (op0, mode0))
2007+ {
2008+ op0 = copy_to_mode_reg (mode0, op0);
2009+ }
2010+
2011+ if (target == 0
2012+ || GET_MODE (target) != tmode
2013+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
2014+ target = gen_reg_rtx (tmode);
2015+ pat = GEN_FCN (icode) (target, op0, op0, op1);
2016+ if (!pat)
2017+ return 0;
2018+ emit_insn (pat);
2019+ return target;
2020+ case AVR32_BUILTIN_LDXI:
2021+ icode = CODE_FOR_ldxi;
2022+ arg0 = TREE_VALUE (arglist);
2023+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
2024+ arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
2025+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
2026+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
2027+ op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
2028+ tmode = insn_data[icode].operand[0].mode;
2029+ mode0 = insn_data[icode].operand[1].mode;
2030+ mode1 = insn_data[icode].operand[2].mode;
2031+
2032+ if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
2033+ {
2034+ op0 = copy_to_mode_reg (mode0, op0);
2035+ }
2036+
2037+ if (!(*insn_data[icode].operand[2].predicate) (op1, mode1))
2038+ {
2039+ op1 = copy_to_mode_reg (mode1, op1);
2040+ }
2041+
2042+ if (!(*insn_data[icode].operand[3].predicate) (op2, SImode))
2043+ {
2044+ error
2045+ ("Parameter 3 to __builtin_ldxi must be a valid extract shift operand: (0|8|16|24)");
2046+ return gen_reg_rtx (mode0);
2047+ }
2048+
2049+ if (target == 0
2050+ || GET_MODE (target) != tmode
2051+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
2052+ target = gen_reg_rtx (tmode);
2053+ pat = GEN_FCN (icode) (target, op0, op1, op2);
2054+ if (!pat)
2055+ return 0;
2056+ emit_insn (pat);
2057+ return target;
2058+ case AVR32_BUILTIN_BSWAP16:
2059+ {
2060+ icode = CODE_FOR_bswap_16;
2061+ arg0 = TREE_VALUE (arglist);
2062+ arg0_mode = TYPE_MODE (TREE_TYPE (arg0));
2063+ mode0 = insn_data[icode].operand[1].mode;
2064+ if (arg0_mode != mode0)
2065+ arg0 = build1 (NOP_EXPR,
2066+ (*lang_hooks.types.type_for_mode) (mode0, 0), arg0);
2067+
2068+ op0 = expand_expr (arg0, NULL_RTX, HImode, 0);
2069+ tmode = insn_data[icode].operand[0].mode;
2070+
2071+
2072+ if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
2073+ {
2074+ op0 = copy_to_mode_reg (mode0, op0);
2075+ }
2076+
2077+ if (target == 0
2078+ || GET_MODE (target) != tmode
2079+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
2080+ {
2081+ target = gen_reg_rtx (tmode);
2082+ }
2083+
2084+
2085+ pat = GEN_FCN (icode) (target, op0);
2086+ if (!pat)
2087+ return 0;
2088+ emit_insn (pat);
2089+
2090+ return target;
2091+ }
2092+ case AVR32_BUILTIN_BSWAP32:
2093+ {
2094+ icode = CODE_FOR_bswap_32;
2095+ arg0 = TREE_VALUE (arglist);
2096+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
2097+ tmode = insn_data[icode].operand[0].mode;
2098+ mode0 = insn_data[icode].operand[1].mode;
2099+
2100+ if (!(*insn_data[icode].operand[1].predicate) (op0, mode0))
2101+ {
2102+ op0 = copy_to_mode_reg (mode0, op0);
2103+ }
2104+
2105+ if (target == 0
2106+ || GET_MODE (target) != tmode
2107+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
2108+ target = gen_reg_rtx (tmode);
2109+
2110+
2111+ pat = GEN_FCN (icode) (target, op0);
2112+ if (!pat)
2113+ return 0;
2114+ emit_insn (pat);
2115+
2116+ return target;
2117+ }
2118+ case AVR32_BUILTIN_MVCR_W:
2119+ case AVR32_BUILTIN_MVCR_D:
2120+ {
2121+ arg0 = TREE_VALUE (arglist);
2122+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
2123+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
2124+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
2125+
2126+ if (fcode == AVR32_BUILTIN_MVCR_W)
2127+ icode = CODE_FOR_mvcrsi;
2128+ else
2129+ icode = CODE_FOR_mvcrdi;
2130+
2131+ tmode = insn_data[icode].operand[0].mode;
2132+
2133+ if (target == 0
2134+ || GET_MODE (target) != tmode
2135+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
2136+ target = gen_reg_rtx (tmode);
2137+
2138+ if (!(*insn_data[icode].operand[1].predicate) (op0, SImode))
2139+ {
2140+ error
2141+ ("Parameter 1 to __builtin_cop is not a valid coprocessor number.");
2142+ error ("Number should be between 0 and 7.");
2143+ return NULL_RTX;
2144+ }
2145+
2146+ if (!(*insn_data[icode].operand[2].predicate) (op1, SImode))
2147+ {
2148+ error
2149+ ("Parameter 2 to __builtin_cop is not a valid coprocessor register number.");
2150+ error ("Number should be between 0 and 15.");
2151+ return NULL_RTX;
2152+ }
2153+
2154+ pat = GEN_FCN (icode) (target, op0, op1);
2155+ if (!pat)
2156+ return 0;
2157+ emit_insn (pat);
2158+
2159+ return target;
2160+ }
2161+ case AVR32_BUILTIN_MACSATHH_W:
2162+ case AVR32_BUILTIN_MACWH_D:
2163+ case AVR32_BUILTIN_MACHH_D:
2164+ {
2165+ arg0 = TREE_VALUE (arglist);
2166+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
2167+ arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
2168+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
2169+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
2170+ op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
2171+
2172+ icode = ((fcode == AVR32_BUILTIN_MACSATHH_W) ? CODE_FOR_macsathh_w :
2173+ (fcode == AVR32_BUILTIN_MACWH_D) ? CODE_FOR_macwh_d :
2174+ CODE_FOR_machh_d);
2175+
2176+ tmode = insn_data[icode].operand[0].mode;
2177+ mode0 = insn_data[icode].operand[1].mode;
2178+ mode1 = insn_data[icode].operand[2].mode;
2179+
2180+
2181+ if (!target
2182+ || GET_MODE (target) != tmode
2183+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
2184+ target = gen_reg_rtx (tmode);
2185+
2186+ if (!(*insn_data[icode].operand[0].predicate) (op0, tmode))
2187+ {
2188+ /* If op0 is already a reg we must cast it to the correct mode. */
2189+ if (REG_P (op0))
2190+ op0 = convert_to_mode (tmode, op0, 1);
2191+ else
2192+ op0 = copy_to_mode_reg (tmode, op0);
2193+ }
2194+
2195+ if (!(*insn_data[icode].operand[1].predicate) (op1, mode0))
2196+ {
2197+ /* If op1 is already a reg we must cast it to the correct mode. */
2198+ if (REG_P (op1))
2199+ op1 = convert_to_mode (mode0, op1, 1);
2200+ else
2201+ op1 = copy_to_mode_reg (mode0, op1);
2202+ }
2203+
2204+ if (!(*insn_data[icode].operand[2].predicate) (op2, mode1))
2205+ {
2206+ /* If op1 is already a reg we must cast it to the correct mode. */
2207+ if (REG_P (op2))
2208+ op2 = convert_to_mode (mode1, op2, 1);
2209+ else
2210+ op2 = copy_to_mode_reg (mode1, op2);
2211+ }
2212+
2213+ emit_move_insn (target, op0);
2214+
2215+ pat = GEN_FCN (icode) (target, op1, op2);
2216+ if (!pat)
2217+ return 0;
2218+ emit_insn (pat);
2219+ return target;
2220+ }
2221+ case AVR32_BUILTIN_MVRC_W:
2222+ case AVR32_BUILTIN_MVRC_D:
2223+ {
2224+ arg0 = TREE_VALUE (arglist);
2225+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
2226+ arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
2227+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
2228+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
2229+ op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
2230+
2231+ if (fcode == AVR32_BUILTIN_MVRC_W)
2232+ icode = CODE_FOR_mvrcsi;
2233+ else
2234+ icode = CODE_FOR_mvrcdi;
2235+
2236+ if (!(*insn_data[icode].operand[0].predicate) (op0, SImode))
2237+ {
2238+ error ("Parameter 1 is not a valid coprocessor number.");
2239+ error ("Number should be between 0 and 7.");
2240+ return NULL_RTX;
2241+ }
2242+
2243+ if (!(*insn_data[icode].operand[1].predicate) (op1, SImode))
2244+ {
2245+ error ("Parameter 2 is not a valid coprocessor register number.");
2246+ error ("Number should be between 0 and 15.");
2247+ return NULL_RTX;
2248+ }
2249+
2250+ if (GET_CODE (op2) == CONST_INT
2251+ || GET_CODE (op2) == CONST
2252+ || GET_CODE (op2) == SYMBOL_REF || GET_CODE (op2) == LABEL_REF)
2253+ {
2254+ op2 = force_const_mem (insn_data[icode].operand[2].mode, op2);
2255+ }
2256+
2257+ if (!(*insn_data[icode].operand[2].predicate) (op2, GET_MODE (op2)))
2258+ op2 = copy_to_mode_reg (insn_data[icode].operand[2].mode, op2);
2259+
2260+
2261+ pat = GEN_FCN (icode) (op0, op1, op2);
2262+ if (!pat)
2263+ return 0;
2264+ emit_insn (pat);
2265+
2266+ return NULL_RTX;
2267+ }
2268+ case AVR32_BUILTIN_COP:
2269+ {
2270+ rtx op3, op4;
2271+ tree arg3, arg4;
2272+ icode = CODE_FOR_cop;
2273+ arg0 = TREE_VALUE (arglist);
2274+ arg1 = TREE_VALUE (TREE_CHAIN (arglist));
2275+ arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
2276+ arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist))));
2277+ arg4 =
2278+ TREE_VALUE (TREE_CHAIN
2279+ (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist)))));
2280+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
2281+ op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
2282+ op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
2283+ op3 = expand_expr (arg3, NULL_RTX, VOIDmode, 0);
2284+ op4 = expand_expr (arg4, NULL_RTX, VOIDmode, 0);
2285+
2286+ if (!(*insn_data[icode].operand[0].predicate) (op0, SImode))
2287+ {
2288+ error
2289+ ("Parameter 1 to __builtin_cop is not a valid coprocessor number.");
2290+ error ("Number should be between 0 and 7.");
2291+ return NULL_RTX;
2292+ }
2293+
2294+ if (!(*insn_data[icode].operand[1].predicate) (op1, SImode))
2295+ {
2296+ error
2297+ ("Parameter 2 to __builtin_cop is not a valid coprocessor register number.");
2298+ error ("Number should be between 0 and 15.");
2299+ return NULL_RTX;
2300+ }
2301+
2302+ if (!(*insn_data[icode].operand[2].predicate) (op2, SImode))
2303+ {
2304+ error
2305+ ("Parameter 3 to __builtin_cop is not a valid coprocessor register number.");
2306+ error ("Number should be between 0 and 15.");
2307+ return NULL_RTX;
2308+ }
2309+
2310+ if (!(*insn_data[icode].operand[3].predicate) (op3, SImode))
2311+ {
2312+ error
2313+ ("Parameter 4 to __builtin_cop is not a valid coprocessor register number.");
2314+ error ("Number should be between 0 and 15.");
2315+ return NULL_RTX;
2316+ }
2317+
2318+ if (!(*insn_data[icode].operand[4].predicate) (op4, SImode))
2319+ {
2320+ error
2321+ ("Parameter 5 to __builtin_cop is not a valid coprocessor operation.");
2322+ error ("Number should be between 0 and 127.");
2323+ return NULL_RTX;
2324+ }
2325+
2326+ pat = GEN_FCN (icode) (op0, op1, op2, op3, op4);
2327+ if (!pat)
2328+ return 0;
2329+ emit_insn (pat);
2330+
2331+ return target;
2332+ }
2333+ }
2334+
2335+ for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
2336+ if (d->code == fcode)
2337+ return avr32_expand_binop_builtin (d->icode, arglist, target);
2338+
2339+
2340+ /* @@@ Should really do something sensible here. */
2341+ return NULL_RTX;
2342+}
2343+
2344+
2345+/* Handle an "interrupt" or "isr" attribute;
2346+ arguments as in struct attribute_spec.handler. */
2347+
2348+static tree
2349+avr32_handle_isr_attribute (tree * node, tree name, tree args,
2350+ int flags, bool * no_add_attrs)
2351+{
2352+ if (DECL_P (*node))
2353+ {
2354+ if (TREE_CODE (*node) != FUNCTION_DECL)
2355+ {
2356+ warning ("`%s' attribute only applies to functions",
2357+ IDENTIFIER_POINTER (name));
2358+ *no_add_attrs = true;
2359+ }
2360+ /* FIXME: the argument if any is checked for type attributes; should it
2361+ be checked for decl ones? */
2362+ }
2363+ else
2364+ {
2365+ if (TREE_CODE (*node) == FUNCTION_TYPE
2366+ || TREE_CODE (*node) == METHOD_TYPE)
2367+ {
2368+ if (avr32_isr_value (args) == AVR32_FT_UNKNOWN)
2369+ {
2370+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
2371+ *no_add_attrs = true;
2372+ }
2373+ }
2374+ else if (TREE_CODE (*node) == POINTER_TYPE
2375+ && (TREE_CODE (TREE_TYPE (*node)) == FUNCTION_TYPE
2376+ || TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE)
2377+ && avr32_isr_value (args) != AVR32_FT_UNKNOWN)
2378+ {
2379+ *node = build_variant_type_copy (*node);
2380+ TREE_TYPE (*node) = build_type_attribute_variant
2381+ (TREE_TYPE (*node),
2382+ tree_cons (name, args, TYPE_ATTRIBUTES (TREE_TYPE (*node))));
2383+ *no_add_attrs = true;
2384+ }
2385+ else
2386+ {
2387+ /* Possibly pass this attribute on from the type to a decl. */
2388+ if (flags & ((int) ATTR_FLAG_DECL_NEXT
2389+ | (int) ATTR_FLAG_FUNCTION_NEXT
2390+ | (int) ATTR_FLAG_ARRAY_NEXT))
2391+ {
2392+ *no_add_attrs = true;
2393+ return tree_cons (name, args, NULL_TREE);
2394+ }
2395+ else
2396+ {
2397+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
2398+ }
2399+ }
2400+ }
2401+
2402+ return NULL_TREE;
2403+}
2404+
2405+/* Handle an attribute requiring a FUNCTION_DECL;
2406+ arguments as in struct attribute_spec.handler. */
2407+static tree
2408+avr32_handle_fndecl_attribute (tree * node, tree name,
2409+ tree args ATTRIBUTE_UNUSED,
2410+ int flags ATTRIBUTE_UNUSED,
2411+ bool * no_add_attrs)
2412+{
2413+ if (TREE_CODE (*node) != FUNCTION_DECL)
2414+ {
2415+ warning ("%qs attribute only applies to functions",
2416+ IDENTIFIER_POINTER (name));
2417+ *no_add_attrs = true;
2418+ }
2419+
2420+ return NULL_TREE;
2421+}
2422+
2423+
2424+/* Handle an acall attribute;
2425+ arguments as in struct attribute_spec.handler. */
2426+
2427+static tree
2428+avr32_handle_acall_attribute (tree * node, tree name,
2429+ tree args ATTRIBUTE_UNUSED,
2430+ int flags ATTRIBUTE_UNUSED, bool * no_add_attrs)
2431+{
2432+ if (TREE_CODE (*node) == FUNCTION_TYPE || TREE_CODE (*node) == METHOD_TYPE)
2433+ {
2434+ warning ("`%s' attribute not yet supported...",
2435+ IDENTIFIER_POINTER (name));
2436+ *no_add_attrs = true;
2437+ return NULL_TREE;
2438+ }
2439+
2440+ warning ("`%s' attribute only applies to functions",
2441+ IDENTIFIER_POINTER (name));
2442+ *no_add_attrs = true;
2443+ return NULL_TREE;
2444+}
2445+
2446+
2447+/* Return 0 if the attributes for two types are incompatible, 1 if they
2448+ are compatible, and 2 if they are nearly compatible (which causes a
2449+ warning to be generated). */
2450+
2451+static int
2452+avr32_comp_type_attributes (tree type1, tree type2)
2453+{
2454+ int acall1, acall2, isr1, isr2, naked1, naked2;
2455+
2456+ /* Check for mismatch of non-default calling convention. */
2457+ if (TREE_CODE (type1) != FUNCTION_TYPE)
2458+ return 1;
2459+
2460+ /* Check for mismatched call attributes. */
2461+ acall1 = lookup_attribute ("acall", TYPE_ATTRIBUTES (type1)) != NULL;
2462+ acall2 = lookup_attribute ("acall", TYPE_ATTRIBUTES (type2)) != NULL;
2463+ naked1 = lookup_attribute ("naked", TYPE_ATTRIBUTES (type1)) != NULL;
2464+ naked2 = lookup_attribute ("naked", TYPE_ATTRIBUTES (type2)) != NULL;
2465+ isr1 = lookup_attribute ("isr", TYPE_ATTRIBUTES (type1)) != NULL;
2466+ if (!isr1)
2467+ isr1 = lookup_attribute ("interrupt", TYPE_ATTRIBUTES (type1)) != NULL;
2468+
2469+ isr2 = lookup_attribute ("isr", TYPE_ATTRIBUTES (type2)) != NULL;
2470+ if (!isr2)
2471+ isr2 = lookup_attribute ("interrupt", TYPE_ATTRIBUTES (type2)) != NULL;
2472+
2473+ if ((acall1 && isr2)
2474+ || (acall2 && isr1) || (naked1 && isr2) || (naked2 && isr1))
2475+ return 0;
2476+
2477+ return 1;
2478+}
2479+
2480+
2481+/* Computes the type of the current function. */
2482+
2483+static unsigned long
2484+avr32_compute_func_type (void)
2485+{
2486+ unsigned long type = AVR32_FT_UNKNOWN;
2487+ tree a;
2488+ tree attr;
2489+
2490+ if (TREE_CODE (current_function_decl) != FUNCTION_DECL)
2491+ abort ();
2492+
2493+ /* Decide if the current function is volatile. Such functions never
2494+ return, and many memory cycles can be saved by not storing register
2495+ values that will never be needed again. This optimization was added to
2496+ speed up context switching in a kernel application. */
2497+ if (optimize > 0
2498+ && TREE_NOTHROW (current_function_decl)
2499+ && TREE_THIS_VOLATILE (current_function_decl))
2500+ type |= AVR32_FT_VOLATILE;
2501+
2502+ if (cfun->static_chain_decl != NULL)
2503+ type |= AVR32_FT_NESTED;
2504+
2505+ attr = DECL_ATTRIBUTES (current_function_decl);
2506+
2507+ a = lookup_attribute ("isr", attr);
2508+ if (a == NULL_TREE)
2509+ a = lookup_attribute ("interrupt", attr);
2510+
2511+ if (a == NULL_TREE)
2512+ type |= AVR32_FT_NORMAL;
2513+ else
2514+ type |= avr32_isr_value (TREE_VALUE (a));
2515+
2516+
2517+ a = lookup_attribute ("acall", attr);
2518+ if (a != NULL_TREE)
2519+ type |= AVR32_FT_ACALL;
2520+
2521+ a = lookup_attribute ("naked", attr);
2522+ if (a != NULL_TREE)
2523+ type |= AVR32_FT_NAKED;
2524+
2525+ return type;
2526+}
2527+
2528+/* Returns the type of the current function. */
2529+
2530+static unsigned long
2531+avr32_current_func_type (void)
2532+{
2533+ if (AVR32_FUNC_TYPE (cfun->machine->func_type) == AVR32_FT_UNKNOWN)
2534+ cfun->machine->func_type = avr32_compute_func_type ();
2535+
2536+ return cfun->machine->func_type;
2537+}
2538+
2539+/*
2540+ This target hook should return true if we should not pass type solely
2541+ in registers. The file expr.h defines a definition that is usually appropriate,
2542+ refer to expr.h for additional documentation.
2543+*/
2544+bool
2545+avr32_must_pass_in_stack (enum machine_mode mode ATTRIBUTE_UNUSED, tree type)
2546+{
2547+ if (type && AGGREGATE_TYPE_P (type)
2548+ /* If the alignment is less than the size then pass in the struct on
2549+ the stack. */
2550+ && ((unsigned int) TYPE_ALIGN_UNIT (type) <
2551+ (unsigned int) int_size_in_bytes (type))
2552+ /* If we support unaligned word accesses then structs of size 4 and 8
2553+ can have any alignment and still be passed in registers. */
2554+ && !(TARGET_UNALIGNED_WORD
2555+ && (int_size_in_bytes (type) == 4
2556+ || int_size_in_bytes (type) == 8))
2557+ /* Double word structs need only a word alignment. */
2558+ && !(int_size_in_bytes (type) == 8 && TYPE_ALIGN_UNIT (type) >= 4))
2559+ return true;
2560+
2561+ if (type && AGGREGATE_TYPE_P (type)
2562+ /* Structs of size 3,5,6,7 are always passed in registers. */
2563+ && (int_size_in_bytes (type) == 3
2564+ || int_size_in_bytes (type) == 5
2565+ || int_size_in_bytes (type) == 6 || int_size_in_bytes (type) == 7))
2566+ return true;
2567+
2568+
2569+ return (type && TREE_ADDRESSABLE (type));
2570+}
2571+
2572+
2573+bool
2574+avr32_strict_argument_naming (CUMULATIVE_ARGS * ca ATTRIBUTE_UNUSED)
2575+{
2576+ return true;
2577+}
2578+
2579+/*
2580+ This target hook should return true if an argument at the position indicated
2581+ by cum should be passed by reference. This predicate is queried after target
2582+ independent reasons for being passed by reference, such as TREE_ADDRESSABLE (type).
2583+
2584+ If the hook returns true, a copy of that argument is made in memory and a
2585+ pointer to the argument is passed instead of the argument itself. The pointer
2586+ is passed in whatever way is appropriate for passing a pointer to that type.
2587+*/
2588+bool
2589+avr32_pass_by_reference (CUMULATIVE_ARGS * cum ATTRIBUTE_UNUSED,
2590+ enum machine_mode mode ATTRIBUTE_UNUSED,
2591+ tree type, bool named ATTRIBUTE_UNUSED)
2592+{
2593+ return (type && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST));
2594+}
2595+
2596+static int
2597+avr32_arg_partial_bytes (CUMULATIVE_ARGS * pcum ATTRIBUTE_UNUSED,
2598+ enum machine_mode mode ATTRIBUTE_UNUSED,
2599+ tree type ATTRIBUTE_UNUSED,
2600+ bool named ATTRIBUTE_UNUSED)
2601+{
2602+ return 0;
2603+}
2604+
2605+
2606+struct gcc_target targetm = TARGET_INITIALIZER;
2607+
2608+/*
2609+ Table used to convert from register number in the assembler instructions and
2610+ the register numbers used in gcc.
2611+*/
2612+const int avr32_function_arg_reglist[] =
2613+{
2614+ INTERNAL_REGNUM (12),
2615+ INTERNAL_REGNUM (11),
2616+ INTERNAL_REGNUM (10),
2617+ INTERNAL_REGNUM (9),
2618+ INTERNAL_REGNUM (8)
2619+};
2620+
2621+rtx avr32_compare_op0 = NULL_RTX;
2622+rtx avr32_compare_op1 = NULL_RTX;
2623+rtx avr32_compare_operator = NULL_RTX;
2624+rtx avr32_acc_cache = NULL_RTX;
2625+
2626+/*
2627+ Returns nonzero if it is allowed to store a value of mode mode in hard
2628+ register number regno.
2629+*/
2630+int
2631+avr32_hard_regno_mode_ok (int regnr, enum machine_mode mode)
2632+{
2633+ /* We allow only float modes in the fp-registers */
2634+ if (regnr >= FIRST_FP_REGNUM
2635+ && regnr <= LAST_FP_REGNUM && GET_MODE_CLASS (mode) != MODE_FLOAT)
2636+ {
2637+ return 0;
2638+ }
2639+
2640+ switch (mode)
2641+ {
2642+ case DImode: /* long long */
2643+ case DFmode: /* double */
2644+ case SCmode: /* __complex__ float */
2645+ case CSImode: /* __complex__ int */
2646+ if (regnr < 4)
2647+ { /* long long int not supported in r12, sp, lr
2648+ or pc. */
2649+ return 0;
2650+ }
2651+ else
2652+ {
2653+ if (regnr % 2) /* long long int has to be refered in even
2654+ registers. */
2655+ return 0;
2656+ else
2657+ return 1;
2658+ }
2659+ case CDImode: /* __complex__ long long */
2660+ case DCmode: /* __complex__ double */
2661+ case TImode: /* 16 bytes */
2662+ if (regnr < 7)
2663+ return 0;
2664+ else if (regnr % 2)
2665+ return 0;
2666+ else
2667+ return 1;
2668+ default:
2669+ return 1;
2670+ }
2671+}
2672+
2673+
2674+int
2675+avr32_rnd_operands (rtx add, rtx shift)
2676+{
2677+ if (GET_CODE (shift) == CONST_INT &&
2678+ GET_CODE (add) == CONST_INT && INTVAL (shift) > 0)
2679+ {
2680+ if ((1 << (INTVAL (shift) - 1)) == INTVAL (add))
2681+ return TRUE;
2682+ }
2683+
2684+ return FALSE;
2685+}
2686+
2687+
2688+
2689+int
2690+avr32_const_ok_for_constraint_p (HOST_WIDE_INT value, char c, const char *str)
2691+{
2692+ switch (c)
2693+ {
2694+ case 'K':
2695+ case 'I':
2696+ {
2697+ HOST_WIDE_INT min_value = 0, max_value = 0;
2698+ char size_str[3];
2699+ int const_size;
2700+
2701+ size_str[0] = str[2];
2702+ size_str[1] = str[3];
2703+ size_str[2] = '\0';
2704+ const_size = atoi (size_str);
2705+
2706+ if (toupper (str[1]) == 'U')
2707+ {
2708+ min_value = 0;
2709+ max_value = (1 << const_size) - 1;
2710+ }
2711+ else if (toupper (str[1]) == 'S')
2712+ {
2713+ min_value = -(1 << (const_size - 1));
2714+ max_value = (1 << (const_size - 1)) - 1;
2715+ }
2716+
2717+ if (c == 'I')
2718+ {
2719+ value = -value;
2720+ }
2721+
2722+ if (value >= min_value && value <= max_value)
2723+ {
2724+ return 1;
2725+ }
2726+ break;
2727+ }
2728+ case 'M':
2729+ return avr32_mask_upper_bits_operand (GEN_INT (value), VOIDmode);
2730+ }
2731+
2732+ return 0;
2733+}
2734+
2735+
2736+/*Compute mask of which floating-point registers needs saving upon
2737+ entry to this function*/
2738+static unsigned long
2739+avr32_compute_save_fp_reg_mask (void)
2740+{
2741+ unsigned long func_type = avr32_current_func_type ();
2742+ unsigned int save_reg_mask = 0;
2743+ unsigned int reg;
2744+ unsigned int max_reg = 7;
2745+ int save_all_call_used_regs = FALSE;
2746+
2747+ /* This only applies for hardware floating-point implementation. */
2748+ if (!TARGET_HARD_FLOAT)
2749+ return 0;
2750+
2751+ if (IS_INTERRUPT (func_type))
2752+ {
2753+
2754+ /* Interrupt functions must not corrupt any registers, even call
2755+ clobbered ones. If this is a leaf function we can just examine the
2756+ registers used by the RTL, but otherwise we have to assume that
2757+ whatever function is called might clobber anything, and so we have
2758+ to save all the call-clobbered registers as well. */
2759+ max_reg = 13;
2760+ save_all_call_used_regs = !current_function_is_leaf;
2761+ }
2762+
2763+ /* All used registers used must be saved */
2764+ for (reg = 0; reg <= max_reg; reg++)
2765+ if (regs_ever_live[INTERNAL_FP_REGNUM (reg)]
2766+ || (save_all_call_used_regs
2767+ && call_used_regs[INTERNAL_FP_REGNUM (reg)]))
2768+ save_reg_mask |= (1 << reg);
2769+
2770+ return save_reg_mask;
2771+}
2772+
2773+/*Compute mask of registers which needs saving upon function entry */
2774+static unsigned long
2775+avr32_compute_save_reg_mask (int push)
2776+{
2777+ unsigned long func_type;
2778+ unsigned int save_reg_mask = 0;
2779+ unsigned int reg;
2780+
2781+ func_type = avr32_current_func_type ();
2782+
2783+ if (IS_INTERRUPT (func_type))
2784+ {
2785+ unsigned int max_reg = 12;
2786+
2787+
2788+ /* Get the banking scheme for the interrupt */
2789+ switch (func_type)
2790+ {
2791+ case AVR32_FT_ISR_FULL:
2792+ max_reg = 0;
2793+ break;
2794+ case AVR32_FT_ISR_HALF:
2795+ max_reg = 7;
2796+ break;
2797+ case AVR32_FT_ISR_NONE:
2798+ max_reg = 12;
2799+ break;
2800+ }
2801+
2802+ /* Interrupt functions must not corrupt any registers, even call
2803+ clobbered ones. If this is a leaf function we can just examine the
2804+ registers used by the RTL, but otherwise we have to assume that
2805+ whatever function is called might clobber anything, and so we have
2806+ to save all the call-clobbered registers as well. */
2807+
2808+ /* Need not push the registers r8-r12 for AVR32A architectures, as this
2809+ is automatially done in hardware. We also do not have any shadow
2810+ registers. */
2811+ if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A)
2812+ {
2813+ max_reg = 7;
2814+ func_type = AVR32_FT_ISR_NONE;
2815+ }
2816+
2817+ /* All registers which are used and is not shadowed must be saved */
2818+ for (reg = 0; reg <= max_reg; reg++)
2819+ if (regs_ever_live[INTERNAL_REGNUM (reg)]
2820+ || (!current_function_is_leaf
2821+ && call_used_regs[INTERNAL_REGNUM (reg)]))
2822+ save_reg_mask |= (1 << reg);
2823+
2824+ /* Check LR */
2825+ if ((regs_ever_live[LR_REGNUM] || !current_function_is_leaf || frame_pointer_needed) && (func_type == AVR32_FT_ISR_NONE) /* Only
2826+ non-shadowed
2827+ register
2828+ models
2829+ */ )
2830+ save_reg_mask |= (1 << ASM_REGNUM (LR_REGNUM));
2831+
2832+ /* Make sure that the GOT register is pushed. */
2833+ if (max_reg >= ASM_REGNUM (PIC_OFFSET_TABLE_REGNUM)
2834+ && current_function_uses_pic_offset_table)
2835+ save_reg_mask |= (1 << ASM_REGNUM (PIC_OFFSET_TABLE_REGNUM));
2836+
2837+ }
2838+ else
2839+ {
2840+ int use_pushm = optimize_size;
2841+
2842+ /* In the normal case we only need to save those registers which are
2843+ call saved and which are used by this function. */
2844+ for (reg = 0; reg <= 7; reg++)
2845+ if (regs_ever_live[INTERNAL_REGNUM (reg)]
2846+ && !call_used_regs[INTERNAL_REGNUM (reg)])
2847+ save_reg_mask |= (1 << reg);
2848+
2849+ /* Make sure that the GOT register is pushed. */
2850+ if (current_function_uses_pic_offset_table)
2851+ save_reg_mask |= (1 << ASM_REGNUM (PIC_OFFSET_TABLE_REGNUM));
2852+
2853+
2854+ /* If we optimize for size and do not have anonymous arguments: use
2855+ popm/pushm always */
2856+ if (use_pushm)
2857+ {
2858+ if ((save_reg_mask & (1 << 0))
2859+ || (save_reg_mask & (1 << 1))
2860+ || (save_reg_mask & (1 << 2)) || (save_reg_mask & (1 << 3)))
2861+ save_reg_mask |= 0xf;
2862+
2863+ if ((save_reg_mask & (1 << 4))
2864+ || (save_reg_mask & (1 << 5))
2865+ || (save_reg_mask & (1 << 6)) || (save_reg_mask & (1 << 7)))
2866+ save_reg_mask |= 0xf0;
2867+
2868+ if ((save_reg_mask & (1 << 8)) || (save_reg_mask & (1 << 9)))
2869+ save_reg_mask |= 0x300;
2870+ }
2871+
2872+
2873+ /* Check LR */
2874+ if ((regs_ever_live[LR_REGNUM] || !current_function_is_leaf ||
2875+ (optimize_size && save_reg_mask) || frame_pointer_needed))
2876+ {
2877+ if (push)
2878+ {
2879+ /* Push/Pop LR */
2880+ save_reg_mask |= (1 << ASM_REGNUM (LR_REGNUM));
2881+ }
2882+ else
2883+ {
2884+ /* Pop PC */
2885+ save_reg_mask |= (1 << ASM_REGNUM (PC_REGNUM));
2886+ }
2887+ }
2888+ }
2889+
2890+ return save_reg_mask;
2891+}
2892+
2893+/*Compute total size in bytes of all saved registers */
2894+static int
2895+avr32_get_reg_mask_size (int reg_mask)
2896+{
2897+ int reg, size;
2898+ size = 0;
2899+
2900+ for (reg = 0; reg <= 15; reg++)
2901+ if (reg_mask & (1 << reg))
2902+ size += 4;
2903+
2904+ return size;
2905+}
2906+
2907+/*Get a register from one of the registers which are saved onto the stack
2908+ upon function entry */
2909+
2910+static int
2911+avr32_get_saved_reg (int save_reg_mask)
2912+{
2913+ unsigned int reg;
2914+
2915+ /* Find the first register which is saved in the saved_reg_mask */
2916+ for (reg = 0; reg <= 15; reg++)
2917+ if (save_reg_mask & (1 << reg))
2918+ return reg;
2919+
2920+ return -1;
2921+}
2922+
2923+/* Return 1 if it is possible to return using a single instruction. */
2924+int
2925+avr32_use_return_insn (int iscond)
2926+{
2927+ unsigned int func_type = avr32_current_func_type ();
2928+ unsigned long saved_int_regs;
2929+ unsigned long saved_fp_regs;
2930+
2931+ /* Never use a return instruction before reload has run. */
2932+ if (!reload_completed)
2933+ return 0;
2934+
2935+ /* Must adjust the stack for vararg functions. */
2936+ if (current_function_args_info.uses_anonymous_args)
2937+ return 0;
2938+
2939+ /* If there a stack adjstment. */
2940+ if (get_frame_size ())
2941+ return 0;
2942+
2943+ saved_int_regs = avr32_compute_save_reg_mask (TRUE);
2944+ saved_fp_regs = avr32_compute_save_fp_reg_mask ();
2945+
2946+ /* Functions which have saved fp-regs on the stack can not be performed in
2947+ one instruction */
2948+ if (saved_fp_regs)
2949+ return 0;
2950+
2951+ /* Conditional returns can not be performed in one instruction if we need
2952+ to restore registers from the stack */
2953+ if (iscond && saved_int_regs)
2954+ return 0;
2955+
2956+ /* Conditional return can not be used for interrupt handlers. */
2957+ if (iscond && IS_INTERRUPT (func_type))
2958+ return 0;
2959+
2960+ /* For interrupt handlers which needs to pop registers */
2961+ if (saved_int_regs && IS_INTERRUPT (func_type))
2962+ return 0;
2963+
2964+
2965+ /* If there are saved registers but the LR isn't saved, then we need two
2966+ instructions for the return. */
2967+ if (saved_int_regs && !(saved_int_regs & (1 << ASM_REGNUM (LR_REGNUM))))
2968+ return 0;
2969+
2970+
2971+ return 1;
2972+}
2973+
2974+
2975+/*Generate some function prologue info in the assembly file*/
2976+
2977+void
2978+avr32_target_asm_function_prologue (FILE * f, HOST_WIDE_INT frame_size)
2979+{
2980+ if (IS_NAKED (avr32_current_func_type ()))
2981+ fprintf (f,
2982+ "\t# Function is naked: Prologue and epilogue provided by programmer\n");
2983+
2984+ if (IS_INTERRUPT (avr32_current_func_type ()))
2985+ {
2986+ switch (avr32_current_func_type ())
2987+ {
2988+ case AVR32_FT_ISR_FULL:
2989+ fprintf (f,
2990+ "\t# Interrupt Function: Fully shadowed register file\n");
2991+ break;
2992+ case AVR32_FT_ISR_HALF:
2993+ fprintf (f,
2994+ "\t# Interrupt Function: Half shadowed register file\n");
2995+ break;
2996+ default:
2997+ case AVR32_FT_ISR_NONE:
2998+ fprintf (f, "\t# Interrupt Function: No shadowed register file\n");
2999+ break;
3000+ }
3001+ }
3002+
3003+
3004+ fprintf (f, "\t# args = %i, frame = %li, pretend = %i\n",
3005+ current_function_args_size, frame_size,
3006+ current_function_pretend_args_size);
3007+
3008+ fprintf (f, "\t# frame_needed = %i, leaf_function = %i\n",
3009+ frame_pointer_needed, current_function_is_leaf);
3010+
3011+ fprintf (f, "\t# uses_anonymous_args = %i\n",
3012+ current_function_args_info.uses_anonymous_args);
3013+}
3014+
3015+
3016+/* Generate and emit an insn that we will recognize as a pushm or stm.
3017+ Unfortunately, since this insn does not reflect very well the actual
3018+ semantics of the operation, we need to annotate the insn for the benefit
3019+ of DWARF2 frame unwind information. */
3020+
3021+int avr32_convert_to_reglist16 (int reglist8_vect);
3022+
3023+static rtx
3024+emit_multi_reg_push (int reglist, int usePUSHM)
3025+{
3026+ rtx insn;
3027+ rtx dwarf;
3028+ rtx tmp;
3029+ rtx reg;
3030+ int i;
3031+ int nr_regs;
3032+ int index = 0;
3033+
3034+ if (usePUSHM)
3035+ {
3036+ insn = emit_insn (gen_pushm (gen_rtx_CONST_INT (SImode, reglist)));
3037+ reglist = avr32_convert_to_reglist16 (reglist);
3038+ }
3039+ else
3040+ {
3041+ insn = emit_insn (gen_stm (stack_pointer_rtx,
3042+ gen_rtx_CONST_INT (SImode, reglist),
3043+ gen_rtx_CONST_INT (SImode, 1)));
3044+ }
3045+
3046+ nr_regs = avr32_get_reg_mask_size (reglist) / 4;
3047+ dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (nr_regs + 1));
3048+
3049+ for (i = 15; i >= 0; i--)
3050+ {
3051+ if (reglist & (1 << i))
3052+ {
3053+ reg = gen_rtx_REG (SImode, INTERNAL_REGNUM (i));
3054+ tmp = gen_rtx_SET (VOIDmode,
3055+ gen_rtx_MEM (SImode,
3056+ plus_constant (stack_pointer_rtx,
3057+ 4 * index)), reg);
3058+ RTX_FRAME_RELATED_P (tmp) = 1;
3059+ XVECEXP (dwarf, 0, 1 + index++) = tmp;
3060+ }
3061+ }
3062+
3063+ tmp = gen_rtx_SET (SImode,
3064+ stack_pointer_rtx,
3065+ gen_rtx_PLUS (SImode,
3066+ stack_pointer_rtx,
3067+ GEN_INT (-4 * nr_regs)));
3068+ RTX_FRAME_RELATED_P (tmp) = 1;
3069+ XVECEXP (dwarf, 0, 0) = tmp;
3070+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
3071+ REG_NOTES (insn));
3072+ return insn;
3073+}
3074+
3075+
3076+static rtx
3077+emit_multi_fp_reg_push (int reglist)
3078+{
3079+ rtx insn;
3080+ rtx dwarf;
3081+ rtx tmp;
3082+ rtx reg;
3083+ int i;
3084+ int nr_regs;
3085+ int index = 0;
3086+
3087+ insn = emit_insn (gen_stm_fp (stack_pointer_rtx,
3088+ gen_rtx_CONST_INT (SImode, reglist),
3089+ gen_rtx_CONST_INT (SImode, 1)));
3090+
3091+ nr_regs = avr32_get_reg_mask_size (reglist) / 4;
3092+ dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (nr_regs + 1));
3093+
3094+ for (i = 15; i >= 0; i--)
3095+ {
3096+ if (reglist & (1 << i))
3097+ {
3098+ reg = gen_rtx_REG (SImode, INTERNAL_FP_REGNUM (i));
3099+ tmp = gen_rtx_SET (VOIDmode,
3100+ gen_rtx_MEM (SImode,
3101+ plus_constant (stack_pointer_rtx,
3102+ 4 * index)), reg);
3103+ RTX_FRAME_RELATED_P (tmp) = 1;
3104+ XVECEXP (dwarf, 0, 1 + index++) = tmp;
3105+ }
3106+ }
3107+
3108+ tmp = gen_rtx_SET (SImode,
3109+ stack_pointer_rtx,
3110+ gen_rtx_PLUS (SImode,
3111+ stack_pointer_rtx,
3112+ GEN_INT (-4 * nr_regs)));
3113+ RTX_FRAME_RELATED_P (tmp) = 1;
3114+ XVECEXP (dwarf, 0, 0) = tmp;
3115+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
3116+ REG_NOTES (insn));
3117+ return insn;
3118+}
3119+
3120+rtx
3121+avr32_gen_load_multiple (rtx * regs, int count, rtx from,
3122+ int write_back, int in_struct_p, int scalar_p)
3123+{
3124+
3125+ rtx result;
3126+ int i = 0, j;
3127+
3128+ result =
3129+ gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + (write_back ? 1 : 0)));
3130+
3131+ if (write_back)
3132+ {
3133+ XVECEXP (result, 0, 0)
3134+ = gen_rtx_SET (GET_MODE (from), from,
3135+ plus_constant (from, count * 4));
3136+ i = 1;
3137+ count++;
3138+ }
3139+
3140+
3141+ for (j = 0; i < count; i++, j++)
3142+ {
3143+ rtx unspec;
3144+ rtx mem = gen_rtx_MEM (SImode, plus_constant (from, j * 4));
3145+ MEM_IN_STRUCT_P (mem) = in_struct_p;
3146+ MEM_SCALAR_P (mem) = scalar_p;
3147+ unspec = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, mem), UNSPEC_LDM);
3148+ XVECEXP (result, 0, i) = gen_rtx_SET (VOIDmode, regs[j], unspec);
3149+ }
3150+
3151+ return result;
3152+}
3153+
3154+
3155+rtx
3156+avr32_gen_store_multiple (rtx * regs, int count, rtx to,
3157+ int in_struct_p, int scalar_p)
3158+{
3159+ rtx result;
3160+ int i = 0, j;
3161+
3162+ result = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
3163+
3164+ for (j = 0; i < count; i++, j++)
3165+ {
3166+ rtx mem = gen_rtx_MEM (SImode, plus_constant (to, j * 4));
3167+ MEM_IN_STRUCT_P (mem) = in_struct_p;
3168+ MEM_SCALAR_P (mem) = scalar_p;
3169+ XVECEXP (result, 0, i)
3170+ = gen_rtx_SET (VOIDmode, mem,
3171+ gen_rtx_UNSPEC (VOIDmode,
3172+ gen_rtvec (1, regs[j]),
3173+ UNSPEC_STORE_MULTIPLE));
3174+ }
3175+
3176+ return result;
3177+}
3178+
3179+
3180+/* Move a block of memory if it is word aligned or we support unaligned
3181+ word memory accesses. The size must be maximum 64 bytes. */
3182+
3183+int
3184+avr32_gen_movmemsi (rtx * operands)
3185+{
3186+ HOST_WIDE_INT bytes_to_go;
3187+ rtx src, dst;
3188+ rtx st_src, st_dst;
3189+ int ptr_offset = 0;
3190+ int block_size;
3191+ int dst_in_struct_p, src_in_struct_p;
3192+ int dst_scalar_p, src_scalar_p;
3193+ int unaligned;
3194+
3195+ if (GET_CODE (operands[2]) != CONST_INT
3196+ || GET_CODE (operands[3]) != CONST_INT
3197+ || INTVAL (operands[2]) > 64
3198+ || ((INTVAL (operands[3]) & 3) && !TARGET_UNALIGNED_WORD))
3199+ return 0;
3200+
3201+ unaligned = (INTVAL (operands[3]) & 3) != 0;
3202+
3203+ block_size = 4;
3204+
3205+ st_dst = XEXP (operands[0], 0);
3206+ st_src = XEXP (operands[1], 0);
3207+
3208+ dst_in_struct_p = MEM_IN_STRUCT_P (operands[0]);
3209+ dst_scalar_p = MEM_SCALAR_P (operands[0]);
3210+ src_in_struct_p = MEM_IN_STRUCT_P (operands[1]);
3211+ src_scalar_p = MEM_SCALAR_P (operands[1]);
3212+
3213+ dst = copy_to_mode_reg (SImode, st_dst);
3214+ src = copy_to_mode_reg (SImode, st_src);
3215+
3216+ bytes_to_go = INTVAL (operands[2]);
3217+
3218+ while (bytes_to_go)
3219+ {
3220+ enum machine_mode move_mode;
3221+ /* Seems to be a problem with reloads for the movti pattern so this is
3222+ disabled until that problem is resolved */
3223+
3224+ /* if ( bytes_to_go >= GET_MODE_SIZE(TImode) ) move_mode = TImode; else
3225+ */
3226+ if ((bytes_to_go >= GET_MODE_SIZE (DImode)) && !unaligned)
3227+ move_mode = DImode;
3228+ else if (bytes_to_go >= GET_MODE_SIZE (SImode))
3229+ move_mode = SImode;
3230+ else
3231+ move_mode = QImode;
3232+
3233+ {
3234+ rtx dst_mem = gen_rtx_MEM (move_mode,
3235+ gen_rtx_PLUS (SImode, dst,
3236+ GEN_INT (ptr_offset)));
3237+ rtx src_mem = gen_rtx_MEM (move_mode,
3238+ gen_rtx_PLUS (SImode, src,
3239+ GEN_INT (ptr_offset)));
3240+ ptr_offset += GET_MODE_SIZE (move_mode);
3241+ bytes_to_go -= GET_MODE_SIZE (move_mode);
3242+
3243+ MEM_IN_STRUCT_P (dst_mem) = dst_in_struct_p;
3244+ MEM_SCALAR_P (dst_mem) = dst_scalar_p;
3245+
3246+ MEM_IN_STRUCT_P (src_mem) = src_in_struct_p;
3247+ MEM_SCALAR_P (src_mem) = src_scalar_p;
3248+ emit_move_insn (dst_mem, src_mem);
3249+
3250+ }
3251+ }
3252+
3253+ return 1;
3254+}
3255+
3256+
3257+
3258+/*Expand the prologue instruction*/
3259+void
3260+avr32_expand_prologue (void)
3261+{
3262+ rtx insn, dwarf;
3263+ unsigned long saved_reg_mask, saved_fp_reg_mask;
3264+ int reglist8 = 0;
3265+
3266+ /* Naked functions does not have a prologue */
3267+ if (IS_NAKED (avr32_current_func_type ()))
3268+ return;
3269+
3270+ saved_reg_mask = avr32_compute_save_reg_mask (TRUE);
3271+
3272+ if (saved_reg_mask)
3273+ {
3274+ /* Must push used registers */
3275+
3276+ /* Should we use POPM or LDM? */
3277+ int usePUSHM = TRUE;
3278+ reglist8 = 0;
3279+ if (((saved_reg_mask & (1 << 0)) ||
3280+ (saved_reg_mask & (1 << 1)) ||
3281+ (saved_reg_mask & (1 << 2)) || (saved_reg_mask & (1 << 3))))
3282+ {
3283+ /* One of R0-R3 should at least be pushed */
3284+ if (((saved_reg_mask & (1 << 0)) &&
3285+ (saved_reg_mask & (1 << 1)) &&
3286+ (saved_reg_mask & (1 << 2)) && (saved_reg_mask & (1 << 3))))
3287+ {
3288+ /* All should be pushed */
3289+ reglist8 |= 0x01;
3290+ }
3291+ else
3292+ {
3293+ usePUSHM = FALSE;
3294+ }
3295+ }
3296+
3297+ if (((saved_reg_mask & (1 << 4)) ||
3298+ (saved_reg_mask & (1 << 5)) ||
3299+ (saved_reg_mask & (1 << 6)) || (saved_reg_mask & (1 << 7))))
3300+ {
3301+ /* One of R4-R7 should at least be pushed */
3302+ if (((saved_reg_mask & (1 << 4)) &&
3303+ (saved_reg_mask & (1 << 5)) &&
3304+ (saved_reg_mask & (1 << 6)) && (saved_reg_mask & (1 << 7))))
3305+ {
3306+ if (usePUSHM)
3307+ /* All should be pushed */
3308+ reglist8 |= 0x02;
3309+ }
3310+ else
3311+ {
3312+ usePUSHM = FALSE;
3313+ }
3314+ }
3315+
3316+ if (((saved_reg_mask & (1 << 8)) || (saved_reg_mask & (1 << 9))))
3317+ {
3318+ /* One of R8-R9 should at least be pushed */
3319+ if (((saved_reg_mask & (1 << 8)) && (saved_reg_mask & (1 << 9))))
3320+ {
3321+ if (usePUSHM)
3322+ /* All should be pushed */
3323+ reglist8 |= 0x04;
3324+ }
3325+ else
3326+ {
3327+ usePUSHM = FALSE;
3328+ }
3329+ }
3330+
3331+ if (saved_reg_mask & (1 << 10))
3332+ reglist8 |= 0x08;
3333+
3334+ if (saved_reg_mask & (1 << 11))
3335+ reglist8 |= 0x10;
3336+
3337+ if (saved_reg_mask & (1 << 12))
3338+ reglist8 |= 0x20;
3339+
3340+ if (saved_reg_mask & (1 << ASM_REGNUM (LR_REGNUM)))
3341+ {
3342+ /* Push LR */
3343+ reglist8 |= 0x40;
3344+ }
3345+
3346+ if (usePUSHM)
3347+ {
3348+ insn = emit_multi_reg_push (reglist8, TRUE);
3349+ }
3350+ else
3351+ {
3352+ insn = emit_multi_reg_push (saved_reg_mask, FALSE);
3353+ }
3354+ RTX_FRAME_RELATED_P (insn) = 1;
3355+
3356+ /* Prevent this instruction from being scheduled after any other
3357+ instructions. */
3358+ emit_insn (gen_blockage ());
3359+ }
3360+
3361+ saved_fp_reg_mask = avr32_compute_save_fp_reg_mask ();
3362+ if (saved_fp_reg_mask)
3363+ {
3364+ insn = emit_multi_fp_reg_push (saved_fp_reg_mask);
3365+ RTX_FRAME_RELATED_P (insn) = 1;
3366+
3367+ /* Prevent this instruction from being scheduled after any other
3368+ instructions. */
3369+ emit_insn (gen_blockage ());
3370+ }
3371+
3372+ /* Set frame pointer */
3373+ if (frame_pointer_needed)
3374+ {
3375+ insn = emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
3376+ RTX_FRAME_RELATED_P (insn) = 1;
3377+ }
3378+
3379+ if (get_frame_size () > 0)
3380+ {
3381+ if (avr32_const_ok_for_constraint_p (get_frame_size (), 'K', "Ks21"))
3382+ {
3383+ insn = emit_insn (gen_rtx_SET (SImode,
3384+ stack_pointer_rtx,
3385+ gen_rtx_PLUS (SImode,
3386+ stack_pointer_rtx,
3387+ gen_rtx_CONST_INT
3388+ (SImode,
3389+ -get_frame_size
3390+ ()))));
3391+ RTX_FRAME_RELATED_P (insn) = 1;
3392+ }
3393+ else
3394+ {
3395+ /* Immediate is larger than k21 We must either check if we can use
3396+ one of the pushed reegisters as temporary storage or we must
3397+ make us a temp register by pushing a register to the stack. */
3398+ rtx temp_reg, const_pool_entry, insn;
3399+ if (saved_reg_mask)
3400+ {
3401+ temp_reg =
3402+ gen_rtx_REG (SImode,
3403+ INTERNAL_REGNUM (avr32_get_saved_reg
3404+ (saved_reg_mask)));
3405+ }
3406+ else
3407+ {
3408+ temp_reg = gen_rtx_REG (SImode, INTERNAL_REGNUM (7));
3409+ emit_move_insn (gen_rtx_MEM
3410+ (SImode,
3411+ gen_rtx_PRE_DEC (SImode, stack_pointer_rtx)),
3412+ temp_reg);
3413+ }
3414+
3415+ const_pool_entry =
3416+ force_const_mem (SImode,
3417+ gen_rtx_CONST_INT (SImode, get_frame_size ()));
3418+ emit_move_insn (temp_reg, const_pool_entry);
3419+
3420+ insn = emit_insn (gen_rtx_SET (SImode,
3421+ stack_pointer_rtx,
3422+ gen_rtx_MINUS (SImode,
3423+ stack_pointer_rtx,
3424+ temp_reg)));
3425+
3426+ dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
3427+ gen_rtx_PLUS (SImode, stack_pointer_rtx,
3428+ GEN_INT (-get_frame_size ())));
3429+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
3430+ dwarf, REG_NOTES (insn));
3431+ RTX_FRAME_RELATED_P (insn) = 1;
3432+
3433+ if (!saved_reg_mask)
3434+ {
3435+ insn =
3436+ emit_move_insn (temp_reg,
3437+ gen_rtx_MEM (SImode,
3438+ gen_rtx_POST_INC (SImode,
3439+ gen_rtx_REG
3440+ (SImode,
3441+ 13))));
3442+ }
3443+
3444+ /* Mark the temp register as dead */
3445+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, temp_reg,
3446+ REG_NOTES (insn));
3447+
3448+
3449+ }
3450+
3451+ /* Prevent the the stack adjustment to be scheduled after any
3452+ instructions using the frame pointer. */
3453+ emit_insn (gen_blockage ());
3454+ }
3455+
3456+ /* Load GOT */
3457+ if (flag_pic)
3458+ {
3459+ avr32_load_pic_register ();
3460+
3461+ /* gcc does not know that load or call instructions might use the pic
3462+ register so it might schedule these instructions before the loading
3463+ of the pic register. To avoid this emit a barrier for now. TODO!
3464+ Find out a better way to let gcc know which instructions might use
3465+ the pic register. */
3466+ emit_insn (gen_blockage ());
3467+ }
3468+ return;
3469+}
3470+
3471+void
3472+avr32_set_return_address (rtx source)
3473+{
3474+ rtx addr;
3475+ unsigned long saved_regs;
3476+
3477+ saved_regs = avr32_compute_save_reg_mask (TRUE);
3478+
3479+ if (!(saved_regs & (1 << ASM_REGNUM (LR_REGNUM))))
3480+ emit_move_insn (gen_rtx_REG (Pmode, LR_REGNUM), source);
3481+ else
3482+ {
3483+ if (frame_pointer_needed)
3484+ addr = gen_rtx_REG (Pmode, FRAME_POINTER_REGNUM);
3485+ else
3486+ /* FIXME: Need to use scratch register if frame is large */
3487+ addr = plus_constant (stack_pointer_rtx, get_frame_size ());
3488+
3489+ emit_move_insn (gen_rtx_MEM (Pmode, addr), source);
3490+ }
3491+}
3492+
3493+
3494+
3495+/* Return the length of INSN. LENGTH is the initial length computed by
3496+ attributes in the machine-description file. */
3497+
3498+int
3499+avr32_adjust_insn_length (rtx insn ATTRIBUTE_UNUSED,
3500+ int length ATTRIBUTE_UNUSED)
3501+{
3502+ return length;
3503+}
3504+
3505+void
3506+avr32_output_return_instruction (int single_ret_inst ATTRIBUTE_UNUSED,
3507+ int iscond ATTRIBUTE_UNUSED,
3508+ rtx cond ATTRIBUTE_UNUSED, rtx r12_imm)
3509+{
3510+
3511+ unsigned long saved_reg_mask, saved_fp_reg_mask;
3512+ int insert_ret = TRUE;
3513+ int reglist8 = 0;
3514+ int stack_adjustment = get_frame_size ();
3515+ unsigned int func_type = avr32_current_func_type ();
3516+ FILE *f = asm_out_file;
3517+
3518+ /* Naked functions does not have an epilogue */
3519+ if (IS_NAKED (func_type))
3520+ return;
3521+
3522+ saved_fp_reg_mask = avr32_compute_save_fp_reg_mask ();
3523+
3524+ saved_reg_mask = avr32_compute_save_reg_mask (FALSE);
3525+
3526+ /* Reset frame pointer */
3527+ if (stack_adjustment > 0)
3528+ {
3529+ if (avr32_const_ok_for_constraint_p (stack_adjustment, 'I', "Is21"))
3530+ {
3531+ fprintf (f, "\tsub sp, %i # Reset Frame Pointer\n",
3532+ -stack_adjustment);
3533+ }
3534+ else
3535+ {
3536+ /* TODO! Is it safe to use r8 as scratch?? */
3537+ fprintf (f, "\tmov r8, lo(%i) # Reset Frame Pointer\n",
3538+ -stack_adjustment);
3539+ fprintf (f, "\torh r8, hi(%i) # Reset Frame Pointer\n",
3540+ -stack_adjustment);
3541+ fprintf (f, "\tadd sp,r8 # Reset Frame Pointer\n");
3542+ }
3543+ }
3544+
3545+ if (saved_fp_reg_mask)
3546+ {
3547+ char reglist[64]; /* 64 bytes should be enough... */
3548+ avr32_make_fp_reglist_w (saved_fp_reg_mask, (char *) reglist);
3549+ fprintf (f, "\tldcm.w\tcp0, sp++, %s\n", reglist);
3550+ if (saved_fp_reg_mask & ~0xff)
3551+ {
3552+ saved_fp_reg_mask &= ~0xff;
3553+ avr32_make_fp_reglist_d (saved_fp_reg_mask, (char *) reglist);
3554+ fprintf (f, "\tldcm.d\tcp0, sp++, %s\n", reglist);
3555+ }
3556+ }
3557+
3558+ if (saved_reg_mask)
3559+ {
3560+ /* Must pop used registers */
3561+
3562+ /* Should we use POPM or LDM? */
3563+ int usePOPM = TRUE;
3564+ if (((saved_reg_mask & (1 << 0)) ||
3565+ (saved_reg_mask & (1 << 1)) ||
3566+ (saved_reg_mask & (1 << 2)) || (saved_reg_mask & (1 << 3))))
3567+ {
3568+ /* One of R0-R3 should at least be popped */
3569+ if (((saved_reg_mask & (1 << 0)) &&
3570+ (saved_reg_mask & (1 << 1)) &&
3571+ (saved_reg_mask & (1 << 2)) && (saved_reg_mask & (1 << 3))))
3572+ {
3573+ /* All should be popped */
3574+ reglist8 |= 0x01;
3575+ }
3576+ else
3577+ {
3578+ usePOPM = FALSE;
3579+ }
3580+ }
3581+
3582+ if (((saved_reg_mask & (1 << 4)) ||
3583+ (saved_reg_mask & (1 << 5)) ||
3584+ (saved_reg_mask & (1 << 6)) || (saved_reg_mask & (1 << 7))))
3585+ {
3586+ /* One of R0-R3 should at least be popped */
3587+ if (((saved_reg_mask & (1 << 4)) &&
3588+ (saved_reg_mask & (1 << 5)) &&
3589+ (saved_reg_mask & (1 << 6)) && (saved_reg_mask & (1 << 7))))
3590+ {
3591+ if (usePOPM)
3592+ /* All should be popped */
3593+ reglist8 |= 0x02;
3594+ }
3595+ else
3596+ {
3597+ usePOPM = FALSE;
3598+ }
3599+ }
3600+
3601+ if (((saved_reg_mask & (1 << 8)) || (saved_reg_mask & (1 << 9))))
3602+ {
3603+ /* One of R8-R9 should at least be pushed */
3604+ if (((saved_reg_mask & (1 << 8)) && (saved_reg_mask & (1 << 9))))
3605+ {
3606+ if (usePOPM)
3607+ /* All should be pushed */
3608+ reglist8 |= 0x04;
3609+ }
3610+ else
3611+ {
3612+ usePOPM = FALSE;
3613+ }
3614+ }
3615+
3616+ if (saved_reg_mask & (1 << 10))
3617+ reglist8 |= 0x08;
3618+
3619+ if (saved_reg_mask & (1 << 11))
3620+ reglist8 |= 0x10;
3621+
3622+ if (saved_reg_mask & (1 << 12))
3623+ reglist8 |= 0x20;
3624+
3625+ if (saved_reg_mask & (1 << ASM_REGNUM (LR_REGNUM)))
3626+ /* Pop LR */
3627+ reglist8 |= 0x40;
3628+
3629+ if (saved_reg_mask & (1 << ASM_REGNUM (PC_REGNUM)))
3630+ /* Pop LR into PC. */
3631+ reglist8 |= 0x80;
3632+
3633+ if (usePOPM)
3634+ {
3635+ char reglist[64]; /* 64 bytes should be enough... */
3636+ avr32_make_reglist8 (reglist8, (char *) reglist);
3637+
3638+ if (reglist8 & 0x80)
3639+ /* This instruction is also a return */
3640+ insert_ret = FALSE;
3641+
3642+ if (r12_imm && !insert_ret)
3643+ fprintf (f, "\tpopm %s, r12=%li\n", reglist, INTVAL (r12_imm));
3644+ else
3645+ fprintf (f, "\tpopm %s\n", reglist);
3646+
3647+ }
3648+ else
3649+ {
3650+ char reglist[64]; /* 64 bytes should be enough... */
3651+ avr32_make_reglist16 (saved_reg_mask, (char *) reglist);
3652+ if (saved_reg_mask & (1 << ASM_REGNUM (PC_REGNUM)))
3653+ /* This instruction is also a return */
3654+ insert_ret = FALSE;
3655+
3656+ if (r12_imm && !insert_ret)
3657+ fprintf (f, "\tldm sp++, %s, r12=%li\n", reglist,
3658+ INTVAL (r12_imm));
3659+ else
3660+ fprintf (f, "\tldm sp++, %s\n", reglist);
3661+
3662+ }
3663+
3664+ }
3665+
3666+ if (IS_INTERRUPT (func_type))
3667+ {
3668+ fprintf (f, "\trete\n");
3669+ }
3670+ else if (insert_ret)
3671+ {
3672+ if (r12_imm)
3673+ fprintf (f, "\tretal %li\n", INTVAL (r12_imm));
3674+ else
3675+ fprintf (f, "\tretal r12\n");
3676+ }
3677+}
3678+
3679+/* Function for converting a fp-register mask to a
3680+ reglistCPD8 register list string. */
3681+void
3682+avr32_make_fp_reglist_d (int reglist_mask, char *reglist_string)
3683+{
3684+ int i;
3685+
3686+ /* Make sure reglist_string is empty */
3687+ reglist_string[0] = '\0';
3688+
3689+ for (i = 0; i < NUM_FP_REGS; i += 2)
3690+ {
3691+ if (reglist_mask & (1 << i))
3692+ {
3693+ strlen (reglist_string) ?
3694+ sprintf (reglist_string, "%s, %s-%s", reglist_string,
3695+ reg_names[INTERNAL_FP_REGNUM (i)],
3696+ reg_names[INTERNAL_FP_REGNUM (i + 1)]) :
3697+ sprintf (reglist_string, "%s-%s",
3698+ reg_names[INTERNAL_FP_REGNUM (i)],
3699+ reg_names[INTERNAL_FP_REGNUM (i + 1)]);
3700+ }
3701+ }
3702+}
3703+
3704+/* Function for converting a fp-register mask to a
3705+ reglistCP8 register list string. */
3706+void
3707+avr32_make_fp_reglist_w (int reglist_mask, char *reglist_string)
3708+{
3709+ int i;
3710+
3711+ /* Make sure reglist_string is empty */
3712+ reglist_string[0] = '\0';
3713+
3714+ for (i = 0; i < NUM_FP_REGS; ++i)
3715+ {
3716+ if (reglist_mask & (1 << i))
3717+ {
3718+ strlen (reglist_string) ?
3719+ sprintf (reglist_string, "%s, %s", reglist_string,
3720+ reg_names[INTERNAL_FP_REGNUM (i)]) :
3721+ sprintf (reglist_string, "%s", reg_names[INTERNAL_FP_REGNUM (i)]);
3722+ }
3723+ }
3724+}
3725+
3726+void
3727+avr32_make_reglist16 (int reglist16_vect, char *reglist16_string)
3728+{
3729+ int i;
3730+
3731+ /* Make sure reglist16_string is empty */
3732+ reglist16_string[0] = '\0';
3733+
3734+ for (i = 0; i < 16; ++i)
3735+ {
3736+ if (reglist16_vect & (1 << i))
3737+ {
3738+ strlen (reglist16_string) ?
3739+ sprintf (reglist16_string, "%s, %s", reglist16_string,
3740+ reg_names[INTERNAL_REGNUM (i)]) :
3741+ sprintf (reglist16_string, "%s", reg_names[INTERNAL_REGNUM (i)]);
3742+ }
3743+ }
3744+}
3745+
3746+int
3747+avr32_convert_to_reglist16 (int reglist8_vect)
3748+{
3749+ int reglist16_vect = 0;
3750+ if (reglist8_vect & 0x1)
3751+ reglist16_vect |= 0xF;
3752+ if (reglist8_vect & 0x2)
3753+ reglist16_vect |= 0xF0;
3754+ if (reglist8_vect & 0x4)
3755+ reglist16_vect |= 0x300;
3756+ if (reglist8_vect & 0x8)
3757+ reglist16_vect |= 0x400;
3758+ if (reglist8_vect & 0x10)
3759+ reglist16_vect |= 0x800;
3760+ if (reglist8_vect & 0x20)
3761+ reglist16_vect |= 0x1000;
3762+ if (reglist8_vect & 0x40)
3763+ reglist16_vect |= 0x4000;
3764+ if (reglist8_vect & 0x80)
3765+ reglist16_vect |= 0x8000;
3766+
3767+ return reglist16_vect;
3768+}
3769+
3770+void
3771+avr32_make_reglist8 (int reglist8_vect, char *reglist8_string)
3772+{
3773+ /* Make sure reglist8_string is empty */
3774+ reglist8_string[0] = '\0';
3775+
3776+ if (reglist8_vect & 0x1)
3777+ sprintf (reglist8_string, "r0-r3");
3778+ if (reglist8_vect & 0x2)
3779+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r4-r7",
3780+ reglist8_string) :
3781+ sprintf (reglist8_string, "r4-r7");
3782+ if (reglist8_vect & 0x4)
3783+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r8-r9",
3784+ reglist8_string) :
3785+ sprintf (reglist8_string, "r8-r9");
3786+ if (reglist8_vect & 0x8)
3787+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r10",
3788+ reglist8_string) :
3789+ sprintf (reglist8_string, "r10");
3790+ if (reglist8_vect & 0x10)
3791+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r11",
3792+ reglist8_string) :
3793+ sprintf (reglist8_string, "r11");
3794+ if (reglist8_vect & 0x20)
3795+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, r12",
3796+ reglist8_string) :
3797+ sprintf (reglist8_string, "r12");
3798+ if (reglist8_vect & 0x40)
3799+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, lr",
3800+ reglist8_string) :
3801+ sprintf (reglist8_string, "lr");
3802+ if (reglist8_vect & 0x80)
3803+ strlen (reglist8_string) ? sprintf (reglist8_string, "%s, pc",
3804+ reglist8_string) :
3805+ sprintf (reglist8_string, "pc");
3806+}
3807+
3808+int
3809+avr32_eh_return_data_regno (int n)
3810+{
3811+ if (n >= 0 && n <= 3)
3812+ return 8 + n;
3813+ else
3814+ return INVALID_REGNUM;
3815+}
3816+
3817+/* Compute the distance from register FROM to register TO.
3818+ These can be the arg pointer, the frame pointer or
3819+ the stack pointer.
3820+ Typical stack layout looks like this:
3821+
3822+ old stack pointer -> | |
3823+ ----
3824+ | | \
3825+ | | saved arguments for
3826+ | | vararg functions
3827+ arg_pointer -> | | /
3828+ --
3829+ | | \
3830+ | | call saved
3831+ | | registers
3832+ | | /
3833+ frame ptr -> --
3834+ | | \
3835+ | | local
3836+ | | variables
3837+ stack ptr --> | | /
3838+ --
3839+ | | \
3840+ | | outgoing
3841+ | | arguments
3842+ | | /
3843+ --
3844+
3845+ For a given funciton some or all of these stack compomnents
3846+ may not be needed, giving rise to the possibility of
3847+ eliminating some of the registers.
3848+
3849+ The values returned by this function must reflect the behaviour
3850+ of avr32_expand_prologue() and avr32_compute_save_reg_mask().
3851+
3852+ The sign of the number returned reflects the direction of stack
3853+ growth, so the values are positive for all eliminations except
3854+ from the soft frame pointer to the hard frame pointer. */
3855+
3856+
3857+int
3858+avr32_initial_elimination_offset (int from, int to)
3859+{
3860+ int i;
3861+ int call_saved_regs = 0;
3862+ unsigned long saved_reg_mask, saved_fp_reg_mask;
3863+ unsigned int local_vars = get_frame_size ();
3864+
3865+ saved_reg_mask = avr32_compute_save_reg_mask (TRUE);
3866+ saved_fp_reg_mask = avr32_compute_save_fp_reg_mask ();
3867+
3868+ for (i = 0; i < 16; ++i)
3869+ {
3870+ if (saved_reg_mask & (1 << i))
3871+ call_saved_regs += 4;
3872+ }
3873+
3874+ for (i = 0; i < NUM_FP_REGS; ++i)
3875+ {
3876+ if (saved_fp_reg_mask & (1 << i))
3877+ call_saved_regs += 4;
3878+ }
3879+
3880+ switch (from)
3881+ {
3882+ case ARG_POINTER_REGNUM:
3883+ switch (to)
3884+ {
3885+ case STACK_POINTER_REGNUM:
3886+ return call_saved_regs + local_vars;
3887+ case FRAME_POINTER_REGNUM:
3888+ return call_saved_regs;
3889+ default:
3890+ abort ();
3891+ }
3892+ case FRAME_POINTER_REGNUM:
3893+ switch (to)
3894+ {
3895+ case STACK_POINTER_REGNUM:
3896+ return local_vars;
3897+ default:
3898+ abort ();
3899+ }
3900+ default:
3901+ abort ();
3902+ }
3903+}
3904+
3905+
3906+/*
3907+ Returns a rtx used when passing the next argument to a function.
3908+ avr32_init_cumulative_args() and avr32_function_arg_advance() sets witch
3909+ register to use.
3910+*/
3911+rtx
3912+avr32_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode,
3913+ tree type, int named)
3914+{
3915+ int index = -1;
3916+
3917+ HOST_WIDE_INT arg_size, arg_rsize;
3918+ if (type)
3919+ {
3920+ arg_size = int_size_in_bytes (type);
3921+ }
3922+ else
3923+ {
3924+ arg_size = GET_MODE_SIZE (mode);
3925+ }
3926+ arg_rsize = PUSH_ROUNDING (arg_size);
3927+
3928+ /*
3929+ The last time this macro is called, it is called with mode == VOIDmode,
3930+ and its result is passed to the call or call_value pattern as operands 2
3931+ and 3 respectively. */
3932+ if (mode == VOIDmode)
3933+ {
3934+ return gen_rtx_CONST_INT (SImode, 22); /* ToDo: fixme. */
3935+ }
3936+
3937+ if ((*targetm.calls.must_pass_in_stack) (mode, type) || !named)
3938+ {
3939+ return NULL_RTX;
3940+ }
3941+
3942+ if (arg_rsize == 8)
3943+ {
3944+ /* use r11:r10 or r9:r8. */
3945+ if (!(GET_USED_INDEX (cum, 1) || GET_USED_INDEX (cum, 2)))
3946+ index = 1;
3947+ else if (!(GET_USED_INDEX (cum, 3) || GET_USED_INDEX (cum, 4)))
3948+ index = 3;
3949+ else
3950+ index = -1;
3951+ }
3952+ else if (arg_rsize == 4)
3953+ { /* Use first available register */
3954+ index = 0;
3955+ while (index <= LAST_CUM_REG_INDEX && GET_USED_INDEX (cum, index))
3956+ index++;
3957+ if (index > LAST_CUM_REG_INDEX)
3958+ index = -1;
3959+ }
3960+
3961+ SET_REG_INDEX (cum, index);
3962+
3963+ if (GET_REG_INDEX (cum) >= 0)
3964+ return gen_rtx_REG (mode,
3965+ avr32_function_arg_reglist[GET_REG_INDEX (cum)]);
3966+
3967+ return NULL_RTX;
3968+}
3969+
3970+/*
3971+ Set the register used for passing the first argument to a function.
3972+*/
3973+void
3974+avr32_init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype,
3975+ rtx libname ATTRIBUTE_UNUSED,
3976+ tree fndecl ATTRIBUTE_UNUSED)
3977+{
3978+ /* Set all registers as unused. */
3979+ SET_INDEXES_UNUSED (cum);
3980+
3981+ /* Reset uses_anonymous_args */
3982+ cum->uses_anonymous_args = 0;
3983+
3984+ /* Reset size of stack pushed arguments */
3985+ cum->stack_pushed_args_size = 0;
3986+
3987+ /* If the function is returning a value passed in memory r12 is used as a
3988+ Return Value Pointer. */
3989+
3990+ if (fntype != 0 && avr32_return_in_memory (TREE_TYPE (fntype), fntype))
3991+ {
3992+ SET_REG_INDEX (cum, 0);
3993+ SET_USED_INDEX (cum, GET_REG_INDEX (cum));
3994+ }
3995+}
3996+
3997+/*
3998+ Set register used for passing the next argument to a function. Only the
3999+ Scratch Registers are used.
4000+
4001+ number name
4002+ 15 r15 PC
4003+ 14 r14 LR
4004+ 13 r13 _SP_________
4005+ FIRST_CUM_REG 12 r12 _||_
4006+ 10 r11 ||
4007+ 11 r10 _||_ Scratch Registers
4008+ 8 r9 ||
4009+ LAST_SCRATCH_REG 9 r8 _\/_________
4010+ 6 r7 /\
4011+ 7 r6 ||
4012+ 4 r5 ||
4013+ 5 r4 ||
4014+ 2 r3 ||
4015+ 3 r2 ||
4016+ 0 r1 ||
4017+ 1 r0 _||_________
4018+
4019+*/
4020+void
4021+avr32_function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode,
4022+ tree type, int named ATTRIBUTE_UNUSED)
4023+{
4024+ HOST_WIDE_INT arg_size, arg_rsize;
4025+
4026+ if (type)
4027+ {
4028+ arg_size = int_size_in_bytes (type);
4029+ }
4030+ else
4031+ {
4032+ arg_size = GET_MODE_SIZE (mode);
4033+ }
4034+ arg_rsize = PUSH_ROUNDING (arg_size);
4035+
4036+ /* It the argument had to be passed in stack, no register is used. */
4037+ if ((*targetm.calls.must_pass_in_stack) (mode, type))
4038+ {
4039+ cum->stack_pushed_args_size += PUSH_ROUNDING (int_size_in_bytes (type));
4040+ return;
4041+ }
4042+
4043+ /* Mark the used registers as "used". */
4044+ if (GET_REG_INDEX (cum) >= 0)
4045+ {
4046+ SET_USED_INDEX (cum, GET_REG_INDEX (cum));
4047+ if (arg_rsize == 8)
4048+ {
4049+ SET_USED_INDEX (cum, (GET_REG_INDEX (cum) + 1));
4050+ }
4051+ }
4052+ else
4053+ {
4054+ /* Had to use stack */
4055+ cum->stack_pushed_args_size += arg_rsize;
4056+ }
4057+}
4058+
4059+/*
4060+ Defines witch direction to go to find the next register to use if the
4061+ argument is larger then one register or for arguments shorter than an
4062+ int which is not promoted, such as the last part of structures with
4063+ size not a multiple of 4. */
4064+enum direction
4065+avr32_function_arg_padding (enum machine_mode mode ATTRIBUTE_UNUSED,
4066+ tree type)
4067+{
4068+ /* Pad upward for all aggregates except byte and halfword sized aggregates
4069+ which can be passed in registers. */
4070+ if (type
4071+ && AGGREGATE_TYPE_P (type)
4072+ && (int_size_in_bytes (type) != 1)
4073+ && !((int_size_in_bytes (type) == 2)
4074+ && TYPE_ALIGN_UNIT (type) >= 2)
4075+ && (int_size_in_bytes (type) & 0x3))
4076+ {
4077+ return upward;
4078+ }
4079+
4080+ return downward;
4081+}
4082+
4083+/*
4084+ Return a rtx used for the return value from a function call.
4085+*/
4086+rtx
4087+avr32_function_value (tree type, tree func)
4088+{
4089+ if (avr32_return_in_memory (type, func))
4090+ return NULL_RTX;
4091+
4092+ if (int_size_in_bytes (type) <= 4)
4093+ if (avr32_return_in_msb (type))
4094+ /* Aggregates of size less than a word which does align the data in the
4095+ MSB must use SImode for r12. */
4096+ return gen_rtx_REG (SImode, RET_REGISTER);
4097+ else
4098+ return gen_rtx_REG (TYPE_MODE (type), RET_REGISTER);
4099+ else if (int_size_in_bytes (type) <= 8)
4100+ return gen_rtx_REG (TYPE_MODE (type), INTERNAL_REGNUM (11));
4101+
4102+ return NULL_RTX;
4103+}
4104+
4105+/*
4106+ Return a rtx used for the return value from a library function call.
4107+*/
4108+rtx
4109+avr32_libcall_value (enum machine_mode mode)
4110+{
4111+
4112+ if (GET_MODE_SIZE (mode) <= 4)
4113+ return gen_rtx_REG (mode, RET_REGISTER);
4114+ else if (GET_MODE_SIZE (mode) <= 8)
4115+ return gen_rtx_REG (mode, INTERNAL_REGNUM (11));
4116+ else
4117+ return NULL_RTX;
4118+}
4119+
4120+/* Return TRUE if X references a SYMBOL_REF. */
4121+int
4122+symbol_mentioned_p (rtx x)
4123+{
4124+ const char *fmt;
4125+ int i;
4126+
4127+ if (GET_CODE (x) == SYMBOL_REF)
4128+ return 1;
4129+
4130+ fmt = GET_RTX_FORMAT (GET_CODE (x));
4131+
4132+ for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
4133+ {
4134+ if (fmt[i] == 'E')
4135+ {
4136+ int j;
4137+
4138+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
4139+ if (symbol_mentioned_p (XVECEXP (x, i, j)))
4140+ return 1;
4141+ }
4142+ else if (fmt[i] == 'e' && symbol_mentioned_p (XEXP (x, i)))
4143+ return 1;
4144+ }
4145+
4146+ return 0;
4147+}
4148+
4149+/* Return TRUE if X references a LABEL_REF. */
4150+int
4151+label_mentioned_p (rtx x)
4152+{
4153+ const char *fmt;
4154+ int i;
4155+
4156+ if (GET_CODE (x) == LABEL_REF)
4157+ return 1;
4158+
4159+ fmt = GET_RTX_FORMAT (GET_CODE (x));
4160+ for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
4161+ {
4162+ if (fmt[i] == 'E')
4163+ {
4164+ int j;
4165+
4166+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
4167+ if (label_mentioned_p (XVECEXP (x, i, j)))
4168+ return 1;
4169+ }
4170+ else if (fmt[i] == 'e' && label_mentioned_p (XEXP (x, i)))
4171+ return 1;
4172+ }
4173+
4174+ return 0;
4175+}
4176+
4177+
4178+int
4179+avr32_legitimate_pic_operand_p (rtx x)
4180+{
4181+
4182+ /* We can't have const, this must be broken down to a symbol. */
4183+ if (GET_CODE (x) == CONST)
4184+ return FALSE;
4185+
4186+ /* Can't access symbols or labels via the constant pool either */
4187+ if ((GET_CODE (x) == SYMBOL_REF
4188+ && CONSTANT_POOL_ADDRESS_P (x)
4189+ && (symbol_mentioned_p (get_pool_constant (x))
4190+ || label_mentioned_p (get_pool_constant (x)))))
4191+ return FALSE;
4192+
4193+ return TRUE;
4194+}
4195+
4196+
4197+rtx
4198+legitimize_pic_address (rtx orig, enum machine_mode mode ATTRIBUTE_UNUSED,
4199+ rtx reg)
4200+{
4201+
4202+ if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
4203+ {
4204+ int subregs = 0;
4205+
4206+ if (reg == 0)
4207+ {
4208+ if (no_new_pseudos)
4209+ abort ();
4210+ else
4211+ reg = gen_reg_rtx (Pmode);
4212+
4213+ subregs = 1;
4214+ }
4215+
4216+ emit_move_insn (reg, orig);
4217+
4218+ /* Only set current function as using pic offset table if flag_pic is
4219+ set. This is because this function is also used if
4220+ TARGET_HAS_ASM_ADDR_PSEUDOS is set. */
4221+ if (flag_pic)
4222+ current_function_uses_pic_offset_table = 1;
4223+
4224+ /* Put a REG_EQUAL note on this insn, so that it can be optimized by
4225+ loop. */
4226+ return reg;
4227+ }
4228+ else if (GET_CODE (orig) == CONST)
4229+ {
4230+ rtx base, offset;
4231+
4232+ if (flag_pic
4233+ && GET_CODE (XEXP (orig, 0)) == PLUS
4234+ && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
4235+ return orig;
4236+
4237+ if (reg == 0)
4238+ {
4239+ if (no_new_pseudos)
4240+ abort ();
4241+ else
4242+ reg = gen_reg_rtx (Pmode);
4243+ }
4244+
4245+ if (GET_CODE (XEXP (orig, 0)) == PLUS)
4246+ {
4247+ base =
4248+ legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
4249+ offset =
4250+ legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
4251+ base == reg ? 0 : reg);
4252+ }
4253+ else
4254+ abort ();
4255+
4256+ if (GET_CODE (offset) == CONST_INT)
4257+ {
4258+ /* The base register doesn't really matter, we only want to test
4259+ the index for the appropriate mode. */
4260+ if (!avr32_const_ok_for_constraint_p (INTVAL (offset), 'I', "Is21"))
4261+ {
4262+ if (!no_new_pseudos)
4263+ offset = force_reg (Pmode, offset);
4264+ else
4265+ abort ();
4266+ }
4267+
4268+ if (GET_CODE (offset) == CONST_INT)
4269+ return plus_constant (base, INTVAL (offset));
4270+ }
4271+
4272+ return gen_rtx_PLUS (Pmode, base, offset);
4273+ }
4274+
4275+ return orig;
4276+}
4277+
4278+/* Generate code to load the PIC register. */
4279+void
4280+avr32_load_pic_register (void)
4281+{
4282+ rtx l1, pic_tmp;
4283+ rtx global_offset_table;
4284+
4285+ if ((current_function_uses_pic_offset_table == 0) || TARGET_NO_INIT_GOT)
4286+ return;
4287+
4288+ if (!flag_pic)
4289+ abort ();
4290+
4291+ l1 = gen_label_rtx ();
4292+
4293+ global_offset_table = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
4294+ pic_tmp =
4295+ gen_rtx_CONST (Pmode,
4296+ gen_rtx_MINUS (SImode, gen_rtx_LABEL_REF (Pmode, l1),
4297+ global_offset_table));
4298+ emit_insn (gen_pic_load_addr
4299+ (pic_offset_table_rtx, force_const_mem (SImode, pic_tmp)));
4300+ emit_insn (gen_pic_compute_got_from_pc (pic_offset_table_rtx, l1));
4301+
4302+ /* Need to emit this whether or not we obey regdecls, since setjmp/longjmp
4303+ can cause life info to screw up. */
4304+ emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
4305+}
4306+
4307+
4308+
4309+/* This hook should return true if values of type type are returned at the most
4310+ significant end of a register (in other words, if they are padded at the
4311+ least significant end). You can assume that type is returned in a register;
4312+ the caller is required to check this. Note that the register provided by
4313+ FUNCTION_VALUE must be able to hold the complete return value. For example,
4314+ if a 1-, 2- or 3-byte structure is returned at the most significant end of a
4315+ 4-byte register, FUNCTION_VALUE should provide an SImode rtx. */
4316+bool
4317+avr32_return_in_msb (tree type ATTRIBUTE_UNUSED)
4318+{
4319+ /* if ( AGGREGATE_TYPE_P (type) ) if ((int_size_in_bytes(type) == 1) ||
4320+ ((int_size_in_bytes(type) == 2) && TYPE_ALIGN_UNIT(type) >= 2)) return
4321+ false; else return true; */
4322+
4323+ return false;
4324+}
4325+
4326+
4327+/*
4328+ Returns one if a certain function value is going to be returned in memory
4329+ and zero if it is going to be returned in a register.
4330+
4331+ BLKmode and all other modes that is larger than 64 bits are returned in
4332+ memory.
4333+*/
4334+bool
4335+avr32_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
4336+{
4337+ if (TYPE_MODE (type) == VOIDmode)
4338+ return false;
4339+
4340+ if (int_size_in_bytes (type) > (2 * UNITS_PER_WORD)
4341+ || int_size_in_bytes (type) == -1)
4342+ {
4343+ return true;
4344+ }
4345+
4346+ /* If we have an aggregate then use the same mechanism as when checking if
4347+ it should be passed on the stack. */
4348+ if (type
4349+ && AGGREGATE_TYPE_P (type)
4350+ && (*targetm.calls.must_pass_in_stack) (TYPE_MODE (type), type))
4351+ return true;
4352+
4353+ return false;
4354+}
4355+
4356+
4357+/* Output the constant part of the trampoline.
4358+ lddpc r0, pc[0x8:e] ; load static chain register
4359+ lddpc pc, pc[0x8:e] ; jump to subrutine
4360+ .long 0 ; Address to static chain,
4361+ ; filled in by avr32_initialize_trampoline()
4362+ .long 0 ; Address to subrutine,
4363+ ; filled in by avr32_initialize_trampoline()
4364+*/
4365+void
4366+avr32_trampoline_template (FILE * file)
4367+{
4368+ fprintf (file, "\tlddpc r0, pc[8]\n");
4369+ fprintf (file, "\tlddpc pc, pc[8]\n");
4370+ /* make room for the address of the static chain. */
4371+ fprintf (file, "\t.long\t0\n");
4372+ /* make room for the address to the subrutine. */
4373+ fprintf (file, "\t.long\t0\n");
4374+}
4375+
4376+
4377+/*
4378+ Initialize the variable parts of a trampoline.
4379+*/
4380+void
4381+avr32_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
4382+{
4383+ /* Store the address to the static chain. */
4384+ emit_move_insn (gen_rtx_MEM
4385+ (SImode, plus_constant (addr, TRAMPOLINE_SIZE - 4)),
4386+ static_chain);
4387+
4388+ /* Store the address to the function. */
4389+ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, TRAMPOLINE_SIZE)),
4390+ fnaddr);
4391+
4392+ emit_insn (gen_cache (gen_rtx_REG (SImode, 13),
4393+ gen_rtx_CONST_INT (SImode,
4394+ AVR32_CACHE_INVALIDATE_ICACHE)));
4395+}
4396+
4397+/* Return nonzero if X is valid as an addressing register. */
4398+int
4399+avr32_address_register_rtx_p (rtx x, int strict_p)
4400+{
4401+ int regno;
4402+
4403+ if (GET_CODE (x) != REG)
4404+ return 0;
4405+
4406+ regno = REGNO (x);
4407+
4408+ if (strict_p)
4409+ return REGNO_OK_FOR_BASE_P (regno);
4410+
4411+ return (regno <= LAST_REGNUM || regno >= FIRST_PSEUDO_REGISTER);
4412+}
4413+
4414+/* Return nonzero if INDEX is valid for an address index operand. */
4415+int
4416+avr32_legitimate_index_p (enum machine_mode mode, rtx index, int strict_p)
4417+{
4418+ enum rtx_code code = GET_CODE (index);
4419+
4420+ if (mode == TImode)
4421+ return 0;
4422+
4423+ /* Standard coprocessor addressing modes. */
4424+ if (code == CONST_INT)
4425+ {
4426+ if (TARGET_HARD_FLOAT && GET_MODE_CLASS (mode) == MODE_FLOAT)
4427+ /* Coprocessor mem insns has a smaller reach than ordinary mem insns */
4428+ return CONST_OK_FOR_CONSTRAINT_P (INTVAL (index), 'K', "Ku14");
4429+ else
4430+ return CONST_OK_FOR_CONSTRAINT_P (INTVAL (index), 'K', "Ks16");
4431+ }
4432+
4433+ if (avr32_address_register_rtx_p (index, strict_p))
4434+ return 1;
4435+
4436+ if (code == MULT)
4437+ {
4438+ rtx xiop0 = XEXP (index, 0);
4439+ rtx xiop1 = XEXP (index, 1);
4440+ return ((avr32_address_register_rtx_p (xiop0, strict_p)
4441+ && power_of_two_operand (xiop1, SImode)
4442+ && (INTVAL (xiop1) <= 8))
4443+ || (avr32_address_register_rtx_p (xiop1, strict_p)
4444+ && power_of_two_operand (xiop0, SImode)
4445+ && (INTVAL (xiop0) <= 8)));
4446+ }
4447+ else if (code == ASHIFT)
4448+ {
4449+ rtx op = XEXP (index, 1);
4450+
4451+ return (avr32_address_register_rtx_p (XEXP (index, 0), strict_p)
4452+ && GET_CODE (op) == CONST_INT
4453+ && INTVAL (op) > 0 && INTVAL (op) <= 3);
4454+ }
4455+
4456+ return 0;
4457+}
4458+
4459+/*
4460+ Used in the GO_IF_LEGITIMATE_ADDRESS macro. Returns a nonzero value if
4461+ the RTX x is a legitimate memory address.
4462+
4463+ Returns NO_REGS if the address is not legatime, GENERAL_REGS or ALL_REGS
4464+ if it is.
4465+*/
4466+
4467+/* Forward declaration*/
4468+int is_minipool_label (rtx label);
4469+
4470+int
4471+avr32_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED,
4472+ rtx x, int strict)
4473+{
4474+
4475+ switch (GET_CODE (x))
4476+ {
4477+ case REG:
4478+ return avr32_address_register_rtx_p (x, strict);
4479+ case CONST:
4480+ {
4481+ rtx label = avr32_find_symbol (x);
4482+ if (label
4483+ &&
4484+ ( (CONSTANT_POOL_ADDRESS_P (label)
4485+ && !(flag_pic
4486+ && (symbol_mentioned_p (get_pool_constant (label))
4487+ || label_mentioned_p (get_pool_constant(label)))))
4488+ /* TODO! Can this ever happen??? */
4489+ || ((GET_CODE (label) == LABEL_REF)
4490+ && GET_CODE (XEXP (label, 0)) == CODE_LABEL
4491+ && is_minipool_label (XEXP (label, 0)))))
4492+ {
4493+ return TRUE;
4494+ }
4495+ }
4496+ break;
4497+ case LABEL_REF:
4498+ if (GET_CODE (XEXP (x, 0)) == CODE_LABEL
4499+ && is_minipool_label (XEXP (x, 0)))
4500+ {
4501+ return TRUE;
4502+ }
4503+ break;
4504+ case SYMBOL_REF:
4505+ {
4506+ if (CONSTANT_POOL_ADDRESS_P (x)
4507+ && !(flag_pic
4508+ && (symbol_mentioned_p (get_pool_constant (x))
4509+ || label_mentioned_p (get_pool_constant (x)))))
4510+ return TRUE;
4511+ /*
4512+ A symbol_ref is only legal if it is a function. If all of them are
4513+ legal, a pseudo reg that is a constant will be replaced by a
4514+ symbol_ref and make illegale code. SYMBOL_REF_FLAG is set by
4515+ ENCODE_SECTION_INFO. */
4516+ else if (SYMBOL_REF_RCALL_FUNCTION_P (x))
4517+ return TRUE;
4518+ break;
4519+ }
4520+ case PRE_DEC: /* (pre_dec (...)) */
4521+ case POST_INC: /* (post_inc (...)) */
4522+ return avr32_address_register_rtx_p (XEXP (x, 0), strict);
4523+ case PLUS: /* (plus (...) (...)) */
4524+ {
4525+ rtx xop0 = XEXP (x, 0);
4526+ rtx xop1 = XEXP (x, 1);
4527+
4528+ return ((avr32_address_register_rtx_p (xop0, strict)
4529+ && avr32_legitimate_index_p (mode, xop1, strict))
4530+ || (avr32_address_register_rtx_p (xop1, strict)
4531+ && avr32_legitimate_index_p (mode, xop0, strict)));
4532+ }
4533+ default:
4534+ break;
4535+ }
4536+
4537+ return FALSE;
4538+}
4539+
4540+
4541+int
4542+avr32_const_double_immediate (rtx value)
4543+{
4544+ HOST_WIDE_INT hi, lo;
4545+
4546+ if (GET_CODE (value) != CONST_DOUBLE)
4547+ return FALSE;
4548+
4549+ if (GET_MODE (value) == DImode)
4550+ {
4551+ hi = CONST_DOUBLE_HIGH (value);
4552+ lo = CONST_DOUBLE_LOW (value);
4553+ }
4554+ else
4555+ {
4556+ HOST_WIDE_INT target_float[2];
4557+ hi = lo = 0;
4558+ real_to_target (target_float, CONST_DOUBLE_REAL_VALUE (value),
4559+ GET_MODE (value));
4560+ lo = target_float[0];
4561+ hi = target_float[1];
4562+ }
4563+ if (avr32_const_ok_for_constraint_p (lo, 'K', "Ks21")
4564+ && ((GET_MODE (value) == SFmode)
4565+ || avr32_const_ok_for_constraint_p (hi, 'K', "Ks21")))
4566+ {
4567+ return TRUE;
4568+ }
4569+
4570+ return FALSE;
4571+}
4572+
4573+
4574+int
4575+avr32_legitimate_constant_p (rtx x)
4576+{
4577+ switch (GET_CODE (x))
4578+ {
4579+ case CONST_INT:
4580+ return avr32_const_ok_for_constraint_p (INTVAL (x), 'K', "Ks21");
4581+ case CONST_DOUBLE:
4582+ if (GET_MODE (x) == SFmode
4583+ || GET_MODE (x) == DFmode || GET_MODE (x) == DImode)
4584+ return avr32_const_double_immediate (x);
4585+ else
4586+ return 0;
4587+ case LABEL_REF:
4588+ return flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS;
4589+ case SYMBOL_REF:
4590+ return flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS;
4591+ case CONST:
4592+ /* We must handle this one in the movsi expansion in order for gcc not
4593+ to put it in the constant pool. */
4594+ return 0 /* flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS */ ;
4595+ case HIGH:
4596+ case CONST_VECTOR:
4597+ return 0;
4598+ default:
4599+ printf ("%s():\n", __FUNCTION__);
4600+ debug_rtx (x);
4601+ return 1;
4602+ }
4603+}
4604+
4605+
4606+/* Strip any special encoding from labels */
4607+const char *
4608+avr32_strip_name_encoding (const char *name)
4609+{
4610+ const char *stripped = name;
4611+
4612+ while (1)
4613+ {
4614+ switch (stripped[0])
4615+ {
4616+ case '#':
4617+ stripped = strchr (name + 1, '#') + 1;
4618+ break;
4619+ case '*':
4620+ stripped = &stripped[1];
4621+ break;
4622+ default:
4623+ return stripped;
4624+ }
4625+ }
4626+}
4627+
4628+
4629+
4630+/* Do anything needed before RTL is emitted for each function. */
4631+static struct machine_function *
4632+avr32_init_machine_status (void)
4633+{
4634+ struct machine_function *machine;
4635+ machine =
4636+ (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
4637+
4638+#if AVR32_FT_UNKNOWN != 0
4639+ machine->func_type = AVR32_FT_UNKNOWN;
4640+#endif
4641+
4642+ machine->minipool_label_head = 0;
4643+ machine->minipool_label_tail = 0;
4644+ return machine;
4645+}
4646+
4647+void
4648+avr32_init_expanders (void)
4649+{
4650+ /* Arrange to initialize and mark the machine per-function status. */
4651+ init_machine_status = avr32_init_machine_status;
4652+}
4653+
4654+
4655+/* Return an RTX indicating where the return address to the
4656+ calling function can be found. */
4657+
4658+rtx
4659+avr32_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
4660+{
4661+ if (count != 0)
4662+ return NULL_RTX;
4663+
4664+ return get_hard_reg_initial_val (Pmode, LR_REGNUM);
4665+}
4666+
4667+
4668+void
4669+avr32_encode_section_info (tree decl, rtx rtl, int first)
4670+{
4671+
4672+ if (first && DECL_P (decl))
4673+ {
4674+ /* Set SYMBOL_REG_FLAG for local functions */
4675+ if (!TREE_PUBLIC (decl) && TREE_CODE (decl) == FUNCTION_DECL)
4676+ {
4677+ if ((*targetm.binds_local_p) (decl))
4678+ {
4679+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
4680+ }
4681+ }
4682+ }
4683+}
4684+
4685+
4686+void
4687+avr32_asm_output_ascii (FILE * stream, char *ptr, int len)
4688+{
4689+ int i, i_new = 0;
4690+ char *new_ptr = xmalloc (4 * len);
4691+ if (new_ptr == NULL)
4692+ internal_error ("Out of memory.");
4693+
4694+ for (i = 0; i < len; i++)
4695+ {
4696+ if (ptr[i] == '\n')
4697+ {
4698+ new_ptr[i_new++] = '\\';
4699+ new_ptr[i_new++] = '0';
4700+ new_ptr[i_new++] = '1';
4701+ new_ptr[i_new++] = '2';
4702+ }
4703+ else if (ptr[i] == '\"')
4704+ {
4705+ new_ptr[i_new++] = '\\';
4706+ new_ptr[i_new++] = '\"';
4707+ }
4708+ else if (ptr[i] == '\\')
4709+ {
4710+ new_ptr[i_new++] = '\\';
4711+ new_ptr[i_new++] = '\\';
4712+ }
4713+ else if (ptr[i] == '\0' && i + 1 < len)
4714+ {
4715+ new_ptr[i_new++] = '\\';
4716+ new_ptr[i_new++] = '0';
4717+ }
4718+ else
4719+ {
4720+ new_ptr[i_new++] = ptr[i];
4721+ }
4722+ }
4723+
4724+ /* Terminate new_ptr. */
4725+ new_ptr[i_new] = '\0';
4726+ fprintf (stream, "\t.ascii\t\"%s\"\n", new_ptr);
4727+ free (new_ptr);
4728+}
4729+
4730+
4731+void
4732+avr32_asm_output_label (FILE * stream, const char *name)
4733+{
4734+ name = avr32_strip_name_encoding (name);
4735+
4736+ /* Print the label. */
4737+ assemble_name (stream, name);
4738+ fprintf (stream, ":\n");
4739+}
4740+
4741+
4742+
4743+void
4744+avr32_asm_weaken_label (FILE * stream, const char *name)
4745+{
4746+ fprintf (stream, "\t.weak ");
4747+ assemble_name (stream, name);
4748+ fprintf (stream, "\n");
4749+}
4750+
4751+/*
4752+ Checks if a labelref is equal to a reserved word in the assembler. If it is,
4753+ insert a '_' before the label name.
4754+*/
4755+void
4756+avr32_asm_output_labelref (FILE * stream, const char *name)
4757+{
4758+ int verbatim = FALSE;
4759+ const char *stripped = name;
4760+ int strip_finished = FALSE;
4761+
4762+ while (!strip_finished)
4763+ {
4764+ switch (stripped[0])
4765+ {
4766+ case '#':
4767+ stripped = strchr (name + 1, '#') + 1;
4768+ break;
4769+ case '*':
4770+ stripped = &stripped[1];
4771+ verbatim = TRUE;
4772+ break;
4773+ default:
4774+ strip_finished = TRUE;
4775+ break;
4776+ }
4777+ }
4778+
4779+ if (verbatim)
4780+ fputs (stripped, stream);
4781+ else
4782+ asm_fprintf (stream, "%U%s", stripped);
4783+}
4784+
4785+
4786+
4787+/*
4788+ Check if the comparison in compare_exp is redundant
4789+ for the condition given in next_cond given that the
4790+ needed flags are already set by an earlier instruction.
4791+ Uses cc_prev_status to check this.
4792+
4793+ Returns NULL_RTX if the compare is not redundant
4794+ or the new condition to use in the conditional
4795+ instruction if the compare is redundant.
4796+*/
4797+static rtx
4798+is_compare_redundant (rtx compare_exp, rtx next_cond)
4799+{
4800+ int z_flag_valid = FALSE;
4801+ int n_flag_valid = FALSE;
4802+ rtx new_cond;
4803+
4804+ if (GET_CODE (compare_exp) != COMPARE)
4805+ return NULL_RTX;
4806+
4807+
4808+ if (GET_MODE (compare_exp) != SImode)
4809+ return NULL_RTX;
4810+
4811+ if (rtx_equal_p (cc_prev_status.mdep.value, compare_exp))
4812+ {
4813+ /* cc0 already contains the correct comparison -> delete cmp insn */
4814+ return next_cond;
4815+ }
4816+
4817+ switch (cc_prev_status.mdep.flags)
4818+ {
4819+ case CC_SET_VNCZ:
4820+ case CC_SET_NCZ:
4821+ n_flag_valid = TRUE;
4822+ case CC_SET_CZ:
4823+ case CC_SET_Z:
4824+ z_flag_valid = TRUE;
4825+ }
4826+
4827+ if (cc_prev_status.mdep.value
4828+ && REG_P (XEXP (compare_exp, 0))
4829+ && REGNO (XEXP (compare_exp, 0)) == REGNO (cc_prev_status.mdep.value)
4830+ && GET_CODE (XEXP (compare_exp, 1)) == CONST_INT
4831+ && next_cond != NULL_RTX)
4832+ {
4833+ if (INTVAL (XEXP (compare_exp, 1)) == 0
4834+ && z_flag_valid
4835+ && (GET_CODE (next_cond) == EQ || GET_CODE (next_cond) == NE))
4836+ /* We can skip comparison Z flag is already reflecting ops[0] */
4837+ return next_cond;
4838+ else if (n_flag_valid
4839+ && ((INTVAL (XEXP (compare_exp, 1)) == 0
4840+ && (GET_CODE (next_cond) == GE
4841+ || GET_CODE (next_cond) == LT))
4842+ || (INTVAL (XEXP (compare_exp, 1)) == -1
4843+ && (GET_CODE (next_cond) == GT
4844+ || GET_CODE (next_cond) == LE))))
4845+ {
4846+ /* We can skip comparison N flag is already reflecting ops[0],
4847+ which means that we can use the mi/pl conditions to check if
4848+ ops[0] is GE or LT 0. */
4849+ if ((GET_CODE (next_cond) == GE) || (GET_CODE (next_cond) == GT))
4850+ new_cond =
4851+ gen_rtx_UNSPEC (CCmode, gen_rtvec (2, cc0_rtx, const0_rtx),
4852+ UNSPEC_COND_PL);
4853+ else
4854+ new_cond =
4855+ gen_rtx_UNSPEC (CCmode, gen_rtvec (2, cc0_rtx, const0_rtx),
4856+ UNSPEC_COND_MI);
4857+ return new_cond;
4858+ }
4859+ }
4860+ return NULL_RTX;
4861+}
4862+
4863+/* Updates cc_status. */
4864+void
4865+avr32_notice_update_cc (rtx exp, rtx insn)
4866+{
4867+ switch (get_attr_cc (insn))
4868+ {
4869+ case CC_CALL_SET:
4870+ CC_STATUS_INIT;
4871+ FPCC_STATUS_INIT;
4872+ /* Check if the function call returns a value in r12 */
4873+ if (REG_P (recog_data.operand[0])
4874+ && REGNO (recog_data.operand[0]) == RETVAL_REGNUM)
4875+ {
4876+ cc_status.flags = 0;
4877+ cc_status.mdep.value =
4878+ gen_rtx_COMPARE (SImode, recog_data.operand[0], const0_rtx);
4879+ cc_status.mdep.flags = CC_SET_VNCZ;
4880+
4881+ }
4882+ break;
4883+ case CC_COMPARE:
4884+ /* Check that compare will not be optimized away if so nothing should
4885+ be done */
4886+ if (is_compare_redundant (SET_SRC (exp), get_next_insn_cond (insn))
4887+ == NULL_RTX)
4888+ {
4889+
4890+ /* Reset the nonstandard flag */
4891+ CC_STATUS_INIT;
4892+ cc_status.flags = 0;
4893+ cc_status.mdep.value = SET_SRC (exp);
4894+ cc_status.mdep.flags = CC_SET_VNCZ;
4895+ }
4896+ break;
4897+ case CC_FPCOMPARE:
4898+ /* Check that floating-point compare will not be optimized away if so
4899+ nothing should be done */
4900+ if (!rtx_equal_p (cc_prev_status.mdep.fpvalue, SET_SRC (exp)))
4901+ {
4902+ /* cc0 already contains the correct comparison -> delete cmp insn */
4903+ /* Reset the nonstandard flag */
4904+ cc_status.mdep.fpvalue = SET_SRC (exp);
4905+ cc_status.mdep.fpflags = CC_SET_CZ;
4906+ }
4907+ break;
4908+ case CC_FROM_FPCC:
4909+ /* Flags are updated with flags from Floating-point coprocessor, set
4910+ CC_NOT_SIGNED flag since the flags are set so that unsigned
4911+ condidion codes can be used directly. */
4912+ CC_STATUS_INIT;
4913+ cc_status.flags = CC_NOT_SIGNED;
4914+ cc_status.mdep.value = cc_status.mdep.fpvalue;
4915+ cc_status.mdep.flags = cc_status.mdep.fpflags;
4916+ break;
4917+ case CC_BLD:
4918+ /* Bit load is kind of like an inverted testsi, because the Z flag is
4919+ inverted */
4920+ CC_STATUS_INIT;
4921+ cc_status.flags = CC_INVERTED;
4922+ cc_status.mdep.value = SET_SRC (exp);
4923+ cc_status.mdep.flags = CC_SET_Z;
4924+ break;
4925+ case CC_NONE:
4926+ /* Insn does not affect CC at all. Check if the instruction updates
4927+ some of the register currently reflected in cc0 */
4928+
4929+ if ((GET_CODE (exp) == SET)
4930+ && (cc_status.value1 || cc_status.value2 || cc_status.mdep.value)
4931+ && (reg_mentioned_p (SET_DEST (exp), cc_status.value1)
4932+ || reg_mentioned_p (SET_DEST (exp), cc_status.value2)
4933+ || reg_mentioned_p (SET_DEST (exp), cc_status.mdep.value)))
4934+ {
4935+ CC_STATUS_INIT;
4936+ }
4937+
4938+ /* If this is a parallel we must step through each of the parallel
4939+ expressions */
4940+ if (GET_CODE (exp) == PARALLEL)
4941+ {
4942+ int i;
4943+ for (i = 0; i < XVECLEN (exp, 0); ++i)
4944+ {
4945+ rtx vec_exp = XVECEXP (exp, 0, i);
4946+ if ((GET_CODE (vec_exp) == SET)
4947+ && (cc_status.value1 || cc_status.value2
4948+ || cc_status.mdep.value)
4949+ && (reg_mentioned_p (SET_DEST (vec_exp), cc_status.value1)
4950+ || reg_mentioned_p (SET_DEST (vec_exp),
4951+ cc_status.value2)
4952+ || reg_mentioned_p (SET_DEST (vec_exp),
4953+ cc_status.mdep.value)))
4954+ {
4955+ CC_STATUS_INIT;
4956+ }
4957+ }
4958+ }
4959+
4960+ /* Check if we have memory opartions with post_inc or pre_dec on the
4961+ register currently reflected in cc0 */
4962+ if (GET_CODE (exp) == SET
4963+ && GET_CODE (SET_SRC (exp)) == MEM
4964+ && (GET_CODE (XEXP (SET_SRC (exp), 0)) == POST_INC
4965+ || GET_CODE (XEXP (SET_SRC (exp), 0)) == PRE_DEC)
4966+ &&
4967+ (reg_mentioned_p
4968+ (XEXP (XEXP (SET_SRC (exp), 0), 0), cc_status.value1)
4969+ || reg_mentioned_p (XEXP (XEXP (SET_SRC (exp), 0), 0),
4970+ cc_status.value2)
4971+ || reg_mentioned_p (XEXP (XEXP (SET_SRC (exp), 0), 0),
4972+ cc_status.mdep.value)))
4973+ CC_STATUS_INIT;
4974+
4975+ if (GET_CODE (exp) == SET
4976+ && GET_CODE (SET_DEST (exp)) == MEM
4977+ && (GET_CODE (XEXP (SET_DEST (exp), 0)) == POST_INC
4978+ || GET_CODE (XEXP (SET_DEST (exp), 0)) == PRE_DEC)
4979+ &&
4980+ (reg_mentioned_p
4981+ (XEXP (XEXP (SET_DEST (exp), 0), 0), cc_status.value1)
4982+ || reg_mentioned_p (XEXP (XEXP (SET_DEST (exp), 0), 0),
4983+ cc_status.value2)
4984+ || reg_mentioned_p (XEXP (XEXP (SET_DEST (exp), 0), 0),
4985+ cc_status.mdep.value)))
4986+ CC_STATUS_INIT;
4987+ break;
4988+
4989+ case CC_SET_VNCZ:
4990+ CC_STATUS_INIT;
4991+ cc_status.mdep.value = recog_data.operand[0];
4992+ cc_status.mdep.flags = CC_SET_VNCZ;
4993+ break;
4994+
4995+ case CC_SET_NCZ:
4996+ CC_STATUS_INIT;
4997+ cc_status.mdep.value = recog_data.operand[0];
4998+ cc_status.mdep.flags = CC_SET_NCZ;
4999+ break;
5000+
5001+ case CC_SET_CZ:
5002+ CC_STATUS_INIT;
5003+ cc_status.mdep.value = recog_data.operand[0];
5004+ cc_status.mdep.flags = CC_SET_CZ;
5005+ break;
5006+
5007+ case CC_SET_Z:
5008+ CC_STATUS_INIT;
5009+ cc_status.mdep.value = recog_data.operand[0];
5010+ cc_status.mdep.flags = CC_SET_Z;
5011+ break;
5012+
5013+ case CC_CLOBBER:
5014+ CC_STATUS_INIT;
5015+ break;
5016+
5017+ default:
5018+ CC_STATUS_INIT;
5019+ }
5020+}
5021+
5022+
5023+/*
5024+ Outputs to stdio stream stream the assembler syntax for an instruction
5025+ operand x. x is an RTL expression.
5026+*/
5027+void
5028+avr32_print_operand (FILE * stream, rtx x, int code)
5029+{
5030+ int error = 0;
5031+
5032+ switch (GET_CODE (x))
5033+ {
5034+ case UNSPEC:
5035+ switch (XINT (x, 1))
5036+ {
5037+ case UNSPEC_COND_PL:
5038+ if (code == 'i')
5039+ fputs ("mi", stream);
5040+ else
5041+ fputs ("pl", stream);
5042+ break;
5043+ case UNSPEC_COND_MI:
5044+ if (code == 'i')
5045+ fputs ("pl", stream);
5046+ else
5047+ fputs ("mi", stream);
5048+ break;
5049+ default:
5050+ error = 1;
5051+ }
5052+ break;
5053+ case EQ:
5054+ if (code == 'i')
5055+ fputs ("ne", stream);
5056+ else
5057+ fputs ("eq", stream);
5058+ break;
5059+ case NE:
5060+ if (code == 'i')
5061+ fputs ("eq", stream);
5062+ else
5063+ fputs ("ne", stream);
5064+ break;
5065+ case GT:
5066+ if (code == 'i')
5067+ fputs ("le", stream);
5068+ else
5069+ fputs ("gt", stream);
5070+ break;
5071+ case GTU:
5072+ if (code == 'i')
5073+ fputs ("ls", stream);
5074+ else
5075+ fputs ("hi", stream);
5076+ break;
5077+ case LT:
5078+ if (code == 'i')
5079+ fputs ("ge", stream);
5080+ else
5081+ fputs ("lt", stream);
5082+ break;
5083+ case LTU:
5084+ if (code == 'i')
5085+ fputs ("hs", stream);
5086+ else
5087+ fputs ("lo", stream);
5088+ break;
5089+ case GE:
5090+ if (code == 'i')
5091+ fputs ("lt", stream);
5092+ else
5093+ fputs ("ge", stream);
5094+ break;
5095+ case GEU:
5096+ if (code == 'i')
5097+ fputs ("lo", stream);
5098+ else
5099+ fputs ("hs", stream);
5100+ break;
5101+ case LE:
5102+ if (code == 'i')
5103+ fputs ("gt", stream);
5104+ else
5105+ fputs ("le", stream);
5106+ break;
5107+ case LEU:
5108+ if (code == 'i')
5109+ fputs ("hi", stream);
5110+ else
5111+ fputs ("ls", stream);
5112+ break;
5113+ case CONST_INT:
5114+ {
5115+ int value = INTVAL (x);
5116+
5117+ if (code == 'i')
5118+ {
5119+ value++;
5120+ }
5121+
5122+ if (code == 'p')
5123+ {
5124+ /* Set to bit position of first bit set in immediate */
5125+ int i, bitpos = 32;
5126+ for (i = 0; i < 32; i++)
5127+ if (value & (1 << i))
5128+ {
5129+ bitpos = i;
5130+ break;
5131+ }
5132+ value = bitpos;
5133+ }
5134+
5135+ if (code == 'r')
5136+ {
5137+ /* Reglist 8 */
5138+ char op[50];
5139+ op[0] = '\0';
5140+
5141+ if (value & 0x01)
5142+ sprintf (op, "r0-r3");
5143+ if (value & 0x02)
5144+ strlen (op) ? sprintf (op, "%s, r4-r7", op) : sprintf (op,
5145+ "r4-r7");
5146+ if (value & 0x04)
5147+ strlen (op) ? sprintf (op, "%s, r8-r9", op) : sprintf (op,
5148+ "r8-r9");
5149+ if (value & 0x08)
5150+ strlen (op) ? sprintf (op, "%s, r10", op) : sprintf (op, "r10");
5151+ if (value & 0x10)
5152+ strlen (op) ? sprintf (op, "%s, r11", op) : sprintf (op, "r11");
5153+ if (value & 0x20)
5154+ strlen (op) ? sprintf (op, "%s, r12", op) : sprintf (op, "r12");
5155+ if (value & 0x40)
5156+ strlen (op) ? sprintf (op, "%s, lr", op) : sprintf (op, "lr");
5157+ if (value & 0x80)
5158+ strlen (op) ? sprintf (op, "%s, pc", op) : sprintf (op, "pc");
5159+
5160+ fputs (op, stream);
5161+ }
5162+ else if (code == 's')
5163+ {
5164+ /* Reglist 16 */
5165+ char reglist16_string[100];
5166+ int i;
5167+ reglist16_string[0] = '\0';
5168+
5169+ for (i = 0; i < 16; ++i)
5170+ {
5171+ if (value & (1 << i))
5172+ {
5173+ strlen (reglist16_string) ? sprintf (reglist16_string,
5174+ "%s, %s",
5175+ reglist16_string,
5176+ reg_names
5177+ [INTERNAL_REGNUM
5178+ (i)]) :
5179+ sprintf (reglist16_string, "%s",
5180+ reg_names[INTERNAL_REGNUM (i)]);
5181+ }
5182+ }
5183+ fputs (reglist16_string, stream);
5184+ }
5185+ else if (code == 'C')
5186+ {
5187+ /* RegListCP8 */
5188+ char reglist_string[100];
5189+ avr32_make_fp_reglist_w (value, (char *) reglist_string);
5190+ fputs (reglist_string, stream);
5191+ }
5192+ else if (code == 'D')
5193+ {
5194+ /* RegListCPD8 */
5195+ char reglist_string[100];
5196+ avr32_make_fp_reglist_d (value, (char *) reglist_string);
5197+ fputs (reglist_string, stream);
5198+ }
5199+ else if (code == 'd')
5200+ {
5201+ /* Print in decimal format */
5202+ fprintf (stream, "%d", value);
5203+ }
5204+ else if (code == 'h')
5205+ {
5206+ /* Print halfword part of word */
5207+ fputs (value ? "b" : "t", stream);
5208+ }
5209+ else
5210+ {
5211+ /* Normal constant */
5212+ fprintf (stream, "%d", value);
5213+ }
5214+ break;
5215+ }
5216+ case CONST_DOUBLE:
5217+ {
5218+ HOST_WIDE_INT hi, lo;
5219+ if (GET_MODE (x) == DImode)
5220+ {
5221+ hi = CONST_DOUBLE_HIGH (x);
5222+ lo = CONST_DOUBLE_LOW (x);
5223+ }
5224+ else
5225+ {
5226+ HOST_WIDE_INT target_float[2];
5227+ hi = lo = 0;
5228+ real_to_target (target_float, CONST_DOUBLE_REAL_VALUE (x),
5229+ GET_MODE (x));
5230+ /* For doubles the most significant part starts at index 0. */
5231+ if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
5232+ {
5233+ hi = target_float[0];
5234+ lo = target_float[1];
5235+ }
5236+ else
5237+ {
5238+ lo = target_float[0];
5239+ }
5240+ }
5241+
5242+ if (avr32_const_ok_for_constraint_p (lo, 'K', "Ks21")
5243+ && ((GET_MODE (x) == SFmode)
5244+ || avr32_const_ok_for_constraint_p (hi, 'K', "Ks21")))
5245+ {
5246+ if (code == 'm')
5247+ fprintf (stream, "%ld", hi);
5248+ else
5249+ fprintf (stream, "%ld", lo);
5250+ }
5251+ else
5252+ {
5253+ fprintf (stream, "value too large");
5254+ }
5255+ break;
5256+ }
5257+ case CONST:
5258+ output_addr_const (stream, XEXP (XEXP (x, 0), 0));
5259+ fprintf (stream, "+%ld", INTVAL (XEXP (XEXP (x, 0), 1)));
5260+ break;
5261+ case REG:
5262+ /* Swap register name if the register is DImode or DFmode. */
5263+ if (GET_MODE (x) == DImode || GET_MODE (x) == DFmode)
5264+ {
5265+ /* Double register must have an even numbered address */
5266+ gcc_assert (!(REGNO (x) % 2));
5267+ if (code == 'm')
5268+ fputs (reg_names[true_regnum (x)], stream);
5269+ else
5270+ fputs (reg_names[true_regnum (x) + 1], stream);
5271+ }
5272+ else if (GET_MODE (x) == TImode)
5273+ {
5274+ switch (code)
5275+ {
5276+ case 'T':
5277+ fputs (reg_names[true_regnum (x)], stream);
5278+ break;
5279+ case 'U':
5280+ fputs (reg_names[true_regnum (x) + 1], stream);
5281+ break;
5282+ case 'L':
5283+ fputs (reg_names[true_regnum (x) + 2], stream);
5284+ break;
5285+ case 'B':
5286+ fputs (reg_names[true_regnum (x) + 3], stream);
5287+ break;
5288+ default:
5289+ fprintf (stream, "%s, %s, %s, %s",
5290+ reg_names[true_regnum (x) + 3],
5291+ reg_names[true_regnum (x) + 2],
5292+ reg_names[true_regnum (x) + 1],
5293+ reg_names[true_regnum (x)]);
5294+ break;
5295+ }
5296+ }
5297+ else
5298+ {
5299+ fputs (reg_names[true_regnum (x)], stream);
5300+ }
5301+ break;
5302+ case CODE_LABEL:
5303+ case LABEL_REF:
5304+ case SYMBOL_REF:
5305+ output_addr_const (stream, x);
5306+ break;
5307+ case MEM:
5308+ switch (GET_CODE (XEXP (x, 0)))
5309+ {
5310+ case LABEL_REF:
5311+ case SYMBOL_REF:
5312+ output_addr_const (stream, XEXP (x, 0));
5313+ break;
5314+ case MEM:
5315+ switch (GET_CODE (XEXP (XEXP (x, 0), 0)))
5316+ {
5317+ case SYMBOL_REF:
5318+ output_addr_const (stream, XEXP (XEXP (x, 0), 0));
5319+ break;
5320+ default:
5321+ error = 1;
5322+ break;
5323+ }
5324+ break;
5325+ case REG:
5326+ avr32_print_operand (stream, XEXP (x, 0), 0);
5327+ if (code != 'p')
5328+ fputs ("[0]", stream);
5329+ break;
5330+ case PRE_DEC:
5331+ fputs ("--", stream);
5332+ avr32_print_operand (stream, XEXP (XEXP (x, 0), 0), 0);
5333+ break;
5334+ case POST_INC:
5335+ avr32_print_operand (stream, XEXP (XEXP (x, 0), 0), 0);
5336+ fputs ("++", stream);
5337+ break;
5338+ case PLUS:
5339+ {
5340+ rtx op0 = XEXP (XEXP (x, 0), 0);
5341+ rtx op1 = XEXP (XEXP (x, 0), 1);
5342+ rtx base = NULL_RTX, offset = NULL_RTX;
5343+
5344+ if (avr32_address_register_rtx_p (op0, 1))
5345+ {
5346+ base = op0;
5347+ offset = op1;
5348+ }
5349+ else if (avr32_address_register_rtx_p (op1, 1))
5350+ {
5351+ /* Operands are switched. */
5352+ base = op1;
5353+ offset = op0;
5354+ }
5355+
5356+ gcc_assert (base && offset
5357+ && avr32_address_register_rtx_p (base, 1)
5358+ && avr32_legitimate_index_p (GET_MODE (x), offset,
5359+ 1));
5360+
5361+ avr32_print_operand (stream, base, 0);
5362+ fputs ("[", stream);
5363+ avr32_print_operand (stream, offset, 0);
5364+ fputs ("]", stream);
5365+ break;
5366+ }
5367+ case CONST:
5368+ output_addr_const (stream, XEXP (XEXP (XEXP (x, 0), 0), 0));
5369+ fprintf (stream, " + %ld",
5370+ INTVAL (XEXP (XEXP (XEXP (x, 0), 0), 1)));
5371+ break;
5372+ default:
5373+ error = 1;
5374+ }
5375+ break;
5376+ case MULT:
5377+ {
5378+ int value = INTVAL (XEXP (x, 1));
5379+
5380+ /* Convert immediate in multiplication into a shift immediate */
5381+ switch (value)
5382+ {
5383+ case 2:
5384+ value = 1;
5385+ break;
5386+ case 4:
5387+ value = 2;
5388+ break;
5389+ case 8:
5390+ value = 3;
5391+ break;
5392+ default:
5393+ value = 0;
5394+ }
5395+ fprintf (stream, "%s << %i", reg_names[true_regnum (XEXP (x, 0))],
5396+ value);
5397+ break;
5398+ }
5399+ case ASHIFT:
5400+ if (GET_CODE (XEXP (x, 1)) == CONST_INT)
5401+ fprintf (stream, "%s << %i", reg_names[true_regnum (XEXP (x, 0))],
5402+ (int) INTVAL (XEXP (x, 1)));
5403+ else if (REG_P (XEXP (x, 1)))
5404+ fprintf (stream, "%s << %s", reg_names[true_regnum (XEXP (x, 0))],
5405+ reg_names[true_regnum (XEXP (x, 1))]);
5406+ else
5407+ {
5408+ error = 1;
5409+ }
5410+ break;
5411+ case LSHIFTRT:
5412+ if (GET_CODE (XEXP (x, 1)) == CONST_INT)
5413+ fprintf (stream, "%s >> %i", reg_names[true_regnum (XEXP (x, 0))],
5414+ (int) INTVAL (XEXP (x, 1)));
5415+ else if (REG_P (XEXP (x, 1)))
5416+ fprintf (stream, "%s >> %s", reg_names[true_regnum (XEXP (x, 0))],
5417+ reg_names[true_regnum (XEXP (x, 1))]);
5418+ else
5419+ {
5420+ error = 1;
5421+ }
5422+ fprintf (stream, ">>");
5423+ break;
5424+ case PARALLEL:
5425+ {
5426+ /* Load store multiple */
5427+ int i;
5428+ int count = XVECLEN (x, 0);
5429+ int reglist16 = 0;
5430+ char reglist16_string[100];
5431+
5432+ for (i = 0; i < count; ++i)
5433+ {
5434+ rtx vec_elm = XVECEXP (x, 0, i);
5435+ if (GET_MODE (vec_elm) != SET)
5436+ {
5437+ debug_rtx (vec_elm);
5438+ internal_error ("Unknown element in parallel expression!");
5439+ }
5440+ if (GET_MODE (XEXP (vec_elm, 0)) == REG)
5441+ {
5442+ /* Load multiple */
5443+ reglist16 |= 1 << ASM_REGNUM (REGNO (XEXP (vec_elm, 0)));
5444+ }
5445+ else
5446+ {
5447+ /* Store multiple */
5448+ reglist16 |= 1 << ASM_REGNUM (REGNO (XEXP (vec_elm, 1)));
5449+ }
5450+ }
5451+
5452+ avr32_make_reglist16 (reglist16, reglist16_string);
5453+ fputs (reglist16_string, stream);
5454+
5455+ break;
5456+ }
5457+
5458+ default:
5459+ error = 1;
5460+ }
5461+
5462+ if (error)
5463+ {
5464+ debug_rtx (x);
5465+ internal_error ("Illegal expression for avr32_print_operand");
5466+ }
5467+}
5468+
5469+rtx
5470+avr32_get_note_reg_equiv (rtx insn)
5471+{
5472+ rtx note;
5473+
5474+ note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
5475+
5476+ if (note != NULL_RTX)
5477+ return XEXP (note, 0);
5478+ else
5479+ return NULL_RTX;
5480+}
5481+
5482+/*
5483+ Outputs to stdio stream stream the assembler syntax for an instruction
5484+ operand that is a memory reference whose address is x. x is an RTL
5485+ expression.
5486+
5487+ ToDo: fixme.
5488+*/
5489+void
5490+avr32_print_operand_address (FILE * stream, rtx x)
5491+{
5492+ fprintf (stream, "(%d) /* address */", REGNO (x));
5493+}
5494+
5495+/* Return true if _GLOBAL_OFFSET_TABLE_ symbol is mentioned. */
5496+bool
5497+avr32_got_mentioned_p (rtx addr)
5498+{
5499+ if (GET_CODE (addr) == MEM)
5500+ addr = XEXP (addr, 0);
5501+ while (GET_CODE (addr) == CONST)
5502+ addr = XEXP (addr, 0);
5503+ if (GET_CODE (addr) == SYMBOL_REF)
5504+ {
5505+ return streq (XSTR (addr, 0), "_GLOBAL_OFFSET_TABLE_");
5506+ }
5507+ if (GET_CODE (addr) == PLUS || GET_CODE (addr) == MINUS)
5508+ {
5509+ bool l1, l2;
5510+
5511+ l1 = avr32_got_mentioned_p (XEXP (addr, 0));
5512+ l2 = avr32_got_mentioned_p (XEXP (addr, 1));
5513+ return l1 || l2;
5514+ }
5515+ return false;
5516+}
5517+
5518+
5519+/* Find the symbol in an address expression. */
5520+
5521+rtx
5522+avr32_find_symbol (rtx addr)
5523+{
5524+ if (GET_CODE (addr) == MEM)
5525+ addr = XEXP (addr, 0);
5526+
5527+ while (GET_CODE (addr) == CONST)
5528+ addr = XEXP (addr, 0);
5529+
5530+ if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
5531+ return addr;
5532+ if (GET_CODE (addr) == PLUS)
5533+ {
5534+ rtx l1, l2;
5535+
5536+ l1 = avr32_find_symbol (XEXP (addr, 0));
5537+ l2 = avr32_find_symbol (XEXP (addr, 1));
5538+ if (l1 != NULL_RTX && l2 == NULL_RTX)
5539+ return l1;
5540+ else if (l1 == NULL_RTX && l2 != NULL_RTX)
5541+ return l2;
5542+ }
5543+
5544+ return NULL_RTX;
5545+}
5546+
5547+
5548+/* Routines for manipulation of the constant pool. */
5549+
5550+/* AVR32 instructions cannot load a large constant directly into a
5551+ register; they have to come from a pc relative load. The constant
5552+ must therefore be placed in the addressable range of the pc
5553+ relative load. Depending on the precise pc relative load
5554+ instruction the range is somewhere between 256 bytes and 4k. This
5555+ means that we often have to dump a constant inside a function, and
5556+ generate code to branch around it.
5557+
5558+ It is important to minimize this, since the branches will slow
5559+ things down and make the code larger.
5560+
5561+ Normally we can hide the table after an existing unconditional
5562+ branch so that there is no interruption of the flow, but in the
5563+ worst case the code looks like this:
5564+
5565+ lddpc rn, L1
5566+ ...
5567+ rjmp L2
5568+ align
5569+ L1: .long value
5570+ L2:
5571+ ...
5572+
5573+ lddpc rn, L3
5574+ ...
5575+ rjmp L4
5576+ align
5577+ L3: .long value
5578+ L4:
5579+ ...
5580+
5581+ We fix this by performing a scan after scheduling, which notices
5582+ which instructions need to have their operands fetched from the
5583+ constant table and builds the table.
5584+
5585+ The algorithm starts by building a table of all the constants that
5586+ need fixing up and all the natural barriers in the function (places
5587+ where a constant table can be dropped without breaking the flow).
5588+ For each fixup we note how far the pc-relative replacement will be
5589+ able to reach and the offset of the instruction into the function.
5590+
5591+ Having built the table we then group the fixes together to form
5592+ tables that are as large as possible (subject to addressing
5593+ constraints) and emit each table of constants after the last
5594+ barrier that is within range of all the instructions in the group.
5595+ If a group does not contain a barrier, then we forcibly create one
5596+ by inserting a jump instruction into the flow. Once the table has
5597+ been inserted, the insns are then modified to reference the
5598+ relevant entry in the pool.
5599+
5600+ Possible enhancements to the algorithm (not implemented) are:
5601+
5602+ 1) For some processors and object formats, there may be benefit in
5603+ aligning the pools to the start of cache lines; this alignment
5604+ would need to be taken into account when calculating addressability
5605+ of a pool. */
5606+
5607+/* These typedefs are located at the start of this file, so that
5608+ they can be used in the prototypes there. This comment is to
5609+ remind readers of that fact so that the following structures
5610+ can be understood more easily.
5611+
5612+ typedef struct minipool_node Mnode;
5613+ typedef struct minipool_fixup Mfix; */
5614+
5615+struct minipool_node
5616+{
5617+ /* Doubly linked chain of entries. */
5618+ Mnode *next;
5619+ Mnode *prev;
5620+ /* The maximum offset into the code that this entry can be placed. While
5621+ pushing fixes for forward references, all entries are sorted in order of
5622+ increasing max_address. */
5623+ HOST_WIDE_INT max_address;
5624+ /* Similarly for an entry inserted for a backwards ref. */
5625+ HOST_WIDE_INT min_address;
5626+ /* The number of fixes referencing this entry. This can become zero if we
5627+ "unpush" an entry. In this case we ignore the entry when we come to
5628+ emit the code. */
5629+ int refcount;
5630+ /* The offset from the start of the minipool. */
5631+ HOST_WIDE_INT offset;
5632+ /* The value in table. */
5633+ rtx value;
5634+ /* The mode of value. */
5635+ enum machine_mode mode;
5636+ /* The size of the value. */
5637+ int fix_size;
5638+};
5639+
5640+struct minipool_fixup
5641+{
5642+ Mfix *next;
5643+ rtx insn;
5644+ HOST_WIDE_INT address;
5645+ rtx *loc;
5646+ enum machine_mode mode;
5647+ int fix_size;
5648+ rtx value;
5649+ Mnode *minipool;
5650+ HOST_WIDE_INT forwards;
5651+ HOST_WIDE_INT backwards;
5652+};
5653+
5654+
5655+/* Fixes less than a word need padding out to a word boundary. */
5656+#define MINIPOOL_FIX_SIZE(mode, value) \
5657+ (IS_FORCE_MINIPOOL(value) ? 0 : \
5658+ (GET_MODE_SIZE ((mode)) >= 4 ? GET_MODE_SIZE ((mode)) : 4))
5659+
5660+#define IS_FORCE_MINIPOOL(x) \
5661+ (GET_CODE(x) == UNSPEC && \
5662+ XINT(x, 1) == UNSPEC_FORCE_MINIPOOL)
5663+
5664+static Mnode *minipool_vector_head;
5665+static Mnode *minipool_vector_tail;
5666+
5667+/* The linked list of all minipool fixes required for this function. */
5668+Mfix *minipool_fix_head;
5669+Mfix *minipool_fix_tail;
5670+/* The fix entry for the current minipool, once it has been placed. */
5671+Mfix *minipool_barrier;
5672+
5673+/* Determines if INSN is the start of a jump table. Returns the end
5674+ of the TABLE or NULL_RTX. */
5675+static rtx
5676+is_jump_table (rtx insn)
5677+{
5678+ rtx table;
5679+
5680+ if (GET_CODE (insn) == JUMP_INSN
5681+ && JUMP_LABEL (insn) != NULL
5682+ && ((table = next_real_insn (JUMP_LABEL (insn)))
5683+ == next_real_insn (insn))
5684+ && table != NULL
5685+ && GET_CODE (table) == JUMP_INSN
5686+ && (GET_CODE (PATTERN (table)) == ADDR_VEC
5687+ || GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
5688+ return table;
5689+
5690+ return NULL_RTX;
5691+}
5692+
5693+static HOST_WIDE_INT
5694+get_jump_table_size (rtx insn)
5695+{
5696+ /* ADDR_VECs only take room if read-only data does into the text section. */
5697+ if (JUMP_TABLES_IN_TEXT_SECTION
5698+#if !defined(READONLY_DATA_SECTION) && !defined(READONLY_DATA_SECTION_ASM_OP)
5699+ || 1
5700+#endif
5701+ )
5702+ {
5703+ rtx body = PATTERN (insn);
5704+ int elt = GET_CODE (body) == ADDR_DIFF_VEC ? 1 : 0;
5705+
5706+ return GET_MODE_SIZE (GET_MODE (body)) * XVECLEN (body, elt);
5707+ }
5708+
5709+ return 0;
5710+}
5711+
5712+/* Move a minipool fix MP from its current location to before MAX_MP.
5713+ If MAX_MP is NULL, then MP doesn't need moving, but the addressing
5714+ constraints may need updating. */
5715+static Mnode *
5716+move_minipool_fix_forward_ref (Mnode * mp, Mnode * max_mp,
5717+ HOST_WIDE_INT max_address)
5718+{
5719+ /* This should never be true and the code below assumes these are
5720+ different. */
5721+ if (mp == max_mp)
5722+ abort ();
5723+
5724+ if (max_mp == NULL)
5725+ {
5726+ if (max_address < mp->max_address)
5727+ mp->max_address = max_address;
5728+ }
5729+ else
5730+ {
5731+ if (max_address > max_mp->max_address - mp->fix_size)
5732+ mp->max_address = max_mp->max_address - mp->fix_size;
5733+ else
5734+ mp->max_address = max_address;
5735+
5736+ /* Unlink MP from its current position. Since max_mp is non-null,
5737+ mp->prev must be non-null. */
5738+ mp->prev->next = mp->next;
5739+ if (mp->next != NULL)
5740+ mp->next->prev = mp->prev;
5741+ else
5742+ minipool_vector_tail = mp->prev;
5743+
5744+ /* Re-insert it before MAX_MP. */
5745+ mp->next = max_mp;
5746+ mp->prev = max_mp->prev;
5747+ max_mp->prev = mp;
5748+
5749+ if (mp->prev != NULL)
5750+ mp->prev->next = mp;
5751+ else
5752+ minipool_vector_head = mp;
5753+ }
5754+
5755+ /* Save the new entry. */
5756+ max_mp = mp;
5757+
5758+ /* Scan over the preceding entries and adjust their addresses as required.
5759+ */
5760+ while (mp->prev != NULL
5761+ && mp->prev->max_address > mp->max_address - mp->prev->fix_size)
5762+ {
5763+ mp->prev->max_address = mp->max_address - mp->prev->fix_size;
5764+ mp = mp->prev;
5765+ }
5766+
5767+ return max_mp;
5768+}
5769+
5770+/* Add a constant to the minipool for a forward reference. Returns the
5771+ node added or NULL if the constant will not fit in this pool. */
5772+static Mnode *
5773+add_minipool_forward_ref (Mfix * fix)
5774+{
5775+ /* If set, max_mp is the first pool_entry that has a lower constraint than
5776+ the one we are trying to add. */
5777+ Mnode *max_mp = NULL;
5778+ HOST_WIDE_INT max_address = fix->address + fix->forwards;
5779+ Mnode *mp;
5780+
5781+ /* If this fix's address is greater than the address of the first entry,
5782+ then we can't put the fix in this pool. We subtract the size of the
5783+ current fix to ensure that if the table is fully packed we still have
5784+ enough room to insert this value by suffling the other fixes forwards. */
5785+ if (minipool_vector_head &&
5786+ fix->address >= minipool_vector_head->max_address - fix->fix_size)
5787+ return NULL;
5788+
5789+ /* Scan the pool to see if a constant with the same value has already been
5790+ added. While we are doing this, also note the location where we must
5791+ insert the constant if it doesn't already exist. */
5792+ for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
5793+ {
5794+ if (GET_CODE (fix->value) == GET_CODE (mp->value)
5795+ && fix->mode == mp->mode
5796+ && (GET_CODE (fix->value) != CODE_LABEL
5797+ || (CODE_LABEL_NUMBER (fix->value)
5798+ == CODE_LABEL_NUMBER (mp->value)))
5799+ && rtx_equal_p (fix->value, mp->value))
5800+ {
5801+ /* More than one fix references this entry. */
5802+ mp->refcount++;
5803+ return move_minipool_fix_forward_ref (mp, max_mp, max_address);
5804+ }
5805+
5806+ /* Note the insertion point if necessary. */
5807+ if (max_mp == NULL && mp->max_address > max_address)
5808+ max_mp = mp;
5809+
5810+ }
5811+
5812+ /* The value is not currently in the minipool, so we need to create a new
5813+ entry for it. If MAX_MP is NULL, the entry will be put on the end of
5814+ the list since the placement is less constrained than any existing
5815+ entry. Otherwise, we insert the new fix before MAX_MP and, if
5816+ necessary, adjust the constraints on the other entries. */
5817+ mp = xmalloc (sizeof (*mp));
5818+ mp->fix_size = fix->fix_size;
5819+ mp->mode = fix->mode;
5820+ mp->value = fix->value;
5821+ mp->refcount = 1;
5822+ /* Not yet required for a backwards ref. */
5823+ mp->min_address = -65536;
5824+
5825+ if (max_mp == NULL)
5826+ {
5827+ mp->max_address = max_address;
5828+ mp->next = NULL;
5829+ mp->prev = minipool_vector_tail;
5830+
5831+ if (mp->prev == NULL)
5832+ {
5833+ minipool_vector_head = mp;
5834+ minipool_vector_label = gen_label_rtx ();
5835+ }
5836+ else
5837+ mp->prev->next = mp;
5838+
5839+ minipool_vector_tail = mp;
5840+ }
5841+ else
5842+ {
5843+ if (max_address > max_mp->max_address - mp->fix_size)
5844+ mp->max_address = max_mp->max_address - mp->fix_size;
5845+ else
5846+ mp->max_address = max_address;
5847+
5848+ mp->next = max_mp;
5849+ mp->prev = max_mp->prev;
5850+ max_mp->prev = mp;
5851+ if (mp->prev != NULL)
5852+ mp->prev->next = mp;
5853+ else
5854+ minipool_vector_head = mp;
5855+ }
5856+
5857+ /* Save the new entry. */
5858+ max_mp = mp;
5859+
5860+ /* Scan over the preceding entries and adjust their addresses as required.
5861+ */
5862+ while (mp->prev != NULL
5863+ && mp->prev->max_address > mp->max_address - mp->prev->fix_size)
5864+ {
5865+ mp->prev->max_address = mp->max_address - mp->prev->fix_size;
5866+ mp = mp->prev;
5867+ }
5868+
5869+ return max_mp;
5870+}
5871+
5872+static Mnode *
5873+move_minipool_fix_backward_ref (Mnode * mp, Mnode * min_mp,
5874+ HOST_WIDE_INT min_address)
5875+{
5876+ HOST_WIDE_INT offset;
5877+
5878+ /* This should never be true, and the code below assumes these are
5879+ different. */
5880+ if (mp == min_mp)
5881+ abort ();
5882+
5883+ if (min_mp == NULL)
5884+ {
5885+ if (min_address > mp->min_address)
5886+ mp->min_address = min_address;
5887+ }
5888+ else
5889+ {
5890+ /* We will adjust this below if it is too loose. */
5891+ mp->min_address = min_address;
5892+
5893+ /* Unlink MP from its current position. Since min_mp is non-null,
5894+ mp->next must be non-null. */
5895+ mp->next->prev = mp->prev;
5896+ if (mp->prev != NULL)
5897+ mp->prev->next = mp->next;
5898+ else
5899+ minipool_vector_head = mp->next;
5900+
5901+ /* Reinsert it after MIN_MP. */
5902+ mp->prev = min_mp;
5903+ mp->next = min_mp->next;
5904+ min_mp->next = mp;
5905+ if (mp->next != NULL)
5906+ mp->next->prev = mp;
5907+ else
5908+ minipool_vector_tail = mp;
5909+ }
5910+
5911+ min_mp = mp;
5912+
5913+ offset = 0;
5914+ for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
5915+ {
5916+ mp->offset = offset;
5917+ if (mp->refcount > 0)
5918+ offset += mp->fix_size;
5919+
5920+ if (mp->next && mp->next->min_address < mp->min_address + mp->fix_size)
5921+ mp->next->min_address = mp->min_address + mp->fix_size;
5922+ }
5923+
5924+ return min_mp;
5925+}
5926+
5927+/* Add a constant to the minipool for a backward reference. Returns the
5928+ node added or NULL if the constant will not fit in this pool.
5929+
5930+ Note that the code for insertion for a backwards reference can be
5931+ somewhat confusing because the calculated offsets for each fix do
5932+ not take into account the size of the pool (which is still under
5933+ construction. */
5934+static Mnode *
5935+add_minipool_backward_ref (Mfix * fix)
5936+{
5937+ /* If set, min_mp is the last pool_entry that has a lower constraint than
5938+ the one we are trying to add. */
5939+ Mnode *min_mp = NULL;
5940+ /* This can be negative, since it is only a constraint. */
5941+ HOST_WIDE_INT min_address = fix->address - fix->backwards;
5942+ Mnode *mp;
5943+
5944+ /* If we can't reach the current pool from this insn, or if we can't insert
5945+ this entry at the end of the pool without pushing other fixes out of
5946+ range, then we don't try. This ensures that we can't fail later on. */
5947+ if (min_address >= minipool_barrier->address
5948+ || (minipool_vector_tail->min_address + fix->fix_size
5949+ >= minipool_barrier->address))
5950+ return NULL;
5951+
5952+ /* Scan the pool to see if a constant with the same value has already been
5953+ added. While we are doing this, also note the location where we must
5954+ insert the constant if it doesn't already exist. */
5955+ for (mp = minipool_vector_tail; mp != NULL; mp = mp->prev)
5956+ {
5957+ if (GET_CODE (fix->value) == GET_CODE (mp->value)
5958+ && fix->mode == mp->mode
5959+ && (GET_CODE (fix->value) != CODE_LABEL
5960+ || (CODE_LABEL_NUMBER (fix->value)
5961+ == CODE_LABEL_NUMBER (mp->value)))
5962+ && rtx_equal_p (fix->value, mp->value)
5963+ /* Check that there is enough slack to move this entry to the end
5964+ of the table (this is conservative). */
5965+ && (mp->max_address
5966+ > (minipool_barrier->address
5967+ + minipool_vector_tail->offset
5968+ + minipool_vector_tail->fix_size)))
5969+ {
5970+ mp->refcount++;
5971+ return move_minipool_fix_backward_ref (mp, min_mp, min_address);
5972+ }
5973+
5974+ if (min_mp != NULL)
5975+ mp->min_address += fix->fix_size;
5976+ else
5977+ {
5978+ /* Note the insertion point if necessary. */
5979+ if (mp->min_address < min_address)
5980+ {
5981+ min_mp = mp;
5982+ }
5983+ else if (mp->max_address
5984+ < minipool_barrier->address + mp->offset + fix->fix_size)
5985+ {
5986+ /* Inserting before this entry would push the fix beyond its
5987+ maximum address (which can happen if we have re-located a
5988+ forwards fix); force the new fix to come after it. */
5989+ min_mp = mp;
5990+ min_address = mp->min_address + fix->fix_size;
5991+ }
5992+ }
5993+ }
5994+
5995+ /* We need to create a new entry. */
5996+ mp = xmalloc (sizeof (*mp));
5997+ mp->fix_size = fix->fix_size;
5998+ mp->mode = fix->mode;
5999+ mp->value = fix->value;
6000+ mp->refcount = 1;
6001+ mp->max_address = minipool_barrier->address + 65536;
6002+
6003+ mp->min_address = min_address;
6004+
6005+ if (min_mp == NULL)
6006+ {
6007+ mp->prev = NULL;
6008+ mp->next = minipool_vector_head;
6009+
6010+ if (mp->next == NULL)
6011+ {
6012+ minipool_vector_tail = mp;
6013+ minipool_vector_label = gen_label_rtx ();
6014+ }
6015+ else
6016+ mp->next->prev = mp;
6017+
6018+ minipool_vector_head = mp;
6019+ }
6020+ else
6021+ {
6022+ mp->next = min_mp->next;
6023+ mp->prev = min_mp;
6024+ min_mp->next = mp;
6025+
6026+ if (mp->next != NULL)
6027+ mp->next->prev = mp;
6028+ else
6029+ minipool_vector_tail = mp;
6030+ }
6031+
6032+ /* Save the new entry. */
6033+ min_mp = mp;
6034+
6035+ if (mp->prev)
6036+ mp = mp->prev;
6037+ else
6038+ mp->offset = 0;
6039+
6040+ /* Scan over the following entries and adjust their offsets. */
6041+ while (mp->next != NULL)
6042+ {
6043+ if (mp->next->min_address < mp->min_address + mp->fix_size)
6044+ mp->next->min_address = mp->min_address + mp->fix_size;
6045+
6046+ if (mp->refcount)
6047+ mp->next->offset = mp->offset + mp->fix_size;
6048+ else
6049+ mp->next->offset = mp->offset;
6050+
6051+ mp = mp->next;
6052+ }
6053+
6054+ return min_mp;
6055+}
6056+
6057+static void
6058+assign_minipool_offsets (Mfix * barrier)
6059+{
6060+ HOST_WIDE_INT offset = 0;
6061+ Mnode *mp;
6062+
6063+ minipool_barrier = barrier;
6064+
6065+ for (mp = minipool_vector_head; mp != NULL; mp = mp->next)
6066+ {
6067+ mp->offset = offset;
6068+
6069+ if (mp->refcount > 0
6070+ /* If the value is (const_int 0) then this is a fake entry so don't
6071+ add an offset for it since it will not be output. */
6072+ && !(GET_CODE (mp->value) == CONST_INT && INTVAL (mp->value) == 0))
6073+ offset += mp->fix_size;
6074+ }
6075+}
6076+
6077+/* Print a symbolic form of X to the debug file, F. */
6078+static void
6079+avr32_print_value (FILE * f, rtx x)
6080+{
6081+ switch (GET_CODE (x))
6082+ {
6083+ case CONST_INT:
6084+ fprintf (f, "0x%x", (int) INTVAL (x));
6085+ return;
6086+
6087+ case CONST_DOUBLE:
6088+ fprintf (f, "<0x%lx,0x%lx>", (long) XWINT (x, 2), (long) XWINT (x, 3));
6089+ return;
6090+
6091+ case CONST_VECTOR:
6092+ {
6093+ int i;
6094+
6095+ fprintf (f, "<");
6096+ for (i = 0; i < CONST_VECTOR_NUNITS (x); i++)
6097+ {
6098+ fprintf (f, "0x%x", (int) INTVAL (CONST_VECTOR_ELT (x, i)));
6099+ if (i < (CONST_VECTOR_NUNITS (x) - 1))
6100+ fputc (',', f);
6101+ }
6102+ fprintf (f, ">");
6103+ }
6104+ return;
6105+
6106+ case CONST_STRING:
6107+ fprintf (f, "\"%s\"", XSTR (x, 0));
6108+ return;
6109+
6110+ case SYMBOL_REF:
6111+ fprintf (f, "`%s'", XSTR (x, 0));
6112+ return;
6113+
6114+ case LABEL_REF:
6115+ fprintf (f, "L%d", INSN_UID (XEXP (x, 0)));
6116+ return;
6117+
6118+ case CONST:
6119+ avr32_print_value (f, XEXP (x, 0));
6120+ return;
6121+
6122+ case PLUS:
6123+ avr32_print_value (f, XEXP (x, 0));
6124+ fprintf (f, "+");
6125+ avr32_print_value (f, XEXP (x, 1));
6126+ return;
6127+
6128+ case PC:
6129+ fprintf (f, "pc");
6130+ return;
6131+
6132+ default:
6133+ fprintf (f, "????");
6134+ return;
6135+ }
6136+}
6137+
6138+int
6139+is_minipool_label (rtx label)
6140+{
6141+ minipool_labels *cur_mp_label = cfun->machine->minipool_label_head;
6142+
6143+ if (GET_CODE (label) != CODE_LABEL)
6144+ return FALSE;
6145+
6146+ while (cur_mp_label)
6147+ {
6148+ if (CODE_LABEL_NUMBER (label)
6149+ == CODE_LABEL_NUMBER (cur_mp_label->label))
6150+ return TRUE;
6151+ cur_mp_label = cur_mp_label->next;
6152+ }
6153+ return FALSE;
6154+}
6155+
6156+static void
6157+new_minipool_label (rtx label)
6158+{
6159+ if (!cfun->machine->minipool_label_head)
6160+ {
6161+ cfun->machine->minipool_label_head =
6162+ ggc_alloc (sizeof (minipool_labels));
6163+ cfun->machine->minipool_label_tail = cfun->machine->minipool_label_head;
6164+ cfun->machine->minipool_label_head->label = label;
6165+ cfun->machine->minipool_label_head->next = 0;
6166+ cfun->machine->minipool_label_head->prev = 0;
6167+ }
6168+ else
6169+ {
6170+ cfun->machine->minipool_label_tail->next =
6171+ ggc_alloc (sizeof (minipool_labels));
6172+ cfun->machine->minipool_label_tail->next->label = label;
6173+ cfun->machine->minipool_label_tail->next->next = 0;
6174+ cfun->machine->minipool_label_tail->next->prev =
6175+ cfun->machine->minipool_label_tail;
6176+ cfun->machine->minipool_label_tail =
6177+ cfun->machine->minipool_label_tail->next;
6178+ }
6179+}
6180+
6181+/* Output the literal table */
6182+static void
6183+dump_minipool (rtx scan)
6184+{
6185+ Mnode *mp;
6186+ Mnode *nmp;
6187+
6188+ if (dump_file)
6189+ fprintf (dump_file,
6190+ ";; Emitting minipool after insn %u; address %ld; align %d (bytes)\n",
6191+ INSN_UID (scan), (unsigned long) minipool_barrier->address, 4);
6192+
6193+ scan = emit_insn_after (gen_consttable_start (), scan);
6194+ scan = emit_insn_after (gen_align_4 (), scan);
6195+ scan = emit_label_after (minipool_vector_label, scan);
6196+ new_minipool_label (minipool_vector_label);
6197+
6198+ for (mp = minipool_vector_head; mp != NULL; mp = nmp)
6199+ {
6200+ if (mp->refcount > 0)
6201+ {
6202+ if (dump_file)
6203+ {
6204+ fprintf (dump_file,
6205+ ";; Offset %u, min %ld, max %ld ",
6206+ (unsigned) mp->offset, (unsigned long) mp->min_address,
6207+ (unsigned long) mp->max_address);
6208+ avr32_print_value (dump_file, mp->value);
6209+ fputc ('\n', dump_file);
6210+ }
6211+
6212+ switch (mp->fix_size)
6213+ {
6214+#ifdef HAVE_consttable_4
6215+ case 4:
6216+ scan = emit_insn_after (gen_consttable_4 (mp->value), scan);
6217+ break;
6218+
6219+#endif
6220+#ifdef HAVE_consttable_8
6221+ case 8:
6222+ scan = emit_insn_after (gen_consttable_8 (mp->value), scan);
6223+ break;
6224+
6225+#endif
6226+ case 0:
6227+ /* This can happen for force-minipool entries which just are
6228+ there to force the minipool to be generate. */
6229+ break;
6230+ default:
6231+ abort ();
6232+ break;
6233+ }
6234+ }
6235+
6236+ nmp = mp->next;
6237+ free (mp);
6238+ }
6239+
6240+ minipool_vector_head = minipool_vector_tail = NULL;
6241+ scan = emit_insn_after (gen_consttable_end (), scan);
6242+ scan = emit_barrier_after (scan);
6243+}
6244+
6245+/* Return the cost of forcibly inserting a barrier after INSN. */
6246+static int
6247+avr32_barrier_cost (rtx insn)
6248+{
6249+ /* Basing the location of the pool on the loop depth is preferable, but at
6250+ the moment, the basic block information seems to be corrupt by this
6251+ stage of the compilation. */
6252+ int base_cost = 50;
6253+ rtx next = next_nonnote_insn (insn);
6254+
6255+ if (next != NULL && GET_CODE (next) == CODE_LABEL)
6256+ base_cost -= 20;
6257+
6258+ switch (GET_CODE (insn))
6259+ {
6260+ case CODE_LABEL:
6261+ /* It will always be better to place the table before the label, rather
6262+ than after it. */
6263+ return 50;
6264+
6265+ case INSN:
6266+ case CALL_INSN:
6267+ return base_cost;
6268+
6269+ case JUMP_INSN:
6270+ return base_cost - 10;
6271+
6272+ default:
6273+ return base_cost + 10;
6274+ }
6275+}
6276+
6277+/* Find the best place in the insn stream in the range
6278+ (FIX->address,MAX_ADDRESS) to forcibly insert a minipool barrier.
6279+ Create the barrier by inserting a jump and add a new fix entry for
6280+ it. */
6281+static Mfix *
6282+create_fix_barrier (Mfix * fix, HOST_WIDE_INT max_address)
6283+{
6284+ HOST_WIDE_INT count = 0;
6285+ rtx barrier;
6286+ rtx from = fix->insn;
6287+ rtx selected = from;
6288+ int selected_cost;
6289+ HOST_WIDE_INT selected_address;
6290+ Mfix *new_fix;
6291+ HOST_WIDE_INT max_count = max_address - fix->address;
6292+ rtx label = gen_label_rtx ();
6293+
6294+ selected_cost = avr32_barrier_cost (from);
6295+ selected_address = fix->address;
6296+
6297+ while (from && count < max_count)
6298+ {
6299+ rtx tmp;
6300+ int new_cost;
6301+
6302+ /* This code shouldn't have been called if there was a natural barrier
6303+ within range. */
6304+ if (GET_CODE (from) == BARRIER)
6305+ abort ();
6306+
6307+ /* Count the length of this insn. */
6308+ count += get_attr_length (from);
6309+
6310+ /* If there is a jump table, add its length. */
6311+ tmp = is_jump_table (from);
6312+ if (tmp != NULL)
6313+ {
6314+ count += get_jump_table_size (tmp);
6315+
6316+ /* Jump tables aren't in a basic block, so base the cost on the
6317+ dispatch insn. If we select this location, we will still put
6318+ the pool after the table. */
6319+ new_cost = avr32_barrier_cost (from);
6320+
6321+ if (count < max_count && new_cost <= selected_cost)
6322+ {
6323+ selected = tmp;
6324+ selected_cost = new_cost;
6325+ selected_address = fix->address + count;
6326+ }
6327+
6328+ /* Continue after the dispatch table. */
6329+ from = NEXT_INSN (tmp);
6330+ continue;
6331+ }
6332+
6333+ new_cost = avr32_barrier_cost (from);
6334+
6335+ if (count < max_count && new_cost <= selected_cost)
6336+ {
6337+ selected = from;
6338+ selected_cost = new_cost;
6339+ selected_address = fix->address + count;
6340+ }
6341+
6342+ from = NEXT_INSN (from);
6343+ }
6344+
6345+ /* Create a new JUMP_INSN that branches around a barrier. */
6346+ from = emit_jump_insn_after (gen_jump (label), selected);
6347+ JUMP_LABEL (from) = label;
6348+ barrier = emit_barrier_after (from);
6349+ emit_label_after (label, barrier);
6350+
6351+ /* Create a minipool barrier entry for the new barrier. */
6352+ new_fix = (Mfix *) obstack_alloc (&minipool_obstack, sizeof (*new_fix));
6353+ new_fix->insn = barrier;
6354+ new_fix->address = selected_address;
6355+ new_fix->next = fix->next;
6356+ fix->next = new_fix;
6357+
6358+ return new_fix;
6359+}
6360+
6361+/* Record that there is a natural barrier in the insn stream at
6362+ ADDRESS. */
6363+static void
6364+push_minipool_barrier (rtx insn, HOST_WIDE_INT address)
6365+{
6366+ Mfix *fix = (Mfix *) obstack_alloc (&minipool_obstack, sizeof (*fix));
6367+
6368+ fix->insn = insn;
6369+ fix->address = address;
6370+
6371+ fix->next = NULL;
6372+ if (minipool_fix_head != NULL)
6373+ minipool_fix_tail->next = fix;
6374+ else
6375+ minipool_fix_head = fix;
6376+
6377+ minipool_fix_tail = fix;
6378+}
6379+
6380+/* Record INSN, which will need fixing up to load a value from the
6381+ minipool. ADDRESS is the offset of the insn since the start of the
6382+ function; LOC is a pointer to the part of the insn which requires
6383+ fixing; VALUE is the constant that must be loaded, which is of type
6384+ MODE. */
6385+static void
6386+push_minipool_fix (rtx insn, HOST_WIDE_INT address, rtx * loc,
6387+ enum machine_mode mode, rtx value)
6388+{
6389+ Mfix *fix = (Mfix *) obstack_alloc (&minipool_obstack, sizeof (*fix));
6390+ rtx body = PATTERN (insn);
6391+
6392+ fix->insn = insn;
6393+ fix->address = address;
6394+ fix->loc = loc;
6395+ fix->mode = mode;
6396+ fix->fix_size = MINIPOOL_FIX_SIZE (mode, value);
6397+ fix->value = value;
6398+
6399+ if (GET_CODE (body) == PARALLEL)
6400+ {
6401+ /* Mcall : Ks16 << 2 */
6402+ fix->forwards = ((1 << 15) - 1) << 2;
6403+ fix->backwards = (1 << 15) << 2;
6404+ }
6405+ else if (GET_CODE (body) == SET
6406+ && GET_MODE_SIZE (GET_MODE (SET_DEST (body))) == 4)
6407+ {
6408+ /* Word Load */
6409+ if (TARGET_HARD_FLOAT
6410+ && GET_MODE_CLASS (GET_MODE (SET_DEST (body))) == MODE_FLOAT)
6411+ {
6412+ /* Ldc0.w : Ku12 << 2 */
6413+ fix->forwards = ((1 << 12) - 1) << 2;
6414+ fix->backwards = 0;
6415+ }
6416+ else
6417+ {
6418+ if (optimize_size)
6419+ {
6420+ /* Lddpc : Ku7 << 2 */
6421+ fix->forwards = ((1 << 7) - 1) << 2;
6422+ fix->backwards = 0;
6423+ }
6424+ else
6425+ {
6426+ /* Ld.w : Ks16 */
6427+ fix->forwards = ((1 << 15) - 4);
6428+ fix->backwards = (1 << 15);
6429+ }
6430+ }
6431+ }
6432+ else if (GET_CODE (body) == SET
6433+ && GET_MODE_SIZE (GET_MODE (SET_DEST (body))) == 8)
6434+ {
6435+ /* Double word load */
6436+ if (TARGET_HARD_FLOAT
6437+ && GET_MODE_CLASS (GET_MODE (SET_DEST (body))) == MODE_FLOAT)
6438+ {
6439+ /* Ldc0.d : Ku12 << 2 */
6440+ fix->forwards = ((1 << 12) - 1) << 2;
6441+ fix->backwards = 0;
6442+ }
6443+ else
6444+ {
6445+ /* Ld.d : Ks16 */
6446+ fix->forwards = ((1 << 15) - 4);
6447+ fix->backwards = (1 << 15);
6448+ }
6449+ }
6450+ else if (GET_CODE (body) == UNSPEC_VOLATILE
6451+ && XINT (body, 1) == VUNSPEC_MVRC)
6452+ {
6453+ /* Coprocessor load */
6454+ /* Ldc : Ku8 << 2 */
6455+ fix->forwards = ((1 << 8) - 1) << 2;
6456+ fix->backwards = 0;
6457+ }
6458+ else
6459+ {
6460+ /* Assume worst case which is lddpc insn. */
6461+ fix->forwards = ((1 << 7) - 1) << 2;
6462+ fix->backwards = 0;
6463+ }
6464+
6465+ fix->minipool = NULL;
6466+
6467+ /* If an insn doesn't have a range defined for it, then it isn't expecting
6468+ to be reworked by this code. Better to abort now than to generate duff
6469+ assembly code. */
6470+ if (fix->forwards == 0 && fix->backwards == 0)
6471+ abort ();
6472+
6473+ if (dump_file)
6474+ {
6475+ fprintf (dump_file,
6476+ ";; %smode fixup for i%d; addr %lu, range (%ld,%ld): ",
6477+ GET_MODE_NAME (mode),
6478+ INSN_UID (insn), (unsigned long) address,
6479+ -1 * (long) fix->backwards, (long) fix->forwards);
6480+ avr32_print_value (dump_file, fix->value);
6481+ fprintf (dump_file, "\n");
6482+ }
6483+
6484+ /* Add it to the chain of fixes. */
6485+ fix->next = NULL;
6486+
6487+ if (minipool_fix_head != NULL)
6488+ minipool_fix_tail->next = fix;
6489+ else
6490+ minipool_fix_head = fix;
6491+
6492+ minipool_fix_tail = fix;
6493+}
6494+
6495+/* Scan INSN and note any of its operands that need fixing.
6496+ If DO_PUSHES is false we do not actually push any of the fixups
6497+ needed. The function returns TRUE is any fixups were needed/pushed.
6498+ This is used by avr32_memory_load_p() which needs to know about loads
6499+ of constants that will be converted into minipool loads. */
6500+static bool
6501+note_invalid_constants (rtx insn, HOST_WIDE_INT address, int do_pushes)
6502+{
6503+ bool result = false;
6504+ int opno;
6505+
6506+ extract_insn (insn);
6507+
6508+ if (!constrain_operands (1))
6509+ fatal_insn_not_found (insn);
6510+
6511+ if (recog_data.n_alternatives == 0)
6512+ return false;
6513+
6514+ /* Fill in recog_op_alt with information about the constraints of this
6515+ insn. */
6516+ preprocess_constraints ();
6517+
6518+ for (opno = 0; opno < recog_data.n_operands; opno++)
6519+ {
6520+ rtx op;
6521+
6522+ /* Things we need to fix can only occur in inputs. */
6523+ if (recog_data.operand_type[opno] != OP_IN)
6524+ continue;
6525+
6526+ op = recog_data.operand[opno];
6527+
6528+ if (avr32_const_pool_ref_operand (op, GET_MODE (op)))
6529+ {
6530+ if (do_pushes)
6531+ {
6532+ rtx cop = avoid_constant_pool_reference (op);
6533+
6534+ /* Casting the address of something to a mode narrower than a
6535+ word can cause avoid_constant_pool_reference() to return the
6536+ pool reference itself. That's no good to us here. Lets
6537+ just hope that we can use the constant pool value directly.
6538+ */
6539+ if (op == cop)
6540+ cop = get_pool_constant (XEXP (op, 0));
6541+
6542+ push_minipool_fix (insn, address,
6543+ recog_data.operand_loc[opno],
6544+ recog_data.operand_mode[opno], cop);
6545+ }
6546+
6547+ result = true;
6548+ }
6549+ else if (TARGET_HAS_ASM_ADDR_PSEUDOS
6550+ && avr32_address_operand (op, GET_MODE (op)))
6551+ {
6552+ /* Handle pseudo instructions using a direct address. These pseudo
6553+ instructions might need entries in the constant pool and we must
6554+ therefor create a constant pool for them, in case the
6555+ assembler/linker needs to insert entries. */
6556+ if (do_pushes)
6557+ {
6558+ /* Push a dummy constant pool entry so that the .cpool
6559+ directive should be inserted on the appropriate place in the
6560+ code even if there are no real constant pool entries. This
6561+ is used by the assembler and linker to know where to put
6562+ generated constant pool entries. */
6563+ push_minipool_fix (insn, address,
6564+ recog_data.operand_loc[opno],
6565+ recog_data.operand_mode[opno],
6566+ gen_rtx_UNSPEC (VOIDmode,
6567+ gen_rtvec (1, const0_rtx),
6568+ UNSPEC_FORCE_MINIPOOL));
6569+ result = true;
6570+ }
6571+ }
6572+ }
6573+ return result;
6574+}
6575+
6576+
6577+static int
6578+avr32_insn_is_cast (rtx insn)
6579+{
6580+
6581+ if (NONJUMP_INSN_P (insn)
6582+ && GET_CODE (PATTERN (insn)) == SET
6583+ && (GET_CODE (SET_SRC (PATTERN (insn))) == ZERO_EXTEND
6584+ || GET_CODE (SET_SRC (PATTERN (insn))) == SIGN_EXTEND)
6585+ && REG_P (XEXP (SET_SRC (PATTERN (insn)), 0))
6586+ && REG_P (SET_DEST (PATTERN (insn))))
6587+ return true;
6588+ return false;
6589+}
6590+
6591+/* FIXME: The level of nesting in this function is way too deep. It needs to be
6592+ torn apart. */
6593+static void
6594+avr32_reorg_optimization (void)
6595+{
6596+ rtx first = get_insns ();
6597+ rtx insn;
6598+
6599+ if (TARGET_MD_REORG_OPTIMIZATION && (optimize_size || (optimize > 0)))
6600+ {
6601+
6602+ /* Scan through all insns looking for cast operations. */
6603+ if (dump_file)
6604+ {
6605+ fprintf (dump_file, ";; Deleting redundant cast operations:\n");
6606+ }
6607+ for (insn = first; insn; insn = NEXT_INSN (insn))
6608+ {
6609+ rtx reg, src_reg, scan;
6610+ enum machine_mode mode;
6611+ int unused_cast;
6612+ rtx label_ref;
6613+
6614+ if (avr32_insn_is_cast (insn)
6615+ && (GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == QImode
6616+ || GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == HImode))
6617+ {
6618+ mode = GET_MODE (XEXP (SET_SRC (PATTERN (insn)), 0));
6619+ reg = SET_DEST (PATTERN (insn));
6620+ src_reg = XEXP (SET_SRC (PATTERN (insn)), 0);
6621+ }
6622+ else
6623+ {
6624+ continue;
6625+ }
6626+
6627+ unused_cast = false;
6628+ label_ref = NULL_RTX;
6629+ for (scan = NEXT_INSN (insn); scan; scan = NEXT_INSN (scan))
6630+ {
6631+ /* Check if we have reached the destination of a simple
6632+ conditional jump which we have already scanned past. If so,
6633+ we can safely continue scanning. */
6634+ if (LABEL_P (scan) && label_ref != NULL_RTX)
6635+ {
6636+ if (CODE_LABEL_NUMBER (scan) ==
6637+ CODE_LABEL_NUMBER (XEXP (label_ref, 0)))
6638+ label_ref = NULL_RTX;
6639+ else
6640+ break;
6641+ }
6642+
6643+ if (!INSN_P (scan))
6644+ continue;
6645+
6646+ /* For conditional jumps we can manage to keep on scanning if
6647+ we meet the destination label later on before any new jump
6648+ insns occure. */
6649+ if (GET_CODE (scan) == JUMP_INSN)
6650+ {
6651+ if (any_condjump_p (scan) && label_ref == NULL_RTX)
6652+ label_ref = condjump_label (scan);
6653+ else
6654+ break;
6655+ }
6656+
6657+ if (!reg_mentioned_p (reg, PATTERN (scan)))
6658+ continue;
6659+
6660+ /* Check if casted register is used in this insn */
6661+ if ((regno_use_in (REGNO (reg), PATTERN (scan)) != NULL_RTX)
6662+ && (GET_MODE (regno_use_in (REGNO (reg), PATTERN (scan))) ==
6663+ GET_MODE (reg)))
6664+ {
6665+ /* If not used in the source to the set or in a memory
6666+ expression in the destiantion then the register is used
6667+ as a destination and is really dead. */
6668+ if (single_set (scan)
6669+ && GET_CODE (PATTERN (scan)) == SET
6670+ && REG_P (SET_DEST (PATTERN (scan)))
6671+ && !regno_use_in (REGNO (reg), SET_SRC (PATTERN (scan)))
6672+ && label_ref == NULL_RTX)
6673+ {
6674+ unused_cast = true;
6675+ }
6676+ break;
6677+ }
6678+
6679+ /* Check if register is dead or set in this insn */
6680+ if (dead_or_set_p (scan, reg))
6681+ {
6682+ unused_cast = true;
6683+ break;
6684+ }
6685+ }
6686+
6687+ /* Check if we have unresolved conditional jumps */
6688+ if (label_ref != NULL_RTX)
6689+ continue;
6690+
6691+ if (unused_cast)
6692+ {
6693+ if (REGNO (reg) == REGNO (XEXP (SET_SRC (PATTERN (insn)), 0)))
6694+ {
6695+ /* One operand cast, safe to delete */
6696+ if (dump_file)
6697+ {
6698+ fprintf (dump_file,
6699+ ";; INSN %i removed, casted register %i value not used.\n",
6700+ INSN_UID (insn), REGNO (reg));
6701+ }
6702+ SET_INSN_DELETED (insn);
6703+ /* Force the instruction to be recognized again */
6704+ INSN_CODE (insn) = -1;
6705+ }
6706+ else
6707+ {
6708+ /* Two operand cast, which really could be substituted with
6709+ a move, if the source register is dead after the cast
6710+ insn and then the insn which sets the source register
6711+ could instead directly set the destination register for
6712+ the cast. As long as there are no insns in between which
6713+ uses the register. */
6714+ rtx link = NULL_RTX;
6715+ rtx set;
6716+ rtx src_reg = XEXP (SET_SRC (PATTERN (insn)), 0);
6717+ unused_cast = false;
6718+
6719+ if (!find_reg_note (insn, REG_DEAD, src_reg))
6720+ continue;
6721+
6722+ /* Search for the insn which sets the source register */
6723+ for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
6724+ {
6725+ if (REG_NOTE_KIND (link) != 0)
6726+ continue;
6727+ set = single_set (XEXP (link, 0));
6728+ if (set && rtx_equal_p (src_reg, SET_DEST (set)))
6729+ {
6730+ link = XEXP (link, 0);
6731+ break;
6732+ }
6733+ }
6734+
6735+ /* Found no link or link is a call insn where we can not
6736+ change the destination register */
6737+ if (link == NULL_RTX || CALL_P (link))
6738+ continue;
6739+
6740+ /* Scan through all insn between link and insn */
6741+ for (scan = NEXT_INSN (link); scan; scan = NEXT_INSN (scan))
6742+ {
6743+ /* Don't try to trace forward past a CODE_LABEL if we
6744+ haven't seen INSN yet. Ordinarily, we will only
6745+ find the setting insn in LOG_LINKS if it is in the
6746+ same basic block. However, cross-jumping can insert
6747+ code labels in between the load and the call, and
6748+ can result in situations where a single call insn
6749+ may have two targets depending on where we came
6750+ from. */
6751+
6752+ if (GET_CODE (scan) == CODE_LABEL)
6753+ break;
6754+
6755+ if (!INSN_P (scan))
6756+ continue;
6757+
6758+ /* Don't try to trace forward past a JUMP. To optimize
6759+ safely, we would have to check that all the
6760+ instructions at the jump destination did not use REG.
6761+ */
6762+
6763+ if (GET_CODE (scan) == JUMP_INSN)
6764+ {
6765+ break;
6766+ }
6767+
6768+ if (!reg_mentioned_p (src_reg, PATTERN (scan)))
6769+ continue;
6770+
6771+ /* We have reached the cast insn */
6772+ if (scan == insn)
6773+ {
6774+ /* We can remove cast and replace the destination
6775+ register of the link insn with the destination
6776+ of the cast */
6777+ if (dump_file)
6778+ {
6779+ fprintf (dump_file,
6780+ ";; INSN %i removed, casted value unused. "
6781+ "Destination of removed cast operation: register %i, folded into INSN %i.\n",
6782+ INSN_UID (insn), REGNO (reg),
6783+ INSN_UID (link));
6784+ }
6785+ /* Update link insn */
6786+ SET_DEST (PATTERN (link)) =
6787+ gen_rtx_REG (mode, REGNO (reg));
6788+ /* Force the instruction to be recognized again */
6789+ INSN_CODE (link) = -1;
6790+
6791+ /* Delete insn */
6792+ SET_INSN_DELETED (insn);
6793+ /* Force the instruction to be recognized again */
6794+ INSN_CODE (insn) = -1;
6795+ break;
6796+ }
6797+ }
6798+ }
6799+ }
6800+ }
6801+ }
6802+
6803+ if (TARGET_MD_REORG_OPTIMIZATION && (optimize_size || (optimize > 0)))
6804+ {
6805+
6806+ /* Scan through all insns looking for shifted add operations */
6807+ if (dump_file)
6808+ {
6809+ fprintf (dump_file,
6810+ ";; Deleting redundant shifted add operations:\n");
6811+ }
6812+ for (insn = first; insn; insn = NEXT_INSN (insn))
6813+ {
6814+ rtx reg, mem_expr, scan, op0, op1;
6815+ int add_only_used_as_pointer;
6816+
6817+ if (INSN_P (insn)
6818+ && GET_CODE (PATTERN (insn)) == SET
6819+ && GET_CODE (SET_SRC (PATTERN (insn))) == PLUS
6820+ && (GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == MULT
6821+ || GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 0)) == ASHIFT)
6822+ && GET_CODE (XEXP (XEXP (SET_SRC (PATTERN (insn)), 0), 1)) ==
6823+ CONST_INT && REG_P (SET_DEST (PATTERN (insn)))
6824+ && REG_P (XEXP (SET_SRC (PATTERN (insn)), 1))
6825+ && REG_P (XEXP (XEXP (SET_SRC (PATTERN (insn)), 0), 0)))
6826+ {
6827+ reg = SET_DEST (PATTERN (insn));
6828+ mem_expr = SET_SRC (PATTERN (insn));
6829+ op0 = XEXP (XEXP (mem_expr, 0), 0);
6830+ op1 = XEXP (mem_expr, 1);
6831+ }
6832+ else
6833+ {
6834+ continue;
6835+ }
6836+
6837+ /* Scan forward the check if the result of the shifted add
6838+ operation is only used as an address in memory operations and
6839+ that the operands to the shifted add are not clobbered. */
6840+ add_only_used_as_pointer = false;
6841+ for (scan = NEXT_INSN (insn); scan; scan = NEXT_INSN (scan))
6842+ {
6843+ if (!INSN_P (scan))
6844+ continue;
6845+
6846+ /* Don't try to trace forward past a JUMP or CALL. To optimize
6847+ safely, we would have to check that all the instructions at
6848+ the jump destination did not use REG. */
6849+
6850+ if (GET_CODE (scan) == JUMP_INSN)
6851+ {
6852+ break;
6853+ }
6854+
6855+ /* If used in a call insn then we cannot optimize it away */
6856+ if (CALL_P (scan) && find_regno_fusage (scan, USE, REGNO (reg)))
6857+ break;
6858+
6859+ /* If any of the operands of the shifted add are clobbered we
6860+ cannot optimize the shifted adda away */
6861+ if ((reg_set_p (op0, scan) && (REGNO (op0) != REGNO (reg)))
6862+ || (reg_set_p (op1, scan) && (REGNO (op1) != REGNO (reg))))
6863+ break;
6864+
6865+ if (!reg_mentioned_p (reg, PATTERN (scan)))
6866+ continue;
6867+
6868+ /* If used any other place than as a pointer or as the
6869+ destination register we failed */
6870+ if (!(single_set (scan)
6871+ && GET_CODE (PATTERN (scan)) == SET
6872+ && ((MEM_P (SET_DEST (PATTERN (scan)))
6873+ && REG_P (XEXP (SET_DEST (PATTERN (scan)), 0))
6874+ && REGNO (XEXP (SET_DEST (PATTERN (scan)), 0)) ==
6875+ REGNO (reg)) || (MEM_P (SET_SRC (PATTERN (scan)))
6876+ &&
6877+ REG_P (XEXP
6878+ (SET_SRC (PATTERN (scan)),
6879+ 0))
6880+ &&
6881+ REGNO (XEXP
6882+ (SET_SRC (PATTERN (scan)),
6883+ 0)) == REGNO (reg))))
6884+ && !(GET_CODE (PATTERN (scan)) == SET
6885+ && REG_P (SET_DEST (PATTERN (scan)))
6886+ && !regno_use_in (REGNO (reg),
6887+ SET_SRC (PATTERN (scan)))))
6888+ break;
6889+
6890+ /* Check if register is dead or set in this insn */
6891+ if (dead_or_set_p (scan, reg))
6892+ {
6893+ add_only_used_as_pointer = true;
6894+ break;
6895+ }
6896+ }
6897+
6898+ if (add_only_used_as_pointer)
6899+ {
6900+ /* Lets delete the add insn and replace all memory references
6901+ which uses the pointer with the full expression. */
6902+ if (dump_file)
6903+ {
6904+ fprintf (dump_file,
6905+ ";; Deleting INSN %i since address expression can be folded into all "
6906+ "memory references using this expression\n",
6907+ INSN_UID (insn));
6908+ }
6909+ SET_INSN_DELETED (insn);
6910+ /* Force the instruction to be recognized again */
6911+ INSN_CODE (insn) = -1;
6912+
6913+ for (scan = NEXT_INSN (insn); scan; scan = NEXT_INSN (scan))
6914+ {
6915+ if (!INSN_P (scan))
6916+ continue;
6917+
6918+ if (!reg_mentioned_p (reg, PATTERN (scan)))
6919+ continue;
6920+
6921+ /* If used any other place than as a pointer or as the
6922+ destination register we failed */
6923+ if ((single_set (scan)
6924+ && GET_CODE (PATTERN (scan)) == SET
6925+ && ((MEM_P (SET_DEST (PATTERN (scan)))
6926+ && REG_P (XEXP (SET_DEST (PATTERN (scan)), 0))
6927+ && REGNO (XEXP (SET_DEST (PATTERN (scan)), 0)) ==
6928+ REGNO (reg)) || (MEM_P (SET_SRC (PATTERN (scan)))
6929+ &&
6930+ REG_P (XEXP
6931+ (SET_SRC (PATTERN (scan)),
6932+ 0))
6933+ &&
6934+ REGNO (XEXP
6935+ (SET_SRC (PATTERN (scan)),
6936+ 0)) == REGNO (reg)))))
6937+ {
6938+ if (dump_file)
6939+ {
6940+ fprintf (dump_file,
6941+ ";; Register %i replaced by indexed address in INSN %i\n",
6942+ REGNO (reg), INSN_UID (scan));
6943+ }
6944+ if (MEM_P (SET_DEST (PATTERN (scan))))
6945+ XEXP (SET_DEST (PATTERN (scan)), 0) = mem_expr;
6946+ else
6947+ XEXP (SET_SRC (PATTERN (scan)), 0) = mem_expr;
6948+ }
6949+
6950+ /* Check if register is dead or set in this insn */
6951+ if (dead_or_set_p (scan, reg))
6952+ {
6953+ break;
6954+ }
6955+
6956+ }
6957+ }
6958+ }
6959+ }
6960+}
6961+
6962+/* Exported to toplev.c.
6963+
6964+ Do a final pass over the function, just before delayed branch
6965+ scheduling. */
6966+
6967+static void
6968+avr32_reorg (void)
6969+{
6970+ rtx insn;
6971+ HOST_WIDE_INT address = 0;
6972+ Mfix *fix;
6973+
6974+ minipool_fix_head = minipool_fix_tail = NULL;
6975+
6976+ /* The first insn must always be a note, or the code below won't scan it
6977+ properly. */
6978+ insn = get_insns ();
6979+ if (GET_CODE (insn) != NOTE)
6980+ abort ();
6981+
6982+ /* Scan all the insns and record the operands that will need fixing. */
6983+ for (insn = next_nonnote_insn (insn); insn; insn = next_nonnote_insn (insn))
6984+ {
6985+ if (GET_CODE (insn) == BARRIER)
6986+ push_minipool_barrier (insn, address);
6987+ else if (INSN_P (insn))
6988+ {
6989+ rtx table;
6990+
6991+ note_invalid_constants (insn, address, true);
6992+ address += get_attr_length (insn);
6993+
6994+ /* If the insn is a vector jump, add the size of the table and skip
6995+ the table. */
6996+ if ((table = is_jump_table (insn)) != NULL)
6997+ {
6998+ address += get_jump_table_size (table);
6999+ insn = table;
7000+ }
7001+ }
7002+ }
7003+
7004+ fix = minipool_fix_head;
7005+
7006+ /* Now scan the fixups and perform the required changes. */
7007+ while (fix)
7008+ {
7009+ Mfix *ftmp;
7010+ Mfix *fdel;
7011+ Mfix *last_added_fix;
7012+ Mfix *last_barrier = NULL;
7013+ Mfix *this_fix;
7014+
7015+ /* Skip any further barriers before the next fix. */
7016+ while (fix && GET_CODE (fix->insn) == BARRIER)
7017+ fix = fix->next;
7018+
7019+ /* No more fixes. */
7020+ if (fix == NULL)
7021+ break;
7022+
7023+ last_added_fix = NULL;
7024+
7025+ for (ftmp = fix; ftmp; ftmp = ftmp->next)
7026+ {
7027+ if (GET_CODE (ftmp->insn) == BARRIER)
7028+ {
7029+ if (ftmp->address >= minipool_vector_head->max_address)
7030+ break;
7031+
7032+ last_barrier = ftmp;
7033+ }
7034+ else if ((ftmp->minipool = add_minipool_forward_ref (ftmp)) == NULL)
7035+ break;
7036+
7037+ last_added_fix = ftmp; /* Keep track of the last fix added.
7038+ */
7039+ }
7040+
7041+ /* If we found a barrier, drop back to that; any fixes that we could
7042+ have reached but come after the barrier will now go in the next
7043+ mini-pool. */
7044+ if (last_barrier != NULL)
7045+ {
7046+ /* Reduce the refcount for those fixes that won't go into this pool
7047+ after all. */
7048+ for (fdel = last_barrier->next;
7049+ fdel && fdel != ftmp; fdel = fdel->next)
7050+ {
7051+ fdel->minipool->refcount--;
7052+ fdel->minipool = NULL;
7053+ }
7054+
7055+ ftmp = last_barrier;
7056+ }
7057+ else
7058+ {
7059+ /* ftmp is first fix that we can't fit into this pool and there no
7060+ natural barriers that we could use. Insert a new barrier in the
7061+ code somewhere between the previous fix and this one, and
7062+ arrange to jump around it. */
7063+ HOST_WIDE_INT max_address;
7064+
7065+ /* The last item on the list of fixes must be a barrier, so we can
7066+ never run off the end of the list of fixes without last_barrier
7067+ being set. */
7068+ if (ftmp == NULL)
7069+ abort ();
7070+
7071+ max_address = minipool_vector_head->max_address;
7072+ /* Check that there isn't another fix that is in range that we
7073+ couldn't fit into this pool because the pool was already too
7074+ large: we need to put the pool before such an instruction. */
7075+ if (ftmp->address < max_address)
7076+ max_address = ftmp->address;
7077+
7078+ last_barrier = create_fix_barrier (last_added_fix, max_address);
7079+ }
7080+
7081+ assign_minipool_offsets (last_barrier);
7082+
7083+ while (ftmp)
7084+ {
7085+ if (GET_CODE (ftmp->insn) != BARRIER
7086+ && ((ftmp->minipool = add_minipool_backward_ref (ftmp))
7087+ == NULL))
7088+ break;
7089+
7090+ ftmp = ftmp->next;
7091+ }
7092+
7093+ /* Scan over the fixes we have identified for this pool, fixing them up
7094+ and adding the constants to the pool itself. */
7095+ for (this_fix = fix; this_fix && ftmp != this_fix;
7096+ this_fix = this_fix->next)
7097+ if (GET_CODE (this_fix->insn) != BARRIER
7098+ /* Do nothing for entries present just to force the insertion of
7099+ a minipool. */
7100+ && !IS_FORCE_MINIPOOL (this_fix->value))
7101+ {
7102+ rtx addr = plus_constant (gen_rtx_LABEL_REF (VOIDmode,
7103+ minipool_vector_label),
7104+ this_fix->minipool->offset);
7105+ *this_fix->loc = gen_rtx_MEM (this_fix->mode, addr);
7106+ }
7107+
7108+ dump_minipool (last_barrier->insn);
7109+ fix = ftmp;
7110+ }
7111+
7112+ /* Free the minipool memory. */
7113+ obstack_free (&minipool_obstack, minipool_startobj);
7114+
7115+ avr32_reorg_optimization ();
7116+}
7117+
7118+
7119+/*
7120+ Hook for doing some final scanning of instructions. Does nothing yet...*/
7121+void
7122+avr32_final_prescan_insn (rtx insn ATTRIBUTE_UNUSED,
7123+ rtx * opvec ATTRIBUTE_UNUSED,
7124+ int noperands ATTRIBUTE_UNUSED)
7125+{
7126+ return;
7127+}
7128+
7129+
7130+
7131+int
7132+avr32_expand_movcc (enum machine_mode mode, rtx operands[])
7133+{
7134+ rtx operator;
7135+ rtx compare_op0 = avr32_compare_op0;
7136+ rtx compare_op1 = avr32_compare_op1;
7137+
7138+ /* Only allow certain compare operations */
7139+ if (GET_MODE (compare_op0) != DImode
7140+ && GET_MODE (compare_op0) != SImode
7141+ && GET_MODE (compare_op0) != HImode && GET_MODE (compare_op0) != QImode)
7142+ return FALSE;
7143+
7144+ if (GET_CODE (compare_op0) == MEM)
7145+ {
7146+ if (no_new_pseudos)
7147+ return FALSE;
7148+ else
7149+ compare_op0 = force_reg (GET_MODE (compare_op0), compare_op0);
7150+ }
7151+
7152+ if (GET_CODE (compare_op1) == MEM)
7153+ {
7154+ if (no_new_pseudos)
7155+ return FALSE;
7156+ else
7157+ compare_op1 = force_reg (GET_MODE (compare_op1), compare_op1);
7158+ }
7159+
7160+ /* For DI, HI and QI mode force comparison operands to registers */
7161+ if (GET_MODE (compare_op0) == DImode
7162+ || GET_MODE (compare_op0) == HImode || GET_MODE (compare_op0) == QImode)
7163+ {
7164+ if (GET_CODE (compare_op0) != REG)
7165+ {
7166+ if (no_new_pseudos)
7167+ return FALSE;
7168+ else
7169+ compare_op0 = force_reg (GET_MODE (compare_op0), compare_op0);
7170+ }
7171+
7172+ if (GET_CODE (compare_op1) != REG)
7173+ {
7174+ if (no_new_pseudos)
7175+ return FALSE;
7176+ else
7177+ compare_op1 = force_reg (GET_MODE (compare_op0), compare_op1);
7178+ }
7179+ }
7180+
7181+ /* Force any immediate compare operands for SI, larger than the L
7182+ constraint, to a register */
7183+ if (GET_MODE (compare_op0) == SImode)
7184+ {
7185+ if ((GET_CODE (compare_op0) == CONST_INT
7186+ && !avr32_const_ok_for_constraint_p (INTVAL (compare_op0), 'K',
7187+ "Ks21")))
7188+ {
7189+ if (no_new_pseudos)
7190+ return FALSE;
7191+ else
7192+ compare_op0 = force_reg (SImode, compare_op0);
7193+ }
7194+
7195+ if ((GET_CODE (compare_op1) == CONST_INT
7196+ && !avr32_const_ok_for_constraint_p (INTVAL (compare_op1), 'K',
7197+ "Ks21")))
7198+ {
7199+ if (no_new_pseudos)
7200+ return FALSE;
7201+ else
7202+ compare_op1 = force_reg (SImode, compare_op1);
7203+ }
7204+ }
7205+
7206+ /* If we have immediates larger than can be allowed in conditional mov
7207+ instructions, force them to registers */
7208+ if (GET_CODE (operands[2]) == CONST_INT
7209+ && !avr32_const_ok_for_constraint_p (INTVAL (operands[2]), 'K', "Ks08"))
7210+ {
7211+ if (no_new_pseudos)
7212+ return FALSE;
7213+ else
7214+ operands[2] = force_reg (mode, operands[2]);
7215+ }
7216+
7217+ if (GET_CODE (operands[3]) == CONST_INT
7218+ && !avr32_const_ok_for_constraint_p (INTVAL (operands[3]), 'K', "Ks08"))
7219+ {
7220+ if (no_new_pseudos)
7221+ return FALSE;
7222+ else
7223+ operands[3] = force_reg (mode, operands[3]);
7224+ }
7225+
7226+ /* Emit the actual instruction */
7227+ operator = gen_rtx_EQ (VOIDmode, const0_rtx, const0_rtx);
7228+ PUT_CODE (operator, GET_CODE (operands[1]));
7229+ switch (mode)
7230+ {
7231+ case SImode:
7232+ switch (GET_MODE (compare_op0))
7233+ {
7234+ case SImode:
7235+ emit_insn (gen_movsicc_cmpsi
7236+ (operands[0], operator, operands[2], operands[3],
7237+ compare_op0, compare_op1));
7238+ break;
7239+ case DImode:
7240+ emit_insn (gen_movsicc_cmpdi
7241+ (operands[0], operator, operands[2], operands[3],
7242+ compare_op0, compare_op1));
7243+ break;
7244+ case HImode:
7245+ emit_insn (gen_movsicc_cmphi
7246+ (operands[0], operator, operands[2], operands[3],
7247+ compare_op0, compare_op1));
7248+ break;
7249+ case QImode:
7250+ emit_insn (gen_movsicc_cmpqi
7251+ (operands[0], operator, operands[2], operands[3],
7252+ compare_op0, compare_op1));
7253+ break;
7254+ default:
7255+ return FALSE;
7256+ }
7257+ break;
7258+ case HImode:
7259+ switch (GET_MODE (compare_op0))
7260+ {
7261+ case SImode:
7262+ emit_insn (gen_movhicc_cmpsi
7263+ (operands[0], operator, operands[2], operands[3],
7264+ compare_op0, compare_op1));
7265+ break;
7266+ case DImode:
7267+ emit_insn (gen_movhicc_cmpdi
7268+ (operands[0], operator, operands[2], operands[3],
7269+ compare_op0, compare_op1));
7270+ break;
7271+ case HImode:
7272+ emit_insn (gen_movhicc_cmphi
7273+ (operands[0], operator, operands[2], operands[3],
7274+ compare_op0, compare_op1));
7275+ break;
7276+ case QImode:
7277+ emit_insn (gen_movhicc_cmpqi
7278+ (operands[0], operator, operands[2], operands[3],
7279+ compare_op0, compare_op1));
7280+ break;
7281+ default:
7282+ return FALSE;
7283+ }
7284+ break;
7285+ case QImode:
7286+ switch (GET_MODE (compare_op0))
7287+ {
7288+ case SImode:
7289+ emit_insn (gen_movqicc_cmpsi
7290+ (operands[0], operator, operands[2], operands[3],
7291+ compare_op0, compare_op1));
7292+ break;
7293+ case DImode:
7294+ emit_insn (gen_movqicc_cmpdi
7295+ (operands[0], operator, operands[2], operands[3],
7296+ compare_op0, compare_op1));
7297+ break;
7298+ case HImode:
7299+ emit_insn (gen_movqicc_cmphi
7300+ (operands[0], operator, operands[2], operands[3],
7301+ compare_op0, compare_op1));
7302+ break;
7303+ case QImode:
7304+ emit_insn (gen_movqicc_cmpqi
7305+ (operands[0], operator, operands[2], operands[3],
7306+ compare_op0, compare_op1));
7307+ break;
7308+ default:
7309+ return FALSE;
7310+ }
7311+ break;
7312+ default:
7313+ return FALSE;
7314+ }
7315+
7316+ return TRUE;
7317+}
7318+
7319+
7320+int
7321+avr32_expand_addcc (enum machine_mode mode, rtx operands[])
7322+{
7323+ rtx operator;
7324+ rtx compare_op0 = avr32_compare_op0;
7325+ rtx compare_op1 = avr32_compare_op1;
7326+
7327+ /* Check if we have an add/sub with an k8 immediate */
7328+ if (!(GET_CODE (operands[3]) == CONST_INT
7329+ && avr32_const_ok_for_constraint_p (-INTVAL (operands[3]), 'K',
7330+ "Ks08")))
7331+ return FALSE;
7332+ else
7333+ /* Flip sign */
7334+ operands[3] = GEN_INT (-INTVAL (operands[3]));
7335+
7336+ /* Only allow certain compare operations */
7337+ if (GET_MODE (compare_op0) != DImode
7338+ && GET_MODE (compare_op0) != SImode
7339+ && GET_MODE (compare_op0) != HImode && GET_MODE (compare_op0) != QImode)
7340+ return FALSE;
7341+
7342+ if (GET_CODE (compare_op0) == MEM)
7343+ {
7344+ if (no_new_pseudos)
7345+ return FALSE;
7346+ else
7347+ compare_op0 = force_reg (GET_MODE (compare_op0), compare_op0);
7348+ }
7349+
7350+ if (GET_CODE (compare_op1) == MEM)
7351+ {
7352+ if (no_new_pseudos)
7353+ return FALSE;
7354+ else
7355+ compare_op1 = force_reg (GET_MODE (compare_op1), compare_op1);
7356+ }
7357+
7358+ /* For DI, HI and QI mode force comparison operands to registers */
7359+ if (GET_MODE (compare_op0) == DImode
7360+ || GET_MODE (compare_op0) == HImode || GET_MODE (compare_op0) == QImode)
7361+ {
7362+ if (GET_CODE (compare_op0) != REG)
7363+ {
7364+ if (no_new_pseudos)
7365+ return FALSE;
7366+ else
7367+ compare_op0 = force_reg (GET_MODE (compare_op0), compare_op0);
7368+ }
7369+
7370+ if (GET_CODE (compare_op1) != REG)
7371+ {
7372+ if (no_new_pseudos)
7373+ return FALSE;
7374+ else
7375+ compare_op1 = force_reg (GET_MODE (compare_op0), compare_op1);
7376+ }
7377+ }
7378+
7379+ /* Force any immediate compare operands for SI, larger than the L
7380+ constraint, to a register */
7381+ if (GET_MODE (compare_op0) == SImode)
7382+ {
7383+ if ((GET_CODE (compare_op0) == CONST_INT
7384+ && !avr32_const_ok_for_constraint_p (INTVAL (compare_op0), 'K',
7385+ "Ks21")))
7386+ {
7387+ if (no_new_pseudos)
7388+ return FALSE;
7389+ else
7390+ compare_op0 = force_reg (SImode, compare_op0);
7391+ }
7392+
7393+ if ((GET_CODE (compare_op1) == CONST_INT
7394+ && !avr32_const_ok_for_constraint_p (INTVAL (compare_op1), 'K',
7395+ "Ks21")))
7396+ {
7397+ if (no_new_pseudos)
7398+ return FALSE;
7399+ else
7400+ compare_op1 = force_reg (SImode, compare_op1);
7401+ }
7402+ }
7403+
7404+ /* If we have immediates larger than can be allowed in conditional mov
7405+ instructions, force them to registers */
7406+ if (GET_CODE (operands[2]) == CONST_INT
7407+ && !avr32_const_ok_for_constraint_p (INTVAL (operands[2]), 'K', "Ks08"))
7408+ {
7409+ if (no_new_pseudos)
7410+ return FALSE;
7411+ else
7412+ operands[2] = force_reg (mode, operands[2]);
7413+ }
7414+
7415+ if (GET_CODE (operands[3]) == CONST_INT
7416+ && !avr32_const_ok_for_constraint_p (INTVAL (operands[3]), 'K', "Ks08"))
7417+ {
7418+ if (no_new_pseudos)
7419+ return FALSE;
7420+ else
7421+ operands[3] = force_reg (mode, operands[3]);
7422+ }
7423+
7424+ if (GET_CODE (operands[0]) != REG)
7425+ {
7426+ if (no_new_pseudos)
7427+ return FALSE;
7428+ else
7429+ operands[0] = force_reg (GET_MODE (operands[0]), operands[0]);
7430+ }
7431+
7432+ if (GET_CODE (operands[2]) != REG)
7433+ {
7434+ if (no_new_pseudos)
7435+ return FALSE;
7436+ else
7437+ operands[2] = force_reg (GET_MODE (operands[2]), operands[2]);
7438+ }
7439+
7440+ /* Check if operands[0] and operands[2] are different */
7441+ if (REGNO (operands[0]) != REGNO (operands[2]))
7442+ {
7443+ emit_move_insn (operands[0], operands[2]);
7444+ operands[2] = operands[0];
7445+ }
7446+
7447+ /* Emit the actual instruction */
7448+ operator = gen_rtx_EQ (VOIDmode, const0_rtx, const0_rtx);
7449+ PUT_CODE (operator, GET_CODE (operands[1]));
7450+ switch (mode)
7451+ {
7452+ case SImode:
7453+ switch (GET_MODE (compare_op0))
7454+ {
7455+ case SImode:
7456+ emit_insn (gen_addsicc_cmpsi
7457+ (operands[0], operator, operands[2], operands[3],
7458+ compare_op0, compare_op1));
7459+ break;
7460+ case DImode:
7461+ emit_insn (gen_addsicc_cmpdi
7462+ (operands[0], operator, operands[2], operands[3],
7463+ compare_op0, compare_op1));
7464+ break;
7465+ case HImode:
7466+ emit_insn (gen_addsicc_cmphi
7467+ (operands[0], operator, operands[2], operands[3],
7468+ compare_op0, compare_op1));
7469+ break;
7470+ case QImode:
7471+ emit_insn (gen_addsicc_cmpqi
7472+ (operands[0], operator, operands[2], operands[3],
7473+ compare_op0, compare_op1));
7474+ break;
7475+ default:
7476+ return FALSE;
7477+ }
7478+ break;
7479+ case HImode:
7480+ switch (GET_MODE (compare_op0))
7481+ {
7482+ case SImode:
7483+ emit_insn (gen_addhicc_cmpsi
7484+ (operands[0], operator, operands[2], operands[3],
7485+ compare_op0, compare_op1));
7486+ break;
7487+ case DImode:
7488+ emit_insn (gen_addhicc_cmpdi
7489+ (operands[0], operator, operands[2], operands[3],
7490+ compare_op0, compare_op1));
7491+ break;
7492+ case HImode:
7493+ emit_insn (gen_addhicc_cmphi
7494+ (operands[0], operator, operands[2], operands[3],
7495+ compare_op0, compare_op1));
7496+ break;
7497+ case QImode:
7498+ emit_insn (gen_addhicc_cmpqi
7499+ (operands[0], operator, operands[2], operands[3],
7500+ compare_op0, compare_op1));
7501+ break;
7502+ default:
7503+ return FALSE;
7504+ }
7505+ break;
7506+ case QImode:
7507+ switch (GET_MODE (compare_op0))
7508+ {
7509+ case SImode:
7510+ emit_insn (gen_addqicc_cmpsi
7511+ (operands[0], operator, operands[2], operands[3],
7512+ compare_op0, compare_op1));
7513+ break;
7514+ case DImode:
7515+ emit_insn (gen_addqicc_cmpdi
7516+ (operands[0], operator, operands[2], operands[3],
7517+ compare_op0, compare_op1));
7518+ break;
7519+ case HImode:
7520+ emit_insn (gen_addqicc_cmphi
7521+ (operands[0], operator, operands[2], operands[3],
7522+ compare_op0, compare_op1));
7523+ break;
7524+ case QImode:
7525+ emit_insn (gen_addqicc_cmpqi
7526+ (operands[0], operator, operands[2], operands[3],
7527+ compare_op0, compare_op1));
7528+ break;
7529+ default:
7530+ return FALSE;
7531+ }
7532+ break;
7533+ default:
7534+ return FALSE;
7535+ }
7536+
7537+ return TRUE;
7538+}
7539+
7540+/* Function for changing the condition on the next instruction,
7541+ should be used when emmiting compare instructions and
7542+ the condition of the next instruction needs to change.
7543+*/
7544+int
7545+set_next_insn_cond (rtx cur_insn, rtx new_cond)
7546+{
7547+ rtx next_insn = next_nonnote_insn (cur_insn);
7548+ if ((next_insn != NULL_RTX)
7549+ && (INSN_P (next_insn))
7550+ && (GET_CODE (PATTERN (next_insn)) == SET)
7551+ && (GET_CODE (SET_SRC (PATTERN (next_insn))) == IF_THEN_ELSE))
7552+ {
7553+ /* Branch instructions */
7554+ XEXP (SET_SRC (PATTERN (next_insn)), 0) = new_cond;
7555+ /* Force the instruction to be recognized again */
7556+ INSN_CODE (next_insn) = -1;
7557+ return TRUE;
7558+ }
7559+ else if ((next_insn != NULL_RTX)
7560+ && (INSN_P (next_insn))
7561+ && (GET_CODE (PATTERN (next_insn)) == SET)
7562+ && comparison_operator (SET_SRC (PATTERN (next_insn)),
7563+ GET_MODE (SET_SRC (PATTERN (next_insn)))))
7564+ {
7565+ /* scc with no compare */
7566+ SET_SRC (PATTERN (next_insn)) = new_cond;
7567+ /* Force the instruction to be recognized again */
7568+ INSN_CODE (next_insn) = -1;
7569+ return TRUE;
7570+ }
7571+
7572+ return FALSE;
7573+}
7574+
7575+/* Function for obtaining the condition for the next instruction
7576+ after cur_insn.
7577+*/
7578+rtx
7579+get_next_insn_cond (rtx cur_insn)
7580+{
7581+ rtx next_insn = next_nonnote_insn (cur_insn);
7582+ rtx cond = NULL_RTX;
7583+ if ((next_insn != NULL_RTX)
7584+ && (INSN_P (next_insn))
7585+ && (GET_CODE (PATTERN (next_insn)) == SET)
7586+ && (GET_CODE (SET_SRC (PATTERN (next_insn))) == IF_THEN_ELSE))
7587+ {
7588+ /* Branch instructions */
7589+ cond = XEXP (SET_SRC (PATTERN (next_insn)), 0);
7590+ }
7591+ else if ((next_insn != NULL_RTX)
7592+ && (INSN_P (next_insn))
7593+ && (GET_CODE (PATTERN (next_insn)) == SET)
7594+ && comparison_operator (SET_SRC (PATTERN (next_insn)),
7595+ GET_MODE (SET_SRC (PATTERN (next_insn)))))
7596+ {
7597+ /* scc with no compare */
7598+ cond = SET_SRC (PATTERN (next_insn));
7599+ }
7600+
7601+ return cond;
7602+}
7603+
7604+int
7605+avr32_expand_scc (enum rtx_code cond, rtx * operands)
7606+{
7607+
7608+ rtx comparation;
7609+ /* Only allow certain compare operations */
7610+ if (GET_MODE (avr32_compare_op0) != DImode
7611+ && GET_MODE (avr32_compare_op0) != SImode
7612+ && GET_MODE (avr32_compare_op0) != HImode
7613+ && GET_MODE (avr32_compare_op0) != QImode)
7614+ return FALSE;
7615+
7616+ /* Delete compare instruction as it is merged into this instruction */
7617+ remove_insn (get_last_insn_anywhere ());
7618+
7619+ if (!REG_P (avr32_compare_op0))
7620+ avr32_compare_op0 =
7621+ force_reg (GET_MODE (avr32_compare_op0), avr32_compare_op0);
7622+
7623+ if (GET_MODE (avr32_compare_op0) != SImode && !REG_P (avr32_compare_op1))
7624+ {
7625+ avr32_compare_op1 =
7626+ force_reg (GET_MODE (avr32_compare_op0), avr32_compare_op1);
7627+ }
7628+ else if (GET_MODE (avr32_compare_op0) == SImode
7629+ && !REG_P (avr32_compare_op1)
7630+ && (GET_CODE (avr32_compare_op1) != CONST_INT
7631+ || (GET_CODE (avr32_compare_op1) == CONST_INT
7632+ &&
7633+ !avr32_const_ok_for_constraint_p (INTVAL
7634+ (avr32_compare_op1), 'K',
7635+ "Ks21"))))
7636+ avr32_compare_op1 =
7637+ force_reg (GET_MODE (avr32_compare_op0), avr32_compare_op1);
7638+
7639+
7640+ comparation =
7641+ gen_rtx_EQ (SImode,
7642+ gen_rtx_COMPARE (GET_MODE (avr32_compare_op0),
7643+ avr32_compare_op0, avr32_compare_op1),
7644+ const0_rtx);
7645+ /* Set correct condition */
7646+ PUT_CODE (comparation, cond);
7647+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], comparation));
7648+ return TRUE;
7649+}
7650+
7651+rtx
7652+avr32_output_cmp (rtx cond, enum machine_mode mode, rtx op0, rtx op1)
7653+{
7654+
7655+ rtx new_cond = NULL_RTX;
7656+ rtx ops[2];
7657+ rtx compare_pattern;
7658+ ops[0] = op0;
7659+ ops[1] = op1;
7660+
7661+ compare_pattern = gen_rtx_COMPARE (mode, op0, op1);
7662+
7663+ new_cond = is_compare_redundant (compare_pattern, cond);
7664+
7665+ if (new_cond != NULL_RTX)
7666+ return new_cond;
7667+
7668+ /* Insert compare */
7669+ switch (mode)
7670+ {
7671+ case QImode:
7672+ output_asm_insn ("cp.b\t%0, %1", ops);
7673+ break;
7674+ case HImode:
7675+ output_asm_insn ("cp.h\t%0, %1", ops);
7676+ break;
7677+ case SImode:
7678+ output_asm_insn ("cp.w\t%0, %1", ops);
7679+ break;
7680+ case DImode:
7681+ if (rtx_equal_p (op1, const0_rtx))
7682+ output_asm_insn ("cp.w\t%0, %1\ncpc\t%m0", ops);
7683+ else
7684+ output_asm_insn ("cp.w\t%0, %1\ncpc\t%m0, %m1", ops);
7685+ break;
7686+ default:
7687+ internal_error ("Unknown comparison mode");
7688+ break;
7689+ }
7690+
7691+ return cond;
7692+}
7693+
7694+int
7695+avr32_load_multiple_operation (rtx op,
7696+ enum machine_mode mode ATTRIBUTE_UNUSED)
7697+{
7698+ int count = XVECLEN (op, 0);
7699+ unsigned int dest_regno;
7700+ rtx src_addr;
7701+ rtx elt;
7702+ int i = 1, base = 0;
7703+
7704+ if (count <= 1 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
7705+ return 0;
7706+
7707+ /* Check to see if this might be a write-back. */
7708+ if (GET_CODE (SET_SRC (elt = XVECEXP (op, 0, 0))) == PLUS)
7709+ {
7710+ i++;
7711+ base = 1;
7712+
7713+ /* Now check it more carefully. */
7714+ if (GET_CODE (SET_DEST (elt)) != REG
7715+ || GET_CODE (XEXP (SET_SRC (elt), 0)) != REG
7716+ || GET_CODE (XEXP (SET_SRC (elt), 1)) != CONST_INT
7717+ || INTVAL (XEXP (SET_SRC (elt), 1)) != (count - 1) * 4)
7718+ return 0;
7719+ }
7720+
7721+ /* Perform a quick check so we don't blow up below. */
7722+ if (count <= 1
7723+ || GET_CODE (XVECEXP (op, 0, i - 1)) != SET
7724+ || GET_CODE (SET_DEST (XVECEXP (op, 0, i - 1))) != REG
7725+ || GET_CODE (SET_SRC (XVECEXP (op, 0, i - 1))) != UNSPEC)
7726+ return 0;
7727+
7728+ dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, i - 1)));
7729+ src_addr = XEXP (SET_SRC (XVECEXP (op, 0, i - 1)), 0);
7730+
7731+ for (; i < count; i++)
7732+ {
7733+ elt = XVECEXP (op, 0, i);
7734+
7735+ if (GET_CODE (elt) != SET
7736+ || GET_CODE (SET_DEST (elt)) != REG
7737+ || GET_MODE (SET_DEST (elt)) != SImode
7738+ || GET_CODE (SET_SRC (elt)) != UNSPEC)
7739+ return 0;
7740+ }
7741+
7742+ return 1;
7743+}
7744+
7745+int
7746+avr32_store_multiple_operation (rtx op,
7747+ enum machine_mode mode ATTRIBUTE_UNUSED)
7748+{
7749+ int count = XVECLEN (op, 0);
7750+ int src_regno;
7751+ rtx dest_addr;
7752+ rtx elt;
7753+ int i = 1;
7754+
7755+ if (count <= 1 || GET_CODE (XVECEXP (op, 0, 0)) != SET)
7756+ return 0;
7757+
7758+ /* Perform a quick check so we don't blow up below. */
7759+ if (count <= i
7760+ || GET_CODE (XVECEXP (op, 0, i - 1)) != SET
7761+ || GET_CODE (SET_DEST (XVECEXP (op, 0, i - 1))) != MEM
7762+ || GET_CODE (SET_SRC (XVECEXP (op, 0, i - 1))) != UNSPEC)
7763+ return 0;
7764+
7765+ src_regno = REGNO (SET_SRC (XVECEXP (op, 0, i - 1)));
7766+ dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, i - 1)), 0);
7767+
7768+ for (; i < count; i++)
7769+ {
7770+ elt = XVECEXP (op, 0, i);
7771+
7772+ if (GET_CODE (elt) != SET
7773+ || GET_CODE (SET_DEST (elt)) != MEM
7774+ || GET_MODE (SET_DEST (elt)) != SImode
7775+ || GET_CODE (SET_SRC (elt)) != UNSPEC)
7776+ return 0;
7777+ }
7778+
7779+ return 1;
7780+}
7781+
7782+int
7783+avr32_valid_macmac_bypass (rtx insn_out, rtx insn_in)
7784+{
7785+ /* Check if they use the same accumulator */
7786+ if (rtx_equal_p
7787+ (SET_DEST (PATTERN (insn_out)), SET_DEST (PATTERN (insn_in))))
7788+ {
7789+ return TRUE;
7790+ }
7791+
7792+ return FALSE;
7793+}
7794+
7795+int
7796+avr32_valid_mulmac_bypass (rtx insn_out, rtx insn_in)
7797+{
7798+ /*
7799+ Check if the mul instruction produces the accumulator for the mac
7800+ instruction. */
7801+ if (rtx_equal_p
7802+ (SET_DEST (PATTERN (insn_out)), SET_DEST (PATTERN (insn_in))))
7803+ {
7804+ return TRUE;
7805+ }
7806+ return FALSE;
7807+}
7808+
7809+int
7810+avr32_store_bypass (rtx insn_out, rtx insn_in)
7811+{
7812+ /* Only valid bypass if the output result is used as an src in the store
7813+ instruction, NOT if used as a pointer or base. */
7814+ if (rtx_equal_p
7815+ (SET_DEST (PATTERN (insn_out)), SET_SRC (PATTERN (insn_in))))
7816+ {
7817+ return TRUE;
7818+ }
7819+
7820+ return FALSE;
7821+}
7822+
7823+int
7824+avr32_mul_waw_bypass (rtx insn_out, rtx insn_in)
7825+{
7826+ /* Check if the register holding the result from the mul instruction is
7827+ used as a result register in the input instruction. */
7828+ if (rtx_equal_p
7829+ (SET_DEST (PATTERN (insn_out)), SET_DEST (PATTERN (insn_in))))
7830+ {
7831+ return TRUE;
7832+ }
7833+
7834+ return FALSE;
7835+}
7836+
7837+int
7838+avr32_valid_load_double_bypass (rtx insn_out, rtx insn_in)
7839+{
7840+ /* Check if the first loaded word in insn_out is used in insn_in. */
7841+ rtx dst_reg;
7842+ rtx second_loaded_reg;
7843+
7844+ /* If this is a double alu operation then the bypass is not valid */
7845+ if ((get_attr_type (insn_in) == TYPE_ALU
7846+ || get_attr_type (insn_in) == TYPE_ALU2)
7847+ && (GET_MODE_SIZE (GET_MODE (SET_DEST (PATTERN (insn_out)))) > 4))
7848+ return FALSE;
7849+
7850+ /* Get the destination register in the load */
7851+ if (!REG_P (SET_DEST (PATTERN (insn_out))))
7852+ return FALSE;
7853+
7854+ dst_reg = SET_DEST (PATTERN (insn_out));
7855+ second_loaded_reg = gen_rtx_REG (SImode, REGNO (dst_reg) + 1);
7856+
7857+ if (!reg_mentioned_p (second_loaded_reg, PATTERN (insn_in)))
7858+ return TRUE;
7859+
7860+ return FALSE;
7861+}
7862+
7863+
7864+int
7865+avr32_valid_load_quad_bypass (rtx insn_out, rtx insn_in)
7866+{
7867+ /*
7868+ Check if the two first loaded word in insn_out are used in insn_in. */
7869+ rtx dst_reg;
7870+ rtx third_loaded_reg, fourth_loaded_reg;
7871+
7872+ /* Get the destination register in the load */
7873+ if (!REG_P (SET_DEST (PATTERN (insn_out))))
7874+ return FALSE;
7875+
7876+ dst_reg = SET_DEST (PATTERN (insn_out));
7877+ third_loaded_reg = gen_rtx_REG (SImode, REGNO (dst_reg) + 2);
7878+ fourth_loaded_reg = gen_rtx_REG (SImode, REGNO (dst_reg) + 3);
7879+
7880+ if (!reg_mentioned_p (third_loaded_reg, PATTERN (insn_in))
7881+ && !reg_mentioned_p (fourth_loaded_reg, PATTERN (insn_in)))
7882+ {
7883+ return TRUE;
7884+ }
7885+
7886+ return FALSE;
7887+}
7888+
7889+int
7890+avr32_sched_use_dfa_pipeline_interface (void)
7891+{
7892+ /* No need to scedule on avr32_uc architecture. */
7893+ return (avr32_arch->arch_type != ARCH_TYPE_AVR32_UC);
7894+}
7895+
7896+void
7897+avr32_select_rtx_section (enum machine_mode mode ATTRIBUTE_UNUSED,
7898+ rtx x ATTRIBUTE_UNUSED,
7899+ unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
7900+{
7901+ /* Let ASM_OUTPUT_POOL_PROLOGUE take care of this */
7902+}
7903+
7904+/* Set up library functions to comply to AVR32 ABI */
7905+
7906+static void
7907+avr32_init_libfuncs (void)
7908+{
7909+ /* Convert gcc run-time function names to AVR32 ABI names */
7910+
7911+ /* Double-precision floating-point arithmetic. */
7912+ set_optab_libfunc (add_optab, DFmode, "__avr32_f64_add");
7913+ set_optab_libfunc (sdiv_optab, DFmode, "__avr32_f64_div");
7914+ set_optab_libfunc (smul_optab, DFmode, "__avr32_f64_mul");
7915+ set_optab_libfunc (neg_optab, DFmode, NULL);
7916+ set_optab_libfunc (sub_optab, DFmode, "__avr32_f64_sub");
7917+
7918+ /* Double-precision comparisons. */
7919+ set_optab_libfunc (eq_optab, DFmode, "__avr32_f64_cmp_eq");
7920+ set_optab_libfunc (ne_optab, DFmode, NULL);
7921+ set_optab_libfunc (lt_optab, DFmode, "__avr32_f64_cmp_lt");
7922+ set_optab_libfunc (le_optab, DFmode, NULL);
7923+ set_optab_libfunc (ge_optab, DFmode, "__avr32_f64_cmp_ge");
7924+ set_optab_libfunc (gt_optab, DFmode, NULL);
7925+
7926+ /* Single-precision floating-point arithmetic. */
7927+ set_optab_libfunc (add_optab, SFmode, "__avr32_f32_add");
7928+ set_optab_libfunc (sdiv_optab, SFmode, "__avr32_f32_div");
7929+ set_optab_libfunc (smul_optab, SFmode, "__avr32_f32_mul");
7930+ set_optab_libfunc (neg_optab, SFmode, NULL);
7931+ set_optab_libfunc (sub_optab, SFmode, "__avr32_f32_sub");
7932+
7933+ /* Single-precision comparisons. */
7934+ set_optab_libfunc (eq_optab, SFmode, "__avr32_f32_cmp_eq");
7935+ set_optab_libfunc (ne_optab, SFmode, NULL);
7936+ set_optab_libfunc (lt_optab, SFmode, "__avr32_f32_cmp_lt");
7937+ set_optab_libfunc (le_optab, SFmode, NULL);
7938+ set_optab_libfunc (ge_optab, SFmode, "__avr32_f32_cmp_ge");
7939+ set_optab_libfunc (gt_optab, SFmode, NULL);
7940+
7941+ /* Floating-point to integer conversions. */
7942+ set_conv_libfunc (sfix_optab, SImode, DFmode, "__avr32_f64_to_s32");
7943+ set_conv_libfunc (ufix_optab, SImode, DFmode, "__avr32_f64_to_u32");
7944+ set_conv_libfunc (sfix_optab, DImode, DFmode, "__avr32_f64_to_s64");
7945+ set_conv_libfunc (ufix_optab, DImode, DFmode, "__avr32_f64_to_u64");
7946+ set_conv_libfunc (sfix_optab, SImode, SFmode, "__avr32_f32_to_s32");
7947+ set_conv_libfunc (ufix_optab, SImode, SFmode, "__avr32_f32_to_u32");
7948+ set_conv_libfunc (sfix_optab, DImode, SFmode, "__avr32_f32_to_s64");
7949+ set_conv_libfunc (ufix_optab, DImode, SFmode, "__avr32_f32_to_u64");
7950+
7951+ /* Conversions between floating types. */
7952+ set_conv_libfunc (trunc_optab, SFmode, DFmode, "__avr32_f64_to_f32");
7953+ set_conv_libfunc (sext_optab, DFmode, SFmode, "__avr32_f32_to_f64");
7954+
7955+ /* Integer to floating-point conversions. Table 8. */
7956+ set_conv_libfunc (sfloat_optab, DFmode, SImode, "__avr32_s32_to_f64");
7957+ set_conv_libfunc (sfloat_optab, DFmode, DImode, "__avr32_s64_to_f64");
7958+ set_conv_libfunc (sfloat_optab, SFmode, SImode, "__avr32_s32_to_f32");
7959+ set_conv_libfunc (sfloat_optab, SFmode, DImode, "__avr32_s64_to_f32");
7960+ set_conv_libfunc (ufloat_optab, DFmode, SImode, "__avr32_u32_to_f64");
7961+ set_conv_libfunc (ufloat_optab, SFmode, SImode, "__avr32_u32_to_f32");
7962+ /* TODO: Add these to gcc library functions */
7963+
7964+ set_conv_libfunc (ufloat_optab, DFmode, DImode, NULL);
7965+ set_conv_libfunc (ufloat_optab, SFmode, DImode, NULL);
7966+
7967+ /* Long long. Table 9. */
7968+ set_optab_libfunc (smul_optab, DImode, "__avr32_mul64");
7969+ set_optab_libfunc (sdiv_optab, DImode, "__avr32_sdiv64");
7970+ set_optab_libfunc (udiv_optab, DImode, "__avr32_udiv64");
7971+ set_optab_libfunc (smod_optab, DImode, "__avr32_smod64");
7972+ set_optab_libfunc (umod_optab, DImode, "__avr32_umod64");
7973+ set_optab_libfunc (ashl_optab, DImode, "__avr32_lsl64");
7974+ set_optab_libfunc (lshr_optab, DImode, "__avr32_lsr64");
7975+ set_optab_libfunc (ashr_optab, DImode, "__avr32_asr64");
7976+}
7977diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/avr32-elf.h gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32-elf.h
7978--- gcc-4.0.2/gcc/config/avr32/avr32-elf.h 1970-01-01 01:00:00.000000000 +0100
7979+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32-elf.h 2006-11-17 10:38:10.000000000 +0100
7980@@ -0,0 +1,82 @@
7981+/*
7982+ Elf specific definitions.
7983+ Copyright 2003-2006 Atmel Corporation.
7984+
7985+ Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
7986+
7987+ This file is part of GCC.
7988+
7989+ This program is free software; you can redistribute it and/or modify
7990+ it under the terms of the GNU General Public License as published by
7991+ the Free Software Foundation; either version 2 of the License, or
7992+ (at your option) any later version.
7993+
7994+ This program is distributed in the hope that it will be useful,
7995+ but WITHOUT ANY WARRANTY; without even the implied warranty of
7996+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7997+ GNU General Public License for more details.
7998+
7999+ You should have received a copy of the GNU General Public License
8000+ along with this program; if not, write to the Free Software
8001+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
8002+
8003+
8004+/*****************************************************************************
8005+ * Controlling the Compilator Driver, 'gcc'
8006+ *****************************************************************************/
8007+
8008+/* Run-time Target Specification. */
8009+#undef TARGET_VERSION
8010+#define TARGET_VERSION fputs (" (AVR32 GNU with ELF)", stderr);
8011+
8012+/*
8013+Another C string constant used much like LINK_SPEC. The
8014+difference between the two is that STARTFILE_SPEC is used at
8015+the very beginning of the command given to the linker.
8016+
8017+If this macro is not defined, a default is provided that loads the
8018+standard C startup file from the usual place. See gcc.c.
8019+*/
8020+#undef STARTFILE_SPEC
8021+#define STARTFILE_SPEC "crt0%O%s crti%O%s crtbegin%O%s"
8022+
8023+#undef LINK_SPEC
8024+#define LINK_SPEC "%{muse-oscall:--defsym __do_not_use_oscall_coproc__=0} %{mrelax|O*:%{mno-relax|O0|O1: ;:--relax}} %{mpart=*:-mavr32elf_%*} %{mcpu=*:-mavr32elf_%*}"
8025+
8026+
8027+/*
8028+Another C string constant used much like LINK_SPEC. The
8029+difference between the two is that ENDFILE_SPEC is used at
8030+the very end of the command given to the linker.
8031+
8032+Do not define this macro if it does not need to do anything.
8033+*/
8034+#undef ENDFILE_SPEC
8035+#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
8036+
8037+
8038+/* Target CPU builtins. */
8039+#define TARGET_CPU_CPP_BUILTINS() \
8040+ do \
8041+ { \
8042+ builtin_define ("__avr32__"); \
8043+ builtin_define ("__AVR32__"); \
8044+ builtin_define ("__AVR32_ELF__"); \
8045+ builtin_define (avr32_part->macro); \
8046+ builtin_define (avr32_arch->macro); \
8047+ if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A) \
8048+ builtin_define ("__AVR32_AVR32A__"); \
8049+ else \
8050+ builtin_define ("__AVR32_AVR32B__"); \
8051+ if (TARGET_UNALIGNED_WORD) \
8052+ builtin_define ("__AVR32_HAS_UNALIGNED_WORD__"); \
8053+ if (TARGET_SIMD) \
8054+ builtin_define ("__AVR32_HAS_SIMD__"); \
8055+ if (TARGET_DSP) \
8056+ builtin_define ("__AVR32_HAS_DSP__"); \
8057+ if (TARGET_RMW) \
8058+ builtin_define ("__AVR32_HAS_RMW__"); \
8059+ if (TARGET_BRANCH_PRED) \
8060+ builtin_define ("__AVR32_HAS_BRANCH_PRED__"); \
8061+ } \
8062+ while (0)
8063diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/avr32.h gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32.h
8064--- gcc-4.0.2/gcc/config/avr32/avr32.h 1970-01-01 01:00:00.000000000 +0100
8065+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32.h 2006-11-10 15:14:06.000000000 +0100
8066@@ -0,0 +1,3374 @@
8067+/*
8068+ Definitions of target machine for AVR32.
8069+ Copyright 2003-2006 Atmel Corporation.
8070+
8071+ Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
8072+ Initial porting by Anders Ådland.
8073+
8074+ This file is part of GCC.
8075+
8076+ This program is free software; you can redistribute it and/or modify
8077+ it under the terms of the GNU General Public License as published by
8078+ the Free Software Foundation; either version 2 of the License, or
8079+ (at your option) any later version.
8080+
8081+ This program is distributed in the hope that it will be useful,
8082+ but WITHOUT ANY WARRANTY; without even the implied warranty of
8083+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8084+ GNU General Public License for more details.
8085+
8086+ You should have received a copy of the GNU General Public License
8087+ along with this program; if not, write to the Free Software
8088+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
8089+
8090+#ifndef GCC_AVR32_H
8091+#define GCC_AVR32_H
8092+
8093+
8094+#ifndef OBJECT_FORMAT_ELF
8095+#error avr32.h included before elfos.h
8096+#endif
8097+
8098+#ifndef LOCAL_LABEL_PREFIX
8099+#define LOCAL_LABEL_PREFIX "."
8100+#endif
8101+
8102+#ifndef SUBTARGET_CPP_SPEC
8103+#define SUBTARGET_CPP_SPEC "-D__ELF__"
8104+#endif
8105+
8106+
8107+extern struct rtx_def *avr32_compare_op0;
8108+extern struct rtx_def *avr32_compare_op1;
8109+
8110+
8111+extern struct rtx_def *avr32_acc_cache;
8112+
8113+/* cache instruction op5 codes */
8114+#define AVR32_CACHE_INVALIDATE_ICACHE 1
8115+
8116+/* These bits describe the different types of function supported
8117+ by the AVR32 backend. They are exclusive. ie a function cannot be both a
8118+ normal function and an interworked function, for example. Knowing the
8119+ type of a function is important for determining its prologue and
8120+ epilogue sequences.
8121+ Note value 7 is currently unassigned. Also note that the interrupt
8122+ function types all have bit 2 set, so that they can be tested for easily.
8123+ Note that 0 is deliberately chosen for AVR32_FT_UNKNOWN so that when the
8124+ machine_function structure is initialized (to zero) func_type will
8125+ default to unknown. This will force the first use of avr32_current_func_type
8126+ to call avr32_compute_func_type. */
8127+#define AVR32_FT_UNKNOWN 0 /* Type has not yet been determined.
8128+ */
8129+#define AVR32_FT_NORMAL 1 /* Your normal, straightforward
8130+ function. */
8131+#define AVR32_FT_ACALL 2 /* An acall function. */
8132+#define AVR32_FT_EXCEPTION_HANDLER 3 /* A C++ exception handler. */
8133+#define AVR32_FT_ISR_FULL 4 /* A fully shadowed interrupt mode. */
8134+#define AVR32_FT_ISR_HALF 5 /* A half shadowed interrupt mode. */
8135+#define AVR32_FT_ISR_NONE 6 /* No shadow registers. */
8136+
8137+#define AVR32_FT_TYPE_MASK ((1 << 3) - 1)
8138+
8139+/* In addition functions can have several type modifiers,
8140+ outlined by these bit masks: */
8141+#define AVR32_FT_INTERRUPT (1 << 2) /* Note overlap with FT_ISR
8142+ and above. */
8143+#define AVR32_FT_NAKED (1 << 3) /* No prologue or epilogue. */
8144+#define AVR32_FT_VOLATILE (1 << 4) /* Does not return. */
8145+#define AVR32_FT_NESTED (1 << 5) /* Embedded inside another
8146+ func. */
8147+
8148+/* Some macros to test these flags. */
8149+#define AVR32_FUNC_TYPE(t) (t & AVR32_FT_TYPE_MASK)
8150+#define IS_INTERRUPT(t) (t & AVR32_FT_INTERRUPT)
8151+#define IS_VOLATILE(t) (t & AVR32_FT_VOLATILE)
8152+#define IS_NAKED(t) (t & AVR32_FT_NAKED)
8153+#define IS_NESTED(t) (t & AVR32_FT_NESTED)
8154+
8155+
8156+typedef struct minipool_labels
8157+GTY ((chain_next ("%h.next"), chain_prev ("%h.prev")))
8158+{
8159+ rtx label;
8160+ struct minipool_labels *prev;
8161+ struct minipool_labels *next;
8162+} minipool_labels;
8163+
8164+/* A C structure for machine-specific, per-function data.
8165+ This is added to the cfun structure. */
8166+
8167+typedef struct machine_function
8168+GTY (())
8169+{
8170+ /* Records the type of the current function. */
8171+ unsigned long func_type;
8172+ /* List of minipool labels, use for checking if code label is valid in a
8173+ memory expression */
8174+ minipool_labels *minipool_label_head;
8175+ minipool_labels *minipool_label_tail;
8176+} machine_function;
8177+
8178+/* Initialize data used by insn expanders. This is called from insn_emit,
8179+ once for every function before code is generated. */
8180+#define INIT_EXPANDERS avr32_init_expanders ()
8181+
8182+/******************************************************************************
8183+ * SPECS
8184+ *****************************************************************************/
8185+
8186+#ifndef ASM_SPEC
8187+#define ASM_SPEC "%{fpic:--pic} %{mrelax|O*:%{mno-relax|O0|O1: ;:--linkrelax}} %{march=*:-march=%*} %{mpart=*:-mpart=%*}"
8188+#endif
8189+
8190+#ifndef MULTILIB_DEFAULTS
8191+#define MULTILIB_DEFAULTS { "march=ap" }
8192+#endif
8193+
8194+
8195+/******************************************************************************
8196+ * Run-time Target Specification
8197+ *****************************************************************************/
8198+extern int target_flags;
8199+
8200+/* Part types. Keep this in sync with the order of avr32_part_types in avr32.c*/
8201+enum part_type
8202+{
8203+ PART_TYPE_AVR32_NONE,
8204+ PART_TYPE_AVR32_AP7000,
8205+ PART_TYPE_AVR32_AP7010,
8206+ PART_TYPE_AVR32_AP7020,
8207+ PART_TYPE_AVR32_UC3A0256,
8208+ PART_TYPE_AVR32_UC3A0512,
8209+ PART_TYPE_AVR32_UC3A1128,
8210+ PART_TYPE_AVR32_UC3A1256,
8211+ PART_TYPE_AVR32_UC3A1512
8212+};
8213+
8214+/* Microarchitectures. */
8215+enum microarchitecture_type
8216+{
8217+ UARCH_TYPE_AVR32A,
8218+ UARCH_TYPE_AVR32B
8219+};
8220+
8221+/* Architectures types which specifies the pipeline.
8222+ Keep this in sync with avr32_arch_types in avr32.c*/
8223+enum architecture_type
8224+{
8225+ ARCH_TYPE_AVR32_AP,
8226+ ARCH_TYPE_AVR32_UC
8227+};
8228+
8229+/* Flag specifying if the cpu has support for DSP instructions.*/
8230+#define FLAG_AVR32_HAS_DSP (1 << 0)
8231+/* Flag specifying if the cpu has support for Read-Modify-Write
8232+ instructions.*/
8233+#define FLAG_AVR32_HAS_RMW (1 << 1)
8234+/* Flag specifying if the cpu has support for SIMD instructions. */
8235+#define FLAG_AVR32_HAS_SIMD (1 << 2)
8236+/* Flag specifying if the cpu has support for unaligned memory word access. */
8237+#define FLAG_AVR32_HAS_UNALIGNED_WORD (1 << 3)
8238+/* Flag specifying if the cpu has support for branch prediction. */
8239+#define FLAG_AVR32_HAS_BRANCH_PRED (1 << 4)
8240+
8241+/* Structure for holding information about different avr32 CPUs/parts */
8242+struct part_type_s
8243+{
8244+ const char *const name;
8245+ enum part_type part_type;
8246+ enum architecture_type arch_type;
8247+ /* Must lie outside user's namespace. NULL == no macro. */
8248+ const char *const macro;
8249+};
8250+
8251+/* Structure for holding information about different avr32 pipeline
8252+ architectures. */
8253+struct arch_type_s
8254+{
8255+ const char *const name;
8256+ enum architecture_type arch_type;
8257+ enum microarchitecture_type uarch_type;
8258+ const unsigned long feature_flags;
8259+ /* Must lie outside user's namespace. NULL == no macro. */
8260+ const char *const macro;
8261+};
8262+
8263+extern const struct part_type_s *avr32_part;
8264+extern const struct arch_type_s *avr32_arch;
8265+
8266+#define USE_RODATA_SECTION (1 << 0)
8267+#define AVR32_FLAG_HARD_FLOAT (1 << 1)
8268+#define AVR32_FLAG_FORCE_DOUBLE_ALIGN (1 << 2)
8269+#define AVR32_FLAG_RELAX (1 << 4)
8270+#define AVR32_FLAG_NO_INIT_GOT (1 << 5)
8271+#define AVR32_FLAG_NO_REORG_OPT (1 << 6)
8272+#define AVR32_FLAG_NO_ASM_ADDR_PSEUDOS (1 << 7)
8273+#define AVR32_FLAG_NO_PIC (1 << 8)
8274+
8275+#define TARGET_HARD_FLOAT (target_flags & AVR32_FLAG_HARD_FLOAT)
8276+#define TARGET_SOFT_FLOAT (!TARGET_HARD_FLOAT)
8277+#define TARGET_FORCE_DOUBLE_ALIGN (target_flags & AVR32_FLAG_FORCE_DOUBLE_ALIGN)
8278+#define TARGET_RELAX (target_flags & AVR32_FLAG_RELAX)
8279+#define TARGET_NO_INIT_GOT (target_flags & AVR32_FLAG_NO_INIT_GOT)
8280+#define TARGET_MD_REORG_OPTIMIZATION (!(target_flags & AVR32_FLAG_NO_REORG_OPT))
8281+#define TARGET_HAS_ASM_ADDR_PSEUDOS (!(target_flags & AVR32_FLAG_NO_ASM_ADDR_PSEUDOS))
8282+
8283+#define TARGET_SIMD (avr32_arch->feature_flags & FLAG_AVR32_HAS_SIMD)
8284+#define TARGET_DSP (avr32_arch->feature_flags & FLAG_AVR32_HAS_DSP)
8285+#define TARGET_RMW (avr32_arch->feature_flags & FLAG_AVR32_HAS_RMW)
8286+#define TARGET_UNALIGNED_WORD (avr32_arch->feature_flags & FLAG_AVR32_HAS_UNALIGNED_WORD)
8287+#define TARGET_BRANCH_PRED (avr32_arch->feature_flags & FLAG_AVR32_HAS_BRANCH_PRED)
8288+
8289+
8290+#define TARGET_SWITCHES { \
8291+ { "use-rodata-section", USE_RODATA_SECTION, \
8292+ N_("Do not put readonly-data in .text section, but in .rodata.") }, \
8293+ { "hard-float", AVR32_FLAG_HARD_FLOAT, \
8294+ N_("Use floating point coprocessor instructions.") }, \
8295+ { "soft-float", -AVR32_FLAG_HARD_FLOAT, \
8296+ N_("Use software floating-point library for floating-point operations.") }, \
8297+ { "force-double-align", AVR32_FLAG_FORCE_DOUBLE_ALIGN, \
8298+ N_("Force double-word alignment for double-word memory accesses.") }, \
8299+ { "no-init-got", AVR32_FLAG_NO_INIT_GOT, \
8300+ N_("Do not initialize GOT register before using it when compiling PIC code.") }, \
8301+ { "relax", AVR32_FLAG_RELAX, \
8302+ N_("Let invoked assembler and linker do relaxing (Enabled by default when optimization level is >1).") }, \
8303+ { "no-relax", -AVR32_FLAG_RELAX, \
8304+ N_("Don't let invoked assembler and linker do relaxing.") }, \
8305+ { "no-reorg-opt", AVR32_FLAG_NO_REORG_OPT, \
8306+ N_("Do not perform machine dependent optimizations in reorg stage.") }, \
8307+ { "asm-addr-pseudos", -AVR32_FLAG_NO_ASM_ADDR_PSEUDOS, \
8308+ N_("Use assembler pseudo-instructions lda.w and call for handling direct addresses. (Enabled by default)") }, \
8309+ { "no-asm-addr-pseudos", AVR32_FLAG_NO_ASM_ADDR_PSEUDOS, \
8310+ N_("Do not use assembler pseudo-instructions lda.w and call for handling direct addresses.") }, \
8311+ { "no-pic", AVR32_FLAG_NO_PIC, \
8312+ N_("Do not emit position-independent code (will break dynamic linking.)") }, \
8313+ { "", 0, NULL } \
8314+}
8315+
8316+
8317+extern const char *avr32_part_name;
8318+extern const char *avr32_arch_name;
8319+
8320+#define TARGET_OPTIONS { \
8321+ { "part=", &avr32_part_name, N_("Specify the AVR32 part name"), 0}, \
8322+ { "cpu=", &avr32_part_name, N_("Specify the AVR32 part name (deprecated)"), 0}, \
8323+ { "arch=", &avr32_arch_name, N_("Specify the AVR32 architecture name"), 0} }
8324+
8325+#define CAN_DEBUG_WITHOUT_FP
8326+
8327+/******************************************************************************
8328+ * Storage Layout
8329+ *****************************************************************************/
8330+
8331+/*
8332+Define this macro to have the value 1 if the most significant bit in a
8333+byte has the lowest number; otherwise define it to have the value zero.
8334+This means that bit-field instructions count from the most significant
8335+bit. If the machine has no bit-field instructions, then this must still
8336+be defined, but it doesn't matter which value it is defined to. This
8337+macro need not be a constant.
8338+
8339+This macro does not affect the way structure fields are packed into
8340+bytes or words; that is controlled by BYTES_BIG_ENDIAN.
8341+*/
8342+#define BITS_BIG_ENDIAN 0
8343+
8344+/*
8345+Define this macro to have the value 1 if the most significant byte in a
8346+word has the lowest number. This macro need not be a constant.
8347+*/
8348+/*
8349+ Data is stored in an big-endian way.
8350+*/
8351+#define BYTES_BIG_ENDIAN 1
8352+
8353+/*
8354+Define this macro to have the value 1 if, in a multiword object, the
8355+most significant word has the lowest number. This applies to both
8356+memory locations and registers; GCC fundamentally assumes that the
8357+order of words in memory is the same as the order in registers. This
8358+macro need not be a constant.
8359+*/
8360+/*
8361+ Data is stored in an bin-endian way.
8362+*/
8363+#define WORDS_BIG_ENDIAN 1
8364+
8365+/*
8366+Define this macro if WORDS_BIG_ENDIAN is not constant. This must be a
8367+constant value with the same meaning as WORDS_BIG_ENDIAN, which will be
8368+used only when compiling libgcc2.c. Typically the value will be set
8369+based on preprocessor defines.
8370+*/
8371+#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
8372+
8373+/*
8374+Define this macro to have the value 1 if DFmode, XFmode or
8375+TFmode floating point numbers are stored in memory with the word
8376+containing the sign bit at the lowest address; otherwise define it to
8377+have the value 0. This macro need not be a constant.
8378+
8379+You need not define this macro if the ordering is the same as for
8380+multi-word integers.
8381+*/
8382+/* #define FLOAT_WORDS_BIG_ENDIAN 1 */
8383+
8384+/*
8385+Define this macro to be the number of bits in an addressable storage
8386+unit (byte); normally 8.
8387+*/
8388+#define BITS_PER_UNIT 8
8389+
8390+/*
8391+Number of bits in a word; normally 32.
8392+*/
8393+#define BITS_PER_WORD 32
8394+
8395+/*
8396+Maximum number of bits in a word. If this is undefined, the default is
8397+BITS_PER_WORD. Otherwise, it is the constant value that is the
8398+largest value that BITS_PER_WORD can have at run-time.
8399+*/
8400+/* MAX_BITS_PER_WORD not defined*/
8401+
8402+/*
8403+Number of storage units in a word; normally 4.
8404+*/
8405+#define UNITS_PER_WORD 4
8406+
8407+/*
8408+Minimum number of units in a word. If this is undefined, the default is
8409+UNITS_PER_WORD. Otherwise, it is the constant value that is the
8410+smallest value that UNITS_PER_WORD can have at run-time.
8411+*/
8412+/* MIN_UNITS_PER_WORD not defined */
8413+
8414+/*
8415+Width of a pointer, in bits. You must specify a value no wider than the
8416+width of Pmode. If it is not equal to the width of Pmode,
8417+you must define POINTERS_EXTEND_UNSIGNED.
8418+*/
8419+#define POINTER_SIZE 32
8420+
8421+/*
8422+A C expression whose value is greater than zero if pointers that need to be
8423+extended from being POINTER_SIZE bits wide to Pmode are to
8424+be zero-extended and zero if they are to be sign-extended. If the value
8425+is less then zero then there must be an "ptr_extend" instruction that
8426+extends a pointer from POINTER_SIZE to Pmode.
8427+
8428+You need not define this macro if the POINTER_SIZE is equal
8429+to the width of Pmode.
8430+*/
8431+/* #define POINTERS_EXTEND_UNSIGNED */
8432+
8433+/*
8434+A Macro to update M and UNSIGNEDP when an object whose type
8435+is TYPE and which has the specified mode and signedness is to be
8436+stored in a register. This macro is only called when TYPE is a
8437+scalar type.
8438+
8439+On most RISC machines, which only have operations that operate on a full
8440+register, define this macro to set M to word_mode if
8441+M is an integer mode narrower than BITS_PER_WORD. In most
8442+cases, only integer modes should be widened because wider-precision
8443+floating-point operations are usually more expensive than their narrower
8444+counterparts.
8445+
8446+For most machines, the macro definition does not change UNSIGNEDP.
8447+However, some machines, have instructions that preferentially handle
8448+either signed or unsigned quantities of certain modes. For example, on
8449+the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
8450+sign-extend the result to 64 bits. On such machines, set
8451+UNSIGNEDP according to which kind of extension is more efficient.
8452+
8453+Do not define this macro if it would never modify M.
8454+*/
8455+#define PROMOTE_MODE(M, UNSIGNEDP, TYPE) \
8456+ do \
8457+ { \
8458+ if (GET_MODE_CLASS (M) == MODE_INT \
8459+ && GET_MODE_SIZE (M) < 4) \
8460+ { \
8461+ (M) = SImode; \
8462+ } \
8463+ } \
8464+ while (0)
8465+
8466+/* Define if operations between registers always perform the operation
8467+ on the full register even if a narrower mode is specified. */
8468+#define WORD_REGISTER_OPERATIONS
8469+
8470+/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
8471+ will either zero-extend or sign-extend. The value of this macro should
8472+ be the code that says which one of the two operations is implicitly
8473+ done, UNKNOWN if not known. */
8474+#define LOAD_EXTEND_OP(MODE) \
8475+ (((MODE) == QImode) ? ZERO_EXTEND \
8476+ : ((MODE) == HImode) ? SIGN_EXTEND : UNKNOWN)
8477+
8478+
8479+/*
8480+Define this macro if the promotion described by PROMOTE_MODE
8481+should only be performed for outgoing function arguments or
8482+function return values, as specified by PROMOTE_FUNCTION_ARGS
8483+and PROMOTE_FUNCTION_RETURN, respectively.
8484+*/
8485+/* #define PROMOTE_FOR_CALL_ONLY */
8486+
8487+/*
8488+Normal alignment required for function parameters on the stack, in
8489+bits. All stack parameters receive at least this much alignment
8490+regardless of data type. On most machines, this is the same as the
8491+size of an integer.
8492+*/
8493+#define PARM_BOUNDARY 32
8494+
8495+/*
8496+Define this macro to the minimum alignment enforced by hardware for the
8497+stack pointer on this machine. The definition is a C expression for the
8498+desired alignment (measured in bits). This value is used as a default
8499+if PREFERRED_STACK_BOUNDARY is not defined. On most machines,
8500+this should be the same as PARM_BOUNDARY.
8501+*/
8502+#define STACK_BOUNDARY 32
8503+
8504+/*
8505+Define this macro if you wish to preserve a certain alignment for the
8506+stack pointer, greater than what the hardware enforces. The definition
8507+is a C expression for the desired alignment (measured in bits). This
8508+macro must evaluate to a value equal to or larger than
8509+STACK_BOUNDARY.
8510+*/
8511+#define PREFERRED_STACK_BOUNDARY (TARGET_FORCE_DOUBLE_ALIGN ? 64 : 32 )
8512+
8513+/*
8514+Alignment required for a function entry point, in bits.
8515+*/
8516+#define FUNCTION_BOUNDARY 16
8517+
8518+/*
8519+Biggest alignment that any data type can require on this machine, in bits.
8520+*/
8521+#define BIGGEST_ALIGNMENT (TARGET_FORCE_DOUBLE_ALIGN ? 64 : 32 )
8522+
8523+/*
8524+If defined, the smallest alignment, in bits, that can be given to an
8525+object that can be referenced in one operation, without disturbing any
8526+nearby object. Normally, this is BITS_PER_UNIT, but may be larger
8527+on machines that don't have byte or half-word store operations.
8528+*/
8529+#define MINIMUM_ATOMIC_ALIGNMENT BITS_PER_UNIT
8530+
8531+
8532+/*
8533+An integer expression for the size in bits of the largest integer machine mode that
8534+should actually be used. All integer machine modes of this size or smaller can be
8535+used for structures and unions with the appropriate sizes. If this macro is undefined,
8536+GET_MODE_BITSIZE (DImode) is assumed.*/
8537+#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
8538+
8539+
8540+/*
8541+If defined, a C expression to compute the alignment given to a constant
8542+that is being placed in memory. CONSTANT is the constant and
8543+BASIC_ALIGN is the alignment that the object would ordinarily
8544+have. The value of this macro is used instead of that alignment to
8545+align the object.
8546+
8547+If this macro is not defined, then BASIC_ALIGN is used.
8548+
8549+The typical use of this macro is to increase alignment for string
8550+constants to be word aligned so that strcpy calls that copy
8551+constants can be done inline.
8552+*/
8553+#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \
8554+ ((TREE_CODE(CONSTANT) == STRING_CST) ? BITS_PER_WORD : BASIC_ALIGN)
8555+
8556+/* Try to align string to a word. */
8557+#define DATA_ALIGNMENT(TYPE, ALIGN) \
8558+ ({(TREE_CODE (TYPE) == ARRAY_TYPE \
8559+ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
8560+ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN));})
8561+
8562+/* Try to align local store strings to a word. */
8563+#define LOCAL_ALIGNMENT(TYPE, ALIGN) \
8564+ ({(TREE_CODE (TYPE) == ARRAY_TYPE \
8565+ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
8566+ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN));})
8567+
8568+/*
8569+Define this macro to be the value 1 if instructions will fail to work
8570+if given data not on the nominal alignment. If instructions will merely
8571+go slower in that case, define this macro as 0.
8572+*/
8573+#define STRICT_ALIGNMENT 1
8574+
8575+/*
8576+Define this if you wish to imitate the way many other C compilers handle
8577+alignment of bit-fields and the structures that contain them.
8578+
8579+The behavior is that the type written for a bit-field (int,
8580+short, or other integer type) imposes an alignment for the
8581+entire structure, as if the structure really did contain an ordinary
8582+field of that type. In addition, the bit-field is placed within the
8583+structure so that it would fit within such a field, not crossing a
8584+boundary for it.
8585+
8586+Thus, on most machines, a bit-field whose type is written as int
8587+would not cross a four-byte boundary, and would force four-byte
8588+alignment for the whole structure. (The alignment used may not be four
8589+bytes; it is controlled by the other alignment parameters.)
8590+
8591+If the macro is defined, its definition should be a C expression;
8592+a nonzero value for the expression enables this behavior.
8593+
8594+Note that if this macro is not defined, or its value is zero, some
8595+bit-fields may cross more than one alignment boundary. The compiler can
8596+support such references if there are insv, extv, and
8597+extzv insns that can directly reference memory.
8598+
8599+The other known way of making bit-fields work is to define
8600+STRUCTURE_SIZE_BOUNDARY as large as BIGGEST_ALIGNMENT.
8601+Then every structure can be accessed with fullwords.
8602+
8603+Unless the machine has bit-field instructions or you define
8604+STRUCTURE_SIZE_BOUNDARY that way, you must define
8605+PCC_BITFIELD_TYPE_MATTERS to have a nonzero value.
8606+
8607+If your aim is to make GCC use the same conventions for laying out
8608+bit-fields as are used by another compiler, here is how to investigate
8609+what the other compiler does. Compile and run this program:
8610+
8611+struct foo1
8612+{
8613+ char x;
8614+ char :0;
8615+ char y;
8616+};
8617+
8618+struct foo2
8619+{
8620+ char x;
8621+ int :0;
8622+ char y;
8623+};
8624+
8625+main ()
8626+{
8627+ printf ("Size of foo1 is %d\n",
8628+ sizeof (struct foo1));
8629+ printf ("Size of foo2 is %d\n",
8630+ sizeof (struct foo2));
8631+ exit (0);
8632+}
8633+
8634+If this prints 2 and 5, then the compiler's behavior is what you would
8635+get from PCC_BITFIELD_TYPE_MATTERS.
8636+*/
8637+#define PCC_BITFIELD_TYPE_MATTERS 1
8638+
8639+
8640+/******************************************************************************
8641+ * Layout of Source Language Data Types
8642+ *****************************************************************************/
8643+
8644+/*
8645+A C expression for the size in bits of the type int on the
8646+target machine. If you don't define this, the default is one word.
8647+*/
8648+#define INT_TYPE_SIZE 32
8649+
8650+/*
8651+A C expression for the size in bits of the type short on the
8652+target machine. If you don't define this, the default is half a word. (If
8653+this would be less than one storage unit, it is rounded up to one unit.)
8654+*/
8655+#define SHORT_TYPE_SIZE 16
8656+
8657+/*
8658+A C expression for the size in bits of the type long on the
8659+target machine. If you don't define this, the default is one word.
8660+*/
8661+#define LONG_TYPE_SIZE 32
8662+
8663+
8664+/*
8665+A C expression for the size in bits of the type long long on the
8666+target machine. If you don't define this, the default is two
8667+words. If you want to support GNU Ada on your machine, the value of this
8668+macro must be at least 64.
8669+*/
8670+#define LONG_LONG_TYPE_SIZE 64
8671+
8672+/*
8673+A C expression for the size in bits of the type char on the
8674+target machine. If you don't define this, the default is
8675+BITS_PER_UNIT.
8676+*/
8677+#define CHAR_TYPE_SIZE 8
8678+
8679+
8680+/*
8681+A C expression for the size in bits of the C++ type bool and
8682+C99 type _Bool on the target machine. If you don't define
8683+this, and you probably shouldn't, the default is CHAR_TYPE_SIZE.
8684+*/
8685+#define BOOL_TYPE_SIZE 8
8686+
8687+
8688+/*
8689+An expression whose value is 1 or 0, according to whether the type
8690+char should be signed or unsigned by default. The user can
8691+always override this default with the options -fsigned-char
8692+and -funsigned-char.
8693+*/
8694+/* We are using unsigned char */
8695+#define DEFAULT_SIGNED_CHAR 0
8696+
8697+
8698+/*
8699+A C expression for a string describing the name of the data type to use
8700+for size values. The typedef name size_t is defined using the
8701+contents of the string.
8702+
8703+The string can contain more than one keyword. If so, separate them with
8704+spaces, and write first any length keyword, then unsigned if
8705+appropriate, and finally int. The string must exactly match one
8706+of the data type names defined in the function
8707+init_decl_processing in the file c-decl.c. You may not
8708+omit int or change the order - that would cause the compiler to
8709+crash on startup.
8710+
8711+If you don't define this macro, the default is "long unsigned int".
8712+*/
8713+#define SIZE_TYPE "long unsigned int"
8714+
8715+/*
8716+A C expression for a string describing the name of the data type to use
8717+for the result of subtracting two pointers. The typedef name
8718+ptrdiff_t is defined using the contents of the string. See
8719+SIZE_TYPE above for more information.
8720+
8721+If you don't define this macro, the default is "long int".
8722+*/
8723+#define PTRDIFF_TYPE "long int"
8724+
8725+
8726+/*
8727+A C expression for the size in bits of the data type for wide
8728+characters. This is used in cpp, which cannot make use of
8729+WCHAR_TYPE.
8730+*/
8731+#define WCHAR_TYPE_SIZE 32
8732+
8733+
8734+/*
8735+A C expression for a string describing the name of the data type to
8736+use for wide characters passed to printf and returned from
8737+getwc. The typedef name wint_t is defined using the
8738+contents of the string. See SIZE_TYPE above for more
8739+information.
8740+
8741+If you don't define this macro, the default is "unsigned int".
8742+*/
8743+#define WINT_TYPE "unsigned int"
8744+
8745+/*
8746+A C expression for a string describing the name of the data type that
8747+can represent any value of any standard or extended signed integer type.
8748+The typedef name intmax_t is defined using the contents of the
8749+string. See SIZE_TYPE above for more information.
8750+
8751+If you don't define this macro, the default is the first of
8752+"int", "long int", or "long long int" that has as
8753+much precision as long long int.
8754+*/
8755+#define INTMAX_TYPE "long long int"
8756+
8757+/*
8758+A C expression for a string describing the name of the data type that
8759+can represent any value of any standard or extended unsigned integer
8760+type. The typedef name uintmax_t is defined using the contents
8761+of the string. See SIZE_TYPE above for more information.
8762+
8763+If you don't define this macro, the default is the first of
8764+"unsigned int", "long unsigned int", or "long long unsigned int"
8765+that has as much precision as long long unsigned int.
8766+*/
8767+#define UINTMAX_TYPE "long long unsigned int"
8768+
8769+
8770+/******************************************************************************
8771+ * Register Usage
8772+ *****************************************************************************/
8773+
8774+/* Convert from gcc internal register number to register number
8775+ used in assembly code */
8776+#define ASM_REGNUM(reg) (LAST_REGNUM - (reg))
8777+#define ASM_FP_REGNUM(reg) (LAST_FP_REGNUM - (reg))
8778+
8779+/* Convert between register number used in assembly to gcc
8780+ internal register number */
8781+#define INTERNAL_REGNUM(reg) (LAST_REGNUM - (reg))
8782+#define INTERNAL_FP_REGNUM(reg) (LAST_FP_REGNUM - (reg))
8783+
8784+/** Basic Characteristics of Registers **/
8785+
8786+/*
8787+Number of hardware registers known to the compiler. They receive
8788+numbers 0 through FIRST_PSEUDO_REGISTER-1; thus, the first
8789+pseudo register's number really is assigned the number
8790+FIRST_PSEUDO_REGISTER.
8791+*/
8792+#define FIRST_PSEUDO_REGISTER (LAST_FP_REGNUM + 1)
8793+
8794+#define FIRST_REGNUM 0
8795+#define LAST_REGNUM 15
8796+#define NUM_FP_REGS 16
8797+#define FIRST_FP_REGNUM 16
8798+#define LAST_FP_REGNUM (16+NUM_FP_REGS-1)
8799+
8800+/*
8801+An initializer that says which registers are used for fixed purposes
8802+all throughout the compiled code and are therefore not available for
8803+general allocation. These would include the stack pointer, the frame
8804+pointer (except on machines where that can be used as a general
8805+register when no frame pointer is needed), the program counter on
8806+machines where that is considered one of the addressable registers,
8807+and any other numbered register with a standard use.
8808+
8809+This information is expressed as a sequence of numbers, separated by
8810+commas and surrounded by braces. The nth number is 1 if
8811+register n is fixed, 0 otherwise.
8812+
8813+The table initialized from this macro, and the table initialized by
8814+the following one, may be overridden at run time either automatically,
8815+by the actions of the macro CONDITIONAL_REGISTER_USAGE, or by
8816+the user with the command options -ffixed-[reg],
8817+-fcall-used-[reg] and -fcall-saved-[reg].
8818+*/
8819+
8820+/* The internal gcc register numbers are reversed
8821+ compared to the real register numbers since
8822+ gcc expects data types stored over multiple
8823+ registers in the register file to be big endian
8824+ if the memory layout is big endian. But this
8825+ is not the case for avr32 so we fake a big
8826+ endian register file. */
8827+
8828+#define FIXED_REGISTERS { \
8829+ 1, /* Program Counter */ \
8830+ 0, /* Link Register */ \
8831+ 1, /* Stack Pointer */ \
8832+ 0, /* r12 */ \
8833+ 0, /* r11 */ \
8834+ 0, /* r10 */ \
8835+ 0, /* r9 */ \
8836+ 0, /* r8 */ \
8837+ 0, /* r7 */ \
8838+ 0, /* r6 */ \
8839+ 0, /* r5 */ \
8840+ 0, /* r4 */ \
8841+ 0, /* r3 */ \
8842+ 0, /* r2 */ \
8843+ 0, /* r1 */ \
8844+ 0, /* r0 */ \
8845+ 0, /* f15 */ \
8846+ 0, /* f14 */ \
8847+ 0, /* f13 */ \
8848+ 0, /* f12 */ \
8849+ 0, /* f11 */ \
8850+ 0, /* f10 */ \
8851+ 0, /* f9 */ \
8852+ 0, /* f8 */ \
8853+ 0, /* f7 */ \
8854+ 0, /* f6 */ \
8855+ 0, /* f5 */ \
8856+ 0, /* f4 */ \
8857+ 0, /* f3 */ \
8858+ 0, /* f2*/ \
8859+ 0, /* f1 */ \
8860+ 0 /* f0 */ \
8861+}
8862+
8863+/*
8864+Like FIXED_REGISTERS but has 1 for each register that is
8865+clobbered (in general) by function calls as well as for fixed
8866+registers. This macro therefore identifies the registers that are not
8867+available for general allocation of values that must live across
8868+function calls.
8869+
8870+If a register has 0 in CALL_USED_REGISTERS, the compiler
8871+automatically saves it on function entry and restores it on function
8872+exit, if the register is used within the function.
8873+*/
8874+#define CALL_USED_REGISTERS { \
8875+ 1, /* Program Counter */ \
8876+ 0, /* Link Register */ \
8877+ 1, /* Stack Pointer */ \
8878+ 1, /* r12 */ \
8879+ 1, /* r11 */ \
8880+ 1, /* r10 */ \
8881+ 1, /* r9 */ \
8882+ 1, /* r8 */ \
8883+ 0, /* r7 */ \
8884+ 0, /* r6 */ \
8885+ 0, /* r5 */ \
8886+ 0, /* r4 */ \
8887+ 0, /* r3 */ \
8888+ 0, /* r2 */ \
8889+ 0, /* r1 */ \
8890+ 0, /* r0 */ \
8891+ 1, /* f15 */ \
8892+ 1, /* f14 */ \
8893+ 1, /* f13 */ \
8894+ 1, /* f12 */ \
8895+ 1, /* f11 */ \
8896+ 1, /* f10 */ \
8897+ 1, /* f9 */ \
8898+ 1, /* f8 */ \
8899+ 0, /* f7 */ \
8900+ 0, /* f6 */ \
8901+ 0, /* f5 */ \
8902+ 0, /* f4 */ \
8903+ 0, /* f3 */ \
8904+ 0, /* f2*/ \
8905+ 0, /* f1*/ \
8906+ 0, /* f0 */ \
8907+}
8908+
8909+/* Interrupt functions can only use registers that have already been
8910+ saved by the prologue, even if they would normally be
8911+ call-clobbered. */
8912+#define HARD_REGNO_RENAME_OK(SRC, DST) \
8913+ (! IS_INTERRUPT (cfun->machine->func_type) || \
8914+ regs_ever_live[DST])
8915+
8916+
8917+/*
8918+Zero or more C statements that may conditionally modify five variables
8919+fixed_regs, call_used_regs, global_regs,
8920+reg_names, and reg_class_contents, to take into account
8921+any dependence of these register sets on target flags. The first three
8922+of these are of type char [] (interpreted as Boolean vectors).
8923+global_regs is a const char *[], and
8924+reg_class_contents is a HARD_REG_SET. Before the macro is
8925+called, fixed_regs, call_used_regs,
8926+reg_class_contents, and reg_names have been initialized
8927+from FIXED_REGISTERS, CALL_USED_REGISTERS,
8928+REG_CLASS_CONTENTS, and REGISTER_NAMES, respectively.
8929+global_regs has been cleared, and any -ffixed-[reg],
8930+-fcall-used-[reg] and -fcall-saved-[reg]
8931+command options have been applied.
8932+
8933+You need not define this macro if it has no work to do.
8934+
8935+If the usage of an entire class of registers depends on the target
8936+flags, you may indicate this to GCC by using this macro to modify
8937+fixed_regs and call_used_regs to 1 for each of the
8938+registers in the classes which should not be used by GCC. Also define
8939+the macro REG_CLASS_FROM_LETTER to return NO_REGS if it
8940+is called with a letter for a class that shouldn't be used.
8941+
8942+ (However, if this class is not included in GENERAL_REGS and all
8943+of the insn patterns whose constraints permit this class are
8944+controlled by target switches, then GCC will automatically avoid using
8945+these registers when the target switches are opposed to them.)
8946+*/
8947+#define CONDITIONAL_REGISTER_USAGE \
8948+ do \
8949+ { \
8950+ int regno; \
8951+ \
8952+ if (TARGET_SOFT_FLOAT) \
8953+ { \
8954+ for (regno = FIRST_FP_REGNUM; \
8955+ regno <= LAST_FP_REGNUM; ++regno) \
8956+ fixed_regs[regno] = call_used_regs[regno] = 1; \
8957+ } \
8958+ if (flag_pic) \
8959+ { \
8960+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
8961+ call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
8962+ } \
8963+ } \
8964+ while (0)
8965+
8966+
8967+/*
8968+If the program counter has a register number, define this as that
8969+register number. Otherwise, do not define it.
8970+*/
8971+
8972+#define LAST_AVR32_REGNUM 16
8973+
8974+
8975+/** Order of Allocation of Registers **/
8976+
8977+/*
8978+If defined, an initializer for a vector of integers, containing the
8979+numbers of hard registers in the order in which GCC should prefer
8980+to use them (from most preferred to least).
8981+
8982+If this macro is not defined, registers are used lowest numbered first
8983+(all else being equal).
8984+
8985+One use of this macro is on machines where the highest numbered
8986+registers must always be saved and the save-multiple-registers
8987+instruction supports only sequences of consecutive registers. On such
8988+machines, define REG_ALLOC_ORDER to be an initializer that lists
8989+the highest numbered allocable register first.
8990+*/
8991+#define REG_ALLOC_ORDER \
8992+{ \
8993+ INTERNAL_REGNUM(8), \
8994+ INTERNAL_REGNUM(9), \
8995+ INTERNAL_REGNUM(10), \
8996+ INTERNAL_REGNUM(11), \
8997+ INTERNAL_REGNUM(12), \
8998+ LR_REGNUM, \
8999+ INTERNAL_REGNUM(7), \
9000+ INTERNAL_REGNUM(6), \
9001+ INTERNAL_REGNUM(5), \
9002+ INTERNAL_REGNUM(4), \
9003+ INTERNAL_REGNUM(3), \
9004+ INTERNAL_REGNUM(2), \
9005+ INTERNAL_REGNUM(1), \
9006+ INTERNAL_REGNUM(0), \
9007+ INTERNAL_FP_REGNUM(15), \
9008+ INTERNAL_FP_REGNUM(14), \
9009+ INTERNAL_FP_REGNUM(13), \
9010+ INTERNAL_FP_REGNUM(12), \
9011+ INTERNAL_FP_REGNUM(11), \
9012+ INTERNAL_FP_REGNUM(10), \
9013+ INTERNAL_FP_REGNUM(9), \
9014+ INTERNAL_FP_REGNUM(8), \
9015+ INTERNAL_FP_REGNUM(7), \
9016+ INTERNAL_FP_REGNUM(6), \
9017+ INTERNAL_FP_REGNUM(5), \
9018+ INTERNAL_FP_REGNUM(4), \
9019+ INTERNAL_FP_REGNUM(3), \
9020+ INTERNAL_FP_REGNUM(2), \
9021+ INTERNAL_FP_REGNUM(1), \
9022+ INTERNAL_FP_REGNUM(0), \
9023+ SP_REGNUM, \
9024+ PC_REGNUM \
9025+}
9026+
9027+
9028+/** How Values Fit in Registers **/
9029+
9030+/*
9031+A C expression for the number of consecutive hard registers, starting
9032+at register number REGNO, required to hold a value of mode
9033+MODE.
9034+
9035+On a machine where all registers are exactly one word, a suitable
9036+definition of this macro is
9037+
9038+#define HARD_REGNO_NREGS(REGNO, MODE) \
9039+ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
9040+ / UNITS_PER_WORD)
9041+*/
9042+#define HARD_REGNO_NREGS(REGNO, MODE) \
9043+ ((unsigned int)((GET_MODE_SIZE(MODE) + UNITS_PER_WORD -1 ) / UNITS_PER_WORD))
9044+
9045+/*
9046+A C expression that is nonzero if it is permissible to store a value
9047+of mode MODE in hard register number REGNO (or in several
9048+registers starting with that one). For a machine where all registers
9049+are equivalent, a suitable definition is
9050+
9051+ #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
9052+
9053+You need not include code to check for the numbers of fixed registers,
9054+because the allocation mechanism considers them to be always occupied.
9055+
9056+On some machines, double-precision values must be kept in even/odd
9057+register pairs. You can implement that by defining this macro to reject
9058+odd register numbers for such modes.
9059+
9060+The minimum requirement for a mode to be OK in a register is that the
9061+mov[mode] instruction pattern support moves between the
9062+register and other hard register in the same class and that moving a
9063+value into the register and back out not alter it.
9064+
9065+Since the same instruction used to move word_mode will work for
9066+all narrower integer modes, it is not necessary on any machine for
9067+HARD_REGNO_MODE_OK to distinguish between these modes, provided
9068+you define patterns movhi, etc., to take advantage of this. This
9069+is useful because of the interaction between HARD_REGNO_MODE_OK
9070+and MODES_TIEABLE_P; it is very desirable for all integer modes
9071+to be tieable.
9072+
9073+Many machines have special registers for floating point arithmetic.
9074+Often people assume that floating point machine modes are allowed only
9075+in floating point registers. This is not true. Any registers that
9076+can hold integers can safely hold a floating point machine
9077+mode, whether or not floating arithmetic can be done on it in those
9078+registers. Integer move instructions can be used to move the values.
9079+
9080+On some machines, though, the converse is true: fixed-point machine
9081+modes may not go in floating registers. This is true if the floating
9082+registers normalize any value stored in them, because storing a
9083+non-floating value there would garble it. In this case,
9084+HARD_REGNO_MODE_OK should reject fixed-point machine modes in
9085+floating registers. But if the floating registers do not automatically
9086+normalize, if you can store any bit pattern in one and retrieve it
9087+unchanged without a trap, then any machine mode may go in a floating
9088+register, so you can define this macro to say so.
9089+
9090+The primary significance of special floating registers is rather that
9091+they are the registers acceptable in floating point arithmetic
9092+instructions. However, this is of no concern to
9093+HARD_REGNO_MODE_OK. You handle it by writing the proper
9094+constraints for those instructions.
9095+
9096+On some machines, the floating registers are especially slow to access,
9097+so that it is better to store a value in a stack frame than in such a
9098+register if floating point arithmetic is not being done. As long as the
9099+floating registers are not in class GENERAL_REGS, they will not
9100+be used unless some pattern's constraint asks for one.
9101+*/
9102+#define HARD_REGNO_MODE_OK(REGNO, MODE) avr32_hard_regno_mode_ok(REGNO, MODE)
9103+
9104+/*
9105+A C expression that is nonzero if a value of mode
9106+MODE1 is accessible in mode MODE2 without copying.
9107+
9108+If HARD_REGNO_MODE_OK(R, MODE1) and
9109+HARD_REGNO_MODE_OK(R, MODE2) are always the same for
9110+any R, then MODES_TIEABLE_P(MODE1, MODE2)
9111+should be nonzero. If they differ for any R, you should define
9112+this macro to return zero unless some other mechanism ensures the
9113+accessibility of the value in a narrower mode.
9114+
9115+You should define this macro to return nonzero in as many cases as
9116+possible since doing so will allow GCC to perform better register
9117+allocation.
9118+*/
9119+#define MODES_TIEABLE_P(MODE1, MODE2) \
9120+ (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
9121+
9122+
9123+
9124+/******************************************************************************
9125+ * Register Classes
9126+ *****************************************************************************/
9127+
9128+/*
9129+An enumeral type that must be defined with all the register class names
9130+as enumeral values. NO_REGS must be first. ALL_REGS
9131+must be the last register class, followed by one more enumeral value,
9132+LIM_REG_CLASSES, which is not a register class but rather
9133+tells how many classes there are.
9134+
9135+Each register class has a number, which is the value of casting
9136+the class name to type int. The number serves as an index
9137+in many of the tables described below.
9138+*/
9139+enum reg_class
9140+{
9141+ NO_REGS,
9142+ GENERAL_REGS,
9143+ FP_REGS,
9144+ ALL_REGS,
9145+ LIM_REG_CLASSES
9146+};
9147+
9148+/*
9149+The number of distinct register classes, defined as follows:
9150+ #define N_REG_CLASSES (int) LIM_REG_CLASSES
9151+*/
9152+#define N_REG_CLASSES (int)LIM_REG_CLASSES
9153+
9154+/*
9155+An initializer containing the names of the register classes as C string
9156+constants. These names are used in writing some of the debugging dumps.
9157+*/
9158+#define REG_CLASS_NAMES \
9159+{ \
9160+ "NO_REGS", \
9161+ "GENERAL_REGS", \
9162+ "FLOATING_POINT_REGS", \
9163+ "ALL_REGS" \
9164+}
9165+
9166+/*
9167+An initializer containing the contents of the register classes, as integers
9168+which are bit masks. The nth integer specifies the contents of class
9169+n. The way the integer mask is interpreted is that
9170+register r is in the class if mask & (1 << r) is 1.
9171+
9172+When the machine has more than 32 registers, an integer does not suffice.
9173+Then the integers are replaced by sub-initializers, braced groupings containing
9174+several integers. Each sub-initializer must be suitable as an initializer
9175+for the type HARD_REG_SET which is defined in hard-reg-set.h.
9176+In this situation, the first integer in each sub-initializer corresponds to
9177+registers 0 through 31, the second integer to registers 32 through 63, and
9178+so on.
9179+*/
9180+#define REG_CLASS_CONTENTS { \
9181+ {0x00000000}, /* NO_REGS */ \
9182+ {0x0000FFFF}, /* GENERAL_REGS */ \
9183+ {0xFFFF0000}, /* FP_REGS */ \
9184+ {0x7FFFFFFF}, /* ALL_REGS */ \
9185+}
9186+
9187+
9188+/*
9189+A C expression whose value is a register class containing hard register
9190+REGNO. In general there is more than one such class; choose a class
9191+which is minimal, meaning that no smaller class also contains the
9192+register.
9193+*/
9194+#define REGNO_REG_CLASS(REGNO) ((REGNO < 16) ? GENERAL_REGS : FP_REGS)
9195+
9196+/*
9197+A macro whose definition is the name of the class to which a valid
9198+base register must belong. A base register is one used in an address
9199+which is the register value plus a displacement.
9200+*/
9201+#define BASE_REG_CLASS GENERAL_REGS
9202+
9203+/*
9204+This is a variation of the BASE_REG_CLASS macro which allows
9205+the selection of a base register in a mode depenedent manner. If
9206+mode is VOIDmode then it should return the same value as
9207+BASE_REG_CLASS.
9208+*/
9209+#define MODE_BASE_REG_CLASS(MODE) BASE_REG_CLASS
9210+
9211+/*
9212+A macro whose definition is the name of the class to which a valid
9213+index register must belong. An index register is one used in an
9214+address where its value is either multiplied by a scale factor or
9215+added to another register (as well as added to a displacement).
9216+*/
9217+#define INDEX_REG_CLASS BASE_REG_CLASS
9218+
9219+/*
9220+A C expression which defines the machine-dependent operand constraint
9221+letters for register classes. If CHAR is such a letter, the
9222+value should be the register class corresponding to it. Otherwise,
9223+the value should be NO_REGS. The register letter r,
9224+corresponding to class GENERAL_REGS, will not be passed
9225+to this macro; you do not need to handle it.
9226+*/
9227+#define REG_CLASS_FROM_LETTER(CHAR) ((CHAR) == 'f' ? FP_REGS : NO_REGS)
9228+
9229+
9230+/* These assume that REGNO is a hard or pseudo reg number.
9231+ They give nonzero only if REGNO is a hard reg of the suitable class
9232+ or a pseudo reg currently allocated to a suitable hard reg.
9233+ Since they use reg_renumber, they are safe only once reg_renumber
9234+ has been allocated, which happens in local-alloc.c. */
9235+#define TEST_REGNO(R, TEST, VALUE) \
9236+ ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
9237+
9238+/*
9239+A C expression which is nonzero if register number num is suitable for use as a base
9240+register in operand addresses. It may be either a suitable hard register or a pseudo
9241+register that has been allocated such a hard register.
9242+*/
9243+#define REGNO_OK_FOR_BASE_P(NUM) TEST_REGNO(NUM, <=, LAST_REGNUM)
9244+
9245+/*
9246+A C expression which is nonzero if register number NUM is
9247+suitable for use as an index register in operand addresses. It may be
9248+either a suitable hard register or a pseudo register that has been
9249+allocated such a hard register.
9250+
9251+The difference between an index register and a base register is that
9252+the index register may be scaled. If an address involves the sum of
9253+two registers, neither one of them scaled, then either one may be
9254+labeled the ``base'' and the other the ``index''; but whichever
9255+labeling is used must fit the machine's constraints of which registers
9256+may serve in each capacity. The compiler will try both labelings,
9257+looking for one that is valid, and will reload one or both registers
9258+only if neither labeling works.
9259+*/
9260+#define REGNO_OK_FOR_INDEX_P(NUM) TEST_REGNO(NUM, <=, LAST_REGNUM)
9261+
9262+/*
9263+A C expression that places additional restrictions on the register class
9264+to use when it is necessary to copy value X into a register in class
9265+CLASS. The value is a register class; perhaps CLASS, or perhaps
9266+another, smaller class. On many machines, the following definition is
9267+safe: #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
9268+
9269+Sometimes returning a more restrictive class makes better code. For
9270+example, on the 68000, when X is an integer constant that is in range
9271+for a 'moveq' instruction, the value of this macro is always
9272+DATA_REGS as long as CLASS includes the data registers.
9273+Requiring a data register guarantees that a 'moveq' will be used.
9274+
9275+If X is a const_double, by returning NO_REGS
9276+you can force X into a memory constant. This is useful on
9277+certain machines where immediate floating values cannot be loaded into
9278+certain kinds of registers.
9279+*/
9280+#define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS
9281+
9282+
9283+
9284+/*
9285+A C expression for the maximum number of consecutive registers
9286+of class CLASS needed to hold a value of mode MODE.
9287+
9288+This is closely related to the macro HARD_REGNO_NREGS. In fact,
9289+the value of the macro CLASS_MAX_NREGS(CLASS, MODE)
9290+should be the maximum value of HARD_REGNO_NREGS(REGNO, MODE)
9291+for all REGNO values in the class CLASS.
9292+
9293+This macro helps control the handling of multiple-word values
9294+in the reload pass.
9295+*/
9296+#define CLASS_MAX_NREGS(CLASS, MODE) /* ToDo:fixme */ \
9297+ (unsigned int)((GET_MODE_SIZE(MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
9298+
9299+
9300+/*
9301+ Using CONST_OK_FOR_CONSTRAINT_P instead of CONS_OK_FOR_LETTER_P
9302+ in order to support constraints with more than one letter.
9303+ Only two letters are then used for constant constraints,
9304+ the letter 'K' and the letter 'I'. The constraint starting with
9305+ these letters must consist of four characters. The character following
9306+ 'K' or 'I' must be either 'u' (unsigned) or 's' (signed) to specify
9307+ if the constant is zero or sign extended. The last two characters specify
9308+ the length in bits of the constant. The base constraint letter 'I' means
9309+ that this is an negated constant, meaning that actually -VAL should be
9310+ checked to lie withing the valid range instead of VAL which is used when
9311+ 'K' is the base constraint letter.
9312+
9313+*/
9314+
9315+#define CONSTRAINT_LEN(C, STR) \
9316+ ( ((C) == 'K' || (C) == 'I') ? 4 : \
9317+ ((C) == 'R') ? 5 : \
9318+ ((C) == 'N' || (C) == 'O' || \
9319+ (C) == 'P' || (C) == 'L' || (C) == 'J') ? -1 : \
9320+ DEFAULT_CONSTRAINT_LEN((C), (STR)) )
9321+
9322+#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, STR) \
9323+ avr32_const_ok_for_constraint_p(VALUE, C, STR)
9324+
9325+/*
9326+A C expression that defines the machine-dependent operand constraint
9327+letters that specify particular ranges of const_double values ('G' or 'H').
9328+
9329+If C is one of those letters, the expression should check that
9330+VALUE, an RTX of code const_double, is in the appropriate
9331+range and return 1 if so, 0 otherwise. If C is not one of those
9332+letters, the value should be 0 regardless of VALUE.
9333+
9334+const_double is used for all floating-point constants and for
9335+DImode fixed-point constants. A given letter can accept either
9336+or both kinds of values. It can use GET_MODE to distinguish
9337+between these kinds.
9338+*/
9339+#define CONST_DOUBLE_OK_FOR_LETTER_P(OP, C) \
9340+ ((C) == 'G' ? avr32_const_double_immediate(OP) : 0)
9341+
9342+/*
9343+A C expression that defines the optional machine-dependent constraint
9344+letters that can be used to segregate specific types of operands, usually
9345+memory references, for the target machine. Any letter that is not
9346+elsewhere defined and not matched by REG_CLASS_FROM_LETTER
9347+may be used. Normally this macro will not be defined.
9348+
9349+If it is required for a particular target machine, it should return 1
9350+if VALUE corresponds to the operand type represented by the
9351+constraint letter C. If C is not defined as an extra
9352+constraint, the value returned should be 0 regardless of VALUE.
9353+
9354+For example, on the ROMP, load instructions cannot have their output
9355+in r0 if the memory reference contains a symbolic address. Constraint
9356+letter 'Q' is defined as representing a memory address that does
9357+not contain a symbolic address. An alternative is specified with
9358+a 'Q' constraint on the input and 'r' on the output. The next
9359+alternative specifies 'm' on the input and a register class that
9360+does not include r0 on the output.
9361+*/
9362+#define EXTRA_CONSTRAINT_STR(OP, C, STR) \
9363+ ((C) == 'W' ? avr32_address_operand(OP, GET_MODE(OP)) : \
9364+ (C) == 'R' ? (avr32_indirect_register_operand(OP, GET_MODE(OP)) || \
9365+ (avr32_imm_disp_memory_operand(OP, GET_MODE(OP)) \
9366+ && avr32_const_ok_for_constraint_p( \
9367+ INTVAL(XEXP(XEXP(OP, 0), 1)), \
9368+ (STR)[1], &(STR)[1]))) : \
9369+ (C) == 'S' ? avr32_indexed_memory_operand(OP, GET_MODE(OP)) : \
9370+ (C) == 'T' ? avr32_const_pool_ref_operand(OP, GET_MODE(OP)) : \
9371+ (C) == 'U' ? SYMBOL_REF_RCALL_FUNCTION_P(OP) : \
9372+ (C) == 'Z' ? avr32_cop_memory_operand(OP, GET_MODE(OP)) : \
9373+ 0)
9374+
9375+
9376+#define EXTRA_MEMORY_CONSTRAINT(C, STR) ( ((C) == 'R') || \
9377+ ((C) == 'S') || \
9378+ ((C) == 'Z') )
9379+
9380+
9381+/* Returns nonzero if op is a function SYMBOL_REF which
9382+ can be called using an rcall instruction */
9383+#define SYMBOL_REF_RCALL_FUNCTION_P(op) \
9384+ ( GET_CODE(op) == SYMBOL_REF \
9385+ && SYMBOL_REF_FUNCTION_P(op) \
9386+ && SYMBOL_REF_LOCAL_P(op) \
9387+ && !SYMBOL_REF_EXTERNAL_P(op) \
9388+ && !TARGET_HAS_ASM_ADDR_PSEUDOS )
9389+
9390+/******************************************************************************
9391+ * Stack Layout and Calling Conventions
9392+ *****************************************************************************/
9393+
9394+/** Basic Stack Layout **/
9395+
9396+/*
9397+Define this macro if pushing a word onto the stack moves the stack
9398+pointer to a smaller address.
9399+
9400+When we say, ``define this macro if ...,'' it means that the
9401+compiler checks this macro only with #ifdef so the precise
9402+definition used does not matter.
9403+*/
9404+/* pushm decrece SP: *(--SP) <-- Rx */
9405+#define STACK_GROWS_DOWNWARD
9406+
9407+/*
9408+This macro defines the operation used when something is pushed
9409+on the stack. In RTL, a push operation will be
9410+(set (mem (STACK_PUSH_CODE (reg sp))) ...)
9411+
9412+The choices are PRE_DEC, POST_DEC, PRE_INC,
9413+and POST_INC. Which of these is correct depends on
9414+the stack direction and on whether the stack pointer points
9415+to the last item on the stack or whether it points to the
9416+space for the next item on the stack.
9417+
9418+The default is PRE_DEC when STACK_GROWS_DOWNWARD is
9419+defined, which is almost always right, and PRE_INC otherwise,
9420+which is often wrong.
9421+*/
9422+/* pushm: *(--SP) <-- Rx */
9423+#define STACK_PUSH_CODE PRE_DEC
9424+
9425+/*
9426+Define this macro if the addresses of local variable slots are at negative
9427+offsets from the frame pointer.
9428+*/
9429+#define FRAME_GROWS_DOWNWARD
9430+
9431+
9432+/*
9433+Offset from the frame pointer to the first local variable slot to be allocated.
9434+
9435+If FRAME_GROWS_DOWNWARD, find the next slot's offset by
9436+subtracting the first slot's length from STARTING_FRAME_OFFSET.
9437+Otherwise, it is found by adding the length of the first slot to the
9438+value STARTING_FRAME_OFFSET.
9439+ (i'm not sure if the above is still correct.. had to change it to get
9440+ rid of an overfull. --mew 2feb93 )
9441+*/
9442+#define STARTING_FRAME_OFFSET 0
9443+
9444+/*
9445+Offset from the stack pointer register to the first location at which
9446+outgoing arguments are placed. If not specified, the default value of
9447+zero is used. This is the proper value for most machines.
9448+
9449+If ARGS_GROW_DOWNWARD, this is the offset to the location above
9450+the first location at which outgoing arguments are placed.
9451+*/
9452+#define STACK_POINTER_OFFSET 0
9453+
9454+/*
9455+Offset from the argument pointer register to the first argument's
9456+address. On some machines it may depend on the data type of the
9457+function.
9458+
9459+If ARGS_GROW_DOWNWARD, this is the offset to the location above
9460+the first argument's address.
9461+*/
9462+#define FIRST_PARM_OFFSET(FUNDECL) 0
9463+
9464+
9465+/*
9466+A C expression whose value is RTL representing the address in a stack
9467+frame where the pointer to the caller's frame is stored. Assume that
9468+FRAMEADDR is an RTL expression for the address of the stack frame
9469+itself.
9470+
9471+If you don't define this macro, the default is to return the value
9472+of FRAMEADDR - that is, the stack frame address is also the
9473+address of the stack word that points to the previous frame.
9474+*/
9475+#define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) plus_constant ((FRAMEADDR), 4)
9476+
9477+
9478+/*
9479+A C expression whose value is RTL representing the value of the return
9480+address for the frame COUNT steps up from the current frame, after
9481+the prologue. FRAMEADDR is the frame pointer of the COUNT
9482+frame, or the frame pointer of the COUNT - 1 frame if
9483+RETURN_ADDR_IN_PREVIOUS_FRAME is defined.
9484+
9485+The value of the expression must always be the correct address when
9486+COUNT is zero, but may be NULL_RTX if there is not way to
9487+determine the return address of other frames.
9488+*/
9489+#define RETURN_ADDR_RTX(COUNT, FRAMEADDR) avr32_return_addr(COUNT, FRAMEADDR)
9490+
9491+
9492+/*
9493+A C expression whose value is RTL representing the location of the
9494+incoming return address at the beginning of any function, before the
9495+prologue. This RTL is either a REG, indicating that the return
9496+value is saved in 'REG', or a MEM representing a location in
9497+the stack.
9498+
9499+You only need to define this macro if you want to support call frame
9500+debugging information like that provided by DWARF 2.
9501+
9502+If this RTL is a REG, you should also define
9503+DWARF_FRAME_RETURN_COLUMN to DWARF_FRAME_REGNUM (REGNO).
9504+*/
9505+#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LR_REGNUM)
9506+
9507+
9508+
9509+/*
9510+A C expression whose value is an integer giving the offset, in bytes,
9511+from the value of the stack pointer register to the top of the stack
9512+frame at the beginning of any function, before the prologue. The top of
9513+the frame is defined to be the value of the stack pointer in the
9514+previous frame, just before the call instruction.
9515+
9516+You only need to define this macro if you want to support call frame
9517+debugging information like that provided by DWARF 2.
9518+*/
9519+#define INCOMING_FRAME_SP_OFFSET 0
9520+
9521+
9522+/** Exception Handling Support **/
9523+
9524+#define DWARF2_UNWIND_INFO 1
9525+
9526+/*
9527+A C expression whose value is the Nth register number used for
9528+data by exception handlers, or INVALID_REGNUM if fewer than
9529+N registers are usable.
9530+
9531+The exception handling library routines communicate with the exception
9532+handlers via a set of agreed upon registers. Ideally these registers
9533+should be call-clobbered; it is possible to use call-saved registers,
9534+but may negatively impact code size. The target must support at least
9535+2 data registers, but should define 4 if there are enough free registers.
9536+
9537+You must define this macro if you want to support call frame exception
9538+handling like that provided by DWARF 2.
9539+*/
9540+/*
9541+ Use r8-r11
9542+*/
9543+#define EH_RETURN_DATA_REGNO(N) \
9544+ ((N) < 4 ? INTERNAL_REGNUM((N) + 8U) : INVALID_REGNUM)
9545+
9546+/*
9547+A C expression whose value is RTL representing a location in which
9548+to store a stack adjustment to be applied before function return.
9549+This is used to unwind the stack to an exception handler's call frame.
9550+It will be assigned zero on code paths that return normally.
9551+
9552+Typically this is a call-clobbered hard register that is otherwise
9553+untouched by the epilogue, but could also be a stack slot.
9554+
9555+You must define this macro if you want to support call frame exception
9556+handling like that provided by DWARF 2.
9557+*/
9558+/*
9559+ I don't think functions that may throw exceptions can ever be leaf
9560+ functions, so we may safely use LR for this.
9561+*/
9562+#define EH_RETURN_STACKADJ_REGNO LR_REGNUM
9563+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG(SImode, EH_RETURN_STACKADJ_REGNO)
9564+
9565+/*
9566+A C expression whose value is RTL representing a location in which
9567+to store the address of an exception handler to which we should
9568+return. It will not be assigned on code paths that return normally.
9569+
9570+Typically this is the location in the call frame at which the normal
9571+return address is stored. For targets that return by popping an
9572+address off the stack, this might be a memory address just below
9573+the target call frame rather than inside the current call
9574+frame. EH_RETURN_STACKADJ_RTX will have already been assigned,
9575+so it may be used to calculate the location of the target call frame.
9576+
9577+Some targets have more complex requirements than storing to an
9578+address calculable during initial code generation. In that case
9579+the eh_return instruction pattern should be used instead.
9580+
9581+If you want to support call frame exception handling, you must
9582+define either this macro or the eh_return instruction pattern.
9583+*/
9584+/*
9585+ We define the eh_return instruction pattern, so this isn't needed.
9586+*/
9587+/* #define EH_RETURN_HANDLER_RTX gen_rtx_REG(Pmode, RET_REGISTER) */
9588+
9589+/*
9590+ This macro chooses the encoding of pointers embedded in the
9591+ exception handling sections. If at all possible, this should be
9592+ defined such that the exception handling section will not require
9593+ dynamic relocations, and so may be read-only.
9594+
9595+ code is 0 for data, 1 for code labels, 2 for function
9596+ pointers. global is true if the symbol may be affected by dynamic
9597+ relocations. The macro should return a combination of the DW_EH_PE_*
9598+ defines as found in dwarf2.h.
9599+
9600+ If this macro is not defined, pointers will not be encoded but
9601+ represented directly.
9602+*/
9603+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
9604+ ((flag_pic && (GLOBAL) ? DW_EH_PE_indirect : 0) \
9605+ | (flag_pic ? DW_EH_PE_pcrel : DW_EH_PE_absptr) \
9606+ | DW_EH_PE_sdata4)
9607+
9608+/* ToDo: The rest of this subsection */
9609+
9610+/** Specifying How Stack Checking is Done **/
9611+/* ToDo: All in this subsection */
9612+
9613+/** Registers That Address the Stack Frame **/
9614+
9615+/*
9616+The register number of the stack pointer register, which must also be a
9617+fixed register according to FIXED_REGISTERS. On most machines,
9618+the hardware determines which register this is.
9619+*/
9620+/* Using r13 as stack pointer. */
9621+#define STACK_POINTER_REGNUM INTERNAL_REGNUM(13)
9622+
9623+/*
9624+The register number of the frame pointer register, which is used to
9625+access automatic variables in the stack frame. On some machines, the
9626+hardware determines which register this is. On other machines, you can
9627+choose any register you wish for this purpose.
9628+*/
9629+/* Use r7 */
9630+#define FRAME_POINTER_REGNUM INTERNAL_REGNUM(7)
9631+
9632+
9633+
9634+/*
9635+The register number of the arg pointer register, which is used to access
9636+the function's argument list. On some machines, this is the same as the
9637+frame pointer register. On some machines, the hardware determines which
9638+register this is. On other machines, you can choose any register you
9639+wish for this purpose. If this is not the same register as the frame
9640+pointer register, then you must mark it as a fixed register according to
9641+FIXED_REGISTERS, or arrange to be able to eliminate it (see Section
9642+10.10.5 [Elimination], page 224).
9643+*/
9644+/* Using r5 */
9645+#define ARG_POINTER_REGNUM INTERNAL_REGNUM(4)
9646+
9647+
9648+/*
9649+Register numbers used for passing a function's static chain pointer. If
9650+register windows are used, the register number as seen by the called
9651+function is STATIC_CHAIN_INCOMING_REGNUM, while the register
9652+number as seen by the calling function is STATIC_CHAIN_REGNUM. If
9653+these registers are the same, STATIC_CHAIN_INCOMING_REGNUM need
9654+not be defined.
9655+
9656+The static chain register need not be a fixed register.
9657+
9658+If the static chain is passed in memory, these macros should not be
9659+defined; instead, the next two macros should be defined.
9660+*/
9661+/* Using r0 */
9662+#define STATIC_CHAIN_REGNUM INTERNAL_REGNUM(0)
9663+
9664+
9665+/** Eliminating Frame Pointer and Arg Pointer **/
9666+
9667+/*
9668+A C expression which is nonzero if a function must have and use a frame
9669+pointer. This expression is evaluated in the reload pass. If its value is
9670+nonzero the function will have a frame pointer.
9671+
9672+The expression can in principle examine the current function and decide
9673+according to the facts, but on most machines the constant 0 or the
9674+constant 1 suffices. Use 0 when the machine allows code to be generated
9675+with no frame pointer, and doing so saves some time or space. Use 1
9676+when there is no possible advantage to avoiding a frame pointer.
9677+
9678+In certain cases, the compiler does not know how to produce valid code
9679+without a frame pointer. The compiler recognizes those cases and
9680+automatically gives the function a frame pointer regardless of what
9681+FRAME_POINTER_REQUIRED says. You don't need to worry about
9682+them.
9683+
9684+In a function that does not require a frame pointer, the frame pointer
9685+register can be allocated for ordinary usage, unless you mark it as a
9686+fixed register. See FIXED_REGISTERS for more information.
9687+*/
9688+/* We need the frame pointer when compiling for profiling */
9689+#define FRAME_POINTER_REQUIRED (current_function_profile)
9690+
9691+/*
9692+A C statement to store in the variable DEPTH_VAR the difference
9693+between the frame pointer and the stack pointer values immediately after
9694+the function prologue. The value would be computed from information
9695+such as the result of get_frame_size () and the tables of
9696+registers regs_ever_live and call_used_regs.
9697+
9698+If ELIMINABLE_REGS is defined, this macro will be not be used and
9699+need not be defined. Otherwise, it must be defined even if
9700+FRAME_POINTER_REQUIRED is defined to always be true; in that
9701+case, you may set DEPTH_VAR to anything.
9702+*/
9703+#define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) ((DEPTH_VAR) = get_frame_size())
9704+
9705+/*
9706+If defined, this macro specifies a table of register pairs used to
9707+eliminate unneeded registers that point into the stack frame. If it is not
9708+defined, the only elimination attempted by the compiler is to replace
9709+references to the frame pointer with references to the stack pointer.
9710+
9711+The definition of this macro is a list of structure initializations, each
9712+of which specifies an original and replacement register.
9713+
9714+On some machines, the position of the argument pointer is not known until
9715+the compilation is completed. In such a case, a separate hard register
9716+must be used for the argument pointer. This register can be eliminated by
9717+replacing it with either the frame pointer or the argument pointer,
9718+depending on whether or not the frame pointer has been eliminated.
9719+
9720+In this case, you might specify:
9721+ #define ELIMINABLE_REGS \
9722+ {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
9723+ {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
9724+ {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
9725+
9726+Note that the elimination of the argument pointer with the stack pointer is
9727+specified first since that is the preferred elimination.
9728+*/
9729+#define ELIMINABLE_REGS \
9730+{ \
9731+ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
9732+ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
9733+ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM } \
9734+}
9735+
9736+/*
9737+A C expression that returns nonzero if the compiler is allowed to try
9738+to replace register number FROM with register number
9739+TO. This macro need only be defined if ELIMINABLE_REGS
9740+is defined, and will usually be the constant 1, since most of the cases
9741+preventing register elimination are things that the compiler already
9742+knows about.
9743+*/
9744+#define CAN_ELIMINATE(FROM, TO) 1
9745+
9746+/*
9747+This macro is similar to INITIAL_FRAME_POINTER_OFFSET. It
9748+specifies the initial difference between the specified pair of
9749+registers. This macro must be defined if ELIMINABLE_REGS is
9750+defined.
9751+*/
9752+#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
9753+ ((OFFSET) = avr32_initial_elimination_offset(FROM, TO))
9754+
9755+/** Passing Function Arguments on the Stack **/
9756+
9757+
9758+/*
9759+A C expression. If nonzero, push insns will be used to pass
9760+outgoing arguments.
9761+If the target machine does not have a push instruction, set it to zero.
9762+That directs GCC to use an alternate strategy: to
9763+allocate the entire argument block and then store the arguments into
9764+it. When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
9765+*/
9766+#define PUSH_ARGS 1
9767+
9768+
9769+/*
9770+A C expression that is the number of bytes actually pushed onto the
9771+stack when an instruction attempts to push NPUSHED bytes.
9772+
9773+On some machines, the definition
9774+
9775+ #define PUSH_ROUNDING(BYTES) (BYTES)
9776+
9777+will suffice. But on other machines, instructions that appear
9778+to push one byte actually push two bytes in an attempt to maintain
9779+alignment. Then the definition should be
9780+
9781+ #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
9782+*/
9783+/* Push 4 bytes at the time. */
9784+#define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3)
9785+
9786+/*
9787+A C expression. If nonzero, the maximum amount of space required for
9788+outgoing arguments will be computed and placed into the variable
9789+current_function_outgoing_args_size. No space will be pushed
9790+onto the stack for each call; instead, the function prologue should
9791+increase the stack frame size by this amount.
9792+
9793+Setting both PUSH_ARGS and ACCUMULATE_OUTGOING_ARGS is not proper.
9794+*/
9795+#define ACCUMULATE_OUTGOING_ARGS 0
9796+
9797+
9798+
9799+
9800+/*
9801+A C expression that should indicate the number of bytes of its own
9802+arguments that a function pops on returning, or 0 if the
9803+function pops no arguments and the caller must therefore pop them all
9804+after the function returns.
9805+
9806+FUNDECL is a C variable whose value is a tree node that describes
9807+the function in question. Normally it is a node of type
9808+FUNCTION_DECL that describes the declaration of the function.
9809+From this you can obtain the DECL_ATTRIBUTES of the function.
9810+
9811+FUNTYPE is a C variable whose value is a tree node that
9812+describes the function in question. Normally it is a node of type
9813+FUNCTION_TYPE that describes the data type of the function.
9814+From this it is possible to obtain the data types of the value and
9815+arguments (if known).
9816+
9817+When a call to a library function is being considered, FUNDECL
9818+will contain an identifier node for the library function. Thus, if
9819+you need to distinguish among various library functions, you can do so
9820+by their names. Note that ``library function'' in this context means
9821+a function used to perform arithmetic, whose name is known specially
9822+in the compiler and was not mentioned in the C code being compiled.
9823+
9824+STACK_SIZE is the number of bytes of arguments passed on the
9825+stack. If a variable number of bytes is passed, it is zero, and
9826+argument popping will always be the responsibility of the calling function.
9827+
9828+On the VAX, all functions always pop their arguments, so the definition
9829+of this macro is STACK_SIZE. On the 68000, using the standard
9830+calling convention, no functions pop their arguments, so the value of
9831+the macro is always 0 in this case. But an alternative calling
9832+convention is available in which functions that take a fixed number of
9833+arguments pop them but other functions (such as printf) pop
9834+nothing (the caller pops all). When this convention is in use,
9835+FUNTYPE is examined to determine whether a function takes a fixed
9836+number of arguments.
9837+*/
9838+#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
9839+
9840+
9841+/*Return true if this function can we use a single return instruction*/
9842+#define USE_RETURN_INSN(ISCOND) avr32_use_return_insn(ISCOND)
9843+
9844+/*
9845+A C expression that should indicate the number of bytes a call sequence
9846+pops off the stack. It is added to the value of RETURN_POPS_ARGS
9847+when compiling a function call.
9848+
9849+CUM is the variable in which all arguments to the called function
9850+have been accumulated.
9851+
9852+On certain architectures, such as the SH5, a call trampoline is used
9853+that pops certain registers off the stack, depending on the arguments
9854+that have been passed to the function. Since this is a property of the
9855+call site, not of the called function, RETURN_POPS_ARGS is not
9856+appropriate.
9857+*/
9858+#define CALL_POPS_ARGS(CUM) 0
9859+
9860+/* Passing Arguments in Registers */
9861+
9862+/*
9863+A C expression that controls whether a function argument is passed
9864+in a register, and which register.
9865+
9866+The arguments are CUM, which summarizes all the previous
9867+arguments; MODE, the machine mode of the argument; TYPE,
9868+the data type of the argument as a tree node or 0 if that is not known
9869+(which happens for C support library functions); and NAMED,
9870+which is 1 for an ordinary argument and 0 for nameless arguments that
9871+correspond to '...' in the called function's prototype.
9872+TYPE can be an incomplete type if a syntax error has previously
9873+occurred.
9874+
9875+The value of the expression is usually either a reg RTX for the
9876+hard register in which to pass the argument, or zero to pass the
9877+argument on the stack.
9878+
9879+For machines like the VAX and 68000, where normally all arguments are
9880+pushed, zero suffices as a definition.
9881+
9882+The value of the expression can also be a parallel RTX. This is
9883+used when an argument is passed in multiple locations. The mode of the
9884+of the parallel should be the mode of the entire argument. The
9885+parallel holds any number of expr_list pairs; each one
9886+describes where part of the argument is passed. In each
9887+expr_list the first operand must be a reg RTX for the hard
9888+register in which to pass this part of the argument, and the mode of the
9889+register RTX indicates how large this part of the argument is. The
9890+second operand of the expr_list is a const_int which gives
9891+the offset in bytes into the entire argument of where this part starts.
9892+As a special exception the first expr_list in the parallel
9893+RTX may have a first operand of zero. This indicates that the entire
9894+argument is also stored on the stack.
9895+
9896+The last time this macro is called, it is called with MODE == VOIDmode,
9897+and its result is passed to the call or call_value
9898+pattern as operands 2 and 3 respectively.
9899+
9900+The usual way to make the ISO library 'stdarg.h' work on a machine
9901+where some arguments are usually passed in registers, is to cause
9902+nameless arguments to be passed on the stack instead. This is done
9903+by making FUNCTION_ARG return 0 whenever NAMED is 0.
9904+
9905+You may use the macro MUST_PASS_IN_STACK (MODE, TYPE)
9906+in the definition of this macro to determine if this argument is of a
9907+type that must be passed in the stack. If REG_PARM_STACK_SPACE
9908+is not defined and FUNCTION_ARG returns nonzero for such an
9909+argument, the compiler will abort. If REG_PARM_STACK_SPACE is
9910+defined, the argument will be computed in the stack and then loaded into
9911+a register. */
9912+
9913+#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
9914+ avr32_function_arg(&(CUM), MODE, TYPE, NAMED)
9915+
9916+
9917+
9918+
9919+/*
9920+A C type for declaring a variable that is used as the first argument of
9921+FUNCTION_ARG and other related values. For some target machines,
9922+the type int suffices and can hold the number of bytes of
9923+argument so far.
9924+
9925+There is no need to record in CUMULATIVE_ARGS anything about the
9926+arguments that have been passed on the stack. The compiler has other
9927+variables to keep track of that. For target machines on which all
9928+arguments are passed on the stack, there is no need to store anything in
9929+CUMULATIVE_ARGS; however, the data structure must exist and
9930+should not be empty, so use int.
9931+*/
9932+typedef struct avr32_args
9933+{
9934+ /* Index representing the argument register the current function argument
9935+ will occupy */
9936+ int index;
9937+ /* A mask with bits representing the argument registers: if a bit is set
9938+ then this register is used for an arguemnt */
9939+ int used_index;
9940+ /* TRUE if this function has anonymous arguments */
9941+ int uses_anonymous_args;
9942+ /* The size in bytes of the named arguments pushed on the stack */
9943+ int stack_pushed_args_size;
9944+ /* Set to true if this function needs a Return Value Pointer */
9945+ int use_rvp;
9946+
9947+} CUMULATIVE_ARGS;
9948+
9949+
9950+#define FIRST_CUM_REG_INDEX 0
9951+#define LAST_CUM_REG_INDEX 4
9952+#define GET_REG_INDEX(CUM) ((CUM)->index)
9953+#define SET_REG_INDEX(CUM, INDEX) ((CUM)->index = (INDEX));
9954+#define GET_USED_INDEX(CUM, INDEX) ((CUM)->used_index & (1 << (INDEX)))
9955+#define SET_USED_INDEX(CUM, INDEX) \
9956+ do \
9957+ { \
9958+ if (INDEX >= 0) \
9959+ (CUM)->used_index |= (1 << (INDEX)); \
9960+ } \
9961+ while (0)
9962+#define SET_INDEXES_UNUSED(CUM) ((CUM)->used_index = 0)
9963+
9964+
9965+/*
9966+ A C statement (sans semicolon) for initializing the variable cum for the
9967+ state at the beginning of the argument list. The variable has type
9968+ CUMULATIVE_ARGS. The value of FNTYPE is the tree node for the data type of
9969+ the function which will receive the args, or 0 if the args are to a compiler
9970+ support library function. For direct calls that are not libcalls, FNDECL
9971+ contain the declaration node of the function. FNDECL is also set when
9972+ INIT_CUMULATIVE_ARGS is used to find arguments for the function being
9973+ compiled. N_NAMED_ARGS is set to the number of named arguments, including a
9974+ structure return address if it is passed as a parameter, when making a call.
9975+ When processing incoming arguments, N_NAMED_ARGS is set to -1.
9976+
9977+ When processing a call to a compiler support library function, LIBNAME
9978+ identifies which one. It is a symbol_ref rtx which contains the name of the
9979+ function, as a string. LIBNAME is 0 when an ordinary C function call is
9980+ being processed. Thus, each time this macro is called, either LIBNAME or
9981+ FNTYPE is nonzero, but never both of them at once.
9982+*/
9983+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
9984+ avr32_init_cumulative_args(&(CUM), FNTYPE, LIBNAME, FNDECL)
9985+
9986+
9987+/*
9988+A C statement (sans semicolon) to update the summarizer variable
9989+CUM to advance past an argument in the argument list. The
9990+values MODE, TYPE and NAMED describe that argument.
9991+Once this is done, the variable CUM is suitable for analyzing
9992+the following argument with FUNCTION_ARG, etc.
9993+
9994+This macro need not do anything if the argument in question was passed
9995+on the stack. The compiler knows how to track the amount of stack space
9996+used for arguments without any special help.
9997+*/
9998+#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
9999+ avr32_function_arg_advance(&(CUM), MODE, TYPE, NAMED)
10000+
10001+/*
10002+If defined, a C expression which determines whether, and in which direction,
10003+to pad out an argument with extra space. The value should be of type
10004+enum direction: either 'upward' to pad above the argument,
10005+'downward' to pad below, or 'none' to inhibit padding.
10006+
10007+The amount of padding is always just enough to reach the next
10008+multiple of FUNCTION_ARG_BOUNDARY; this macro does not control
10009+it.
10010+
10011+This macro has a default definition which is right for most systems.
10012+For little-endian machines, the default is to pad upward. For
10013+big-endian machines, the default is to pad downward for an argument of
10014+constant size shorter than an int, and upward otherwise.
10015+*/
10016+#define FUNCTION_ARG_PADDING(MODE, TYPE) \
10017+ avr32_function_arg_padding(MODE, TYPE)
10018+
10019+/*
10020+ Specify padding for the last element of a block move between registers
10021+ and memory. First is nonzero if this is the only element. Defining
10022+ this macro allows better control of register function parameters on
10023+ big-endian machines, without using PARALLEL rtl. In particular,
10024+ MUST_PASS_IN_STACK need not test padding and mode of types in registers,
10025+ as there is no longer a "wrong" part of a register; For example, a three
10026+ byte aggregate may be passed in the high part of a register if so required.
10027+*/
10028+#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
10029+ avr32_function_arg_padding(MODE, TYPE)
10030+
10031+/*
10032+If defined, a C expression which determines whether the default
10033+implementation of va_arg will attempt to pad down before reading the
10034+next argument, if that argument is smaller than its aligned space as
10035+controlled by PARM_BOUNDARY. If this macro is not defined, all such
10036+arguments are padded down if BYTES_BIG_ENDIAN is true.
10037+*/
10038+#define PAD_VARARGS_DOWN \
10039+ (FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward)
10040+
10041+
10042+/*
10043+A C expression that is nonzero if REGNO is the number of a hard
10044+register in which function arguments are sometimes passed. This does
10045+not include implicit arguments such as the static chain and
10046+the structure-value address. On many machines, no registers can be
10047+used for this purpose since all function arguments are pushed on the
10048+stack.
10049+*/
10050+/*
10051+ Use r8 - r12 for function arguments.
10052+*/
10053+#define FUNCTION_ARG_REGNO_P(REGNO) \
10054+ (REGNO >= 3 && REGNO <= 7)
10055+
10056+/* Number of registers used for passing function arguments */
10057+#define NUM_ARG_REGS 5
10058+
10059+/*
10060+If defined, the order in which arguments are loaded into their
10061+respective argument registers is reversed so that the last
10062+argument is loaded first. This macro only affects arguments
10063+passed in registers.
10064+*/
10065+/* #define LOAD_ARGS_REVERSED */
10066+
10067+/** How Scalar Function Values Are Returned **/
10068+
10069+/* AVR32 is using r12 as return register. */
10070+#define RET_REGISTER (15 - 12)
10071+
10072+/*
10073+Define this macro if -traditional should not cause functions
10074+declared to return float to convert the value to double.
10075+*/
10076+/* #define TRADITIONAL_RETURN_FLOAT */
10077+
10078+/*
10079+A C expression to create an RTX representing the place where a
10080+function returns a value of data type VALTYPE. VALTYPE is
10081+a tree node representing a data type. Write TYPE_MODE(VALTYPE)
10082+to get the machine mode used to represent that type.
10083+On many machines, only the mode is relevant. (Actually, on most
10084+machines, scalar values are returned in the same place regardless of
10085+mode).
10086+
10087+The value of the expression is usually a reg RTX for the hard
10088+register where the return value is stored. The value can also be a
10089+parallel RTX, if the return value is in multiple places. See
10090+FUNCTION_ARG for an explanation of the parallel form.
10091+
10092+If PROMOTE_FUNCTION_RETURN is defined, you must apply the same
10093+promotion rules specified in PROMOTE_MODE if VALTYPE is a
10094+scalar type.
10095+
10096+If the precise function being called is known, FUNC is a tree
10097+node (FUNCTION_DECL) for it; otherwise, FUNC is a null
10098+pointer. This makes it possible to use a different value-returning
10099+convention for specific functions when all their calls are
10100+known.
10101+
10102+FUNCTION_VALUE is not used for return vales with aggregate data
10103+types, because these are returned in another way. See
10104+STRUCT_VALUE_REGNUM and related macros, below.
10105+*/
10106+#define FUNCTION_VALUE(VALTYPE, FUNC) avr32_function_value(VALTYPE, FUNC)
10107+
10108+
10109+/*
10110+A C expression to create an RTX representing the place where a library
10111+function returns a value of mode MODE. If the precise function
10112+being called is known, FUNC is a tree node
10113+(FUNCTION_DECL) for it; otherwise, func is a null
10114+pointer. This makes it possible to use a different value-returning
10115+convention for specific functions when all their calls are
10116+known.
10117+
10118+Note that "library function" in this context means a compiler
10119+support routine, used to perform arithmetic, whose name is known
10120+specially by the compiler and was not mentioned in the C code being
10121+compiled.
10122+
10123+The definition of LIBRARY_VALUE need not be concerned aggregate
10124+data types, because none of the library functions returns such types.
10125+*/
10126+#define LIBCALL_VALUE(MODE) avr32_libcall_value(MODE)
10127+
10128+/*
10129+A C expression that is nonzero if REGNO is the number of a hard
10130+register in which the values of called function may come back.
10131+
10132+A register whose use for returning values is limited to serving as the
10133+second of a pair (for a value of type double, say) need not be
10134+recognized by this macro. So for most machines, this definition
10135+suffices:
10136+ #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
10137+
10138+If the machine has register windows, so that the caller and the called
10139+function use different registers for the return value, this macro
10140+should recognize only the caller's register numbers.
10141+*/
10142+/*
10143+ When returning a value of mode DImode, r11:r10 is used, else r12 is used.
10144+*/
10145+#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RET_REGISTER \
10146+ || (REGNO) == INTERNAL_REGNUM(11))
10147+
10148+
10149+/** How Large Values Are Returned **/
10150+
10151+
10152+/*
10153+Define this macro to be 1 if all structure and union return values must be
10154+in memory. Since this results in slower code, this should be defined
10155+only if needed for compatibility with other compilers or with an ABI.
10156+If you define this macro to be 0, then the conventions used for structure
10157+and union return values are decided by the RETURN_IN_MEMORY macro.
10158+
10159+If not defined, this defaults to the value 1.
10160+*/
10161+#define DEFAULT_PCC_STRUCT_RETURN 0
10162+
10163+
10164+
10165+
10166+/** Generating Code for Profiling **/
10167+
10168+/*
10169+A C statement or compound statement to output to FILE some
10170+assembler code to call the profiling subroutine mcount.
10171+
10172+The details of how mcount expects to be called are determined by
10173+your operating system environment, not by GCC. To figure them out,
10174+compile a small program for profiling using the system's installed C
10175+compiler and look at the assembler code that results.
10176+
10177+Older implementations of mcount expect the address of a counter
10178+variable to be loaded into some register. The name of this variable is
10179+'LP' followed by the number LABELNO, so you would generate
10180+the name using 'LP%d' in a fprintf.
10181+*/
10182+/* ToDo: fixme */
10183+#ifndef FUNCTION_PROFILER
10184+#define FUNCTION_PROFILER(FILE, LABELNO) \
10185+ fprintf((FILE), "/* profiler %d */", (LABELNO))
10186+#endif
10187+
10188+
10189+/*****************************************************************************
10190+ * Trampolines for Nested Functions *
10191+ *****************************************************************************/
10192+
10193+/*
10194+A C statement to output, on the stream FILE, assembler code for a
10195+block of data that contains the constant parts of a trampoline. This
10196+code should not include a label - the label is taken care of
10197+automatically.
10198+
10199+If you do not define this macro, it means no template is needed
10200+for the target. Do not define this macro on systems where the block move
10201+code to copy the trampoline into place would be larger than the code
10202+to generate it on the spot.
10203+*/
10204+/* ToDo: correct? */
10205+#define TRAMPOLINE_TEMPLATE(FILE) avr32_trampoline_template(FILE);
10206+
10207+
10208+/*
10209+A C expression for the size in bytes of the trampoline, as an integer.
10210+*/
10211+/* ToDo: fixme */
10212+#define TRAMPOLINE_SIZE 0x0C
10213+
10214+/*
10215+Alignment required for trampolines, in bits.
10216+
10217+If you don't define this macro, the value of BIGGEST_ALIGNMENT
10218+is used for aligning trampolines.
10219+*/
10220+#define TRAMPOLINE_ALIGNMENT 16
10221+
10222+/*
10223+A C statement to initialize the variable parts of a trampoline.
10224+ADDR is an RTX for the address of the trampoline; FNADDR is
10225+an RTX for the address of the nested function; STATIC_CHAIN is an
10226+RTX for the static chain value that should be passed to the function
10227+when it is called.
10228+*/
10229+#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
10230+ avr32_initialize_trampoline(ADDR, FNADDR, STATIC_CHAIN)
10231+
10232+
10233+/******************************************************************************
10234+ * Implicit Calls to Library Routines
10235+ *****************************************************************************/
10236+
10237+/* Tail calling. */
10238+
10239+/* A C expression that evaluates to true if it is ok to perform a sibling
10240+ call to DECL. */
10241+#define FUNCTION_OK_FOR_SIBCALL(DECL) 0
10242+
10243+#define OVERRIDE_OPTIONS avr32_override_options ()
10244+
10245+
10246+
10247+/******************************************************************************
10248+ * Addressing Modes
10249+ *****************************************************************************/
10250+
10251+/*
10252+A C expression that is nonzero if the machine supports pre-increment,
10253+pre-decrement, post-increment, or post-decrement addressing respectively.
10254+*/
10255+/*
10256+ AVR32 supports Rp++ and --Rp
10257+*/
10258+#define HAVE_PRE_INCREMENT 0
10259+#define HAVE_PRE_DECREMENT 1
10260+#define HAVE_POST_INCREMENT 1
10261+#define HAVE_POST_DECREMENT 0
10262+
10263+/*
10264+A C expression that is nonzero if the machine supports pre- or
10265+post-address side-effect generation involving constants other than
10266+the size of the memory operand.
10267+*/
10268+#define HAVE_PRE_MODIFY_DISP 0
10269+#define HAVE_POST_MODIFY_DISP 0
10270+
10271+/*
10272+A C expression that is nonzero if the machine supports pre- or
10273+post-address side-effect generation involving a register displacement.
10274+*/
10275+#define HAVE_PRE_MODIFY_REG 0
10276+#define HAVE_POST_MODIFY_REG 0
10277+
10278+/*
10279+A C expression that is 1 if the RTX X is a constant which
10280+is a valid address. On most machines, this can be defined as
10281+CONSTANT_P (X), but a few machines are more restrictive
10282+in which constant addresses are supported.
10283+
10284+CONSTANT_P accepts integer-values expressions whose values are
10285+not explicitly known, such as symbol_ref, label_ref, and
10286+high expressions and const arithmetic expressions, in
10287+addition to const_int and const_double expressions.
10288+*/
10289+#define CONSTANT_ADDRESS_P(X) CONSTANT_P(X)
10290+
10291+/*
10292+A number, the maximum number of registers that can appear in a valid
10293+memory address. Note that it is up to you to specify a value equal to
10294+the maximum number that GO_IF_LEGITIMATE_ADDRESS would ever
10295+accept.
10296+*/
10297+#define MAX_REGS_PER_ADDRESS 2
10298+
10299+/*
10300+A C compound statement with a conditional goto LABEL;
10301+executed if X (an RTX) is a legitimate memory address on the
10302+target machine for a memory operand of mode MODE.
10303+
10304+It usually pays to define several simpler macros to serve as
10305+subroutines for this one. Otherwise it may be too complicated to
10306+understand.
10307+
10308+This macro must exist in two variants: a strict variant and a
10309+non-strict one. The strict variant is used in the reload pass. It
10310+must be defined so that any pseudo-register that has not been
10311+allocated a hard register is considered a memory reference. In
10312+contexts where some kind of register is required, a pseudo-register
10313+with no hard register must be rejected.
10314+
10315+The non-strict variant is used in other passes. It must be defined to
10316+accept all pseudo-registers in every context where some kind of
10317+register is required.
10318+
10319+Compiler source files that want to use the strict variant of this
10320+macro define the macro REG_OK_STRICT. You should use an
10321+#ifdef REG_OK_STRICT conditional to define the strict variant
10322+in that case and the non-strict variant otherwise.
10323+
10324+Subroutines to check for acceptable registers for various purposes (one
10325+for base registers, one for index registers, and so on) are typically
10326+among the subroutines used to define GO_IF_LEGITIMATE_ADDRESS.
10327+Then only these subroutine macros need have two variants; the higher
10328+levels of macros may be the same whether strict or not.
10329+
10330+Normally, constant addresses which are the sum of a symbol_ref
10331+and an integer are stored inside a const RTX to mark them as
10332+constant. Therefore, there is no need to recognize such sums
10333+specifically as legitimate addresses. Normally you would simply
10334+recognize any const as legitimate.
10335+
10336+Usually PRINT_OPERAND_ADDRESS is not prepared to handle constant
10337+sums that are not marked with const. It assumes that a naked
10338+plus indicates indexing. If so, then you must reject such
10339+naked constant sums as illegitimate addresses, so that none of them will
10340+be given to PRINT_OPERAND_ADDRESS.
10341+
10342+On some machines, whether a symbolic address is legitimate depends on
10343+the section that the address refers to. On these machines, define the
10344+macro ENCODE_SECTION_INFO to store the information into the
10345+symbol_ref, and then check for it here. When you see a
10346+const, you will have to look inside it to find the
10347+symbol_ref in order to determine the section.
10348+
10349+The best way to modify the name string is by adding text to the
10350+beginning, with suitable punctuation to prevent any ambiguity. Allocate
10351+the new name in saveable_obstack. You will have to modify
10352+ASM_OUTPUT_LABELREF to remove and decode the added text and
10353+output the name accordingly, and define STRIP_NAME_ENCODING to
10354+access the original name string.
10355+
10356+You can check the information stored here into the symbol_ref in
10357+the definitions of the macros GO_IF_LEGITIMATE_ADDRESS and
10358+PRINT_OPERAND_ADDRESS.
10359+*/
10360+#ifdef REG_OK_STRICT
10361+# define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
10362+ do \
10363+ { \
10364+ if (avr32_legitimate_address(MODE, X, 1)) \
10365+ goto LABEL; \
10366+ } \
10367+ while (0)
10368+#else
10369+# define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
10370+ do \
10371+ { \
10372+ if (avr32_legitimate_address(MODE, X, 0)) \
10373+ goto LABEL; \
10374+ } \
10375+ while (0)
10376+#endif
10377+
10378+/*
10379+A C expression that is nonzero if X (assumed to be a reg
10380+RTX) is valid for use as a base register. For hard registers, it
10381+should always accept those which the hardware permits and reject the
10382+others. Whether the macro accepts or rejects pseudo registers must be
10383+controlled by REG_OK_STRICT as described above. This usually
10384+requires two variant definitions, of which REG_OK_STRICT
10385+controls the one actually used.
10386+*/
10387+#ifdef REG_OK_STRICT
10388+# define REG_OK_FOR_BASE_P(X) \
10389+ REGNO_OK_FOR_BASE_P(REGNO(X))
10390+#else
10391+# define REG_OK_FOR_BASE_P(X) \
10392+ ((REGNO(X) <= LAST_REGNUM) || (REGNO(X) >= FIRST_PSEUDO_REGISTER))
10393+#endif
10394+
10395+
10396+/*
10397+A C expression that is nonzero if X (assumed to be a reg
10398+RTX) is valid for use as an index register.
10399+
10400+The difference between an index register and a base register is that
10401+the index register may be scaled. If an address involves the sum of
10402+two registers, neither one of them scaled, then either one may be
10403+labeled the "base" and the other the "index"; but whichever
10404+labeling is used must fit the machine's constraints of which registers
10405+may serve in each capacity. The compiler will try both labelings,
10406+looking for one that is valid, and will reload one or both registers
10407+only if neither labeling works.
10408+*/
10409+#define REG_OK_FOR_INDEX_P(X) \
10410+ REG_OK_FOR_BASE_P(X)
10411+
10412+
10413+/*
10414+A C compound statement that attempts to replace X with a valid
10415+memory address for an operand of mode MODE. win will be a
10416+C statement label elsewhere in the code; the macro definition may use
10417+
10418+ GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
10419+
10420+to avoid further processing if the address has become legitimate.
10421+
10422+X will always be the result of a call to break_out_memory_refs,
10423+and OLDX will be the operand that was given to that function to produce
10424+X.
10425+
10426+The code generated by this macro should not alter the substructure of
10427+X. If it transforms X into a more legitimate form, it
10428+should assign X (which will always be a C variable) a new value.
10429+
10430+It is not necessary for this macro to come up with a legitimate
10431+address. The compiler has standard ways of doing so in all cases. In
10432+fact, it is safe for this macro to do nothing. But often a
10433+machine-dependent strategy can generate better code.
10434+*/
10435+#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
10436+ do \
10437+ { \
10438+ if (GET_CODE(X) == PLUS \
10439+ && GET_CODE(XEXP(X, 0)) == REG \
10440+ && GET_CODE(XEXP(X, 1)) == CONST_INT \
10441+ && !CONST_OK_FOR_CONSTRAINT_P(INTVAL(XEXP(X, 1)), \
10442+ 'K', "Ks16")) \
10443+ { \
10444+ rtx index = force_reg(SImode, XEXP(X, 1)); \
10445+ X = gen_rtx_PLUS( SImode, XEXP(X, 0), index); \
10446+ } \
10447+ GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN); \
10448+ } \
10449+ while(0)
10450+
10451+
10452+/*
10453+A C statement or compound statement with a conditional
10454+goto LABEL; executed if memory address X (an RTX) can have
10455+different meanings depending on the machine mode of the memory
10456+reference it is used for or if the address is valid for some modes
10457+but not others.
10458+
10459+Autoincrement and autodecrement addresses typically have mode-dependent
10460+effects because the amount of the increment or decrement is the size
10461+of the operand being addressed. Some machines have other mode-dependent
10462+addresses. Many RISC machines have no mode-dependent addresses.
10463+
10464+You may assume that ADDR is a valid address for the machine.
10465+*/
10466+#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
10467+ do \
10468+ { \
10469+ if (GET_CODE (ADDR) == POST_INC \
10470+ || GET_CODE (ADDR) == PRE_DEC) \
10471+ goto LABEL; \
10472+ } \
10473+ while (0)
10474+
10475+/*
10476+A C expression that is nonzero if X is a legitimate constant for
10477+an immediate operand on the target machine. You can assume that
10478+X satisfies CONSTANT_P, so you need not check this. In fact,
10479+'1' is a suitable definition for this macro on machines where
10480+anything CONSTANT_P is valid.
10481+*/
10482+#define LEGITIMATE_CONSTANT_P(X) avr32_legitimate_constant_p(X)
10483+
10484+
10485+/******************************************************************************
10486+ * Condition Code Status
10487+ *****************************************************************************/
10488+
10489+#define HAVE_conditional_move 1
10490+
10491+/*
10492+C code for a data type which is used for declaring the mdep
10493+component of cc_status. It defaults to int.
10494+
10495+This macro is not used on machines that do not use cc0.
10496+*/
10497+
10498+typedef struct
10499+{
10500+ int flags;
10501+ rtx value;
10502+ int fpflags;
10503+ rtx fpvalue;
10504+} avr32_status_reg;
10505+
10506+
10507+#define CC_STATUS_MDEP avr32_status_reg
10508+
10509+/*
10510+A C expression to initialize the mdep field to "empty".
10511+The default definition does nothing, since most machines don't use
10512+the field anyway. If you want to use the field, you should probably
10513+define this macro to initialize it.
10514+
10515+This macro is not used on machines that do not use cc0.
10516+*/
10517+
10518+#define CC_STATUS_MDEP_INIT \
10519+ (cc_status.mdep.flags = CC_NONE , cc_status.mdep.value = 0)
10520+
10521+#define FPCC_STATUS_INIT \
10522+ (cc_status.mdep.fpflags = CC_NONE , cc_status.mdep.fpvalue = 0)
10523+
10524+/*
10525+A C compound statement to set the components of cc_status
10526+appropriately for an insn INSN whose body is EXP. It is
10527+this macro's responsibility to recognize insns that set the condition
10528+code as a byproduct of other activity as well as those that explicitly
10529+set (cc0).
10530+
10531+This macro is not used on machines that do not use cc0.
10532+
10533+If there are insns that do not set the condition code but do alter
10534+other machine registers, this macro must check to see whether they
10535+invalidate the expressions that the condition code is recorded as
10536+reflecting. For example, on the 68000, insns that store in address
10537+registers do not set the condition code, which means that usually
10538+NOTICE_UPDATE_CC can leave cc_status unaltered for such
10539+insns. But suppose that the previous insn set the condition code
10540+based on location 'a4@@(102)' and the current insn stores a new
10541+value in 'a4'. Although the condition code is not changed by
10542+this, it will no longer be true that it reflects the contents of
10543+'a4@@(102)'. Therefore, NOTICE_UPDATE_CC must alter
10544+cc_status in this case to say that nothing is known about the
10545+condition code value.
10546+
10547+The definition of NOTICE_UPDATE_CC must be prepared to deal
10548+with the results of peephole optimization: insns whose patterns are
10549+parallel RTXs containing various reg, mem or
10550+constants which are just the operands. The RTL structure of these
10551+insns is not sufficient to indicate what the insns actually do. What
10552+NOTICE_UPDATE_CC should do when it sees one is just to run
10553+CC_STATUS_INIT.
10554+
10555+A possible definition of NOTICE_UPDATE_CC is to call a function
10556+that looks at an attribute (see Insn Attributes) named, for example,
10557+'cc'. This avoids having detailed information about patterns in
10558+two places, the 'md' file and in NOTICE_UPDATE_CC.
10559+*/
10560+
10561+#define NOTICE_UPDATE_CC(EXP, INSN) avr32_notice_update_cc(EXP, INSN)
10562+
10563+
10564+
10565+
10566+/******************************************************************************
10567+ * Describing Relative Costs of Operations
10568+ *****************************************************************************/
10569+
10570+
10571+
10572+/*
10573+A C expression for the cost of moving data of mode MODE from a
10574+register in class FROM to one in class TO. The classes are
10575+expressed using the enumeration values such as GENERAL_REGS. A
10576+value of 2 is the default; other values are interpreted relative to
10577+that.
10578+
10579+It is not required that the cost always equal 2 when FROM is the
10580+same as TO; on some machines it is expensive to move between
10581+registers if they are not general registers.
10582+
10583+If reload sees an insn consisting of a single set between two
10584+hard registers, and if REGISTER_MOVE_COST applied to their
10585+classes returns a value of 2, reload does not check to ensure that the
10586+constraints of the insn are met. Setting a cost of other than 2 will
10587+allow reload to verify that the constraints are met. You should do this
10588+if the movm pattern's constraints do not allow such copying.
10589+*/
10590+#define REGISTER_MOVE_COST(MODE, FROM, TO) \
10591+ ((GET_MODE_SIZE(MODE) <= 4) ? 2: \
10592+ (GET_MODE_SIZE(MODE) <= 8) ? 3: \
10593+ 4)
10594+
10595+/*
10596+A C expression for the cost of moving data of mode MODE between a
10597+register of class CLASS and memory; IN is zero if the value
10598+is to be written to memory, nonzero if it is to be read in. This cost
10599+is relative to those in REGISTER_MOVE_COST. If moving between
10600+registers and memory is more expensive than between two registers, you
10601+should define this macro to express the relative cost.
10602+
10603+If you do not define this macro, GCC uses a default cost of 4 plus
10604+the cost of copying via a secondary reload register, if one is
10605+needed. If your machine requires a secondary reload register to copy
10606+between memory and a register of CLASS but the reload mechanism is
10607+more complex than copying via an intermediate, define this macro to
10608+reflect the actual cost of the move.
10609+
10610+GCC defines the function memory_move_secondary_cost if
10611+secondary reloads are needed. It computes the costs due to copying via
10612+a secondary register. If your machine copies from memory using a
10613+secondary register in the conventional way but the default base value of
10614+4 is not correct for your machine, define this macro to add some other
10615+value to the result of that function. The arguments to that function
10616+are the same as to this macro.
10617+*/
10618+/*
10619+ Memory moves are costly
10620+*/
10621+#define MEMORY_MOVE_COST(MODE, CLASS, IN) 10
10622+/*
10623+ (((IN) ? ((GET_MODE_SIZE(MODE) < 4) ? 4 : \
10624+ (GET_MODE_SIZE(MODE) > 8) ? 6 : \
10625+ 3) \
10626+ : ((GET_MODE_SIZE(MODE) > 8) ? 4 : 2)))
10627+*/
10628+
10629+/*
10630+A C expression for the cost of a branch instruction. A value of 1 is
10631+the default; other values are interpreted relative to that.
10632+*/
10633+ /* Try to use conditionals as much as possible */
10634+#define BRANCH_COST (TARGET_BRANCH_PRED ? 3 : 5)
10635+
10636+/*A C expression for the maximum number of instructions to execute via conditional
10637+ execution instructions instead of a branch. A value of BRANCH_COST+1 is the default
10638+ if the machine does not use cc0, and 1 if it does use cc0.*/
10639+#define MAX_CONDITIONAL_EXECUTE 3
10640+
10641+/*
10642+Define this macro as a C expression which is nonzero if accessing less
10643+than a word of memory (i.e.: a char or a short) is no
10644+faster than accessing a word of memory, i.e., if such access
10645+require more than one instruction or if there is no difference in cost
10646+between byte and (aligned) word loads.
10647+
10648+When this macro is not defined, the compiler will access a field by
10649+finding the smallest containing object; when it is defined, a fullword
10650+load will be used if alignment permits. Unless bytes accesses are
10651+faster than word accesses, using word accesses is preferable since it
10652+may eliminate subsequent memory access if subsequent accesses occur to
10653+other fields in the same word of the structure, but to different bytes.
10654+*/
10655+#define SLOW_BYTE_ACCESS 1
10656+
10657+
10658+/*
10659+Define this macro if it is as good or better to call a constant
10660+function address than to call an address kept in a register.
10661+*/
10662+#define NO_FUNCTION_CSE
10663+
10664+
10665+/******************************************************************************
10666+ * Adjusting the Instruction Scheduler
10667+ *****************************************************************************/
10668+
10669+/*****************************************************************************
10670+ * Dividing the Output into Sections (Texts, Data, ...) *
10671+ *****************************************************************************/
10672+
10673+/*
10674+A C expression whose value is a string, including spacing, containing the
10675+assembler operation that should precede instructions and read-only data.
10676+Normally "\t.text" is right.
10677+*/
10678+#define TEXT_SECTION_ASM_OP "\t.text"
10679+/*
10680+A C statement that switches to the default section containing instructions.
10681+Normally this is not needed, as simply defining TEXT_SECTION_ASM_OP
10682+is enough. The MIPS port uses this to sort all functions after all data
10683+declarations.
10684+*/
10685+/* #define TEXT_SECTION */
10686+
10687+/*
10688+A C expression whose value is a string, including spacing, containing the
10689+assembler operation to identify the following data as writable initialized
10690+data. Normally "\t.data" is right.
10691+*/
10692+#define DATA_SECTION_ASM_OP "\t.data"
10693+
10694+/*
10695+If defined, a C expression whose value is a string, including spacing,
10696+containing the assembler operation to identify the following data as
10697+shared data. If not defined, DATA_SECTION_ASM_OP will be used.
10698+*/
10699+
10700+/*
10701+A C expression whose value is a string, including spacing, containing
10702+the assembler operation to identify the following data as read-only
10703+initialized data.
10704+*/
10705+#undef READONLY_DATA_SECTION_ASM_OP
10706+#define READONLY_DATA_SECTION_ASM_OP \
10707+ ((target_flags & USE_RODATA_SECTION) ? \
10708+ "\t.section\t.rodata" : \
10709+ TEXT_SECTION_ASM_OP )
10710+
10711+
10712+/*
10713+If defined, a C expression whose value is a string, including spacing,
10714+containing the assembler operation to identify the following data as
10715+uninitialized global data. If not defined, and neither
10716+ASM_OUTPUT_BSS nor ASM_OUTPUT_ALIGNED_BSS are defined,
10717+uninitialized global data will be output in the data section if
10718+-fno-common is passed, otherwise ASM_OUTPUT_COMMON will be
10719+used.
10720+*/
10721+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
10722+
10723+/*
10724+If defined, a C expression whose value is a string, including spacing,
10725+containing the assembler operation to identify the following data as
10726+uninitialized global shared data. If not defined, and
10727+BSS_SECTION_ASM_OP is, the latter will be used.
10728+*/
10729+/*#define SHARED_BSS_SECTION_ASM_OP "\trseg\tshared_bbs_section:data:noroot(0)\n"*/
10730+/*
10731+If defined, a C expression whose value is a string, including spacing,
10732+containing the assembler operation to identify the following data as
10733+initialization code. If not defined, GCC will assume such a section does
10734+not exist.
10735+*/
10736+#undef INIT_SECTION_ASM_OP
10737+#define INIT_SECTION_ASM_OP "\t.section\t.init"
10738+
10739+/*
10740+If defined, a C expression whose value is a string, including spacing,
10741+containing the assembler operation to identify the following data as
10742+finalization code. If not defined, GCC will assume such a section does
10743+not exist.
10744+*/
10745+#undef FINI_SECTION_ASM_OP
10746+#define FINI_SECTION_ASM_OP "\t.section\t.fini"
10747+
10748+/*
10749+If defined, an ASM statement that switches to a different section
10750+via SECTION_OP, calls FUNCTION, and switches back to
10751+the text section. This is used in crtstuff.c if
10752+INIT_SECTION_ASM_OP or FINI_SECTION_ASM_OP to calls
10753+to initialization and finalization functions from the init and fini
10754+sections. By default, this macro uses a simple function call. Some
10755+ports need hand-crafted assembly code to avoid dependencies on
10756+registers initialized in the function prologue or to ensure that
10757+constant pools don't end up too far way in the text section.
10758+*/
10759+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
10760+ asm ( SECTION_OP "\n" \
10761+ "mcall r6[" USER_LABEL_PREFIX #FUNC "@got]\n" \
10762+ TEXT_SECTION_ASM_OP);
10763+
10764+
10765+/*
10766+Define this macro to be an expression with a nonzero value if jump
10767+tables (for tablejump insns) should be output in the text
10768+section, along with the assembler instructions. Otherwise, the
10769+readonly data section is used.
10770+
10771+This macro is irrelevant if there is no separate readonly data section.
10772+*/
10773+#define JUMP_TABLES_IN_TEXT_SECTION 1
10774+
10775+
10776+/******************************************************************************
10777+ * Position Independent Code (PIC)
10778+ *****************************************************************************/
10779+
10780+#ifndef AVR32_ALWAYS_PIC
10781+#define AVR32_ALWAYS_PIC 0
10782+#endif
10783+
10784+/* GOT is set to r6 */
10785+#define PIC_OFFSET_TABLE_REGNUM INTERNAL_REGNUM(6)
10786+
10787+/*
10788+A C expression that is nonzero if X is a legitimate immediate
10789+operand on the target machine when generating position independent code.
10790+You can assume that X satisfies CONSTANT_P, so you need not
10791+check this. You can also assume flag_pic is true, so you need not
10792+check it either. You need not define this macro if all constants
10793+(including SYMBOL_REF) can be immediate operands when generating
10794+position independent code.
10795+*/
10796+/* We can't directly access anything that contains a symbol,
10797+ nor can we indirect via the constant pool. */
10798+#define LEGITIMATE_PIC_OPERAND_P(X) avr32_legitimate_pic_operand_p(X)
10799+
10800+
10801+/* We need to know when we are making a constant pool; this determines
10802+ whether data needs to be in the GOT or can be referenced via a GOT
10803+ offset. */
10804+extern int making_const_table;
10805+
10806+/******************************************************************************
10807+ * Defining the Output Assembler Language
10808+ *****************************************************************************/
10809+
10810+
10811+/*
10812+A C string constant describing how to begin a comment in the target
10813+assembler language. The compiler assumes that the comment will end at
10814+the end of the line.
10815+*/
10816+#define ASM_COMMENT_START "# "
10817+
10818+/*
10819+A C string constant for text to be output before each asm
10820+statement or group of consecutive ones. Normally this is
10821+"#APP", which is a comment that has no effect on most
10822+assemblers but tells the GNU assembler that it must check the lines
10823+that follow for all valid assembler constructs.
10824+*/
10825+#undef ASM_APP_ON
10826+#define ASM_APP_ON "#APP\n"
10827+
10828+/*
10829+A C string constant for text to be output after each asm
10830+statement or group of consecutive ones. Normally this is
10831+"#NO_APP", which tells the GNU assembler to resume making the
10832+time-saving assumptions that are valid for ordinary compiler output.
10833+*/
10834+#undef ASM_APP_OFF
10835+#define ASM_APP_OFF "#NO_APP\n"
10836+
10837+
10838+
10839+#define FILE_ASM_OP "\t.file\n"
10840+#define IDENT_ASM_OP "\t.ident\t"
10841+#define SET_ASM_OP "\t.set\t"
10842+
10843+
10844+/*
10845+ * Output assembly directives to switch to section name. The section
10846+ * should have attributes as specified by flags, which is a bit mask
10847+ * of the SECTION_* flags defined in 'output.h'. If align is nonzero,
10848+ * it contains an alignment in bytes to be used for the section,
10849+ * otherwise some target default should be used. Only targets that
10850+ * must specify an alignment within the section directive need pay
10851+ * attention to align -- we will still use ASM_OUTPUT_ALIGN.
10852+ *
10853+ * NOTE: This one must not be moved to avr32.c
10854+ */
10855+#undef TARGET_ASM_NAMED_SECTION
10856+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
10857+
10858+
10859+/*
10860+You may define this macro as a C expression. You should define the
10861+expression to have a nonzero value if GCC should output the constant
10862+pool for a function before the code for the function, or a zero value if
10863+GCC should output the constant pool after the function. If you do
10864+not define this macro, the usual case, GCC will output the constant
10865+pool before the function.
10866+*/
10867+#define CONSTANT_POOL_BEFORE_FUNCTION 0
10868+
10869+
10870+/*
10871+Define this macro as a C expression which is nonzero if the constant
10872+EXP, of type tree, should be output after the code for a
10873+function. The compiler will normally output all constants before the
10874+function; you need not define this macro if this is OK.
10875+*/
10876+#define CONSTANT_AFTER_FUNCTION_P(EXP) 1
10877+
10878+
10879+/*
10880+Define this macro as a C expression which is nonzero if C is
10881+used as a logical line separator by the assembler.
10882+
10883+If you do not define this macro, the default is that only
10884+the character ';' is treated as a logical line separator.
10885+*/
10886+#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n')
10887+
10888+
10889+/** Output of Uninitialized Variables **/
10890+
10891+/*
10892+A C statement (sans semicolon) to output to the stdio stream
10893+STREAM the assembler definition of a common-label named
10894+NAME whose size is SIZE bytes. The variable ROUNDED
10895+is the size rounded up to whatever alignment the caller wants.
10896+
10897+Use the expression assemble_name(STREAM, NAME) to
10898+output the name itself; before and after that, output the additional
10899+assembler syntax for defining the name, and a newline.
10900+
10901+This macro controls how the assembler definitions of uninitialized
10902+common global variables are output.
10903+*/
10904+/*
10905+#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
10906+ avr32_asm_output_common(STREAM, NAME, SIZE, ROUNDED)
10907+*/
10908+
10909+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
10910+ do \
10911+ { \
10912+ fputs ("\t.comm ", (FILE)); \
10913+ assemble_name ((FILE), (NAME)); \
10914+ fprintf ((FILE), ",%d\n", (SIZE)); \
10915+ } \
10916+ while (0)
10917+
10918+/*
10919+ * Like ASM_OUTPUT_BSS except takes the required alignment as a
10920+ * separate, explicit argument. If you define this macro, it is used
10921+ * in place of ASM_OUTPUT_BSS, and gives you more flexibility in
10922+ * handling the required alignment of the variable. The alignment is
10923+ * specified as the number of bits.
10924+ *
10925+ * Try to use function asm_output_aligned_bss defined in file varasm.c
10926+ * when defining this macro.
10927+ */
10928+#define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
10929+ asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGNMENT)
10930+
10931+/*
10932+A C statement (sans semicolon) to output to the stdio stream
10933+STREAM the assembler definition of a local-common-label named
10934+NAME whose size is SIZE bytes. The variable ROUNDED
10935+is the size rounded up to whatever alignment the caller wants.
10936+
10937+Use the expression assemble_name(STREAM, NAME) to
10938+output the name itself; before and after that, output the additional
10939+assembler syntax for defining the name, and a newline.
10940+
10941+This macro controls how the assembler definitions of uninitialized
10942+static variables are output.
10943+*/
10944+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
10945+ do \
10946+ { \
10947+ fputs ("\t.lcomm ", (FILE)); \
10948+ assemble_name ((FILE), (NAME)); \
10949+ fprintf ((FILE), ",%d, %d\n", (SIZE), 2); \
10950+ } \
10951+ while (0)
10952+
10953+
10954+/*
10955+A C statement (sans semicolon) to output to the stdio stream
10956+STREAM the assembler definition of a label named NAME.
10957+Use the expression assemble_name(STREAM, NAME) to
10958+output the name itself; before and after that, output the additional
10959+assembler syntax for defining the name, and a newline.
10960+*/
10961+#define ASM_OUTPUT_LABEL(STREAM, NAME) avr32_asm_output_label(STREAM, NAME)
10962+
10963+/* A C string containing the appropriate assembler directive to
10964+ * specify the size of a symbol, without any arguments. On systems
10965+ * that use ELF, the default (in 'config/elfos.h') is '"\t.size\t"';
10966+ * on other systems, the default is not to define this macro.
10967+ *
10968+ * Define this macro only if it is correct to use the default
10969+ * definitions of ASM_ OUTPUT_SIZE_DIRECTIVE and
10970+ * ASM_OUTPUT_MEASURED_SIZE for your system. If you need your own
10971+ * custom definitions of those macros, or if you do not need explicit
10972+ * symbol sizes at all, do not define this macro.
10973+ */
10974+#define SIZE_ASM_OP "\t.size\t"
10975+
10976+
10977+/*
10978+A C statement (sans semicolon) to output to the stdio stream
10979+STREAM some commands that will make the label NAME global;
10980+that is, available for reference from other files. Use the expression
10981+assemble_name(STREAM, NAME) to output the name
10982+itself; before and after that, output the additional assembler syntax
10983+for making that name global, and a newline.
10984+*/
10985+#define GLOBAL_ASM_OP "\t.globl\t"
10986+
10987+
10988+
10989+/*
10990+A C expression which evaluates to true if the target supports weak symbols.
10991+
10992+If you don't define this macro, defaults.h provides a default
10993+definition. If either ASM_WEAKEN_LABEL or ASM_WEAKEN_DECL
10994+is defined, the default definition is '1'; otherwise, it is
10995+'0'. Define this macro if you want to control weak symbol support
10996+with a compiler flag such as -melf.
10997+*/
10998+#define SUPPORTS_WEAK 1
10999+
11000+/*
11001+A C statement (sans semicolon) to output to the stdio stream
11002+STREAM a reference in assembler syntax to a label named
11003+NAME. This should add '_' to the front of the name, if that
11004+is customary on your operating system, as it is in most Berkeley Unix
11005+systems. This macro is used in assemble_name.
11006+*/
11007+#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
11008+ avr32_asm_output_labelref(STREAM, NAME)
11009+
11010+
11011+
11012+/*
11013+A C expression to assign to OUTVAR (which is a variable of type
11014+char *) a newly allocated string made from the string
11015+NAME and the number NUMBER, with some suitable punctuation
11016+added. Use alloca to get space for the string.
11017+
11018+The string will be used as an argument to ASM_OUTPUT_LABELREF to
11019+produce an assembler label for an internal static variable whose name is
11020+NAME. Therefore, the string must be such as to result in valid
11021+assembler code. The argument NUMBER is different each time this
11022+macro is executed; it prevents conflicts between similarly-named
11023+internal static variables in different scopes.
11024+
11025+Ideally this string should not be a valid C identifier, to prevent any
11026+conflict with the user's own symbols. Most assemblers allow periods
11027+or percent signs in assembler symbols; putting at least one of these
11028+between the name and the number will suffice.
11029+*/
11030+#define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \
11031+ do \
11032+ { \
11033+ (OUTVAR) = (char *) alloca (strlen ((NAME)) + 10); \
11034+ sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)); \
11035+ } \
11036+ while (0)
11037+
11038+
11039+/** Macros Controlling Initialization Routines **/
11040+
11041+
11042+/*
11043+If defined, main will not call __main as described above.
11044+This macro should be defined for systems that control start-up code
11045+on a symbol-by-symbol basis, such as OSF/1, and should not
11046+be defined explicitly for systems that support INIT_SECTION_ASM_OP.
11047+*/
11048+/*
11049+ __main is not defined when debugging.
11050+*/
11051+#define HAS_INIT_SECTION
11052+
11053+
11054+/** Output of Assembler Instructions **/
11055+
11056+/*
11057+A C initializer containing the assembler's names for the machine
11058+registers, each one as a C string constant. This is what translates
11059+register numbers in the compiler into assembler language.
11060+*/
11061+
11062+#define REGISTER_NAMES \
11063+{ \
11064+ "pc", "lr", \
11065+ "sp", "r12", \
11066+ "r11", "r10", \
11067+ "r9", "r8", \
11068+ "r7", "r6", \
11069+ "r5", "r4", \
11070+ "r3", "r2", \
11071+ "r1", "r0", \
11072+ "f15","f14", \
11073+ "f13","f12", \
11074+ "f11","f10", \
11075+ "f9", "f8", \
11076+ "f7", "f6", \
11077+ "f5", "f4", \
11078+ "f3", "f2", \
11079+ "f1", "f0" \
11080+}
11081+
11082+/*
11083+A C compound statement to output to stdio stream STREAM the
11084+assembler syntax for an instruction operand X. X is an
11085+RTL expression.
11086+
11087+CODE is a value that can be used to specify one of several ways
11088+of printing the operand. It is used when identical operands must be
11089+printed differently depending on the context. CODE comes from
11090+the '%' specification that was used to request printing of the
11091+operand. If the specification was just '%digit' then
11092+CODE is 0; if the specification was '%ltr digit'
11093+then CODE is the ASCII code for ltr.
11094+
11095+If X is a register, this macro should print the register's name.
11096+The names can be found in an array reg_names whose type is
11097+char *[]. reg_names is initialized from REGISTER_NAMES.
11098+
11099+When the machine description has a specification '%punct'
11100+(a '%' followed by a punctuation character), this macro is called
11101+with a null pointer for X and the punctuation character for
11102+CODE.
11103+*/
11104+#define PRINT_OPERAND(STREAM, X, CODE) avr32_print_operand(STREAM, X, CODE)
11105+
11106+/* A C statement to be executed just prior to the output of
11107+ assembler code for INSN, to modify the extracted operands so
11108+ they will be output differently.
11109+
11110+ Here the argument OPVEC is the vector containing the operands
11111+ extracted from INSN, and NOPERANDS is the number of elements of
11112+ the vector which contain meaningful data for this insn.
11113+ The contents of this vector are what will be used to convert the insn
11114+ template into assembler code, so you can change the assembler output
11115+ by changing the contents of the vector. */
11116+#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
11117+ avr32_final_prescan_insn ((INSN), (OPVEC), (NOPERANDS))
11118+
11119+/*
11120+A C expression which evaluates to true if CODE is a valid
11121+punctuation character for use in the PRINT_OPERAND macro. If
11122+PRINT_OPERAND_PUNCT_VALID_P is not defined, it means that no
11123+punctuation characters (except for the standard one, '%') are used
11124+in this way.
11125+*/
11126+/*
11127+ 'm' refers to the most significant word in a two-register mode.
11128+*/
11129+#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == 'm' || (CODE) == 'e')
11130+
11131+/*
11132+A C compound statement to output to stdio stream STREAM the
11133+assembler syntax for an instruction operand that is a memory reference
11134+whose address is X. X is an RTL expression.
11135+
11136+On some machines, the syntax for a symbolic address depends on the
11137+section that the address refers to. On these machines, define the macro
11138+ENCODE_SECTION_INFO to store the information into the
11139+symbol_ref, and then check for it here. (see Assembler Format.)
11140+*/
11141+#define PRINT_OPERAND_ADDRESS(STREAM, X) avr32_print_operand_address(STREAM, X)
11142+
11143+
11144+/** Output of Dispatch Tables **/
11145+
11146+/*
11147+ * A C statement to output to the stdio stream stream an assembler
11148+ * pseudo-instruction to generate a difference between two
11149+ * labels. value and rel are the numbers of two internal labels. The
11150+ * definitions of these labels are output using
11151+ * (*targetm.asm_out.internal_label), and they must be printed in the
11152+ * same way here. For example,
11153+ *
11154+ * fprintf (stream, "\t.word L%d-L%d\n",
11155+ * value, rel)
11156+ *
11157+ * You must provide this macro on machines where the addresses in a
11158+ * dispatch table are relative to the table's own address. If defined,
11159+ * GCC will also use this macro on all machines when producing
11160+ * PIC. body is the body of the ADDR_DIFF_VEC; it is provided so that
11161+ * the mode and flags can be read.
11162+ */
11163+#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
11164+ fprintf(STREAM, "\tbral\t%sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
11165+
11166+/*
11167+This macro should be provided on machines where the addresses
11168+in a dispatch table are absolute.
11169+
11170+The definition should be a C statement to output to the stdio stream
11171+STREAM an assembler pseudo-instruction to generate a reference to
11172+a label. VALUE is the number of an internal label whose
11173+definition is output using ASM_OUTPUT_INTERNAL_LABEL.
11174+For example,
11175+
11176+fprintf(STREAM, "\t.word L%d\n", VALUE)
11177+*/
11178+
11179+#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
11180+ fprintf(STREAM, "\t.long %sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
11181+
11182+/** Assembler Commands for Exception Regions */
11183+
11184+/* ToDo: All of this subsection */
11185+
11186+/** Assembler Commands for Alignment */
11187+
11188+
11189+/*
11190+A C statement to output to the stdio stream STREAM an assembler
11191+command to advance the location counter to a multiple of 2 to the
11192+POWER bytes. POWER will be a C expression of type int.
11193+*/
11194+#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
11195+ do \
11196+ { \
11197+ if ((POWER) != 0) \
11198+ fprintf(STREAM, "\t.align\t%d\n", POWER); \
11199+ } \
11200+ while (0)
11201+
11202+/*
11203+Like ASM_OUTPUT_ALIGN, except that the \nop" instruction is used for padding, if
11204+necessary.
11205+*/
11206+#define ASM_OUTPUT_ALIGN_WITH_NOP(STREAM, POWER) \
11207+ fprintf(STREAM, "\t.balignw\t%d, 0xd703\n", (1 << POWER))
11208+
11209+
11210+
11211+/******************************************************************************
11212+ * Controlling Debugging Information Format
11213+ *****************************************************************************/
11214+
11215+/* How to renumber registers for dbx and gdb. */
11216+#define DBX_REGISTER_NUMBER(REGNO) ASM_REGNUM (REGNO)
11217+
11218+/* The DWARF 2 CFA column which tracks the return address. */
11219+#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM(LR_REGNUM)
11220+
11221+/*
11222+Define this macro if GCC should produce dwarf version 2 format
11223+debugging output in response to the -g option.
11224+
11225+To support optional call frame debugging information, you must also
11226+define INCOMING_RETURN_ADDR_RTX and either set
11227+RTX_FRAME_RELATED_P on the prologue insns if you use RTL for the
11228+prologue, or call dwarf2out_def_cfa and dwarf2out_reg_save
11229+as appropriate from TARGET_ASM_FUNCTION_PROLOGUE if you don't.
11230+*/
11231+#define DWARF2_DEBUGGING_INFO 1
11232+
11233+
11234+#define DWARF2_ASM_LINE_DEBUG_INFO 1
11235+#define DWARF2_FRAME_INFO 1
11236+
11237+
11238+/******************************************************************************
11239+ * Miscellaneous Parameters
11240+ *****************************************************************************/
11241+
11242+/* ToDo: a lot */
11243+
11244+/*
11245+An alias for a machine mode name. This is the machine mode that
11246+elements of a jump-table should have.
11247+*/
11248+#define CASE_VECTOR_MODE SImode
11249+
11250+/*
11251+Define this macro to be a C expression to indicate when jump-tables
11252+should contain relative addresses. If jump-tables never contain
11253+relative addresses, then you need not define this macro.
11254+*/
11255+#define CASE_VECTOR_PC_RELATIVE 0
11256+
11257+/*
11258+The maximum number of bytes that a single instruction can move quickly
11259+between memory and registers or between two memory locations.
11260+*/
11261+#define MOVE_MAX (2*UNITS_PER_WORD)
11262+
11263+
11264+/* A C expression that is nonzero if on this machine the number of bits actually used
11265+ for the count of a shift operation is equal to the number of bits needed to represent
11266+ the size of the object being shifted. When this macro is nonzero, the compiler will
11267+ assume that it is safe to omit a sign-extend, zero-extend, and certain bitwise 'and'
11268+ instructions that truncates the count of a shift operation. On machines that have
11269+ instructions that act on bit-fields at variable positions, which may include 'bit test'
11270+ 378 GNU Compiler Collection (GCC) Internals
11271+ instructions, a nonzero SHIFT_COUNT_TRUNCATED also enables deletion of truncations
11272+ of the values that serve as arguments to bit-field instructions.
11273+ If both types of instructions truncate the count (for shifts) and position (for bit-field
11274+ operations), or if no variable-position bit-field instructions exist, you should define
11275+ this macro.
11276+ However, on some machines, such as the 80386 and the 680x0, truncation only applies
11277+ to shift operations and not the (real or pretended) bit-field operations. Define SHIFT_
11278+ COUNT_TRUNCATED to be zero on such machines. Instead, add patterns to the 'md' file
11279+ that include the implied truncation of the shift instructions.
11280+ You need not de ne this macro if it would always have the value of zero. */
11281+#define SHIFT_COUNT_TRUNCATED 1
11282+
11283+/*
11284+A C expression which is nonzero if on this machine it is safe to
11285+convert an integer of INPREC bits to one of OUTPREC
11286+bits (where OUTPREC is smaller than INPREC) by merely
11287+operating on it as if it had only OUTPREC bits.
11288+
11289+On many machines, this expression can be 1.
11290+
11291+When TRULY_NOOP_TRUNCATION returns 1 for a pair of sizes for
11292+modes for which MODES_TIEABLE_P is 0, suboptimal code can result.
11293+If this is the case, making TRULY_NOOP_TRUNCATION return 0 in
11294+such cases may improve things.
11295+*/
11296+#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
11297+
11298+/*
11299+An alias for the machine mode for pointers. On most machines, define
11300+this to be the integer mode corresponding to the width of a hardware
11301+pointer; SImode on 32-bit machine or DImode on 64-bit machines.
11302+On some machines you must define this to be one of the partial integer
11303+modes, such as PSImode.
11304+
11305+The width of Pmode must be at least as large as the value of
11306+POINTER_SIZE. If it is not equal, you must define the macro
11307+POINTERS_EXTEND_UNSIGNED to specify how pointers are extended
11308+to Pmode.
11309+*/
11310+#define Pmode SImode
11311+
11312+/*
11313+An alias for the machine mode used for memory references to functions
11314+being called, in call RTL expressions. On most machines this
11315+should be QImode.
11316+*/
11317+#define FUNCTION_MODE SImode
11318+
11319+
11320+#define REG_S_P(x) \
11321+ (REG_P (x) || (GET_CODE (x) == SUBREG && REG_P (XEXP (x, 0))))
11322+
11323+
11324+/* If defined, modifies the length assigned to instruction INSN as a
11325+ function of the context in which it is used. LENGTH is an lvalue
11326+ that contains the initially computed length of the insn and should
11327+ be updated with the correct length of the insn. */
11328+#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
11329+ ((LENGTH) = avr32_adjust_insn_length ((INSN), (LENGTH)))
11330+
11331+
11332+#define CLZ_DEFINED_VALUE_AT_ZERO(mode, value) \
11333+ (value = 32, (mode == SImode))
11334+
11335+#define CTZ_DEFINED_VALUE_AT_ZERO(mode, value) \
11336+ (value = 32, (mode == SImode))
11337+
11338+#define UNITS_PER_SIMD_WORD UNITS_PER_WORD
11339+
11340+#define STORE_FLAG_VALUE 1
11341+
11342+enum avr32_builtins
11343+{
11344+ AVR32_BUILTIN_MTSR,
11345+ AVR32_BUILTIN_MFSR,
11346+ AVR32_BUILTIN_MTDR,
11347+ AVR32_BUILTIN_MFDR,
11348+ AVR32_BUILTIN_CACHE,
11349+ AVR32_BUILTIN_SYNC,
11350+ AVR32_BUILTIN_TLBR,
11351+ AVR32_BUILTIN_TLBS,
11352+ AVR32_BUILTIN_TLBW,
11353+ AVR32_BUILTIN_BREAKPOINT,
11354+ AVR32_BUILTIN_XCHG,
11355+ AVR32_BUILTIN_LDXI,
11356+ AVR32_BUILTIN_BSWAP16,
11357+ AVR32_BUILTIN_BSWAP32,
11358+ AVR32_BUILTIN_COP,
11359+ AVR32_BUILTIN_MVCR_W,
11360+ AVR32_BUILTIN_MVRC_W,
11361+ AVR32_BUILTIN_MVCR_D,
11362+ AVR32_BUILTIN_MVRC_D,
11363+ AVR32_BUILTIN_MULSATHH_H,
11364+ AVR32_BUILTIN_MULSATHH_W,
11365+ AVR32_BUILTIN_MULSATRNDHH_H,
11366+ AVR32_BUILTIN_MULSATRNDWH_W,
11367+ AVR32_BUILTIN_MULSATWH_W,
11368+ AVR32_BUILTIN_MACSATHH_W,
11369+ AVR32_BUILTIN_SATADD_H,
11370+ AVR32_BUILTIN_SATSUB_H,
11371+ AVR32_BUILTIN_SATADD_W,
11372+ AVR32_BUILTIN_SATSUB_W,
11373+ AVR32_BUILTIN_MULWH_D,
11374+ AVR32_BUILTIN_MULNWH_D,
11375+ AVR32_BUILTIN_MACWH_D,
11376+ AVR32_BUILTIN_MACHH_D,
11377+ AVR32_BUILTIN_MUSFR,
11378+ AVR32_BUILTIN_MUSTR,
11379+ AVR32_BUILTIN_SATS,
11380+ AVR32_BUILTIN_SATU,
11381+ AVR32_BUILTIN_SATRNDS,
11382+ AVR32_BUILTIN_SATRNDU
11383+};
11384+
11385+
11386+#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) \
11387+ ((MODE == SFmode) || (MODE == DFmode))
11388+
11389+#define RENAME_LIBRARY_SET ".set"
11390+
11391+/* Make ABI_NAME an alias for __GCC_NAME. */
11392+#define RENAME_LIBRARY(GCC_NAME, ABI_NAME) \
11393+ __asm__ (".globl\t__avr32_" #ABI_NAME "\n" \
11394+ ".set\t__avr32_" #ABI_NAME \
11395+ ", __" #GCC_NAME "\n");
11396+
11397+/* Give libgcc functions avr32 ABI name. */
11398+#ifdef L_muldi3
11399+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, mul64)
11400+#endif
11401+#ifdef L_divdi3
11402+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (divdi3, sdiv64)
11403+#endif
11404+#ifdef L_udivdi3
11405+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (udivdi3, udiv64)
11406+#endif
11407+#ifdef L_moddi3
11408+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (moddi3, smod64)
11409+#endif
11410+#ifdef L_umoddi3
11411+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (umoddi3, umod64)
11412+#endif
11413+#ifdef L_ashldi3
11414+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (ashldi3, lsl64)
11415+#endif
11416+#ifdef L_lshrdi3
11417+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (lshrdi3, lsr64)
11418+#endif
11419+#ifdef L_ashrdi3
11420+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (ashrdi3, asr64)
11421+#endif
11422+
11423+#ifdef L_fixsfdi
11424+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f32_to_s64)
11425+#endif
11426+#ifdef L_fixunssfdi
11427+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f32_to_u64)
11428+#endif
11429+#ifdef L_floatdidf
11430+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, s64_to_f64)
11431+#endif
11432+#ifdef L_floatdisf
11433+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, s64_to_f32)
11434+#endif
11435+
11436+#ifdef L_addsub_sf
11437+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (addsf3, f32_add); RENAME_LIBRARY (subsf3, f32_sub)
11438+#endif
11439+
11440+#endif
11441diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/avr32.md gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32.md
11442--- gcc-4.0.2/gcc/config/avr32/avr32.md 1970-01-01 01:00:00.000000000 +0100
11443+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32.md 2006-11-09 15:04:35.000000000 +0100
11444@@ -0,0 +1,4694 @@
11445+;; AVR32 machine description file.
11446+;; Copyright 2003-2006 Atmel Corporation.
11447+;;
11448+;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
11449+;;
11450+;; This file is part of GCC.
11451+;;
11452+;; This program is free software; you can redistribute it and/or modify
11453+;; it under the terms of the GNU General Public License as published by
11454+;; the Free Software Foundation; either version 2 of the License, or
11455+;; (at your option) any later version.
11456+;;
11457+;; This program is distributed in the hope that it will be useful,
11458+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11459+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11460+;; GNU General Public License for more details.
11461+;;
11462+;; You should have received a copy of the GNU General Public License
11463+;; along with this program; if not, write to the Free Software
11464+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11465+
11466+;; -*- Mode: Scheme -*-
11467+
11468+(define_attr "type" "alu,alu2,alu_sat,mulhh,mulwh,mulww_w,mulww_d,div,machh_w,macww_w,macww_d,branch,call,load,load_rm,store,load2,load4,store2,store4,fmul,fcmps,fcmpd,fcast,fmv,fmvcpu,fldd,fstd,flds,fsts,fstm"
11469+ (const_string "alu"))
11470+
11471+
11472+(define_attr "cc" "none,set_vncz,set_ncz,set_cz,set_z,bld,compare,clobber,call_set,fpcompare,from_fpcc"
11473+ (const_string "none"))
11474+
11475+
11476+(define_attr "pipeline" "ap,uc"
11477+ (const_string "ap"))
11478+
11479+(define_attr "length" ""
11480+ (const_int 4))
11481+
11482+
11483+;; Uses of UNSPEC in this file:
11484+(define_constants
11485+ [(UNSPEC_PUSHM 0)
11486+ (UNSPEC_POPM 1)
11487+ (UNSPEC_UDIVMODSI4_INTERNAL 2)
11488+ (UNSPEC_DIVMODSI4_INTERNAL 3)
11489+ (UNSPEC_STM 4)
11490+ (UNSPEC_LDM 5)
11491+ (UNSPEC_MOVSICC 6)
11492+ (UNSPEC_ADDSICC 7)
11493+ (UNSPEC_COND_MI 8)
11494+ (UNSPEC_COND_PL 9)
11495+ (UNSPEC_PIC_SYM 10)
11496+ (UNSPEC_PIC_BASE 11)
11497+ (UNSPEC_STORE_MULTIPLE 12)
11498+ (UNSPEC_STMFP 13)
11499+ (UNSPEC_FPCC_TO_REG 14)
11500+ (UNSPEC_REG_TO_CC 15)
11501+ (UNSPEC_FORCE_MINIPOOL 16)
11502+ (UNSPEC_SATS 17)
11503+ (UNSPEC_SATU 18)
11504+ (UNSPEC_SATRNDS 19)
11505+ (UNSPEC_SATRNDU 20)
11506+ ])
11507+
11508+(define_constants
11509+ [(VUNSPEC_EPILOGUE 0)
11510+ (VUNSPEC_CACHE 1)
11511+ (VUNSPEC_MTSR 2)
11512+ (VUNSPEC_MFSR 3)
11513+ (VUNSPEC_BLOCKAGE 4)
11514+ (VUNSPEC_SYNC 5)
11515+ (VUNSPEC_TLBR 6)
11516+ (VUNSPEC_TLBW 7)
11517+ (VUNSPEC_TLBS 8)
11518+ (VUNSPEC_BREAKPOINT 9)
11519+ (VUNSPEC_MTDR 10)
11520+ (VUNSPEC_MFDR 11)
11521+ (VUNSPEC_MVCR 12)
11522+ (VUNSPEC_MVRC 13)
11523+ (VUNSPEC_COP 14)
11524+ (VUNSPEC_ALIGN 15)
11525+ (VUNSPEC_POOL_START 16)
11526+ (VUNSPEC_POOL_END 17)
11527+ (VUNSPEC_POOL_4 18)
11528+ (VUNSPEC_POOL_8 19)
11529+ (VUNSPEC_MUSFR 20)
11530+ (VUNSPEC_MUSTR 21)
11531+ ])
11532+
11533+(define_constants
11534+ [
11535+ ;; R7 = 15-7 = 8
11536+ (FP_REGNUM 8)
11537+ ;; Return Register = R12 = 15 - 12 = 3
11538+ (RETVAL_REGNUM 3)
11539+ ;; SP = R13 = 15 - 13 = 2
11540+ (SP_REGNUM 2)
11541+ ;; LR = R14 = 15 - 14 = 1
11542+ (LR_REGNUM 1)
11543+ ;; PC = R15 = 15 - 15 = 0
11544+ (PC_REGNUM 0)
11545+ ;; FPSR = GENERAL_REGS + 1 = 17
11546+ (FPCC_REGNUM 17)
11547+ ])
11548+
11549+
11550+
11551+
11552+;;******************************************************************************
11553+;; Macros
11554+;;******************************************************************************
11555+
11556+;; Integer Modes for basic alu insns
11557+(define_mode_macro INTM [SI HI QI])
11558+(define_mode_attr alu_cc_attr [(SI "set_vncz") (HI "clobber") (QI "clobber")])
11559+
11560+;; Move word modes
11561+(define_mode_macro MOVM [SI V2HI V4QI])
11562+
11563+;; For mov/addcc insns
11564+(define_mode_macro ADDCC [SI HI QI])
11565+(define_mode_macro MOVCC [SI HI QI])
11566+(define_mode_macro CMP [DI SI HI QI])
11567+(define_mode_attr cmp_constraint [(DI "r") (SI "rKs21") (HI "r") (QI "r")])
11568+(define_mode_attr cmp_predicate [(DI "register_operand")
11569+ (SI "register_immediate_operand")
11570+ (HI "register_operand")
11571+ (QI "register_operand")])
11572+
11573+;; For all conditional insns
11574+(define_code_macro any_cond [eq ne gt ge lt le gtu geu ltu leu])
11575+(define_code_attr cond [(eq "eq") (ne "ne") (gt "gt") (ge "ge") (lt "lt") (le "le")
11576+ (gtu "hi") (geu "hs") (ltu "lo") (leu "ls")])
11577+(define_code_attr invcond [(eq "ne") (ne "eq") (gt "le") (ge "lt") (lt "ge") (le "gt")
11578+ (gtu "ls") (geu "lo") (ltu "hs") (leu "hi")])
11579+
11580+;; For logical operations
11581+(define_code_macro logical [and ior xor])
11582+(define_code_attr logical_insn [(and "and") (ior "or") (xor "eor")])
11583+
11584+;; Load the predicates
11585+(include "predicates.md")
11586+
11587+
11588+;;******************************************************************************
11589+;; Automaton pipeline description for avr32
11590+;;******************************************************************************
11591+
11592+(define_automaton "avr32_ap")
11593+
11594+
11595+(define_cpu_unit "is" "avr32_ap")
11596+(define_cpu_unit "a1,m1,da" "avr32_ap")
11597+(define_cpu_unit "a2,m2,d" "avr32_ap")
11598+
11599+;;Alu instructions
11600+(define_insn_reservation "alu_op" 1
11601+ (and (eq_attr "pipeline" "ap")
11602+ (eq_attr "type" "alu"))
11603+ "is,a1,a2")
11604+
11605+(define_insn_reservation "alu2_op" 2
11606+ (and (eq_attr "pipeline" "ap")
11607+ (eq_attr "type" "alu2"))
11608+ "is,is+a1,a1+a2,a2")
11609+
11610+(define_insn_reservation "alu_sat_op" 2
11611+ (and (eq_attr "pipeline" "ap")
11612+ (eq_attr "type" "alu_sat"))
11613+ "is,a1,a2")
11614+
11615+
11616+;;Mul instructions
11617+(define_insn_reservation "mulhh_op" 2
11618+ (and (eq_attr "pipeline" "ap")
11619+ (eq_attr "type" "mulhh,mulwh"))
11620+ "is,m1,m2")
11621+
11622+(define_insn_reservation "mulww_w_op" 3
11623+ (and (eq_attr "pipeline" "ap")
11624+ (eq_attr "type" "mulww_w"))
11625+ "is,m1,m1+m2,m2")
11626+
11627+(define_insn_reservation "mulww_d_op" 5
11628+ (and (eq_attr "pipeline" "ap")
11629+ (eq_attr "type" "mulww_d"))
11630+ "is,m1,m1+m2,m1+m2,m2,m2")
11631+
11632+(define_insn_reservation "div_op" 33
11633+ (and (eq_attr "pipeline" "ap")
11634+ (eq_attr "type" "div"))
11635+ "is,m1,m1*31 + m2*31,m2")
11636+
11637+(define_insn_reservation "machh_w_op" 3
11638+ (and (eq_attr "pipeline" "ap")
11639+ (eq_attr "type" "machh_w"))
11640+ "is*2,m1,m2")
11641+
11642+
11643+(define_insn_reservation "macww_w_op" 4
11644+ (and (eq_attr "pipeline" "ap")
11645+ (eq_attr "type" "macww_w"))
11646+ "is*2,m1,m1,m2")
11647+
11648+
11649+(define_insn_reservation "macww_d_op" 6
11650+ (and (eq_attr "pipeline" "ap")
11651+ (eq_attr "type" "macww_d"))
11652+ "is*2,m1,m1+m2,m1+m2,m2")
11653+
11654+;;Bypasses for Mac instructions, because of accumulator cache.
11655+;;Set latency as low as possible in order to let the compiler let
11656+;;mul -> mac and mac -> mac combinations which use the same
11657+;;accumulator cache be placed close together to avoid any
11658+;;instructions which can ruin the accumulator cache come inbetween.
11659+(define_bypass 4 "machh_w_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
11660+(define_bypass 5 "macww_w_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
11661+(define_bypass 7 "macww_d_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
11662+
11663+(define_bypass 3 "mulhh_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
11664+(define_bypass 4 "mulww_w_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
11665+(define_bypass 6 "mulww_d_op" "alu_op,alu2_op,alu_sat_op,load_op" "avr32_mul_waw_bypass")
11666+
11667+
11668+;;Bypasses for all mul/mac instructions followed by an instruction
11669+;;which reads the output AND writes the result to the same register.
11670+;;This will generate an Write After Write hazard which gives an
11671+;;extra cycle before the result is ready.
11672+(define_bypass 0 "machh_w_op" "machh_w_op" "avr32_valid_macmac_bypass")
11673+(define_bypass 0 "macww_w_op" "macww_w_op" "avr32_valid_macmac_bypass")
11674+(define_bypass 0 "macww_d_op" "macww_d_op" "avr32_valid_macmac_bypass")
11675+
11676+(define_bypass 0 "mulhh_op" "machh_w_op" "avr32_valid_mulmac_bypass")
11677+(define_bypass 0 "mulww_w_op" "macww_w_op" "avr32_valid_mulmac_bypass")
11678+(define_bypass 0 "mulww_d_op" "macww_d_op" "avr32_valid_mulmac_bypass")
11679+
11680+;;Branch and call instructions
11681+;;We assume that all branches and rcalls are predicted correctly :-)
11682+;;while calls use a lot of cycles.
11683+(define_insn_reservation "branch_op" 0
11684+ (and (eq_attr "pipeline" "ap")
11685+ (eq_attr "type" "branch"))
11686+ "nothing")
11687+
11688+(define_insn_reservation "call_op" 10
11689+ (and (eq_attr "pipeline" "ap")
11690+ (eq_attr "type" "call"))
11691+ "nothing")
11692+
11693+
11694+;;Load store instructions
11695+(define_insn_reservation "load_op" 2
11696+ (and (eq_attr "pipeline" "ap")
11697+ (eq_attr "type" "load"))
11698+ "is,da,d")
11699+
11700+(define_insn_reservation "load_rm_op" 3
11701+ (and (eq_attr "pipeline" "ap")
11702+ (eq_attr "type" "load_rm"))
11703+ "is,da,d")
11704+
11705+
11706+(define_insn_reservation "store_op" 0
11707+ (and (eq_attr "pipeline" "ap")
11708+ (eq_attr "type" "store"))
11709+ "is,da,d")
11710+
11711+
11712+(define_insn_reservation "load_double_op" 3
11713+ (and (eq_attr "pipeline" "ap")
11714+ (eq_attr "type" "load2"))
11715+ "is,da,da+d,d")
11716+
11717+(define_insn_reservation "load_quad_op" 4
11718+ (and (eq_attr "pipeline" "ap")
11719+ (eq_attr "type" "load4"))
11720+ "is,da,da+d,da+d,d")
11721+
11722+(define_insn_reservation "store_double_op" 0
11723+ (and (eq_attr "pipeline" "ap")
11724+ (eq_attr "type" "store2"))
11725+ "is,da,da+d,d")
11726+
11727+
11728+(define_insn_reservation "store_quad_op" 0
11729+ (and (eq_attr "pipeline" "ap")
11730+ (eq_attr "type" "store4"))
11731+ "is,da,da+d,da+d,d")
11732+
11733+;;For store the operand to write to memory is read in d and
11734+;;the real latency between any instruction and a store is therefore
11735+;;one less than for the instructions which reads the operands in the first
11736+;;excecution stage
11737+(define_bypass 2 "load_double_op" "store_double_op" "avr32_store_bypass")
11738+(define_bypass 3 "load_quad_op" "store_quad_op" "avr32_store_bypass")
11739+(define_bypass 1 "load_op" "store_op" "avr32_store_bypass")
11740+(define_bypass 2 "load_rm_op" "store_op" "avr32_store_bypass")
11741+(define_bypass 1 "alu_sat_op" "store_op" "avr32_store_bypass")
11742+(define_bypass 1 "alu2_op" "store_op" "avr32_store_bypass")
11743+(define_bypass 1 "mulhh_op" "store_op" "avr32_store_bypass")
11744+(define_bypass 2 "mulww_w_op" "store_op" "avr32_store_bypass")
11745+(define_bypass 4 "mulww_d_op" "store_op" "avr32_store_bypass" )
11746+(define_bypass 2 "machh_w_op" "store_op" "avr32_store_bypass")
11747+(define_bypass 3 "macww_w_op" "store_op" "avr32_store_bypass")
11748+(define_bypass 5 "macww_d_op" "store_op" "avr32_store_bypass")
11749+
11750+
11751+; Bypass for load double operation. If only the first loaded word is needed
11752+; then the latency is 2
11753+(define_bypass 2 "load_double_op"
11754+ "load_op,load_rm_op,alu_sat_op, alu2_op, alu_op, mulhh_op, mulww_w_op,
11755+ mulww_d_op, machh_w_op, macww_w_op, macww_d_op"
11756+ "avr32_valid_load_double_bypass")
11757+
11758+; Bypass for load quad operation. If only the first or second loaded word is needed
11759+; we set the latency to 2
11760+(define_bypass 2 "load_quad_op"
11761+ "load_op,load_rm_op,alu_sat_op, alu2_op, alu_op, mulhh_op, mulww_w_op,
11762+ mulww_d_op, machh_w_op, macww_w_op, macww_d_op"
11763+ "avr32_valid_load_quad_bypass")
11764+
11765+
11766+;;******************************************************************************
11767+;; End of Automaton pipeline description for avr32
11768+;;******************************************************************************
11769+
11770+
11771+
11772+;;=============================================================================
11773+;; move
11774+;;-----------------------------------------------------------------------------
11775+
11776+;;== char - 8 bits ============================================================
11777+(define_expand "movqi"
11778+ [(set (match_operand:QI 0 "nonimmediate_operand" "")
11779+ (match_operand:QI 1 "general_operand" ""))]
11780+ ""
11781+ {
11782+ if ( !no_new_pseudos ){
11783+ if (GET_CODE (operands[1]) == MEM && optimize){
11784+ rtx reg = gen_reg_rtx (SImode);
11785+
11786+ emit_insn (gen_zero_extendqisi2 (reg, operands[1]));
11787+ operands[1] = gen_lowpart (QImode, reg);
11788+ }
11789+
11790+ /* One of the ops has to be in a register. */
11791+ if (GET_CODE (operands[0]) == MEM)
11792+ operands[1] = force_reg (QImode, operands[1]);
11793+ }
11794+
11795+ })
11796+
11797+(define_insn "*movqi_internal"
11798+ [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r")
11799+ (match_operand:QI 1 "general_operand" "rKs08,m,r,i"))]
11800+ ""
11801+ "@
11802+ mov\t%0, %1
11803+ ld.ub\t%0, %1
11804+ st.b\t%0, %1
11805+ mov\t%0, %1"
11806+ [(set_attr "length" "2,4,4,4")
11807+ (set_attr "type" "alu,load_rm,store,alu")])
11808+
11809+
11810+
11811+;;== short - 16 bits ==========================================================
11812+(define_expand "movhi"
11813+ [(set (match_operand:HI 0 "nonimmediate_operand" "")
11814+ (match_operand:HI 1 "general_operand" ""))]
11815+ ""
11816+ {
11817+ if ( !no_new_pseudos ){
11818+ if (GET_CODE (operands[1]) == MEM && optimize){
11819+ rtx reg = gen_reg_rtx (SImode);
11820+
11821+ emit_insn (gen_extendhisi2 (reg, operands[1]));
11822+ operands[1] = gen_lowpart (HImode, reg);
11823+ }
11824+
11825+ /* One of the ops has to be in a register. */
11826+ if (GET_CODE (operands[0]) == MEM)
11827+ operands[1] = force_reg (HImode, operands[1]);
11828+ }
11829+
11830+ })
11831+
11832+(define_insn "*movhi_internal"
11833+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r")
11834+ (match_operand:HI 1 "general_operand" "rKs08,m,r,i"))]
11835+ ""
11836+ "@
11837+ mov\t%0, %1
11838+ ld.sh\t%0, %1
11839+ st.h\t%0, %1
11840+ mov\t%0, %1"
11841+ [(set_attr "length" "2,4,4,4")
11842+ (set_attr "type" "alu,load_rm,store,alu")])
11843+
11844+
11845+;;== int - 32 bits ============================================================
11846+
11847+(define_expand "movmisalignsi"
11848+ [(set (match_operand:SI 0 "nonimmediate_operand" "")
11849+ (match_operand:SI 1 "nonimmediate_operand" ""))]
11850+ "TARGET_UNALIGNED_WORD"
11851+ {
11852+ }
11853+)
11854+
11855+(define_expand "mov<mode>"
11856+ [(set (match_operand:MOVM 0 "nonimmediate_operand" "")
11857+ (match_operand:MOVM 1 "general_operand" ""))]
11858+ ""
11859+ {
11860+
11861+ /* One of the ops has to be in a register. */
11862+ if (GET_CODE (operands[0]) == MEM)
11863+ operands[1] = force_reg (<MODE>mode, operands[1]);
11864+
11865+
11866+ /* Check for out of range immediate constants as these may
11867+ occur during reloading, since it seems like reload does
11868+ not check if the immediate is legitimate. Don't know if
11869+ this is a bug? */
11870+ if ( reload_in_progress
11871+ && GET_CODE(operands[1]) == CONST_INT
11872+ && !avr32_const_ok_for_constraint_p(INTVAL(operands[1]), 'K', "Ks21") ){
11873+ operands[1] = force_const_mem(SImode, operands[1]);
11874+ }
11875+
11876+ if ( (flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS)
11877+ && !avr32_legitimate_pic_operand_p(operands[1]) )
11878+ operands[1] = legitimize_pic_address (operands[1], <MODE>mode,
11879+ (no_new_pseudos ? operands[0] : 0));
11880+ else if ( flag_pic && avr32_address_operand(operands[1], GET_MODE(operands[1])) )
11881+ /* If we have an address operand then this function uses the pic register. */
11882+ current_function_uses_pic_offset_table = 1;
11883+ })
11884+
11885+
11886+(define_insn "mov<mode>_internal"
11887+ [(set (match_operand:MOVM 0 "nonimmediate_operand" "=r,r,r,m,r")
11888+ (match_operand:MOVM 1 "general_operand" "rKs08,Ks21,m,r,W"))]
11889+ ""
11890+ {
11891+ switch (which_alternative) {
11892+ case 0:
11893+ case 1: return "mov\t%0, %1";
11894+ case 2:
11895+ if ( (REG_P(XEXP(operands[1], 0))
11896+ && REGNO(XEXP(operands[1], 0)) == SP_REGNUM)
11897+ || (GET_CODE(XEXP(operands[1], 0)) == PLUS
11898+ && REGNO(XEXP(XEXP(operands[1], 0), 0)) == SP_REGNUM
11899+ && GET_CODE(XEXP(XEXP(operands[1], 0), 1)) == CONST_INT
11900+ && INTVAL(XEXP(XEXP(operands[1], 0), 1)) % 4 == 0
11901+ && INTVAL(XEXP(XEXP(operands[1], 0), 1)) <= 0x1FC) )
11902+ return "lddsp\t%0, %1";
11903+ else if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])) )
11904+ return "lddpc\t%0, %1";
11905+ else
11906+ return "ld.w\t%0, %1";
11907+ case 3:
11908+ if ( (REG_P(XEXP(operands[0], 0))
11909+ && REGNO(XEXP(operands[0], 0)) == SP_REGNUM)
11910+ || (GET_CODE(XEXP(operands[0], 0)) == PLUS
11911+ && REGNO(XEXP(XEXP(operands[0], 0), 0)) == SP_REGNUM
11912+ && GET_CODE(XEXP(XEXP(operands[0], 0), 1)) == CONST_INT
11913+ && INTVAL(XEXP(XEXP(operands[0], 0), 1)) % 4 == 0
11914+ && INTVAL(XEXP(XEXP(operands[0], 0), 1)) <= 0x1FC) )
11915+ return "stdsp\t%0, %1";
11916+ else
11917+ return "st.w\t%0, %1";
11918+ case 4:
11919+ if ( TARGET_HAS_ASM_ADDR_PSEUDOS )
11920+ return "lda.w\t%0, %1";
11921+ else
11922+ return "ld.w\t%0, r6[%1@got]";
11923+ default:
11924+ abort();
11925+ }
11926+ }
11927+
11928+ [(set_attr "length" "2,4,4,4,8")
11929+ (set_attr "type" "alu,alu,load,store,load")
11930+ (set_attr "cc" "none,none,none,none,clobber")])
11931+
11932+
11933+;; These instructions are for loading constants which cannot be loaded
11934+;; directly from the constant pool because the offset is too large
11935+;; high and lo_sum are used even tough for our case it should be
11936+;; low and high sum :-)
11937+(define_insn "mov_symbol_lo"
11938+ [(set (match_operand:SI 0 "register_operand" "=r")
11939+ (high:SI (match_operand:SI 1 "immediate_operand" "i" )))]
11940+ ""
11941+ "mov\t%0, lo(%1)"
11942+ [(set_attr "type" "alu")
11943+ (set_attr "length" "4")]
11944+)
11945+
11946+(define_insn "add_symbol_hi"
11947+ [(set (match_operand:SI 0 "register_operand" "=r")
11948+ (lo_sum:SI (match_dup 0)
11949+ (match_operand:SI 1 "immediate_operand" "i" )))]
11950+ ""
11951+ "orh\t%0, hi(%1)"
11952+ [(set_attr "type" "alu")
11953+ (set_attr "length" "4")]
11954+)
11955+
11956+
11957+
11958+;; When generating pic, we need to load the symbol offset into a register.
11959+;; So that the optimizer does not confuse this with a normal symbol load
11960+;; we use an unspec. The offset will be loaded from a constant pool entry,
11961+;; since that is the only type of relocation we can use.
11962+(define_insn "pic_load_addr"
11963+ [(set (match_operand:SI 0 "register_operand" "=r")
11964+ (unspec:SI [(match_operand:SI 1 "" "")] UNSPEC_PIC_SYM))]
11965+ "flag_pic && CONSTANT_POOL_ADDRESS_P(XEXP(operands[1], 0))"
11966+ "lddpc\t%0, %1"
11967+ [(set_attr "type" "load")
11968+ (set_attr "length" "4")]
11969+)
11970+
11971+(define_insn "pic_compute_got_from_pc"
11972+ [(set (match_operand:SI 0 "register_operand" "+r")
11973+ (unspec:SI [(minus:SI (pc)
11974+ (match_dup 0))] UNSPEC_PIC_BASE))
11975+ (use (label_ref (match_operand 1 "" "")))]
11976+ "flag_pic"
11977+ {
11978+ (*targetm.asm_out.internal_label) (asm_out_file, "L",
11979+ CODE_LABEL_NUMBER (operands[1]));
11980+ return \"rsub\t%0, pc\";
11981+ }
11982+ [(set_attr "cc" "clobber")
11983+ (set_attr "length" "2")]
11984+)
11985+
11986+;;== long long int - 64 bits ==================================================
11987+(define_expand "movdi"
11988+ [(set (match_operand:DI 0 "nonimmediate_operand" "")
11989+ (match_operand:DI 1 "general_operand" ""))]
11990+ ""
11991+ {
11992+
11993+ /* One of the ops has to be in a register. */
11994+ if (GET_CODE (operands[0]) != REG)
11995+ operands[1] = force_reg (DImode, operands[1]);
11996+
11997+ })
11998+
11999+
12000+(define_insn_and_split "*movdi_internal"
12001+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
12002+ (match_operand:DI 1 "general_operand" "r,Ks08,Ks21,G,m,r"))]
12003+ ""
12004+ {
12005+ switch (which_alternative ){
12006+ case 1:
12007+ case 2:
12008+ if ( INTVAL(operands[1]) < 0 )
12009+ return "mov\t%0, %1\;mov\t%m0, -1";
12010+ else
12011+ return "mov\t%0, %1\;mov\t%m0, 0";
12012+ case 0:
12013+ case 3:
12014+ return "mov\t%0, %1\;mov\t%m0, %m1";
12015+ case 4:
12016+ if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])))
12017+ return "ld.d\t%0, pc[%1 - .]";
12018+ else
12019+ return "ld.d\t%0, %1";
12020+ case 5:
12021+ return "st.d\t%0, %1";
12022+ default:
12023+ abort();
12024+ }
12025+ }
12026+ "reload_completed &&
12027+ (REG_P(operands[0]) &&
12028+ (REG_P(operands[1]) || avr32_const_double_immediate(operands[1]) ||
12029+ ((GET_CODE(operands[1]) == CONST_INT) && avr32_const_ok_for_constraint_p(INTVAL(operands[1]), 'K', \"Ks21\")) ))"
12030+ [(set (match_dup 0) (match_dup 1))
12031+ (set (match_dup 2) (match_dup 3))]
12032+ {
12033+ operands[2] = gen_highpart (SImode, operands[0]);
12034+ operands[0] = gen_lowpart (SImode, operands[0]);
12035+ if ( REG_P(operands[1]) ){
12036+ operands[3] = gen_highpart(SImode, operands[1]);
12037+ operands[1] = gen_lowpart(SImode, operands[1]);
12038+ } else if ( GET_CODE(operands[1]) == CONST_DOUBLE ){
12039+ operands[3] = GEN_INT(CONST_DOUBLE_LOW(operands[1]));
12040+ operands[1] = GEN_INT(CONST_DOUBLE_HIGH(operands[1]));
12041+ } else if ( GET_CODE(operands[1]) == CONST_INT ){
12042+ operands[3] = GEN_INT((INTVAL(operands[1]) < 0) ? -1 : 0);
12043+ operands[1] = operands[1];
12044+ } else {
12045+ internal_error("Illegal operand[1] for movdi split!");
12046+ }
12047+ }
12048+
12049+ [(set_attr "length" "4,6,8,8,4,4")
12050+ (set_attr "type" "alu2,alu2,alu2,alu2,load2,store2")])
12051+
12052+
12053+;;== 128 bits ==================================================
12054+(define_expand "movti"
12055+ [(set (match_operand:TI 0 "nonimmediate_operand" "")
12056+ (match_operand:TI 1 "general_operand" ""))]
12057+ ""
12058+ {
12059+
12060+ /* One of the ops has to be in a register. */
12061+ if (GET_CODE (operands[0]) != REG)
12062+ operands[1] = force_reg (TImode, operands[1]);
12063+
12064+ /* We must fix any pre_dec for loads and post_inc stores */
12065+ if ( GET_CODE (operands[0]) == MEM
12066+ && GET_CODE (XEXP(operands[0],0)) == POST_INC ){
12067+ emit_move_insn(gen_rtx_MEM(TImode, XEXP(XEXP(operands[0],0),0)), operands[1]);
12068+ emit_insn(gen_addsi3(XEXP(XEXP(operands[0],0),0), XEXP(XEXP(operands[0],0),0), GEN_INT(GET_MODE_SIZE(TImode))));
12069+ DONE;
12070+ }
12071+
12072+ if ( GET_CODE (operands[1]) == MEM
12073+ && GET_CODE (XEXP(operands[1],0)) == PRE_DEC ){
12074+ emit_insn(gen_addsi3(XEXP(XEXP(operands[1],0),0), XEXP(XEXP(operands[1],0),0), GEN_INT(-GET_MODE_SIZE(TImode))));
12075+ emit_move_insn(operands[0], gen_rtx_MEM(TImode, XEXP(XEXP(operands[1],0),0)));
12076+ DONE;
12077+ }
12078+
12079+ if (GET_CODE (operands[1]) == CONST_INT){
12080+ unsigned int sign_extend = (INTVAL(operands[1]) < 0) ? 0xFFFFFFFF : 0;
12081+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 12), operands[1]);
12082+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 8), GEN_INT(sign_extend));
12083+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 4), GEN_INT(sign_extend));
12084+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 0), GEN_INT(sign_extend));
12085+ DONE;
12086+ }
12087+
12088+ if (GET_CODE (operands[0]) == REG
12089+ && GET_CODE (operands[1]) == REG){
12090+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 12), gen_rtx_SUBREG(SImode, operands[1], 12));
12091+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 8), gen_rtx_SUBREG(SImode, operands[1], 8));
12092+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 4), gen_rtx_SUBREG(SImode, operands[1], 4));
12093+ emit_move_insn(gen_rtx_SUBREG(SImode, operands[0], 0), gen_rtx_SUBREG(SImode, operands[1], 0));
12094+ DONE;
12095+ }
12096+ })
12097+
12098+
12099+(define_insn "*movti_internal"
12100+ [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r, <RKu00,r")
12101+ (match_operand:TI 1 "loadti_operand" " r,RKu00>,r,m"))]
12102+ ""
12103+ "@
12104+ mov\t%T0, %T1\;mov\t%U0, %U1\;mov\t%L0, %L1\;mov\t%B0, %B1
12105+ ldm\t%p1, %0
12106+ stm\t%p0, %1
12107+ ldm\t%p1, %0"
12108+ [(set_attr "length" "8,4,4,4")
12109+ (set_attr "type" "alu,load4,store4,load4")])
12110+
12111+
12112+;;== float - 32 bits ==========================================================
12113+(define_expand "movsf"
12114+ [(set (match_operand:SF 0 "nonimmediate_operand" "")
12115+ (match_operand:SF 1 "general_operand" ""))]
12116+ ""
12117+ {
12118+
12119+
12120+ /* One of the ops has to be in a register. */
12121+ if (GET_CODE (operands[0]) != REG)
12122+ operands[1] = force_reg (SFmode, operands[1]);
12123+
12124+ })
12125+
12126+(define_insn "*movsf_internal"
12127+ [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,r,m")
12128+ (match_operand:SF 1 "general_operand" "r,G,m,r"))]
12129+ "TARGET_SOFT_FLOAT"
12130+ {
12131+ switch (which_alternative) {
12132+ case 0:
12133+ case 1: return "mov\t%0, %1";
12134+ case 2:
12135+ if ( (REG_P(XEXP(operands[1], 0))
12136+ && REGNO(XEXP(operands[1], 0)) == SP_REGNUM)
12137+ || (GET_CODE(XEXP(operands[1], 0)) == PLUS
12138+ && REGNO(XEXP(XEXP(operands[1], 0), 0)) == SP_REGNUM
12139+ && GET_CODE(XEXP(XEXP(operands[1], 0), 1)) == CONST_INT
12140+ && INTVAL(XEXP(XEXP(operands[1], 0), 1)) % 4 == 0
12141+ && INTVAL(XEXP(XEXP(operands[1], 0), 1)) <= 0x1FC) )
12142+ return "lddsp\t%0, %1";
12143+ else if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])) )
12144+ return "lddpc\t%0, %1";
12145+ else
12146+ return "ld.w\t%0, %1";
12147+ case 3:
12148+ if ( (REG_P(XEXP(operands[0], 0))
12149+ && REGNO(XEXP(operands[0], 0)) == SP_REGNUM)
12150+ || (GET_CODE(XEXP(operands[0], 0)) == PLUS
12151+ && REGNO(XEXP(XEXP(operands[0], 0), 0)) == SP_REGNUM
12152+ && GET_CODE(XEXP(XEXP(operands[0], 0), 1)) == CONST_INT
12153+ && INTVAL(XEXP(XEXP(operands[0], 0), 1)) % 4 == 0
12154+ && INTVAL(XEXP(XEXP(operands[0], 0), 1)) <= 0x1FC) )
12155+ return "stdsp\t%0, %1";
12156+ else
12157+ return "st.w\t%0, %1";
12158+ default:
12159+ abort();
12160+ }
12161+ }
12162+
12163+ [(set_attr "length" "2,4,4,4")
12164+ (set_attr "type" "alu,alu,load,store")])
12165+
12166+
12167+
12168+;;== double - 64 bits =========================================================
12169+(define_expand "movdf"
12170+ [(set (match_operand:DF 0 "nonimmediate_operand" "")
12171+ (match_operand:DF 1 "general_operand" ""))]
12172+ ""
12173+ {
12174+ /* One of the ops has to be in a register. */
12175+ if (GET_CODE (operands[0]) != REG){
12176+ operands[1] = force_reg (DFmode, operands[1]);
12177+ }
12178+ })
12179+
12180+
12181+(define_insn_and_split "*movdf_internal"
12182+ [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,r,m")
12183+ (match_operand:DF 1 "general_operand" "r,G,m,r"))]
12184+ "TARGET_SOFT_FLOAT"
12185+ {
12186+ switch (which_alternative ){
12187+ case 0:
12188+ case 1:
12189+ return "mov\t%0, %1\;mov\t%m0, %m1";
12190+ case 2:
12191+ if ( avr32_const_pool_ref_operand(operands[1], GET_MODE(operands[1])))
12192+ return "ld.d\t%0, pc[%1 - .]";
12193+ else
12194+ return "ld.d\t%0, %1";
12195+ case 3:
12196+ return "st.d\t%0, %1";
12197+ default:
12198+ abort();
12199+ }
12200+ }
12201+ "TARGET_SOFT_FLOAT
12202+ && reload_completed
12203+ && (REG_P(operands[0]) && REG_P(operands[1]))"
12204+ [(set (match_dup 0) (match_dup 1))
12205+ (set (match_dup 2) (match_dup 3))]
12206+ "
12207+ {
12208+ operands[2] = gen_highpart (SImode, operands[0]);
12209+ operands[0] = gen_lowpart (SImode, operands[0]);
12210+ operands[3] = gen_highpart(SImode, operands[1]);
12211+ operands[1] = gen_lowpart(SImode, operands[1]);
12212+ }
12213+ "
12214+
12215+ [(set_attr "length" "4,8,4,4")
12216+ (set_attr "type" "alu2,alu2,load2,store2")])
12217+
12218+
12219+
12220+
12221+;;=============================================================================
12222+;; Move chunks of memory
12223+;;=============================================================================
12224+
12225+(define_expand "movmemsi"
12226+ [(match_operand:BLK 0 "general_operand" "")
12227+ (match_operand:BLK 1 "general_operand" "")
12228+ (match_operand:SI 2 "const_int_operand" "")
12229+ (match_operand:SI 3 "const_int_operand" "")]
12230+ ""
12231+ "
12232+ if (avr32_gen_movmemsi (operands))
12233+ DONE;
12234+ FAIL;
12235+ "
12236+ )
12237+
12238+
12239+
12240+
12241+;;=============================================================================
12242+;; Bit field instructions
12243+;;-----------------------------------------------------------------------------
12244+;; Instructions to insert or extract bit-fields
12245+;;=============================================================================
12246+
12247+(define_insn "insv"
12248+ [ (set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
12249+ (match_operand:SI 1 "immediate_operand" "Ku05")
12250+ (match_operand:SI 2 "immediate_operand" "Ku05"))
12251+ (match_operand 3 "register_operand" "r"))]
12252+ ""
12253+ "bfins\t%0, %3, %2, %1"
12254+ [(set_attr "type" "alu")
12255+ (set_attr "length" "4")
12256+ (set_attr "cc" "set_ncz")])
12257+
12258+
12259+
12260+
12261+(define_insn "extv"
12262+ [ (set (match_operand:SI 0 "register_operand" "=r")
12263+ (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
12264+ (match_operand:SI 2 "immediate_operand" "Ku05")
12265+ (match_operand:SI 3 "immediate_operand" "Ku05")))]
12266+ ""
12267+ "bfexts\t%0, %1, %3, %2"
12268+ [(set_attr "type" "alu")
12269+ (set_attr "length" "4")
12270+ (set_attr "cc" "set_ncz")])
12271+
12272+
12273+(define_insn "extzv"
12274+ [ (set (match_operand:SI 0 "register_operand" "=r")
12275+ (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
12276+ (match_operand:SI 2 "immediate_operand" "Ku05")
12277+ (match_operand:SI 3 "immediate_operand" "Ku05")))]
12278+ ""
12279+ "bfextu\t%0, %1, %3, %2"
12280+ [(set_attr "type" "alu")
12281+ (set_attr "length" "4")
12282+ (set_attr "cc" "set_ncz")])
12283+
12284+
12285+
12286+;;=============================================================================
12287+;; Some peepholes for avoiding unnecessary cast instructions
12288+;; followed by bfins.
12289+;;-----------------------------------------------------------------------------
12290+
12291+(define_peephole2
12292+ [(set (match_operand:SI 0 "register_operand" "")
12293+ (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
12294+ (set (zero_extract:SI (match_operand 2 "register_operand" "")
12295+ (match_operand:SI 3 "immediate_operand" "")
12296+ (match_operand:SI 4 "immediate_operand" ""))
12297+ (match_dup 0))]
12298+ "((peep2_reg_dead_p(2, operands[0]) &&
12299+ (INTVAL(operands[3]) <= 8)))"
12300+ [(set (zero_extract:SI (match_dup 2)
12301+ (match_dup 3)
12302+ (match_dup 4))
12303+ (match_dup 1))]
12304+ )
12305+
12306+(define_peephole2
12307+ [(set (match_operand:SI 0 "register_operand" "")
12308+ (zero_extend:SI (match_operand:HI 1 "register_operand" "")))
12309+ (set (zero_extract:SI (match_operand 2 "register_operand" "")
12310+ (match_operand:SI 3 "immediate_operand" "")
12311+ (match_operand:SI 4 "immediate_operand" ""))
12312+ (match_dup 0))]
12313+ "((peep2_reg_dead_p(2, operands[0]) &&
12314+ (INTVAL(operands[3]) <= 16)))"
12315+ [(set (zero_extract:SI (match_dup 2)
12316+ (match_dup 3)
12317+ (match_dup 4))
12318+ (match_dup 1))]
12319+ )
12320+
12321+;;=============================================================================
12322+;; push bytes
12323+;;-----------------------------------------------------------------------------
12324+;; Implements the push instruction
12325+;;=============================================================================
12326+(define_insn "pushm"
12327+ [(set (mem:BLK (pre_dec:BLK (reg:SI SP_REGNUM)))
12328+ (unspec:BLK [(match_operand 0 "const_int_operand" "")]
12329+ UNSPEC_PUSHM))]
12330+ ""
12331+ {
12332+ if (INTVAL(operands[0])) {
12333+ return "pushm\t%r0";
12334+ } else {
12335+ return "";
12336+ }
12337+ }
12338+ [(set_attr "type" "store")
12339+ (set_attr "length" "2")
12340+ (set_attr "cc" "none")])
12341+
12342+(define_insn "stm"
12343+ [(unspec [(match_operand 0 "register_operand" "r")
12344+ (match_operand 1 "const_int_operand" "")
12345+ (match_operand 2 "const_int_operand" "")]
12346+ UNSPEC_STM)]
12347+ ""
12348+ {
12349+ if (INTVAL(operands[1])) {
12350+ if (INTVAL(operands[2]) != 0)
12351+ return "stm\t--%0, %s1";
12352+ else
12353+ return "stm\t%0, %s1";
12354+ } else {
12355+ return "";
12356+ }
12357+ }
12358+ [(set_attr "type" "store")
12359+ (set_attr "length" "4")
12360+ (set_attr "cc" "none")])
12361+
12362+
12363+
12364+(define_insn "popm"
12365+ [(unspec [(match_operand 0 "const_int_operand" "")]
12366+ UNSPEC_POPM)]
12367+ ""
12368+ {
12369+ if (INTVAL(operands[0])) {
12370+ return "popm %r0";
12371+ } else {
12372+ return "";
12373+ }
12374+ }
12375+ [(set_attr "type" "load")
12376+ (set_attr "length" "2")])
12377+
12378+
12379+
12380+;;=============================================================================
12381+;; add
12382+;;-----------------------------------------------------------------------------
12383+;; Adds reg1 with reg2 and puts the result in reg0.
12384+;;=============================================================================
12385+(define_insn "add<mode>3"
12386+ [(set (match_operand:INTM 0 "register_operand" "=r,r,r,r,r")
12387+ (plus:INTM (match_operand:INTM 1 "register_operand" "%0,r,0,r,0")
12388+ (match_operand:INTM 2 "avr32_add_operand" "r,r,Is08,Is16,Is21")))]
12389+ ""
12390+ "@
12391+ add %0, %2
12392+ add %0, %1, %2
12393+ sub %0, %n2
12394+ sub %0, %1, %n2
12395+ sub %0, %n2"
12396+
12397+ [(set_attr "length" "2,4,2,4,4")
12398+ (set_attr "cc" "<INTM:alu_cc_attr>")])
12399+
12400+(define_insn "*addsi3_lsl"
12401+ [(set (match_operand:SI 0 "register_operand" "=r")
12402+ (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
12403+ (match_operand:SI 3 "avr32_add_shift_immediate_operand" "Ku02"))
12404+ (match_operand:SI 2 "register_operand" "r")))]
12405+ ""
12406+ "add %0, %2, %1 << %3"
12407+ [(set_attr "length" "4")
12408+ (set_attr "cc" "set_vncz")])
12409+
12410+
12411+(define_insn "*addsi3_mul"
12412+ [(set (match_operand:SI 0 "register_operand" "=r")
12413+ (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")
12414+ (match_operand:SI 3 "immediate_operand" "Ku04" ))
12415+ (match_operand:SI 2 "register_operand" "r")))]
12416+ "(INTVAL(operands[3]) == 0) || (INTVAL(operands[3]) == 2) ||
12417+ (INTVAL(operands[3]) == 4) || (INTVAL(operands[3]) == 8)"
12418+ "add %0, %2, %1 << %p3"
12419+ [(set_attr "length" "4")
12420+ (set_attr "cc" "set_vncz")])
12421+
12422+
12423+(define_peephole2
12424+ [(set (match_operand:SI 0 "register_operand" "")
12425+ (ashift:SI (match_operand:SI 1 "register_operand" "")
12426+ (match_operand:SI 2 "immediate_operand" "")))
12427+ (set (match_operand:SI 3 "register_operand" "")
12428+ (plus:SI (match_dup 0)
12429+ (match_operand:SI 4 "register_operand" "")))]
12430+ "(peep2_reg_dead_p(2, operands[0]) &&
12431+ (INTVAL(operands[2]) < 4 && INTVAL(operands[2]) > 0))"
12432+ [(set (match_dup 3)
12433+ (plus:SI (ashift:SI (match_dup 1)
12434+ (match_dup 2))
12435+ (match_dup 4)))]
12436+ )
12437+
12438+(define_peephole2
12439+ [(set (match_operand:SI 0 "register_operand" "")
12440+ (ashift:SI (match_operand:SI 1 "register_operand" "")
12441+ (match_operand:SI 2 "immediate_operand" "")))
12442+ (set (match_operand:SI 3 "register_operand" "")
12443+ (plus:SI (match_operand:SI 4 "register_operand" "")
12444+ (match_dup 0)))]
12445+ "(peep2_reg_dead_p(2, operands[0]) &&
12446+ (INTVAL(operands[2]) < 4 && INTVAL(operands[2]) > 0))"
12447+ [(set (match_dup 3)
12448+ (plus:SI (ashift:SI (match_dup 1)
12449+ (match_dup 2))
12450+ (match_dup 4)))]
12451+ )
12452+
12453+(define_insn "adddi3"
12454+ [(set (match_operand:DI 0 "register_operand" "=r,r")
12455+ (plus:DI (match_operand:DI 1 "register_operand" "%r,0")
12456+ (match_operand:DI 2 "register_operand" "r,r")))]
12457+ ""
12458+ "@
12459+ add %0, %1, %2\;adc %m0, %m1, %m2
12460+ add %0, %2\;adc %m0, %m0, %m2"
12461+ [(set_attr "length" "8,6")
12462+ (set_attr "type" "alu2")
12463+ (set_attr "cc" "set_vncz")])
12464+
12465+
12466+
12467+;;=============================================================================
12468+;; subtract
12469+;;-----------------------------------------------------------------------------
12470+;; Subtract reg2 or immediate value from reg0 and puts the result in reg0.
12471+;;=============================================================================
12472+
12473+(define_peephole2
12474+ [(set (match_operand:QI 0 "register_operand" "")
12475+ (minus:QI (match_operand:QI 1 "general_operand" "")
12476+ (match_operand:QI 2 "general_operand" "")))
12477+ (set (match_operand:QI 3 "register_operand" "")
12478+ (match_dup 0))]
12479+ "peep2_reg_dead_p(2, operands[0])"
12480+ [(set (match_dup 3)
12481+ (minus:QI (match_dup 1) (match_dup 2)))]
12482+ )
12483+
12484+(define_peephole
12485+ [(set (match_operand:QI 0 "register_operand" "")
12486+ (minus:QI (match_operand:QI 1 "immediate_operand" "Ks08")
12487+ (match_operand:QI 2 "register_operand" "r")))
12488+ (set (match_operand:QI 3 "register_operand" "r")
12489+ (match_dup 0))]
12490+ "dead_or_set_p(insn, operands[0])"
12491+ "rsub %3, %2, %1"
12492+ [(set_attr "length" "4")
12493+ (set_attr "cc" "clobber")]
12494+ )
12495+
12496+
12497+
12498+(define_insn "sub<mode>3"
12499+ [(set (match_operand:INTM 0 "general_operand" "=r,r,r,r,r,r,r")
12500+ (minus:INTM (match_operand:INTM 1 "nonmemory_operand" "0,r,0,r,0,r,Ks08")
12501+ (match_operand:INTM 2 "nonmemory_operand" "r,r,Ks08,Ks16,Ks21,0,r")))]
12502+ ""
12503+ "@
12504+ sub %0, %2
12505+ sub %0, %1, %2
12506+ sub %0, %2
12507+ sub %0, %1, %2
12508+ sub %0, %2
12509+ rsub %0, %1
12510+ rsub %0, %2, %1"
12511+ [(set_attr "length" "2,4,2,4,4,2,4")
12512+ (set_attr "cc" "<INTM:alu_cc_attr>")])
12513+
12514+(define_insn "*sub<mode>3_mul"
12515+ [(set (match_operand:INTM 0 "register_operand" "=r,r,r")
12516+ (minus:INTM (match_operand:INTM 1 "register_operand" "r,0,r")
12517+ (mult:INTM (match_operand:INTM 2 "register_operand" "r,r,0")
12518+ (match_operand:SI 3 "immediate_operand" "Ku04,Ku04,Ku04" ))))]
12519+ "(INTVAL(operands[3]) == 0) || (INTVAL(operands[3]) == 2) ||
12520+ (INTVAL(operands[3]) == 4) || (INTVAL(operands[3]) == 8)"
12521+ "@
12522+ sub %0, %1, %2 << %p3
12523+ sub %0, %0, %2 << %p3
12524+ sub %0, %1, %0 << %p3"
12525+ [(set_attr "length" "4,4,4")
12526+ (set_attr "cc" "<INTM:alu_cc_attr>")])
12527+
12528+(define_insn "*sub<mode>3_lsl"
12529+ [(set (match_operand:INTM 0 "register_operand" "=r")
12530+ (minus:INTM (ashift:INTM (match_operand:INTM 1 "register_operand" "r")
12531+ (match_operand:SI 3 "avr32_add_shift_immediate_operand" "Ku02"))
12532+ (match_operand:INTM 2 "register_operand" "r")))]
12533+ ""
12534+ "sub %0, %2, %1 << %3"
12535+ [(set_attr "length" "4")
12536+ (set_attr "cc" "<INTM:alu_cc_attr>")])
12537+
12538+
12539+(define_insn "subdi3"
12540+ [(set (match_operand:DI 0 "register_operand" "=r,r")
12541+ (minus:DI (match_operand:DI 1 "register_operand" "%r,0")
12542+ (match_operand:DI 2 "register_operand" "r,r")))]
12543+ ""
12544+ "@
12545+ sub %0, %1, %2\;sbc %m0, %m1, %m2
12546+ sub %0, %2\;sbc %m0, %m0, %m2"
12547+ [(set_attr "length" "8,6")
12548+ (set_attr "type" "alu2")
12549+ (set_attr "cc" "set_vncz")])
12550+
12551+
12552+
12553+;;=============================================================================
12554+;; multiply
12555+;;-----------------------------------------------------------------------------
12556+;; Multiply op1 and op2 and put the value in op0.
12557+;;=============================================================================
12558+
12559+
12560+(define_insn "mulqi3"
12561+ [(set (match_operand:QI 0 "register_operand" "=r,r,r")
12562+ (mult:QI (match_operand:QI 1 "register_operand" "%0,r,r")
12563+ (match_operand:QI 2 "avr32_mul_operand" "r,r,Ks08")))]
12564+ ""
12565+ {
12566+ switch (which_alternative){
12567+ case 0:
12568+ return "mul %0, %2";
12569+ case 1:
12570+ return "mul %0, %1, %2";
12571+ case 2:
12572+ return "mul %0, %1, %2";
12573+ default:
12574+ abort();
12575+ }
12576+ }
12577+ [(set_attr "type" "mulww_w,mulww_w,mulwh")
12578+ (set_attr "length" "2,4,4")
12579+ (set_attr "cc" "none")])
12580+
12581+(define_insn "mulsi3"
12582+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
12583+ (mult:SI (match_operand:SI 1 "register_operand" "%0,r,r")
12584+ (match_operand:SI 2 "avr32_mul_operand" "r,r,Ks08")))]
12585+ ""
12586+ {
12587+ switch (which_alternative){
12588+ case 0:
12589+ return "mul %0, %2";
12590+ case 1:
12591+ return "mul %0, %1, %2";
12592+ case 2:
12593+ return "mul %0, %1, %2";
12594+ default:
12595+ abort();
12596+ }
12597+ }
12598+ [(set_attr "type" "mulww_w,mulww_w,mulwh")
12599+ (set_attr "length" "2,4,4")
12600+ (set_attr "cc" "none")])
12601+
12602+
12603+(define_insn "mulhisi3"
12604+ [(set (match_operand:SI 0 "register_operand" "=r")
12605+ (mult:SI
12606+ (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
12607+ (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
12608+ "TARGET_DSP"
12609+ "mulhh.w %0, %1:b, %2:b"
12610+ [(set_attr "type" "mulhh")
12611+ (set_attr "length" "4")
12612+ (set_attr "cc" "none")])
12613+
12614+(define_peephole2
12615+ [(match_scratch:DI 6 "r")
12616+ (set (match_operand:SI 0 "register_operand" "")
12617+ (mult:SI
12618+ (sign_extend:SI (match_operand:HI 1 "register_operand" ""))
12619+ (sign_extend:SI (match_operand:HI 2 "register_operand" ""))))
12620+ (set (match_operand:SI 3 "register_operand" "")
12621+ (ashiftrt:SI (match_dup 0)
12622+ (const_int 16)))]
12623+ "TARGET_DSP
12624+ && (peep2_reg_dead_p(1, operands[0]) || (REGNO(operands[0]) == REGNO(operands[3])))"
12625+ [(set (match_dup 4) (sign_extend:SI (match_dup 1)))
12626+ (set (match_dup 6)
12627+ (ashift:DI (mult:DI (sign_extend:DI (match_dup 4))
12628+ (sign_extend:DI (match_dup 2)))
12629+ (const_int 16)))
12630+ (set (match_dup 3) (match_dup 5))]
12631+
12632+ "{
12633+ operands[4] = gen_rtx_REG(SImode, REGNO(operands[1]));
12634+ operands[5] = gen_highpart (SImode, operands[4]);
12635+ }"
12636+ )
12637+
12638+(define_insn "mulnhisi3"
12639+ [(set (match_operand:SI 0 "register_operand" "=r")
12640+ (mult:SI
12641+ (sign_extend:SI (neg:HI (match_operand:HI 1 "register_operand" "r")))
12642+ (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
12643+ "TARGET_DSP"
12644+ "mulnhh.w %0, %1:b, %2:b"
12645+ [(set_attr "type" "mulhh")
12646+ (set_attr "length" "4")
12647+ (set_attr "cc" "none")])
12648+
12649+(define_insn "machisi3"
12650+ [(set (match_operand:SI 0 "register_operand" "+r")
12651+ (plus:SI (mult:SI
12652+ (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
12653+ (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))
12654+ (match_dup 0)))]
12655+ "TARGET_DSP"
12656+ "machh.w %0, %1:b, %2:b"
12657+ [(set_attr "type" "machh_w")
12658+ (set_attr "length" "4")
12659+ (set_attr "cc" "none")])
12660+
12661+
12662+
12663+(define_insn "mulsidi3"
12664+ [(set (match_operand:DI 0 "register_operand" "=r")
12665+ (mult:DI
12666+ (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
12667+ (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
12668+ ""
12669+ "muls.d %0, %1, %2"
12670+ [(set_attr "type" "mulww_d")
12671+ (set_attr "length" "4")
12672+ (set_attr "cc" "none")])
12673+
12674+(define_insn "umulsidi3"
12675+ [(set (match_operand:DI 0 "register_operand" "=r")
12676+ (mult:DI
12677+ (zero_extend:DI (match_operand:SI 1 "register_operand" "%r"))
12678+ (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
12679+ ""
12680+ "mulu.d %0, %1, %2"
12681+ [(set_attr "type" "mulww_d")
12682+ (set_attr "length" "4")
12683+ (set_attr "cc" "none")])
12684+
12685+(define_insn "*mulaccsi3"
12686+ [(set (match_operand:SI 0 "register_operand" "+r")
12687+ (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "%r")
12688+ (match_operand:SI 2 "register_operand" "r"))
12689+ (match_dup 0)))]
12690+ ""
12691+ "mac %0, %1, %2"
12692+ [(set_attr "type" "macww_w")
12693+ (set_attr "length" "4")
12694+ (set_attr "cc" "none")])
12695+
12696+(define_insn "mulaccsidi3"
12697+ [(set (match_operand:DI 0 "register_operand" "+r")
12698+ (plus:DI (mult:DI
12699+ (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
12700+ (sign_extend:DI (match_operand:SI 2 "register_operand" "r")))
12701+ (match_dup 0)))]
12702+ ""
12703+ "macs.d %0, %1, %2"
12704+ [(set_attr "type" "macww_d")
12705+ (set_attr "length" "4")
12706+ (set_attr "cc" "none")])
12707+
12708+(define_insn "umulaccsidi3"
12709+ [(set (match_operand:DI 0 "register_operand" "+r")
12710+ (plus:DI (mult:DI
12711+ (zero_extend:DI (match_operand:SI 1 "register_operand" "%r"))
12712+ (zero_extend:DI (match_operand:SI 2 "register_operand" "r")))
12713+ (match_dup 0)))]
12714+ ""
12715+ "macu.d %0, %1, %2"
12716+ [(set_attr "type" "macww_d")
12717+ (set_attr "length" "4")
12718+ (set_attr "cc" "none")])
12719+
12720+
12721+
12722+;; Try to avoid Write-After-Write hazards for mul operations
12723+;; if it can be done
12724+(define_peephole2
12725+ [(set (match_operand:SI 0 "register_operand" "")
12726+ (mult:SI
12727+ (sign_extend:SI (match_operand 1 "general_operand" ""))
12728+ (sign_extend:SI (match_operand 2 "general_operand" ""))))
12729+ (set (match_dup 0)
12730+ (match_operator:SI 3 "alu_operator" [(match_dup 0)
12731+ (match_operand 4 "general_operand" "")]))]
12732+ "peep2_reg_dead_p(1, operands[2])"
12733+ [(set (match_dup 5)
12734+ (mult:SI
12735+ (sign_extend:SI (match_dup 1))
12736+ (sign_extend:SI (match_dup 2))))
12737+ (set (match_dup 0)
12738+ (match_op_dup 3 [(match_dup 5)
12739+ (match_dup 4)]))]
12740+ "{operands[5] = gen_rtx_REG(SImode, REGNO(operands[2]));}"
12741+ )
12742+
12743+
12744+
12745+;;=============================================================================
12746+;; DSP instructions
12747+;;=============================================================================
12748+(define_insn "mulsathh_h"
12749+ [(set (match_operand:HI 0 "register_operand" "=r")
12750+ (ss_truncate:HI (ashiftrt:SI (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
12751+ (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))
12752+ (const_int 15))))]
12753+ "TARGET_DSP"
12754+ "mulsathh.h\t%0, %1:b, %2:b"
12755+ [(set_attr "length" "4")
12756+ (set_attr "cc" "none")
12757+ (set_attr "type" "mulhh")])
12758+
12759+(define_insn "mulsatrndhh_h"
12760+ [(set (match_operand:HI 0 "register_operand" "=r")
12761+ (ss_truncate:HI (ashiftrt:SI
12762+ (plus:SI (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "%r"))
12763+ (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))
12764+ (const_int 1073741824))
12765+ (const_int 15))))]
12766+ "TARGET_DSP"
12767+ "mulsatrndhh.h\t%0, %1:b, %2:b"
12768+ [(set_attr "length" "4")
12769+ (set_attr "cc" "none")
12770+ (set_attr "type" "mulhh")])
12771+
12772+(define_insn "mulsathh_w"
12773+ [(set (match_operand:SI 0 "register_operand" "=r")
12774+ (ss_truncate:SI (ashift:DI (mult:DI (sign_extend:DI (match_operand:HI 1 "register_operand" "%r"))
12775+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12776+ (const_int 1))))]
12777+ "TARGET_DSP"
12778+ "mulsathh.w\t%0, %1:b, %2:b"
12779+ [(set_attr "length" "4")
12780+ (set_attr "cc" "none")
12781+ (set_attr "type" "mulhh")])
12782+
12783+(define_insn "mulsatwh_w"
12784+ [(set (match_operand:SI 0 "register_operand" "=r")
12785+ (ss_truncate:SI (ashiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
12786+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12787+ (const_int 15))))]
12788+ "TARGET_DSP"
12789+ "mulsatwh.w\t%0, %1, %2:b"
12790+ [(set_attr "length" "4")
12791+ (set_attr "cc" "none")
12792+ (set_attr "type" "mulwh")])
12793+
12794+(define_insn "mulsatrndwh_w"
12795+ [(set (match_operand:SI 0 "register_operand" "=r")
12796+ (ss_truncate:SI (ashiftrt:DI (plus:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
12797+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12798+ (const_int 1073741824))
12799+ (const_int 15))))]
12800+ "TARGET_DSP"
12801+ "mulsatrndwh.w\t%0, %1, %2:b"
12802+ [(set_attr "length" "4")
12803+ (set_attr "cc" "none")
12804+ (set_attr "type" "mulwh")])
12805+
12806+(define_insn "macsathh_w"
12807+ [(set (match_operand:SI 0 "register_operand" "+r")
12808+ (plus:SI (match_dup 0)
12809+ (ss_truncate:SI (ashift:DI (mult:DI (sign_extend:DI (match_operand:HI 1 "register_operand" "%r"))
12810+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12811+ (const_int 1)))))]
12812+ "TARGET_DSP"
12813+ "macsathh.w\t%0, %1:b, %2:b"
12814+ [(set_attr "length" "4")
12815+ (set_attr "cc" "none")
12816+ (set_attr "type" "mulhh")])
12817+
12818+
12819+(define_insn "mulwh_d"
12820+ [(set (match_operand:DI 0 "register_operand" "=r")
12821+ (ashift:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
12822+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12823+ (const_int 16)))]
12824+ "TARGET_DSP"
12825+ "mulwh.d\t%0, %1, %2:b"
12826+ [(set_attr "length" "4")
12827+ (set_attr "cc" "none")
12828+ (set_attr "type" "mulwh")])
12829+
12830+
12831+(define_insn "mulnwh_d"
12832+ [(set (match_operand:DI 0 "register_operand" "=r")
12833+ (ashift:DI (mult:DI (not:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))
12834+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12835+ (const_int 16)))]
12836+ "TARGET_DSP"
12837+ "mulnwh.d\t%0, %1, %2:b"
12838+ [(set_attr "length" "4")
12839+ (set_attr "cc" "none")
12840+ (set_attr "type" "mulwh")])
12841+
12842+(define_insn "macwh_d"
12843+ [(set (match_operand:DI 0 "register_operand" "+r")
12844+ (plus:DI (match_dup 0)
12845+ (ashift:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
12846+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))
12847+ (const_int 16))))]
12848+ "TARGET_DSP"
12849+ "macwh.d\t%0, %1, %2:b"
12850+ [(set_attr "length" "4")
12851+ (set_attr "cc" "none")
12852+ (set_attr "type" "mulwh")])
12853+
12854+(define_insn "machh_d"
12855+ [(set (match_operand:DI 0 "register_operand" "+r")
12856+ (plus:DI (match_dup 0)
12857+ (mult:DI (sign_extend:DI (match_operand:HI 1 "register_operand" "%r"))
12858+ (sign_extend:DI (match_operand:HI 2 "register_operand" "r")))))]
12859+ "TARGET_DSP"
12860+ "machh.d\t%0, %1:b, %2:b"
12861+ [(set_attr "length" "4")
12862+ (set_attr "cc" "none")
12863+ (set_attr "type" "mulwh")])
12864+
12865+(define_insn "satadd_w"
12866+ [(set (match_operand:SI 0 "register_operand" "=r")
12867+ (ss_plus:SI (match_operand:SI 1 "register_operand" "r")
12868+ (match_operand:SI 2 "register_operand" "r")))]
12869+ "TARGET_DSP"
12870+ "satadd.w\t%0, %1, %2"
12871+ [(set_attr "length" "4")
12872+ (set_attr "cc" "none")
12873+ (set_attr "type" "alu_sat")])
12874+
12875+(define_insn "satsub_w"
12876+ [(set (match_operand:SI 0 "register_operand" "=r")
12877+ (ss_minus:SI (match_operand:SI 1 "register_operand" "r")
12878+ (match_operand:SI 2 "register_operand" "r")))]
12879+ "TARGET_DSP"
12880+ "satsub.w\t%0, %1, %2"
12881+ [(set_attr "length" "4")
12882+ (set_attr "cc" "none")
12883+ (set_attr "type" "alu_sat")])
12884+
12885+(define_insn "satadd_h"
12886+ [(set (match_operand:HI 0 "register_operand" "=r")
12887+ (ss_plus:HI (match_operand:HI 1 "register_operand" "r")
12888+ (match_operand:HI 2 "register_operand" "r")))]
12889+ "TARGET_DSP"
12890+ "satadd.h\t%0, %1, %2"
12891+ [(set_attr "length" "4")
12892+ (set_attr "cc" "none")
12893+ (set_attr "type" "alu_sat")])
12894+
12895+(define_insn "satsub_h"
12896+ [(set (match_operand:HI 0 "register_operand" "=r")
12897+ (ss_minus:HI (match_operand:HI 1 "register_operand" "r")
12898+ (match_operand:HI 2 "register_operand" "r")))]
12899+ "TARGET_DSP"
12900+ "satsub.h\t%0, %1, %2"
12901+ [(set_attr "length" "4")
12902+ (set_attr "cc" "none")
12903+ (set_attr "type" "alu_sat")])
12904+
12905+
12906+;;=============================================================================
12907+;; smin
12908+;;-----------------------------------------------------------------------------
12909+;; Set reg0 to the smallest value of reg1 and reg2. It is used for signed
12910+;; values in the registers.
12911+;;=============================================================================
12912+(define_insn "sminsi3"
12913+ [(set (match_operand:SI 0 "register_operand" "=r")
12914+ (smin:SI (match_operand:SI 1 "register_operand" "r")
12915+ (match_operand:SI 2 "register_operand" "r")))]
12916+ ""
12917+ "min %0, %1, %2"
12918+ [(set_attr "length" "4")
12919+ (set_attr "cc" "none")])
12920+
12921+;;=============================================================================
12922+;; smax
12923+;;-----------------------------------------------------------------------------
12924+;; Set reg0 to the largest value of reg1 and reg2. It is used for signed
12925+;; values in the registers.
12926+;;=============================================================================
12927+(define_insn "smaxsi3"
12928+ [(set (match_operand:SI 0 "register_operand" "=r")
12929+ (smax:SI (match_operand:SI 1 "register_operand" "r")
12930+ (match_operand:SI 2 "register_operand" "r")))]
12931+ ""
12932+ "max %0, %1, %2"
12933+ [(set_attr "length" "4")
12934+ (set_attr "cc" "none")])
12935+
12936+
12937+;;=============================================================================
12938+;; Logical operations
12939+;;-----------------------------------------------------------------------------
12940+
12941+;; Split up simple DImode logical operations. Simply perform the logical
12942+;; operation on the upper and lower halves of the registers.
12943+(define_split
12944+ [(set (match_operand:DI 0 "register_operand" "")
12945+ (match_operator:DI 6 "logical_binary_operator"
12946+ [(match_operand:DI 1 "register_operand" "")
12947+ (match_operand:DI 2 "register_operand" "")]))]
12948+ "reload_completed"
12949+ [(set (match_dup 0) (match_op_dup:SI 6 [(match_dup 1) (match_dup 2)]))
12950+ (set (match_dup 3) (match_op_dup:SI 6 [(match_dup 4) (match_dup 5)]))]
12951+ "
12952+ {
12953+ operands[3] = gen_highpart (SImode, operands[0]);
12954+ operands[0] = gen_lowpart (SImode, operands[0]);
12955+ operands[4] = gen_highpart (SImode, operands[1]);
12956+ operands[1] = gen_lowpart (SImode, operands[1]);
12957+ operands[5] = gen_highpart (SImode, operands[2]);
12958+ operands[2] = gen_lowpart (SImode, operands[2]);
12959+ }"
12960+)
12961+
12962+;;=============================================================================
12963+;; Logical operations with shifted operand
12964+;;=============================================================================
12965+(define_insn "<code>si_lshift"
12966+ [(set (match_operand:SI 0 "register_operand" "=r")
12967+ (logical:SI (match_operator:SI 4 "logical_shift_operator"
12968+ [(match_operand:SI 2 "register_operand" "r")
12969+ (match_operand:SI 3 "immediate_operand" "Ku05")])
12970+ (match_operand:SI 1 "register_operand" "r")))]
12971+ ""
12972+ {
12973+ if ( GET_CODE(operands[4]) == ASHIFT )
12974+ return "<logical_insn>\t%0, %1, %2 << %3";
12975+ else
12976+ return "<logical_insn>\t%0, %1, %2 >> %3";
12977+ }
12978+
12979+ [(set_attr "cc" "set_z")]
12980+)
12981+
12982+
12983+;;************************************************
12984+;; Peepholes for detecting logical operantions
12985+;; with shifted operands
12986+;;************************************************
12987+
12988+(define_peephole
12989+ [(set (match_operand:SI 3 "register_operand" "")
12990+ (match_operator:SI 5 "logical_shift_operator"
12991+ [(match_operand:SI 1 "register_operand" "")
12992+ (match_operand:SI 2 "immediate_operand" "")]))
12993+ (set (match_operand:SI 0 "register_operand" "")
12994+ (logical:SI (match_operand:SI 4 "register_operand" "")
12995+ (match_dup 3)))]
12996+ "(dead_or_set_p(insn, operands[3])) || (REGNO(operands[3]) == REGNO(operands[0]))"
12997+ {
12998+ if ( GET_CODE(operands[5]) == ASHIFT )
12999+ return "<logical_insn>\t%0, %4, %1 << %2";
13000+ else
13001+ return "<logical_insn>\t%0, %4, %1 >> %2";
13002+ }
13003+ [(set_attr "cc" "set_z")]
13004+ )
13005+
13006+(define_peephole
13007+ [(set (match_operand:SI 3 "register_operand" "")
13008+ (match_operator:SI 5 "logical_shift_operator"
13009+ [(match_operand:SI 1 "register_operand" "")
13010+ (match_operand:SI 2 "immediate_operand" "")]))
13011+ (set (match_operand:SI 0 "register_operand" "")
13012+ (logical:SI (match_dup 3)
13013+ (match_operand:SI 4 "register_operand" "")))]
13014+ "(dead_or_set_p(insn, operands[3])) || (REGNO(operands[3]) == REGNO(operands[0]))"
13015+ {
13016+ if ( GET_CODE(operands[5]) == ASHIFT )
13017+ return "<logical_insn>\t%0, %4, %1 << %2";
13018+ else
13019+ return "<logical_insn>\t%0, %4, %1 >> %2";
13020+ }
13021+ [(set_attr "cc" "set_z")]
13022+ )
13023+
13024+
13025+(define_peephole2
13026+ [(set (match_operand:SI 0 "register_operand" "")
13027+ (match_operator:SI 5 "logical_shift_operator"
13028+ [(match_operand:SI 1 "register_operand" "")
13029+ (match_operand:SI 2 "immediate_operand" "")]))
13030+ (set (match_operand:SI 3 "register_operand" "")
13031+ (logical:SI (match_operand:SI 4 "register_operand" "")
13032+ (match_dup 0)))]
13033+ "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[3]) == REGNO(operands[0]))"
13034+
13035+ [(set (match_dup 3)
13036+ (logical:SI (match_op_dup:SI 5 [(match_dup 1) (match_dup 2)])
13037+ (match_dup 4)))]
13038+
13039+ ""
13040+)
13041+
13042+(define_peephole2
13043+ [(set (match_operand:SI 0 "register_operand" "")
13044+ (match_operator:SI 5 "logical_shift_operator"
13045+ [(match_operand:SI 1 "register_operand" "")
13046+ (match_operand:SI 2 "immediate_operand" "")]))
13047+ (set (match_operand:SI 3 "register_operand" "")
13048+ (logical:SI (match_dup 0)
13049+ (match_operand:SI 4 "register_operand" "")))]
13050+ "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[3]) == REGNO(operands[0]))"
13051+
13052+ [(set (match_dup 3)
13053+ (logical:SI (match_op_dup:SI 5 [(match_dup 1) (match_dup 2)])
13054+ (match_dup 4)))]
13055+
13056+ ""
13057+)
13058+
13059+
13060+;;=============================================================================
13061+;; and
13062+;;-----------------------------------------------------------------------------
13063+;; Store the result after a bitwise logical-and between reg0 and reg2 in reg0.
13064+;;=============================================================================
13065+
13066+(define_insn "andnsi"
13067+ [(set (match_operand:SI 0 "register_operand" "=r")
13068+ (and:SI (match_operand:SI 1 "register_operand" "0")
13069+ (not:SI (match_operand:SI 2 "register_operand" "r"))))]
13070+ ""
13071+ "andn %0, %2"
13072+ [(set_attr "cc" "set_z")
13073+ (set_attr "length" "2")]
13074+)
13075+
13076+
13077+
13078+
13079+(define_insn "andsi3"
13080+ [(set (match_operand:SI 0 "register_operand" "=r, r, r, r")
13081+ (and:SI (match_operand:SI 1 "register_operand" "%0, r, 0, r")
13082+ (match_operand:SI 2 "nonmemory_operand" "r, M, i, r")))]
13083+ ""
13084+ {
13085+ switch (which_alternative){
13086+ case 0:
13087+ return "and\t%0, %2";
13088+ case 1:
13089+ {
13090+ int i, first_set = -1;
13091+ /* Search for first bit set in mask */
13092+ for ( i = 31; i >= 0; --i )
13093+ if ( INTVAL(operands[2]) & (1 << i) ){
13094+ first_set = i;
13095+ break;
13096+ }
13097+ operands[2] = gen_rtx_CONST_INT(SImode, first_set + 1);
13098+ return "bfextu\t%0, %1, 0, %2";
13099+ }
13100+ case 2:
13101+ if ( one_bit_cleared_operand(operands[2], VOIDmode) ){
13102+ int bitpos;
13103+ for ( bitpos = 0; bitpos < 32; bitpos++ )
13104+ if ( !(INTVAL(operands[2]) & (1 << bitpos)) )
13105+ break;
13106+ operands[2] = gen_rtx_CONST_INT(SImode, bitpos);
13107+ return "cbr\t%0, %2";
13108+ } else if ( (INTVAL(operands[2]) >= 0) &&
13109+ (INTVAL(operands[2]) <= 65535) )
13110+ return "andl\t%0, %2, COH";
13111+ else if ( (INTVAL(operands[2]) < 0) &&
13112+ (INTVAL(operands[2]) >= -65536 ) )
13113+ return "andl\t%0, lo(%2)";
13114+ else if ( ((INTVAL(operands[2]) & 0xffff) == 0xffff) )
13115+ return "andh\t%0, hi(%2)";
13116+ else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
13117+ return "andh\t%0, hi(%2), COH";
13118+ else
13119+ return "andh\t%0, hi(%2)\;andl\t%0, lo(%2)";
13120+ case 3:
13121+ return "and\t%0, %1, %2";
13122+ default:
13123+ abort();
13124+ }
13125+ }
13126+
13127+ [(set_attr "length" "2,4,8,4")
13128+ (set_attr "cc" "set_z")])
13129+
13130+
13131+(define_insn "anddi3"
13132+ [(set (match_operand:DI 0 "register_operand" "=&r,&r")
13133+ (and:DI (match_operand:DI 1 "register_operand" "%0,r")
13134+ (match_operand:DI 2 "register_operand" "r,r")))]
13135+ ""
13136+ "#"
13137+ [(set_attr "length" "8")
13138+ (set_attr "cc" "clobber")]
13139+)
13140+
13141+;;=============================================================================
13142+;; or
13143+;;-----------------------------------------------------------------------------
13144+;; Store the result after a bitwise inclusive-or between reg0 and reg2 in reg0.
13145+;;=============================================================================
13146+
13147+(define_insn "iorsi3"
13148+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
13149+ (ior:SI (match_operand:SI 1 "register_operand" "%0,0,r" )
13150+ (match_operand:SI 2 "nonmemory_operand" "r ,i,r")))]
13151+ ""
13152+ {
13153+ switch (which_alternative){
13154+ case 0:
13155+ return "or\t%0, %2";
13156+ case 1:
13157+ if ( one_bit_set_operand(operands[2], VOIDmode) ){
13158+ int bitpos;
13159+ for (bitpos = 0; bitpos < 32; bitpos++)
13160+ if (INTVAL(operands[2]) & (1 << bitpos))
13161+ break;
13162+ operands[2] = gen_rtx_CONST_INT( SImode, bitpos);
13163+ return "sbr\t%0, %2";
13164+ } else if ( (INTVAL(operands[2]) >= 0) &&
13165+ (INTVAL(operands[2]) <= 65535) )
13166+ return "orl\t%0, %2";
13167+ else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
13168+ return "orh\t%0, hi(%2)";
13169+ else
13170+ return "orh\t%0, hi(%2)\;orl\t%0, lo(%2)";
13171+ case 2:
13172+ return "or\t%0, %1, %2";
13173+ default:
13174+ abort();
13175+ }
13176+ }
13177+ [(set_attr "length" "2,8,4")
13178+ (set_attr "cc" "set_z")])
13179+
13180+
13181+;(define_insn "iorsi3"
13182+; [(set (match_operand:SI 0 "register_operand" "=r, r, r")
13183+; (ior:SI (match_operand:SI 1 "avr32_logical_insn_operand" "r, r, rA" )
13184+; (match_operand:SI 2 "register_operand" "0, i, r")))]
13185+; ""
13186+; {
13187+; switch (which_alternative){
13188+; case 0:
13189+; return "or %0, %2";
13190+; case 1:
13191+; if ( one_bit_set_operand(operands[2], VOIDmode) ){
13192+; int i, bitpos;
13193+; for ( i = 0; i < 32; i++ )
13194+; if ( INTVAL(operands[2]) & (1 << i) ){
13195+; bitpos = i;
13196+; break;
13197+; }
13198+; operands[2] = gen_rtx_CONST_INT( SImode, bitpos);
13199+; return "sbr %0, %2";
13200+; } else if ( (INTVAL(operands[2]) >= 0) &&
13201+; (INTVAL(operands[2]) <= 65535) )
13202+; return "orl %0, %2";
13203+; else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
13204+; return "orh %0, hi(%2)";
13205+; else
13206+; return "orh %0, hi(%2)\;orl %0, lo(%2)";
13207+; case 2:
13208+; return "or %0, %2, %1";
13209+; }
13210+; }
13211+; [(set_attr "length" "2,8,4")
13212+; (set_attr "cc" "set_z")])
13213+
13214+(define_insn "iordi3"
13215+ [(set (match_operand:DI 0 "register_operand" "=&r,&r")
13216+ (ior:DI (match_operand:DI 1 "register_operand" "%0,r")
13217+ (match_operand:DI 2 "register_operand" "r,r")))]
13218+ ""
13219+ "#"
13220+ [(set_attr "length" "8")
13221+ (set_attr "cc" "clobber")]
13222+)
13223+
13224+;;=============================================================================
13225+;; xor bytes
13226+;;-----------------------------------------------------------------------------
13227+;; Store the result after a bitwise exclusive-or between reg0 and reg2 in reg0.
13228+;;=============================================================================
13229+
13230+(define_insn "xorsi3"
13231+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
13232+ (xor:SI (match_operand:SI 1 "register_operand" "0,0,r")
13233+ (match_operand:SI 2 "nonmemory_operand" "r,i,r")))]
13234+ ""
13235+ {
13236+ switch (which_alternative){
13237+ case 0:
13238+ return "eor %0, %2";
13239+ case 1:
13240+ if ( (INTVAL(operands[2]) >= 0) &&
13241+ (INTVAL(operands[2]) <= 65535) )
13242+ return "eorl %0, %2";
13243+ else if ( ((INTVAL(operands[2]) & 0xffff) == 0x0) )
13244+ return "eorh %0, hi(%2)";
13245+ else
13246+ return "eorh %0, hi(%2)\;eorl %0, lo(%2)";
13247+ case 2:
13248+ return "eor %0, %1, %2";
13249+ default:
13250+ abort();
13251+ }
13252+ }
13253+
13254+ [(set_attr "length" "2,8,4")
13255+ (set_attr "cc" "set_z")])
13256+
13257+(define_insn "xordi3"
13258+ [(set (match_operand:DI 0 "register_operand" "=&r,&r")
13259+ (xor:DI (match_operand:DI 1 "register_operand" "%0,r")
13260+ (match_operand:DI 2 "register_operand" "r,r")))]
13261+ ""
13262+ "#"
13263+ [(set_attr "length" "8")
13264+ (set_attr "cc" "clobber")]
13265+)
13266+
13267+;;=============================================================================
13268+;; divmod
13269+;;-----------------------------------------------------------------------------
13270+;; Signed division that produces both a quotient and a remainder.
13271+;;=============================================================================
13272+(define_expand "divmodsi4"
13273+ [(parallel [
13274+ (parallel [
13275+ (set (match_operand:SI 0 "register_operand" "=r")
13276+ (div:SI (match_operand:SI 1 "register_operand" "r")
13277+ (match_operand:SI 2 "register_operand" "r")))
13278+ (set (match_operand:SI 3 "register_operand" "=r")
13279+ (mod:SI (match_dup 1)
13280+ (match_dup 2)))])
13281+ (use (match_dup 4))])]
13282+ ""
13283+ {
13284+ if (! no_new_pseudos) {
13285+ operands[4] = gen_reg_rtx (DImode);
13286+
13287+ emit_insn(gen_divmodsi4_internal(operands[4],operands[1],operands[2]));
13288+ emit_move_insn(operands[0], gen_rtx_SUBREG( SImode, operands[4], 4));
13289+ emit_move_insn(operands[3], gen_rtx_SUBREG( SImode, operands[4], 0));
13290+
13291+ DONE;
13292+ } else {
13293+ FAIL;
13294+ }
13295+
13296+ })
13297+
13298+
13299+(define_insn "divmodsi4_internal"
13300+ [(set (match_operand:DI 0 "register_operand" "=r")
13301+ (unspec:DI [(match_operand:SI 1 "register_operand" "r")
13302+ (match_operand:SI 2 "register_operand" "r")]
13303+ UNSPEC_DIVMODSI4_INTERNAL))]
13304+ ""
13305+ "divs %0, %1, %2"
13306+ [(set_attr "type" "div")
13307+ (set_attr "cc" "none")])
13308+
13309+
13310+;;=============================================================================
13311+;; udivmod
13312+;;-----------------------------------------------------------------------------
13313+;; Unsigned division that produces both a quotient and a remainder.
13314+;;=============================================================================
13315+(define_expand "udivmodsi4"
13316+ [(parallel [
13317+ (parallel [
13318+ (set (match_operand:SI 0 "register_operand" "=r")
13319+ (udiv:SI (match_operand:SI 1 "register_operand" "r")
13320+ (match_operand:SI 2 "register_operand" "r")))
13321+ (set (match_operand:SI 3 "register_operand" "=r")
13322+ (umod:SI (match_dup 1)
13323+ (match_dup 2)))])
13324+ (use (match_dup 4))])]
13325+ ""
13326+ {
13327+ if (! no_new_pseudos) {
13328+ operands[4] = gen_reg_rtx (DImode);
13329+
13330+ emit_insn(gen_udivmodsi4_internal(operands[4],operands[1],operands[2]));
13331+ emit_move_insn(operands[0], gen_rtx_SUBREG( SImode, operands[4], 4));
13332+ emit_move_insn(operands[3], gen_rtx_SUBREG( SImode, operands[4], 0));
13333+
13334+ DONE;
13335+ } else {
13336+ FAIL;
13337+ }
13338+ })
13339+
13340+(define_insn "udivmodsi4_internal"
13341+ [(set (match_operand:DI 0 "register_operand" "=r")
13342+ (unspec:DI [(match_operand:SI 1 "register_operand" "r")
13343+ (match_operand:SI 2 "register_operand" "r")]
13344+ UNSPEC_UDIVMODSI4_INTERNAL))]
13345+ ""
13346+ "divu %0, %1, %2"
13347+ [(set_attr "type" "div")
13348+ (set_attr "cc" "none")])
13349+
13350+
13351+;;=============================================================================
13352+;; Arithmetic-shift left
13353+;;-----------------------------------------------------------------------------
13354+;; Arithmetic-shift reg0 left by reg2 or immediate value.
13355+;;=============================================================================
13356+
13357+(define_insn "ashlsi3"
13358+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
13359+ (ashift:SI (match_operand:SI 1 "register_operand" "r,0,r")
13360+ (match_operand:SI 2 "nonmemory_operand" "r,Ku05,Ku05")))]
13361+ ""
13362+ "@
13363+ lsl %0, %1, %2
13364+ lsl %0, %2
13365+ lsl %0, %1, %2"
13366+ [(set_attr "length" "4,2,4")
13367+ (set_attr "cc" "set_ncz")])
13368+
13369+;;=============================================================================
13370+;; Arithmetic-shift right
13371+;;-----------------------------------------------------------------------------
13372+;; Arithmetic-shift reg0 right by an immediate value.
13373+;;=============================================================================
13374+
13375+(define_insn "ashrsi3"
13376+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
13377+ (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,0,r")
13378+ (match_operand:SI 2 "nonmemory_operand" "r,Ku05,Ku05")))]
13379+ ""
13380+ "@
13381+ asr %0, %1, %2
13382+ asr %0, %2
13383+ asr %0, %1, %2"
13384+ [(set_attr "length" "4,2,4")
13385+ (set_attr "cc" "set_ncz")])
13386+
13387+;;=============================================================================
13388+;; Logical shift right
13389+;;-----------------------------------------------------------------------------
13390+;; Logical shift reg0 right by an immediate value.
13391+;;=============================================================================
13392+
13393+(define_insn "lshrsi3"
13394+ [(set (match_operand:SI 0 "register_operand" "=r,r,r")
13395+ (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,0,r")
13396+ (match_operand:SI 2 "nonmemory_operand" "r,Ku05,Ku05")))]
13397+ ""
13398+ "@
13399+ lsr %0, %1, %2
13400+ lsr %0, %2
13401+ lsr %0, %1, %2"
13402+ [(set_attr "length" "4,2,4")
13403+ (set_attr "cc" "set_ncz")])
13404+
13405+
13406+;;=============================================================================
13407+;; neg
13408+;;-----------------------------------------------------------------------------
13409+;; Negate operand 1 and store the result in operand 0.
13410+;;=============================================================================
13411+(define_insn "negsi2"
13412+ [(set (match_operand:SI 0 "register_operand" "=r")
13413+ (neg:SI (match_operand:SI 1 "register_operand" "0")))]
13414+ ""
13415+ "neg %0"
13416+ [(set_attr "length" "2")
13417+ (set_attr "cc" "set_vncz")])
13418+
13419+;;=============================================================================
13420+;; abs
13421+;;-----------------------------------------------------------------------------
13422+;; Store the absolute value of operand 1 into operand 0.
13423+;;=============================================================================
13424+(define_insn "abssi2"
13425+ [(set (match_operand:SI 0 "register_operand" "=r")
13426+ (abs:SI (match_operand:SI 1 "register_operand" "0")))]
13427+ ""
13428+ "abs %0"
13429+ [(set_attr "length" "2")
13430+ (set_attr "cc" "set_z")])
13431+
13432+
13433+;;=============================================================================
13434+;; one_cmpl
13435+;;-----------------------------------------------------------------------------
13436+;; Store the bitwise-complement of operand 1 into operand 0.
13437+;;=============================================================================
13438+
13439+(define_insn "one_cmplsi2"
13440+ [(set (match_operand:SI 0 "register_operand" "=r,r")
13441+ (not:SI (match_operand:SI 1 "register_operand" "r,0")))]
13442+ ""
13443+ "@
13444+ rsub %0, %1, -1
13445+ com %0"
13446+ [(set_attr "length" "4,2")
13447+ (set_attr "cc" "set_z")])
13448+
13449+
13450+;;=============================================================================
13451+;; Bit load
13452+;;-----------------------------------------------------------------------------
13453+;; Load a bit into Z and C flags
13454+;;=============================================================================
13455+(define_insn "bldsi"
13456+ [(set (cc0)
13457+ (and:SI (match_operand:SI 0 "register_operand" "r")
13458+ (match_operand:SI 1 "one_bit_set_operand" "i")))]
13459+ ""
13460+ "bld\t%0, %p1"
13461+ [(set_attr "length" "4")
13462+ (set_attr "cc" "bld")]
13463+ )
13464+
13465+
13466+;;=============================================================================
13467+;; Compare
13468+;;-----------------------------------------------------------------------------
13469+;; Compare reg0 with reg1 or an immediate value.
13470+;;=============================================================================
13471+
13472+(define_expand "cmpqi"
13473+ [(set (cc0)
13474+ (compare:QI
13475+ (match_operand:QI 0 "general_operand" "")
13476+ (match_operand:QI 1 "general_operand" "")))]
13477+ ""
13478+ "{
13479+
13480+ if ( GET_CODE(operands[0]) != REG
13481+ && GET_CODE(operands[0]) != SUBREG)
13482+ operands[0] = force_reg(QImode, operands[0]);
13483+
13484+
13485+ if ( GET_CODE(operands[1]) != REG
13486+ && GET_CODE(operands[1]) != SUBREG )
13487+ operands[1] = force_reg(QImode, operands[1]);
13488+
13489+ avr32_compare_op0 = operands[0];
13490+ avr32_compare_op1 = operands[1];
13491+ emit_insn(gen_cmpqi_internal(operands[0], operands[1]));
13492+ DONE;
13493+ }"
13494+)
13495+
13496+(define_insn "cmpqi_internal"
13497+ [(set (cc0)
13498+ (compare:QI
13499+ (match_operand:QI 0 "register_operand" "r")
13500+ (match_operand:QI 1 "register_operand" "r")))]
13501+ ""
13502+ {
13503+ set_next_insn_cond(insn,
13504+ avr32_output_cmp(get_next_insn_cond(insn), QImode, operands[0], operands[1]));
13505+ return "";
13506+ }
13507+ [(set_attr "length" "4")
13508+ (set_attr "cc" "compare")])
13509+
13510+(define_expand "cmphi"
13511+ [(set (cc0)
13512+ (compare:HI
13513+ (match_operand:HI 0 "general_operand" "")
13514+ (match_operand:HI 1 "general_operand" "")))]
13515+ ""
13516+ "{
13517+ if ( GET_CODE(operands[0]) != REG
13518+ && GET_CODE(operands[0]) != SUBREG )
13519+ operands[0] = force_reg(HImode, operands[0]);
13520+
13521+
13522+ if ( GET_CODE(operands[1]) != REG
13523+ && GET_CODE(operands[1]) != SUBREG)
13524+ operands[1] = force_reg(HImode, operands[1]);
13525+
13526+ avr32_compare_op0 = operands[0];
13527+ avr32_compare_op1 = operands[1];
13528+ emit_insn(gen_cmphi_internal(operands[0], operands[1]));
13529+ DONE;
13530+ }"
13531+)
13532+
13533+
13534+(define_insn "cmphi_internal"
13535+ [(set (cc0)
13536+ (compare:HI
13537+ (match_operand:HI 0 "register_operand" "r")
13538+ (match_operand:HI 1 "register_operand" "r")))]
13539+ ""
13540+ {
13541+ set_next_insn_cond(insn,
13542+ avr32_output_cmp(get_next_insn_cond(insn), HImode, operands[0], operands[1]));
13543+ return "";
13544+ }
13545+ [(set_attr "length" "4")
13546+ (set_attr "cc" "compare")])
13547+
13548+
13549+(define_expand "cmpsi"
13550+ [(set (cc0)
13551+ (compare:SI
13552+ (match_operand:SI 0 "general_operand" "")
13553+ (match_operand:SI 1 "general_operand" "")))]
13554+ ""
13555+ "{
13556+ if ( GET_CODE(operands[0]) != REG
13557+ && GET_CODE(operands[0]) != SUBREG )
13558+ operands[0] = force_reg(SImode, operands[0]);
13559+
13560+ if ( GET_CODE(operands[1]) != REG
13561+ && GET_CODE(operands[1]) != SUBREG
13562+ && GET_CODE(operands[1]) != CONST_INT )
13563+ operands[1] = force_reg(SImode, operands[1]);
13564+
13565+ avr32_compare_op0 = operands[0];
13566+ avr32_compare_op1 = operands[1];
13567+
13568+
13569+ emit_insn(gen_cmpsi_internal(operands[0], operands[1]));
13570+ DONE;
13571+ }"
13572+)
13573+
13574+
13575+
13576+
13577+(define_insn "cmpsi_internal"
13578+ [(set (cc0)
13579+ (compare:SI
13580+ (match_operand:SI 0 "register_operand" "r, r, r")
13581+ (match_operand:SI 1 "nonmemory_operand" "r, Ks06, Ks21")))]
13582+ ""
13583+ {
13584+ set_next_insn_cond(insn,
13585+ avr32_output_cmp(get_next_insn_cond(insn), SImode, operands[0], operands[1]));
13586+ return "";
13587+ }
13588+
13589+ [(set_attr "length" "2,2,4")
13590+ (set_attr "cc" "compare")])
13591+
13592+
13593+(define_expand "cmpdi"
13594+ [(set (cc0)
13595+ (compare:DI
13596+ (match_operand:DI 0 "register_operand" "")
13597+ (match_operand:DI 1 "register_operand" "")))]
13598+ ""
13599+ {
13600+ avr32_compare_op0 = operands[0];
13601+ avr32_compare_op1 = operands[1];
13602+ emit_insn(gen_cmpdi_internal(operands[0], operands[1]));
13603+ DONE;
13604+ }
13605+)
13606+
13607+(define_insn "cmpdi_internal"
13608+ [(set (cc0)
13609+ (compare:DI
13610+ (match_operand:DI 0 "register_operand" "r")
13611+ (match_operand:DI 1 "register_operand" "r")))]
13612+ ""
13613+ {
13614+ set_next_insn_cond(insn,
13615+ avr32_output_cmp(get_next_insn_cond(insn), DImode, operands[0], operands[1]));
13616+ return "";
13617+ }
13618+
13619+ [(set_attr "length" "6")
13620+ (set_attr "type" "alu2")
13621+ (set_attr "cc" "compare")])
13622+
13623+
13624+
13625+;;=============================================================================
13626+;; Test if zero
13627+;;-----------------------------------------------------------------------------
13628+;; Compare reg against zero and set the condition codes.
13629+;;=============================================================================
13630+
13631+
13632+(define_expand "tstsi"
13633+ [(set (cc0)
13634+ (match_operand:SI 0 "register_operand" ""))]
13635+ ""
13636+ {
13637+ avr32_compare_op0 = operands[0];
13638+ avr32_compare_op1 = gen_rtx_CONST_INT(SImode, 0);
13639+ emit_insn(gen_tstsi_internal(operands[0]));
13640+ DONE;
13641+ }
13642+)
13643+
13644+(define_insn "tstsi_internal"
13645+ [(set (cc0)
13646+ (match_operand:SI 0 "register_operand" "r"))]
13647+ ""
13648+ {
13649+ set_next_insn_cond(insn,
13650+ avr32_output_cmp(get_next_insn_cond(insn), SImode, operands[0], const0_rtx));
13651+
13652+ return "";
13653+ }
13654+ [(set_attr "length" "2")
13655+ (set_attr "cc" "compare")])
13656+
13657+
13658+(define_expand "tstdi"
13659+ [(set (cc0)
13660+ (match_operand:DI 0 "register_operand" ""))]
13661+ ""
13662+ {
13663+ avr32_compare_op0 = operands[0];
13664+ avr32_compare_op1 = gen_rtx_CONST_INT(DImode, 0);
13665+ emit_insn(gen_tstdi_internal(operands[0]));
13666+ DONE;
13667+ }
13668+)
13669+
13670+(define_insn "tstdi_internal"
13671+ [(set (cc0)
13672+ (match_operand:DI 0 "register_operand" "r"))]
13673+ ""
13674+ {
13675+ set_next_insn_cond(insn,
13676+ avr32_output_cmp(get_next_insn_cond(insn), DImode, operands[0], const0_rtx));
13677+ return "";
13678+ }
13679+ [(set_attr "length" "4")
13680+ (set_attr "type" "alu2")
13681+ (set_attr "cc" "compare")])
13682+
13683+
13684+
13685+;;=============================================================================
13686+;; Convert operands
13687+;;-----------------------------------------------------------------------------
13688+;;
13689+;;=============================================================================
13690+(define_insn "truncdisi2"
13691+ [(set (match_operand:SI 0 "general_operand" "")
13692+ (truncate:SI (match_operand:DI 1 "general_operand" "")))]
13693+ ""
13694+ "truncdisi2")
13695+
13696+;;=============================================================================
13697+;; Extend
13698+;;-----------------------------------------------------------------------------
13699+;;
13700+;;=============================================================================
13701+
13702+
13703+(define_insn "extendhisi2"
13704+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
13705+ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
13706+ ""
13707+ {
13708+ switch ( which_alternative ){
13709+ case 0:
13710+ return "casts.h\t%0";
13711+ case 1:
13712+ return "bfexts\t%0, %1, 0, 16";
13713+ case 2:
13714+ case 3:
13715+ return "ld.sh\t%0, %1";
13716+ default:
13717+ abort();
13718+ }
13719+ }
13720+ [(set_attr "length" "2,4,2,4")
13721+ (set_attr "cc" "set_ncz,set_ncz,none,none")
13722+ (set_attr "type" "alu,alu,load_rm,load_rm")])
13723+
13724+(define_insn "extendqisi2"
13725+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
13726+ (sign_extend:SI (match_operand:QI 1 "extendqi_operand" "0,r,RKu00,m")))]
13727+ ""
13728+ {
13729+ switch ( which_alternative ){
13730+ case 0:
13731+ return "casts.b\t%0";
13732+ case 1:
13733+ return "bfexts\t%0, %1, 0, 8";
13734+ case 2:
13735+ case 3:
13736+ return "ld.sb\t%0, %1";
13737+ default:
13738+ abort();
13739+ }
13740+ }
13741+ [(set_attr "length" "2,4,2,4")
13742+ (set_attr "cc" "set_ncz,set_ncz,none,none")
13743+ (set_attr "type" "alu,alu,load_rm,load_rm")])
13744+
13745+(define_insn "extendqihi2"
13746+ [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
13747+ (sign_extend:HI (match_operand:QI 1 "extendqi_operand" "0,r,RKu00,m")))]
13748+ ""
13749+ {
13750+ switch ( which_alternative ){
13751+ case 0:
13752+ return "casts.b\t%0";
13753+ case 1:
13754+ return "bfexts\t%0, %1, 0, 8";
13755+ case 2:
13756+ case 3:
13757+ return "ld.sb\t%0, %1";
13758+ default:
13759+ abort();
13760+ }
13761+ }
13762+ [(set_attr "length" "2,4,2,4")
13763+ (set_attr "cc" "set_ncz,set_ncz,none,none")
13764+ (set_attr "type" "alu,alu,load_rm,load_rm")])
13765+
13766+
13767+;;=============================================================================
13768+;; Zero-extend
13769+;;-----------------------------------------------------------------------------
13770+;;
13771+;;=============================================================================
13772+
13773+(define_insn "zero_extendhisi2"
13774+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
13775+ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
13776+ ""
13777+ {
13778+ switch ( which_alternative ){
13779+ case 0:
13780+ return "castu.h\t%0";
13781+ case 1:
13782+ return "bfextu\t%0, %1, 0, 16";
13783+ case 2:
13784+ case 3:
13785+ return "ld.uh\t%0, %1";
13786+ default:
13787+ abort();
13788+ }
13789+ }
13790+
13791+ [(set_attr "length" "2,4,2,4")
13792+ (set_attr "cc" "set_ncz,set_ncz,none,none")
13793+ (set_attr "type" "alu,alu,load_rm,load_rm")])
13794+
13795+(define_insn "zero_extendqisi2"
13796+ [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
13797+ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
13798+ ""
13799+ {
13800+ switch ( which_alternative ){
13801+ case 0:
13802+ return "castu.b\t%0";
13803+ case 1:
13804+ return "bfextu\t%0, %1, 0, 8";
13805+ case 2:
13806+ case 3:
13807+ return "ld.ub\t%0, %1";
13808+ default:
13809+ abort();
13810+ }
13811+ }
13812+ [(set_attr "length" "2,4,2,4")
13813+ (set_attr "cc" "set_ncz, set_ncz, none, none")
13814+ (set_attr "type" "alu, alu, load_rm, load_rm")])
13815+
13816+(define_insn "zero_extendqihi2"
13817+ [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
13818+ (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,r,<RKu00>,m")))]
13819+ ""
13820+ {
13821+ switch ( which_alternative ){
13822+ case 0:
13823+ return "castu.b\t%0";
13824+ case 1:
13825+ return "bfextu\t%0, %1, 0, 8";
13826+ case 2:
13827+ case 3:
13828+ return "ld.ub\t%0, %1";
13829+ default:
13830+ abort();
13831+ }
13832+ }
13833+ [(set_attr "length" "2,4,2,4")
13834+ (set_attr "cc" "set_ncz, set_ncz, none, none")
13835+ (set_attr "type" "alu, alu, load_rm, load_rm")])
13836+
13837+
13838+
13839+;;=============================================================================
13840+;; Conditional set register
13841+;; sr{cond4} rd
13842+;;-----------------------------------------------------------------------------
13843+
13844+;;Because of the same issue as with conditional moves and adds we must
13845+;;not separate the compare instrcution from the scc instruction as
13846+;;they might be sheduled "badly".
13847+
13848+(define_expand "s<code>"
13849+ [(set (match_operand:SI 0 "register_operand" "")
13850+ (any_cond (cc0)
13851+ (const_int 0)))]
13852+ ""
13853+ {
13854+ if ( !avr32_expand_scc(<CODE>, operands) ){
13855+ FAIL;
13856+ }
13857+ DONE;
13858+ }
13859+ )
13860+
13861+
13862+(define_insn "comparesi_and_set"
13863+ [(set (match_operand:SI 0 "register_operand" "=r")
13864+ (match_operator 1 "avr32_comparison_operator"
13865+ [ (compare (match_operand:SI 2 "register_operand" "r")
13866+ (match_operand:SI 3 "general_operand" "rKs06Ks21"))
13867+ (const_int 0)]))]
13868+ ""
13869+ {
13870+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[2]), operands[2], operands[3]);
13871+ return "sr%1\t%0";
13872+ }
13873+ [(set_attr "length" "6")
13874+ (set_attr "cc" "clobber")])
13875+
13876+(define_insn "comparehi_and_set"
13877+ [(set (match_operand:SI 0 "register_operand" "=r")
13878+ (match_operator 1 "avr32_comparison_operator"
13879+ [ (compare (match_operand:HI 2 "register_operand" "r")
13880+ (match_operand:HI 3 "register_operand" "r"))
13881+ (const_int 0)]))]
13882+ ""
13883+ {
13884+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[2]), operands[2], operands[3]);
13885+ return "sr%1\t%0";
13886+ }
13887+ [(set_attr "length" "6")
13888+ (set_attr "cc" "clobber")])
13889+
13890+(define_insn "compareqi_and_set"
13891+ [(set (match_operand:SI 0 "register_operand" "=r")
13892+ (match_operator 1 "avr32_comparison_operator"
13893+ [ (compare (match_operand:QI 2 "register_operand" "r")
13894+ (match_operand:QI 3 "register_operand" "r"))
13895+ (const_int 0)]))]
13896+ ""
13897+ {
13898+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[2]), operands[2], operands[3]);
13899+ return "sr%1\t%0";
13900+ }
13901+ [(set_attr "length" "6")
13902+ (set_attr "cc" "clobber")])
13903+
13904+(define_insn "*comparedi_and_set"
13905+ [(set (match_operand:SI 0 "register_operand" "=r")
13906+ (match_operator 1 "avr32_comparison_operator"
13907+ [ (compare (match_operand:DI 2 "register_operand" "r")
13908+ (match_operand:DI 3 "register_operand" "r"))
13909+ (const_int 0)]))]
13910+ ""
13911+ {
13912+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[2]), operands[2], operands[3]);
13913+ return "sr%1\t%0";
13914+ }
13915+ [(set_attr "length" "6")
13916+ (set_attr "cc" "clobber")])
13917+
13918+(define_insn "*tstdi_and_set"
13919+ [(set (match_operand:SI 0 "register_operand" "=r")
13920+ (match_operator 1 "avr32_comparison_operator"
13921+ [ (compare (match_operand:DI 2 "register_operand" "r")
13922+ (const_int 0))
13923+ (const_int 0)]))]
13924+ ""
13925+ {
13926+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[2]), operands[2], const0_rtx);
13927+ return "sr%1\t%0";
13928+ }
13929+ [(set_attr "length" "6")
13930+ (set_attr "cc" "clobber")])
13931+
13932+
13933+
13934+;;=============================================================================
13935+;; Conditional branch
13936+;;-----------------------------------------------------------------------------
13937+;; Branch to label if the specified condition codes are set.
13938+;;=============================================================================
13939+; branch if negative
13940+(define_insn "bmi"
13941+ [(set (pc)
13942+ (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_MI)
13943+ (label_ref (match_operand 0 "" ""))
13944+ (pc)))]
13945+ ""
13946+ "brmi %0"
13947+ [(set_attr "type" "branch")
13948+ (set (attr "length")
13949+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13950+ (le (minus (pc) (match_dup 0)) (const_int 256)))
13951+ (const_int 2)] ; use compact branch
13952+ (const_int 4))) ; use extended branch
13953+ (set_attr "cc" "none")])
13954+
13955+(define_insn "*bmi-reverse"
13956+ [(set (pc)
13957+ (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_MI)
13958+ (pc)
13959+ (label_ref (match_operand 0 "" ""))))]
13960+ ""
13961+ "brpl %0"
13962+ [(set_attr "type" "branch")
13963+ (set (attr "length")
13964+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13965+ (le (minus (pc) (match_dup 0)) (const_int 256)))
13966+ (const_int 2)] ; use compact branch
13967+ (const_int 4))) ; use extended branch
13968+ (set_attr "cc" "none")])
13969+
13970+; branch if positive
13971+(define_insn "bpl"
13972+ [(set (pc)
13973+ (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_PL)
13974+ (label_ref (match_operand 0 "" ""))
13975+ (pc)))]
13976+ ""
13977+ "brpl %0"
13978+ [(set_attr "type" "branch")
13979+ (set (attr "length")
13980+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13981+ (le (minus (pc) (match_dup 0)) (const_int 256)))
13982+ (const_int 2)] ; use compact branch
13983+ (const_int 4))) ; use extended branch
13984+ (set_attr "cc" "none")])
13985+
13986+(define_insn "*bpl-reverse"
13987+ [(set (pc)
13988+ (if_then_else (unspec:CC [(cc0) (const_int 0)] UNSPEC_COND_PL)
13989+ (pc)
13990+ (label_ref (match_operand 0 "" ""))))]
13991+ ""
13992+ "brmi %0"
13993+ [(set_attr "type" "branch")
13994+ (set (attr "length")
13995+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
13996+ (le (minus (pc) (match_dup 0)) (const_int 256)))
13997+ (const_int 2)] ; use compact branch
13998+ (const_int 4))) ; use extended branch
13999+ (set_attr "cc" "none")])
14000+
14001+; branch if equal
14002+(define_insn "b<code>"
14003+ [(set (pc)
14004+ (if_then_else (any_cond:CC (cc0)
14005+ (const_int 0))
14006+ (label_ref (match_operand 0 "" ""))
14007+ (pc)))]
14008+ ""
14009+ "br<cond> %0 "
14010+ [(set_attr "type" "branch")
14011+ (set (attr "length")
14012+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
14013+ (le (minus (pc) (match_dup 0)) (const_int 256)))
14014+ (const_int 2)] ; use compact branch
14015+ (const_int 4))) ; use extended branch
14016+ (set_attr "cc" "none")])
14017+
14018+
14019+(define_insn "*b<code>-reverse"
14020+ [(set (pc)
14021+ (if_then_else (any_cond:CC (cc0)
14022+ (const_int 0))
14023+ (pc)
14024+ (label_ref (match_operand 0 "" ""))))]
14025+ ""
14026+ "br<invcond> %0 "
14027+ [(set_attr "type" "branch")
14028+ (set (attr "length")
14029+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 254))
14030+ (le (minus (pc) (match_dup 0)) (const_int 256)))
14031+ (const_int 2)] ; use compact branch
14032+ (const_int 4))) ; use extended branch
14033+ (set_attr "cc" "none")])
14034+
14035+
14036+
14037+;=============================================================================
14038+; Conditional Add/Subtract
14039+;-----------------------------------------------------------------------------
14040+; sub{cond4} Rd, imm
14041+;=============================================================================
14042+
14043+
14044+(define_expand "add<mode>cc"
14045+ [(set (match_operand:ADDCC 0 "register_operand" "")
14046+ (if_then_else:ADDCC (match_operand 1 "avr32_comparison_operator" "")
14047+ (match_operand:ADDCC 2 "register_immediate_operand" "")
14048+ (match_operand:ADDCC 3 "register_immediate_operand" "")))]
14049+ ""
14050+ {
14051+ if ( avr32_expand_addcc(<MODE>mode, operands ) )
14052+ DONE;
14053+ else
14054+ FAIL;
14055+ }
14056+ )
14057+
14058+
14059+(define_insn "add<ADDCC:mode>cc_cmp<CMP:mode>"
14060+ [(set (match_operand:ADDCC 0 "register_operand" "=&r")
14061+ (unspec:ADDCC [(match_operand 1 "avr32_comparison_operator" "")
14062+ (match_operand:ADDCC 2 "register_operand" "0")
14063+ (match_operand:ADDCC 3 "immediate_operand" "Ks08")
14064+ (match_operand:CMP 4 "register_operand" "r")
14065+ (match_operand:CMP 5 "<CMP:cmp_predicate>" "<CMP:cmp_constraint>")
14066+ ]
14067+ UNSPEC_ADDSICC ))]
14068+ ""
14069+ {
14070+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[4]), operands[4], operands[5]);
14071+
14072+ return "sub%1\t%0, %3";
14073+ }
14074+ [(set_attr "length" "8")
14075+ (set_attr "cc" "clobber")])
14076+
14077+
14078+;=============================================================================
14079+; Conditional Move
14080+;-----------------------------------------------------------------------------
14081+; mov{cond4} Rd, (Rs/imm)
14082+;=============================================================================
14083+(define_expand "mov<mode>cc"
14084+ [(set (match_operand:ADDCC 0 "register_operand" "")
14085+ (if_then_else:ADDCC (match_operand 1 "avr32_comparison_operator" "")
14086+ (match_operand:ADDCC 2 "register_immediate_operand" "")
14087+ (match_operand:ADDCC 3 "register_immediate_operand" "")))]
14088+ ""
14089+ {
14090+ if ( avr32_expand_movcc(<MODE>mode, operands ) )
14091+ DONE;
14092+ else
14093+ FAIL;
14094+ }
14095+ )
14096+
14097+(define_insn "mov<MOVCC:mode>cc_cmp<CMP:mode>"
14098+ [(set (match_operand:MOVCC 0 "register_operand" "=r,r,r")
14099+ (unspec:MOVCC [(match_operand 1 "avr32_comparison_operator" "")
14100+ (match_operand:MOVCC 2 "register_immediate_operand" "0,rKs08,rKs08")
14101+ (match_operand:MOVCC 3 "register_immediate_operand" "rKs08,0,rKs08")
14102+ (match_operand:CMP 4 "register_operand" "r, r, r")
14103+ (match_operand:CMP 5 "<CMP:cmp_predicate>" "<CMP:cmp_constraint>, <CMP:cmp_constraint>, <CMP:cmp_constraint>")
14104+ ]
14105+ UNSPEC_MOVSICC ))]
14106+ ""
14107+ {
14108+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[4]), operands[4], operands[5]);
14109+
14110+ switch( which_alternative ){
14111+ case 0:
14112+ return "mov%i1 %0, %3";
14113+ case 1:
14114+ return "mov%1 %0, %2";
14115+ case 2:
14116+ return "mov%1 %0, %2\;mov%i1 %0, %3";
14117+ default:
14118+ abort();
14119+ }
14120+
14121+
14122+ }
14123+ [(set_attr "length" "8,8,12")
14124+ (set_attr "cc" "clobber")])
14125+
14126+
14127+;;=============================================================================
14128+;; jump
14129+;;-----------------------------------------------------------------------------
14130+;; Jump inside a function; an unconditional branch to a label.
14131+;;=============================================================================
14132+(define_insn "jump"
14133+ [(set (pc)
14134+ (label_ref (match_operand 0 "" "")))]
14135+ ""
14136+ {
14137+ if (get_attr_length(insn) > 4)
14138+ return "Can't jump this far";
14139+ return (get_attr_length(insn) == 2 ?
14140+ "rjmp %0" : "bral %0");
14141+ }
14142+ [(set_attr "type" "branch")
14143+ (set (attr "length")
14144+ (cond [(and (le (minus (match_dup 0) (pc)) (const_int 1022))
14145+ (le (minus (pc) (match_dup 0)) (const_int 1024)))
14146+ (const_int 2) ; use rjmp
14147+ (le (match_dup 0) (const_int 1048575))
14148+ (const_int 4)] ; use bral
14149+ (const_int 8))) ; do something else
14150+ (set_attr "cc" "none")])
14151+
14152+;;=============================================================================
14153+;; call
14154+;;-----------------------------------------------------------------------------
14155+;; Subroutine call instruction returning no value.
14156+;;=============================================================================
14157+(define_insn "call_internal"
14158+ [(parallel [(call (mem:SI (match_operand:SI 0 "avr32_call_operand" "r,U,T,W"))
14159+ (match_operand 1 "" ""))
14160+ (clobber (reg:SI LR_REGNUM))])]
14161+ ""
14162+ {
14163+ switch (which_alternative){
14164+ case 0:
14165+ return "icall\t%0";
14166+ case 1:
14167+ return "rcall\t%0";
14168+ case 2:
14169+ return "mcall\t%0";
14170+ case 3:
14171+ if ( TARGET_HAS_ASM_ADDR_PSEUDOS )
14172+ return "call\t%0";
14173+ else
14174+ return "mcall\tr6[%0@got]";
14175+ default:
14176+ abort();
14177+ }
14178+ }
14179+ [(set_attr "type" "call")
14180+ (set_attr "length" "2,4,4,10")
14181+ (set_attr "cc" "clobber")])
14182+
14183+
14184+(define_expand "call"
14185+ [(parallel [(call (match_operand:SI 0 "" "")
14186+ (match_operand 1 "" ""))
14187+ (clobber (reg:SI LR_REGNUM))])]
14188+ ""
14189+ {
14190+ rtx call_address;
14191+ if ( GET_CODE(operands[0]) != MEM )
14192+ FAIL;
14193+
14194+ call_address = XEXP(operands[0], 0);
14195+
14196+ /* If assembler supports call pseudo insn and the call
14197+ address is a symbol then nothing special needs to be done. */
14198+ if ( TARGET_HAS_ASM_ADDR_PSEUDOS
14199+ && (GET_CODE(call_address) == SYMBOL_REF) ){
14200+ /* We must however mark the function as using the GOT if
14201+ flag_pic is set, since the call insn might turn into
14202+ a mcall using the GOT ptr register. */
14203+ if ( flag_pic ){
14204+ current_function_uses_pic_offset_table = 1;
14205+ emit_call_insn(gen_call_internal(call_address, operands[1]));
14206+ DONE;
14207+ }
14208+ } else {
14209+ if ( flag_pic &&
14210+ GET_CODE(call_address) == SYMBOL_REF ){
14211+ current_function_uses_pic_offset_table = 1;
14212+ emit_call_insn(gen_call_internal(call_address, operands[1]));
14213+ DONE;
14214+ }
14215+
14216+ if ( !SYMBOL_REF_RCALL_FUNCTION_P(operands[0]) ){
14217+ if ( optimize_size &&
14218+ GET_CODE(call_address) == SYMBOL_REF ){
14219+ call_address = force_const_mem(SImode, call_address);
14220+ } else {
14221+ call_address = force_reg(SImode, call_address);
14222+ }
14223+ }
14224+ }
14225+ emit_call_insn(gen_call_internal(call_address, operands[1]));
14226+ DONE;
14227+ }
14228+)
14229+
14230+;;=============================================================================
14231+;; call_value
14232+;;-----------------------------------------------------------------------------
14233+;; Subrutine call instruction returning a value.
14234+;;=============================================================================
14235+(define_expand "call_value"
14236+ [(parallel [(set (match_operand:SI 0 "" "")
14237+ (call (match_operand:SI 1 "" "")
14238+ (match_operand 2 "" "")))
14239+ (clobber (reg:SI LR_REGNUM))])]
14240+ ""
14241+ {
14242+ rtx call_address;
14243+ if ( GET_CODE(operands[1]) != MEM )
14244+ FAIL;
14245+
14246+ call_address = XEXP(operands[1], 0);
14247+
14248+ /* If assembler supports call pseudo insn and the call
14249+ address is a symbol then nothing special needs to be done. */
14250+ if ( TARGET_HAS_ASM_ADDR_PSEUDOS
14251+ && (GET_CODE(call_address) == SYMBOL_REF) ){
14252+ /* We must however mark the function as using the GOT if
14253+ flag_pic is set, since the call insn might turn into
14254+ a mcall using the GOT ptr register. */
14255+ if ( flag_pic ) {
14256+ current_function_uses_pic_offset_table = 1;
14257+ emit_call_insn(gen_call_value_internal(operands[0], call_address, operands[2]));
14258+ DONE;
14259+ }
14260+ } else {
14261+ if ( flag_pic &&
14262+ GET_CODE(call_address) == SYMBOL_REF ){
14263+ current_function_uses_pic_offset_table = 1;
14264+ emit_call_insn(gen_call_value_internal(operands[0], call_address, operands[2]));
14265+ DONE;
14266+ }
14267+
14268+ if ( !SYMBOL_REF_RCALL_FUNCTION_P(operands[1]) ){
14269+ if ( optimize_size &&
14270+ GET_CODE(call_address) == SYMBOL_REF){
14271+ call_address = force_const_mem(SImode, call_address);
14272+ } else {
14273+ call_address = force_reg(SImode, call_address);
14274+ }
14275+ }
14276+ }
14277+ emit_call_insn(gen_call_value_internal(operands[0], call_address,
14278+ operands[2]));
14279+ DONE;
14280+
14281+ })
14282+
14283+(define_insn "call_value_internal"
14284+ [(parallel [(set (match_operand 0 "register_operand" "=r,r,r,r")
14285+ (call (mem:SI (match_operand:SI 1 "avr32_call_operand" "r,U,T,W"))
14286+ (match_operand 2 "" "")))
14287+ (clobber (reg:SI LR_REGNUM))])]
14288+ ;; Operand 2 not used on the AVR32.
14289+ ""
14290+ {
14291+ switch (which_alternative){
14292+ case 0:
14293+ return "icall\t%1";
14294+ case 1:
14295+ return "rcall\t%1";
14296+ case 2:
14297+ return "mcall\t%1";
14298+ case 3:
14299+ if ( TARGET_HAS_ASM_ADDR_PSEUDOS )
14300+ return "call\t%1";
14301+ else
14302+ return "mcall\tr6[%1@got]";
14303+ default:
14304+ abort();
14305+ }
14306+ }
14307+ [(set_attr "type" "call")
14308+ (set_attr "length" "2,4,4,10")
14309+ (set_attr "cc" "call_set")])
14310+
14311+
14312+;;=============================================================================
14313+;; untyped_call
14314+;;-----------------------------------------------------------------------------
14315+;; Subrutine call instruction returning a value of any type.
14316+;; The code is copied from m68k.md (except gen_blockage is removed)
14317+;; Fixme!
14318+;;=============================================================================
14319+(define_expand "untyped_call"
14320+ [(parallel [(call (match_operand 0 "avr32_call_operand" "")
14321+ (const_int 0))
14322+ (match_operand 1 "" "")
14323+ (match_operand 2 "" "")])]
14324+ ""
14325+ {
14326+ int i;
14327+
14328+ emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
14329+
14330+ for (i = 0; i < XVECLEN (operands[2], 0); i++) {
14331+ rtx set = XVECEXP (operands[2], 0, i);
14332+ emit_move_insn (SET_DEST (set), SET_SRC (set));
14333+ }
14334+
14335+ /* The optimizer does not know that the call sets the function value
14336+ registers we stored in the result block. We avoid problems by
14337+ claiming that all hard registers are used and clobbered at this
14338+ point. */
14339+ emit_insn (gen_blockage ());
14340+
14341+ DONE;
14342+ })
14343+
14344+
14345+;;=============================================================================
14346+;; return
14347+;;=============================================================================
14348+
14349+(define_insn "return"
14350+ [(return)]
14351+ "USE_RETURN_INSN (FALSE)"
14352+ {
14353+ avr32_output_return_instruction(TRUE, FALSE, NULL, NULL);
14354+ return "";
14355+ }
14356+ [(set_attr "length" "4")
14357+ (set_attr "type" "call")]
14358+ )
14359+
14360+(define_insn "*return_value_imm"
14361+ [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
14362+ (use (reg RETVAL_REGNUM))
14363+ (return)])]
14364+ "USE_RETURN_INSN (FALSE) &&
14365+ ((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
14366+ {
14367+ avr32_output_return_instruction(TRUE, FALSE, NULL, operands[0]);
14368+ return "";
14369+ }
14370+ [(set_attr "length" "4")
14371+ (set_attr "type" "call")]
14372+ )
14373+
14374+(define_insn "*return_value_si"
14375+ [(set (reg RETVAL_REGNUM) (match_operand:SI 0 "register_operand" "r"))
14376+ (use (reg RETVAL_REGNUM))
14377+ (return)]
14378+ "USE_RETURN_INSN (TRUE)"
14379+ "retal %0";
14380+ [(set_attr "type" "call")]
14381+ )
14382+
14383+(define_insn "*return_value_hi"
14384+ [(parallel [(set (reg RETVAL_REGNUM) (match_operand:HI 0 "register_operand" "r"))
14385+ (use (reg RETVAL_REGNUM))
14386+ (return)])]
14387+ "USE_RETURN_INSN (TRUE)"
14388+ "retal %0"
14389+ [(set_attr "type" "call")]
14390+ )
14391+
14392+(define_insn "*return_value_qi"
14393+ [(parallel [(set (reg RETVAL_REGNUM) (match_operand:QI 0 "register_operand" "r"))
14394+ (use (reg RETVAL_REGNUM))
14395+ (return)])]
14396+ "USE_RETURN_INSN (TRUE)"
14397+ "retal %0"
14398+ [(set_attr "type" "call")]
14399+ )
14400+
14401+;;=============================================================================
14402+;; nop
14403+;;-----------------------------------------------------------------------------
14404+;; No-op instruction.
14405+;;=============================================================================
14406+(define_insn "nop"
14407+ [(const_int 0)]
14408+ ""
14409+ "nop"
14410+ [(set_attr "length" "2")
14411+ (set_attr "type" "alu")
14412+ (set_attr "cc" "none")])
14413+
14414+;;=============================================================================
14415+;; nonlocal_goto
14416+;;-----------------------------------------------------------------------------
14417+;; Jump from one function to a label in an outer function.
14418+;; Must invalidate return stack, since the function will be exited without
14419+;; a return
14420+;;=============================================================================
14421+(define_expand "nonlocal_goto"
14422+ [(use (match_operand 0 "" ""))
14423+ (use (match_operand 1 "" ""))
14424+ (use (match_operand 2 "" ""))
14425+ (use (match_operand 3 "" ""))]
14426+ ""
14427+ {
14428+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__nonlocal_goto"),
14429+ 0, VOIDmode, 3,
14430+ operands[0], SImode,
14431+ operands[1], Pmode,
14432+ operands[2], SImode);
14433+
14434+ DONE;
14435+ }
14436+)
14437+
14438+
14439+(define_expand "builtin_longjmp"
14440+ [(use (match_operand 0 "" ""))]
14441+ ""
14442+ {
14443+ rtx ops[3];
14444+
14445+ ops[0] = gen_rtx_MEM (Pmode, gen_rtx_PLUS(SImode, operands[0], gen_rtx_CONST_INT(SImode,0)));
14446+ ops[1] = gen_rtx_MEM (Pmode, gen_rtx_PLUS(SImode, operands[0], gen_rtx_CONST_INT(SImode,4)));
14447+ ops[2] = gen_rtx_MEM (Pmode, gen_rtx_PLUS(SImode, operands[0], gen_rtx_CONST_INT(SImode,8)));
14448+
14449+
14450+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__nonlocal_goto"),
14451+ 0, VOIDmode, 3,
14452+ ops[0], SImode,
14453+ ops[1], Pmode,
14454+ ops[2], SImode);
14455+
14456+ DONE;
14457+ }
14458+ )
14459+
14460+
14461+;;=============================================================================
14462+;; indirect_jump
14463+;;-----------------------------------------------------------------------------
14464+;; Jump to an address in reg or memory.
14465+;;=============================================================================
14466+(define_expand "indirect_jump"
14467+ [(set (pc)
14468+ (match_operand:SI 0 "general_operand" "r,m"))]
14469+ ""
14470+ {
14471+ /* One of the ops has to be in a register. */
14472+ if ( (flag_pic || TARGET_HAS_ASM_ADDR_PSEUDOS )
14473+ && !avr32_legitimate_pic_operand_p(operands[0]) )
14474+ operands[0] = legitimize_pic_address (operands[0], SImode, 0);
14475+ else if ( flag_pic && avr32_address_operand(operands[0], GET_MODE(operands[0])) )
14476+ /* If we have an address operand then this function uses the pic register. */
14477+ current_function_uses_pic_offset_table = 1;
14478+ })
14479+
14480+
14481+(define_insn "indirect_jump_internal"
14482+ [(set (pc)
14483+ (match_operand:SI 0 "general_operand" "r,m,W"))]
14484+ ""
14485+ {
14486+ switch( which_alternative ){
14487+ case 0:
14488+ return "mov\tpc, %0";
14489+ case 1:
14490+ if ( avr32_const_pool_ref_operand(operands[0], GET_MODE(operands[0])) )
14491+ return "lddpc\tpc, %0";
14492+ else
14493+ return "ld.w\tpc, %0";
14494+ case 2:
14495+ if ( flag_pic )
14496+ return "ld.w\tpc, r6[%0@got]";
14497+ else
14498+ return "lda.w\tpc, %0";
14499+ default:
14500+ abort();
14501+ }
14502+ }
14503+ [(set_attr "length" "2,4,8")
14504+ (set_attr "type" "call,call,call")
14505+ (set_attr "cc" "none,none,clobber")])
14506+
14507+
14508+;;=============================================================================
14509+;; casesi
14510+;;=============================================================================
14511+
14512+
14513+(define_expand "casesi"
14514+ [(match_operand:SI 0 "register_operand" "") ; index to jump on
14515+ (match_operand:SI 1 "const_int_operand" "") ; lower bound
14516+ (match_operand:SI 2 "const_int_operand" "") ; total range
14517+ (match_operand:SI 3 "" "") ; table label
14518+ (match_operand:SI 4 "" "")] ; Out of range label
14519+ ""
14520+ "
14521+ {
14522+ rtx reg;
14523+ if (operands[1] != const0_rtx)
14524+ {
14525+ if (!avr32_const_ok_for_constraint_p(INTVAL (operands[1]), 'I', \"Is21\")){
14526+ reg = force_reg(SImode, GEN_INT (INTVAL (operands[1])));
14527+ emit_insn (gen_subsi3 (reg, operands[0],
14528+ reg));
14529+ } else {
14530+ reg = gen_reg_rtx (SImode);
14531+ emit_insn (gen_addsi3 (reg, operands[0],
14532+ GEN_INT (-INTVAL (operands[1]))));
14533+ }
14534+ operands[0] = reg;
14535+ }
14536+
14537+ if (!avr32_const_ok_for_constraint_p(INTVAL (operands[2]), 'K', \"Ks21\"))
14538+ operands[2] = force_reg (SImode, operands[2]);
14539+
14540+ emit_jump_insn (gen_casesi_internal (operands[0], operands[2], operands[3],
14541+ operands[4], gen_reg_rtx(SImode)));
14542+ DONE;
14543+ }"
14544+)
14545+
14546+;; The USE in this pattern is needed to tell flow analysis that this is
14547+;; a CASESI insn. It has no other purpose.
14548+(define_insn "casesi_internal"
14549+ [(parallel [(set (pc)
14550+ (if_then_else
14551+ (leu (match_operand:SI 0 "register_operand" "r")
14552+ (match_operand:SI 1 "register_immediate_operand" "rKu03"))
14553+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
14554+ (label_ref (match_operand 2 "" ""))))
14555+ (label_ref (match_operand 3 "" ""))))
14556+ (clobber (match_operand:SI 4 "register_operand" "=r"))
14557+ (use (label_ref (match_dup 2)))])]
14558+ ""
14559+ {
14560+ if (flag_pic)
14561+ return "cp.w\t%0, %1\;brhi\t%3\;sub\t%4, pc, -(%2 - .)\;add\tpc, %4, %0 << 2";
14562+ return "cp.w\t%0, %1\;brhi\t%3\;sub\t%4, pc, -(%2 - .)\;ld.w\tpc, %4[%0 << 2]";
14563+ }
14564+ [(set_attr "cc" "clobber")
14565+ (set_attr "length" "16")]
14566+)
14567+
14568+
14569+(define_insn "prefetch"
14570+ [(prefetch (match_operand:SI 0 "register_operand" "r")
14571+ (match_operand 1 "const_int_operand" "")
14572+ (match_operand 2 "const_int_operand" ""))]
14573+ ""
14574+ {
14575+ return "pref\t%0[0]";
14576+ }
14577+
14578+ [(set_attr "length" "4")
14579+ (set_attr "type" "load")
14580+ (set_attr "cc" "none")])
14581+
14582+
14583+
14584+;;=============================================================================
14585+;; prologue
14586+;;-----------------------------------------------------------------------------
14587+;; This pattern, if defined, emits RTL for entry to a function. The function
14588+;; entry i responsible for setting up the stack frame, initializing the frame
14589+;; pointer register, saving callee saved registers, etc.
14590+;;=============================================================================
14591+(define_expand "prologue"
14592+ [(clobber (const_int 0))]
14593+ ""
14594+ "
14595+ avr32_expand_prologue();
14596+ DONE;
14597+ "
14598+ )
14599+
14600+;;=============================================================================
14601+;; eh_return
14602+;;-----------------------------------------------------------------------------
14603+;; This pattern, if defined, affects the way __builtin_eh_return, and
14604+;; thence the call frame exception handling library routines, are
14605+;; built. It is intended to handle non-trivial actions needed along
14606+;; the abnormal return path.
14607+;;
14608+;; The address of the exception handler to which the function should
14609+;; return is passed as operand to this pattern. It will normally need
14610+;; to copied by the pattern to some special register or memory
14611+;; location. If the pattern needs to determine the location of the
14612+;; target call frame in order to do so, it may use
14613+;; EH_RETURN_STACKADJ_RTX, if defined; it will have already been
14614+;; assigned.
14615+;;
14616+;; If this pattern is not defined, the default action will be to
14617+;; simply copy the return address to EH_RETURN_HANDLER_RTX. Either
14618+;; that macro or this pattern needs to be defined if call frame
14619+;; exception handling is to be used.
14620+(define_expand "eh_return"
14621+ [(use (match_operand 0 "general_operand" ""))]
14622+ ""
14623+ "
14624+ avr32_set_return_address (operands[0]);
14625+ DONE;
14626+ "
14627+ )
14628+
14629+;;=============================================================================
14630+;; ffssi2
14631+;;-----------------------------------------------------------------------------
14632+(define_insn "ffssi2"
14633+ [ (set (match_operand:SI 0 "register_operand" "=r")
14634+ (ffs:SI (match_operand:SI 1 "register_operand" "r"))) ]
14635+ ""
14636+ "mov %0, %1
14637+ brev %0
14638+ clz %0, %0
14639+ sub %0, -1
14640+ cp %0, 33
14641+ moveq %0, 0"
14642+ [(set_attr "length" "18")
14643+ (set_attr "cc" "clobber")]
14644+ )
14645+
14646+
14647+
14648+;;=============================================================================
14649+;; swap_h
14650+;;-----------------------------------------------------------------------------
14651+(define_insn "*swap_h"
14652+ [ (set (match_operand:SI 0 "register_operand" "=r")
14653+ (ior:SI (ashift:SI (match_dup 0) (const_int 16))
14654+ (lshiftrt:SI (match_dup 0) (const_int 16))))]
14655+ ""
14656+ "swap.h %0"
14657+ [(set_attr "length" "2")]
14658+ )
14659+
14660+(define_insn_and_split "bswap_16"
14661+ [ (set (match_operand:HI 0 "avr32_bswap_operand" "=r,RKs13,r")
14662+ (ior:HI (and:HI (lshiftrt:HI (match_operand:HI 1 "avr32_bswap_operand" "r,r,RKs13")
14663+ (const_int 8))
14664+ (const_int 255))
14665+ (ashift:HI (and:HI (match_dup 1)
14666+ (const_int 255))
14667+ (const_int 8))))]
14668+ ""
14669+ {
14670+ switch ( which_alternative ){
14671+ case 0:
14672+ if ( REGNO(operands[0]) == REGNO(operands[1]))
14673+ return "swap.bh\t%0";
14674+ else
14675+ return "mov\t%0, %1\;swap.bh\t%0";
14676+ case 1:
14677+ return "stswp.h\t%0, %1";
14678+ case 2:
14679+ return "ldswp.sh\t%0, %1";
14680+ default:
14681+ abort();
14682+ }
14683+ }
14684+
14685+ "(reload_completed &&
14686+ REG_P(operands[0]) && REG_P(operands[1])
14687+ && (REGNO(operands[0]) != REGNO(operands[1])))"
14688+ [(set (match_dup 0) (match_dup 1))
14689+ (set (match_dup 0)
14690+ (ior:HI (and:HI (lshiftrt:HI (match_dup 0)
14691+ (const_int 8))
14692+ (const_int 255))
14693+ (ashift:HI (and:HI (match_dup 0)
14694+ (const_int 255))
14695+ (const_int 8))))]
14696+ ""
14697+
14698+ [(set_attr "length" "4,4,4")
14699+ (set_attr "type" "alu,store,load_rm")]
14700+ )
14701+
14702+(define_insn_and_split "bswap_32"
14703+ [ (set (match_operand:SI 0 "avr32_bswap_operand" "=r,RKs14,r")
14704+ (ior:SI (ior:SI (lshiftrt:SI (and:SI (match_operand:SI 1 "avr32_bswap_operand" "=r,r,RKs14")
14705+ (const_int 4278190080))
14706+ (const_int 24))
14707+ (lshiftrt:SI (and:SI (match_dup 1)
14708+ (const_int 16711680))
14709+ (const_int 8)))
14710+ (ior:SI (ashift:SI (and:SI (match_dup 1)
14711+ (const_int 65280))
14712+ (const_int 8))
14713+ (ashift:SI (and:SI (match_dup 1)
14714+ (const_int 255))
14715+ (const_int 24)))))]
14716+ ""
14717+ {
14718+ switch ( which_alternative ){
14719+ case 0:
14720+ if ( REGNO(operands[0]) == REGNO(operands[1]))
14721+ return "swap.b\t%0";
14722+ else
14723+ return "mov\t%0, %1\;swap.b\t%0";
14724+ case 1:
14725+ return "stswp.w\t%0, %1";
14726+ case 2:
14727+ return "ldswp.w\t%0, %1";
14728+ default:
14729+ abort();
14730+ }
14731+ }
14732+ "(reload_completed &&
14733+ REG_P(operands[0]) && REG_P(operands[1])
14734+ && (REGNO(operands[0]) != REGNO(operands[1])))"
14735+ [(set (match_dup 0) (match_dup 1))
14736+ (set (match_dup 0)
14737+ (ior:SI (ior:SI (lshiftrt:SI (and:SI (match_dup 0)
14738+ (const_int 4278190080))
14739+ (const_int 24))
14740+ (lshiftrt:SI (and:SI (match_dup 0)
14741+ (const_int 16711680))
14742+ (const_int 8)))
14743+ (ior:SI (ashift:SI (and:SI (match_dup 0)
14744+ (const_int 65280))
14745+ (const_int 8))
14746+ (ashift:SI (and:SI (match_dup 0)
14747+ (const_int 255))
14748+ (const_int 24)))))]
14749+ ""
14750+
14751+ [(set_attr "length" "4,4,4")
14752+ (set_attr "type" "alu,store,load_rm")]
14753+ )
14754+
14755+
14756+;;=============================================================================
14757+;; blockage
14758+;;-----------------------------------------------------------------------------
14759+;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
14760+;; all of memory. This blocks insns from being moved across this point.
14761+
14762+(define_insn "blockage"
14763+ [(unspec_volatile [(const_int 0)] VUNSPEC_BLOCKAGE)]
14764+ ""
14765+ ""
14766+ [(set_attr "length" "0")]
14767+)
14768+
14769+;;=============================================================================
14770+;; clzsi2
14771+;;-----------------------------------------------------------------------------
14772+(define_insn "clzsi2"
14773+ [ (set (match_operand:SI 0 "register_operand" "=r")
14774+ (clz:SI (match_operand:SI 1 "register_operand" "r"))) ]
14775+ ""
14776+ "clz %0, %1"
14777+ [(set_attr "length" "4")
14778+ (set_attr "cc" "set_z")]
14779+ )
14780+
14781+;;=============================================================================
14782+;; ctzsi2
14783+;;-----------------------------------------------------------------------------
14784+(define_insn "ctzsi2"
14785+ [ (set (match_operand:SI 0 "register_operand" "=r,r")
14786+ (ctz:SI (match_operand:SI 1 "register_operand" "0,r"))) ]
14787+ ""
14788+ "@
14789+ brev\t%0\;clz\t%0, %0
14790+ mov\t%0, %1\;brev\t%0\;clz\t%0, %0"
14791+ [(set_attr "length" "8")
14792+ (set_attr "cc" "set_z")]
14793+ )
14794+
14795+;;=============================================================================
14796+;; cache instructions
14797+;;-----------------------------------------------------------------------------
14798+(define_insn "cache"
14799+ [ (unspec_volatile [(match_operand:SI 0 "register_operand" "r")
14800+ (match_operand:SI 1 "immediate_operand" "Ku05")] VUNSPEC_CACHE)]
14801+ ""
14802+ "cache %0[0], %1"
14803+ [(set_attr "length" "4")]
14804+ )
14805+
14806+(define_insn "sync"
14807+ [ (unspec_volatile [(match_operand:SI 0 "immediate_operand" "Ku08")] VUNSPEC_SYNC)]
14808+ ""
14809+ "sync %0"
14810+ [(set_attr "length" "4")]
14811+ )
14812+
14813+;;=============================================================================
14814+;; TLB instructions
14815+;;-----------------------------------------------------------------------------
14816+(define_insn "tlbr"
14817+ [ (unspec_volatile [(const_int 0)] VUNSPEC_TLBR)]
14818+ ""
14819+ "tlbr"
14820+ [(set_attr "length" "2")]
14821+ )
14822+
14823+(define_insn "tlbw"
14824+ [ (unspec_volatile [(const_int 0)] VUNSPEC_TLBW)]
14825+ ""
14826+ "tlbw"
14827+ [(set_attr "length" "2")]
14828+ )
14829+
14830+(define_insn "tlbs"
14831+ [ (unspec_volatile [(const_int 0)] VUNSPEC_TLBS)]
14832+ ""
14833+ "tlbs"
14834+ [(set_attr "length" "2")]
14835+ )
14836+
14837+;;=============================================================================
14838+;; Breakpoint instruction
14839+;;-----------------------------------------------------------------------------
14840+(define_insn "breakpoint"
14841+ [ (unspec_volatile [(const_int 0)] VUNSPEC_BREAKPOINT)]
14842+ ""
14843+ "breakpoint"
14844+ [(set_attr "length" "2")]
14845+ )
14846+
14847+;;=============================================================================
14848+;; Xchg instruction
14849+;;-----------------------------------------------------------------------------
14850+(define_insn "xchg"
14851+ [ (parallel [(set (match_operand:SI 0 "register_operand" "=&r")
14852+ (mem:SI (match_operand:SI 1 "register_operand" "r")))
14853+ (set (mem:SI (match_operand:SI 2 "register_operand" "=1"))
14854+ (match_operand:SI 3 "register_operand" "r"))])]
14855+ ""
14856+ "xchg\t%0, %1, %3"
14857+ [(set_attr "length" "4")]
14858+ )
14859+
14860+;;=============================================================================
14861+;; mtsr/mfsr instruction
14862+;;-----------------------------------------------------------------------------
14863+(define_insn "mtsr"
14864+ [ (unspec_volatile [(match_operand 0 "immediate_operand" "i")
14865+ (match_operand:SI 1 "register_operand" "r")] VUNSPEC_MTSR)]
14866+ ""
14867+ "mtsr\t%0, %1"
14868+ [(set_attr "length" "4")]
14869+ )
14870+
14871+(define_insn "mfsr"
14872+ [ (set (match_operand:SI 0 "register_operand" "=r")
14873+ (unspec_volatile:SI [(match_operand 1 "immediate_operand" "i")] VUNSPEC_MFSR)) ]
14874+ ""
14875+ "mfsr\t%0, %1"
14876+ [(set_attr "length" "4")]
14877+ )
14878+
14879+;;=============================================================================
14880+;; mtdr/mfdr instruction
14881+;;-----------------------------------------------------------------------------
14882+(define_insn "mtdr"
14883+ [ (unspec_volatile [(match_operand 0 "immediate_operand" "i")
14884+ (match_operand:SI 1 "register_operand" "r")] VUNSPEC_MTDR)]
14885+ ""
14886+ "mtdr\t%0, %1"
14887+ [(set_attr "length" "4")]
14888+ )
14889+
14890+(define_insn "mfdr"
14891+ [ (set (match_operand:SI 0 "register_operand" "=r")
14892+ (unspec_volatile:SI [(match_operand 1 "immediate_operand" "i")] VUNSPEC_MFDR)) ]
14893+ ""
14894+ "mfdr\t%0, %1"
14895+ [(set_attr "length" "4")]
14896+ )
14897+
14898+;;=============================================================================
14899+;; musfr
14900+;;-----------------------------------------------------------------------------
14901+(define_insn "musfr"
14902+ [ (unspec_volatile [(match_operand:SI 0 "register_operand" "r")] VUNSPEC_MUSFR)]
14903+ ""
14904+ "musfr\t%0"
14905+ [(set_attr "length" "2")
14906+ (set_attr "cc" "clobber")]
14907+ )
14908+
14909+(define_insn "mustr"
14910+ [ (set (match_operand:SI 0 "register_operand" "=r")
14911+ (unspec_volatile:SI [(const_int 0)] VUNSPEC_MUSTR)) ]
14912+ ""
14913+ "mustr\t%0"
14914+ [(set_attr "length" "2")]
14915+ )
14916+
14917+;;=============================================================================
14918+;; Saturation Round Scale instruction
14919+;;-----------------------------------------------------------------------------
14920+(define_insn "sats"
14921+ [ (set (match_operand:SI 0 "register_operand" "+r")
14922+ (unspec:SI [(match_dup 0)
14923+ (match_operand 1 "immediate_operand" "Ku05")
14924+ (match_operand 2 "immediate_operand" "Ku05")]
14925+ UNSPEC_SATS)) ]
14926+ "TARGET_DSP"
14927+ "sats\t%0 >> %1, %2"
14928+ [(set_attr "type" "alu_sat")
14929+ (set_attr "length" "4")]
14930+ )
14931+
14932+(define_insn "satu"
14933+ [ (set (match_operand:SI 0 "register_operand" "+r")
14934+ (unspec:SI [(match_dup 0)
14935+ (match_operand 1 "immediate_operand" "Ku05")
14936+ (match_operand 2 "immediate_operand" "Ku05")]
14937+ UNSPEC_SATU)) ]
14938+ "TARGET_DSP"
14939+ "satu\t%0 >> %1, %2"
14940+ [(set_attr "type" "alu_sat")
14941+ (set_attr "length" "4")]
14942+ )
14943+
14944+(define_insn "satrnds"
14945+ [ (set (match_operand:SI 0 "register_operand" "+r")
14946+ (unspec:SI [(match_dup 0)
14947+ (match_operand 1 "immediate_operand" "Ku05")
14948+ (match_operand 2 "immediate_operand" "Ku05")]
14949+ UNSPEC_SATRNDS)) ]
14950+ "TARGET_DSP"
14951+ "satrnds\t%0 >> %1, %2"
14952+ [(set_attr "type" "alu_sat")
14953+ (set_attr "length" "4")]
14954+ )
14955+
14956+(define_insn "satrndu"
14957+ [ (set (match_operand:SI 0 "register_operand" "+r")
14958+ (unspec:SI [(match_dup 0)
14959+ (match_operand 1 "immediate_operand" "Ku05")
14960+ (match_operand 2 "immediate_operand" "Ku05")]
14961+ UNSPEC_SATRNDU)) ]
14962+ "TARGET_DSP"
14963+ "sats\t%0 >> %1, %2"
14964+ [(set_attr "type" "alu_sat")
14965+ (set_attr "length" "4")]
14966+ )
14967+
14968+;; Special patterns for dealing with the constant pool
14969+
14970+(define_insn "align_4"
14971+ [(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN)]
14972+ ""
14973+ {
14974+ assemble_align (32);
14975+ return "";
14976+ }
14977+ [(set_attr "length" "2")]
14978+)
14979+
14980+(define_insn "consttable_start"
14981+ [(unspec_volatile [(const_int 0)] VUNSPEC_POOL_START)]
14982+ ""
14983+ {
14984+ return ".cpool";
14985+ }
14986+ [(set_attr "length" "0")]
14987+ )
14988+
14989+(define_insn "consttable_end"
14990+ [(unspec_volatile [(const_int 0)] VUNSPEC_POOL_END)]
14991+ ""
14992+ {
14993+ making_const_table = FALSE;
14994+ return "";
14995+ }
14996+ [(set_attr "length" "0")]
14997+)
14998+
14999+
15000+(define_insn "consttable_4"
15001+ [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_4)]
15002+ ""
15003+ {
15004+ making_const_table = TRUE;
15005+ switch (GET_MODE_CLASS (GET_MODE (operands[0])))
15006+ {
15007+ case MODE_FLOAT:
15008+ {
15009+ REAL_VALUE_TYPE r;
15010+ char real_string[1024];
15011+ REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
15012+ real_to_decimal(real_string, &r, 1024, 0, 1);
15013+ asm_fprintf (asm_out_file, "\t.float\t%s\n", real_string);
15014+ break;
15015+ }
15016+ default:
15017+ assemble_integer (operands[0], 4, 0, 1);
15018+ break;
15019+ }
15020+ return "";
15021+ }
15022+ [(set_attr "length" "4")]
15023+)
15024+
15025+(define_insn "consttable_8"
15026+ [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_8)]
15027+ ""
15028+ {
15029+ making_const_table = TRUE;
15030+ switch (GET_MODE_CLASS (GET_MODE (operands[0])))
15031+ {
15032+ case MODE_FLOAT:
15033+ {
15034+ REAL_VALUE_TYPE r;
15035+ char real_string[1024];
15036+ REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
15037+ real_to_decimal(real_string, &r, 1024, 0, 1);
15038+ asm_fprintf (asm_out_file, "\t.double\t%s\n", real_string);
15039+ break;
15040+ }
15041+ default:
15042+ assemble_integer(operands[0], 8, 0, 1);
15043+ break;
15044+ }
15045+ return "";
15046+ }
15047+ [(set_attr "length" "8")]
15048+)
15049+
15050+;;=============================================================================
15051+;; coprocessor instructions
15052+;;-----------------------------------------------------------------------------
15053+(define_insn "cop"
15054+ [ (unspec_volatile [(match_operand 0 "immediate_operand" "Ku03")
15055+ (match_operand 1 "immediate_operand" "Ku04")
15056+ (match_operand 2 "immediate_operand" "Ku04")
15057+ (match_operand 3 "immediate_operand" "Ku04")
15058+ (match_operand 4 "immediate_operand" "Ku07")] VUNSPEC_COP)]
15059+ ""
15060+ "cop\tcp%0, cr%1, cr%2, cr%3, %4"
15061+ [(set_attr "length" "4")]
15062+ )
15063+
15064+(define_insn "mvcrsi"
15065+ [ (set (match_operand:SI 0 "avr32_cop_move_operand" "=r,<,Z")
15066+ (unspec_volatile:SI [(match_operand 1 "immediate_operand" "Ku03,Ku03,Ku03")
15067+ (match_operand 2 "immediate_operand" "Ku04,Ku04,Ku04")]
15068+ VUNSPEC_MVCR)) ]
15069+ ""
15070+ "@
15071+ mvcr.w\tcp%1, %0, cr%2
15072+ stcm.w\tcp%1, %0, cr%2
15073+ stc.w\tcp%1, %0, cr%2"
15074+ [(set_attr "length" "4")]
15075+ )
15076+
15077+(define_insn "mvcrdi"
15078+ [ (set (match_operand:DI 0 "avr32_cop_move_operand" "=r,<,Z")
15079+ (unspec_volatile:DI [(match_operand 1 "immediate_operand" "Ku03,Ku03,Ku03")
15080+ (match_operand 2 "immediate_operand" "Ku04,Ku04,Ku04")]
15081+ VUNSPEC_MVCR)) ]
15082+ ""
15083+ "@
15084+ mvcr.d\tcp%1, %0, cr%2
15085+ stcm.d\tcp%1, %0, cr%2-cr%i2
15086+ stc.d\tcp%1, %0, cr%2"
15087+ [(set_attr "length" "4")]
15088+ )
15089+
15090+(define_insn "mvrcsi"
15091+ [ (unspec_volatile:SI [(match_operand 0 "immediate_operand" "Ku03,Ku03,Ku03")
15092+ (match_operand 1 "immediate_operand" "Ku04,Ku04,Ku04")
15093+ (match_operand:SI 2 "avr32_cop_move_operand" "r,>,Z")]
15094+ VUNSPEC_MVRC)]
15095+ ""
15096+ {
15097+ switch (which_alternative){
15098+ case 0:
15099+ return "mvrc.w\tcp%0, cr%1, %2";
15100+ case 1:
15101+ return "ldcm.w\tcp%0, %2, cr%1";
15102+ case 2:
15103+ return "ldc.w\tcp%0, cr%1, %2";
15104+ default:
15105+ abort();
15106+ }
15107+ }
15108+ [(set_attr "length" "4")]
15109+ )
15110+
15111+(define_insn "mvrcdi"
15112+ [ (unspec_volatile:DI [(match_operand 0 "immediate_operand" "Ku03,Ku03,Ku03")
15113+ (match_operand 1 "immediate_operand" "Ku04,Ku04,Ku04")
15114+ (match_operand:DI 2 "avr32_cop_move_operand" "r,>,Z")]
15115+ VUNSPEC_MVRC)]
15116+ ""
15117+ {
15118+ switch (which_alternative){
15119+ case 0:
15120+ return "mvrc.d\tcp%0, cr%1, %2";
15121+ case 1:
15122+ return "ldcm.d\tcp%0, %2, cr%1-cr%i1";
15123+ case 2:
15124+ return "ldc.d\tcp%0, cr%1, %2";
15125+ default:
15126+ abort();
15127+ }
15128+ }
15129+ [(set_attr "length" "4")]
15130+ )
15131+
15132+;;=============================================================================
15133+;; epilogue
15134+;;-----------------------------------------------------------------------------
15135+;; This pattern emits RTL for exit from a function. The function exit is
15136+;; responsible for deallocating the stack frame, restoring callee saved
15137+;; registers and emitting the return instruction.
15138+;; ToDo: using TARGET_ASM_FUNCTION_PROLOGUE instead.
15139+;;=============================================================================
15140+(define_expand "epilogue"
15141+ [(unspec_volatile [(return)] VUNSPEC_EPILOGUE)]
15142+ ""
15143+ "
15144+ if (USE_RETURN_INSN (FALSE)){
15145+ emit_jump_insn (gen_return ());
15146+ DONE;
15147+ }
15148+ emit_jump_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode,
15149+ gen_rtvec (1,
15150+ gen_rtx_RETURN (VOIDmode)),
15151+ VUNSPEC_EPILOGUE));
15152+ DONE;
15153+ "
15154+ )
15155+
15156+(define_insn "*epilogue_insns"
15157+ [(unspec_volatile [(return)] VUNSPEC_EPILOGUE)]
15158+ ""
15159+ {
15160+ avr32_output_return_instruction (FALSE, FALSE, NULL, NULL);
15161+ return "";
15162+ }
15163+ ; Length is absolute worst case
15164+ [(set_attr "type" "branch")
15165+ (set_attr "length" "12")]
15166+ )
15167+
15168+(define_insn "*epilogue_insns_ret_imm"
15169+ [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
15170+ (use (reg RETVAL_REGNUM))
15171+ (unspec_volatile [(return)] VUNSPEC_EPILOGUE)])]
15172+ "((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
15173+ {
15174+ avr32_output_return_instruction (FALSE, FALSE, NULL, operands[0]);
15175+ return "";
15176+ }
15177+ ; Length is absolute worst case
15178+ [(set_attr "type" "branch")
15179+ (set_attr "length" "12")]
15180+ )
15181+
15182+(define_insn "sibcall_epilogue"
15183+ [(unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)]
15184+ ""
15185+ {
15186+ avr32_output_return_instruction (FALSE, FALSE, NULL, NULL);
15187+ return "";
15188+ }
15189+;; Length is absolute worst case
15190+ [(set_attr "type" "branch")
15191+ (set_attr "length" "12")]
15192+ )
15193+
15194+(define_insn "*sibcall_epilogue_insns_ret_imm"
15195+ [(parallel [(set (reg RETVAL_REGNUM) (match_operand 0 "immediate_operand" "i"))
15196+ (use (reg RETVAL_REGNUM))
15197+ (unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)])]
15198+ "((INTVAL(operands[0]) == -1) || (INTVAL(operands[0]) == 0) || (INTVAL(operands[0]) == 1))"
15199+ {
15200+ avr32_output_return_instruction (FALSE, FALSE, NULL, operands[0]);
15201+ return "";
15202+ }
15203+ ; Length is absolute worst case
15204+ [(set_attr "type" "branch")
15205+ (set_attr "length" "12")]
15206+ )
15207+
15208+(define_insn "ldxi"
15209+ [(set (match_operand:SI 0 "register_operand" "=r")
15210+ (mem:SI (plus:SI
15211+ (match_operand:SI 1 "register_operand" "r")
15212+ (mult:SI (zero_extract:SI (match_operand:SI 2 "register_operand" "r")
15213+ (const_int 8)
15214+ (match_operand:SI 3 "immediate_operand" "Ku05"))
15215+ (const_int 4)))))]
15216+ "(INTVAL(operands[3]) == 24 || INTVAL(operands[3]) == 16 || INTVAL(operands[3]) == 8
15217+ || INTVAL(operands[3]) == 0)"
15218+ {
15219+ switch ( INTVAL(operands[3]) ){
15220+ case 0:
15221+ return "ld.w %0, %1[%2:b << 2]";
15222+ case 8:
15223+ return "ld.w %0, %1[%2:l << 2]";
15224+ case 16:
15225+ return "ld.w %0, %1[%2:u << 2]";
15226+ case 24:
15227+ return "ld.w %0, %1[%2:t << 2]";
15228+ default:
15229+ internal_error("illegal operand for ldxi");
15230+ }
15231+ }
15232+ [(set_attr "type" "load")
15233+ (set_attr "length" "4")
15234+ (set_attr "cc" "none")])
15235+
15236+
15237+
15238+
15239+
15240+
15241+;;=============================================================================
15242+;; Peephole optimizing
15243+;;-----------------------------------------------------------------------------
15244+;; Changing
15245+;; sub r8, r7, 8
15246+;; st.w r8[0x0], r12
15247+;; to
15248+;; sub r8, r7, 8
15249+;; st.w r7[-0x8], r12
15250+;;=============================================================================
15251+; (set (reg:SI 9 r8)
15252+; (plus:SI (reg/f:SI 6 r7)
15253+; (const_int ...)))
15254+; (set (mem:SI (reg:SI 9 r8))
15255+; (reg:SI 12 r12))
15256+(define_peephole2
15257+ [(set (match_operand:SI 0 "register_operand" "")
15258+ (plus:SI (match_operand:SI 1 "register_operand" "")
15259+ (match_operand:SI 2 "immediate_operand" "")))
15260+ (set (mem:SI (match_dup 0))
15261+ (match_operand:SI 3 "register_operand" ""))]
15262+ "REGNO(operands[0]) != REGNO(operands[1])"
15263+ [(set (match_dup 0)
15264+ (plus:SI (match_dup 1)
15265+ (match_dup 2)))
15266+ (set (mem:SI (plus:SI (match_dup 1)
15267+ (match_dup 2)))
15268+ (match_dup 3))]
15269+ "")
15270+
15271+;;=============================================================================
15272+;; Peephole optimizing
15273+;;-----------------------------------------------------------------------------
15274+;; Changing
15275+;; sub r6, r7, 4
15276+;; ld.w r6, r6[0x0]
15277+;; to
15278+;; sub r6, r7, 4
15279+;; ld.w r6, r7[-0x4]
15280+;;=============================================================================
15281+; (set (reg:SI 7 r6)
15282+; (plus:SI (reg/f:SI 6 r7)
15283+; (const_int -4 [0xfffffffc])))
15284+; (set (reg:SI 7 r6)
15285+; (mem:SI (reg:SI 7 r6)))
15286+(define_peephole2
15287+ [(set (match_operand:SI 0 "register_operand" "")
15288+ (plus:SI (match_operand:SI 1 "register_operand" "")
15289+ (match_operand:SI 2 "immediate_operand" "")))
15290+ (set (match_operand:SI 3 "register_operand" "")
15291+ (mem:SI (match_dup 0)))]
15292+ "REGNO(operands[0]) != REGNO(operands[1])"
15293+ [(set (match_dup 0)
15294+ (plus:SI (match_dup 1)
15295+ (match_dup 2)))
15296+ (set (match_dup 3)
15297+ (mem:SI (plus:SI (match_dup 1)
15298+ (match_dup 2))))]
15299+ "")
15300+
15301+;;=============================================================================
15302+;; Peephole optimizing
15303+;;-----------------------------------------------------------------------------
15304+;; Changing
15305+;; ld.sb r0, r7[-0x6]
15306+;; cashs.b r0
15307+;; to
15308+;; ld.sb r0, r7[-0x6]
15309+;;=============================================================================
15310+(define_peephole2
15311+ [(set (match_operand:QI 0 "register_operand" "")
15312+ (match_operand:QI 1 "load_sb_memory_operand" ""))
15313+ (set (match_operand:SI 2 "register_operand" "")
15314+ (sign_extend:SI (match_dup 0)))]
15315+ "(REGNO(operands[0]) == REGNO(operands[2]) || peep2_reg_dead_p(2, operands[0]))"
15316+ [(set (match_dup 2)
15317+ (sign_extend:SI (match_dup 1)))]
15318+ "")
15319+
15320+;;=============================================================================
15321+;; Peephole optimizing
15322+;;-----------------------------------------------------------------------------
15323+;; Changing
15324+;; ld.ub r0, r7[-0x6]
15325+;; cashu.b r0
15326+;; to
15327+;; ld.ub r0, r7[-0x6]
15328+;;=============================================================================
15329+(define_peephole2
15330+ [(set (match_operand:QI 0 "register_operand" "")
15331+ (match_operand:QI 1 "memory_operand" ""))
15332+ (set (match_operand:SI 2 "register_operand" "")
15333+ (zero_extend:SI (match_dup 0)))]
15334+ "(REGNO(operands[0]) == REGNO(operands[2])) || peep2_reg_dead_p(2, operands[0])"
15335+ [(set (match_dup 2)
15336+ (zero_extend:SI (match_dup 1)))]
15337+ "")
15338+
15339+;;=============================================================================
15340+;; Peephole optimizing
15341+;;-----------------------------------------------------------------------------
15342+;; Changing
15343+;; ld.sh r0, r7[-0x6]
15344+;; casts.h r0
15345+;; to
15346+;; ld.sh r0, r7[-0x6]
15347+;;=============================================================================
15348+(define_peephole2
15349+ [(set (match_operand:HI 0 "register_operand" "")
15350+ (match_operand:HI 1 "memory_operand" ""))
15351+ (set (match_operand:SI 2 "register_operand" "")
15352+ (sign_extend:SI (match_dup 0)))]
15353+ "(REGNO(operands[0]) == REGNO(operands[2])) || peep2_reg_dead_p(2, operands[0])"
15354+ [(set (match_dup 2)
15355+ (sign_extend:SI (match_dup 1)))]
15356+ "")
15357+
15358+;;=============================================================================
15359+;; Peephole optimizing
15360+;;-----------------------------------------------------------------------------
15361+;; Changing
15362+;; ld.uh r0, r7[-0x6]
15363+;; castu.h r0
15364+;; to
15365+;; ld.uh r0, r7[-0x6]
15366+;;=============================================================================
15367+(define_peephole2
15368+ [(set (match_operand:HI 0 "register_operand" "")
15369+ (match_operand:HI 1 "memory_operand" ""))
15370+ (set (match_operand:SI 2 "register_operand" "")
15371+ (zero_extend:SI (match_dup 0)))]
15372+ "(REGNO(operands[0]) == REGNO(operands[2])) || peep2_reg_dead_p(2, operands[0])"
15373+ [(set (match_dup 2)
15374+ (zero_extend:SI (match_dup 1)))]
15375+ "")
15376+
15377+;;=============================================================================
15378+;; Peephole optimizing
15379+;;-----------------------------------------------------------------------------
15380+;; Changing
15381+;; mul rd, rx, ry
15382+;; add rd2, rd
15383+;; to
15384+;; mac rd2, rx, ry
15385+;;=============================================================================
15386+(define_peephole2
15387+ [(set (match_operand:SI 0 "register_operand" "")
15388+ (mult:SI (match_operand:SI 1 "register_operand" "")
15389+ (match_operand:SI 2 "register_operand" "")))
15390+ (set (match_operand:SI 3 "register_operand" "")
15391+ (plus:SI (match_dup 3)
15392+ (match_dup 0)))]
15393+ "peep2_reg_dead_p(2, operands[0])"
15394+ [(set (match_dup 3)
15395+ (plus:SI (mult:SI (match_dup 1)
15396+ (match_dup 2))
15397+ (match_dup 3)))]
15398+ "")
15399+
15400+
15401+
15402+;;=============================================================================
15403+;; Peephole optimizing
15404+;;-----------------------------------------------------------------------------
15405+;; Changing
15406+;; bfextu rd, rs, k5, 1 or and(h/l) rd, one_bit_set_mask
15407+;; to
15408+;; bld rs, k5
15409+;;
15410+;; If rd is dead after the operation.
15411+;;=============================================================================
15412+(define_peephole2
15413+ [ (set (match_operand:SI 0 "register_operand" "")
15414+ (zero_extract:SI (match_operand:SI 1 "register_operand" "")
15415+ (const_int 1)
15416+ (match_operand:SI 2 "immediate_operand" "")))
15417+ (set (cc0)
15418+ (match_dup 0))]
15419+ "peep2_reg_dead_p(2, operands[0])"
15420+ [(set (cc0)
15421+ (and:SI (match_dup 1)
15422+ (match_dup 2)))]
15423+ "operands[2] = GEN_INT(1 << INTVAL(operands[2]));")
15424+
15425+(define_peephole2
15426+ [ (set (match_operand:SI 0 "register_operand" "")
15427+ (and:SI (match_operand:SI 1 "register_operand" "")
15428+ (match_operand:SI 2 "one_bit_set_operand" "")))
15429+ (set (cc0)
15430+ (match_dup 0))]
15431+ "peep2_reg_dead_p(2, operands[0])"
15432+ [(set (cc0)
15433+ (and:SI (match_dup 1)
15434+ (match_dup 2)))]
15435+ "")
15436+
15437+;;=============================================================================
15438+;; Peephole optimizing
15439+;;-----------------------------------------------------------------------------
15440+;; Load with extracted index: ld.w Rd, Rb[Ri:{t/u/b/l} << 2]
15441+;;
15442+;;=============================================================================
15443+
15444+
15445+(define_peephole
15446+ [(set (match_operand:SI 0 "register_operand" "")
15447+ (zero_extract:SI (match_operand:SI 1 "register_operand" "")
15448+ (const_int 8)
15449+ (match_operand:SI 2 "avr32_extract_shift_operand" "")))
15450+ (set (match_operand:SI 3 "register_operand" "")
15451+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
15452+ (match_operand:SI 4 "register_operand" ""))))]
15453+
15454+ "(dead_or_set_p(insn, operands[0]))"
15455+ {
15456+ switch ( INTVAL(operands[2]) ){
15457+ case 0:
15458+ return "ld.w %3, %4[%1:b << 2]";
15459+ case 8:
15460+ return "ld.w %3, %4[%1:l << 2]";
15461+ case 16:
15462+ return "ld.w %3, %4[%1:u << 2]";
15463+ case 24:
15464+ return "ld.w %3, %4[%1:t << 2]";
15465+ default:
15466+ internal_error("illegal operand for ldxi");
15467+ }
15468+ }
15469+ [(set_attr "type" "load")
15470+ (set_attr "length" "4")
15471+ (set_attr "cc" "clobber")]
15472+ )
15473+
15474+
15475+
15476+(define_peephole
15477+ [(set (match_operand:SI 0 "register_operand" "")
15478+ (and:SI (match_operand:SI 1 "register_operand" "") (const_int 255)))
15479+ (set (match_operand:SI 2 "register_operand" "")
15480+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
15481+ (match_operand:SI 3 "register_operand" ""))))]
15482+
15483+ "(dead_or_set_p(insn, operands[0]))"
15484+
15485+ "ld.w %2, %3[%1:b << 2]"
15486+ [(set_attr "type" "load")
15487+ (set_attr "length" "4")
15488+ (set_attr "cc" "clobber")]
15489+ )
15490+
15491+
15492+(define_peephole2
15493+ [(set (match_operand:SI 0 "register_operand" "")
15494+ (zero_extract:SI (match_operand:SI 1 "register_operand" "")
15495+ (const_int 8)
15496+ (match_operand:SI 2 "avr32_extract_shift_operand" "")))
15497+ (set (match_operand:SI 3 "register_operand" "")
15498+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
15499+ (match_operand:SI 4 "register_operand" ""))))]
15500+
15501+ "(peep2_reg_dead_p(2, operands[0]))
15502+ || (REGNO(operands[0]) == REGNO(operands[3]))"
15503+ [(set (match_dup 3)
15504+ (mem:SI (plus:SI
15505+ (match_dup 4)
15506+ (mult:SI (zero_extract:SI (match_dup 1)
15507+ (const_int 8)
15508+ (match_dup 2))
15509+ (const_int 4)))))]
15510+ )
15511+
15512+(define_peephole2
15513+ [(set (match_operand:SI 0 "register_operand" "")
15514+ (zero_extend:SI (match_operand:QI 1 "register_operand" "")))
15515+ (set (match_operand:SI 2 "register_operand" "")
15516+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
15517+ (match_operand:SI 3 "register_operand" ""))))]
15518+
15519+ "(peep2_reg_dead_p(2, operands[0]))
15520+ || (REGNO(operands[0]) == REGNO(operands[2]))"
15521+ [(set (match_dup 2)
15522+ (mem:SI (plus:SI
15523+ (match_dup 3)
15524+ (mult:SI (zero_extract:SI (match_dup 1)
15525+ (const_int 8)
15526+ (const_int 0))
15527+ (const_int 4)))))]
15528+ "operands[1] = gen_rtx_REG(SImode, REGNO(operands[1]));"
15529+ )
15530+
15531+
15532+(define_peephole2
15533+ [(set (match_operand:SI 0 "register_operand" "")
15534+ (and:SI (match_operand:SI 1 "register_operand" "")
15535+ (const_int 255)))
15536+ (set (match_operand:SI 2 "register_operand" "")
15537+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
15538+ (match_operand:SI 3 "register_operand" ""))))]
15539+
15540+ "(peep2_reg_dead_p(2, operands[0]))
15541+ || (REGNO(operands[0]) == REGNO(operands[2]))"
15542+ [(set (match_dup 2)
15543+ (mem:SI (plus:SI
15544+ (match_dup 3)
15545+ (mult:SI (zero_extract:SI (match_dup 1)
15546+ (const_int 8)
15547+ (const_int 0))
15548+ (const_int 4)))))]
15549+ ""
15550+ )
15551+
15552+
15553+
15554+(define_peephole2
15555+ [(set (match_operand:SI 0 "register_operand" "")
15556+ (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
15557+ (const_int 24)))
15558+ (set (match_operand:SI 2 "register_operand" "")
15559+ (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
15560+ (match_operand:SI 3 "register_operand" ""))))]
15561+
15562+ "(peep2_reg_dead_p(2, operands[0]))
15563+ || (REGNO(operands[0]) == REGNO(operands[2]))"
15564+ [(set (match_dup 2)
15565+ (mem:SI (plus:SI
15566+ (match_dup 3)
15567+ (mult:SI (zero_extract:SI (match_dup 1)
15568+ (const_int 8)
15569+ (const_int 24))
15570+ (const_int 4)))))]
15571+ ""
15572+ )
15573+
15574+
15575+;;************************************************
15576+;; ANDN
15577+;;
15578+;;************************************************
15579+
15580+
15581+(define_peephole2
15582+ [(set (match_operand:SI 0 "register_operand" "")
15583+ (not:SI (match_operand:SI 1 "register_operand" "")))
15584+ (set (match_operand:SI 2 "register_operand" "")
15585+ (and:SI (match_dup 2)
15586+ (match_dup 0)))]
15587+ "peep2_reg_dead_p(2, operands[0])"
15588+
15589+ [(set (match_dup 2)
15590+ (and:SI (match_dup 2)
15591+ (not:SI (match_dup 1))
15592+ ))]
15593+ ""
15594+)
15595+
15596+(define_peephole2
15597+ [(set (match_operand:SI 0 "register_operand" "")
15598+ (not:SI (match_operand:SI 1 "register_operand" "")))
15599+ (set (match_operand:SI 2 "register_operand" "")
15600+ (and:SI (match_dup 0)
15601+ (match_dup 2)
15602+ ))]
15603+ "peep2_reg_dead_p(2, operands[0])"
15604+
15605+ [(set (match_dup 2)
15606+ (and:SI (match_dup 2)
15607+ (not:SI (match_dup 1))
15608+ ))]
15609+
15610+ ""
15611+)
15612+
15613+
15614+;;=================================================================
15615+;; Addabs peephole
15616+;;=================================================================
15617+
15618+(define_peephole
15619+ [(set (match_operand:SI 2 "register_operand" "=r")
15620+ (abs:SI (match_operand:SI 1 "register_operand" "r")))
15621+ (set (match_operand:SI 0 "register_operand" "=r")
15622+ (plus:SI (match_operand:SI 3 "register_operand" "r")
15623+ (match_dup 2)))]
15624+ "dead_or_set_p(insn, operands[2])"
15625+ "addabs %0, %3, %1"
15626+ [(set_attr "length" "4")
15627+ (set_attr "cc" "set_z")])
15628+
15629+(define_peephole
15630+ [(set (match_operand:SI 2 "register_operand" "=r")
15631+ (abs:SI (match_operand:SI 1 "register_operand" "r")))
15632+ (set (match_operand:SI 0 "register_operand" "=r")
15633+ (plus:SI (match_dup 2)
15634+ (match_operand:SI 3 "register_operand" "r")))]
15635+ "dead_or_set_p(insn, operands[2])"
15636+ "addabs %0, %3, %1"
15637+ [(set_attr "length" "4")
15638+ (set_attr "cc" "set_z")])
15639+
15640+
15641+;;=================================================================
15642+;; Detect roundings
15643+;;=================================================================
15644+
15645+(define_insn "*round"
15646+ [(set (match_operand:SI 0 "register_operand" "=r")
15647+ (ashiftrt:SI (plus:SI (match_operand:SI 1 "register_operand" "0")
15648+ (match_operand:SI 2 "immediate_operand" "i"))
15649+ (match_operand:SI 3 "immediate_operand" "i")))]
15650+ "avr32_rnd_operands(operands[2], operands[3])"
15651+
15652+ "satrnds %0 >> %3, 31"
15653+
15654+ [(set_attr "type" "alu_sat")
15655+ (set_attr "length" "4")]
15656+
15657+ )
15658+
15659+
15660+(define_peephole2
15661+ [(set (match_operand:SI 0 "register_operand" "")
15662+ (plus:SI (match_dup 0)
15663+ (match_operand:SI 1 "immediate_operand" "")))
15664+ (set (match_dup 0)
15665+ (ashiftrt:SI (match_dup 0)
15666+ (match_operand:SI 2 "immediate_operand" "")))]
15667+ "avr32_rnd_operands(operands[1], operands[2])"
15668+
15669+ [(set (match_dup 0)
15670+ (ashiftrt:SI (plus:SI (match_dup 0)
15671+ (match_dup 1))
15672+ (match_dup 2)))]
15673+ )
15674+
15675+(define_peephole
15676+ [(set (match_operand:SI 0 "register_operand" "r")
15677+ (plus:SI (match_dup 0)
15678+ (match_operand:SI 1 "immediate_operand" "i")))
15679+ (set (match_dup 0)
15680+ (ashiftrt:SI (match_dup 0)
15681+ (match_operand:SI 2 "immediate_operand" "i")))]
15682+ "avr32_rnd_operands(operands[1], operands[2])"
15683+
15684+ "satrnds %0 >> %2, 31"
15685+
15686+ [(set_attr "type" "alu_sat")
15687+ (set_attr "length" "4")
15688+ (set_attr "cc" "clobber")]
15689+
15690+ )
15691+
15692+
15693+
15694+
15695+;;=================================================================
15696+;; Conditional Subtract
15697+;;=================================================================
15698+
15699+
15700+(define_peephole
15701+ [(set (match_operand:SI 0 "register_operand" "")
15702+ (minus:SI (match_operand:SI 1 "register_operand" "")
15703+ (match_operand:SI 2 "immediate_operand" "")))
15704+ (set (match_dup 1)
15705+ (unspec:SI [(match_operand 5 "avr32_comparison_operator" "")
15706+ (match_dup 0)
15707+ (match_dup 1)
15708+ (match_operand 3 "general_operand" "")
15709+ (match_operand 4 "general_operand" "")]
15710+ UNSPEC_MOVSICC))]
15711+
15712+ "(dead_or_set_p(insn, operands[0])) && avr32_const_ok_for_constraint_p(INTVAL(operands[2]), 'K', \"Ks08\")"
15713+
15714+ {
15715+
15716+ operands[5] = avr32_output_cmp(operands[5], GET_MODE(operands[3]), operands[3], operands[4]);
15717+
15718+ return "sub%5 %1, %2";
15719+ }
15720+
15721+ [(set_attr "length" "10")
15722+ (set_attr "cc" "clobber")]
15723+ )
15724+
15725+(define_peephole
15726+ [(set (match_operand:SI 0 "register_operand" "")
15727+ (plus:SI (match_operand:SI 1 "register_operand" "")
15728+ (match_operand:SI 2 "immediate_operand" "")))
15729+ (set (match_dup 1)
15730+ (unspec:SI [(match_operand 5 "avr32_comparison_operator" "")
15731+ (match_dup 0)
15732+ (match_dup 1)
15733+ (match_operand 3 "general_operand" "")
15734+ (match_operand 4 "general_operand" "")]
15735+ UNSPEC_MOVSICC))]
15736+
15737+ "(dead_or_set_p(insn, operands[0]) && avr32_const_ok_for_constraint_p(INTVAL(operands[2]), 'I', \"Is08\"))"
15738+
15739+ {
15740+ operands[5] = avr32_output_cmp(operands[5], GET_MODE(operands[3]), operands[3], operands[4]);
15741+
15742+ return "sub%5 %1, %n2";
15743+ }
15744+ [(set_attr "length" "10")
15745+ (set_attr "cc" "clobber")]
15746+ )
15747+
15748+;;=================================================================
15749+;; mcall
15750+;;=================================================================
15751+(define_peephole
15752+ [(set (match_operand:SI 0 "register_operand" "")
15753+ (match_operand 1 "avr32_const_pool_ref_operand" ""))
15754+ (parallel [(call (mem:SI (match_dup 0))
15755+ (match_operand 2 "" ""))
15756+ (clobber (reg:SI LR_REGNUM))])]
15757+ "dead_or_set_p(insn, operands[0])"
15758+ "mcall %1"
15759+ [(set_attr "type" "call")
15760+ (set_attr "length" "4")
15761+ (set_attr "cc" "clobber")]
15762+)
15763+
15764+(define_peephole
15765+ [(set (match_operand:SI 2 "register_operand" "")
15766+ (match_operand 1 "avr32_const_pool_ref_operand" ""))
15767+ (parallel [(set (match_operand 0 "register_operand" "")
15768+ (call (mem:SI (match_dup 2))
15769+ (match_operand 3 "" "")))
15770+ (clobber (reg:SI LR_REGNUM))])]
15771+ "dead_or_set_p(insn, operands[2])"
15772+ "mcall %1"
15773+ [(set_attr "type" "call")
15774+ (set_attr "length" "4")
15775+ (set_attr "cc" "call_set")]
15776+)
15777+
15778+
15779+(define_peephole2
15780+ [(set (match_operand:SI 0 "register_operand" "")
15781+ (match_operand 1 "avr32_const_pool_ref_operand" ""))
15782+ (parallel [(call (mem:SI (match_dup 0))
15783+ (match_operand 2 "" ""))
15784+ (clobber (reg:SI LR_REGNUM))])]
15785+ "peep2_reg_dead_p(2, operands[0])"
15786+ [(parallel [(call (mem:SI (match_dup 1))
15787+ (match_dup 2))
15788+ (clobber (reg:SI LR_REGNUM))])]
15789+ ""
15790+)
15791+
15792+(define_peephole2
15793+ [(set (match_operand:SI 0 "register_operand" "")
15794+ (match_operand 1 "avr32_const_pool_ref_operand" ""))
15795+ (parallel [(set (match_operand 2 "register_operand" "")
15796+ (call (mem:SI (match_dup 0))
15797+ (match_operand 3 "" "")))
15798+ (clobber (reg:SI LR_REGNUM))])]
15799+ "(peep2_reg_dead_p(2, operands[0]) || (REGNO(operands[2]) == REGNO(operands[0])))"
15800+ [(parallel [(set (match_dup 2)
15801+ (call (mem:SI (match_dup 1))
15802+ (match_dup 3)))
15803+ (clobber (reg:SI LR_REGNUM))])]
15804+ ""
15805+)
15806+
15807+;;=================================================================
15808+;; Returning a value
15809+;;=================================================================
15810+
15811+
15812+(define_peephole
15813+ [(set (match_operand 0 "register_operand" "")
15814+ (match_operand 1 "register_operand" ""))
15815+ (return)]
15816+ "USE_RETURN_INSN (TRUE) && (REGNO(operands[0]) == RETVAL_REGNUM)
15817+ && (REGNO(operands[1]) != LR_REGNUM)
15818+ && (REGNO_REG_CLASS(REGNO(operands[1])) == GENERAL_REGS)"
15819+ "retal %1"
15820+ [(set_attr "type" "call")
15821+ (set_attr "length" "2")]
15822+ )
15823+
15824+
15825+(define_peephole
15826+ [(set (match_operand 0 "register_operand" "r")
15827+ (match_operand 1 "immediate_operand" "i"))
15828+ (return)]
15829+ "(USE_RETURN_INSN (FALSE) && (REGNO(operands[0]) == RETVAL_REGNUM) &&
15830+ ((INTVAL(operands[1]) == -1) || (INTVAL(operands[1]) == 0) || (INTVAL(operands[1]) == 1)))"
15831+ {
15832+ avr32_output_return_instruction (TRUE, FALSE, NULL, operands[1]);
15833+ return "";
15834+ }
15835+ [(set_attr "type" "call")
15836+ (set_attr "length" "4")]
15837+ )
15838+
15839+(define_peephole
15840+ [(set (match_operand 0 "register_operand" "r")
15841+ (match_operand 1 "immediate_operand" "i"))
15842+ (unspec_volatile [(return)] VUNSPEC_EPILOGUE)]
15843+ "(REGNO(operands[0]) == RETVAL_REGNUM) &&
15844+ ((INTVAL(operands[1]) == -1) || (INTVAL(operands[1]) == 0) || (INTVAL(operands[1]) == 1))"
15845+ {
15846+ avr32_output_return_instruction (FALSE, FALSE, NULL, operands[1]);
15847+ return "";
15848+ }
15849+ ; Length is absolute worst case
15850+ [(set_attr "type" "branch")
15851+ (set_attr "length" "12")]
15852+ )
15853+
15854+(define_peephole
15855+ [(set (match_operand 0 "register_operand" "r")
15856+ (unspec [(match_operand 1 "avr32_comparison_operator" "")
15857+ (match_operand 2 "register_immediate_operand" "rKs08")
15858+ (match_operand 3 "register_immediate_operand" "rKs08")
15859+ (match_operand 4 "register_immediate_operand" "r")
15860+ (match_operand 5 "register_immediate_operand" "rKs21")
15861+ ]
15862+ UNSPEC_MOVSICC ))
15863+ (return)]
15864+ "USE_RETURN_INSN (TRUE) && (REGNO(operands[0]) == RETVAL_REGNUM) &&
15865+ ((GET_MODE(operands[4]) == SImode) ||
15866+ ((GET_MODE(operands[4]) != SImode) && (GET_CODE(operands[5]) == REG)))"
15867+ {
15868+ operands[1] = avr32_output_cmp(operands[1], GET_MODE(operands[4]), operands[4], operands[5]);
15869+
15870+ if ( GET_CODE(operands[2]) == REG
15871+ && GET_CODE(operands[3]) == REG
15872+ && REGNO(operands[2]) != LR_REGNUM
15873+ && REGNO(operands[3]) != LR_REGNUM ){
15874+ return "ret%1 %2\;ret%i1 %3";
15875+ } else if ( GET_CODE(operands[2]) == REG
15876+ && GET_CODE(operands[3]) == CONST_INT ){
15877+ if ( INTVAL(operands[3]) == -1
15878+ || INTVAL(operands[3]) == 0
15879+ || INTVAL(operands[3]) == 1 ){
15880+ return "ret%1 %2\;ret%i1 %d3";
15881+ } else {
15882+ return "mov%1 r12, %2\;mov%i1 r12, %3\;retal r12";
15883+ }
15884+ } else if ( GET_CODE(operands[2]) == CONST_INT
15885+ && GET_CODE(operands[3]) == REG ){
15886+ if ( INTVAL(operands[2]) == -1
15887+ || INTVAL(operands[2]) == 0
15888+ || INTVAL(operands[2]) == 1 ){
15889+ return "ret%1 %d2\;ret%i1 %3";
15890+ } else {
15891+ return "mov%1 r12, %2\;mov%i1 r12, %3\;retal r12";
15892+ }
15893+ } else {
15894+ if ( (INTVAL(operands[2]) == -1
15895+ || INTVAL(operands[2]) == 0
15896+ || INTVAL(operands[2]) == 1 )
15897+ && (INTVAL(operands[3]) == -1
15898+ || INTVAL(operands[3]) == 0
15899+ || INTVAL(operands[3]) == 1 )){
15900+ return "ret%1 %d2\;ret%i1 %d3";
15901+ } else {
15902+ return "mov%1 r12, %2\;mov%i1 r12, %3\;retal r12";
15903+ }
15904+ }
15905+ }
15906+
15907+ [(set_attr "length" "14")
15908+ (set_attr "cc" "clobber")
15909+ (set_attr "type" "call")])
15910+
15911+
15912+;;=================================================================
15913+;; mulnhh.w
15914+;;=================================================================
15915+
15916+(define_peephole2
15917+ [(set (match_operand:HI 0 "register_operand" "")
15918+ (neg:HI (match_operand:HI 1 "register_operand" "")))
15919+ (set (match_operand:SI 2 "register_operand" "")
15920+ (mult:SI
15921+ (sign_extend:SI (match_dup 0))
15922+ (sign_extend:SI (match_operand:HI 3 "register_operand" ""))))]
15923+ "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[2]) == REGNO(operands[0]))"
15924+ [ (set (match_dup 2)
15925+ (mult:SI
15926+ (sign_extend:SI (neg:HI (match_dup 1)))
15927+ (sign_extend:SI (match_dup 3))))]
15928+ ""
15929+ )
15930+
15931+(define_peephole2
15932+ [(set (match_operand:HI 0 "register_operand" "")
15933+ (neg:HI (match_operand:HI 1 "register_operand" "")))
15934+ (set (match_operand:SI 2 "register_operand" "")
15935+ (mult:SI
15936+ (sign_extend:SI (match_operand:HI 3 "register_operand" ""))
15937+ (sign_extend:SI (match_dup 0))))]
15938+ "(peep2_reg_dead_p(2, operands[0])) || (REGNO(operands[2]) == REGNO(operands[0]))"
15939+ [ (set (match_dup 2)
15940+ (mult:SI
15941+ (sign_extend:SI (neg:HI (match_dup 1)))
15942+ (sign_extend:SI (match_dup 3))))]
15943+ ""
15944+ )
15945+
15946+
15947+
15948+;;=================================================================
15949+;; sthh.w
15950+;;=================================================================
15951+(define_insn "vec_setv2hi"
15952+ [(set (match_operand:V2HI 0 "register_operand" "=r")
15953+ (vec_merge:V2HI
15954+ (match_dup 0)
15955+ (vec_duplicate:V2HI
15956+ (match_operand:HI 1 "register_operand" "r"))
15957+ (const_int 1)))]
15958+ ""
15959+ "bfins\t%0, %1, 16, 16"
15960+ [(set_attr "type" "alu")
15961+ (set_attr "length" "4")
15962+ (set_attr "cc" "clobber")])
15963+
15964+(define_insn "vec_setv2lo"
15965+ [(set (match_operand:V2HI 0 "register_operand" "+r")
15966+ (vec_merge:V2HI
15967+ (match_dup 0)
15968+ (vec_duplicate:V2HI
15969+ (match_operand:HI 1 "register_operand" "r"))
15970+ (const_int 2)))]
15971+ ""
15972+ "bfins\t%0, %1, 0, 16"
15973+ [(set_attr "type" "alu")
15974+ (set_attr "length" "4")
15975+ (set_attr "cc" "clobber")])
15976+
15977+(define_expand "vec_setv2"
15978+ [(set (match_operand:V2HI 0 "register_operand" "")
15979+ (vec_merge:V2HI
15980+ (match_dup 0)
15981+ (vec_duplicate:V2HI
15982+ (match_operand:HI 1 "register_operand" ""))
15983+ (match_operand 2 "immediate_operand" "")))]
15984+ ""
15985+ { operands[2] = GEN_INT(INTVAL(operands[2]) + 1); }
15986+ )
15987+
15988+(define_insn "vec_extractv2hi"
15989+ [(set (match_operand:HI 0 "register_operand" "=r")
15990+ (vec_select:HI
15991+ (match_operand:V2HI 1 "register_operand" "r")
15992+ (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
15993+ ""
15994+ {
15995+ if ( INTVAL(operands[2]) == 0 )
15996+ return "bfextu\t%0, %1, 16, 16";
15997+ else
15998+ return "bfextu\t%0, %1, 0, 16";
15999+ }
16000+ [(set_attr "type" "alu")
16001+ (set_attr "length" "4")
16002+ (set_attr "cc" "clobber")])
16003+
16004+(define_insn "vec_extractv4qi"
16005+ [(set (match_operand:QI 0 "register_operand" "=r")
16006+ (vec_select:QI
16007+ (match_operand:V4QI 1 "register_operand" "r")
16008+ (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
16009+ ""
16010+ {
16011+ switch ( INTVAL(operands[2]) ){
16012+ case 0:
16013+ return "bfextu\t%0, %1, 24, 8";
16014+ case 1:
16015+ return "bfextu\t%0, %1, 16, 8";
16016+ case 2:
16017+ return "bfextu\t%0, %1, 8, 8";
16018+ case 3:
16019+ return "bfextu\t%0, %1, 0, 8";
16020+ default:
16021+ abort();
16022+ }
16023+ }
16024+ [(set_attr "type" "alu")
16025+ (set_attr "length" "4")
16026+ (set_attr "cc" "clobber")])
16027+
16028+
16029+(define_insn "concatv2hi"
16030+ [(set (match_operand:V2HI 0 "register_operand" "=r, r, r")
16031+ (vec_concat:V2HI
16032+ (match_operand:HI 1 "register_operand" "r, r, 0")
16033+ (match_operand:HI 2 "register_operand" "r, 0, r")))]
16034+ ""
16035+ "@
16036+ mov\t%0, %1\;bfins\t%0, %2, 0, 16
16037+ bfins\t%0, %2, 0, 16
16038+ bfins\t%0, %1, 16, 16"
16039+ [(set_attr "length" "6, 4, 4")
16040+ (set_attr "type" "alu")])
16041+
16042+;(define_peephole2
16043+; [(set (match_operand:HI 0 "register_operand" "r")
16044+; (plus:HI (match_operand:HI 3 "register_operand" "r")
16045+; (match_operand:HI 4 "register_operand" "r")))
16046+; (set (match_operand:HI 1 "register_operand" "r")
16047+; (minus:HI (match_dup 3)
16048+; (match_dup 4)))]
16049+; "REGNO(operands[0]) != REGNO(operands[3])"
16050+; [(set (match_dup 2)
16051+; (vec_concat:V2HI
16052+; (minus:HI (match_dup 3)
16053+; (match_dup 4))
16054+; (plus:HI (match_dup 3) (match_dup 4))))
16055+; (set (match_dup 1) (vec_select:HI (match_dup 2)
16056+; (parallel [(const_int 0)])))]
16057+;
16058+; "operands[2] = gen_rtx_REG(V2HImode, REGNO(operands[0]));"
16059+; )
16060+;
16061+;(define_peephole2
16062+; [(set (match_operand:HI 0 "register_operand" "r")
16063+; (minus:HI (match_operand:HI 3 "register_operand" "r")
16064+; (match_operand:HI 4 "register_operand" "r")))
16065+; (set (match_operand:HI 1 "register_operand" "r")
16066+; (plus:HI (match_dup 3)
16067+; (match_dup 4)))]
16068+; "REGNO(operands[0]) != REGNO(operands[3])"
16069+; [(set (match_dup 2)
16070+; (vec_concat:V2HI
16071+; (plus:HI (match_dup 3)
16072+; (match_dup 4))
16073+; (minus:HI (match_dup 3) (match_dup 4))))
16074+; (set (match_dup 1) (vec_select:HI (match_dup 2)
16075+; (parallel [(const_int 0)])))]
16076+;
16077+; "operands[2] = gen_rtx_REG(V2HImode, REGNO(operands[0]));"
16078+; )
16079+
16080+
16081+;(define_peephole2
16082+; [(match_scratch:V2HI 5 "r")
16083+; (set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "")
16084+; (match_operand:HI 1 "immediate_operand" "")))
16085+; (match_operand:HI 2 "register_operand" "r"))
16086+; (set (mem:HI (plus:SI (match_dup 0)
16087+; (match_operand:HI 3 "immediate_operand" "")))
16088+; (match_operand:HI 4 "register_operand" "r"))]
16089+; "(GET_CODE(operands[1]) == CONST_INT) && (GET_CODE(operands[3]) == CONST_INT)
16090+; && (INTVAL(operands[3]) == (INTVAL(operands[1]) + 2))"
16091+;
16092+; [(set (match_dup 5)
16093+; (vec_concat:V2HI
16094+; (match_dup 2)
16095+; (match_dup 4)))
16096+; (set (mem:V2HI (plus:SI (match_dup 0) (match_dup 1)))
16097+; (match_dup 5))]
16098+; ""
16099+; )
16100+;
16101+
16102+;(define_insn "sthh_w"
16103+; [(set (match_operand:V2HI 0 "avr32_sthh_w_memory_operand" "m")
16104+; (vec_concat:V2HI
16105+; (vec_select:HI (match_operand:V2HI 1 "register_operand" "r")
16106+; (parallel [(match_operand 3 "immediate_operand" "i")]))
16107+; (vec_select:HI (match_operand:V2HI 2 "register_operand" "r")
16108+; (parallel [(match_operand 4 "immediate_operand" "i")]))))]
16109+; "MEM_ALIGN(operands[0]) >= 32"
16110+; "sthh.w\t%0, %1:%h3, %2:%h4"
16111+; [(set_attr "length" "4")
16112+; (set_attr "type" "store")])
16113+;
16114+;(define_peephole2
16115+; [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "")
16116+; (match_operand:HI 1 "immediate_operand" "")))
16117+; (match_operand:HI 2 "register_operand" "r"))
16118+; (set (mem:HI (plus:SI (match_dup 0)
16119+; (match_operand:HI 3 "avr32_sthh_operand" "")))
16120+; (match_operand:HI 4 "register_operand" "r"))]
16121+; "(GET_CODE(operands[1]) == CONST_INT) && (GET_CODE(operands[3]) == CONST_INT)
16122+; && (INTVAL(operands[3]) == (INTVAL(operands[1]) - 2))"
16123+;
16124+; [(paralell [(set (mem:HI (plus:SI (match_dup 0)
16125+; (match_dup 3)))
16126+; (match_dup 4))
16127+; (set (mem:HI (plus:SI (match_dup 0)
16128+; (plus:SI (match_dup 3) (const_int 2))))
16129+; (match_dup 2))])]
16130+; ""
16131+; )
16132+
16133+
16134+;; Load the SIMD description
16135+(include "simd.md")
16136+
16137+;; Load the FP coprocessor patterns
16138+(include "fpcp.md")
16139diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/avr32-modes.def gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32-modes.def
16140--- gcc-4.0.2/gcc/config/avr32/avr32-modes.def 1970-01-01 01:00:00.000000000 +0100
16141+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32-modes.def 2005-08-19 14:17:15.000000000 +0200
16142@@ -0,0 +1 @@
16143+VECTOR_MODES (INT, 4); /* V4QI V2HI */
16144diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/avr32-protos.h gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32-protos.h
16145--- gcc-4.0.2/gcc/config/avr32/avr32-protos.h 1970-01-01 01:00:00.000000000 +0100
16146+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/avr32-protos.h 2006-10-10 13:03:42.000000000 +0200
16147@@ -0,0 +1,175 @@
16148+/*
16149+ Prototypes for exported functions defined in avr32.c
16150+ Copyright 2003-2006 Atmel Corporation.
16151+
16152+ Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
16153+ Initial porting by Anders Ådland.
16154+
16155+ This file is part of GCC.
16156+
16157+ This program is free software; you can redistribute it and/or modify
16158+ it under the terms of the GNU General Public License as published by
16159+ the Free Software Foundation; either version 2 of the License, or
16160+ (at your option) any later version.
16161+
16162+ This program is distributed in the hope that it will be useful,
16163+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16164+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16165+ GNU General Public License for more details.
16166+
16167+ You should have received a copy of the GNU General Public License
16168+ along with this program; if not, write to the Free Software
16169+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16170+
16171+
16172+#ifndef AVR32_PROTOS_H
16173+#define AVR32_PROTOS_H
16174+
16175+extern const int swap_reg[];
16176+
16177+extern int avr32_valid_macmac_bypass (rtx, rtx);
16178+extern int avr32_valid_mulmac_bypass (rtx, rtx);
16179+
16180+extern int avr32_decode_lcomm_symbol_offset (rtx, int *);
16181+extern void avr32_encode_lcomm_symbol_offset (tree, char *, int);
16182+
16183+extern const char *avr32_strip_name_encoding (const char *);
16184+
16185+extern rtx avr32_get_note_reg_equiv (rtx insn);
16186+
16187+extern int avr32_use_return_insn (int iscond);
16188+
16189+extern void avr32_make_reglist16 (int reglist16_vect, char *reglist16_string);
16190+
16191+extern void avr32_make_reglist8 (int reglist8_vect, char *reglist8_string);
16192+extern void avr32_make_fp_reglist_w (int reglist_mask, char *reglist_string);
16193+extern void avr32_make_fp_reglist_d (int reglist_mask, char *reglist_string);
16194+
16195+extern void avr32_output_return_instruction (int single_ret_inst,
16196+ int iscond, rtx cond,
16197+ rtx r12_imm);
16198+extern void avr32_expand_prologue (void);
16199+extern void avr32_set_return_address (rtx source);
16200+
16201+extern int avr32_hard_regno_mode_ok (int regno, enum machine_mode mode);
16202+extern int avr32_extra_constraint_s (rtx value, const int strict);
16203+extern int avr32_eh_return_data_regno (const int n);
16204+extern int avr32_initial_elimination_offset (const int from, const int to);
16205+extern rtx avr32_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode,
16206+ tree type, int named);
16207+extern void avr32_init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype,
16208+ rtx libname, tree fndecl);
16209+extern void avr32_function_arg_advance (CUMULATIVE_ARGS * cum,
16210+ enum machine_mode mode,
16211+ tree type, int named);
16212+#ifdef ARGS_SIZE_RTX
16213+/* expr.h defines ARGS_SIZE_RTX and `enum direction'. */
16214+extern enum direction avr32_function_arg_padding (enum machine_mode mode,
16215+ tree type);
16216+#endif /* ARGS_SIZE_RTX */
16217+extern rtx avr32_function_value (tree valtype, tree func);
16218+extern rtx avr32_libcall_value (enum machine_mode mode);
16219+extern int avr32_sched_use_dfa_pipeline_interface (void);
16220+extern bool avr32_return_in_memory (tree type, tree fntype);
16221+extern void avr32_regs_to_save (char *operand);
16222+extern void avr32_target_asm_function_prologue (FILE * file,
16223+ HOST_WIDE_INT size);
16224+extern void avr32_target_asm_function_epilogue (FILE * file,
16225+ HOST_WIDE_INT size);
16226+extern void avr32_trampoline_template (FILE * file);
16227+extern void avr32_initialize_trampoline (rtx addr, rtx fnaddr,
16228+ rtx static_chain);
16229+extern int avr32_legitimate_address (enum machine_mode mode, rtx x,
16230+ int strict);
16231+extern int avr32_legitimate_constant_p (rtx x);
16232+
16233+extern int avr32_legitimate_pic_operand_p (rtx x);
16234+
16235+extern rtx avr32_find_symbol (rtx x);
16236+extern void avr32_select_section (rtx exp, int reloc, int align);
16237+extern void avr32_encode_section_info (tree decl, rtx rtl, int first);
16238+extern void avr32_asm_file_end (FILE * stream);
16239+extern void avr32_asm_output_ascii (FILE * stream, char *ptr, int len);
16240+extern void avr32_asm_output_common (FILE * stream, const char *name,
16241+ int size, int rounded);
16242+extern void avr32_asm_output_label (FILE * stream, const char *name);
16243+extern void avr32_asm_declare_object_name (FILE * stream, char *name,
16244+ tree decl);
16245+extern void avr32_asm_globalize_label (FILE * stream, const char *name);
16246+extern void avr32_asm_weaken_label (FILE * stream, const char *name);
16247+extern void avr32_asm_output_external (FILE * stream, tree decl,
16248+ const char *name);
16249+extern void avr32_asm_output_external_libcall (FILE * stream, rtx symref);
16250+extern void avr32_asm_output_labelref (FILE * stream, const char *name);
16251+extern void avr32_notice_update_cc (rtx exp, rtx insn);
16252+extern void avr32_print_operand (FILE * stream, rtx x, int code);
16253+extern void avr32_print_operand_address (FILE * stream, rtx x);
16254+
16255+extern int avr32_symbol (rtx x);
16256+
16257+extern void avr32_select_rtx_section (enum machine_mode mode, rtx x,
16258+ unsigned HOST_WIDE_INT align);
16259+
16260+extern int avr32_load_multiple_operation (rtx op, enum machine_mode mode);
16261+extern int avr32_store_multiple_operation (rtx op, enum machine_mode mode);
16262+
16263+extern int avr32_const_ok_for_constraint_p (HOST_WIDE_INT value, char c,
16264+ const char *str);
16265+
16266+extern bool avr32_cannot_force_const_mem (rtx x);
16267+
16268+extern void avr32_init_builtins (void);
16269+
16270+extern rtx avr32_expand_builtin (tree exp, rtx target, rtx subtarget,
16271+ enum machine_mode mode, int ignore);
16272+
16273+extern bool avr32_must_pass_in_stack (enum machine_mode mode, tree type);
16274+
16275+extern bool avr32_strict_argument_naming (CUMULATIVE_ARGS * ca);
16276+
16277+extern bool avr32_pass_by_reference (CUMULATIVE_ARGS * cum,
16278+ enum machine_mode mode,
16279+ tree type, bool named);
16280+
16281+extern rtx avr32_gen_load_multiple (rtx * regs, int count, rtx from,
16282+ int write_back, int in_struct_p,
16283+ int scalar_p);
16284+extern rtx avr32_gen_store_multiple (rtx * regs, int count, rtx to,
16285+ int in_struct_p, int scalar_p);
16286+extern int avr32_gen_movmemsi (rtx * operands);
16287+
16288+extern int avr32_rnd_operands (rtx add, rtx shift);
16289+extern int avr32_adjust_insn_length (rtx insn, int length);
16290+
16291+extern int symbol_mentioned_p (rtx x);
16292+extern int label_mentioned_p (rtx x);
16293+extern rtx legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg);
16294+extern int avr32_address_register_rtx_p (rtx x, int strict_p);
16295+extern int avr32_legitimate_index_p (enum machine_mode mode, rtx index,
16296+ int strict_p);
16297+
16298+extern int avr32_const_double_immediate (rtx value);
16299+extern void avr32_init_expanders (void);
16300+extern rtx avr32_return_addr (int count, rtx frame);
16301+extern bool avr32_got_mentioned_p (rtx addr);
16302+
16303+extern void avr32_final_prescan_insn (rtx insn, rtx * opvec, int noperands);
16304+
16305+extern int avr32_expand_movcc (enum machine_mode mode, rtx operands[]);
16306+extern int avr32_expand_addcc (enum machine_mode mode, rtx operands[]);
16307+#ifdef RTX_CODE
16308+extern int avr32_expand_scc (RTX_CODE cond, rtx * operands);
16309+#endif
16310+
16311+extern int avr32_store_bypass (rtx insn_out, rtx insn_in);
16312+extern int avr32_mul_waw_bypass (rtx insn_out, rtx insn_in);
16313+extern int avr32_valid_load_double_bypass (rtx insn_out, rtx insn_in);
16314+extern int avr32_valid_load_quad_bypass (rtx insn_out, rtx insn_in);
16315+extern rtx avr32_output_cmp (rtx cond, enum machine_mode mode,
16316+ rtx op0, rtx op1);
16317+
16318+rtx get_next_insn_cond (rtx cur_insn);
16319+int set_next_insn_cond (rtx cur_insn, rtx cond);
16320+void avr32_override_options (void);
16321+
16322+#endif /* AVR32_PROTOS_H */
16323diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/crti.asm gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/crti.asm
16324--- gcc-4.0.2/gcc/config/avr32/crti.asm 1970-01-01 01:00:00.000000000 +0100
16325+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/crti.asm 2006-10-10 12:36:34.000000000 +0200
16326@@ -0,0 +1,64 @@
16327+/*
16328+ Init/fini stuff for AVR32.
16329+ Copyright 2003-2006 Atmel Corporation.
16330+
16331+ Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
16332+
16333+ This file is part of GCC.
16334+
16335+ This program is free software; you can redistribute it and/or modify
16336+ it under the terms of the GNU General Public License as published by
16337+ the Free Software Foundation; either version 2 of the License, or
16338+ (at your option) any later version.
16339+
16340+ This program is distributed in the hope that it will be useful,
16341+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16342+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16343+ GNU General Public License for more details.
16344+
16345+ You should have received a copy of the GNU General Public License
16346+ along with this program; if not, write to the Free Software
16347+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16348+
16349+
16350+/* The code in sections .init and .fini is supposed to be a single
16351+ regular function. The function in .init is called directly from
16352+ start in crt1.asm. The function in .fini is atexit()ed in crt1.asm
16353+ too.
16354+
16355+ crti.asm contributes the prologue of a function to these sections,
16356+ and crtn.asm comes up the epilogue. STARTFILE_SPEC should list
16357+ crti.o before any other object files that might add code to .init
16358+ or .fini sections, and ENDFILE_SPEC should list crtn.o after any
16359+ such object files. */
16360+
16361+ .file "crti.asm"
16362+
16363+ .section ".init"
16364+/* Just load the GOT */
16365+ .align 2
16366+ .global _init
16367+_init:
16368+ stm --sp, r6, lr
16369+ lddpc r6, 1f
16370+0:
16371+ rsub r6, pc
16372+ rjmp 2f
16373+ .align 2
16374+1: .long 0b - _GLOBAL_OFFSET_TABLE_
16375+2:
16376+
16377+ .section ".fini"
16378+/* Just load the GOT */
16379+ .align 2
16380+ .global _fini
16381+_fini:
16382+ stm --sp, r6, lr
16383+ lddpc r6, 1f
16384+0:
16385+ rsub r6, pc
16386+ rjmp 2f
16387+ .align 2
16388+1: .long 0b - _GLOBAL_OFFSET_TABLE_
16389+2:
16390+
16391diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/crtn.asm gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/crtn.asm
16392--- gcc-4.0.2/gcc/config/avr32/crtn.asm 1970-01-01 01:00:00.000000000 +0100
16393+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/crtn.asm 2006-10-10 12:36:34.000000000 +0200
16394@@ -0,0 +1,44 @@
16395+/* Copyright (C) 2001 Free Software Foundation, Inc.
16396+ Written By Nick Clifton
16397+
16398+ This file is free software; you can redistribute it and/or modify it
16399+ under the terms of the GNU General Public License as published by the
16400+ Free Software Foundation; either version 2, or (at your option) any
16401+ later version.
16402+
16403+ In addition to the permissions in the GNU General Public License, the
16404+ Free Software Foundation gives you unlimited permission to link the
16405+ compiled version of this file with other programs, and to distribute
16406+ those programs without any restriction coming from the use of this
16407+ file. (The General Public License restrictions do apply in other
16408+ respects; for example, they cover modification of the file, and
16409+ distribution when not linked into another program.)
16410+
16411+ This file is distributed in the hope that it will be useful, but
16412+ WITHOUT ANY WARRANTY; without even the implied warranty of
16413+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16414+ General Public License for more details.
16415+
16416+ You should have received a copy of the GNU General Public License
16417+ along with this program; see the file COPYING. If not, write to
16418+ the Free Software Foundation, 59 Temple Place - Suite 330,
16419+ Boston, MA 02111-1307, USA.
16420+
16421+ As a special exception, if you link this library with files
16422+ compiled with GCC to produce an executable, this does not cause
16423+ the resulting executable to be covered by the GNU General Public License.
16424+ This exception does not however invalidate any other reasons why
16425+ the executable file might be covered by the GNU General Public License.
16426+*/
16427+
16428+
16429+
16430+
16431+ .file "crtn.asm"
16432+
16433+ .section ".init"
16434+ ldm sp++, r6, pc
16435+
16436+ .section ".fini"
16437+ ldm sp++, r6, pc
16438+
16439diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/fpcp.md gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/fpcp.md
16440--- gcc-4.0.2/gcc/config/avr32/fpcp.md 1970-01-01 01:00:00.000000000 +0100
16441+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/fpcp.md 2006-10-10 12:36:34.000000000 +0200
16442@@ -0,0 +1,551 @@
16443+;; AVR32 machine description file for Floating-Point instructions.
16444+;; Copyright 2003-2006 Atmel Corporation.
16445+;;
16446+;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
16447+;;
16448+;; This file is part of GCC.
16449+;;
16450+;; This program is free software; you can redistribute it and/or modify
16451+;; it under the terms of the GNU General Public License as published by
16452+;; the Free Software Foundation; either version 2 of the License, or
16453+;; (at your option) any later version.
16454+;;
16455+;; This program is distributed in the hope that it will be useful,
16456+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16457+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16458+;; GNU General Public License for more details.
16459+;;
16460+;; You should have received a copy of the GNU General Public License
16461+;; along with this program; if not, write to the Free Software
16462+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16463+
16464+;; -*- Mode: Scheme -*-
16465+
16466+;;******************************************************************************
16467+;; Automaton pipeline description for floating-point coprocessor insns
16468+;;******************************************************************************
16469+(define_cpu_unit "fid,fm1,fm2,fm3,fm4,fwb,fcmp,fcast" "avr32_ap")
16470+
16471+(define_insn_reservation "fmv_op" 1
16472+ (and (eq_attr "pipeline" "ap")
16473+ (eq_attr "type" "fmv"))
16474+ "is,da,d,fid,fwb")
16475+
16476+(define_insn_reservation "fmul_op" 5
16477+ (and (eq_attr "pipeline" "ap")
16478+ (eq_attr "type" "fmul"))
16479+ "is,da,d,fid,fm1,fm2,fm3,fm4,fwb")
16480+
16481+(define_insn_reservation "fcmps_op" 1
16482+ (and (eq_attr "pipeline" "ap")
16483+ (eq_attr "type" "fcmps"))
16484+ "is,da,d,fid,fcmp")
16485+
16486+(define_insn_reservation "fcmpd_op" 2
16487+ (and (eq_attr "pipeline" "ap")
16488+ (eq_attr "type" "fcmpd"))
16489+ "is,da,d,fid*2,fcmp")
16490+
16491+(define_insn_reservation "fcast_op" 3
16492+ (and (eq_attr "pipeline" "ap")
16493+ (eq_attr "type" "fcast"))
16494+ "is,da,d,fid,fcmp,fcast,fwb")
16495+
16496+(define_insn_reservation "fmvcpu_op" 2
16497+ (and (eq_attr "pipeline" "ap")
16498+ (eq_attr "type" "fmvcpu"))
16499+ "is,da,d")
16500+
16501+(define_insn_reservation "fldd_op" 1
16502+ (and (eq_attr "pipeline" "ap")
16503+ (eq_attr "type" "fldd"))
16504+ "is,da,d,fwb")
16505+
16506+(define_insn_reservation "flds_op" 1
16507+ (and (eq_attr "pipeline" "ap")
16508+ (eq_attr "type" "flds"))
16509+ "is,da,d,fwb")
16510+
16511+(define_insn_reservation "fsts_op" 0
16512+ (and (eq_attr "pipeline" "ap")
16513+ (eq_attr "type" "fsts"))
16514+ "is,da*2,d")
16515+
16516+(define_insn_reservation "fstd_op" 0
16517+ (and (eq_attr "pipeline" "ap")
16518+ (eq_attr "type" "fstd"))
16519+ "is,da*2,d")
16520+
16521+
16522+(define_insn "*movsf_fpcp"
16523+ [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,r,f,m,r,r,r,m")
16524+ (match_operand:SF 1 "general_operand" " f,r,f,m,f,r,G,m,r"))]
16525+ "TARGET_HARD_FLOAT"
16526+ "@
16527+ fmov.s\t%0, %1
16528+ fmov.s\t%0, %1
16529+ fmov.s\t%0, %1
16530+ fld.s\t%0, %1
16531+ fst.s\t%0, %1
16532+ mov\t%0, %1
16533+ mov\t%0, %1
16534+ ld.w\t%0, %1
16535+ st.w\t%0, %1"
16536+ [(set_attr "length" "4,4,4,4,4,2,4,4,4")
16537+ (set_attr "type" "fmv,flds,fmvcpu,flds,fsts,alu,alu,load,store")])
16538+
16539+(define_insn_and_split "*movdf_fpcp"
16540+ [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,r,f,m,r,r,m")
16541+ (match_operand:DF 1 "general_operand" " f,r,f,m,f,r,m,r"))]
16542+ "TARGET_HARD_FLOAT"
16543+ "@
16544+ fmov.d\t%0, %1
16545+ fmov.d\t%0, %1
16546+ fmov.d\t%0, %1
16547+ fld.d\t%0, %1
16548+ fst.d\t%0, %1
16549+ mov\t%0, %1\;mov\t%m0, %m1
16550+ ld.d\t%0, %1
16551+ st.d\t%0, %1"
16552+
16553+ "TARGET_HARD_FLOAT
16554+ && reload_completed
16555+ && (REG_P(operands[0]) && (REGNO_REG_CLASS(REGNO(operands[0])) == GENERAL_REGS))
16556+ && (REG_P(operands[1]) && (REGNO_REG_CLASS(REGNO(operands[1])) == GENERAL_REGS))"
16557+ [(set (match_dup 0) (match_dup 1))
16558+ (set (match_dup 2) (match_dup 3))]
16559+ "
16560+ {
16561+ operands[2] = gen_highpart (SImode, operands[0]);
16562+ operands[0] = gen_lowpart (SImode, operands[0]);
16563+ operands[3] = gen_highpart(SImode, operands[1]);
16564+ operands[1] = gen_lowpart(SImode, operands[1]);
16565+ }
16566+ "
16567+
16568+ [(set_attr "length" "4,4,4,4,4,4,4,4")
16569+ (set_attr "type" "fmv,fldd,fmvcpu,fldd,fstd,alu2,load2,store2")])
16570+
16571+
16572+(define_insn "mulsf3"
16573+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16574+ (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16575+ (match_operand:SF 2 "avr32_fp_register_operand" "f")))]
16576+ "TARGET_HARD_FLOAT"
16577+ "fmul.s\t%0, %1, %2"
16578+ [(set_attr "length" "4")
16579+ (set_attr "type" "fmul")])
16580+
16581+(define_insn "nmulsf3"
16582+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16583+ (neg:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16584+ (match_operand:SF 2 "avr32_fp_register_operand" "f"))))]
16585+ "TARGET_HARD_FLOAT"
16586+ "fnmul.s\t%0, %1, %2"
16587+ [(set_attr "length" "4")
16588+ (set_attr "type" "fmul")])
16589+
16590+(define_peephole2
16591+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "")
16592+ (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "")
16593+ (match_operand:SF 2 "avr32_fp_register_operand" "")))
16594+ (set (match_operand:SF 3 "avr32_fp_register_operand" "")
16595+ (neg:SF (match_dup 0)))]
16596+ "TARGET_HARD_FLOAT &&
16597+ (peep2_reg_dead_p(2, operands[0]) || (REGNO(operands[3]) == REGNO(operands[0])))"
16598+ [(set (match_dup 3)
16599+ (neg:SF (mult:SF (match_dup 1)
16600+ (match_dup 2))))]
16601+)
16602+
16603+
16604+(define_insn "macsf3"
16605+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16606+ (plus:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16607+ (match_operand:SF 2 "avr32_fp_register_operand" "f"))
16608+ (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
16609+ "TARGET_HARD_FLOAT"
16610+ "fmac.s\t%0, %1, %2"
16611+ [(set_attr "length" "4")
16612+ (set_attr "type" "fmul")])
16613+
16614+(define_insn "nmacsf3"
16615+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16616+ (plus:SF (neg:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16617+ (match_operand:SF 2 "avr32_fp_register_operand" "f")))
16618+ (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
16619+ "TARGET_HARD_FLOAT"
16620+ "fnmac.s\t%0, %1, %2"
16621+ [(set_attr "length" "4")
16622+ (set_attr "type" "fmul")])
16623+
16624+(define_peephole2
16625+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "")
16626+ (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "")
16627+ (match_operand:SF 2 "avr32_fp_register_operand" "")))
16628+ (set (match_operand:SF 3 "avr32_fp_register_operand" "")
16629+ (minus:SF
16630+ (match_dup 3)
16631+ (match_dup 0)))]
16632+ "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
16633+ [(set (match_dup 3)
16634+ (plus:SF (neg:SF (mult:SF (match_dup 1)
16635+ (match_dup 2)))
16636+ (match_dup 3)))]
16637+)
16638+
16639+
16640+(define_insn "msubacsf3"
16641+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16642+ (minus:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16643+ (match_operand:SF 2 "avr32_fp_register_operand" "f"))
16644+ (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
16645+ "TARGET_HARD_FLOAT"
16646+ "fmsc.s\t%0, %1, %2"
16647+ [(set_attr "length" "4")
16648+ (set_attr "type" "fmul")])
16649+
16650+(define_peephole2
16651+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "")
16652+ (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "")
16653+ (match_operand:SF 2 "avr32_fp_register_operand" "")))
16654+ (set (match_operand:SF 3 "avr32_fp_register_operand" "")
16655+ (minus:SF
16656+ (match_dup 0)
16657+ (match_dup 3)))]
16658+ "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
16659+ [(set (match_dup 3)
16660+ (minus:SF (mult:SF (match_dup 1)
16661+ (match_dup 2))
16662+ (match_dup 3)))]
16663+)
16664+
16665+(define_insn "nmsubacsf3"
16666+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16667+ (minus:SF (neg:SF (mult:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16668+ (match_operand:SF 2 "avr32_fp_register_operand" "f")))
16669+ (match_operand:SF 3 "avr32_fp_register_operand" "0")))]
16670+ "TARGET_HARD_FLOAT"
16671+ "fnmsc.s\t%0, %1, %2"
16672+ [(set_attr "length" "4")
16673+ (set_attr "type" "fmul")])
16674+
16675+
16676+
16677+(define_insn "addsf3"
16678+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16679+ (plus:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16680+ (match_operand:SF 2 "avr32_fp_register_operand" "f")))]
16681+ "TARGET_HARD_FLOAT"
16682+ "fadd.s\t%0, %1, %2"
16683+ [(set_attr "length" "4")
16684+ (set_attr "type" "fmul")])
16685+
16686+(define_insn "subsf3"
16687+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16688+ (minus:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")
16689+ (match_operand:SF 2 "avr32_fp_register_operand" "f")))]
16690+ "TARGET_HARD_FLOAT"
16691+ "fsub.s\t%0, %1, %2"
16692+ [(set_attr "length" "4")
16693+ (set_attr "type" "fmul")])
16694+
16695+
16696+(define_insn "negsf2"
16697+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16698+ (neg:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
16699+ "TARGET_HARD_FLOAT"
16700+ "fneg.s\t%0, %1"
16701+ [(set_attr "length" "4")
16702+ (set_attr "type" "fmv")])
16703+
16704+(define_insn "abssf2"
16705+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16706+ (abs:SF (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
16707+ "TARGET_HARD_FLOAT"
16708+ "fabs.s\t%0, %1"
16709+ [(set_attr "length" "4")
16710+ (set_attr "type" "fmv")])
16711+
16712+(define_insn "truncdfsf2"
16713+ [(set (match_operand:SF 0 "avr32_fp_register_operand" "=f")
16714+ (float_truncate:SF
16715+ (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
16716+ "TARGET_HARD_FLOAT"
16717+ "fcastd.s\t%0, %1"
16718+ [(set_attr "length" "4")
16719+ (set_attr "type" "fcast")])
16720+
16721+(define_insn "extendsfdf2"
16722+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16723+ (float_extend:DF
16724+ (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
16725+ "TARGET_HARD_FLOAT"
16726+ "fcasts.d\t%0, %1"
16727+ [(set_attr "length" "4")
16728+ (set_attr "type" "fcast")])
16729+
16730+(define_insn "muldf3"
16731+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16732+ (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16733+ (match_operand:DF 2 "avr32_fp_register_operand" "f")))]
16734+ "TARGET_HARD_FLOAT"
16735+ "fmul.d\t%0, %1, %2"
16736+ [(set_attr "length" "4")
16737+ (set_attr "type" "fmul")])
16738+
16739+(define_insn "nmuldf3"
16740+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16741+ (neg:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16742+ (match_operand:DF 2 "avr32_fp_register_operand" "f"))))]
16743+ "TARGET_HARD_FLOAT"
16744+ "fnmul.d\t%0, %1, %2"
16745+ [(set_attr "length" "4")
16746+ (set_attr "type" "fmul")])
16747+
16748+(define_peephole2
16749+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "")
16750+ (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "")
16751+ (match_operand:DF 2 "avr32_fp_register_operand" "")))
16752+ (set (match_operand:DF 3 "avr32_fp_register_operand" "")
16753+ (neg:DF (match_dup 0)))]
16754+ "TARGET_HARD_FLOAT &&
16755+ (peep2_reg_dead_p(2, operands[0]) || (REGNO(operands[3]) == REGNO(operands[0])))"
16756+ [(set (match_dup 3)
16757+ (neg:DF (mult:DF (match_dup 1)
16758+ (match_dup 2))))]
16759+)
16760+
16761+(define_insn "macdf3"
16762+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16763+ (plus:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16764+ (match_operand:DF 2 "avr32_fp_register_operand" "f"))
16765+ (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
16766+ "TARGET_HARD_FLOAT"
16767+ "fmac.d\t%0, %1, %2"
16768+ [(set_attr "length" "4")
16769+ (set_attr "type" "fmul")])
16770+
16771+(define_insn "msubacdf3"
16772+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16773+ (minus:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16774+ (match_operand:DF 2 "avr32_fp_register_operand" "f"))
16775+ (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
16776+ "TARGET_HARD_FLOAT"
16777+ "fmsc.d\t%0, %1, %2"
16778+ [(set_attr "length" "4")
16779+ (set_attr "type" "fmul")])
16780+
16781+(define_peephole2
16782+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "")
16783+ (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "")
16784+ (match_operand:DF 2 "avr32_fp_register_operand" "")))
16785+ (set (match_operand:DF 3 "avr32_fp_register_operand" "")
16786+ (minus:DF
16787+ (match_dup 0)
16788+ (match_dup 3)))]
16789+ "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
16790+ [(set (match_dup 3)
16791+ (minus:DF (mult:DF (match_dup 1)
16792+ (match_dup 2))
16793+ (match_dup 3)))]
16794+ )
16795+
16796+(define_insn "nmsubacdf3"
16797+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16798+ (minus:DF (neg:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16799+ (match_operand:DF 2 "avr32_fp_register_operand" "f")))
16800+ (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
16801+ "TARGET_HARD_FLOAT"
16802+ "fnmsc.d\t%0, %1, %2"
16803+ [(set_attr "length" "4")
16804+ (set_attr "type" "fmul")])
16805+
16806+(define_insn "nmacdf3"
16807+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16808+ (plus:DF (neg:DF (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16809+ (match_operand:DF 2 "avr32_fp_register_operand" "f")))
16810+ (match_operand:DF 3 "avr32_fp_register_operand" "0")))]
16811+ "TARGET_HARD_FLOAT"
16812+ "fnmac.d\t%0, %1, %2"
16813+ [(set_attr "length" "4")
16814+ (set_attr "type" "fmul")])
16815+
16816+(define_peephole2
16817+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "")
16818+ (mult:DF (match_operand:DF 1 "avr32_fp_register_operand" "")
16819+ (match_operand:DF 2 "avr32_fp_register_operand" "")))
16820+ (set (match_operand:DF 3 "avr32_fp_register_operand" "")
16821+ (minus:DF
16822+ (match_dup 3)
16823+ (match_dup 0)))]
16824+ "TARGET_HARD_FLOAT && peep2_reg_dead_p(2, operands[0])"
16825+ [(set (match_dup 3)
16826+ (plus:DF (neg:DF (mult:DF (match_dup 1)
16827+ (match_dup 2)))
16828+ (match_dup 3)))]
16829+)
16830+
16831+(define_insn "adddf3"
16832+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16833+ (plus:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16834+ (match_operand:DF 2 "avr32_fp_register_operand" "f")))]
16835+ "TARGET_HARD_FLOAT"
16836+ "fadd.d\t%0, %1, %2"
16837+ [(set_attr "length" "4")
16838+ (set_attr "type" "fmul")])
16839+
16840+(define_insn "subdf3"
16841+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16842+ (minus:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")
16843+ (match_operand:DF 2 "avr32_fp_register_operand" "f")))]
16844+ "TARGET_HARD_FLOAT"
16845+ "fsub.d\t%0, %1, %2"
16846+ [(set_attr "length" "4")
16847+ (set_attr "type" "fmul")])
16848+
16849+(define_insn "negdf2"
16850+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16851+ (neg:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
16852+ "TARGET_HARD_FLOAT"
16853+ "fneg.d\t%0, %1"
16854+ [(set_attr "length" "4")
16855+ (set_attr "type" "fmv")])
16856+
16857+(define_insn "absdf2"
16858+ [(set (match_operand:DF 0 "avr32_fp_register_operand" "=f")
16859+ (abs:DF (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
16860+ "TARGET_HARD_FLOAT"
16861+ "fabs.d\t%0, %1"
16862+ [(set_attr "length" "4")
16863+ (set_attr "type" "fmv")])
16864+
16865+
16866+(define_expand "cmpdf"
16867+ [(set (cc0)
16868+ (compare:DF
16869+ (match_operand:DF 0 "general_operand" "")
16870+ (match_operand:DF 1 "general_operand" "")))]
16871+ "TARGET_HARD_FLOAT"
16872+ "{
16873+ rtx tmpreg;
16874+ if ( !REG_P(operands[0]) )
16875+ operands[0] = force_reg(DFmode, operands[0]);
16876+
16877+ if ( !REG_P(operands[1]) )
16878+ operands[1] = force_reg(DFmode, operands[1]);
16879+
16880+ avr32_compare_op0 = operands[0];
16881+ avr32_compare_op1 = operands[1];
16882+
16883+ emit_insn(gen_cmpdf_internal(operands[0], operands[1]));
16884+
16885+ tmpreg = gen_reg_rtx(SImode);
16886+ emit_insn(gen_fpcc_to_reg(tmpreg));
16887+ emit_insn(gen_reg_to_cc(tmpreg));
16888+
16889+ DONE;
16890+ }"
16891+)
16892+
16893+(define_insn "cmpdf_internal"
16894+ [(set (reg:CC FPCC_REGNUM)
16895+ (compare:CC
16896+ (match_operand:DF 0 "avr32_fp_register_operand" "f")
16897+ (match_operand:DF 1 "avr32_fp_register_operand" "f")))]
16898+ "TARGET_HARD_FLOAT"
16899+ {
16900+ if (!rtx_equal_p(cc_prev_status.mdep.fpvalue, SET_SRC(PATTERN (insn))) )
16901+ return "fcmp.d\t%0, %1";
16902+ return "";
16903+ }
16904+ [(set_attr "length" "4")
16905+ (set_attr "type" "fcmpd")
16906+ (set_attr "cc" "fpcompare")])
16907+
16908+(define_expand "cmpsf"
16909+ [(set (cc0)
16910+ (compare:SF
16911+ (match_operand:SF 0 "general_operand" "")
16912+ (match_operand:SF 1 "general_operand" "")))]
16913+ "TARGET_HARD_FLOAT"
16914+ "{
16915+ rtx tmpreg;
16916+ if ( !REG_P(operands[0]) )
16917+ operands[0] = force_reg(SFmode, operands[0]);
16918+
16919+ if ( !REG_P(operands[1]) )
16920+ operands[1] = force_reg(SFmode, operands[1]);
16921+
16922+ avr32_compare_op0 = operands[0];
16923+ avr32_compare_op1 = operands[1];
16924+
16925+ emit_insn(gen_cmpsf_internal(operands[0], operands[1]));
16926+
16927+ tmpreg = gen_reg_rtx(SImode);
16928+ emit_insn(gen_fpcc_to_reg(tmpreg));
16929+ emit_insn(gen_reg_to_cc(tmpreg));
16930+
16931+ DONE;
16932+ }"
16933+)
16934+
16935+(define_insn "cmpsf_internal"
16936+ [(set (reg:CC FPCC_REGNUM)
16937+ (compare:CC
16938+ (match_operand:SF 0 "avr32_fp_register_operand" "f")
16939+ (match_operand:SF 1 "avr32_fp_register_operand" "f")))]
16940+ "TARGET_HARD_FLOAT"
16941+ {
16942+ if (!rtx_equal_p(cc_prev_status.mdep.fpvalue, SET_SRC(PATTERN (insn))) )
16943+ return "fcmp.s\t%0, %1";
16944+ return "";
16945+ }
16946+ [(set_attr "length" "4")
16947+ (set_attr "type" "fcmps")
16948+ (set_attr "cc" "fpcompare")])
16949+
16950+(define_insn "fpcc_to_reg"
16951+ [(set (match_operand:SI 0 "register_operand" "=r")
16952+ (unspec:SI [(reg:CC FPCC_REGNUM)]
16953+ UNSPEC_FPCC_TO_REG))]
16954+ "TARGET_HARD_FLOAT"
16955+ "fmov.s\t%0, fsr"
16956+ [(set_attr "length" "4")
16957+ (set_attr "type" "fmvcpu")])
16958+
16959+(define_insn "reg_to_cc"
16960+ [(set (cc0)
16961+ (unspec:SI [(match_operand:SI 0 "register_operand" "r")]
16962+ UNSPEC_REG_TO_CC))]
16963+ "TARGET_HARD_FLOAT"
16964+ "musfr\t%0"
16965+ [(set_attr "length" "2")
16966+ (set_attr "type" "alu")
16967+ (set_attr "cc" "from_fpcc")])
16968+
16969+(define_insn "stm_fp"
16970+ [(unspec [(match_operand 0 "register_operand" "r")
16971+ (match_operand 1 "const_int_operand" "")
16972+ (match_operand 2 "const_int_operand" "")]
16973+ UNSPEC_STMFP)]
16974+ "TARGET_HARD_FLOAT"
16975+ {
16976+ int cop_reglist = INTVAL(operands[1]);
16977+
16978+ if (INTVAL(operands[2]) != 0)
16979+ return "stcm.w\tcp0, --%0, %C1";
16980+ else
16981+ return "stcm.w\tcp0, %0, %C1";
16982+
16983+ if ( cop_reglist & ~0xff ){
16984+ operands[1] = GEN_INT(cop_reglist & ~0xff);
16985+ if (INTVAL(operands[2]) != 0)
16986+ return "stcm.d\tcp0, --%0, %D1";
16987+ else
16988+ return "stcm.d\tcp0, %0, %D1";
16989+ }
16990+ }
16991+ [(set_attr "type" "fstm")
16992+ (set_attr "length" "4")
16993+ (set_attr "cc" "none")])
16994diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/lib1funcs.S gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/lib1funcs.S
16995--- gcc-4.0.2/gcc/config/avr32/lib1funcs.S 1970-01-01 01:00:00.000000000 +0100
16996+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/lib1funcs.S 2006-10-10 12:36:34.000000000 +0200
16997@@ -0,0 +1,1678 @@
16998+/*#define __IEEE_LARGE_FLOATS__*/
16999+
17000+/* Adjust the unpacked double number if it is a subnormal number.
17001+ The exponent and mantissa pair are stored
17002+ in [mant_hi,mant_lo] and [exp]. A register with the correct sign bit in
17003+ the MSB is passed in [sign]. Needs two scratch
17004+ registers [scratch1] and [scratch2]. An adjusted and packed double float
17005+ is present in [mant_hi,mant_lo] after macro has executed */
17006+.macro adjust_subnormal_df exp, mant_lo, mant_hi, sign, scratch1, scratch2
17007+ /* We have an exponent which is <=0 indicating a subnormal number
17008+ As it should be stored as if the exponent was 1 (although the
17009+ exponent field is all zeros to indicate a subnormal number)
17010+ we have to shift down the mantissa to its correct position. */
17011+ neg \exp
17012+ sub \exp,-1 /* amount to shift down */
17013+ cp.w \exp,54
17014+ brlo 50f /* if more than 53 shift steps, the
17015+ entire mantissa will disappear
17016+ without any rounding to occur */
17017+ mov \mant_hi, 0
17018+ mov \mant_lo, 0
17019+ rjmp 52f
17020+50:
17021+ sub \exp,-10 /* do the shift to position the
17022+ mantissa at the same time
17023+ note! this does not include the
17024+ final 1 step shift to add the sign */
17025+
17026+ /* when shifting, save all shifted out bits in [scratch2]. we may need to
17027+ look at them to make correct rounding. */
17028+
17029+ rsub \scratch1,\exp,32 /* get inverted shift count */
17030+ cp.w \exp,32 /* handle shifts >= 32 separately */
17031+ brhs 51f
17032+
17033+ /* small (<32) shift amount, both words are part of the shift */
17034+ lsl \scratch2,\mant_lo,\scratch1 /* save bits to shift out from lsw*/
17035+ lsl \scratch1,\mant_hi,\scratch1 /* get bits from msw destined for lsw*/
17036+ lsr \mant_lo,\mant_lo,\exp /* shift down lsw */
17037+ lsr \mant_hi,\mant_hi,\exp /* shift down msw */
17038+ or \mant_hi,\scratch1 /* add bits from msw with prepared lsw */
17039+ rjmp 50f
17040+
17041+ /* large (>=32) shift amount, only lsw will have bits left after shift.
17042+ note that shift operations will use ((shift count) mod 32) so
17043+ we do not need to subtract 32 from shift count. */
17044+51:
17045+ lsl \scratch2,\mant_hi,\scratch1 /* save bits to shift out from msw */
17046+ or \scratch2,\mant_lo /* also save all bits from lsw */
17047+ mov \mant_lo,\mant_hi /* msw -> lsw (i.e. "shift 32 first") */
17048+ mov \mant_hi,0 /* clear msw */
17049+ lsr \mant_lo,\mant_lo,\exp /* make rest of shift inside lsw */
17050+
17051+50:
17052+ /* result is almost ready to return, except that least significant bit
17053+ and the part we already shifted out may cause the result to be
17054+ rounded */
17055+ bld \mant_lo,0 /* get bit to be shifted out */
17056+ brcc 51f /* if bit was 0, no rounding */
17057+
17058+ /* msb of part to remove is 1, so rounding depends on rest of bits */
17059+ tst \scratch2,\scratch2 /* get shifted out tail */
17060+ brne 50f /* if rest > 0, do round */
17061+ bld \mant_lo,1 /* we have to look at lsb in result */
17062+ brcc 51f /* if lsb is 0, don't round */
17063+
17064+50:
17065+ /* subnormal result requires rounding
17066+ rounding may cause subnormal to become smallest normal number
17067+ luckily, smallest normal number has exactly the representation
17068+ we got by rippling a one bit up from mantissa into exponent field. */
17069+ sub \mant_lo,-1
17070+ subcc \mant_hi,-1
17071+
17072+51:
17073+ /* shift and return packed double with correct sign */
17074+ rol \sign
17075+ ror \mant_hi
17076+ ror \mant_lo
17077+52:
17078+.endm
17079+
17080+
17081+/* Adjust subnormal single float number with exponent [exp]
17082+ and mantissa [mant] and round. */
17083+.macro adjust_subnormal_sf sf, exp, mant, sign, scratch
17084+ /* subnormal number */
17085+ rsub \exp,\exp, 1 /* shift amount */
17086+ cp.w \exp, 25
17087+ movhs \mant, 0
17088+ brhs 90f /* Return zero */
17089+ rsub \scratch, \exp, 32
17090+ lsl \scratch, \mant,\scratch/* Check if there are any bits set
17091+ in the bits discarded in the mantissa */
17092+ srne \scratch /* If so set the lsb of the shifted mantissa */
17093+ lsr \mant,\mant,\exp /* Shift the mantissa */
17094+ or \mant, \scratch /* Round lsb if any bits were shifted out */
17095+ /* Rounding : For explaination, see round_sf. */
17096+ mov \scratch, 0x7f /* Set rounding constant */
17097+ bld \mant, 8
17098+ subeq \scratch, -1 /* For odd numbers use rounding constant 0x80 */
17099+ add \mant, \scratch /* Add rounding constant to mantissa */
17100+ /* We can't overflow because mantissa is at least shifted one position
17101+ to the right so the implicit bit is zero. We can however get the implicit
17102+ bit set after rounding which means that we have the lowest normal number
17103+ but this is ok since this bit has the same position as the LSB of the
17104+ exponent */
17105+ lsr \sf, \mant, 7
17106+ /* Rotate in sign */
17107+ lsl \sign, 1
17108+ ror \sf
17109+90:
17110+.endm
17111+
17112+
17113+/* Round the unpacked df number with exponent [exp] and
17114+ mantissa [mant_hi, mant_lo]. Uses scratch register
17115+ [scratch] */
17116+.macro round_df exp, mant_lo, mant_hi, scratch
17117+ mov \scratch, 0x3ff /* Rounding constant */
17118+ bld \mant_lo,11 /* Check if lsb in the final result is
17119+ set */
17120+ subeq \scratch, -1 /* Adjust rounding constant to 0x400
17121+ if rounding 0.5 upwards */
17122+ add \mant_lo, \scratch /* Round */
17123+ acr \mant_hi /* If overflowing we know that
17124+ we have all zeros in the bits not
17125+ scaled out so we can leave them
17126+ but we must increase the exponent with
17127+ two since we had an implicit bit
17128+ which is lost + the extra overflow bit */
17129+ subcs \exp, -2 /* Update exponent */
17130+.endm
17131+
17132+/* Round single float number stored in [mant] and [exp] */
17133+.macro round_sf exp, mant, scratch
17134+ /* Round:
17135+ For 0.5 we round to nearest even integer
17136+ for all other cases we round to nearest integer.
17137+ This means that if the digit left of the "point" (.)
17138+ is 1 we can add 0x80 to the mantissa since the
17139+ corner case 0x180 will round up to 0x200. If the
17140+ digit left of the "point" is 0 we will have to
17141+ add 0x7f since this will give 0xff and hence a
17142+ truncation/rounding downwards for the corner
17143+ case when the 9 lowest bits are 0x080 */
17144+ mov \scratch, 0x7f /* Set rounding constant */
17145+ /* Check if the mantissa is even or odd */
17146+ bld \mant, 8
17147+ subeq \scratch, -1 /* Rounding constant should be 0x80 */
17148+ add \mant, \scratch
17149+ subcs \exp, -2 /* Adjust exponent if we overflowed */
17150+.endm
17151+
17152+/* Scale mantissa [mant_hi, mant_lo] with amount [shift_count].
17153+ Uses scratch registers [scratch1] and [scratch2] */
17154+.macro scale_df shift_count, mant_lo, mant_hi, scratch1, scratch2
17155+ /* Scale [mant_hi, mant_lo] with shift_amount.
17156+ Must not forget the sticky bits we intend to shift out. */
17157+
17158+ rsub \scratch1,\shift_count,32/* get (32 - shift count)
17159+ (if shift count > 32 we get a
17160+ negative value, but that will
17161+ work as well in the code below.) */
17162+
17163+ cp.w \shift_count,32 /* handle shifts >= 32 separately */
17164+ brhs 70f
17165+
17166+ /* small (<32) shift amount, both words are part of the shift
17167+ first remember whether part that is lost contains any 1 bits ... */
17168+ lsl \scratch2,\mant_lo,\scratch1 /*shift away bits that are part of
17169+ final mantissa. only part that goes
17170+ to scratch2 are bits that will be lost */
17171+
17172+ /* ... and now to the actual shift */
17173+ lsl \scratch1,\mant_hi,\scratch1 /* get bits from msw destined for lsw*/
17174+ lsr \mant_lo,\mant_lo,\shift_count /* shift down lsw of mantissa */
17175+ lsr \mant_hi,\mant_hi,\shift_count /* shift down msw of mantissa */
17176+ or \mant_lo,\scratch1 /* combine these bits with prepared lsw*/
17177+ rjmp 71f
17178+
17179+ /* large (>=32) shift amount, only lsw will have bits left after shift.
17180+ note that shift operations will use ((shift count) mod 32) so
17181+ we do not need to subtract 32 from shift count. */
17182+70:
17183+ /* first remember whether part that is lost contains any 1 bits ... */
17184+ lsl \scratch2,\mant_hi,\scratch1 /* save all lost bits from msw */
17185+ or \scratch2,\mant_lo /* also save lost bits (all) from lsw
17186+ now scratch2<>0 if we lose any bits */
17187+
17188+ /* ... and now to the actual shift */
17189+ mov \mant_lo,\mant_hi /* msw -> lsw (i.e. "shift 32 first")*/
17190+ mov \mant_hi,0 /* clear msw */
17191+ lsr \mant_lo,\mant_lo,\shift_count /* make rest of shift inside lsw*/
17192+
17193+71:
17194+ cp.w \scratch2,0 /* if any '1' bit in part we lost ...*/
17195+ breq 70f
17196+
17197+ sbr \mant_lo,0 /* ... we need to set sticky bit*/
17198+70:
17199+.endm
17200+
17201+/* Unpack exponent and mantissa from the double number
17202+ stored in [df_hi,df_lo]. The exponent is stored in [exp]
17203+ while the mantissa is stored in [df_hi,df_lo]. */
17204+
17205+.macro unpack_df exp, df_lo, df_hi
17206+ lsr \exp, \df_hi,21 /* Extract exponent */
17207+ lsl \df_hi,10 /* Get mantissa */
17208+ or \df_hi,\df_hi,\df_lo>>21
17209+ lsl \df_lo,11
17210+
17211+ neg \exp /* Fix implicit bit */
17212+ bst \df_hi,31
17213+ subeq \exp,1
17214+ neg \exp /* negate back exponent */
17215+ .endm
17216+
17217+/* Unpack exponent and mantissa from the single float number
17218+ stored in [sf]. The exponent is stored in [exp]
17219+ while the mantissa is stored in [sf]. */
17220+.macro unpack_sf exp, sf
17221+ lsr \exp, \sf, 24
17222+ brne 80f
17223+ /* Fix subnormal number */
17224+ lsl \sf,7
17225+ clz \exp,\sf
17226+ lsl \sf,\sf,\exp
17227+ rsub \exp,\exp,1
17228+ rjmp 81f
17229+80:
17230+ lsl \sf,7
17231+ sbr \sf, 31 /*Implicit bit*/
17232+81:
17233+.endm
17234+
17235+
17236+
17237+/* Pack a single float number stored in [mant] and [exp]
17238+ into a single float number in [sf] */
17239+.macro pack_sf sf, exp, mant
17240+ bld \mant,31 /* implicit bit to z */
17241+ subne \exp,1 /* if subnormal (implicit bit 0)
17242+ adjust exponent to storage format */
17243+
17244+ lsr \sf, \mant, 7
17245+ bfins \sf, \exp, 24, 8
17246+.endm
17247+
17248+/* Pack exponent [exp] and mantissa [mant_hi, mant_lo]
17249+ into [df_hi, df_lo]. [df_hi] is shifted
17250+ one bit up so the sign bit can be shifted into it */
17251+
17252+.macro pack_df exp, mant_lo, mant_hi, df_lo, df_hi
17253+ bld \mant_hi,31 /* implicit bit to z */
17254+ subne \exp,1 /* if subnormal (implicit bit 0)
17255+ adjust exponent to storage format */
17256+
17257+ lsr \mant_lo,11 /* shift back lsw */
17258+ or \df_lo,\mant_lo,\mant_hi<<21 /* combine with low bits from msw */
17259+ lsl \mant_hi,1 /* get rid of implicit bit */
17260+ lsr \mant_hi,11 /* shift back msw except for one step*/
17261+ or \df_hi,\mant_hi,\exp<<21 /* combine msw with exponent */
17262+.endm
17263+
17264+/* Normalize single float number stored in [mant] and [exp]
17265+ using scratch register [scratch] */
17266+.macro normalize_sf exp, mant, scratch
17267+ /* Adjust exponent and mantissa */
17268+ clz \scratch, \mant
17269+ sub \exp, \scratch
17270+ lsl \mant, \mant, \scratch
17271+.endm
17272+
17273+/* Normalize the exponent and mantissa pair stored
17274+ in [mant_hi,mant_lo] and [exp]. Needs two scratch
17275+ registers [scratch1] and [scratch2]. */
17276+.macro normalize_df exp, mant_lo, mant_hi, scratch1, scratch2
17277+ clz \scratch1,\mant_hi /* Check if we have zeros in high bits */
17278+ breq 80f /* No need for scaling if no zeros in high bits */
17279+ cp.w \scratch1,32 /* Check for all zeros */
17280+ breq 81f
17281+
17282+ /* shift amount is smaller than 32, and involves both msw and lsw*/
17283+ rsub \scratch2,\scratch1,32 /* shift mantissa */
17284+ lsl \mant_hi,\mant_hi,\scratch1
17285+ lsr \scratch2,\mant_lo,\scratch2
17286+ or \mant_hi,\scratch2
17287+ lsl \mant_lo,\mant_lo,\scratch1
17288+ sub \exp,\scratch1 /* adjust exponent */
17289+ rjmp 80f /* Finished */
17290+81:
17291+ /* shift amount is greater than 32 */
17292+ clz \scratch1,\mant_lo /* shift mantissa */
17293+ sub \scratch1,-32
17294+ mov \mant_hi,\mant_lo
17295+ lsl \mant_hi,\mant_hi,\scratch1
17296+ mov \mant_lo,0
17297+ sub \exp,\scratch1 /* adjust exponent */
17298+80:
17299+.endm
17300+
17301+
17302+#ifdef L_avr32_f64_mul
17303+ .align 2
17304+ .global __avr32_f64_mul
17305+ .type __avr32_f64_mul,@function
17306+
17307+__avr32_f64_mul:
17308+ pushm r0-r3,r4-r7,lr
17309+
17310+ /* Unpack */
17311+ eor r12, r11, r9 /* Sign op1 ^ Sign op2 is MSB of r12*/
17312+ lsl r11,1 /* Unpack op1 */
17313+ lsl r9,1 /* Unpack op2 */
17314+
17315+ /* Sort operands op1 >= op2 */
17316+ lddpc r5, .Linf
17317+ cp.w r10,r8
17318+ cpc r11,r9
17319+ brhs 0f
17320+
17321+ mov r7,r11 /* swap operands if op2 was larger */
17322+ mov r6,r10
17323+ mov r11,r9
17324+ mov r10,r8
17325+ mov r9,r7
17326+ mov r8,r6
17327+
17328+0:
17329+ /* Check against infinity */
17330+ cp.w r11,r5
17331+ brlo 1f
17332+ /* infinity or nan */
17333+ /* we have to check low word as well as nan mantissa may be 0 in msw*/
17334+ cpc r10
17335+ /* we know that op1 is inf or nan. if z != 1 then we have nan.
17336+ in this case, also return nan. */
17337+ breq 0f
17338+ /* Return NaN */
17339+ mov r11, -1
17340+ rjmp __dfmul_return_op1
17341+0:
17342+
17343+ /* op1 is infinity. op2 is smaller or same so it cannot be nan.
17344+ it can be infinity or a (sub-)normal number.
17345+ we should return op1 (infinity) except when op2 is zero when
17346+ result should be nan. */
17347+ or r5,r9,r8
17348+ brne __dfmul_return_op1 /* op2 is not zero. return op1.*/
17349+ /* Return NaN */
17350+ mov r11, -1
17351+ rjmp __dfmul_return_op1
17352+
17353+1:
17354+ /* no operand is inf/nan, and operands have been arranged in order
17355+ with op1 >= op2, implying that if we have a zero, it is found in
17356+ op2. in this case, result should be zero (with sign from both ops). */
17357+
17358+ or r5,r9,r8 /* check the smaller value for zero */
17359+ brne 0f
17360+ mov r10, 0
17361+ mov r11, 0
17362+ rjmp __dfmul_return_op1 /* Early exit */
17363+0:
17364+
17365+ /* we have two "normal" (can be subnormal) nonzero numbers in r11:r10
17366+ and r9:r8. sign of result is already calculated in r12.
17367+ perform a normal multiplication. */
17368+
17369+ /* Unpack and normalize*/
17370+ unpack_df r7 /*exp*/, r10, r11 /* mantissa */
17371+ normalize_df r7 /*exp*/, r10, r11 /* mantissa */, r4, r5 /* scratch */
17372+
17373+
17374+ /* Unpack and normalize*/
17375+ unpack_df r6 /*exp*/, r8, r9 /* mantissa */
17376+ normalize_df r6 /*exp*/, r8, r9 /* mantissa */, r4, r5 /* scratch */
17377+
17378+ /* Multiply */
17379+
17380+ mulu.d r0,r10,r8
17381+ add lr,r7,r6 /* calculate new exponent after mul */
17382+ mulu.d r2,r11,r8
17383+ sub lr,(1023-1) /* remove exponent bias as we have
17384+ included bias from both op1 and op2
17385+ sub one less, or in other words
17386+ add one to exponent. see below why. */
17387+ mulu.d r6,r11,r9
17388+ add r2,r1
17389+ mulu.d r4,r10,r9
17390+
17391+
17392+ adc r6,r6,r3
17393+ acr r7
17394+
17395+ add r4,r2
17396+ adc r6,r6,r5
17397+ acr r7
17398+
17399+ // r7:r6 is now in range [0x4000...0000 - 0xffff...fffe]
17400+ // remaining bits in r0 and r4 are of no interest, except that we have
17401+ // to add a sticky bit to r10 in case we had a 1 bit in r4 or r0.
17402+
17403+ or r4,r0
17404+ movne r0, 1 /* If we have bits in r4 or r0 */
17405+ or r6,r0 /* set lsb of result to 1 */
17406+
17407+
17408+ // if msb is set, it was because multiplication gave an "overflow"
17409+ // of one bit so exponent should be incremented.
17410+ // we already did that above so we are done.
17411+ // if msb is *not* set it will be normalized and exponent will be
17412+ // decremented (which will compensate the one we added above).
17413+
17414+ normalize_df lr /*exp*/, r6, r7 /* mantissa */, r8, r9 /* scratch */
17415+
17416+ /* Check if a subnormal result was created */
17417+ cp.w lr, 0
17418+ brgt 0f
17419+
17420+ adjust_subnormal_df lr, r6, r7, r12, r8, r9
17421+ mov r10, r6
17422+ mov r11, r7
17423+ popm r0-r3,r4-r7, pc
17424+0:
17425+
17426+ /* Round result */
17427+ round_df lr /*exp*/, r6, r7 /* Mantissa */, r4 /*scratch*/
17428+ cp.w lr,0x7ff
17429+ brlt 0f
17430+ /*Return infinity */
17431+ lddpc r11, .Linf
17432+ mov r10, 0
17433+ rjmp __dfmul_return_op1
17434+
17435+0:
17436+
17437+ /* Pack */
17438+ pack_df lr /*exp*/, r6, r7 /* mantissa */, r10, r11 /* Output df number*/
17439+__dfmul_return_op1:
17440+ lsl r12,1 /* shift in sign bit */
17441+ ror r11
17442+
17443+ popm r0-r3,r4-r7, pc
17444+
17445+#endif
17446+
17447+
17448+#ifdef L_avr32_f64_addsub
17449+ .align 2
17450+ .global __avr32_f64_sub
17451+ .type __avr32_f64_sub,@function
17452+
17453+__avr32_f64_sub:
17454+ pushm r4-r7,lr
17455+
17456+ eor r12,r11,r9 // compare signs of operands
17457+ bld r12,31
17458+ brcc __dfsub // same sign => subtract
17459+
17460+ eorh r9,0x8000
17461+ rjmp __dfadd // different signs => op1 + (-op2)
17462+__dfsub:
17463+
17464+ lsl r11,1 // unpack op1 msw and get sign in c
17465+ or r4,r11,r10 // check if all bits zero
17466+ brne 1f
17467+
17468+ // op1 is zero, negate op2 and handle as add
17469+ eorh r9,0x8000
17470+ // op1 is +/-0, and is unpacked with sign in c. add to op2.
17471+ // also used by sub, but op2 has been negated in this case
17472+ ror r12 // save sign of op1 in msb of r12
17473+ lsl r9,1 // unpack msw and get sign of op2
17474+ or r4,r9,r8 // check all bits in op2
17475+ breq 0f
17476+
17477+ // if op2 != 0, then return op2 unchanged.
17478+ ror r9 // pack op2 msw again with sign from c
17479+ mov r11,r9
17480+ mov r10,r8
17481+ popm r4-r7,pc
17482+
17483+0:
17484+ // both op1 and op2 zero, but sign unknown. result should and signs.
17485+ ror r9 // pack op2 msw again with sign from c
17486+ lsl r12,1 // get back sign of op1 into c ...
17487+ ror r11 // and back in original op1
17488+ and r11,r9 // and sign bits. as op1 is zero, the
17489+ // only bit which can be 1 is sign bit
17490+ popm r4-r7,pc
17491+
17492+1:
17493+ ror r12 // save op1 sign in msb of r12
17494+
17495+ lsl r9,1 // unpack op2 msw
17496+ or r4,r8,r9
17497+ brne 0f
17498+ // op2 is zero, return op1
17499+ // whatever it is. the only case
17500+ // requiring special handling is if
17501+ // op1 is zero, but that was handled
17502+ // above.
17503+ lsl r12, 1
17504+ ror r11
17505+ popm r4-r7,pc
17506+
17507+0:
17508+ // make sure that op1 >= op2, flip sign if we swap ops
17509+ cp.w r10,r8
17510+ cpc r11,r9
17511+ brhs 0f
17512+
17513+ com r12 // sign of op1 and result in lsb(r12)
17514+ mov r7,r11 // swap operands if op2 was larger
17515+ mov r6,r10
17516+ mov r11,r9
17517+ mov r10,r8
17518+ mov r9,r7
17519+ mov r8,r6
17520+
17521+0:
17522+ // check if op1 is nan or inf.
17523+ lddpc r5,.Linf
17524+ cp.w r11,r5
17525+ brlo 1f
17526+ /* Op 1 is nan or inf */
17527+ // we have to check low word as well as nan mantissa may be 0 in msw
17528+ cpc r10
17529+ // we know that op1 is inf or nan. if z != 1 then we have nan.
17530+ // if we have nan, return nan.
17531+ breq 0f
17532+ mov r11, -1
17533+ rjmp __dfsub_return_op1
17534+0:
17535+
17536+ // op1 is infinity. check if op2 is nan, infinty or a normal number.
17537+ cp.w r9,r5
17538+ movhs r11, -1 // op2 is a normal number. return op1.
17539+
17540+ // op2 can be infinity (of the same sign as op1) or nan.
17541+ // in both cases we should return nan.
17542+ rjmp __dfsub_return_op1
17543+1:
17544+ // if op1 is not inf or nan, then op2 cannot be since op1 >= op2
17545+
17546+ // now prepare the operands by expanding them and shifting op2
17547+ // to the correct position for the subtract. note! if op2 is
17548+ // insignificant compared to op1, the function will take care of
17549+ // this and return op1 directly to the application.
17550+
17551+ /* Unpack operands */
17552+ unpack_df r7 /* exp op1*/, r10, r11 /* Mantissa op1 */
17553+ unpack_df r6 /* exp op2*/, r8, r9 /* Mantissa op2 */
17554+
17555+ /* Get shift amount required for aligning op1 and op2 */
17556+ rsub r6, r7
17557+ breq __perform_dfsub /* No shift needed */
17558+
17559+ cp.w r6, 63
17560+ brhs __dfsub_pack_result /* Op 2 insignificant compared to op1 */
17561+
17562+ /* Shift mantissa of op2 so that op1 and op2 are aligned */
17563+ scale_df r6 /* shift_count*/, r8, r9 /* Mantissa */, r4, r5 /*Scratch*/
17564+
17565+__perform_dfsub:
17566+ sub r10,r8 /* subtract mantissa of op2 from op1 */
17567+ sbc r11,r11,r9
17568+ or r4,r11,r10 /* check if result is all zeroes */
17569+ brne 0f
17570+ popm r4-r7,pc /* Early return */
17571+0:
17572+
17573+ normalize_df r7 /*exp*/, r10, r11 /* mantissa */, r8, r9 /* scratch */
17574+
17575+ /* Check if a subnormal result was created */
17576+ cp.w r7, 0
17577+ brgt 0f
17578+
17579+ adjust_subnormal_df r7 /*exp*/, r10, r11 /* Mantissa */, r12 /*sign*/, r8, r9 /*scratch*/
17580+ popm r4-r7,pc
17581+0:
17582+
17583+ /* Round result */
17584+ round_df r7 /*exp*/, r10, r11 /* Mantissa */, r9 /*scratch*/
17585+ cp.w r7,0x7ff
17586+ brlt __dfsub_pack_result
17587+ /*Return infinity */
17588+ lddpc r11, .Linf
17589+ mov r10, 0
17590+ rjmp __dfsub_return_op1
17591+
17592+__dfsub_pack_result:
17593+ /* Pack */
17594+ pack_df r7 /*exp*/, r10, r11 /* mantissa */, r10, r11 /* Output df number*/
17595+
17596+__dfsub_return_op1:
17597+ lsl r12,1
17598+ ror r11
17599+ popm r4-r7,pc
17600+
17601+ .align 2
17602+ .global __avr32_f64_add
17603+ .type __avr32_f64_add,@function
17604+__avr32_f64_add:
17605+ pushm r4-r7,lr
17606+ eor r12,r11,r9 // compare signs of operands
17607+ lsl r12,1
17608+ brcc __dfadd // same sign => add
17609+
17610+ eorh r9,0x8000
17611+ rjmp __dfsub // different signs => op1 - (-op2)
17612+__dfadd:
17613+
17614+ lsl r11,1 // unpack op1 msw and get sign in c
17615+ or r4,r11,r10 // check if all bits zero
17616+ brne 1f
17617+
17618+ // op1 is +/-0, and is unpacked with sign in c. add to op2.
17619+ // also used by sub, but op2 has been negated in this case
17620+ ror r12 // save sign of op1 in msb of r12
17621+ lsl r9,1 // unpack msw and get sign of op2
17622+ or r4,r9,r8 // check all bits in op2
17623+ breq 0f
17624+
17625+ // if op2 != 0, then return op2 unchanged.
17626+ ror r9 // pack op2 msw again with sign from c
17627+ mov r11,r9
17628+ mov r10,r8
17629+ popm r4-r7,pc
17630+
17631+0:
17632+ // both op1 and op2 zero, but sign unknown. result should and signs.
17633+ ror r9 // pack op2 msw again with sign from c
17634+ lsl r12,1 // get back sign of op1 into c ...
17635+ ror r11 // and back in original op1
17636+ and r11,r9 // and sign bits. as op1 is zero, the
17637+ // only bit which can be 1 is sign bit
17638+ popm r4-r7,pc
17639+1:
17640+ ror r12 // save op1 sign in msb of r12
17641+
17642+ lsl r9,1 // unpack op2 msw
17643+ or r4,r8,r9
17644+ brne 0f
17645+ // op2 is zero, return op1
17646+ // whatever it is. the only case
17647+ // requiring special handling is if
17648+ // op1 is zero, but that was handled
17649+ // above.
17650+ lsl r12, 1
17651+ ror r11
17652+ popm r4-r7,pc
17653+0:
17654+ // make sure that exp[op1] >= exp[op2]
17655+ cp.w r11,r9
17656+ brhs 0f
17657+
17658+ mov r7,r11 // swap operands if op2 was larger
17659+ mov r6,r10
17660+ mov r11,r9
17661+ mov r10,r8
17662+ mov r9,r7
17663+ mov r8,r6
17664+
17665+0:
17666+ // check if op1 is nan or inf.
17667+ lddpc r5,.Linf
17668+ cp.w r11,r5
17669+ brlo 1f
17670+ /* Op 1 is nan or inf */
17671+ // we have to check low word as well as nan mantissa may be 0 in msw
17672+ cpc r10
17673+ // we know that op1 is inf or nan. if z != 1 then we have nan.
17674+ // if we have nan, return nan.
17675+ breq 0f
17676+ mov r11, -1
17677+ rjmp __dfadd_return_op1
17678+0:
17679+
17680+ // op1 is infinity. check if op2 is nan, infinty or a normal number.
17681+ cp.w r9,r5
17682+ // Op2 is NaN of Inf. Return op2 but with sign of result.
17683+ // If Op2 is NaN, sign doesn't matter but no need to separate NaN
17684+ movhs r11, r9
17685+ movhs r10, r8
17686+
17687+ // op2 can be infinity (of the same sign as op1) or nan.
17688+ // in both cases we should return nan.
17689+ rjmp __dfadd_return_op1
17690+1:
17691+ // if op1 is not inf or nan, then op2 cannot be since exp[op1] >=
17692+ // exp[op2]
17693+
17694+ // now prepare the operands by expanding them and shifting op2
17695+ // to the correct position for the add. note! if op2 is
17696+ // insignificant compared to op1, the function will take care of
17697+ // this and return op1 directly to the application.
17698+
17699+ /* Unpack operands */
17700+ unpack_df r7 /* exp op1*/, r10, r11 /* Mantissa op1 */
17701+ unpack_df r6 /* exp op2*/, r8, r9 /* Mantissa op2 */
17702+
17703+ /* Get shift amount required for aligning op1 and op2 */
17704+ rsub r6, r7
17705+ breq __perform_dfadd /* No shift needed */
17706+
17707+ cp.w r6, 63
17708+ brhs __dfadd_pack_result /* Op 2 insignificant compared to op1 */
17709+
17710+ /* Shift mantissa of op2 so that op1 and op2 are aligned */
17711+ scale_df r6 /* shift_count*/, r8, r9 /* Mantissa */, r4, r5 /*Scratch*/
17712+
17713+__perform_dfadd:
17714+ add r10,r8 // add mantissas
17715+ adc r11,r11,r9
17716+ brcc 0f
17717+ ror r11 // overflow => shift down mantissa
17718+ ror r10
17719+ brcc 1f // sticky bit shifted out?
17720+ sbr r10,0 // if so, merge it into result again
17721+1:
17722+ sub r7,-1 // increase exponent with 1
17723+0:
17724+ normalize_df r7 /*exp*/, r10, r11 /* mantissa */, r8, r9 /* scratch */
17725+
17726+ /* Check if a subnormal result was created */
17727+ cp.w r7, 0
17728+ brgt 0f
17729+
17730+ adjust_subnormal_df r7 /*exp*/, r10, r11 /* Mantissa */, r12 /*sign*/, r8, r9 /*scratch*/
17731+ popm r4-r7,pc
17732+0:
17733+
17734+ /* Round result */
17735+ round_df r7 /*exp*/, r10, r11 /* Mantissa */, r9 /*scratch*/
17736+ cp.w r7,0x7ff
17737+ brlt __dfadd_pack_result
17738+ /*Return infinity */
17739+ lddpc r11, .Linf
17740+ mov r10, 0
17741+ rjmp __dfadd_return_op1
17742+
17743+__dfadd_pack_result:
17744+ /* Pack */
17745+ pack_df r7 /*exp*/, r10, r11 /* mantissa */, r10, r11 /* Output df number*/
17746+
17747+__dfadd_return_op1:
17748+ lsl r12,1
17749+ ror r11
17750+ popm r4-r7,pc
17751+#endif
17752+
17753+#ifdef L_avr32_f64_to_u32
17754+ /* This goes into L_fixdfsi */
17755+#endif
17756+
17757+
17758+#ifdef L_avr32_f64_to_s32
17759+ .global __avr32_f64_to_u32
17760+ .type __avr32_f64_to_u32,@function
17761+__avr32_f64_to_u32:
17762+ cp.w r11, 0
17763+ retmi 0 /* Negative returns 0 */
17764+#ifdef __LARGE_FLOATS__
17765+ lsl r12,r11,1
17766+ lsr r12,21 /* extract exponent*/
17767+ sub r12,1023 /* convert to unbiased exponent.*/
17768+ retlo 0 /* too small exponent implies zero. */
17769+ cp.w r12,32
17770+ brcc 0f
17771+ rjmp 1f
17772+#endif
17773+
17774+ /* Fallthrough to df to signed si conversion */
17775+ .global __avr32_f64_to_s32
17776+ .type __avr32_f64_to_s32,@function
17777+__avr32_f64_to_s32:
17778+ lsl r12,r11,1
17779+ lsr r12,21 /* extract exponent*/
17780+ sub r12,1023 /* convert to unbiased exponent.*/
17781+ retlo 0 /* too small exponent implies zero. */
17782+
17783+#ifdef __LARGE_FLOATS__
17784+ cp.w r12,31
17785+ brcc 0f
17786+#endif
17787+1:
17788+ rsub r12,r12,31 /* shift count = 31 - exponent */
17789+ mov r9,r11 /* save sign for later...*/
17790+ lsl r11,11 /* remove exponent and sign*/
17791+ sbr r11,31 /* add implicit bit*/
17792+ or r11,r11,r10>>21 /* get rest of bits from lsw of double */
17793+ lsr r11,r11,r12 /* shift down mantissa to final place */
17794+ lsl r9,1 /* sign -> carry */
17795+ retcc r11 /* if positive, we are done */
17796+ neg r11 /* if negative float, negate result */
17797+ ret r11
17798+
17799+#ifdef __LARGE_FLOATS__
17800+0:
17801+ mov r12,-1 /* r11 = 0xffffffff */
17802+ lsr r12,1 /* r11 = 0x7fffffff */
17803+ lsl r11,1 /* sign -> carry */
17804+ acr r12 /* r11 = signed ? 0x80000000
17805+ : 0x7fffffff */
17806+ ret r12
17807+#endif
17808+#endif /* L_fixdfsi*/
17809+
17810+#ifdef L_avr32_f64_to_u64
17811+ /* Actual function is in L_fixdfdi */
17812+#endif
17813+
17814+#ifdef L_avr32_f64_to_s64
17815+ .global __avr32_f64_to_u64
17816+ .type __avr32_f64_to_u64,@function
17817+__avr32_f64_to_u64:
17818+ cp.w r11,0
17819+ /* Negative numbers return zero */
17820+ movmi r10, 0
17821+ movmi r11, 0
17822+ retmi r11
17823+#ifdef __LARGE_FLOATS__
17824+ lsl r9,r11,1
17825+ lsr r9,21 /* get exponent*/
17826+ sub r9,1023 /* convert to correct range*/
17827+ /* Return zero if exponent to small */
17828+ movlo r10, 0
17829+ movlo r11, 0
17830+ retlo r11
17831+ cp.w r9,64
17832+ mov r8,r11 /* save sign for later...*/
17833+ brcs 1f
17834+ rjmp 2f /* Number to large */
17835+
17836+#endif
17837+
17838+
17839+
17840+ /* Fallthrough */
17841+ .global __avr32_f64_to_s64
17842+ .type __avr32_f64_to_s64,@function
17843+__avr32_f64_to_s64:
17844+ lsl r9,r11,1
17845+ lsr r9,21 /* get exponent*/
17846+ sub r9,1023 /* convert to correct range*/
17847+ /* Return zero if exponent to small */
17848+ movlo r10, 0
17849+ movlo r11, 0
17850+ retlo r11
17851+
17852+#ifdef __LARGE_FLOATS__
17853+ cp.w r9,63
17854+ mov r8,r11 /* save sign for later...*/
17855+ brcc 2f
17856+#else
17857+ mov r8,r11 /* save sign for later...*/
17858+#endif
17859+1:
17860+ lsl r11,11 /* remove exponent */
17861+ sbr r11,31 /* add implicit bit*/
17862+ or r11,r11,r10>>21 /* get rest of bits from lsw of double*/
17863+ lsl r10,11 /* align lsw correctly as well */
17864+ rsub r9,r9,63 /* shift count = 63 - exponent */
17865+ breq 1f
17866+
17867+ cp.w r9,32 /* is shift count more than one reg? */
17868+ brhs 0f
17869+
17870+ mov r12,r11 /* save msw */
17871+ lsr r10,r10,r9 /* small shift count, shift down lsw */
17872+ lsr r11,r11,r9 /* small shift count, shift down msw */
17873+ rsub r9,r9,32 /* get 32-size of shifted out tail */
17874+ lsl r12,r12,r9 /* align part to move from msw to lsw */
17875+ or r10,r12 /* combine to get new lsw */
17876+ rjmp 1f
17877+
17878+0:
17879+ lsr r10,r11,r9 /* large shift count,only lsw get bits
17880+ note that shift count is modulo 32*/
17881+ mov r11,0 /* msw will be 0 */
17882+
17883+1:
17884+ lsl r8,1 /* sign -> carry */
17885+ retcc r11 /* if positive, we are done */
17886+
17887+ neg r11 /* if negative float, negate result */
17888+ neg r10
17889+ scr r11
17890+ ret r11
17891+
17892+
17893+#ifdef __LARGE_FLOATS__
17894+2:
17895+ mov r11,-1 /* r11 = 0xffffffff */
17896+ lsr r11,1 /* r11 = 0x7fffffff */
17897+ lsl r8,1 /* sign -> carry */
17898+ acr r11 /* r11 = signed ? 0x80000000 */
17899+ /* : 0x7fffffff */
17900+ lsl r10,r11,31 /* extend last bit of msw*/
17901+ asr r10,31
17902+ ret r11
17903+#endif
17904+#endif
17905+
17906+#ifdef L_avr32_u32_to_f64
17907+ /* Code located in L_floatsidf */
17908+#endif
17909+
17910+#ifdef L_avr32_s32_to_f64
17911+ .global __avr32_u32_to_f64
17912+ .type __avr32_u32_to_f64,@function
17913+__avr32_u32_to_f64:
17914+ sub r11, r12, 0 /* Move to r11 and force Z flag to be updated */
17915+ mov r12, 0 /* always positive */
17916+ rjmp 0f /* Jump to common code for floatsidf */
17917+
17918+ .global __avr32_s32_to_f64
17919+ .type __avr32_s32_to_f64,@function
17920+__avr32_s32_to_f64:
17921+ mov r11, r12 /* Keep original value in r12 for sign */
17922+ abs r11 /* Absolute value if r12 */
17923+0:
17924+ mov r10,0 /* let remaining bits be zero */
17925+ reteq r11 /* zero long will return zero float */
17926+
17927+ pushm lr
17928+ mov r9,31+1023 /* set exponent */
17929+
17930+ normalize_df r9 /*exp*/, r10, r11 /* mantissa */, r8, lr /* scratch */
17931+
17932+ /* Check if a subnormal result was created */
17933+ cp.w r9, 0
17934+ brgt 0f
17935+
17936+ adjust_subnormal_df r9 /* exp */, r10, r11 /* Mantissa */, r12 /*sign*/, r8, lr /* scratch */
17937+ popm pc
17938+0:
17939+
17940+ /* Round result */
17941+ round_df r9 /*exp*/, r10, r11 /* Mantissa */, r8 /*scratch*/
17942+ cp.w r9,0x7ff
17943+ brlt 0f
17944+ /*Return infinity */
17945+ lddpc r11, .Linf
17946+ mov r10, 0
17947+ rjmp __floatsidf_return_op1
17948+
17949+0:
17950+
17951+ /* Pack */
17952+ pack_df r9 /*exp*/, r10, r11 /* mantissa */, r10, r11 /* Output df number*/
17953+__floatsidf_return_op1:
17954+ lsl r12,1 /* shift in sign bit */
17955+ ror r11
17956+
17957+ popm pc
17958+#endif
17959+
17960+
17961+#ifdef L_avr32_f32_cmp_eq
17962+ .global __avr32_f32_cmp_eq
17963+ .type __avr32_f32_cmp_eq,@function
17964+__avr32_f32_cmp_eq:
17965+ cp.w r12, r11
17966+ brne 0f /* If not equal check for +/-0 */
17967+
17968+ /* Check for NaN or Inf */
17969+ lddpc r11,.Linf_sf
17970+ lsl r12, 1
17971+ cp.w r12, r11
17972+ srls r12 /* 0 if NaN, 1 otherwise */
17973+ ret r12
17974+0:
17975+ /* Or together the two values and shift out the sign bit.
17976+ If the result is zero, then the two values are both zero. */
17977+ or r12, r11
17978+ lsl r12, 1
17979+ sreq r12
17980+ ret r12
17981+#endif
17982+
17983+#if defined(L_avr32_f32_cmp_ge) || defined(L_avr32_f32_cmp_lt)
17984+#ifdef L_avr32_f32_cmp_ge
17985+ .global __avr32_f32_cmp_ge
17986+ .type __avr32_f32_cmp_ge,@function
17987+__avr32_f32_cmp_ge:
17988+#endif
17989+#ifdef L_avr32_f32_cmp_lt
17990+ .global __avr32_f32_cmp_lt
17991+ .type __avr32_f32_cmp_lt,@function
17992+__avr32_f32_cmp_lt:
17993+#endif
17994+ lsl r10, r12, 1 /* Remove sign bits */
17995+ lsl r9, r11, 1
17996+ lddpc r8, .Linf_sf
17997+ cp.w r10, r8
17998+ rethi 0 /* Op0 is NaN */
17999+ cp.w r9, r8
18000+ rethi 0 /* Op1 is Nan */
18001+
18002+ eor r8, r11, r12
18003+ bld r12, 31
18004+#ifdef L_avr32_f32_cmp_ge
18005+ srcc r8 /* Set result to true if op0 is positive*/
18006+#endif
18007+#ifdef L_avr32_f32_cmp_lt
18008+ srcs r8 /* Set result to true if op0 is negative*/
18009+#endif
18010+ retmi r8 /* Return if signs are different */
18011+ brcs 0f /* Both signs negative? */
18012+
18013+ /* Both signs positive */
18014+ cp.w r12, r11
18015+#ifdef L_avr32_f32_cmp_ge
18016+ srhs r12
18017+#endif
18018+#ifdef L_avr32_f32_cmp_lt
18019+ srlo r12
18020+#endif
18021+ retal r12
18022+0:
18023+ /* Both signs negative */
18024+ cp.w r11, r12
18025+#ifdef L_avr32_f32_cmp_ge
18026+ srhs r12
18027+#endif
18028+#ifdef L_avr32_f32_cmp_lt
18029+ srlo r12
18030+#endif
18031+ retal r12
18032+#endif
18033+
18034+
18035+#ifdef L_avr32_f64_cmp_eq
18036+ .global __avr32_f64_cmp_eq
18037+ .type __avr32_f64_cmp_eq,@function
18038+__avr32_f64_cmp_eq:
18039+ cp.w r10,r8
18040+ cpc r11,r9
18041+ brne 0f /* Both args could be zero with different sign bits */
18042+
18043+ /* check for NaN */
18044+ lsl r11,1
18045+ lddpc r12,.Linf
18046+ cp.w r10,0
18047+ cpc r11,r12 /* check if nan or inf */
18048+ srls r12 /* If Arg is NaN return 0 else 1*/
18049+ ret r12 /* Return */
18050+
18051+0:
18052+ lsl r11,1 /* get rid of sign bits */
18053+ lsl r9,1
18054+ or r11,r10 /* Check if all bits are zero */
18055+ or r11,r9
18056+ or r11,r8
18057+ sreq r12 /* If all zeros the arguments are equal
18058+ so return 1 else return 0 */
18059+ ret r12
18060+#endif
18061+
18062+
18063+#if defined(L_avr32_f64_cmp_ge) || defined(L_avr32_f64_cmp_lt)
18064+
18065+#ifdef L_avr32_f64_cmp_ge
18066+ .global __avr32_f64_cmp_ge
18067+ .type __avr32_f64_cmp_ge,@function
18068+__avr32_f64_cmp_ge:
18069+#endif
18070+#ifdef L_avr32_f64_cmp_lt
18071+ .global __avr32_f64_cmp_lt
18072+ .type __avr32_f64_cmp_lt,@function
18073+__avr32_f64_cmp_lt:
18074+#endif
18075+
18076+ /* compare magnitude of op1 and op2 */
18077+ pushm lr
18078+
18079+ lsl r11,1 /* Remove sign bit of op1 */
18080+ srcs lr /* Sign op1 to lsb of lr*/
18081+ lsl r9,1 /* Remove sign bit of op2 */
18082+ rol lr /* Sign op2 to lsb of lr, sign bit op1 bit 1 of lr*/
18083+
18084+ /* Check for Nan */
18085+ lddpc r12,.Linf
18086+ cp.w r10,0
18087+ cpc r11,r12
18088+ movhi r12, 0 /* Return false for NaN */
18089+ brhi 0f /* We have NaN */
18090+ cp.w r8,0
18091+ cpc r9,r12
18092+ movhi r12, 0 /* Return false for NaN */
18093+ brhi 0f /* We have NaN */
18094+
18095+ cp.w lr,3 /* both operands negative ?*/
18096+ breq 1f
18097+
18098+ cp.w lr,1 /* both operands positive? */
18099+ brlo 2f
18100+
18101+ /* Different signs. If sign of op1 is negative the difference
18102+ between op1 and op2 will always be negative, and if op1 is
18103+ positive the difference will always be positive */
18104+#ifdef L_avr32_f64_cmp_ge
18105+ sreq r12
18106+#endif
18107+#ifdef L_avr32_f64_cmp_lt
18108+ srne r12
18109+#endif
18110+ popm pc
18111+
18112+
18113+2:
18114+ /* Both operands positive. Just compute the difference */
18115+ cp.w r10,r8
18116+ cpc r11,r9
18117+#ifdef L_avr32_f64_cmp_ge
18118+ srhs r12
18119+#endif
18120+#ifdef L_avr32_f64_cmp_lt
18121+ srlo r12
18122+#endif
18123+ popm pc
18124+
18125+1:
18126+ /* Both operands negative. Compute the difference with operands switched */
18127+ cp r8,r10
18128+ cpc r9,r11
18129+#ifdef L_avr32_f64_cmp_ge
18130+ srhs r12
18131+#endif
18132+#ifdef L_avr32_f64_cmp_lt
18133+ srlo r12
18134+#endif
18135+0:
18136+ popm pc
18137+#endif
18138+
18139+
18140+
18141+#ifdef L_avr32_f64_div
18142+ .global __avr32_f64_div
18143+ .type __avr32_f64_div,@function
18144+__avr32_f64_div:
18145+ stm --sp, r2-r7,lr
18146+ eor r12, r11, r9 /* Sign(op1) ^ Sign(op2) to msb of r12*/
18147+ lsl r11,1 /* unpack op1*/
18148+ lddpc lr,.Linf
18149+ lsl r9,1 /* unpack op2*/
18150+
18151+ cp.w r11,lr
18152+ brhs 0f /* op1 is NaN or infinity */
18153+ cp.w r9,lr
18154+ brhs 1f /* op2 is NaN or infinity */
18155+ or r5,r9,r8
18156+ breq 2f /* op2 is zero */
18157+ or r5,r11,r10
18158+ breq __dfdiv_return_op1 /* op1 is zero return zero*/
18159+
18160+ /* Unpack and normalize */
18161+ /* op1 */
18162+ unpack_df r7 /*exp*/, r10, r11 /*df number*/
18163+ normalize_df r7 /*exp*/, r10, r11 /*Mantissa*/, r4, r5 /*scratch*/
18164+
18165+ /* op1 */
18166+ unpack_df r6 /*exp*/, r8, r9 /*df number*/
18167+ normalize_df r6 /*exp*/, r8, r9 /*Mantissa*/, r4, r5 /*scratch*/
18168+
18169+ /* Compute new exponent */
18170+ sub r7,r6
18171+ sub r7,-1023
18172+
18173+ /* Do fixed point division of mantissas*/
18174+ mov r6,55
18175+ lsr r11,1
18176+ ror r10
18177+ lsr r9,1
18178+ ror r8
18179+
18180+3:
18181+ /* Check if dividend is higher or same than divisor */
18182+ sub r2,r10,r8
18183+ sbc r3,r11,r9
18184+ /* If so move the difference back into the dividend */
18185+ movhs r10, r2
18186+ movhs r11, r3
18187+ /* Update the Quotient */
18188+ rol r4
18189+ rol r5
18190+ eorl r4,1
18191+
18192+ /* Shift the dividend */
18193+ lsl r10,1
18194+ rol r11
18195+
18196+ sub r6,1
18197+ brne 3b
18198+
18199+ /* Check if we have a remainder which will the propagate into
18200+ the last bit */
18201+
18202+ or r11,r11,r10
18203+ neg r11
18204+ rol r4
18205+ rol r5
18206+
18207+ /* Adjust mantissa into correct alignment */
18208+ lsl r11, r5,(64-56)
18209+ or r11,r11,r4>>(32-64+56)
18210+ lsl r10,r4, (64-56)
18211+
18212+ /* Normalize result */
18213+ normalize_df r7 /*exp*/, r10, r11 /* mantissa */, r8, r9 /* scratch */
18214+
18215+ /* Check if a subnormal result was created */
18216+ cp.w r7, 0
18217+ brgt 3f
18218+
18219+ adjust_subnormal_df r7 /*exp*/, r10, r11 /* Mantissa */, r12 /*sign*/, r8, r9 /*scratch*/
18220+ ldm sp++, r2-r7,pc
18221+3:
18222+
18223+ /* Round result */
18224+ round_df r7 /*exp*/, r10, r11 /* Mantissa */, r9 /*scratch*/
18225+ cp.w r7,0x7ff
18226+ brlt __dfdiv_pack_result
18227+ /*Return infinity */
18228+ lddpc r11, .Linf
18229+ mov r10, 0
18230+ rjmp __dfdiv_return_op1
18231+
18232+__dfdiv_pack_result:
18233+ /* Pack */
18234+ pack_df r7 /*exp*/, r10, r11 /* mantissa */, r10, r11 /* Output df number*/
18235+
18236+__dfdiv_return_op1:
18237+ lsl r12,1
18238+ ror r11
18239+ ldm sp++, r2-r7,pc
18240+
18241+0:
18242+ /* Op1 is NaN or Inf */
18243+ cpc r10
18244+ /* If op1 is a NaN the we should return a NaN */
18245+ brne __dfdiv_return_op1
18246+
18247+ /* Op1 is infinity, check op2*/
18248+ cp.w r9,lr
18249+ brlo __dfdiv_return_op1 /* Op2 is a normal number return inf */
18250+ /* Other combinations: return NaN */
18251+ mov r11, -1
18252+ ldm sp++, r2-r7,pc
18253+
18254+1:
18255+ /* Op2 is NaN or Inf */
18256+ cpc r8
18257+ /* If inf return zero else return NaN*/
18258+ mov r10, 0
18259+ moveq r11, 0
18260+ movne r11, -1
18261+ ldm sp++, r2-r7,pc
18262+
18263+2:
18264+ /* Op2 is zero */
18265+ or r6,r11,r10 /* 0.0/0.0 yields NaN */
18266+ mov r10, 0
18267+ moveq r11, -1 /* Return NaN */
18268+ movne r11, lr /* Return inf */
18269+ rjmp __dfdiv_return_op1
18270+
18271+#endif
18272+
18273+
18274+#ifdef L_avr32_f32_div
18275+ .global __avr32_f32_div
18276+ .type __avr32_f32_div,@function
18277+__avr32_f32_div:
18278+ eor r8, r11, r12 /* MSB(r8) = Sign(op1) ^ Sign(op2) */
18279+ /* Unpack */
18280+ lsl r12,1
18281+ reteq 0 /* Return zero if op1 is zero */
18282+ lddpc r9, .Linf_sf
18283+ lsl r11,1
18284+
18285+ /* Check op1 for NaN or Inf */
18286+ cp r12,r9
18287+ brhs 2f
18288+
18289+ /* Check op2 for NaN or Inf */
18290+ cp r11,r9
18291+ brhs 3f
18292+ /* Check op2 for zero */
18293+ tst r11,r11
18294+ breq 4f
18295+
18296+ /* If op1 is zero return zero */
18297+ tst r12, r12
18298+ reteq 0
18299+
18300+ /* Unpack op1*/
18301+ unpack_sf r9 /*exp*/, r12 /*sf*/
18302+
18303+ /* Unpack op2*/
18304+ unpack_sf r10 /*exp*/, r11 /*sf*/
18305+
18306+ /* Calculate new exponent */
18307+ stm --sp,r7,lr
18308+ sub r9, r10
18309+ sub r9,-127
18310+
18311+ /* Divide */
18312+ mov r7,26
18313+
18314+ lsr r12,1 /* Make room for one more bit in mantissas */
18315+ lsr r11,1
18316+
18317+0:
18318+ sub r10,r12,r11
18319+ movcc r12, r10 /* update dividend if divisor smaller */
18320+ rol lr /* shift result into lr */
18321+ eorl lr,1 /* flip bit. */
18322+ lsl r12,1 /* Shift dividend */
18323+ sub r7,1
18324+ brne 0b
18325+
18326+ /* round and scale*/
18327+ neg r12 /* c = 1 iff r12 != 0 */
18328+ rol lr
18329+ lsl r10,lr,(32-27) /* Adjust mantissa */
18330+ ldm sp++, r7, lr
18331+
18332+
18333+ normalize_sf r9 /*exp*/, r10 /*mant*/, r11 /*scratch*/
18334+
18335+ /* Check for subnormal result */
18336+ cp.w r9, 0
18337+ brgt 0f
18338+
18339+ /* Adjust a subnormal result */
18340+ adjust_subnormal_sf r12 /*sf*/, r9 /*exp*/, r10 /*mant*/, r8 /*sign*/,r11 /*scratch*/
18341+ ret r12
18342+0:
18343+ round_sf r9 /*exp*/, r10 /*mant*/, r11 /*scratch*/
18344+ pack_sf r12 /*sf*/, r9 /*exp*/, r10 /*mant*/
18345+__divsf_return_op1:
18346+ lsl r8, 1
18347+ ror r12
18348+ ret r12
18349+
18350+2:
18351+ /* Op1 is NaN or inf */
18352+ retne -1 /* Return NaN if op1 is NaN */
18353+ /* Op1 is inf check op2 */
18354+ cp r11, r9
18355+ brlo __divsf_return_op1 /* inf/number gives inf */
18356+ ret -1 /* The rest gives NaN*/
18357+3:
18358+ /* Op1 is NaN or inf */
18359+ reteq 0 /* Return zero if number/inf*/
18360+ ret -1 /* Return NaN*/
18361+4:
18362+ /* Op2 is zero ? */
18363+ tst r12,r12
18364+ reteq -1 /* 0.0/0.0 is NaN */
18365+ lddpc r12, .Linf_sf
18366+ rjmp __divsf_return_op1
18367+
18368+#endif
18369+
18370+#ifdef L_avr32_f32_mul
18371+ .global __avr32_f32_mul
18372+ .type __avr32_f32_mul,@function
18373+__avr32_f32_mul:
18374+ eor r8, r11, r12 /* MSB(r8) = Sign(op1) ^ Sign(op2) */
18375+ lsl r12,1 /* unpack op1 */
18376+ lsl r11,1 /* unpack op2 */
18377+
18378+ /* arrange operands so that that op1 >= op2 */
18379+ sub r9,r12,r11
18380+ brcc 0f
18381+
18382+ sub r12,r9 /* swap operands if op2 was larger */
18383+ add r11,r9
18384+
18385+0:
18386+ lddpc r9,.Linf_sf
18387+ cp r12,r9
18388+ brhs 2f
18389+
18390+ /* Check op2 for zero */
18391+ tst r11,r11
18392+ reteq 0 /* Return zero */
18393+
18394+ /* Unpack op1 */
18395+ unpack_sf r9 /*exp*/, r12 /*sf*/
18396+ /* Unpack op2 */
18397+ unpack_sf r10 /*exp*/, r11 /*sf*/
18398+
18399+ /* Calculate new exponent */
18400+ add r9,r10
18401+
18402+ /* Do the multiplication */
18403+ mulu.d r10,r12,r11
18404+
18405+ sub r9,(127-1) /* remove extra exponent bias */
18406+
18407+ /* Check if we have any bits in r10 which
18408+ means a rounding bit should be inserted in LSB of result */
18409+ tst r10,r10
18410+ srne r10
18411+ or r12,r11,r10
18412+
18413+ /* Normalize */
18414+ normalize_sf r9 /*exp*/, r12 /*mant*/, r11 /*scratch*/
18415+
18416+ /* Check for subnormal result */
18417+ cp.w r9, 0
18418+ brgt 0f
18419+
18420+ /* Adjust a subnormal result */
18421+ adjust_subnormal_sf r12/*sf*/, r9 /*exp*/, r12 /*mant*/, r8 /*sign*/, r11 /*scratch */
18422+ ret r12
18423+0:
18424+ round_sf r9 /*exp*/, r12 /*mant*/, r11 /*scratch*/
18425+ cp.w r9, 0xff
18426+ brlo 1f
18427+ lddpc r12,.Linf_sf
18428+ rjmp __mulsf_return_op1
18429+1:
18430+ pack_sf r12 /*sf*/, r9 /*exp*/, r12 /*mant*/
18431+__mulsf_return_op1:
18432+ lsl r8, 1
18433+ ror r12
18434+ ret r12
18435+
18436+2:
18437+ /* Op1 is inf or NaN */
18438+ retne -1 /* Op1 is NaN return NaN */
18439+
18440+ /* Op1 is inf and op2 is smaller so it is either infinity
18441+ or a subnormal number */
18442+ cp r11,0
18443+ brne __mulsf_return_op1 /* op2 is not zero. return op1.*/
18444+ ret -1 /* inf * 0 return NaN */
18445+#endif
18446+
18447+
18448+#ifdef L_avr32_s32_to_f32
18449+ .global __avr32_s32_to_f32
18450+ .type __avr32_s32_to_f32,@function
18451+__avr32_s32_to_f32:
18452+ cp r12, 0
18453+ reteq r12 /* If zero then return zero float */
18454+ mov r11, r12 /* Keep the sign */
18455+ abs r12 /* Compute the absolute value */
18456+ mov r10, 31 + 127 /* Set the correct exponent */
18457+
18458+ /* Normalize */
18459+ normalize_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18460+
18461+ /* Check for subnormal result */
18462+ cp.w r10, 0
18463+ brgt 0f
18464+
18465+ /* Adjust a subnormal result */
18466+ adjust_subnormal_sf r12/*sf*/, r10 /*exp*/, r12 /*mant*/, r11/*sign*/, r9 /*scratch*/
18467+ ret r12
18468+0:
18469+ round_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18470+ pack_sf r12 /*sf*/, r10 /*exp*/, r12 /*mant*/
18471+__floatsisf_return_op1:
18472+ lsl r11, 1
18473+ ror r12
18474+ ret r12
18475+#endif
18476+
18477+#ifdef L_avr32_u32_to_f32
18478+ .global __avr32_u32_to_f32
18479+ .type __avr32_u32_to_f32,@function
18480+__avr32_u32_to_f32:
18481+ cp r12, 0
18482+ reteq r12 /* If zero then return zero float */
18483+ mov r10, 31 + 127 /* Set the correct exponent */
18484+
18485+ /* Normalize */
18486+ normalize_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18487+
18488+ /* Check for subnormal result */
18489+ cp.w r10, 0
18490+ brgt 0f
18491+
18492+ /* Adjust a subnormal result */
18493+ mov r8, 0
18494+ adjust_subnormal_sf r12/*sf*/,r10 /*exp*/, r12 /*mant*/,r8/*sign*/, r9 /*scratch*/
18495+ ret r12
18496+0:
18497+ round_sf r10 /*exp*/, r12 /*mant*/, r9 /*scratch*/
18498+ pack_sf r12 /*sf*/, r10 /*exp*/, r12 /*mant*/
18499+__floatunsisf_return_op1:
18500+ lsr r12,1 /* Sign bit is 0 for unsigned int */
18501+ ret r12
18502+#endif
18503+
18504+
18505+#ifdef L_avr32_f32_to_s32
18506+ .global __avr32_f32_to_s32
18507+ .type __avr32_f32_to_s32,@function
18508+__avr32_f32_to_s32:
18509+ lsr r11,r12,23 /* Extract exponent */
18510+ castu.b r11
18511+ sub r11,127 /* Fix bias */
18512+ retlo 0 /* Negative exponent yields zero integer */
18513+
18514+#ifdef __IEEE_LARGE_FLOATS__
18515+ cp r11,31
18516+ brcc 0f
18517+#endif
18518+ /* Shift mantissa into correct position */
18519+ rsub r11,r11,31 /* Shift amount */
18520+ lsl r10,r12,8 /* Get mantissa */
18521+ sbr r10,31 /* Add implicit bit */
18522+ lsr r10,r10,r11 /* Perform shift */
18523+ lsl r12,1 /* Check sign */
18524+ retcc r10 /* if positive, we are done */
18525+ neg r10 /* if negative float, negate result */
18526+ ret r10
18527+
18528+#ifdef __IEEE_LARGE_FLOATS__
18529+0:
18530+ mov r11,-1
18531+ lsr r11,1
18532+ lsl r12,1
18533+ acr r11
18534+
18535+ ret r11
18536+#endif
18537+#endif
18538+
18539+#ifdef L_avr32_f32_to_u32
18540+ .global __avr32_f32_to_u32
18541+ .type __avr32_f32_to_u32,@function
18542+__avr32_f32_to_u32:
18543+ cp r12,0
18544+ retmi 0 /* Negative numbers gives 0 */
18545+ bfextu r11, r12, 23, 8 /* Extract exponent */
18546+ sub r11,127 /* Fix bias */
18547+ retlo 0 /* Negative exponent yields zero integer */
18548+
18549+#ifdef __IEEE_LARGE_FLOATS__
18550+ cp r11,32
18551+ brcc 0f
18552+#endif
18553+ /* Shift mantissa into correct position */
18554+ rsub r11,r11,31 /* Shift amount */
18555+ lsl r12,8 /* Get mantissa */
18556+ sbr r12,31 /* Add implicit bit */
18557+ lsr r12,r12,r11 /* Perform shift */
18558+ ret r12
18559+
18560+#ifdef __IEEE_LARGE_FLOATS__
18561+0:
18562+ mov r11,-1
18563+ lsr r11,1
18564+ lsl r12,1
18565+ acr r11
18566+
18567+ ret r11
18568+#endif
18569+#endif
18570+
18571+#ifdef L_avr32_f32_to_f64
18572+ .global __avr32_f32_to_f64
18573+ .type __avr32_f32_to_f64,@function
18574+
18575+__avr32_f32_to_f64:
18576+ lsl r11,r12,1 /* Remove sign bit, keep original value in r12*/
18577+ moveq r10, 0
18578+ reteq r11 /* Return zero if input is zero */
18579+
18580+ bfextu r9,r11,24,8 /* Get exponent */
18581+ cp.w r9,0xff /* check for NaN or inf */
18582+ breq 0f
18583+
18584+ lsl r11,7 /* Convert sf mantissa to df format */
18585+ mov r10,0
18586+
18587+ /* Check if implicit bit should be set */
18588+ cp.w r9, 0
18589+ subeq r9,-1 /* Adjust exponent if it was 0 */
18590+ srne r8
18591+ or r11, r11, r8 << 31 /* Set implicit bit if needed */
18592+ sub r9,(127-0x3ff) /* Convert exponent to df format exponent */
18593+
18594+ pushm lr
18595+ normalize_df r9 /*exp*/, r10, r11 /*mantissa*/, r8, lr /*scratch*/
18596+ popm lr
18597+ pack_df r9 /*exp*/, r10, r11 /*mantissa*/, r10, r11 /*df*/
18598+
18599+__extendsfdf_return_op1:
18600+ /* Rotate in sign bit */
18601+ lsl r12, 1
18602+ ror r11
18603+ ret r11
18604+
18605+0:
18606+ /* Inf or NaN*/
18607+ lddpc r10, .Linf
18608+ lsl r11,8 /* check mantissa */
18609+ movne r11, -1 /* Return NaN */
18610+ moveq r11, r10 /* Return inf */
18611+ rjmp __extendsfdf_return_op1
18612+#endif
18613+
18614+
18615+#ifdef L_avr32_f64_to_f32
18616+ .global __avr32_f64_to_f32
18617+ .type __avr32_f64_to_f32,@function
18618+
18619+__avr32_f64_to_f32:
18620+ /* Unpack */
18621+ lsl r9,r11,1 /* Unpack exponent */
18622+ lsr r9,21
18623+
18624+ reteq 0 /* If exponent is 0 the number is so small
18625+ that the conversion to single float gives
18626+ zero */
18627+
18628+ lsl r8,r11,10 /* Adjust mantissa */
18629+ or r12,r8,r10>>22
18630+
18631+ lsl r10,10 /* Check if there are any remaining bits
18632+ in the low part of the mantissa.*/
18633+ neg r10
18634+ rol r12 /* If there were remaining bits then set lsb
18635+ of mantissa to 1 */
18636+
18637+ cp r9,0x7ff
18638+ breq 2f /* Check for NaN or inf */
18639+
18640+ sub r9,(0x3ff-127) /* Adjust bias of exponent */
18641+ sbr r12,31 /* set the implicit bit.*/
18642+
18643+ cp.w r9, 0 /* Check for subnormal number */
18644+ brgt 0f
18645+
18646+ /* Adjust a subnormal result */
18647+ adjust_subnormal_sf r12/*sf*/,r9 /*exp*/, r12 /*mant*/, r11/*sign*/, r10 /*scratch*/
18648+ ret r12
18649+0:
18650+ round_sf r9 /*exp*/, r12 /*mant*/, r10 /*scratch*/
18651+ pack_sf r12 /*sf*/, r9 /*exp*/, r12 /*mant*/
18652+__truncdfsf_return_op1:
18653+ /* Rotate in sign bit */
18654+ lsl r11, 1
18655+ ror r12
18656+ ret r12
18657+
18658+
18659+2:
18660+ /* NaN or inf */
18661+ cbr r12,31 /* clear implicit bit */
18662+ retne -1 /* Return NaN if mantissa not zero */
18663+ lddpc r12,.Linf_sf
18664+ ret r12 /* Return inf */
18665+#endif
18666+
18667+
18668+ .align 2
18669+.Linf:
18670+ .long 0xffe00000
18671+
18672+ .align 2
18673+.Linf_sf:
18674+ .long 0xff000000
18675+
18676diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/lib2funcs.S gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/lib2funcs.S
18677--- gcc-4.0.2/gcc/config/avr32/lib2funcs.S 1970-01-01 01:00:00.000000000 +0100
18678+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/lib2funcs.S 2006-10-10 12:36:34.000000000 +0200
18679@@ -0,0 +1,21 @@
18680+ .align 4
18681+ .global __nonlocal_goto
18682+ .type __nonlocal_goto,@function
18683+
18684+/* __nonlocal_goto: This function handles nonlocal_goto's in gcc.
18685+
18686+ parameter 0 (r12) = New Frame Pointer
18687+ parameter 1 (r11) = Address to goto
18688+ parameter 2 (r10) = New Stack Pointer
18689+
18690+ This function invalidates the return stack, since it returns from a
18691+ function without using a return instruction.
18692+*/
18693+__nonlocal_goto:
18694+ mov r7, r12
18695+ mov sp, r10
18696+ frs # Flush return stack
18697+ mov pc, r11
18698+
18699+
18700+
18701diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/linux-elf.h gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/linux-elf.h
18702--- gcc-4.0.2/gcc/config/avr32/linux-elf.h 1970-01-01 01:00:00.000000000 +0100
18703+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/linux-elf.h 2006-11-10 15:14:06.000000000 +0100
18704@@ -0,0 +1,154 @@
18705+/*
18706+ Linux/Elf specific definitions.
18707+ Copyright 2003-2006 Atmel Corporation.
18708+
18709+ Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
18710+ and Håvard Skinnemoen, Atmel Norway, <hskinnemoen@atmel.com>
18711+
18712+ This file is part of GCC.
18713+
18714+ This program is free software; you can redistribute it and/or modify
18715+ it under the terms of the GNU General Public License as published by
18716+ the Free Software Foundation; either version 2 of the License, or
18717+ (at your option) any later version.
18718+
18719+ This program is distributed in the hope that it will be useful,
18720+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18721+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18722+ GNU General Public License for more details.
18723+
18724+ You should have received a copy of the GNU General Public License
18725+ along with this program; if not, write to the Free Software
18726+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18727+
18728+
18729+
18730+/* elfos.h should have already been included. Now just override
18731+ any conflicting definitions and add any extras. */
18732+
18733+/* Run-time Target Specification. */
18734+#undef TARGET_VERSION
18735+#define TARGET_VERSION fputs (" (AVR32 GNU/Linux with ELF)", stderr);
18736+
18737+/* Do not assume anything about header files. */
18738+#define NO_IMPLICIT_EXTERN_C
18739+
18740+/* The GNU C++ standard library requires that these macros be defined. */
18741+#undef CPLUSPLUS_CPP_SPEC
18742+#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
18743+
18744+/* Now we define the strings used to build the spec file. */
18745+#undef LIB_SPEC
18746+#define LIB_SPEC \
18747+ "%{pthread:-lpthread} \
18748+ %{shared:-lc} \
18749+ %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
18750+
18751+/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
18752+ the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
18753+ provides part of the support for getting C++ file-scope static
18754+ object constructed before entering `main'. */
18755+
18756+#undef STARTFILE_SPEC
18757+#define STARTFILE_SPEC \
18758+ "%{!shared: \
18759+ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
18760+ %{!p:%{profile:gcrt1.o%s} \
18761+ %{!profile:crt1.o%s}}}} \
18762+ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
18763+
18764+/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
18765+ the GNU/Linux magical crtend.o file (see crtstuff.c) which
18766+ provides part of the support for getting C++ file-scope static
18767+ object constructed before entering `main', followed by a normal
18768+ GNU/Linux "finalizer" file, `crtn.o'. */
18769+
18770+#undef ENDFILE_SPEC
18771+#define ENDFILE_SPEC \
18772+ "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
18773+
18774+#undef ASM_SPEC
18775+#define ASM_SPEC "%{!mno-pic:--pic} %{mrelax|O*:%{mno-relax|O0|O1: ;:--linkrelax}} %{mcpu=*:-mcpu=%*}"
18776+
18777+#undef LINK_SPEC
18778+#define LINK_SPEC "%{version:-v} \
18779+ %{static:-Bstatic} \
18780+ %{shared:-shared} \
18781+ %{symbolic:-Bsymbolic} \
18782+ %{rdynamic:-export-dynamic} \
18783+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
18784+ %{mrelax|O*:%{mno-relax|O0|O1: ;:--relax}}"
18785+
18786+#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
18787+
18788+/* This is how we tell the assembler that two symbols have the same value. */
18789+#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
18790+ do \
18791+ { \
18792+ assemble_name (FILE, NAME1); \
18793+ fputs (" = ", FILE); \
18794+ assemble_name (FILE, NAME2); \
18795+ fputc ('\n', FILE); \
18796+ } \
18797+ while (0)
18798+
18799+
18800+
18801+#undef CC1_SPEC
18802+#define CC1_SPEC "%{profile:-p}"
18803+
18804+/* Target CPU builtins. */
18805+#define TARGET_CPU_CPP_BUILTINS() \
18806+ do \
18807+ { \
18808+ builtin_define ("__avr32__"); \
18809+ builtin_define ("__AVR32__"); \
18810+ builtin_define ("__AVR32_LINUX__"); \
18811+ builtin_define (avr32_part->macro); \
18812+ builtin_define (avr32_arch->macro); \
18813+ if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A) \
18814+ builtin_define ("__AVR32_AVR32A__"); \
18815+ else \
18816+ builtin_define ("__AVR32_AVR32B__"); \
18817+ if (TARGET_UNALIGNED_WORD) \
18818+ builtin_define ("__AVR32_HAS_UNALIGNED_WORD__"); \
18819+ if (TARGET_SIMD) \
18820+ builtin_define ("__AVR32_HAS_SIMD__"); \
18821+ if (TARGET_DSP) \
18822+ builtin_define ("__AVR32_HAS_DSP__"); \
18823+ if (TARGET_RMW) \
18824+ builtin_define ("__AVR32_HAS_RMW__"); \
18825+ if (TARGET_BRANCH_PRED) \
18826+ builtin_define ("__AVR32_HAS_BRANCH_PRED__"); \
18827+ if (flag_pic) \
18828+ { \
18829+ builtin_define ("__PIC__"); \
18830+ builtin_define ("__pic__"); \
18831+ } \
18832+ } \
18833+ while (0)
18834+
18835+
18836+
18837+/* Call the function profiler with a given profile label. */
18838+#undef FUNCTION_PROFILER
18839+#define FUNCTION_PROFILER(STREAM, LABELNO) \
18840+ do \
18841+ { \
18842+ fprintf (STREAM, "\tmov\tlr, lo(mcount)\n\torh\tlr, hi(mcount)\n"); \
18843+ fprintf (STREAM, "\ticall lr\n"); \
18844+ } \
18845+ while (0)
18846+
18847+#define NO_PROFILE_COUNTERS 1
18848+
18849+/* For dynamic libraries to work */
18850+/* #define PLT_REG_CALL_CLOBBERED 1 */
18851+#define AVR32_ALWAYS_PIC 1
18852+
18853+/* uclibc does not implement sinf, cosf etc. */
18854+#undef TARGET_C99_FUNCTIONS
18855+#define TARGET_C99_FUNCTIONS 0
18856+
18857+#define LINK_GCC_C_SEQUENCE_SPEC \
18858+ "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
18859diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/predicates.md gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/predicates.md
18860--- gcc-4.0.2/gcc/config/avr32/predicates.md 1970-01-01 01:00:00.000000000 +0100
18861+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/predicates.md 2006-11-09 15:01:19.000000000 +0100
18862@@ -0,0 +1,303 @@
18863+;; AVR32 predicates file.
18864+;; Copyright 2003-2006 Atmel Corporation.
18865+;;
18866+;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
18867+;;
18868+;; This file is part of GCC.
18869+;;
18870+;; This program is free software; you can redistribute it and/or modify
18871+;; it under the terms of the GNU General Public License as published by
18872+;; the Free Software Foundation; either version 2 of the License, or
18873+;; (at your option) any later version.
18874+;;
18875+;; This program is distributed in the hope that it will be useful,
18876+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18877+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18878+;; GNU General Public License for more details.
18879+;;
18880+;; You should have received a copy of the GNU General Public License
18881+;; along with this program; if not, write to the Free Software
18882+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18883+
18884+
18885+;; True if the operand is a memory reference which contains an
18886+;; Address consisting of a single pointer register
18887+(define_predicate "avr32_indirect_register_operand"
18888+ (and (match_code "mem")
18889+ (match_test "register_operand(XEXP(op, 0), SImode)")))
18890+
18891+
18892+
18893+;; Address expression with a base pointer offset with
18894+;; a register displacement
18895+(define_predicate "avr32_indexed_memory_operand"
18896+ (and (match_code "mem")
18897+ (match_test "GET_CODE(XEXP(op, 0)) == PLUS"))
18898+ {
18899+
18900+ rtx op0 = XEXP(XEXP(op, 0), 0);
18901+ rtx op1 = XEXP(XEXP(op, 0), 1);
18902+
18903+ return ((avr32_address_register_rtx_p (op0, 0)
18904+ && avr32_legitimate_index_p (GET_MODE(op), op1, 0))
18905+ || (avr32_address_register_rtx_p (op1, 0)
18906+ && avr32_legitimate_index_p (GET_MODE(op), op0, 0)));
18907+
18908+ })
18909+
18910+;; Operand suitable for the ld.sb instruction
18911+(define_predicate "load_sb_memory_operand"
18912+ (ior (match_operand 0 "avr32_indirect_register_operand")
18913+ (match_operand 0 "avr32_indexed_memory_operand")))
18914+
18915+
18916+;; Operand suitable as operand to insns sign extending QI values
18917+(define_predicate "extendqi_operand"
18918+ (ior (match_operand 0 "load_sb_memory_operand")
18919+ (match_operand 0 "register_operand")))
18920+
18921+(define_predicate "post_inc_memory_operand"
18922+ (and (match_code "mem")
18923+ (match_test "(GET_CODE(XEXP(op, 0)) == POST_INC)
18924+ && REG_P(XEXP(XEXP(op, 0), 0))")))
18925+
18926+;; Operand suitable for loading TImode values
18927+(define_predicate "loadti_operand"
18928+ (ior (ior (match_operand 0 "register_operand")
18929+ (match_operand 0 "avr32_indirect_register_operand"))
18930+ (match_operand 0 "post_inc_memory_operand")))
18931+
18932+;; Operand suitable for add instructions
18933+(define_predicate "avr32_add_operand"
18934+ (ior (match_operand 0 "register_operand")
18935+ (and (match_operand 0 "immediate_operand")
18936+ (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'I', \"Is21\")"))))
18937+
18938+;; Operand is a power of two immediate
18939+(define_predicate "power_of_two_operand"
18940+ (match_code "const_int")
18941+{
18942+ HOST_WIDE_INT value = INTVAL (op);
18943+
18944+ return value != 0 && (value & (value - 1)) == 0;
18945+})
18946+
18947+;; Operand is a multiple of 8 immediate
18948+(define_predicate "multiple_of_8_operand"
18949+ (match_code "const_int")
18950+{
18951+ HOST_WIDE_INT value = INTVAL (op);
18952+
18953+ return (value & 0x7) == 0 ;
18954+})
18955+
18956+;; Operand is a multiple of 16 immediate
18957+(define_predicate "multiple_of_16_operand"
18958+ (match_code "const_int")
18959+{
18960+ HOST_WIDE_INT value = INTVAL (op);
18961+
18962+ return (value & 0xf) == 0 ;
18963+})
18964+
18965+;; Operand is a mask used for masking away upper bits of a reg
18966+(define_predicate "avr32_mask_upper_bits_operand"
18967+ (match_code "const_int")
18968+{
18969+ HOST_WIDE_INT value = INTVAL (op) + 1;
18970+
18971+ return value != 1 && value != 0 && (value & (value - 1)) == 0;
18972+})
18973+
18974+
18975+;; Operand suitable for mul instructions
18976+(define_predicate "avr32_mul_operand"
18977+ (ior (match_operand 0 "register_operand")
18978+ (and (match_operand 0 "immediate_operand")
18979+ (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'K', \"Ks08\")"))))
18980+
18981+;; True for logical binary operators.
18982+(define_predicate "logical_binary_operator"
18983+ (match_code "ior,xor,and"))
18984+
18985+;; True for logical shift operators
18986+(define_predicate "logical_shift_operator"
18987+ (match_code "ashift,lshiftrt"))
18988+
18989+;; True for shift operand for logical and, or and eor insns
18990+(define_predicate "avr32_logical_shift_operand"
18991+ (and (match_code "ashift,lshiftrt")
18992+ (ior (and (match_test "GET_CODE(XEXP(op, 1)) == CONST_INT")
18993+ (match_test "register_operand(XEXP(op, 0), GET_MODE(XEXP(op, 0)))"))
18994+ (and (match_test "GET_CODE(XEXP(op, 0)) == CONST_INT")
18995+ (match_test "register_operand(XEXP(op, 1), GET_MODE(XEXP(op, 1)))"))))
18996+ {
18997+ return 1;
18998+ }
18999+ )
19000+
19001+
19002+;; Predicate for second operand to and, ior and xor insn patterns
19003+(define_predicate "avr32_logical_insn_operand"
19004+ (ior (match_operand 0 "register_operand")
19005+ (match_operand 0 "avr32_logical_shift_operand"))
19006+ {
19007+ return 1;
19008+ }
19009+)
19010+
19011+
19012+;; True for avr32 comparison operators
19013+(define_predicate "avr32_comparison_operator"
19014+ (ior (match_code "eq, ne, gt, ge, lt, le, gtu, geu, ltu, leu")
19015+ (and (match_code "unspec")
19016+ (match_test "(XINT(op, 1) == UNSPEC_COND_MI)
19017+ || (XINT(op, 1) == UNSPEC_COND_PL)"))))
19018+
19019+;; True if this is a const_int with one bit set
19020+(define_predicate "one_bit_set_operand"
19021+ (match_code "const_int")
19022+ {
19023+ int i;
19024+ int value;
19025+ int ones = 0;
19026+
19027+ value = INTVAL(op);
19028+ for ( i = 0 ; i < 32; i++ ){
19029+ if ( value & ( 1 << i ) ){
19030+ ones++;
19031+ }
19032+ }
19033+
19034+ return ( ones == 1 );
19035+ })
19036+
19037+
19038+;; True if this is a const_int with one bit cleared
19039+(define_predicate "one_bit_cleared_operand"
19040+ (match_code "const_int")
19041+ {
19042+ int i;
19043+ int value;
19044+ int zeroes = 0;
19045+
19046+ value = INTVAL(op);
19047+ for ( i = 0 ; i < 32; i++ ){
19048+ if ( !(value & ( 1 << i )) ){
19049+ zeroes++;
19050+ }
19051+ }
19052+
19053+ return ( zeroes == 1 );
19054+ })
19055+
19056+
19057+;; True if this is a register or immediate operand
19058+(define_predicate "register_immediate_operand"
19059+ (ior (match_operand 0 "register_operand")
19060+ (match_operand 0 "immediate_operand")))
19061+
19062+
19063+;; True is this is an operand containing a label_ref
19064+(define_predicate "avr32_label_ref_operand"
19065+ (and (match_code "mem")
19066+ (match_test "avr32_find_symbol(op)
19067+ && (GET_CODE(avr32_find_symbol(op)) == LABEL_REF)")))
19068+
19069+;; True is this is a valid symbol pointing to the constant pool
19070+(define_predicate "avr32_const_pool_operand"
19071+ (and (match_code "symbol_ref")
19072+ (match_test "CONSTANT_POOL_ADDRESS_P(op)"))
19073+ {
19074+ return (flag_pic ? (!(symbol_mentioned_p (get_pool_constant (op))
19075+ || label_mentioned_p (get_pool_constant (op)))
19076+ || avr32_got_mentioned_p(get_pool_constant (op)))
19077+ : true);
19078+ }
19079+)
19080+
19081+;; True is this is a memory reference to the constant or mini pool
19082+(define_predicate "avr32_const_pool_ref_operand"
19083+ (ior (match_operand 0 "avr32_label_ref_operand")
19084+ (and (match_code "mem")
19085+ (match_test "avr32_const_pool_operand(XEXP(op,0), GET_MODE(XEXP(op,0)))"))))
19086+
19087+
19088+
19089+;; True is this is a k12 offseted memory operand
19090+(define_predicate "avr32_k12_memory_operand"
19091+ (and (match_code "mem")
19092+ (ior (match_test "REG_P(XEXP(op, 0))")
19093+ (match_test "GET_CODE(XEXP(op, 0)) == PLUS
19094+ && REG_P(XEXP(XEXP(op, 0), 0))
19095+ && (GET_CODE(XEXP(XEXP(op, 0), 1)) == CONST_INT)
19096+ && (CONST_OK_FOR_CONSTRAINT_P(INTVAL(XEXP(XEXP(op, 0), 0)),
19097+ 'K', (mode == SImode) ? \"Ks14\" : ((mode == HImode) ? \"Ks13\" : \"Ks12\")))"))))
19098+
19099+;; True is this is a memory operand with an immediate displacement
19100+(define_predicate "avr32_imm_disp_memory_operand"
19101+ (and (match_code "mem")
19102+ (match_test "GET_CODE(XEXP(op, 0)) == PLUS
19103+ && REG_P(XEXP(XEXP(op, 0), 0))
19104+ && (GET_CODE(XEXP(XEXP(op, 0), 1)) == CONST_INT)")))
19105+
19106+;; True is this is a bswap operand
19107+(define_predicate "avr32_bswap_operand"
19108+ (ior (match_operand 0 "avr32_k12_memory_operand")
19109+ (match_operand 0 "register_operand")))
19110+
19111+;; True is this is a valid coprocessor insn memory operand
19112+(define_predicate "avr32_cop_memory_operand"
19113+ (and (match_operand 0 "memory_operand")
19114+ (not (match_test "GET_CODE(XEXP(op, 0)) == PLUS
19115+ && REG_P(XEXP(XEXP(op, 0), 0))
19116+ && (GET_CODE(XEXP(XEXP(op, 0), 1)) == CONST_INT)
19117+ && !(CONST_OK_FOR_CONSTRAINT_P(INTVAL(XEXP(XEXP(op, 0), 0)), 'K', \"Ku10\"))"))))
19118+
19119+;; True is this is a valid source/destination operand
19120+;; for moving values to/from a coprocessor
19121+(define_predicate "avr32_cop_move_operand"
19122+ (ior (match_operand 0 "register_operand")
19123+ (match_operand 0 "avr32_cop_memory_operand")))
19124+
19125+
19126+;; True is this is a valid extract byte offset for use in
19127+;; load extracted index insns
19128+(define_predicate "avr32_extract_shift_operand"
19129+ (and (match_operand 0 "const_int_operand")
19130+ (match_test "(INTVAL(op) == 0) || (INTVAL(op) == 8)
19131+ || (INTVAL(op) == 16) || (INTVAL(op) == 24)")))
19132+
19133+;; True is this is a floating-point register
19134+(define_predicate "avr32_fp_register_operand"
19135+ (and (match_operand 0 "register_operand")
19136+ (match_test "REGNO_REG_CLASS(REGNO(op)) == FP_REGS")))
19137+
19138+;; True is this is valid avr32 symbol operand
19139+(define_predicate "avr32_symbol_operand"
19140+ (ior (match_code "label_ref, symbol_ref")
19141+ (and (match_code "const")
19142+ (match_test "avr32_find_symbol(op)"))))
19143+
19144+;; True is this is valid operand for the lda.w and call pseudo insns
19145+(define_predicate "avr32_address_operand"
19146+ (and (match_code "label_ref, symbol_ref")
19147+ (ior (match_test "TARGET_HAS_ASM_ADDR_PSEUDOS")
19148+ (match_test "flag_pic")) ))
19149+
19150+;; True if this is a avr32 call operand
19151+(define_predicate "avr32_call_operand"
19152+ (ior (ior (match_operand 0 "register_operand")
19153+ (ior (match_operand 0 "avr32_const_pool_ref_operand")
19154+ (match_operand 0 "avr32_address_operand")))
19155+ (match_test "SYMBOL_REF_RCALL_FUNCTION_P(op)")))
19156+
19157+;; Return true for operators performing ALU operations
19158+
19159+(define_predicate "alu_operator"
19160+ (match_code "ior, xor, and, plus, minus, ashift, lshiftrt, ashiftrt"))
19161+
19162+(define_predicate "avr32_add_shift_immediate_operand"
19163+ (and (match_operand 0 "immediate_operand")
19164+ (match_test "CONST_OK_FOR_CONSTRAINT_P(INTVAL(op), 'K', \"Ku02\")")))
19165+
19166diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/simd.md gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/simd.md
19167--- gcc-4.0.2/gcc/config/avr32/simd.md 1970-01-01 01:00:00.000000000 +0100
19168+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/simd.md 2006-10-10 12:36:34.000000000 +0200
19169@@ -0,0 +1,145 @@
19170+;; AVR32 machine description file for SIMD instructions.
19171+;; Copyright 2003-2006 Atmel Corporation.
19172+;;
19173+;; Written by Ronny Pedersen, Atmel Norway, <rpedersen@atmel.com>
19174+;;
19175+;; This file is part of GCC.
19176+;;
19177+;; This program is free software; you can redistribute it and/or modify
19178+;; it under the terms of the GNU General Public License as published by
19179+;; the Free Software Foundation; either version 2 of the License, or
19180+;; (at your option) any later version.
19181+;;
19182+;; This program is distributed in the hope that it will be useful,
19183+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19184+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19185+;; GNU General Public License for more details.
19186+;;
19187+;; You should have received a copy of the GNU General Public License
19188+;; along with this program; if not, write to the Free Software
19189+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19190+
19191+;; -*- Mode: Scheme -*-
19192+
19193+
19194+;; Vector modes
19195+(define_mode_macro VECM [V2HI V4QI])
19196+(define_mode_attr size [(V2HI "h") (V4QI "b")])
19197+
19198+(define_insn "add<mode>3"
19199+ [(set (match_operand:VECM 0 "register_operand" "=r")
19200+ (plus:VECM (match_operand:VECM 1 "register_operand" "r")
19201+ (match_operand:VECM 2 "register_operand" "r")))]
19202+ "TARGET_SIMD"
19203+ "padd.<size>\t%0, %1, %2"
19204+ [(set_attr "length" "4")
19205+ (set_attr "type" "alu")])
19206+
19207+
19208+(define_insn "sub<mode>3"
19209+ [(set (match_operand:VECM 0 "register_operand" "=r")
19210+ (minus:VECM (match_operand:VECM 1 "register_operand" "r")
19211+ (match_operand:VECM 2 "register_operand" "r")))]
19212+ "TARGET_SIMD"
19213+ "psub.<size>\t%0, %1, %2"
19214+ [(set_attr "length" "4")
19215+ (set_attr "type" "alu")])
19216+
19217+
19218+(define_insn "abs<mode>2"
19219+ [(set (match_operand:VECM 0 "register_operand" "=r")
19220+ (abs:VECM (match_operand:VECM 1 "register_operand" "r")))]
19221+ "TARGET_SIMD"
19222+ "pabs.s<size>\t%0, %1"
19223+ [(set_attr "length" "4")
19224+ (set_attr "type" "alu")])
19225+
19226+(define_insn "ashl<mode>3"
19227+ [(set (match_operand:VECM 0 "register_operand" "=r")
19228+ (ashift:VECM (match_operand:VECM 1 "register_operand" "r")
19229+ (match_operand:SI 2 "immediate_operand" "Ku04")))]
19230+ "TARGET_SIMD"
19231+ "plsl.<size>\t%0, %1, %2"
19232+ [(set_attr "length" "4")
19233+ (set_attr "type" "alu")])
19234+
19235+(define_insn "ashr<mode>3"
19236+ [(set (match_operand:VECM 0 "register_operand" "=r")
19237+ (ashiftrt:VECM (match_operand:VECM 1 "register_operand" "r")
19238+ (match_operand:SI 2 "immediate_operand" "Ku04")))]
19239+ "TARGET_SIMD"
19240+ "pasr.<size>\t%0, %1, %2"
19241+ [(set_attr "length" "4")
19242+ (set_attr "type" "alu")])
19243+
19244+(define_insn "lshr<mode>3"
19245+ [(set (match_operand:VECM 0 "register_operand" "=r")
19246+ (lshiftrt:VECM (match_operand:VECM 1 "register_operand" "r")
19247+ (match_operand:SI 2 "immediate_operand" "Ku04")))]
19248+ "TARGET_SIMD"
19249+ "plsr.<size>\t%0, %1, %2"
19250+ [(set_attr "length" "4")
19251+ (set_attr "type" "alu")])
19252+
19253+(define_insn "smaxv2hi3"
19254+ [(set (match_operand:V2HI 0 "register_operand" "=r")
19255+ (smax:V2HI (match_operand:V2HI 1 "register_operand" "r")
19256+ (match_operand:V2HI 2 "register_operand" "r")))]
19257+
19258+ "TARGET_SIMD"
19259+ "pmax.sh\t%0, %1, %2"
19260+ [(set_attr "length" "4")
19261+ (set_attr "type" "alu")])
19262+
19263+(define_insn "sminv2hi3"
19264+ [(set (match_operand:V2HI 0 "register_operand" "=r")
19265+ (smin:V2HI (match_operand:V2HI 1 "register_operand" "r")
19266+ (match_operand:V2HI 2 "register_operand" "r")))]
19267+
19268+ "TARGET_SIMD"
19269+ "pmin.sh\t%0, %1, %2"
19270+ [(set_attr "length" "4")
19271+ (set_attr "type" "alu")])
19272+
19273+(define_insn "umaxv4qi3"
19274+ [(set (match_operand:V4QI 0 "register_operand" "=r")
19275+ (umax:V4QI (match_operand:V4QI 1 "register_operand" "r")
19276+ (match_operand:V4QI 2 "register_operand" "r")))]
19277+
19278+ "TARGET_SIMD"
19279+ "pmax.ub\t%0, %1, %2"
19280+ [(set_attr "length" "4")
19281+ (set_attr "type" "alu")])
19282+
19283+(define_insn "uminv4qi3"
19284+ [(set (match_operand:V4QI 0 "register_operand" "=r")
19285+ (umin:V4QI (match_operand:V4QI 1 "register_operand" "r")
19286+ (match_operand:V4QI 2 "register_operand" "r")))]
19287+
19288+ "TARGET_SIMD"
19289+ "pmin.ub\t%0, %1, %2"
19290+ [(set_attr "length" "4")
19291+ (set_attr "type" "alu")])
19292+
19293+
19294+(define_insn "addsubv2hi"
19295+ [(set (match_operand:V2HI 0 "register_operand" "=r")
19296+ (vec_concat:V2HI
19297+ (plus:HI (match_operand:HI 1 "register_operand" "r")
19298+ (match_operand:HI 2 "register_operand" "r"))
19299+ (minus:HI (match_dup 1) (match_dup 2))))]
19300+ "TARGET_SIMD"
19301+ "paddsub.h\t%0, %1:b, %2:b"
19302+ [(set_attr "length" "4")
19303+ (set_attr "type" "alu")])
19304+
19305+(define_insn "subaddv2hi"
19306+ [(set (match_operand:V2HI 0 "register_operand" "=r")
19307+ (vec_concat:V2HI
19308+ (minus:HI (match_operand:HI 1 "register_operand" "r")
19309+ (match_operand:HI 2 "register_operand" "r"))
19310+ (plus:HI (match_dup 1) (match_dup 2))))]
19311+ "TARGET_SIMD"
19312+ "psubadd.h\t%0, %1:b, %2:b"
19313+ [(set_attr "length" "4")
19314+ (set_attr "type" "alu")])
19315diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/t-avr32 gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/t-avr32
19316--- gcc-4.0.2/gcc/config/avr32/t-avr32 1970-01-01 01:00:00.000000000 +0100
19317+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/t-avr32 2006-11-24 17:10:48.000000000 +0100
19318@@ -0,0 +1,63 @@
19319+
19320+MD_INCLUDES= $(srcdir)/config/avr32/avr32.md \
19321+ $(srcdir)/config/avr32/fpcp.md \
19322+ $(srcdir)/config/avr32/simd.md \
19323+ $(srcdir)/config/avr32/predicates.md
19324+
19325+s-config s-conditions s-flags s-codes s-constants s-emit s-recog s-preds \
19326+ s-opinit s-extract s-peep s-attr s-attrtab s-output: $(MD_INCLUDES)
19327+
19328+# We want fine grained libraries, so use the new code
19329+# to build the floating point emulation libraries.
19330+FPBIT = fp-bit.c
19331+DPBIT = dp-bit.c
19332+
19333+LIB1ASMSRC = avr32/lib1funcs.S
19334+LIB1ASMFUNCS = _avr32_f64_mul _avr32_f64_addsub _avr32_f64_to_u32 _avr32_f64_to_s32 \
19335+ _avr32_f64_to_u64 _avr32_f64_to_s64 _avr32_u32_to_f64 _avr32_s32_to_f64 \
19336+ _avr32_f64_cmp_eq _avr32_f64_cmp_ge _avr32_f64_cmp_lt \
19337+ _avr32_f32_cmp_eq _avr32_f32_cmp_ge _avr32_f32_cmp_lt \
19338+ _avr32_f64_div _avr32_f32_div\
19339+ _avr32_f32_mul _avr32_s32_to_f32 _avr32_u32_to_f32 _avr32_f32_to_s32 \
19340+ _avr32_f32_to_u32 _avr32_f32_to_f64 _avr32_f64_to_f32
19341+
19342+LIB2FUNCS_EXTRA += $(srcdir)/config/avr32/lib2funcs.S
19343+
19344+MULTILIB_OPTIONS = march=ap/march=uc
19345+MULTILIB_DIRNAMES = ap uc
19346+MULTILIB_EXCEPTIONS =
19347+MULTILIB_MATCHES = march?ap=mcpu?ap7000
19348+MULTILIB_MATCHES += march?ap=mcpu?ap7010
19349+MULTILIB_MATCHES += march?ap=mcpu?ap7020
19350+MULTILIB_MATCHES += march?uc=mcpu?uc3a0256
19351+MULTILIB_MATCHES += march?uc=mcpu?uc3a0512
19352+MULTILIB_MATCHES += march?uc=mcpu?uc3a1128
19353+MULTILIB_MATCHES += march?uc=mcpu?uc3a1256
19354+MULTILIB_MATCHES += march?uc=mcpu?uc3a1512
19355+MULTILIB_MATCHES += march?ap=mpart?ap7000
19356+MULTILIB_MATCHES += march?ap=mpart?ap7010
19357+MULTILIB_MATCHES += march?ap=mpart?ap7020
19358+MULTILIB_MATCHES += march?uc=mpart?uc3a0256
19359+MULTILIB_MATCHES += march?uc=mpart?uc3a0512
19360+MULTILIB_MATCHES += march?uc=mpart?uc3a1128
19361+MULTILIB_MATCHES += march?uc=mpart?uc3a1256
19362+MULTILIB_MATCHES += march?uc=mpart?uc3a1512
19363+
19364+EXTRA_MULTILIB_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crti.o crtn.o
19365+
19366+CRTSTUFF_T_CFLAGS = -mrelax
19367+CRTSTUFF_T_CFLAGS_S = -mrelax -fPIC
19368+TARGET_LIBGCC2_CFLAGS += -mrelax
19369+
19370+LIBGCC = stmp-multilib
19371+INSTALL_LIBGCC = install-multilib
19372+
19373+fp-bit.c: $(srcdir)/config/fp-bit.c
19374+ echo '#define FLOAT' > fp-bit.c
19375+ cat $(srcdir)/config/fp-bit.c >> fp-bit.c
19376+
19377+dp-bit.c: $(srcdir)/config/fp-bit.c
19378+ cat $(srcdir)/config/fp-bit.c > dp-bit.c
19379+
19380+
19381+
19382diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/t-elf gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/t-elf
19383--- gcc-4.0.2/gcc/config/avr32/t-elf 1970-01-01 01:00:00.000000000 +0100
19384+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/t-elf 2006-03-20 13:59:57.000000000 +0100
19385@@ -0,0 +1,16 @@
19386+
19387+# Assemble startup files.
19388+$(T)crti.o: $(srcdir)/config/avr32/crti.asm $(GCC_PASSES)
19389+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) $(INCLUDES) \
19390+ -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/avr32/crti.asm
19391+
19392+$(T)crtn.o: $(srcdir)/config/avr32/crtn.asm $(GCC_PASSES)
19393+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) $(INCLUDES) \
19394+ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/avr32/crtn.asm
19395+
19396+
19397+# Build the libraries for both hard and soft floating point
19398+EXTRA_MULTILIB_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crti.o crtn.o
19399+
19400+LIBGCC = stmp-multilib
19401+INSTALL_LIBGCC = install-multilib
19402diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/avr32/uclinux-elf.h gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/uclinux-elf.h
19403--- gcc-4.0.2/gcc/config/avr32/uclinux-elf.h 1970-01-01 01:00:00.000000000 +0100
19404+++ gcc-4.0.2-atmel.0.99.2/gcc/config/avr32/uclinux-elf.h 2006-01-04 10:57:09.000000000 +0100
19405@@ -0,0 +1,20 @@
19406+
19407+/* Run-time Target Specification. */
19408+#undef TARGET_VERSION
19409+#define TARGET_VERSION fputs (" (AVR32 uClinux with ELF)", stderr)
19410+
19411+/* We don't want a .jcr section on uClinux. As if this makes a difference... */
19412+#define TARGET_USE_JCR_SECTION 0
19413+
19414+/* Here we go. Drop the crtbegin/crtend stuff completely. */
19415+#undef STARTFILE_SPEC
19416+#define STARTFILE_SPEC \
19417+ "%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s}" \
19418+ " %{!p:%{profile:gcrt1.o%s}" \
19419+ " %{!profile:crt1.o%s}}}} crti.o%s"
19420+
19421+#undef ENDFILE_SPEC
19422+#define ENDFILE_SPEC "crtn.o%s"
19423+
19424+#undef TARGET_DEFAULT
19425+#define TARGET_DEFAULT (AVR32_FLAG_NO_INIT_GOT)
19426diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config/host-linux.c gcc-4.0.2-atmel.0.99.2/gcc/config/host-linux.c
19427--- gcc-4.0.2/gcc/config/host-linux.c 2005-08-01 20:00:10.000000000 +0200
19428+++ gcc-4.0.2-atmel.0.99.2/gcc/config/host-linux.c 2006-03-23 13:33:12.000000000 +0100
19429@@ -26,6 +26,9 @@
19430 #include "hosthooks.h"
19431 #include "hosthooks-def.h"
19432
19433+#ifndef SSIZE_MAX
19434+#define SSIZE_MAX LONG_MAX
19435+#endif
19436
19437 /* Linux has a feature called exec-shield-randomize that perturbs the
19438 address of non-fixed mapped segments by a (relatively) small amount.
19439diff -Nrup --ignore-space-change gcc-4.0.2/gcc/config.gcc gcc-4.0.2-atmel.0.99.2/gcc/config.gcc
19440--- gcc-4.0.2/gcc/config.gcc 2005-08-09 12:57:04.000000000 +0200
19441+++ gcc-4.0.2-atmel.0.99.2/gcc/config.gcc 2006-02-08 17:33:56.000000000 +0100
19442@@ -189,9 +189,6 @@ case ${target} in
19443 | ip2k-*-elf \
19444 | ns32k-*-netbsdelf* \
19445 | ns32k-*-netbsd* \
19446- | c4x-* \
19447- | tic4x-* \
19448- | hppa1.1-*-rtems* \
19449 )
19450 if test "x$enable_obsolete" != xyes; then
19451 echo "*** Configuration ${target} is obsolete." >&2
19452@@ -251,9 +248,6 @@ arm*-*-*)
19453 cpu_type=arm
19454 extra_headers="mmintrin.h"
19455 ;;
19456-bfin*-*)
19457- cpu_type=bfin
19458- ;;
19459 ep9312*-*-*)
19460 cpu_type=arm
19461 ;;
19462@@ -735,6 +729,24 @@ avr-*-*)
19463 tm_file="avr/avr.h dbxelf.h"
19464 use_fixproto=yes
19465 ;;
19466+avr32*-*-linux*)
19467+ tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/avr32.h "
19468+ tmake_file="t-linux avr32/t-avr32 avr32/t-elf"
19469+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
19470+ extra_modes=avr32/avr32-modes.def
19471+ gnu_ld=yes
19472+ ;;
19473+avr32*-*-uclinux*)
19474+ tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/uclinux-elf.h avr32/avr32.h"
19475+ tmake_file="t-linux avr32/t-avr32 avr32/t-elf"
19476+ extra_modes=avr32/avr32-modes.def
19477+ gnu_ld=yes
19478+ ;;
19479+avr32-*-*)
19480+ tm_file="dbxelf.h elfos.h avr32/avr32.h avr32/avr32-elf.h"
19481+ tmake_file="avr32/t-avr32 avr32/t-elf"
19482+ extra_modes=avr32/avr32-modes.def
19483+ ;;
19484 bfin*-elf*)
19485 tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h"
19486 tmake_file=bfin/t-bfin-elf
19487@@ -792,14 +804,10 @@ frv-*-*linux*)
19488 linux.h frv/linux.h frv/frv-abi.h"
19489 tmake_file="${tmake_file} frv/t-frv frv/t-linux"
19490 ;;
19491-h8300-*-rtemscoff*)
19492+h8300-*-rtems*)
19493 tmake_file="h8300/t-h8300 t-rtems h8300/t-rtems"
19494 tm_file="h8300/h8300.h dbxcoff.h h8300/coff.h h8300/rtems.h rtems.h"
19495 ;;
19496-h8300-*-rtems*)
19497- tmake_file="h8300/t-h8300 h8300/t-elf t-rtems h8300/t-rtems"
19498- tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h"
19499- ;;
19500 h8300-*-elf*)
19501 tmake_file="h8300/t-h8300 h8300/t-elf"
19502 tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h"
19503@@ -1560,6 +1568,9 @@ pdp11-*-bsd)
19504 pdp11-*-*)
19505 use_fixproto=yes
19506 ;;
19507+avr-*-*)
19508+ use_fixproto=yes
19509+ ;;
19510 # port not yet contributed
19511 #powerpc-*-openbsd*)
19512 # tmake_file="${tmake_file} rs6000/t-fprules "
19513@@ -2471,6 +2482,21 @@ case "${target}" in
19514 fi
19515 ;;
19516
19517+ avr32*-*-*)
19518+ supported_defaults="cpu"
19519+
19520+ case "$with_cpu" in
19521+ "" \
19522+ | morgan | ap7000 )
19523+ # OK
19524+ ;;
19525+ *)
19526+ echo "Unknown arch used in --with-arch=$with_arch" 1>&2
19527+ exit 1
19528+ ;;
19529+ esac
19530+ ;;
19531+
19532 fr*-*-*linux*)
19533 supported_defaults=cpu
19534 case "$with_cpu" in
19535diff -Nrup --ignore-space-change gcc-4.0.2/gcc/cp/decl.c gcc-4.0.2-atmel.0.99.2/gcc/cp/decl.c
19536--- gcc-4.0.2/gcc/cp/decl.c 2005-09-09 02:51:56.000000000 +0200
19537+++ gcc-4.0.2-atmel.0.99.2/gcc/cp/decl.c 2006-10-03 15:32:50.000000000 +0200
19538@@ -6128,6 +6128,7 @@ compute_array_index_type (tree name, tre
19539 name);
19540 else
19541 error ("size of array is not an integral constant-expression");
19542+ size = integer_one_node;
19543 }
19544 else if (pedantic)
19545 {
19546diff -Nrup --ignore-space-change gcc-4.0.2/gcc/c-typeck.c gcc-4.0.2-atmel.0.99.2/gcc/c-typeck.c
19547--- gcc-4.0.2/gcc/c-typeck.c 2005-09-06 22:10:50.000000000 +0200
19548+++ gcc-4.0.2-atmel.0.99.2/gcc/c-typeck.c 2006-10-03 15:32:50.000000000 +0200
19549@@ -2742,8 +2742,13 @@ build_unary_op (enum tree_code code, tre
19550 when we have proper support for integer constant expressions. */
19551 val = get_base_address (arg);
19552 if (val && TREE_CODE (val) == INDIRECT_REF
19553- && integer_zerop (TREE_OPERAND (val, 0)))
19554- return fold_convert (argtype, fold_offsetof (arg));
19555+ && TREE_CONSTANT (TREE_OPERAND (val, 0)))
19556+ {
19557+ tree op0 = fold_convert (argtype, fold_offsetof (arg)), op1;
19558+
19559+ op1 = fold_convert (argtype, TREE_OPERAND (val, 0));
19560+ return fold (build2 (PLUS_EXPR, argtype, op0, op1));
19561+ }
19562
19563 val = build1 (ADDR_EXPR, argtype, arg);
19564
19565diff -Nrup --ignore-space-change gcc-4.0.2/gcc/doc/extend.texi gcc-4.0.2-atmel.0.99.2/gcc/doc/extend.texi
19566--- gcc-4.0.2/gcc/doc/extend.texi 2005-07-20 12:36:23.000000000 +0200
19567+++ gcc-4.0.2-atmel.0.99.2/gcc/doc/extend.texi 2006-06-19 13:14:00.000000000 +0200
19568@@ -1723,13 +1723,6 @@ on data in the eight bit data area. Not
19569 You must use GAS and GLD from GNU binutils version 2.7 or later for
19570 this attribute to work correctly.
19571
19572-@item exception_handler
19573-@cindex exception handler functions on the Blackfin processor
19574-Use this attribute on the Blackfin to indicate that the specified function
19575-is an exception handler. The compiler will generate function entry and
19576-exit sequences suitable for use in an exception handler when this
19577-attribute is present.
19578-
19579 @item far
19580 @cindex functions which handle memory bank switching
19581 On 68HC11 and 68HC12 the @code{far} attribute causes the compiler to
19582@@ -1873,13 +1866,13 @@ this attribute to work correctly.
19583
19584 @item interrupt
19585 @cindex interrupt handler functions
19586-Use this attribute on the ARM, AVR, C4x, M32R/D and Xstormy16 ports to indicate
19587+Use this attribute on the ARM, AVR, AVR32, C4x, M32R/D and Xstormy16 ports to indicate
19588 that the specified function is an interrupt handler. The compiler will
19589 generate function entry and exit sequences suitable for use in an
19590 interrupt handler when this attribute is present.
19591
19592-Note, interrupt handlers for the Blackfin, m68k, H8/300, H8/300H, H8S, and
19593-SH processors can be specified via the @code{interrupt_handler} attribute.
19594+Note, interrupt handlers for the m68k, H8/300, H8/300H, H8S, and SH processors
19595+can be specified via the @code{interrupt_handler} attribute.
19596
19597 Note, on the AVR, interrupts will be enabled inside the function.
19598
19599@@ -1892,18 +1885,21 @@ void f () __attribute__ ((interrupt ("IR
19600
19601 Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF@.
19602
19603-@item interrupt_handler
19604-@cindex interrupt handler functions on the Blackfin, m68k, H8/300 and SH processors
19605-Use this attribute on the Blackfin, m68k, H8/300, H8/300H, H8S, and SH to
19606-indicate that the specified function is an interrupt handler. The compiler
19607-will generate function entry and exit sequences suitable for use in an
19608-interrupt handler when this attribute is present.
19609+Note, for the AVR32, you can specify which banking scheme is used for
19610+the interrupt mode this interrupt handler is used in like this:
19611+
19612+@smallexample
19613+void f () __attribute__ ((interrupt ("FULL")));
19614+@end smallexample
19615
19616-@item kspisusp
19617-@cindex User stack pointer in interrupts on the Blackfin
19618-When used together with @code{interrupt_handler}, @code{exception_handler}
19619-or @code{nmi_handler}, code will be generated to load the stack pointer
19620-from the USP register in the function prologue.
19621+Permissible values for this parameter are: FULL, HALF, NONE and UNDEF.
19622+
19623+@item interrupt_handler
19624+@cindex interrupt handler functions on the m68k, H8/300 and SH processors
19625+Use this attribute on the m68k, H8/300, H8/300H, H8S, and SH to indicate that
19626+the specified function is an interrupt handler. The compiler will generate
19627+function entry and exit sequences suitable for use in an interrupt
19628+handler when this attribute is present.
19629
19630 @item long_call/short_call
19631 @cindex indirect calls on ARM
19632@@ -1983,19 +1979,6 @@ use the normal calling convention based
19633 This attribute can be used to cancel the effect of the @option{-mlong-calls}
19634 option.
19635
19636-@item nesting
19637-@cindex Allow nesting in an interrupt handler on the Blackfin processor.
19638-Use this attribute together with @code{interrupt_handler},
19639-@code{exception_handler} or @code{nmi_handler} to indicate that the function
19640-entry code should enable nested interrupts or exceptions.
19641-
19642-@item nmi_handler
19643-@cindex NMI handler functions on the Blackfin processor
19644-Use this attribute on the Blackfin to indicate that the specified function
19645-is an NMI handler. The compiler will generate function entry and
19646-exit sequences suitable for use in an NMI handler when this
19647-attribute is present.
19648-
19649 @item no_instrument_function
19650 @cindex @code{no_instrument_function} function attribute
19651 @opindex finstrument-functions
19652@@ -2140,8 +2123,8 @@ disabled with the linker or the loader i
19653 problem.)
19654
19655 @item saveall
19656-@cindex save all registers on the Blackfin, H8/300, H8/300H, and H8S
19657-Use this attribute on the Blackfin, H8/300, H8/300H, and H8S to indicate that
19658+@cindex save all registers on the H8/300, H8/300H, and H8S
19659+Use this attribute on the H8/300, H8/300H, and H8S to indicate that
19660 all registers except the stack pointer should be saved in the prologue
19661 regardless of whether they are used or not.
19662
19663@@ -3221,7 +3204,7 @@ struct my_unpacked_struct
19664 int i;
19665 @};
19666
19667-struct __attribute__ ((__packed__)) my_packed_struct
19668+struct my_packed_struct __attribute__ ((__packed__))
19669 @{
19670 char c;
19671 int i;
19672@@ -5449,6 +5432,7 @@ instructions, but allow the compiler to
19673 @menu
19674 * Alpha Built-in Functions::
19675 * ARM Built-in Functions::
19676+* AVR32 Built-in Functions::
19677 * Blackfin Built-in Functions::
19678 * FR-V Built-in Functions::
19679 * X86 Built-in Functions::
19680@@ -5686,6 +5670,54 @@ long long __builtin_arm_wxor (long long,
19681 long long __builtin_arm_wzero ()
19682 @end smallexample
19683
19684+@node AVR32 Built-in Functions
19685+@subsection AVR32 Built-in Functions
19686+
19687+
19688+@smallexample
19689+
19690+int __builtin_sats (int /*Rd*/,int /*sa*/, int /*bn*/)
19691+int __builtin_satu (int /*Rd*/,int /*sa*/, int /*bn*/)
19692+int __builtin_satrnds (int /*Rd*/,int /*sa*/, int /*bn*/)
19693+int __builtin_satrndu (int /*Rd*/,int /*sa*/, int /*bn*/)
19694+short __builtin_mulsathh_h (short, short)
19695+int __builtin_mulsathh_w (short, short)
19696+short __builtin_mulsatrndhh_h (short, short)
19697+int __builtin_mulsatrndwh_w (int, short)
19698+int __builtin_mulsatwh_w (int, short)
19699+int __builtin_macsathh_w (int, short, short)
19700+short __builtin_satadd_h (short, short)
19701+short __builtin_satsub_h (short, short)
19702+int __builtin_satadd_w (int, int)
19703+int __builtin_satsub_w (int, int)
19704+long long __builtin_mulwh_d(int, short)
19705+long long __builtin_mulnwh_d(int, short)
19706+long long __builtin_macwh_d(long long, int, short)
19707+long long __builtin_machh_d(long long, short, short)
19708+
19709+void __builtin_musfr(int);
19710+int __builtin_mustr(void);
19711+int __builtin_mfsr(int /*Status Register Address*/)
19712+void __builtin_mtsr(int /*Status Register Address*/, int /*Value*/)
19713+int __builtin_mfdr(int /*Debug Register Address*/)
19714+void __builtin_mtdr(int /*Debug Register Address*/, int /*Value*/)
19715+void __builtin_cache(void * /*Address*/, int /*Cache Operation*/)
19716+void __builtin_sync(int /*Sync Operation*/)
19717+void __builtin_tlbr(void)
19718+void __builtin_tlbs(void)
19719+void __builtin_tlbw(void)
19720+void __builtin_breakpoint(void)
19721+int __builtin_xchg(void * /*Address*/, int /*Value*/ )
19722+short __builtin_bswap_16(short)
19723+int __builtin_bswap_32(int)
19724+void __builtin_cop(int/*cpnr*/, int/*crd*/, int/*crx*/, int/*cry*/, int/*op*/)
19725+int __builtin_mvcr_w(int/*cpnr*/, int/*crs*/)
19726+void __builtin_mvrc_w(int/*cpnr*/, int/*crd*/, int/*value*/)
19727+long long __builtin_mvcr_d(int/*cpnr*/, int/*crs*/)
19728+void __builtin_mvrc_d(int/*cpnr*/, int/*crd*/, long long/*value*/)
19729+
19730+@end smallexample
19731+
19732 @node Blackfin Built-in Functions
19733 @subsection Blackfin Built-in Functions
19734
19735diff -Nrup --ignore-space-change gcc-4.0.2/gcc/doc/invoke.texi gcc-4.0.2-atmel.0.99.2/gcc/doc/invoke.texi
19736--- gcc-4.0.2/gcc/doc/invoke.texi 2005-09-02 10:12:30.000000000 +0200
19737+++ gcc-4.0.2-atmel.0.99.2/gcc/doc/invoke.texi 2006-02-08 17:33:56.000000000 +0100
19738@@ -185,7 +185,7 @@ in the following sections.
19739 -fno-default-inline -fvisibility-inlines-hidden @gol
19740 -Wabi -Wctor-dtor-privacy @gol
19741 -Wnon-virtual-dtor -Wreorder @gol
19742--Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol
19743+-Weffc++ -Wno-deprecated @gol
19744 -Wno-non-template-friend -Wold-style-cast @gol
19745 -Woverloaded-virtual -Wno-pmf-conversions @gol
19746 -Wsign-promo}
19747@@ -542,6 +542,10 @@ Objective-C and Objective-C++ Dialects}.
19748 -mauto-incdec -minmax -mlong-calls -mshort @gol
19749 -msoft-reg-count=@var{count}}
19750
19751+@emph{AVR32 Options}
19752+@gccoptlist{-muse-rodata-section -mhard-float -msoft-float -mrelax @gol
19753+-muse-oscall -mforce-double-align -mno-init-got -mcpu=@var{cpu}}
19754+
19755 @emph{MCore Options}
19756 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
19757 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
19758@@ -1738,14 +1742,6 @@ to filter out those warnings.
19759 @opindex Wno-deprecated
19760 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
19761
19762-@item -Wstrict-null-sentinel @r{(C++ only)}
19763-@opindex Wstrict-null-sentinel
19764-Warn also about the use of an uncasted @code{NULL} as sentinel. When
19765-compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
19766-to @code{__null}. Although it is a null pointer constant not a null pointer,
19767-it is guaranteed to of the same size as a pointer. But this use is
19768-not portable across different compilers.
19769-
19770 @item -Wno-non-template-friend @r{(C++ only)}
19771 @opindex Wno-non-template-friend
19772 Disable warnings when non-templatized friend functions are declared
19773@@ -2549,13 +2545,11 @@ get these warnings.
19774 If you want to warn about code which uses the uninitialized value of the
19775 variable in its own initializer, use the @option{-Winit-self} option.
19776
19777-These warnings occur for individual uninitialized or clobbered
19778-elements of structure, union or array variables as well as for
19779-variables which are uninitialized or clobbered as a whole. They do
19780-not occur for variables or elements declared @code{volatile}. Because
19781-these warnings depend on optimization, the exact variables or elements
19782-for which there are warnings will depend on the precise optimization
19783-options and version of GCC used.
19784+These warnings occur only for variables that are candidates for
19785+register allocation. Therefore, they do not occur for a variable that
19786+is declared @code{volatile}, or whose address is taken, or whose size
19787+is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
19788+structures, unions or arrays, even when they are in registers.
19789
19790 Note that there may be no warning about a variable that is used only
19791 to compute a value that itself is never used, because such
19792@@ -5584,10 +5578,6 @@ If number of candidates in the set is sm
19793 we always try to remove unnecessary ivs from the set during its
19794 optimization when a new iv is added to the set.
19795
19796-@item scev-max-expr-size
19797-Bound on size of expressions used in the scalar evolutions analyzer.
19798-Large expressions slow the analyzer.
19799-
19800 @item max-iterations-to-track
19801
19802 The maximum number of iterations of a loop the brute force algorithm
19803@@ -6695,7 +6685,7 @@ that macro, which enables you to change
19804 * ARC Options::
19805 * ARM Options::
19806 * AVR Options::
19807-* Blackfin Options::
19808+* AVR32 Options::
19809 * CRIS Options::
19810 * Darwin Options::
19811 * DEC Alpha Options::
19812@@ -7147,81 +7137,55 @@ comply to the C standards, but it will p
19813 size.
19814 @end table
19815
19816-@node Blackfin Options
19817-@subsection Blackfin Options
19818-@cindex Blackfin Options
19819+@node AVR32 Options
19820+@subsection AVR32 Options
19821+@cindex AVR32 Options
19822
19823-@table @gcctabopt
19824-@item -momit-leaf-frame-pointer
19825-@opindex momit-leaf-frame-pointer
19826-Don't keep the frame pointer in a register for leaf functions. This
19827-avoids the instructions to save, set up and restore frame pointers and
19828-makes an extra register available in leaf functions. The option
19829-@option{-fomit-frame-pointer} removes the frame pointer for all functions
19830-which might make debugging harder.
19831+These options are defined for AVR32 implementations:
19832
19833-@item -mspecld-anomaly
19834-@opindex mspecld-anomaly
19835-When enabled, the compiler will ensure that the generated code does not
19836-contain speculative loads after jump instructions. This option is enabled
19837-by default.
19838-
19839-@item -mno-specld-anomaly
19840-@opindex mno-specld-anomaly
19841-Don't generate extra code to prevent speculative loads from occurring.
19842-
19843-@item -mcsync-anomaly
19844-@opindex mcsync-anomaly
19845-When enabled, the compiler will ensure that the generated code does not
19846-contain CSYNC or SSYNC instructions too soon after conditional branches.
19847-This option is enabled by default.
19848-
19849-@item -mno-csync-anomaly
19850-@opindex mno-csync-anomaly
19851-Don't generate extra code to prevent CSYNC or SSYNC instructions from
19852-occurring too soon after a conditional branch.
19853-
19854-@item -mlow-64k
19855-@opindex mlow-64k
19856-When enabled, the compiler is free to take advantage of the knowledge that
19857-the entire program fits into the low 64k of memory.
19858-
19859-@item -mno-low-64k
19860-@opindex mno-low-64k
19861-Assume that the program is arbitrarily large. This is the default.
19862+@table @gcctabopt
19863+@item -muse-rodata-section
19864+@opindex muse-rodata-section
19865+Use section @samp{.rodata} for read-only data instead of @samp{.text}.
19866
19867-@item -mid-shared-library
19868-@opindex mid-shared-library
19869-Generate code that supports shared libraries via the library ID method.
19870-This allows for execute in place and shared libraries in an environment
19871-without virtual memory management. This option implies @option{-fPIC}.
19872+@item -mhard-float
19873+@opindex mhard-float
19874+Use floating-point coprocessor instructions.
19875
19876-@item -mno-id-shared-library
19877-@opindex mno-id-shared-library
19878-Generate code that doesn't assume ID based shared libraries are being used.
19879-This is the default.
19880+@item -msoft-float
19881+@opindex msoft-float
19882+Use software floating-point library.
19883
19884-@item -mshared-library-id=n
19885-@opindex mshared-library-id
19886-Specified the identification number of the ID based shared library being
19887-compiled. Specifying a value of 0 will generate more compact code, specifying
19888-other values will force the allocation of that number to the current
19889-library but is no more space or time efficient than omitting this option.
19890+@item -mrelax
19891+@opindex mrelax
19892+Enable relaxing in linker. This means that when the address of symbols
19893+are known at link time, the linker can optimize @samp{icall} and @samp{mcall}
19894+instructions into a @samp{rcall} instruction if possible. Loading the address
19895+of a symbol can also be optimized.
19896+
19897+@item -muse-oscall
19898+@opindex muse-oscall
19899+When using gcc as a frontend for linking this switch forces the use of
19900+@samp{fake} system calls in the newlib c-library. These fake system
19901+calls are handled by some AVR32 simulators which redirects these calls
19902+to the OS in which the simulator is running. This is practical for
19903+being able to perform file I/O when running programs in a simulator.
19904+
19905+@item -mforce-double-align
19906+@opindex mforce-double-align
19907+Force double-word alignment for double-word memory accesses.
19908+
19909+@item -mno-init-got
19910+@opindex mno-init-got
19911+Do not initialize the GOT register before using it when compiling PIC
19912+code.
19913
19914-@item -mlong-calls
19915-@itemx -mno-long-calls
19916-@opindex mlong-calls
19917-@opindex mno-long-calls
19918-Tells the compiler to perform function calls by first loading the
19919-address of the function into a register and then performing a subroutine
19920-call on this register. This switch is needed if the target function
19921-will lie outside of the 24 bit addressing range of the offset based
19922-version of subroutine call instruction.
19923+@item -mcpu=@var{cpu-type}
19924+@opindex mcpu
19925+Generate code for the specified cpu. Permissible names are: @samp{morgan},
19926+@samp{ap7000} and @samp{default}. @samp{default} is a dummy cpu which
19927+allows all avr32 instructions.
19928
19929-This feature is not enabled by default. Specifying
19930-@option{-mno-long-calls} will restore the default behavior. Note these
19931-switches have no effect on how the compiler generates code to handle
19932-function calls via function pointers.
19933 @end table
19934
19935 @node CRIS Options
19936@@ -10853,6 +10817,7 @@ conventions that adheres to the March 19
19937 Application Binary Interface, PowerPC processor supplement. This is the
19938 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
19939
19940+
19941 @item -mcall-sysv-eabi
19942 @opindex mcall-sysv-eabi
19943 Specify both @option{-mcall-sysv} and @option{-meabi} options.
19944diff -Nrup --ignore-space-change gcc-4.0.2/gcc/doc/md.texi gcc-4.0.2-atmel.0.99.2/gcc/doc/md.texi
19945--- gcc-4.0.2/gcc/doc/md.texi 2005-08-14 01:56:45.000000000 +0200
19946+++ gcc-4.0.2-atmel.0.99.2/gcc/doc/md.texi 2006-07-13 09:53:31.000000000 +0200
19947@@ -3,6 +3,7 @@
19948 @c This is part of the GCC manual.
19949 @c For copying conditions, see the file gcc.texi.
19950
19951+
19952 @ifset INTERNALS
19953 @node Machine Desc
19954 @chapter Machine Descriptions
19955@@ -1683,6 +1684,59 @@ A memory reference suitable for iWMMXt l
19956 A memory reference suitable for the ARMv4 ldrsb instruction.
19957 @end table
19958
19959+@item AVR32 family---@file{avr32.h}
19960+@table @code
19961+@item f
19962+Floating-point registers (f0 to f15)
19963+
19964+@item Ku@var{bits}
19965+Unsigned constant representable with @var{bits} number of bits (Must be
19966+two digits). I.e: An unsigned 8-bit constant is written as @samp{Ku08}
19967+
19968+@item Ks@var{bits}
19969+Signed constant representable with @var{bits} number of bits (Must be
19970+two digits). I.e: A signed 12-bit constant is written as @samp{Ks12}
19971+
19972+@item Is@var{bits}
19973+The negated range of a signed constant representable with @var{bits}
19974+number of bits. The same as @samp{Ks@var{bits}} with a negated range.
19975+This means that the constant must be in the range @math{-2^{bits-1}-1} to @math{2^{bits-1}}
19976+
19977+@item G
19978+A single/double precision floating-point immediate or 64-bit integer
19979+immediate where the least and most significant words both can be
19980+loaded with a move instruction. That is the the integer form of the
19981+values in the least and most significant words both are in the range
19982+@math{-2^{20}} to @math{2^{20}-1}.
19983+
19984+@item RKs@var{bits}
19985+A memory reference where the address consists of a base register
19986+plus a signed immediate displacement with range given by @samp{Ks@var{bits}}
19987+which has the same format as for the signed immediate integer constraint
19988+given above.
19989+
19990+@item RKu@var{bits}
19991+A memory reference where the address consists of a base register
19992+plus an unsigned immediate displacement with range given by @samp{Ku@var{bits}}
19993+which has the same format as for the unsigned immediate integer constraint
19994+given above.
19995+
19996+@item S
19997+A memory reference with an immediate or register offset
19998+
19999+@item T
20000+A memory reference to a constant pool entry
20001+
20002+@item W
20003+A valid operand for use in the @samp{lda.w} instruction macro when
20004+relaxing is enabled
20005+
20006+@item Z
20007+A memory reference valid for coprocessor memory instructions
20008+
20009+@end table
20010+
20011+
20012 @item AVR family---@file{avr.h}
20013 @table @code
20014 @item l
20015@@ -2069,102 +2123,6 @@ range of 1 to 2047.
20016
20017 @end table
20018
20019-@item Blackfin family---@file{bfin.h}
20020-@table @code
20021-@item a
20022-P register
20023-
20024-@item d
20025-D register
20026-
20027-@item z
20028-A call clobbered P register.
20029-
20030-@item D
20031-Even-numbered D register
20032-
20033-@item W
20034-Odd-numbered D register
20035-
20036-@item e
20037-Accumulator register.
20038-
20039-@item A
20040-Even-numbered accumulator register.
20041-
20042-@item B
20043-Odd-numbered accumulator register.
20044-
20045-@item b
20046-I register
20047-
20048-@item B
20049-B register
20050-
20051-@item f
20052-M register
20053-
20054-@item c
20055-Registers used for circular buffering, i.e. I, B, or L registers.
20056-
20057-@item C
20058-The CC register.
20059-
20060-@item x
20061-Any D, P, B, M, I or L register.
20062-
20063-@item y
20064-Additional registers typically used only in prologues and epilogues: RETS,
20065-RETN, RETI, RETX, RETE, ASTAT, SEQSTAT and USP.
20066-
20067-@item w
20068-Any register except accumulators or CC.
20069-
20070-@item Ksh
20071-Signed 16 bit integer (in the range -32768 to 32767)
20072-
20073-@item Kuh
20074-Unsigned 16 bit integer (in the range 0 to 65535)
20075-
20076-@item Ks7
20077-Signed 7 bit integer (in the range -64 to 63)
20078-
20079-@item Ku7
20080-Unsigned 7 bit integer (in the range 0 to 127)
20081-
20082-@item Ku5
20083-Unsigned 5 bit integer (in the range 0 to 31)
20084-
20085-@item Ks4
20086-Signed 4 bit integer (in the range -8 to 7)
20087-
20088-@item Ks3
20089-Signed 3 bit integer (in the range -3 to 4)
20090-
20091-@item Ku3
20092-Unsigned 3 bit integer (in the range 0 to 7)
20093-
20094-@item P@var{n}
20095-Constant @var{n}, where @var{n} is a single-digit constant in the range 0 to 4.
20096-
20097-@item M1
20098-Constant 255.
20099-
20100-@item M2
20101-Constant 65535.
20102-
20103-@item J
20104-An integer constant with exactly a single bit set.
20105-
20106-@item L
20107-An integer constant with all bits set except exactly one.
20108-
20109-@item H
20110-
20111-@item Q
20112-Any SYMBOL_REF.
20113-@end table
20114-
20115 @item IP2K---@file{ip2k.h}
20116 @table @code
20117 @item a
20118diff -Nrup --ignore-space-change gcc-4.0.2/gcc/expr.c gcc-4.0.2-atmel.0.99.2/gcc/expr.c
20119--- gcc-4.0.2/gcc/expr.c 2005-09-10 03:03:28.000000000 +0200
20120+++ gcc-4.0.2-atmel.0.99.2/gcc/expr.c 2006-10-10 12:40:42.000000000 +0200
20121@@ -3314,16 +3314,17 @@ emit_single_push_insn (enum machine_mode
20122 }
20123 else
20124 {
20125+ emit_move_insn (stack_pointer_rtx,
20126+ expand_binop (Pmode,
20127 #ifdef STACK_GROWS_DOWNWARD
20128- /* ??? This seems wrong if STACK_PUSH_CODE == POST_DEC. */
20129- dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
20130- GEN_INT (-(HOST_WIDE_INT) rounded_size));
20131+ sub_optab,
20132 #else
20133- /* ??? This seems wrong if STACK_PUSH_CODE == POST_INC. */
20134- dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
20135- GEN_INT (rounded_size));
20136+ add_optab,
20137 #endif
20138- dest_addr = gen_rtx_PRE_MODIFY (Pmode, stack_pointer_rtx, dest_addr);
20139+ stack_pointer_rtx,
20140+ GEN_INT (rounded_size),
20141+ NULL_RTX, 0, OPTAB_LIB_WIDEN));
20142+ dest_addr = stack_pointer_rtx;
20143 }
20144
20145 dest = gen_rtx_MEM (mode, dest_addr);
20146diff -Nrup --ignore-space-change gcc-4.0.2/gcc/genemit.c gcc-4.0.2-atmel.0.99.2/gcc/genemit.c
20147--- gcc-4.0.2/gcc/genemit.c 2004-09-09 15:22:33.000000000 +0200
20148+++ gcc-4.0.2-atmel.0.99.2/gcc/genemit.c 2006-03-23 13:26:49.000000000 +0100
20149@@ -122,6 +122,24 @@ max_operand_vec (rtx insn, int arg)
20150 }
20151
20152 static void
20153+gen_vararg_prologue(int operands)
20154+{
20155+ int i;
20156+
20157+ if (operands > 1)
20158+ {
20159+ for (i = 1; i < operands; i++)
20160+ printf(" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
20161+
20162+ printf(" va_list args;\n\n");
20163+ printf(" va_start(args, operand0);\n");
20164+ for (i = 1; i < operands; i++)
20165+ printf(" operand%d = va_arg(args, rtx);\n", i);
20166+ printf(" va_end(args);\n\n");
20167+ }
20168+}
20169+
20170+static void
20171 print_code (RTX_CODE code)
20172 {
20173 const char *p1;
20174@@ -406,18 +424,16 @@ gen_insn (rtx insn, int lineno)
20175 fatal ("match_dup operand number has no match_operand");
20176
20177 /* Output the function name and argument declarations. */
20178- printf ("rtx\ngen_%s (", XSTR (insn, 0));
20179+ printf ("rtx\ngen_%s ", XSTR (insn, 0));
20180+
20181 if (operands)
20182- for (i = 0; i < operands; i++)
20183- if (i)
20184- printf (",\n\trtx operand%d ATTRIBUTE_UNUSED", i);
20185+ printf("(rtx operand0 ATTRIBUTE_UNUSED, ...)\n");
20186 else
20187- printf ("rtx operand%d ATTRIBUTE_UNUSED", i);
20188- else
20189- printf ("void");
20190- printf (")\n");
20191+ printf("(void)\n");
20192 printf ("{\n");
20193
20194+ gen_vararg_prologue(operands);
20195+
20196 /* Output code to construct and return the rtl for the instruction body. */
20197
20198 if (XVECLEN (insn, 1) == 1)
20199@@ -457,16 +473,12 @@ gen_expand (rtx expand)
20200 operands = max_operand_vec (expand, 1);
20201
20202 /* Output the function name and argument declarations. */
20203- printf ("rtx\ngen_%s (", XSTR (expand, 0));
20204+ printf ("rtx\ngen_%s ", XSTR (expand, 0));
20205 if (operands)
20206- for (i = 0; i < operands; i++)
20207- if (i)
20208- printf (",\n\trtx operand%d", i);
20209- else
20210- printf ("rtx operand%d", i);
20211+ printf("(rtx operand0 ATTRIBUTE_UNUSED, ...)\n");
20212 else
20213- printf ("void");
20214- printf (")\n");
20215+ printf("(void)\n");
20216+
20217 printf ("{\n");
20218
20219 /* If we don't have any C code to write, only one insn is being written,
20220@@ -476,6 +488,8 @@ gen_expand (rtx expand)
20221 && operands > max_dup_opno
20222 && XVECLEN (expand, 1) == 1)
20223 {
20224+ gen_vararg_prologue(operands);
20225+
20226 printf (" return ");
20227 gen_exp (XVECEXP (expand, 1, 0), DEFINE_EXPAND, NULL);
20228 printf (";\n}\n\n");
20229@@ -489,6 +503,7 @@ gen_expand (rtx expand)
20230 for (; i <= max_scratch_opno; i++)
20231 printf (" rtx operand%d ATTRIBUTE_UNUSED;\n", i);
20232 printf (" rtx _val = 0;\n");
20233+ gen_vararg_prologue(operands);
20234 printf (" start_sequence ();\n");
20235
20236 /* The fourth operand of DEFINE_EXPAND is some code to be executed
20237diff -Nrup --ignore-space-change gcc-4.0.2/gcc/genflags.c gcc-4.0.2-atmel.0.99.2/gcc/genflags.c
20238--- gcc-4.0.2/gcc/genflags.c 2004-09-09 15:22:33.000000000 +0200
20239+++ gcc-4.0.2-atmel.0.99.2/gcc/genflags.c 2006-10-10 12:40:42.000000000 +0200
20240@@ -128,7 +128,6 @@ static void
20241 gen_proto (rtx insn)
20242 {
20243 int num = num_operands (insn);
20244- int i;
20245 const char *name = XSTR (insn, 0);
20246 int truth = maybe_eval_c_test (XSTR (insn, 2));
20247
20248@@ -159,12 +158,7 @@ gen_proto (rtx insn)
20249 if (num == 0)
20250 fputs ("void", stdout);
20251 else
20252- {
20253- for (i = 1; i < num; i++)
20254- fputs ("rtx, ", stdout);
20255-
20256- fputs ("rtx", stdout);
20257- }
20258+ fputs("rtx, ...", stdout);
20259
20260 puts (");");
20261
20262@@ -174,12 +168,7 @@ gen_proto (rtx insn)
20263 {
20264 printf ("static inline rtx\ngen_%s", name);
20265 if (num > 0)
20266- {
20267- putchar ('(');
20268- for (i = 0; i < num-1; i++)
20269- printf ("rtx ARG_UNUSED (%c), ", 'a' + i);
20270- printf ("rtx ARG_UNUSED (%c))\n", 'a' + i);
20271- }
20272+ puts("(rtx ARG_UNUSED(a), ...)");
20273 else
20274 puts ("(void)");
20275 puts ("{\n return 0;\n}");
20276diff -Nrup --ignore-space-change gcc-4.0.2/gcc/genoutput.c gcc-4.0.2-atmel.0.99.2/gcc/genoutput.c
20277--- gcc-4.0.2/gcc/genoutput.c 2004-09-09 15:22:34.000000000 +0200
20278+++ gcc-4.0.2-atmel.0.99.2/gcc/genoutput.c 2006-03-23 13:26:49.000000000 +0100
20279@@ -383,7 +383,7 @@ output_insn_data (void)
20280 }
20281
20282 if (d->name && d->name[0] != '*')
20283- printf (" (insn_gen_fn) gen_%s,\n", d->name);
20284+ printf (" gen_%s,\n", d->name);
20285 else
20286 printf (" 0,\n");
20287
20288diff -Nrup --ignore-space-change gcc-4.0.2/gcc/longlong.h gcc-4.0.2-atmel.0.99.2/gcc/longlong.h
20289--- gcc-4.0.2/gcc/longlong.h 2004-06-15 12:40:44.000000000 +0200
20290+++ gcc-4.0.2-atmel.0.99.2/gcc/longlong.h 2005-06-07 14:59:22.000000000 +0200
20291@@ -227,6 +227,39 @@ UDItype __umulsidi3 (USItype, USItype);
20292 #define UDIV_TIME 100
20293 #endif /* __arm__ */
20294
20295+#if defined (__avr32__) && W_TYPE_SIZE == 32
20296+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
20297+ __asm__ ("add\t%1, %4, %5\n\tadc\t%0, %2, %3" \
20298+ : "=r" ((USItype) (sh)), \
20299+ "=&r" ((USItype) (sl)) \
20300+ : "r" ((USItype) (ah)), \
20301+ "r" ((USItype) (bh)), \
20302+ "r" ((USItype) (al)), \
20303+ "r" ((USItype) (bl)) __CLOBBER_CC)
20304+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
20305+ __asm__ ("sub\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
20306+ : "=r" ((USItype) (sh)), \
20307+ "=&r" ((USItype) (sl)) \
20308+ : "r" ((USItype) (ah)), \
20309+ "r" ((USItype) (bh)), \
20310+ "r" ((USItype) (al)), \
20311+ "r" ((USItype) (bl)) __CLOBBER_CC)
20312+
20313+#define __umulsidi3(a,b) ((UDItype)(a) * (UDItype)(b))
20314+
20315+#define umul_ppmm(w1, w0, u, v) \
20316+{ \
20317+ DWunion __w; \
20318+ __w.ll = __umulsidi3 (u, v); \
20319+ w1 = __w.s.high; \
20320+ w0 = __w.s.low; \
20321+}
20322+
20323+#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
20324+#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
20325+#define COUNT_LEADING_ZEROS_0 32
20326+#endif
20327+
20328 #if defined (__hppa) && W_TYPE_SIZE == 32
20329 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
20330 __asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \
20331diff -Nrup --ignore-space-change gcc-4.0.2/gcc/optabs.h gcc-4.0.2-atmel.0.99.2/gcc/optabs.h
20332--- gcc-4.0.2/gcc/optabs.h 2005-02-12 12:34:21.000000000 +0100
20333+++ gcc-4.0.2-atmel.0.99.2/gcc/optabs.h 2006-10-10 12:40:42.000000000 +0200
20334@@ -389,7 +389,7 @@ extern enum insn_code reload_out_optab[N
20335 extern GTY(()) optab code_to_optab[NUM_RTX_CODE + 1];
20336
20337
20338-typedef rtx (*rtxfun) (rtx);
20339+typedef rtx (*rtxfun) (rtx, ...);
20340
20341 /* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
20342 gives the gen_function to make a branch to test that condition. */
20343Binary files gcc-4.0.2/gcc/po/be.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/be.gmo differ
20344Binary files gcc-4.0.2/gcc/po/ca.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/ca.gmo differ
20345Binary files gcc-4.0.2/gcc/po/da.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/da.gmo differ
20346Binary files gcc-4.0.2/gcc/po/de.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/de.gmo differ
20347Binary files gcc-4.0.2/gcc/po/el.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/el.gmo differ
20348Binary files gcc-4.0.2/gcc/po/es.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/es.gmo differ
20349Binary files gcc-4.0.2/gcc/po/fr.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/fr.gmo differ
20350Binary files gcc-4.0.2/gcc/po/ja.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/ja.gmo differ
20351Binary files gcc-4.0.2/gcc/po/nl.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/nl.gmo differ
20352Binary files gcc-4.0.2/gcc/po/sv.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/sv.gmo differ
20353Binary files gcc-4.0.2/gcc/po/tr.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/tr.gmo differ
20354Binary files gcc-4.0.2/gcc/po/zh_CN.gmo and gcc-4.0.2-atmel.0.99.2/gcc/po/zh_CN.gmo differ
20355diff -Nrup --ignore-space-change gcc-4.0.2/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c gcc-4.0.2-atmel.0.99.2/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c
20356--- gcc-4.0.2/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c 2005-02-19 20:48:02.000000000 +0100
20357+++ gcc-4.0.2-atmel.0.99.2/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c 2005-06-07 14:06:28.000000000 +0200
20358@@ -1 +1,3 @@
20359-/* Test no newline at eof warning when Mac line ending is used*/ /* { dg-do compile } */ int main() { return 0; }
20360\ No newline at end of file
20361+/* Test no newline at eof warning when Mac line ending is used*/
20362+/* { dg-do compile } */
20363+int main() { return 0; }
20364diff -Nrup --ignore-space-change gcc-4.0.2/gcc/tree-ssa-operands.c gcc-4.0.2-atmel.0.99.2/gcc/tree-ssa-operands.c
20365--- gcc-4.0.2/gcc/tree-ssa-operands.c 2005-06-24 15:23:42.000000000 +0200
20366+++ gcc-4.0.2-atmel.0.99.2/gcc/tree-ssa-operands.c 2005-07-15 16:06:29.000000000 +0200
20367@@ -1135,7 +1135,7 @@ get_expr_operands (tree stmt, tree *expr
20368
20369 if (code == COMPONENT_REF)
20370 {
20371- if (s_ann && TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
20372+ if (TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
20373 s_ann->has_volatile_ops = true;
20374 get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none);
20375 }
20376diff -Nrup --ignore-space-change gcc-4.0.2/libcpp/po/sv.po gcc-4.0.2-atmel.0.99.2/libcpp/po/sv.po
20377--- gcc-4.0.2/libcpp/po/sv.po 2005-09-04 14:30:22.000000000 +0200
20378+++ gcc-4.0.2-atmel.0.99.2/libcpp/po/sv.po 2006-01-20 10:54:31.000000000 +0100
20379@@ -2,7 +2,7 @@
20380 # Copyright © 2000, 2005 Free Software Foundation, Inc.
20381 # Dennis Björklund <db@zigo.dhs.org>, 2000, 2001, 2002.
20382 # Göran Uddeborg <goeran@uddeborg.se>, 2005.
20383-# $Revision: 1.2 $
20384+# $Revision: 3550 $
20385 #
20386 msgid ""
20387 msgstr ""
20388Binary files gcc-4.0.2/libcpp/po/tr.gmo and gcc-4.0.2-atmel.0.99.2/libcpp/po/tr.gmo differ
20389Binary files gcc-4.0.2/libcpp/po/vi.gmo and gcc-4.0.2-atmel.0.99.2/libcpp/po/vi.gmo differ
20390diff -Nrup --ignore-space-change gcc-4.0.2/libffi/src/frv/eabi.S gcc-4.0.2-atmel.0.99.2/libffi/src/frv/eabi.S
20391--- gcc-4.0.2/libffi/src/frv/eabi.S 2004-08-30 17:43:03.000000000 +0200
20392+++ gcc-4.0.2-atmel.0.99.2/libffi/src/frv/eabi.S 2005-07-15 16:26:03.000000000 +0200
20393@@ -3,7 +3,7 @@
20394
20395 FR-V Assembly glue.
20396
20397- $Id: sysv.S,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
20398+ $Id: eabi.S 3484 2005-07-15 14:26:03Z rpedersen $
20399
20400 Permission is hereby granted, free of charge, to any person obtaining
20401 a copy of this software and associated documentation files (the
20402diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/AttributeList.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/AttributeList.java
20403--- gcc-4.0.2/libjava/external/sax/org/xml/sax/AttributeList.java 2005-02-02 01:41:51.000000000 +0100
20404+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/AttributeList.java 2005-07-15 16:26:03.000000000 +0200
20405@@ -1,7 +1,7 @@
20406 // SAX Attribute List Interface.
20407 // http://www.saxproject.org
20408 // No warranty; no copyright -- use this as you will.
20409-// $Id: AttributeList.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20410+// $Id: AttributeList.java 3484 2005-07-15 14:26:03Z rpedersen $
20411
20412 package org.xml.sax;
20413
20414diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/Attributes.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/Attributes.java
20415--- gcc-4.0.2/libjava/external/sax/org/xml/sax/Attributes.java 2005-02-02 01:41:51.000000000 +0100
20416+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/Attributes.java 2005-07-15 16:26:03.000000000 +0200
20417@@ -2,7 +2,7 @@
20418 // http://www.saxproject.org
20419 // Written by David Megginson
20420 // NO WARRANTY! This class is in the public domain.
20421-// $Id: Attributes.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20422+// $Id: Attributes.java 3484 2005-07-15 14:26:03Z rpedersen $
20423
20424 package org.xml.sax;
20425
20426diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ContentHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ContentHandler.java
20427--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ContentHandler.java 2005-02-02 01:41:51.000000000 +0100
20428+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ContentHandler.java 2005-07-15 16:26:03.000000000 +0200
20429@@ -2,7 +2,7 @@
20430 // http://www.saxproject.org
20431 // Written by David Megginson
20432 // NO WARRANTY! This class is in the public domain.
20433-// $Id: ContentHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20434+// $Id: ContentHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20435
20436 package org.xml.sax;
20437
20438diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/DocumentHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/DocumentHandler.java
20439--- gcc-4.0.2/libjava/external/sax/org/xml/sax/DocumentHandler.java 2005-02-02 01:41:51.000000000 +0100
20440+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/DocumentHandler.java 2005-07-15 16:26:03.000000000 +0200
20441@@ -1,7 +1,7 @@
20442 // SAX document handler.
20443 // http://www.saxproject.org
20444 // No warranty; no copyright -- use this as you will.
20445-// $Id: DocumentHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20446+// $Id: DocumentHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20447
20448 package org.xml.sax;
20449
20450diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/DTDHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/DTDHandler.java
20451--- gcc-4.0.2/libjava/external/sax/org/xml/sax/DTDHandler.java 2005-02-02 01:41:51.000000000 +0100
20452+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/DTDHandler.java 2005-07-15 16:26:03.000000000 +0200
20453@@ -1,7 +1,7 @@
20454 // SAX DTD handler.
20455 // http://www.saxproject.org
20456 // No warranty; no copyright -- use this as you will.
20457-// $Id: DTDHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20458+// $Id: DTDHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20459
20460 package org.xml.sax;
20461
20462diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/EntityResolver.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/EntityResolver.java
20463--- gcc-4.0.2/libjava/external/sax/org/xml/sax/EntityResolver.java 2005-02-02 01:41:51.000000000 +0100
20464+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/EntityResolver.java 2005-07-15 16:26:03.000000000 +0200
20465@@ -1,7 +1,7 @@
20466 // SAX entity resolver.
20467 // http://www.saxproject.org
20468 // No warranty; no copyright -- use this as you will.
20469-// $Id: EntityResolver.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20470+// $Id: EntityResolver.java 3484 2005-07-15 14:26:03Z rpedersen $
20471
20472 package org.xml.sax;
20473
20474diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ErrorHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ErrorHandler.java
20475--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ErrorHandler.java 2005-02-02 01:41:51.000000000 +0100
20476+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ErrorHandler.java 2005-07-15 16:26:03.000000000 +0200
20477@@ -1,7 +1,7 @@
20478 // SAX error handler.
20479 // http://www.saxproject.org
20480 // No warranty; no copyright -- use this as you will.
20481-// $Id: ErrorHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20482+// $Id: ErrorHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20483
20484 package org.xml.sax;
20485
20486diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java
20487--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java 2005-02-02 01:41:52.000000000 +0100
20488+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java 2005-07-15 16:26:03.000000000 +0200
20489@@ -1,7 +1,7 @@
20490 // Attributes2Impl.java - extended AttributesImpl
20491 // http://www.saxproject.org
20492 // Public Domain: no warranty.
20493-// $Id: Attributes2Impl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20494+// $Id: Attributes2Impl.java 3484 2005-07-15 14:26:03Z rpedersen $
20495
20496 package org.xml.sax.ext;
20497
20498diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Attributes2.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Attributes2.java
20499--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Attributes2.java 2005-02-02 01:41:52.000000000 +0100
20500+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Attributes2.java 2005-07-15 16:26:03.000000000 +0200
20501@@ -1,7 +1,7 @@
20502 // Attributes2.java - extended Attributes
20503 // http://www.saxproject.org
20504 // Public Domain: no warranty.
20505-// $Id: Attributes2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20506+// $Id: Attributes2.java 3484 2005-07-15 14:26:03Z rpedersen $
20507
20508 package org.xml.sax.ext;
20509
20510diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/DeclHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/DeclHandler.java
20511--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/DeclHandler.java 2005-02-02 01:41:52.000000000 +0100
20512+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/DeclHandler.java 2005-07-15 16:26:03.000000000 +0200
20513@@ -1,7 +1,7 @@
20514 // DeclHandler.java - Optional handler for DTD declaration events.
20515 // http://www.saxproject.org
20516 // Public Domain: no warranty.
20517-// $Id: DeclHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20518+// $Id: DeclHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20519
20520 package org.xml.sax.ext;
20521
20522diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/DefaultHandler2.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/DefaultHandler2.java
20523--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/DefaultHandler2.java 2005-02-02 01:41:52.000000000 +0100
20524+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/DefaultHandler2.java 2005-07-15 16:26:03.000000000 +0200
20525@@ -1,7 +1,7 @@
20526 // DefaultHandler2.java - extended DefaultHandler
20527 // http://www.saxproject.org
20528 // Public Domain: no warranty.
20529-// $Id: DefaultHandler2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20530+// $Id: DefaultHandler2.java 3484 2005-07-15 14:26:03Z rpedersen $
20531
20532 package org.xml.sax.ext;
20533
20534diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java
20535--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java 2005-02-02 01:41:52.000000000 +0100
20536+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java 2005-07-15 16:26:03.000000000 +0200
20537@@ -1,7 +1,7 @@
20538 // EntityResolver2.java - Extended SAX entity resolver.
20539 // http://www.saxproject.org
20540 // No warranty; no copyright -- use this as you will.
20541-// $Id: EntityResolver2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20542+// $Id: EntityResolver2.java 3484 2005-07-15 14:26:03Z rpedersen $
20543
20544 package org.xml.sax.ext;
20545
20546diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java
20547--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java 2005-02-02 01:41:52.000000000 +0100
20548+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java 2005-07-15 16:26:03.000000000 +0200
20549@@ -1,7 +1,7 @@
20550 // LexicalHandler.java - optional handler for lexical parse events.
20551 // http://www.saxproject.org
20552 // Public Domain: no warranty.
20553-// $Id: LexicalHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20554+// $Id: LexicalHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20555
20556 package org.xml.sax.ext;
20557
20558diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java
20559--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java 2005-02-02 01:41:52.000000000 +0100
20560+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java 2005-07-15 16:26:03.000000000 +0200
20561@@ -1,7 +1,7 @@
20562 // Locator2Impl.java - extended LocatorImpl
20563 // http://www.saxproject.org
20564 // Public Domain: no warranty.
20565-// $Id: Locator2Impl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20566+// $Id: Locator2Impl.java 3484 2005-07-15 14:26:03Z rpedersen $
20567
20568 package org.xml.sax.ext;
20569
20570diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Locator2.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Locator2.java
20571--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/Locator2.java 2005-02-02 01:41:52.000000000 +0100
20572+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/Locator2.java 2005-07-15 16:26:03.000000000 +0200
20573@@ -1,7 +1,7 @@
20574 // Locator2.java - extended Locator
20575 // http://www.saxproject.org
20576 // Public Domain: no warranty.
20577-// $Id: Locator2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20578+// $Id: Locator2.java 3484 2005-07-15 14:26:03Z rpedersen $
20579
20580 package org.xml.sax.ext;
20581
20582diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/package.html gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/package.html
20583--- gcc-4.0.2/libjava/external/sax/org/xml/sax/ext/package.html 2005-02-02 01:41:52.000000000 +0100
20584+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/ext/package.html 2005-07-15 16:26:03.000000000 +0200
20585@@ -1,5 +1,5 @@
20586 <HTML><HEAD>
20587-<!-- $Id: package.html,v 1.1 2004/12/23 22:38:42 mark Exp $ -->
20588+<!-- $Id: package.html 3484 2005-07-15 14:26:03Z rpedersen $ -->
20589 </HEAD><BODY>
20590
20591 <p>
20592diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/HandlerBase.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/HandlerBase.java
20593--- gcc-4.0.2/libjava/external/sax/org/xml/sax/HandlerBase.java 2005-02-02 01:41:51.000000000 +0100
20594+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/HandlerBase.java 2005-07-15 16:26:03.000000000 +0200
20595@@ -1,7 +1,7 @@
20596 // SAX default handler base class.
20597 // http://www.saxproject.org
20598 // No warranty; no copyright -- use this as you will.
20599-// $Id: HandlerBase.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20600+// $Id: HandlerBase.java 3484 2005-07-15 14:26:03Z rpedersen $
20601
20602 package org.xml.sax;
20603
20604diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java
20605--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java 2005-02-02 01:41:53.000000000 +0100
20606+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java 2005-07-15 16:26:03.000000000 +0200
20607@@ -1,7 +1,7 @@
20608 // SAX default implementation for AttributeList.
20609 // http://www.saxproject.org
20610 // No warranty; no copyright -- use this as you will.
20611-// $Id: AttributeListImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20612+// $Id: AttributeListImpl.java 3484 2005-07-15 14:26:03Z rpedersen $
20613
20614 package org.xml.sax.helpers;
20615
20616diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java
20617--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java 2005-02-02 01:41:54.000000000 +0100
20618+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java 2005-07-15 16:26:03.000000000 +0200
20619@@ -2,7 +2,7 @@
20620 // http://www.saxproject.org
20621 // Written by David Megginson
20622 // NO WARRANTY! This class is in the public domain.
20623-// $Id: AttributesImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20624+// $Id: AttributesImpl.java 3484 2005-07-15 14:26:03Z rpedersen $
20625
20626 package org.xml.sax.helpers;
20627
20628diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java
20629--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java 2005-02-02 01:41:54.000000000 +0100
20630+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java 2005-07-15 16:26:03.000000000 +0200
20631@@ -2,7 +2,7 @@
20632 // http://www.saxproject.org
20633 // Written by David Megginson
20634 // NO WARRANTY! This class is in the public domain.
20635-// $Id: DefaultHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20636+// $Id: DefaultHandler.java 3484 2005-07-15 14:26:03Z rpedersen $
20637
20638 package org.xml.sax.helpers;
20639
20640diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java
20641--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java 2005-02-02 01:41:54.000000000 +0100
20642+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java 2005-07-15 16:26:03.000000000 +0200
20643@@ -1,7 +1,7 @@
20644 // SAX default implementation for Locator.
20645 // http://www.saxproject.org
20646 // No warranty; no copyright -- use this as you will.
20647-// $Id: LocatorImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20648+// $Id: LocatorImpl.java 3484 2005-07-15 14:26:03Z rpedersen $
20649
20650 package org.xml.sax.helpers;
20651
20652diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java
20653--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java 2005-04-06 23:38:28.000000000 +0200
20654+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java 2005-06-07 14:06:28.000000000 +0200
20655@@ -2,7 +2,7 @@
20656 // http://www.saxproject.org
20657 // Written by David Megginson
20658 // This class is in the Public Domain. NO WARRANTY!
20659-// $Id: NamespaceSupport.java,v 1.2 2005/03/24 00:04:07 tromey Exp $
20660+// $Id: NamespaceSupport.java 3462 2005-06-07 12:06:28Z rpedersen $
20661
20662 package org.xml.sax.helpers;
20663
20664diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/NewInstance.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/NewInstance.java
20665--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/NewInstance.java 2005-02-02 01:41:54.000000000 +0100
20666+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/NewInstance.java 2005-07-15 16:26:03.000000000 +0200
20667@@ -3,7 +3,7 @@
20668 // Written by Edwin Goei, edwingo@apache.org
20669 // and by David Brownell, dbrownell@users.sourceforge.net
20670 // NO WARRANTY! This class is in the Public Domain.
20671-// $Id: NewInstance.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20672+// $Id: NewInstance.java 3484 2005-07-15 14:26:03Z rpedersen $
20673
20674 package org.xml.sax.helpers;
20675
20676diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/package.html gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/package.html
20677--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/package.html 2005-02-02 01:41:54.000000000 +0100
20678+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/package.html 2005-07-15 16:26:03.000000000 +0200
20679@@ -1,5 +1,5 @@
20680 <HTML><HEAD>
20681-<!-- $Id: package.html,v 1.1 2004/12/23 22:38:42 mark Exp $ -->
20682+<!-- $Id: package.html 3484 2005-07-15 14:26:03Z rpedersen $ -->
20683 </HEAD><BODY>
20684
20685 <p>This package contains "helper" classes, including
20686diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java
20687--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java 2005-02-02 01:41:54.000000000 +0100
20688+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java 2005-07-15 16:26:03.000000000 +0200
20689@@ -2,7 +2,7 @@
20690 // http://www.saxproject.org
20691 // Written by David Megginson
20692 // NO WARRANTY! This class is in the public domain.
20693-// $Id: ParserAdapter.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20694+// $Id: ParserAdapter.java 3484 2005-07-15 14:26:03Z rpedersen $
20695
20696 package org.xml.sax.helpers;
20697
20698diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java
20699--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java 2005-02-02 01:41:54.000000000 +0100
20700+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java 2005-07-15 16:26:03.000000000 +0200
20701@@ -1,7 +1,7 @@
20702 // SAX parser factory.
20703 // http://www.saxproject.org
20704 // No warranty; no copyright -- use this as you will.
20705-// $Id: ParserFactory.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20706+// $Id: ParserFactory.java 3484 2005-07-15 14:26:03Z rpedersen $
20707
20708 package org.xml.sax.helpers;
20709
20710diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java
20711--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java 2005-02-02 01:41:54.000000000 +0100
20712+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java 2005-07-15 16:26:03.000000000 +0200
20713@@ -2,7 +2,7 @@
20714 // http://www.saxproject.org
20715 // Written by David Megginson
20716 // NO WARRANTY! This class is in the Public Domain.
20717-// $Id: XMLFilterImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20718+// $Id: XMLFilterImpl.java 3484 2005-07-15 14:26:03Z rpedersen $
20719
20720 package org.xml.sax.helpers;
20721
20722diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java
20723--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java 2005-02-02 01:41:54.000000000 +0100
20724+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java 2005-07-15 16:26:03.000000000 +0200
20725@@ -2,7 +2,7 @@
20726 // http://www.saxproject.org
20727 // Written by David Megginson
20728 // NO WARRANTY! This class is in the public domain.
20729-// $Id: XMLReaderAdapter.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20730+// $Id: XMLReaderAdapter.java 3484 2005-07-15 14:26:03Z rpedersen $
20731
20732 package org.xml.sax.helpers;
20733
20734diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java
20735--- gcc-4.0.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java 2005-02-02 01:41:54.000000000 +0100
20736+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java 2005-07-15 16:26:03.000000000 +0200
20737@@ -3,7 +3,7 @@
20738 // Written by David Megginson
20739 // and by David Brownell
20740 // NO WARRANTY! This class is in the Public Domain.
20741-// $Id: XMLReaderFactory.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20742+// $Id: XMLReaderFactory.java 3484 2005-07-15 14:26:03Z rpedersen $
20743
20744 package org.xml.sax.helpers;
20745 import java.io.BufferedReader;
20746diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/InputSource.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/InputSource.java
20747--- gcc-4.0.2/libjava/external/sax/org/xml/sax/InputSource.java 2005-02-02 01:41:51.000000000 +0100
20748+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/InputSource.java 2005-07-15 16:26:03.000000000 +0200
20749@@ -1,7 +1,7 @@
20750 // SAX input source.
20751 // http://www.saxproject.org
20752 // No warranty; no copyright -- use this as you will.
20753-// $Id: InputSource.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20754+// $Id: InputSource.java 3484 2005-07-15 14:26:03Z rpedersen $
20755
20756 package org.xml.sax;
20757
20758diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/Locator.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/Locator.java
20759--- gcc-4.0.2/libjava/external/sax/org/xml/sax/Locator.java 2005-02-02 01:41:51.000000000 +0100
20760+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/Locator.java 2005-07-15 16:26:03.000000000 +0200
20761@@ -1,7 +1,7 @@
20762 // SAX locator interface for document events.
20763 // http://www.saxproject.org
20764 // No warranty; no copyright -- use this as you will.
20765-// $Id: Locator.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20766+// $Id: Locator.java 3484 2005-07-15 14:26:03Z rpedersen $
20767
20768 package org.xml.sax;
20769
20770diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/package.html gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/package.html
20771--- gcc-4.0.2/libjava/external/sax/org/xml/sax/package.html 2005-02-02 01:41:51.000000000 +0100
20772+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/package.html 2005-07-15 16:26:03.000000000 +0200
20773@@ -1,5 +1,5 @@
20774 <html><head>
20775-<!-- $Id: package.html,v 1.1 2004/12/23 22:38:42 mark Exp $ -->
20776+<!-- $Id: package.html 3484 2005-07-15 14:26:03Z rpedersen $ -->
20777 </head><body>
20778
20779 <p> This package provides the core SAX APIs.
20780diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/Parser.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/Parser.java
20781--- gcc-4.0.2/libjava/external/sax/org/xml/sax/Parser.java 2005-02-02 01:41:51.000000000 +0100
20782+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/Parser.java 2005-07-15 16:26:03.000000000 +0200
20783@@ -1,7 +1,7 @@
20784 // SAX parser interface.
20785 // http://www.saxproject.org
20786 // No warranty; no copyright -- use this as you will.
20787-// $Id: Parser.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20788+// $Id: Parser.java 3484 2005-07-15 14:26:03Z rpedersen $
20789
20790 package org.xml.sax;
20791
20792diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXException.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXException.java
20793--- gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXException.java 2005-02-02 01:41:51.000000000 +0100
20794+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXException.java 2005-07-15 16:26:03.000000000 +0200
20795@@ -1,7 +1,7 @@
20796 // SAX exception class.
20797 // http://www.saxproject.org
20798 // No warranty; no copyright -- use this as you will.
20799-// $Id: SAXException.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20800+// $Id: SAXException.java 3484 2005-07-15 14:26:03Z rpedersen $
20801
20802 package org.xml.sax;
20803
20804diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXNotRecognizedException.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXNotRecognizedException.java
20805--- gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXNotRecognizedException.java 2005-02-02 01:41:51.000000000 +0100
20806+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXNotRecognizedException.java 2005-07-15 16:26:03.000000000 +0200
20807@@ -2,7 +2,7 @@
20808 // http://www.saxproject.org
20809 // Written by David Megginson
20810 // NO WARRANTY! This class is in the Public Domain.
20811-// $Id: SAXNotRecognizedException.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20812+// $Id: SAXNotRecognizedException.java 3484 2005-07-15 14:26:03Z rpedersen $
20813
20814 package org.xml.sax;
20815
20816diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXNotSupportedException.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXNotSupportedException.java
20817--- gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXNotSupportedException.java 2005-02-02 01:41:51.000000000 +0100
20818+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXNotSupportedException.java 2005-07-15 16:26:03.000000000 +0200
20819@@ -2,7 +2,7 @@
20820 // http://www.saxproject.org
20821 // Written by David Megginson
20822 // NO WARRANTY! This class is in the Public Domain.
20823-// $Id: SAXNotSupportedException.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20824+// $Id: SAXNotSupportedException.java 3484 2005-07-15 14:26:03Z rpedersen $
20825
20826 package org.xml.sax;
20827
20828diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXParseException.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXParseException.java
20829--- gcc-4.0.2/libjava/external/sax/org/xml/sax/SAXParseException.java 2005-02-02 01:41:51.000000000 +0100
20830+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/SAXParseException.java 2005-07-15 16:26:03.000000000 +0200
20831@@ -1,7 +1,7 @@
20832 // SAX exception class.
20833 // http://www.saxproject.org
20834 // No warranty; no copyright -- use this as you will.
20835-// $Id: SAXParseException.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20836+// $Id: SAXParseException.java 3484 2005-07-15 14:26:03Z rpedersen $
20837
20838 package org.xml.sax;
20839
20840diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/XMLFilter.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/XMLFilter.java
20841--- gcc-4.0.2/libjava/external/sax/org/xml/sax/XMLFilter.java 2005-02-02 01:41:51.000000000 +0100
20842+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/XMLFilter.java 2005-07-15 16:26:03.000000000 +0200
20843@@ -2,7 +2,7 @@
20844 // http://www.saxproject.org
20845 // Written by David Megginson
20846 // NO WARRANTY! This class is in the Public Domain.
20847-// $Id: XMLFilter.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20848+// $Id: XMLFilter.java 3484 2005-07-15 14:26:03Z rpedersen $
20849
20850 package org.xml.sax;
20851
20852diff -Nrup --ignore-space-change gcc-4.0.2/libjava/external/sax/org/xml/sax/XMLReader.java gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/XMLReader.java
20853--- gcc-4.0.2/libjava/external/sax/org/xml/sax/XMLReader.java 2005-02-02 01:41:51.000000000 +0100
20854+++ gcc-4.0.2-atmel.0.99.2/libjava/external/sax/org/xml/sax/XMLReader.java 2005-07-15 16:26:03.000000000 +0200
20855@@ -2,7 +2,7 @@
20856 // http://www.saxproject.org
20857 // Written by David Megginson
20858 // NO WARRANTY! This class is in the Public Domain.
20859-// $Id: XMLReader.java,v 1.1 2004/12/23 22:38:42 mark Exp $
20860+// $Id: XMLReader.java 3484 2005-07-15 14:26:03Z rpedersen $
20861
20862 package org.xml.sax;
20863
20864Binary files gcc-4.0.2/libjava/gnu/java/awt/doc-files/BitwiseXORComposite-1.png and gcc-4.0.2-atmel.0.99.2/libjava/gnu/java/awt/doc-files/BitwiseXORComposite-1.png differ
20865Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/Area-1.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/Area-1.png differ
20866Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/CubicCurve2D-1.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/CubicCurve2D-1.png differ
20867Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/CubicCurve2D-2.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/CubicCurve2D-2.png differ
20868Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/CubicCurve2D-3.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/CubicCurve2D-3.png differ
20869Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/CubicCurve2D-4.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/CubicCurve2D-4.png differ
20870Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/CubicCurve2D-5.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/CubicCurve2D-5.png differ
20871Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/Ellipse-1.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/Ellipse-1.png differ
20872Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/GeneralPath-1.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/GeneralPath-1.png differ
20873Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/QuadCurve2D-1.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/QuadCurve2D-1.png differ
20874Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/QuadCurve2D-2.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/QuadCurve2D-2.png differ
20875Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/QuadCurve2D-3.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/QuadCurve2D-3.png differ
20876Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/QuadCurve2D-4.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/QuadCurve2D-4.png differ
20877Binary files gcc-4.0.2/libjava/java/awt/geom/doc-files/QuadCurve2D-5.png and gcc-4.0.2-atmel.0.99.2/libjava/java/awt/geom/doc-files/QuadCurve2D-5.png differ
20878Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/BevelBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/BevelBorder-1.png differ
20879Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/BevelBorder-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/BevelBorder-2.png differ
20880Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/BevelBorder-3.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/BevelBorder-3.png differ
20881Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/EmptyBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/EmptyBorder-1.png differ
20882Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/EtchedBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/EtchedBorder-1.png differ
20883Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/EtchedBorder-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/EtchedBorder-2.png differ
20884Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/LineBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/LineBorder-1.png differ
20885Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/MatteBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/MatteBorder-1.png differ
20886Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/MatteBorder-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/MatteBorder-2.png differ
20887Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/MatteBorder-3.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/MatteBorder-3.png differ
20888Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/MatteBorder-4.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/MatteBorder-4.png differ
20889Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/MatteBorder-5.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/MatteBorder-5.png differ
20890Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/MatteBorder-6.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/MatteBorder-6.png differ
20891Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/SoftBevelBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/SoftBevelBorder-1.png differ
20892Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/SoftBevelBorder-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/SoftBevelBorder-2.png differ
20893Binary files gcc-4.0.2/libjava/javax/swing/border/doc-files/SoftBevelBorder-3.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/border/doc-files/SoftBevelBorder-3.png differ
20894Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders-1.png differ
20895Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders-2.png differ
20896Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.ButtonBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.ButtonBorder-1.png differ
20897Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.FieldBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.FieldBorder-1.png differ
20898Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.MarginBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.MarginBorder-1.png differ
20899Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.MenuBarBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.MenuBarBorder-1.png differ
20900Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.RadioButtonBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.RadioButtonBorder-1.png differ
20901Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-1.png differ
20902Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-2.png differ
20903Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneDividerBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneDividerBorder-1.png differ
20904Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.ToggleButtonBorder-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicBorders.ToggleButtonBorder-1.png differ
20905Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-1.png differ
20906Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-2.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-2.png differ
20907Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-3.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-3.png differ
20908Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-4.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-4.png differ
20909Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-5.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-5.png differ
20910Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-6.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-6.png differ
20911Binary files gcc-4.0.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-7.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/basic/doc-files/BasicGraphicsUtils-7.png differ
20912Binary files gcc-4.0.2/libjava/javax/swing/plaf/doc-files/ComponentUI-1.dia and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/doc-files/ComponentUI-1.dia differ
20913Binary files gcc-4.0.2/libjava/javax/swing/plaf/doc-files/ComponentUI-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/doc-files/ComponentUI-1.png differ
20914Binary files gcc-4.0.2/libjava/javax/swing/plaf/doc-files/TreeUI-1.png and gcc-4.0.2-atmel.0.99.2/libjava/javax/swing/plaf/doc-files/TreeUI-1.png differ
20915Binary files gcc-4.0.2/libjava/testsuite/libjava.jar/simple.jar and gcc-4.0.2-atmel.0.99.2/libjava/testsuite/libjava.jar/simple.jar differ
20916diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/acinclude.m4 gcc-4.0.2-atmel.0.99.2/libstdc++-v3/acinclude.m4
20917--- gcc-4.0.2/libstdc++-v3/acinclude.m4 2005-06-23 11:23:59.000000000 +0200
20918+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/acinclude.m4 2006-03-28 10:54:09.000000000 +0200
20919@@ -139,6 +139,15 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
20920 #enable_symvers=no
20921 #enable_hosted_libstdcxx=yes
20922
20923+ # Check for uClibc since Linux platforms use different configuration
20924+ # directories depending on the C library in use.
20925+ AC_EGREP_CPP([_using_uclibc], [
20926+ #include <stdio.h>
20927+ #if __UCLIBC__
20928+ _using_uclibc
20929+ #endif
20930+ ], uclibc=yes, uclibc=no)
20931+
20932 # Find platform-specific directories containing configuration info.
20933 # Also possibly modify flags used elsewhere, as needed by the platform.
20934 GLIBCXX_CHECK_HOST
20935diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/configure.host gcc-4.0.2-atmel.0.99.2/libstdc++-v3/configure.host
20936--- gcc-4.0.2/libstdc++-v3/configure.host 2005-06-17 02:22:20.000000000 +0200
20937+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/configure.host 2006-03-28 10:54:09.000000000 +0200
20938@@ -193,8 +193,15 @@ case "${host_os}" in
20939 freebsd*)
20940 os_include_dir="os/bsd/freebsd"
20941 ;;
20942+ linux-uclibc*)
20943+ os_include_dir="os/uclibc-linux"
20944+ ;;
20945 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
20946+ if [ "$uclibc" = "yes" ]; then
20947+ os_include_dir="os/uclibc"
20948+ else
20949 os_include_dir="os/gnu-linux"
20950+ fi
20951 ;;
20952 hpux*)
20953 os_include_dir="os/hpux"
20954diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/crossconfig.m4 gcc-4.0.2-atmel.0.99.2/libstdc++-v3/crossconfig.m4
20955--- gcc-4.0.2/libstdc++-v3/crossconfig.m4 2005-02-01 07:56:19.000000000 +0100
20956+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/crossconfig.m4 2006-03-28 10:54:09.000000000 +0200
20957@@ -148,9 +148,13 @@ case "${host}" in
20958 fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
20959 SECTION_FLAGS='-ffunction-sections -fdata-sections'
20960 AC_SUBST(SECTION_FLAGS)
20961+ GLIBCXX_CHECK_COMPILER_FEATURES
20962 GLIBCXX_CHECK_LINKER_FEATURES
20963+ GLIBCXX_CHECK_MATH_SUPPORT
20964+ GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
20965 GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
20966- GLIBCXX_CHECK_WCHAR_T_SUPPORT
20967+ GLIBCXX_CHECK_ICONV_SUPPORT
20968+ GLIBCXX_CHECK_STDLIB_SUPPORT
20969
20970 # For LFS.
20971 AC_DEFINE(HAVE_INT64_T)
20972Binary files gcc-4.0.2/libstdc++-v3/docs/html/17_intro/confdeps.png and gcc-4.0.2-atmel.0.99.2/libstdc++-v3/docs/html/17_intro/confdeps.png differ
20973diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/include/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/include/Makefile.in
20974--- gcc-4.0.2/libstdc++-v3/include/Makefile.in 2005-06-22 22:39:09.000000000 +0200
20975+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/include/Makefile.in 2006-03-28 10:54:09.000000000 +0200
20976@@ -1,8 +1,8 @@
20977-# Makefile.in generated by automake 1.9.3 from Makefile.am.
20978+# Makefile.in generated by automake 1.9.6 from Makefile.am.
20979 # @configure_input@
20980
20981 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
20982-# 2003, 2004 Free Software Foundation, Inc.
20983+# 2003, 2004, 2005 Free Software Foundation, Inc.
20984 # This Makefile.in is free software; the Free Software Foundation
20985 # gives unlimited permission to copy and/or distribute it,
20986 # with or without modifications, as long as this notice is preserved.
20987@@ -36,6 +36,7 @@ POST_UNINSTALL = :
20988 build_triplet = @build@
20989 host_triplet = @host@
20990 target_triplet = @target@
20991+LIBOBJDIR =
20992 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
20993 $(top_srcdir)/fragment.am
20994 subdir = include
20995diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/libmath/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/libmath/Makefile.in
20996--- gcc-4.0.2/libstdc++-v3/libmath/Makefile.in 2005-06-22 22:39:18.000000000 +0200
20997+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/libmath/Makefile.in 2006-03-28 10:54:09.000000000 +0200
20998@@ -1,8 +1,8 @@
20999-# Makefile.in generated by automake 1.9.3 from Makefile.am.
21000+# Makefile.in generated by automake 1.9.6 from Makefile.am.
21001 # @configure_input@
21002
21003 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
21004-# 2003, 2004 Free Software Foundation, Inc.
21005+# 2003, 2004, 2005 Free Software Foundation, Inc.
21006 # This Makefile.in is free software; the Free Software Foundation
21007 # gives unlimited permission to copy and/or distribute it,
21008 # with or without modifications, as long as this notice is preserved.
21009@@ -14,8 +14,6 @@
21010
21011 @SET_MAKE@
21012
21013-SOURCES = $(libmath_la_SOURCES)
21014-
21015 srcdir = @srcdir@
21016 top_srcdir = @top_srcdir@
21017 VPATH = @srcdir@
21018@@ -39,6 +37,7 @@ POST_UNINSTALL = :
21019 build_triplet = @build@
21020 host_triplet = @host@
21021 target_triplet = @target@
21022+LIBOBJDIR =
21023 subdir = libmath
21024 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
21025 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
21026diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/libsupc++/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/libsupc++/Makefile.in
21027--- gcc-4.0.2/libstdc++-v3/libsupc++/Makefile.in 2005-06-22 22:39:21.000000000 +0200
21028+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/libsupc++/Makefile.in 2006-03-28 10:54:09.000000000 +0200
21029@@ -1,8 +1,8 @@
21030-# Makefile.in generated by automake 1.9.3 from Makefile.am.
21031+# Makefile.in generated by automake 1.9.6 from Makefile.am.
21032 # @configure_input@
21033
21034 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
21035-# 2003, 2004 Free Software Foundation, Inc.
21036+# 2003, 2004, 2005 Free Software Foundation, Inc.
21037 # This Makefile.in is free software; the Free Software Foundation
21038 # gives unlimited permission to copy and/or distribute it,
21039 # with or without modifications, as long as this notice is preserved.
21040@@ -15,8 +15,6 @@
21041 @SET_MAKE@
21042
21043
21044-SOURCES = $(libsupc___la_SOURCES) $(libsupc__convenience_la_SOURCES)
21045-
21046 srcdir = @srcdir@
21047 top_srcdir = @top_srcdir@
21048 VPATH = @srcdir@
21049@@ -40,6 +38,7 @@ POST_UNINSTALL = :
21050 build_triplet = @build@
21051 host_triplet = @host@
21052 target_triplet = @target@
21053+LIBOBJDIR =
21054 DIST_COMMON = $(glibcxxinstall_HEADERS) $(srcdir)/Makefile.am \
21055 $(srcdir)/Makefile.in $(top_srcdir)/fragment.am
21056 subdir = libsupc++
21057diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/Makefile.in
21058--- gcc-4.0.2/libstdc++-v3/Makefile.in 2005-06-22 22:37:12.000000000 +0200
21059+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/Makefile.in 2006-03-28 10:54:09.000000000 +0200
21060@@ -1,8 +1,8 @@
21061-# Makefile.in generated by automake 1.9.3 from Makefile.am.
21062+# Makefile.in generated by automake 1.9.6 from Makefile.am.
21063 # @configure_input@
21064
21065 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
21066-# 2003, 2004 Free Software Foundation, Inc.
21067+# 2003, 2004, 2005 Free Software Foundation, Inc.
21068 # This Makefile.in is free software; the Free Software Foundation
21069 # gives unlimited permission to copy and/or distribute it,
21070 # with or without modifications, as long as this notice is preserved.
21071@@ -36,6 +36,7 @@ POST_UNINSTALL = :
21072 build_triplet = @build@
21073 host_triplet = @host@
21074 target_triplet = @target@
21075+LIBOBJDIR =
21076 DIST_COMMON = README $(am__configure_deps) $(srcdir)/../config.guess \
21077 $(srcdir)/../config.sub $(srcdir)/../install-sh \
21078 $(srcdir)/../ltmain.sh $(srcdir)/../missing \
21079@@ -408,7 +409,13 @@ uninstall-info-am:
21080 # (which will cause the Makefiles to be regenerated when you run `make');
21081 # (2) otherwise, pass the desired values on the `make' command line.
21082 $(RECURSIVE_TARGETS):
21083- @set fnord $$MAKEFLAGS; amf=$$2; \
21084+ @failcom='exit 1'; \
21085+ for f in x $$MAKEFLAGS; do \
21086+ case $$f in \
21087+ *=* | --[!k]*);; \
21088+ *k*) failcom='fail=yes';; \
21089+ esac; \
21090+ done; \
21091 dot_seen=no; \
21092 target=`echo $@ | sed s/-recursive//`; \
21093 list='$(SUBDIRS)'; for subdir in $$list; do \
21094@@ -420,7 +427,7 @@ $(RECURSIVE_TARGETS):
21095 local_target="$$target"; \
21096 fi; \
21097 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
21098- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
21099+ || eval $$failcom; \
21100 done; \
21101 if test "$$dot_seen" = "no"; then \
21102 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
21103@@ -428,7 +435,13 @@ $(RECURSIVE_TARGETS):
21104
21105 mostlyclean-recursive clean-recursive distclean-recursive \
21106 maintainer-clean-recursive:
21107- @set fnord $$MAKEFLAGS; amf=$$2; \
21108+ @failcom='exit 1'; \
21109+ for f in x $$MAKEFLAGS; do \
21110+ case $$f in \
21111+ *=* | --[!k]*);; \
21112+ *k*) failcom='fail=yes';; \
21113+ esac; \
21114+ done; \
21115 dot_seen=no; \
21116 case "$@" in \
21117 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
21118@@ -449,7 +462,7 @@ maintainer-clean-recursive:
21119 local_target="$$target"; \
21120 fi; \
21121 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
21122- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
21123+ || eval $$failcom; \
21124 done && test -z "$$fail"
21125 tags-recursive:
21126 list='$(SUBDIRS)'; for subdir in $$list; do \
21127diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/po/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/po/Makefile.in
21128--- gcc-4.0.2/libstdc++-v3/po/Makefile.in 2005-06-22 22:39:24.000000000 +0200
21129+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/po/Makefile.in 2006-03-28 10:54:09.000000000 +0200
21130@@ -1,8 +1,8 @@
21131-# Makefile.in generated by automake 1.9.3 from Makefile.am.
21132+# Makefile.in generated by automake 1.9.6 from Makefile.am.
21133 # @configure_input@
21134
21135 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
21136-# 2003, 2004 Free Software Foundation, Inc.
21137+# 2003, 2004, 2005 Free Software Foundation, Inc.
21138 # This Makefile.in is free software; the Free Software Foundation
21139 # gives unlimited permission to copy and/or distribute it,
21140 # with or without modifications, as long as this notice is preserved.
21141@@ -36,6 +36,7 @@ POST_UNINSTALL = :
21142 build_triplet = @build@
21143 host_triplet = @host@
21144 target_triplet = @target@
21145+LIBOBJDIR =
21146 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
21147 $(top_srcdir)/fragment.am
21148 subdir = po
21149diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/src/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/src/Makefile.in
21150--- gcc-4.0.2/libstdc++-v3/src/Makefile.in 2005-06-22 22:39:26.000000000 +0200
21151+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/src/Makefile.in 2006-03-28 10:54:09.000000000 +0200
21152@@ -1,8 +1,8 @@
21153-# Makefile.in generated by automake 1.9.3 from Makefile.am.
21154+# Makefile.in generated by automake 1.9.6 from Makefile.am.
21155 # @configure_input@
21156
21157 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
21158-# 2003, 2004 Free Software Foundation, Inc.
21159+# 2003, 2004, 2005 Free Software Foundation, Inc.
21160 # This Makefile.in is free software; the Free Software Foundation
21161 # gives unlimited permission to copy and/or distribute it,
21162 # with or without modifications, as long as this notice is preserved.
21163@@ -14,8 +14,6 @@
21164
21165 @SET_MAKE@
21166
21167-SOURCES = $(libstdc___la_SOURCES)
21168-
21169 srcdir = @srcdir@
21170 top_srcdir = @top_srcdir@
21171 pkgdatadir = $(datadir)/@PACKAGE@
21172@@ -38,6 +36,7 @@ POST_UNINSTALL = :
21173 build_triplet = @build@
21174 host_triplet = @host@
21175 target_triplet = @target@
21176+LIBOBJDIR =
21177 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
21178 $(top_srcdir)/fragment.am
21179 subdir = src
21180diff -Nrup --ignore-space-change gcc-4.0.2/libstdc++-v3/testsuite/Makefile.in gcc-4.0.2-atmel.0.99.2/libstdc++-v3/testsuite/Makefile.in
21181--- gcc-4.0.2/libstdc++-v3/testsuite/Makefile.in 2005-06-22 22:39:30.000000000 +0200
21182+++ gcc-4.0.2-atmel.0.99.2/libstdc++-v3/testsuite/Makefile.in 2006-03-28 10:54:09.000000000 +0200
21183@@ -1,8 +1,8 @@
21184-# Makefile.in generated by automake 1.9.3 from Makefile.am.
21185+# Makefile.in generated by automake 1.9.6 from Makefile.am.
21186 # @configure_input@
21187
21188 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
21189-# 2003, 2004 Free Software Foundation, Inc.
21190+# 2003, 2004, 2005 Free Software Foundation, Inc.
21191 # This Makefile.in is free software; the Free Software Foundation
21192 # gives unlimited permission to copy and/or distribute it,
21193 # with or without modifications, as long as this notice is preserved.
21194@@ -14,8 +14,6 @@
21195
21196 @SET_MAKE@
21197
21198-SOURCES = $(libv3test_a_SOURCES)
21199-
21200 srcdir = @srcdir@
21201 top_srcdir = @top_srcdir@
21202 VPATH = @srcdir@
21203@@ -39,6 +37,7 @@ POST_UNINSTALL = :
21204 build_triplet = @build@
21205 host_triplet = @host@
21206 target_triplet = @target@
21207+LIBOBJDIR =
21208 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
21209 $(top_srcdir)/fragment.am
21210 subdir = testsuite
21211diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/mtest.adb gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/mtest.adb
21212--- gcc-4.0.2/zlib/contrib/ada/mtest.adb 2004-10-11 19:44:23.000000000 +0200
21213+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/mtest.adb 2005-07-15 16:26:03.000000000 +0200
21214@@ -8,7 +8,7 @@
21215 -- Continuous test for ZLib multithreading. If the test is fail
21216 -- Wou should provide thread safe allocation routines for the Z_Stream.
21217 --
21218--- $Id: mtest.adb,v 1.2 2003/08/12 12:11:05 vagul Exp $
21219+-- $Id: mtest.adb 3484 2005-07-15 14:26:03Z rpedersen $
21220
21221 with ZLib;
21222 with Ada.Streams;
21223diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/read.adb gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/read.adb
21224--- gcc-4.0.2/zlib/contrib/ada/read.adb 2004-10-11 19:44:23.000000000 +0200
21225+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/read.adb 2005-07-15 16:26:03.000000000 +0200
21226@@ -6,7 +6,7 @@
21227 -- Open source license information is in the zlib.ads file. --
21228 ----------------------------------------------------------------
21229
21230--- $Id: read.adb,v 1.7 2003/08/12 12:12:35 vagul Exp $
21231+-- $Id: read.adb 3484 2005-07-15 14:26:03Z rpedersen $
21232
21233 -- Test/demo program for the generic read interface.
21234
21235diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/test.adb gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/test.adb
21236--- gcc-4.0.2/zlib/contrib/ada/test.adb 2004-10-11 19:44:23.000000000 +0200
21237+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/test.adb 2005-07-15 16:26:03.000000000 +0200
21238@@ -6,7 +6,7 @@
21239 -- Open source license information is in the zlib.ads file. --
21240 ----------------------------------------------------------------
21241
21242--- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
21243+-- $Id: test.adb 3484 2005-07-15 14:26:03Z rpedersen $
21244
21245 -- The program has a few aims.
21246 -- 1. Test ZLib.Ada95 thick binding functionality.
21247diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/zlib.adb gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib.adb
21248--- gcc-4.0.2/zlib/contrib/ada/zlib.adb 2004-10-11 19:44:23.000000000 +0200
21249+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib.adb 2005-07-15 16:26:03.000000000 +0200
21250@@ -6,7 +6,7 @@
21251 -- Open source license information is in the zlib.ads file. --
21252 ----------------------------------------------------------------
21253
21254--- $Id: zlib.adb,v 1.19 2003/07/13 16:02:19 vagul Exp $
21255+-- $Id: zlib.adb 3484 2005-07-15 14:26:03Z rpedersen $
21256
21257 with Ada.Exceptions;
21258 with Ada.Unchecked_Conversion;
21259diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/zlib.ads gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib.ads
21260--- gcc-4.0.2/zlib/contrib/ada/zlib.ads 2004-10-11 19:44:23.000000000 +0200
21261+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib.ads 2005-07-15 16:26:03.000000000 +0200
21262@@ -25,7 +25,7 @@
21263 -- covered by the GNU Public License. --
21264 ------------------------------------------------------------------------------
21265
21266--- $Id: zlib.ads,v 1.17 2003/08/12 13:19:07 vagul Exp $
21267+-- $Id: zlib.ads 3484 2005-07-15 14:26:03Z rpedersen $
21268
21269 with Ada.Streams;
21270
21271diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/zlib-streams.adb gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-streams.adb
21272--- gcc-4.0.2/zlib/contrib/ada/zlib-streams.adb 2004-10-11 19:44:23.000000000 +0200
21273+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-streams.adb 2005-07-15 16:26:03.000000000 +0200
21274@@ -6,7 +6,7 @@
21275 -- Open source license information is in the zlib.ads file. --
21276 ----------------------------------------------------------------
21277
21278--- $Id: zlib-streams.adb,v 1.9 2003/08/12 13:15:31 vagul Exp $
21279+-- $Id: zlib-streams.adb 3484 2005-07-15 14:26:03Z rpedersen $
21280
21281 with Ada.Unchecked_Deallocation;
21282
21283diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/zlib-streams.ads gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-streams.ads
21284--- gcc-4.0.2/zlib/contrib/ada/zlib-streams.ads 2004-10-11 19:44:23.000000000 +0200
21285+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-streams.ads 2005-07-15 16:26:03.000000000 +0200
21286@@ -6,7 +6,7 @@
21287 -- Open source license information is in the zlib.ads file. --
21288 ----------------------------------------------------------------
21289
21290--- $Id: zlib-streams.ads,v 1.11 2003/08/12 13:15:31 vagul Exp $
21291+-- $Id: zlib-streams.ads 3484 2005-07-15 14:26:03Z rpedersen $
21292
21293 package ZLib.Streams is
21294
21295diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/zlib-thin.adb gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-thin.adb
21296--- gcc-4.0.2/zlib/contrib/ada/zlib-thin.adb 2004-10-11 19:44:23.000000000 +0200
21297+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-thin.adb 2005-07-15 16:26:03.000000000 +0200
21298@@ -6,7 +6,7 @@
21299 -- Open source license information is in the zlib.ads file. --
21300 ----------------------------------------------------------------
21301
21302--- $Id: zlib-thin.adb,v 1.6 2003/01/21 15:26:37 vagul Exp $
21303+-- $Id: zlib-thin.adb 3484 2005-07-15 14:26:03Z rpedersen $
21304
21305 package body ZLib.Thin is
21306
21307diff -Nrup --ignore-space-change gcc-4.0.2/zlib/contrib/ada/zlib-thin.ads gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-thin.ads
21308--- gcc-4.0.2/zlib/contrib/ada/zlib-thin.ads 2004-10-11 19:44:23.000000000 +0200
21309+++ gcc-4.0.2-atmel.0.99.2/zlib/contrib/ada/zlib-thin.ads 2005-07-15 16:26:03.000000000 +0200
21310@@ -6,7 +6,7 @@
21311 -- Open source license information is in the zlib.ads file. --
21312 ----------------------------------------------------------------
21313
21314--- $Id: zlib-thin.ads,v 1.8 2003/08/12 13:16:51 vagul Exp $
21315+-- $Id: zlib-thin.ads 3484 2005-07-15 14:26:03Z rpedersen $
21316
21317 with Interfaces.C.Strings;
21318 with System.Address_To_Access_Conversions;
21319diff -Nrup --ignore-space-change gcc-4.0.2/zlib/zconf.in.h gcc-4.0.2-atmel.0.99.2/zlib/zconf.in.h
21320--- gcc-4.0.2/zlib/zconf.in.h 2004-10-11 19:44:14.000000000 +0200
21321+++ gcc-4.0.2-atmel.0.99.2/zlib/zconf.in.h 2005-07-15 16:26:03.000000000 +0200
21322@@ -3,7 +3,7 @@
21323 * For conditions of distribution and use, see copyright notice in zlib.h
21324 */
21325
21326-/* @(#) $Id$ */
21327+/* @(#) $Id: zconf.in.h 3484 2005-07-15 14:26:03Z rpedersen $ */
21328
21329 #ifndef ZCONF_H
21330 #define ZCONF_H
diff --git a/meta/packages/gcc/gcc-4.0.2/libstdc++-configure.patch b/meta/packages/gcc/gcc-4.0.2/libstdc++-configure.patch
new file mode 100644
index 0000000000..8dc613104d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/libstdc++-configure.patch
@@ -0,0 +1,10 @@
1--- /tmp/configure 2007-06-02 09:26:29.000000000 +0200
2+++ gcc-4.0.2/libstdc++-v3/configure 2007-06-02 09:26:40.135215000 +0200
3@@ -101472,7 +101472,6 @@
4 _ACEOF
5
6 fi
7-done
8
9 fi
10
diff --git a/meta/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch b/meta/packages/gcc/gcc-4.0.2/zecke-no-host-includes.patch
index 6afb10d6ef..6afb10d6ef 100644
--- a/meta/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch
+++ b/meta/packages/gcc/gcc-4.0.2/zecke-no-host-includes.patch
diff --git a/meta/packages/gcc/gcc-4.1.1/zecke-xgcc-cpp.patch b/meta/packages/gcc/gcc-4.0.2/zecke-xgcc-cpp.patch
index 42ec190600..ba7d7257d9 100644
--- a/meta/packages/gcc/gcc-4.1.1/zecke-xgcc-cpp.patch
+++ b/meta/packages/gcc/gcc-4.0.2/zecke-xgcc-cpp.patch
@@ -1,9 +1,9 @@
1Index: gcc-4.1.1/Makefile.in 1Index: gcc-4.0.2/Makefile.in
2=================================================================== 2===================================================================
3--- gcc-4.1.1.orig/Makefile.in 2006-08-06 13:32:44.000000000 +0200 3--- gcc-4.0.2.orig/Makefile.in 2006-08-06 13:17:09.000000000 +0200
4+++ gcc-4.1.1/Makefile.in 2006-08-06 13:32:46.000000000 +0200 4+++ gcc-4.0.2/Makefile.in 2006-08-06 13:18:35.000000000 +0200
5@@ -194,6 +194,7 @@ 5@@ -197,6 +197,7 @@
6 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ 6 AS="$(AS_FOR_TARGET)"; export AS; \
7 CC="$(CC_FOR_TARGET)"; export CC; \ 7 CC="$(CC_FOR_TARGET)"; export CC; \
8 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ 8 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
9+ CPP="$(CC_FOR_TARGET) -E"; export CCP; \ 9+ CPP="$(CC_FOR_TARGET) -E"; export CCP; \
diff --git a/meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch b/meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch
deleted file mode 100644
index 49d576c7dd..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch
+++ /dev/null
@@ -1,544 +0,0 @@
1--- gcc-4.1.0/gcc/config/t-linux-uclibc
2+++ gcc-4.1.0/gcc/config/t-linux-uclibc
3@@ -0,0 +1,5 @@
4+# Remove glibc specific files added in t-linux
5+SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
6+
7+# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
8+LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
9--- gcc-4.1.0/gcc/config.gcc
10+++ gcc-4.1.0/gcc/config.gcc
11@@ -1887,7 +1887,7 @@ s390x-ibm-tpf*)
12 ;;
13 sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
14 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
15- sh-*-linux* | sh[346lbe]*-*-linux* | \
16+ sh*-*-linux* | sh[346lbe]*-*-linux* | \
17 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
18 sh64-*-netbsd* | sh64l*-*-netbsd*)
19 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
20@@ -2341,6 +2341,12 @@ m32c-*-elf*)
21 ;;
22 esac
23
24+# Rather than hook into each target, just do it after all the linux
25+# targets have been processed
26+case ${target} in
27+*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
28+esac
29+
30 case ${target} in
31 i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1)
32 tmake_file="${tmake_file} i386/t-gmm_malloc"
33--- gcc-4.1.0/boehm-gc/configure
34+++ gcc-4.1.0/boehm-gc/configure
35@@ -4320,6 +4320,11 @@ linux-gnu*)
36 lt_cv_deplibs_check_method=pass_all
37 ;;
38
39+linux-uclibc*)
40+ lt_cv_deplibs_check_method=pass_all
41+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
42+ ;;
43+
44 netbsd* | knetbsd*-gnu)
45 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
46 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
47--- gcc-4.1.0/configure
48+++ gcc-4.1.0/configure
49@@ -1133,7 +1133,7 @@ no)
50 ;;
51 "")
52 case "${target}" in
53- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
54+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
55 # Enable libmudflap by default in GNU and friends.
56 ;;
57 *-*-freebsd*)
58--- gcc-4.1.0/configure.in
59+++ gcc-4.1.0/configure.in
60@@ -341,7 +341,7 @@ no)
61 ;;
62 "")
63 case "${target}" in
64- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
65+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
66 # Enable libmudflap by default in GNU and friends.
67 ;;
68 *-*-freebsd*)
69--- gcc-4.1.0/contrib/regression/objs-gcc.sh
70+++ gcc-4.1.0/contrib/regression/objs-gcc.sh
71@@ -105,6 +105,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
72 then
73 make all-gdb all-dejagnu all-ld || exit 1
74 make install-gdb install-dejagnu install-ld || exit 1
75+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
76+ then
77+ make all-gdb all-dejagnu all-ld || exit 1
78+ make install-gdb install-dejagnu install-ld || exit 1
79 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
80 make bootstrap || exit 1
81 make install || exit 1
82--- gcc-4.1.0/gcc/config/alpha/linux-elf.h
83+++ gcc-4.1.0/gcc/config/alpha/linux-elf.h
84@@ -27,7 +27,11 @@ Boston, MA 02110-1301, USA. */
85 #define SUBTARGET_EXTRA_SPECS \
86 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
87
88+#if defined USE_UCLIBC
89+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
90+#else
91 #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
92+#endif
93
94 #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
95 %{O*:-O3} %{!O*:-O1} \
96--- gcc-4.1.0/gcc/config/arm/linux-elf.h
97+++ gcc-4.1.0/gcc/config/arm/linux-elf.h
98@@ -51,7 +51,11 @@
99
100 #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
101
102+#ifdef USE_UCLIBC
103+#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
104+#else
105 #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2"
106+#endif
107
108 #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \
109 %{b} \
110--- gcc-4.1.0/gcc/config/cris/linux.h
111+++ gcc-4.1.0/gcc/config/cris/linux.h
112@@ -73,6 +73,25 @@ Boston, MA 02110-1301, USA. */
113 #undef CRIS_DEFAULT_CPU_VERSION
114 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
115
116+#ifdef USE_UCLIBC
117+
118+#undef CRIS_SUBTARGET_VERSION
119+#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
120+
121+#undef CRIS_LINK_SUBTARGET_SPEC
122+#define CRIS_LINK_SUBTARGET_SPEC \
123+ "-mcrislinux\
124+ -rpath-link include/asm/../..%s\
125+ %{shared} %{static}\
126+ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
127+ %{!shared: \
128+ %{!static: \
129+ %{rdynamic:-export-dynamic} \
130+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
131+ %{!r:%{O2|O3: --gc-sections}}"
132+
133+#else /* USE_UCLIBC */
134+
135 #undef CRIS_SUBTARGET_VERSION
136 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
137
138@@ -87,6 +106,8 @@ Boston, MA 02110-1301, USA. */
139 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
140 %{!r:%{O2|O3: --gc-sections}}"
141
142+#endif /* USE_UCLIBC */
143+
144
145 /* Node: Run-time Target */
146
147--- gcc-4.1.0/gcc/config/i386/linux.h
148+++ gcc-4.1.0/gcc/config/i386/linux.h
149@@ -107,6 +107,11 @@ Boston, MA 02110-1301, USA. */
150 #define LINK_EMULATION "elf_i386"
151 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
152
153+#if defined USE_UCLIBC
154+#undef DYNAMIC_LINKER
155+#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
156+#endif
157+
158 #undef SUBTARGET_EXTRA_SPECS
159 #define SUBTARGET_EXTRA_SPECS \
160 { "link_emulation", LINK_EMULATION },\
161--- gcc-4.1.0/gcc/config/i386/linux64.h
162+++ gcc-4.1.0/gcc/config/i386/linux64.h
163@@ -54,14 +54,21 @@ Boston, MA 02110-1301, USA. */
164 When the -shared link option is used a final link is not being
165 done. */
166
167+#ifdef USE_UCLIBC
168+#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
169+#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
170+#else
171+#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
172+#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
173+#endif
174 #undef LINK_SPEC
175 #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
176 %{shared:-shared} \
177 %{!shared: \
178 %{!static: \
179 %{rdynamic:-export-dynamic} \
180- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
181- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
182+ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
183+ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
184 %{static:-static}}"
185
186 /* Similar to standard Linux, but adding -ffast-math support. */
187--- gcc-4.1.0/gcc/config/ia64/linux.h
188+++ gcc-4.1.0/gcc/config/ia64/linux.h
189@@ -37,13 +37,18 @@ do { \
190 /* Define this for shared library support because it isn't in the main
191 linux.h file. */
192
193+#ifdef USE_UCLIBC
194+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
195+#else
196+#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
197+#endif
198 #undef LINK_SPEC
199 #define LINK_SPEC "\
200 %{shared:-shared} \
201 %{!shared: \
202 %{!static: \
203 %{rdynamic:-export-dynamic} \
204- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
205+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
206 %{static:-static}}"
207
208
209--- gcc-4.1.0/gcc/config/m68k/linux.h
210+++ gcc-4.1.0/gcc/config/m68k/linux.h
211@@ -123,12 +123,17 @@ Boston, MA 02110-1301, USA. */
212
213 /* If ELF is the default format, we should not use /lib/elf. */
214
215+#ifdef USE_UCLIBC
216+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
217+#else
218+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
219+#endif
220 #undef LINK_SPEC
221 #define LINK_SPEC "-m m68kelf %{shared} \
222 %{!shared: \
223 %{!static: \
224 %{rdynamic:-export-dynamic} \
225- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
226+ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
227 %{static}}"
228
229 /* For compatibility with linux/a.out */
230--- gcc-4.1.0/gcc/config/mips/linux.h
231+++ gcc-4.1.0/gcc/config/mips/linux.h
232@@ -105,6 +105,11 @@ Boston, MA 02110-1301, USA. */
233
234 /* Borrowed from sparc/linux.h */
235 #undef LINK_SPEC
236+#ifdef USE_UCLIBC
237+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
238+#else
239+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
240+#endif
241 #define LINK_SPEC \
242 "%(endian_spec) \
243 %{shared:-shared} \
244@@ -112,7 +117,7 @@ Boston, MA 02110-1301, USA. */
245 %{!ibcs: \
246 %{!static: \
247 %{rdynamic:-export-dynamic} \
248- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
249+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
250 %{static:-static}}}"
251
252 #undef SUBTARGET_ASM_SPEC
253--- gcc-4.1.0/gcc/config/pa/pa-linux.h
254+++ gcc-4.1.0/gcc/config/pa/pa-linux.h
255@@ -49,13 +49,18 @@ Boston, MA 02110-1301, USA. */
256 /* Define this for shared library support because it isn't in the main
257 linux.h file. */
258
259+#ifdef USE_UCLIBC
260+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
261+#else
262+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
263+#endif
264 #undef LINK_SPEC
265 #define LINK_SPEC "\
266 %{shared:-shared} \
267 %{!shared: \
268 %{!static: \
269 %{rdynamic:-export-dynamic} \
270- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
271+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
272 %{static:-static}}"
273
274 /* glibc's profiling functions don't need gcc to allocate counters. */
275--- gcc-4.1.0/gcc/config/rs6000/linux.h
276+++ gcc-4.1.0/gcc/config/rs6000/linux.h
277@@ -72,7 +72,11 @@
278 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
279
280 #undef LINK_OS_DEFAULT_SPEC
281+#ifdef USE_UCLIBC
282+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
283+#else
284 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
285+#endif
286
287 #define LINK_GCC_C_SEQUENCE_SPEC \
288 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
289--- gcc-4.1.0/gcc/config/rs6000/sysv4.h
290+++ gcc-4.1.0/gcc/config/rs6000/sysv4.h
291@@ -866,6 +866,7 @@ extern int fixuplabelno;
292 mcall-linux : %(link_os_linux) ; \
293 mcall-gnu : %(link_os_gnu) ; \
294 mcall-netbsd : %(link_os_netbsd) ; \
295+ mcall-linux-uclibc : %(link_os_linux_uclibc); \
296 mcall-openbsd: %(link_os_openbsd) ; \
297 : %(link_os_default) }"
298
299@@ -1043,6 +1044,10 @@ extern int fixuplabelno;
300 %{rdynamic:-export-dynamic} \
301 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
302
303+#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
304+ %{rdynamic:-export-dynamic} \
305+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
306+
307 #if defined(HAVE_LD_EH_FRAME_HDR)
308 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
309 #endif
310@@ -1209,6 +1214,7 @@ ncrtn.o%s"
311 { "link_os_sim", LINK_OS_SIM_SPEC }, \
312 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
313 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
314+ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
315 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
316 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
317 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
318--- gcc-4.1.0/gcc/config/s390/linux.h
319+++ gcc-4.1.0/gcc/config/s390/linux.h
320@@ -77,6 +77,13 @@ Software Foundation, 51 Franklin Street,
321 #define MULTILIB_DEFAULTS { "m31" }
322 #endif
323
324+#ifdef USE_UCLIBC
325+#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
326+#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
327+#else
328+#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
329+#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
330+#endif
331 #undef LINK_SPEC
332 #define LINK_SPEC \
333 "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
334@@ -86,8 +93,8 @@ Software Foundation, 51 Franklin Street,
335 %{!static: \
336 %{rdynamic:-export-dynamic} \
337 %{!dynamic-linker: \
338- %{m31:-dynamic-linker /lib/ld.so.1} \
339- %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
340+ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
341+ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
342
343
344 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
345--- gcc-4.1.0/gcc/config/sh/linux.h
346+++ gcc-4.1.0/gcc/config/sh/linux.h
347@@ -56,12 +56,21 @@ Boston, MA 02110-1301, USA. */
348 #undef SUBTARGET_LINK_EMUL_SUFFIX
349 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
350 #undef SUBTARGET_LINK_SPEC
351+#ifdef USE_UCLIBC
352+#define SUBTARGET_LINK_SPEC \
353+ "%{shared:-shared} \
354+ %{!static: \
355+ %{rdynamic:-export-dynamic} \
356+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
357+ %{static:-static}"
358+#else
359 #define SUBTARGET_LINK_SPEC \
360 "%{shared:-shared} \
361 %{!static: \
362 %{rdynamic:-export-dynamic} \
363 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
364 %{static:-static}"
365+#endif
366
367 /* Output assembler code to STREAM to call the profiler. */
368
369--- gcc-4.1.0/gcc/config/sparc/linux.h
370+++ gcc-4.1.0/gcc/config/sparc/linux.h
371@@ -125,6 +125,11 @@ Boston, MA 02110-1301, USA. */
372
373 /* If ELF is the default format, we should not use /lib/elf. */
374
375+#ifdef USE_UCLIBC
376+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
377+#else
378+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
379+#endif
380 #undef LINK_SPEC
381 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
382 %{!mno-relax:%{!r:-relax}} \
383@@ -132,7 +137,7 @@ Boston, MA 02110-1301, USA. */
384 %{!ibcs: \
385 %{!static: \
386 %{rdynamic:-export-dynamic} \
387- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
388+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
389 %{static:-static}}}"
390
391 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
392--- gcc-4.1.0/gcc/config/sparc/linux64.h
393+++ gcc-4.1.0/gcc/config/sparc/linux64.h
394@@ -162,12 +162,17 @@ Boston, MA 02110-1301, USA. */
395 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
396 { "link_arch", LINK_ARCH_SPEC },
397
398+#ifdef USE_UCLIBC
399+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
400+#else
401+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
402+#endif
403 #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
404 %{!shared: \
405 %{!ibcs: \
406 %{!static: \
407 %{rdynamic:-export-dynamic} \
408- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
409+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
410 %{static:-static}}} \
411 "
412
413--- gcc-4.1.0/libffi/configure
414+++ gcc-4.1.0/libffi/configure
415@@ -3457,6 +3457,11 @@ linux-gnu*)
416 lt_cv_deplibs_check_method=pass_all
417 ;;
418
419+linux-uclibc*)
420+ lt_cv_deplibs_check_method=pass_all
421+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
422+ ;;
423+
424 netbsd* | knetbsd*-gnu)
425 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
426 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
427--- gcc-4.1.0/libgfortran/configure
428+++ gcc-4.1.0/libgfortran/configure
429@@ -3699,6 +3699,11 @@ linux-gnu*)
430 lt_cv_deplibs_check_method=pass_all
431 ;;
432
433+linux-uclibc*)
434+ lt_cv_deplibs_check_method=pass_all
435+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
436+ ;;
437+
438 netbsd* | knetbsd*-gnu)
439 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
440 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
441--- gcc-4.1.0/libjava/configure
442+++ gcc-4.1.0/libjava/configure
443@@ -5137,6 +5137,11 @@ linux-gnu*)
444 lt_cv_deplibs_check_method=pass_all
445 ;;
446
447+linux-uclibc*)
448+ lt_cv_deplibs_check_method=pass_all
449+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
450+ ;;
451+
452 netbsd* | knetbsd*-gnu)
453 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
454 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
455--- gcc-4.1.0/libmudflap/configure
456+++ gcc-4.1.0/libmudflap/configure
457@@ -5382,6 +5382,11 @@ linux-gnu*)
458 lt_cv_deplibs_check_method=pass_all
459 ;;
460
461+linux-uclibc*)
462+ lt_cv_deplibs_check_method=pass_all
463+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
464+ ;;
465+
466 netbsd* | knetbsd*-gnu)
467 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
468 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
469--- gcc-4.1.0/libobjc/configure
470+++ gcc-4.1.0/libobjc/configure
471@@ -3312,6 +3312,11 @@ linux-gnu*)
472 lt_cv_deplibs_check_method=pass_all
473 ;;
474
475+linux-uclibc*)
476+ lt_cv_deplibs_check_method=pass_all
477+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
478+ ;;
479+
480 netbsd* | knetbsd*-gnu)
481 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
482 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
483--- gcc-4.1.0/libtool.m4
484+++ gcc-4.1.0/libtool.m4
485@@ -743,6 +743,11 @@ linux-gnu*)
486 lt_cv_deplibs_check_method=pass_all
487 ;;
488
489+linux-uclibc*)
490+ lt_cv_deplibs_check_method=pass_all
491+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
492+ ;;
493+
494 netbsd* | knetbsd*-gnu)
495 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
496 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
497--- gcc-4.1.0/ltconfig
498+++ gcc-4.1.0/ltconfig
499@@ -603,6 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
500
501 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
502 case $host_os in
503+linux-uclibc*) ;;
504 linux-gnu*) ;;
505 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
506 esac
507@@ -1274,6 +1275,23 @@ linux-gnu*)
508 dynamic_linker='GNU/Linux ld.so'
509 ;;
510
511+linux-uclibc*)
512+ version_type=linux
513+ need_lib_prefix=no
514+ need_version=no
515+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
516+ soname_spec='${libname}${release}.so$major'
517+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
518+ shlibpath_var=LD_LIBRARY_PATH
519+ shlibpath_overrides_runpath=no
520+ # This implies no fast_install, which is unacceptable.
521+ # Some rework will be needed to allow for fast_install
522+ # before this can be enabled.
523+ hardcode_into_libs=yes
524+ # Assume using the uClibc dynamic linker.
525+ dynamic_linker="uClibc ld.so"
526+ ;;
527+
528 netbsd*)
529 need_lib_prefix=no
530 need_version=no
531--- gcc-4.1.0/zlib/configure
532+++ gcc-4.1.0/zlib/configure
533@@ -3426,6 +3426,11 @@ linux-gnu*)
534 lt_cv_deplibs_check_method=pass_all
535 ;;
536
537+linux-uclibc*)
538+ lt_cv_deplibs_check_method=pass_all
539+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
540+ ;;
541+
542 netbsd* | knetbsd*-gnu)
543 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
544 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch b/meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch
deleted file mode 100644
index acebe5308f..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1--- gcc-2005q3-1.orig/gcc/config.gcc 2005-10-31 19:02:54.000000000 +0300
2+++ gcc-2005q3-1/gcc/config.gcc 2006-01-27 01:09:09.000000000 +0300
3@@ -674,7 +674,7 @@
4 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
5 tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm"
6 case ${target} in
7- arm*-*-linux-gnueabi)
8+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
9 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
10 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
11 # The BPABI long long divmod functions return a 128-bit value in
12
13diff -urN gcc-2005q3-2/gcc/config/arm/linux-eabi.h gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h
14--- gcc-2005q3-2/gcc/config/arm/linux-eabi.h 2005-12-07 23:14:16.000000000 +0300
15+++ gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h 2006-03-29 19:02:34.000000000 +0400
16@@ -53,7 +53,11 @@
17 /* Use ld-linux.so.3 so that it will be possible to run "classic"
18 GNU/Linux binaries on an EABI system. */
19 #undef LINUX_TARGET_INTERPRETER
20+#ifdef USE_UCLIBC
21+#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
22+#else
23 #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3"
24+#endif
25
26 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
27 use the GNU/Linux version, not the generic BPABI version. */
diff --git a/meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch b/meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch
deleted file mode 100644
index 9d65a6234e..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch
+++ /dev/null
@@ -1,3261 +0,0 @@
1diff -urN gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 gcc-4.1.0/libstdc++-v3/acinclude.m4
2--- gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 2006-03-26 12:08:28.000000000 -0700
3+++ gcc-4.1.0/libstdc++-v3/acinclude.m4 2006-03-25 22:06:30.000000000 -0700
4@@ -1071,7 +1071,7 @@
5 AC_MSG_CHECKING([for C locale to use])
6 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
7 [use MODEL for target locale package],
8- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
9+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
10
11 # If they didn't use this option switch, or if they specified --enable
12 # with no specific model, we'll have to look for one. If they
13@@ -1087,6 +1087,9 @@
14 # Default to "generic".
15 if test $enable_clocale_flag = auto; then
16 case ${target_os} in
17+ *-uclibc*)
18+ enable_clocale_flag=uclibc
19+ ;;
20 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
21 AC_EGREP_CPP([_GLIBCXX_ok], [
22 #include <features.h>
23@@ -1230,6 +1233,40 @@
24 CTIME_CC=config/locale/generic/time_members.cc
25 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
26 ;;
27+ uclibc)
28+ AC_MSG_RESULT(uclibc)
29+
30+ # Declare intention to use gettext, and add support for specific
31+ # languages.
32+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
33+ ALL_LINGUAS="de fr"
34+
35+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
36+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
37+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
38+ USE_NLS=yes
39+ fi
40+ # Export the build objects.
41+ for ling in $ALL_LINGUAS; do \
42+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
43+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
44+ done
45+ AC_SUBST(glibcxx_MOFILES)
46+ AC_SUBST(glibcxx_POFILES)
47+
48+ CLOCALE_H=config/locale/uclibc/c_locale.h
49+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
50+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
51+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
52+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
53+ CMESSAGES_H=config/locale/uclibc/messages_members.h
54+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
55+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
56+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
57+ CTIME_H=config/locale/uclibc/time_members.h
58+ CTIME_CC=config/locale/uclibc/time_members.cc
59+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
60+ ;;
61 esac
62
63 # This is where the testsuite looks for locale catalogs, using the
64diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
65--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 17:00:00.000000000 -0700
66+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2006-03-25 22:18:37.000000000 -0700
67@@ -0,0 +1,63 @@
68+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
69+
70+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
71+//
72+// This file is part of the GNU ISO C++ Library. This library is free
73+// software; you can redistribute it and/or modify it under the
74+// terms of the GNU General Public License as published by the
75+// Free Software Foundation; either version 2, or (at your option)
76+// any later version.
77+
78+// This library is distributed in the hope that it will be useful,
79+// but WITHOUT ANY WARRANTY; without even the implied warranty of
80+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81+// GNU General Public License for more details.
82+
83+// You should have received a copy of the GNU General Public License along
84+// with this library; see the file COPYING. If not, write to the Free
85+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
86+// USA.
87+
88+// As a special exception, you may use this file as part of a free software
89+// library without restriction. Specifically, if other files instantiate
90+// templates or use macros or inline functions from this file, or you compile
91+// this file and link it with other files to produce an executable, this
92+// file does not by itself cause the resulting executable to be covered by
93+// the GNU General Public License. This exception does not however
94+// invalidate any other reasons why the executable file might be covered by
95+// the GNU General Public License.
96+
97+// Written by Jakub Jelinek <jakub@redhat.com>
98+
99+#include <bits/c++config.h>
100+#include <clocale>
101+
102+#ifdef __UCLIBC_MJN3_ONLY__
103+#warning clean this up
104+#endif
105+
106+#ifdef __UCLIBC_HAS_XLOCALE__
107+
108+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
109+extern "C" __typeof(strcoll_l) __strcoll_l;
110+extern "C" __typeof(strftime_l) __strftime_l;
111+extern "C" __typeof(strtod_l) __strtod_l;
112+extern "C" __typeof(strtof_l) __strtof_l;
113+extern "C" __typeof(strtold_l) __strtold_l;
114+extern "C" __typeof(strxfrm_l) __strxfrm_l;
115+extern "C" __typeof(newlocale) __newlocale;
116+extern "C" __typeof(freelocale) __freelocale;
117+extern "C" __typeof(duplocale) __duplocale;
118+extern "C" __typeof(uselocale) __uselocale;
119+
120+#ifdef _GLIBCXX_USE_WCHAR_T
121+extern "C" __typeof(iswctype_l) __iswctype_l;
122+extern "C" __typeof(towlower_l) __towlower_l;
123+extern "C" __typeof(towupper_l) __towupper_l;
124+extern "C" __typeof(wcscoll_l) __wcscoll_l;
125+extern "C" __typeof(wcsftime_l) __wcsftime_l;
126+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
127+extern "C" __typeof(wctype_l) __wctype_l;
128+#endif
129+
130+#endif // GLIBC 2.3 and later
131diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
132--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 17:00:00.000000000 -0700
133+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-25 22:18:37.000000000 -0700
134@@ -0,0 +1,152 @@
135+// Wrapper for underlying C-language localization -*- C++ -*-
136+
137+// Copyright (C) 2001, 2002, 2003, 2004, 2005
138+// Free Software Foundation, Inc.
139+//
140+// This file is part of the GNU ISO C++ Library. This library is free
141+// software; you can redistribute it and/or modify it under the
142+// terms of the GNU General Public License as published by the
143+// Free Software Foundation; either version 2, or (at your option)
144+// any later version.
145+
146+// This library is distributed in the hope that it will be useful,
147+// but WITHOUT ANY WARRANTY; without even the implied warranty of
148+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
149+// GNU General Public License for more details.
150+
151+// You should have received a copy of the GNU General Public License along
152+// with this library; see the file COPYING. If not, write to the Free
153+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
154+// USA.
155+
156+// As a special exception, you may use this file as part of a free software
157+// library without restriction. Specifically, if other files instantiate
158+// templates or use macros or inline functions from this file, or you compile
159+// this file and link it with other files to produce an executable, this
160+// file does not by itself cause the resulting executable to be covered by
161+// the GNU General Public License. This exception does not however
162+// invalidate any other reasons why the executable file might be covered by
163+// the GNU General Public License.
164+
165+//
166+// ISO C++ 14882: 22.8 Standard locale categories.
167+//
168+
169+// Written by Benjamin Kosnik <bkoz@redhat.com>
170+
171+#include <cerrno> // For errno
172+#include <locale>
173+#include <stdexcept>
174+#include <langinfo.h>
175+#include <bits/c++locale_internal.h>
176+
177+#ifndef __UCLIBC_HAS_XLOCALE__
178+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
179+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
180+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
181+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
182+#define __strtof_l(S, E, L) strtof((S), (E))
183+#define __strtod_l(S, E, L) strtod((S), (E))
184+#define __strtold_l(S, E, L) strtold((S), (E))
185+#warning should dummy __newlocale check for C|POSIX ?
186+#define __newlocale(a, b, c) NULL
187+#define __freelocale(a) ((void)0)
188+#define __duplocale(a) __c_locale()
189+#endif
190+
191+namespace std
192+{
193+ template<>
194+ void
195+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
196+ const __c_locale& __cloc)
197+ {
198+ char* __sanity;
199+ errno = 0;
200+ float __f = __strtof_l(__s, &__sanity, __cloc);
201+ if (__sanity != __s && errno != ERANGE)
202+ __v = __f;
203+ else
204+ __err |= ios_base::failbit;
205+ }
206+
207+ template<>
208+ void
209+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
210+ const __c_locale& __cloc)
211+ {
212+ char* __sanity;
213+ errno = 0;
214+ double __d = __strtod_l(__s, &__sanity, __cloc);
215+ if (__sanity != __s && errno != ERANGE)
216+ __v = __d;
217+ else
218+ __err |= ios_base::failbit;
219+ }
220+
221+ template<>
222+ void
223+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
224+ const __c_locale& __cloc)
225+ {
226+ char* __sanity;
227+ errno = 0;
228+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
229+ if (__sanity != __s && errno != ERANGE)
230+ __v = __ld;
231+ else
232+ __err |= ios_base::failbit;
233+ }
234+
235+ void
236+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
237+ __c_locale __old)
238+ {
239+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
240+#ifdef __UCLIBC_HAS_XLOCALE__
241+ if (!__cloc)
242+ {
243+ // This named locale is not supported by the underlying OS.
244+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
245+ "name not valid"));
246+ }
247+#endif
248+ }
249+
250+ void
251+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
252+ {
253+ if (__cloc && _S_get_c_locale() != __cloc)
254+ __freelocale(__cloc);
255+ }
256+
257+ __c_locale
258+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
259+ { return __duplocale(__cloc); }
260+} // namespace std
261+
262+namespace __gnu_cxx
263+{
264+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
265+ {
266+ "LC_CTYPE",
267+ "LC_NUMERIC",
268+ "LC_TIME",
269+ "LC_COLLATE",
270+ "LC_MONETARY",
271+ "LC_MESSAGES",
272+#if _GLIBCXX_NUM_CATEGORIES != 0
273+ "LC_PAPER",
274+ "LC_NAME",
275+ "LC_ADDRESS",
276+ "LC_TELEPHONE",
277+ "LC_MEASUREMENT",
278+ "LC_IDENTIFICATION"
279+#endif
280+ };
281+}
282+
283+namespace std
284+{
285+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
286+} // namespace std
287diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h
288--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 17:00:00.000000000 -0700
289+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-03-26 13:03:42.000000000 -0700
290@@ -0,0 +1,117 @@
291+// Wrapper for underlying C-language localization -*- C++ -*-
292+
293+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
294+//
295+// This file is part of the GNU ISO C++ Library. This library is free
296+// software; you can redistribute it and/or modify it under the
297+// terms of the GNU General Public License as published by the
298+// Free Software Foundation; either version 2, or (at your option)
299+// any later version.
300+
301+// This library is distributed in the hope that it will be useful,
302+// but WITHOUT ANY WARRANTY; without even the implied warranty of
303+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304+// GNU General Public License for more details.
305+
306+// You should have received a copy of the GNU General Public License along
307+// with this library; see the file COPYING. If not, write to the Free
308+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
309+// USA.
310+
311+// As a special exception, you may use this file as part of a free software
312+// library without restriction. Specifically, if other files instantiate
313+// templates or use macros or inline functions from this file, or you compile
314+// this file and link it with other files to produce an executable, this
315+// file does not by itself cause the resulting executable to be covered by
316+// the GNU General Public License. This exception does not however
317+// invalidate any other reasons why the executable file might be covered by
318+// the GNU General Public License.
319+
320+//
321+// ISO C++ 14882: 22.8 Standard locale categories.
322+//
323+
324+// Written by Benjamin Kosnik <bkoz@redhat.com>
325+
326+#ifndef _C_LOCALE_H
327+#define _C_LOCALE_H 1
328+
329+#pragma GCC system_header
330+
331+#include <cstring> // get std::strlen
332+#include <cstdio> // get std::snprintf or std::sprintf
333+#include <clocale>
334+#include <langinfo.h> // For codecvt
335+#ifdef __UCLIBC_MJN3_ONLY__
336+#warning fix this
337+#endif
338+#ifdef __UCLIBC_HAS_LOCALE__
339+#include <iconv.h> // For codecvt using iconv, iconv_t
340+#endif
341+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
342+#include <libintl.h> // For messages
343+#endif
344+
345+#ifdef __UCLIBC_MJN3_ONLY__
346+#warning what is _GLIBCXX_C_LOCALE_GNU for
347+#endif
348+#define _GLIBCXX_C_LOCALE_GNU 1
349+
350+#ifdef __UCLIBC_MJN3_ONLY__
351+#warning fix categories
352+#endif
353+// #define _GLIBCXX_NUM_CATEGORIES 6
354+#define _GLIBCXX_NUM_CATEGORIES 0
355+
356+#ifdef __UCLIBC_HAS_XLOCALE__
357+namespace __gnu_cxx
358+{
359+ extern "C" __typeof(uselocale) __uselocale;
360+}
361+#endif
362+
363+namespace std
364+{
365+#ifdef __UCLIBC_HAS_XLOCALE__
366+ typedef __locale_t __c_locale;
367+#else
368+ typedef int* __c_locale;
369+#endif
370+
371+ // Convert numeric value of type _Tv to string and return length of
372+ // string. If snprintf is available use it, otherwise fall back to
373+ // the unsafe sprintf which, in general, can be dangerous and should
374+ // be avoided.
375+ template<typename _Tv>
376+ int
377+ __convert_from_v(char* __out,
378+ const int __size __attribute__ ((__unused__)),
379+ const char* __fmt,
380+#ifdef __UCLIBC_HAS_XLOCALE__
381+ _Tv __v, const __c_locale& __cloc, int __prec)
382+ {
383+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
384+#else
385+ _Tv __v, const __c_locale&, int __prec)
386+ {
387+# ifdef __UCLIBC_HAS_LOCALE__
388+ char* __old = std::setlocale(LC_ALL, NULL);
389+ char* __sav = new char[std::strlen(__old) + 1];
390+ std::strcpy(__sav, __old);
391+ std::setlocale(LC_ALL, "C");
392+# endif
393+#endif
394+
395+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
396+
397+#ifdef __UCLIBC_HAS_XLOCALE__
398+ __gnu_cxx::__uselocale(__old);
399+#elif defined __UCLIBC_HAS_LOCALE__
400+ std::setlocale(LC_ALL, __sav);
401+ delete [] __sav;
402+#endif
403+ return __ret;
404+ }
405+}
406+
407+#endif
408diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
409--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 17:00:00.000000000 -0700
410+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2006-03-25 22:18:37.000000000 -0700
411@@ -0,0 +1,306 @@
412+// std::codecvt implementation details, GNU version -*- C++ -*-
413+
414+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
415+//
416+// This file is part of the GNU ISO C++ Library. This library is free
417+// software; you can redistribute it and/or modify it under the
418+// terms of the GNU General Public License as published by the
419+// Free Software Foundation; either version 2, or (at your option)
420+// any later version.
421+
422+// This library is distributed in the hope that it will be useful,
423+// but WITHOUT ANY WARRANTY; without even the implied warranty of
424+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
425+// GNU General Public License for more details.
426+
427+// You should have received a copy of the GNU General Public License along
428+// with this library; see the file COPYING. If not, write to the Free
429+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
430+// USA.
431+
432+// As a special exception, you may use this file as part of a free software
433+// library without restriction. Specifically, if other files instantiate
434+// templates or use macros or inline functions from this file, or you compile
435+// this file and link it with other files to produce an executable, this
436+// file does not by itself cause the resulting executable to be covered by
437+// the GNU General Public License. This exception does not however
438+// invalidate any other reasons why the executable file might be covered by
439+// the GNU General Public License.
440+
441+//
442+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
443+//
444+
445+// Written by Benjamin Kosnik <bkoz@redhat.com>
446+
447+#include <locale>
448+#include <bits/c++locale_internal.h>
449+
450+namespace std
451+{
452+ // Specializations.
453+#ifdef _GLIBCXX_USE_WCHAR_T
454+ codecvt_base::result
455+ codecvt<wchar_t, char, mbstate_t>::
456+ do_out(state_type& __state, const intern_type* __from,
457+ const intern_type* __from_end, const intern_type*& __from_next,
458+ extern_type* __to, extern_type* __to_end,
459+ extern_type*& __to_next) const
460+ {
461+ result __ret = ok;
462+ state_type __tmp_state(__state);
463+
464+#ifdef __UCLIBC_HAS_XLOCALE__
465+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
466+#endif
467+
468+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
469+ // in case we fall back to wcrtomb and then continue, in a loop.
470+ // NB: wcsnrtombs is a GNU extension
471+ for (__from_next = __from, __to_next = __to;
472+ __from_next < __from_end && __to_next < __to_end
473+ && __ret == ok;)
474+ {
475+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
476+ __from_end - __from_next);
477+ if (!__from_chunk_end)
478+ __from_chunk_end = __from_end;
479+
480+ __from = __from_next;
481+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
482+ __from_chunk_end - __from_next,
483+ __to_end - __to_next, &__state);
484+ if (__conv == static_cast<size_t>(-1))
485+ {
486+ // In case of error, in order to stop at the exact place we
487+ // have to start again from the beginning with a series of
488+ // wcrtomb.
489+ for (; __from < __from_next; ++__from)
490+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
491+ __state = __tmp_state;
492+ __ret = error;
493+ }
494+ else if (__from_next && __from_next < __from_chunk_end)
495+ {
496+ __to_next += __conv;
497+ __ret = partial;
498+ }
499+ else
500+ {
501+ __from_next = __from_chunk_end;
502+ __to_next += __conv;
503+ }
504+
505+ if (__from_next < __from_end && __ret == ok)
506+ {
507+ extern_type __buf[MB_LEN_MAX];
508+ __tmp_state = __state;
509+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
510+ if (__conv > static_cast<size_t>(__to_end - __to_next))
511+ __ret = partial;
512+ else
513+ {
514+ memcpy(__to_next, __buf, __conv);
515+ __state = __tmp_state;
516+ __to_next += __conv;
517+ ++__from_next;
518+ }
519+ }
520+ }
521+
522+#ifdef __UCLIBC_HAS_XLOCALE__
523+ __uselocale(__old);
524+#endif
525+
526+ return __ret;
527+ }
528+
529+ codecvt_base::result
530+ codecvt<wchar_t, char, mbstate_t>::
531+ do_in(state_type& __state, const extern_type* __from,
532+ const extern_type* __from_end, const extern_type*& __from_next,
533+ intern_type* __to, intern_type* __to_end,
534+ intern_type*& __to_next) const
535+ {
536+ result __ret = ok;
537+ state_type __tmp_state(__state);
538+
539+#ifdef __UCLIBC_HAS_XLOCALE__
540+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
541+#endif
542+
543+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
544+ // in case we store a L'\0' and then continue, in a loop.
545+ // NB: mbsnrtowcs is a GNU extension
546+ for (__from_next = __from, __to_next = __to;
547+ __from_next < __from_end && __to_next < __to_end
548+ && __ret == ok;)
549+ {
550+ const extern_type* __from_chunk_end;
551+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
552+ __from_end
553+ - __from_next));
554+ if (!__from_chunk_end)
555+ __from_chunk_end = __from_end;
556+
557+ __from = __from_next;
558+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
559+ __from_chunk_end - __from_next,
560+ __to_end - __to_next, &__state);
561+ if (__conv == static_cast<size_t>(-1))
562+ {
563+ // In case of error, in order to stop at the exact place we
564+ // have to start again from the beginning with a series of
565+ // mbrtowc.
566+ for (;; ++__to_next, __from += __conv)
567+ {
568+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
569+ &__tmp_state);
570+ if (__conv == static_cast<size_t>(-1)
571+ || __conv == static_cast<size_t>(-2))
572+ break;
573+ }
574+ __from_next = __from;
575+ __state = __tmp_state;
576+ __ret = error;
577+ }
578+ else if (__from_next && __from_next < __from_chunk_end)
579+ {
580+ // It is unclear what to return in this case (see DR 382).
581+ __to_next += __conv;
582+ __ret = partial;
583+ }
584+ else
585+ {
586+ __from_next = __from_chunk_end;
587+ __to_next += __conv;
588+ }
589+
590+ if (__from_next < __from_end && __ret == ok)
591+ {
592+ if (__to_next < __to_end)
593+ {
594+ // XXX Probably wrong for stateful encodings
595+ __tmp_state = __state;
596+ ++__from_next;
597+ *__to_next++ = L'\0';
598+ }
599+ else
600+ __ret = partial;
601+ }
602+ }
603+
604+#ifdef __UCLIBC_HAS_XLOCALE__
605+ __uselocale(__old);
606+#endif
607+
608+ return __ret;
609+ }
610+
611+ int
612+ codecvt<wchar_t, char, mbstate_t>::
613+ do_encoding() const throw()
614+ {
615+ // XXX This implementation assumes that the encoding is
616+ // stateless and is either single-byte or variable-width.
617+ int __ret = 0;
618+#ifdef __UCLIBC_HAS_XLOCALE__
619+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
620+#endif
621+ if (MB_CUR_MAX == 1)
622+ __ret = 1;
623+#ifdef __UCLIBC_HAS_XLOCALE__
624+ __uselocale(__old);
625+#endif
626+ return __ret;
627+ }
628+
629+ int
630+ codecvt<wchar_t, char, mbstate_t>::
631+ do_max_length() const throw()
632+ {
633+#ifdef __UCLIBC_HAS_XLOCALE__
634+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
635+#endif
636+ // XXX Probably wrong for stateful encodings.
637+ int __ret = MB_CUR_MAX;
638+#ifdef __UCLIBC_HAS_XLOCALE__
639+ __uselocale(__old);
640+#endif
641+ return __ret;
642+ }
643+
644+ int
645+ codecvt<wchar_t, char, mbstate_t>::
646+ do_length(state_type& __state, const extern_type* __from,
647+ const extern_type* __end, size_t __max) const
648+ {
649+ int __ret = 0;
650+ state_type __tmp_state(__state);
651+
652+#ifdef __UCLIBC_HAS_XLOCALE__
653+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
654+#endif
655+
656+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
657+ // in case we advance past it and then continue, in a loop.
658+ // NB: mbsnrtowcs is a GNU extension
659+
660+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
661+ // its fourth parameter (it wouldn't with NULL as first parameter).
662+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
663+ * __max));
664+ while (__from < __end && __max)
665+ {
666+ const extern_type* __from_chunk_end;
667+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
668+ __end
669+ - __from));
670+ if (!__from_chunk_end)
671+ __from_chunk_end = __end;
672+
673+ const extern_type* __tmp_from = __from;
674+ size_t __conv = mbsnrtowcs(__to, &__from,
675+ __from_chunk_end - __from,
676+ __max, &__state);
677+ if (__conv == static_cast<size_t>(-1))
678+ {
679+ // In case of error, in order to stop at the exact place we
680+ // have to start again from the beginning with a series of
681+ // mbrtowc.
682+ for (__from = __tmp_from;; __from += __conv)
683+ {
684+ __conv = mbrtowc(NULL, __from, __end - __from,
685+ &__tmp_state);
686+ if (__conv == static_cast<size_t>(-1)
687+ || __conv == static_cast<size_t>(-2))
688+ break;
689+ }
690+ __state = __tmp_state;
691+ __ret += __from - __tmp_from;
692+ break;
693+ }
694+ if (!__from)
695+ __from = __from_chunk_end;
696+
697+ __ret += __from - __tmp_from;
698+ __max -= __conv;
699+
700+ if (__from < __end && __max)
701+ {
702+ // XXX Probably wrong for stateful encodings
703+ __tmp_state = __state;
704+ ++__from;
705+ ++__ret;
706+ --__max;
707+ }
708+ }
709+
710+#ifdef __UCLIBC_HAS_XLOCALE__
711+ __uselocale(__old);
712+#endif
713+
714+ return __ret;
715+ }
716+#endif
717+}
718diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
719--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 17:00:00.000000000 -0700
720+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2006-03-25 22:18:37.000000000 -0700
721@@ -0,0 +1,80 @@
722+// std::collate implementation details, GNU version -*- C++ -*-
723+
724+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
725+//
726+// This file is part of the GNU ISO C++ Library. This library is free
727+// software; you can redistribute it and/or modify it under the
728+// terms of the GNU General Public License as published by the
729+// Free Software Foundation; either version 2, or (at your option)
730+// any later version.
731+
732+// This library is distributed in the hope that it will be useful,
733+// but WITHOUT ANY WARRANTY; without even the implied warranty of
734+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
735+// GNU General Public License for more details.
736+
737+// You should have received a copy of the GNU General Public License along
738+// with this library; see the file COPYING. If not, write to the Free
739+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
740+// USA.
741+
742+// As a special exception, you may use this file as part of a free software
743+// library without restriction. Specifically, if other files instantiate
744+// templates or use macros or inline functions from this file, or you compile
745+// this file and link it with other files to produce an executable, this
746+// file does not by itself cause the resulting executable to be covered by
747+// the GNU General Public License. This exception does not however
748+// invalidate any other reasons why the executable file might be covered by
749+// the GNU General Public License.
750+
751+//
752+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
753+//
754+
755+// Written by Benjamin Kosnik <bkoz@redhat.com>
756+
757+#include <locale>
758+#include <bits/c++locale_internal.h>
759+
760+#ifndef __UCLIBC_HAS_XLOCALE__
761+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
762+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
763+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
764+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
765+#endif
766+
767+namespace std
768+{
769+ // These are basically extensions to char_traits, and perhaps should
770+ // be put there instead of here.
771+ template<>
772+ int
773+ collate<char>::_M_compare(const char* __one, const char* __two) const
774+ {
775+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
776+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
777+ }
778+
779+ template<>
780+ size_t
781+ collate<char>::_M_transform(char* __to, const char* __from,
782+ size_t __n) const
783+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
784+
785+#ifdef _GLIBCXX_USE_WCHAR_T
786+ template<>
787+ int
788+ collate<wchar_t>::_M_compare(const wchar_t* __one,
789+ const wchar_t* __two) const
790+ {
791+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
792+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
793+ }
794+
795+ template<>
796+ size_t
797+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
798+ size_t __n) const
799+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
800+#endif
801+}
802diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
803--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 17:00:00.000000000 -0700
804+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-25 22:18:37.000000000 -0700
805@@ -0,0 +1,314 @@
806+// std::ctype implementation details, GNU version -*- C++ -*-
807+
808+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
809+//
810+// This file is part of the GNU ISO C++ Library. This library is free
811+// software; you can redistribute it and/or modify it under the
812+// terms of the GNU General Public License as published by the
813+// Free Software Foundation; either version 2, or (at your option)
814+// any later version.
815+
816+// This library is distributed in the hope that it will be useful,
817+// but WITHOUT ANY WARRANTY; without even the implied warranty of
818+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
819+// GNU General Public License for more details.
820+
821+// You should have received a copy of the GNU General Public License along
822+// with this library; see the file COPYING. If not, write to the Free
823+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
824+// USA.
825+
826+// As a special exception, you may use this file as part of a free software
827+// library without restriction. Specifically, if other files instantiate
828+// templates or use macros or inline functions from this file, or you compile
829+// this file and link it with other files to produce an executable, this
830+// file does not by itself cause the resulting executable to be covered by
831+// the GNU General Public License. This exception does not however
832+// invalidate any other reasons why the executable file might be covered by
833+// the GNU General Public License.
834+
835+//
836+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
837+//
838+
839+// Written by Benjamin Kosnik <bkoz@redhat.com>
840+
841+#define _LIBC
842+#include <locale>
843+#undef _LIBC
844+#include <bits/c++locale_internal.h>
845+
846+#ifndef __UCLIBC_HAS_XLOCALE__
847+#define __wctype_l(S, L) wctype((S))
848+#define __towupper_l(C, L) towupper((C))
849+#define __towlower_l(C, L) towlower((C))
850+#define __iswctype_l(C, M, L) iswctype((C), (M))
851+#endif
852+
853+namespace std
854+{
855+ // NB: The other ctype<char> specializations are in src/locale.cc and
856+ // various /config/os/* files.
857+ template<>
858+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
859+ : ctype<char>(0, false, __refs)
860+ {
861+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
862+ {
863+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
864+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
865+#ifdef __UCLIBC_HAS_XLOCALE__
866+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
867+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
868+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
869+#endif
870+ }
871+ }
872+
873+#ifdef _GLIBCXX_USE_WCHAR_T
874+ ctype<wchar_t>::__wmask_type
875+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
876+ {
877+ __wmask_type __ret;
878+ switch (__m)
879+ {
880+ case space:
881+ __ret = __wctype_l("space", _M_c_locale_ctype);
882+ break;
883+ case print:
884+ __ret = __wctype_l("print", _M_c_locale_ctype);
885+ break;
886+ case cntrl:
887+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
888+ break;
889+ case upper:
890+ __ret = __wctype_l("upper", _M_c_locale_ctype);
891+ break;
892+ case lower:
893+ __ret = __wctype_l("lower", _M_c_locale_ctype);
894+ break;
895+ case alpha:
896+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
897+ break;
898+ case digit:
899+ __ret = __wctype_l("digit", _M_c_locale_ctype);
900+ break;
901+ case punct:
902+ __ret = __wctype_l("punct", _M_c_locale_ctype);
903+ break;
904+ case xdigit:
905+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
906+ break;
907+ case alnum:
908+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
909+ break;
910+ case graph:
911+ __ret = __wctype_l("graph", _M_c_locale_ctype);
912+ break;
913+ default:
914+ __ret = __wmask_type();
915+ }
916+ return __ret;
917+ }
918+
919+ wchar_t
920+ ctype<wchar_t>::do_toupper(wchar_t __c) const
921+ { return __towupper_l(__c, _M_c_locale_ctype); }
922+
923+ const wchar_t*
924+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
925+ {
926+ while (__lo < __hi)
927+ {
928+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
929+ ++__lo;
930+ }
931+ return __hi;
932+ }
933+
934+ wchar_t
935+ ctype<wchar_t>::do_tolower(wchar_t __c) const
936+ { return __towlower_l(__c, _M_c_locale_ctype); }
937+
938+ const wchar_t*
939+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
940+ {
941+ while (__lo < __hi)
942+ {
943+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
944+ ++__lo;
945+ }
946+ return __hi;
947+ }
948+
949+ bool
950+ ctype<wchar_t>::
951+ do_is(mask __m, wchar_t __c) const
952+ {
953+ // The case of __m == ctype_base::space is particularly important,
954+ // due to its use in many istream functions. Therefore we deal with
955+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
956+ // is the mask corresponding to ctype_base::space. NB: an encoding
957+ // change would not affect correctness!
958+ bool __ret = false;
959+ if (__m == _M_bit[5])
960+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
961+ else
962+ {
963+ // Highest bitmask in ctype_base == 10, but extra in "C"
964+ // library for blank.
965+ const size_t __bitmasksize = 11;
966+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
967+ if (__m & _M_bit[__bitcur])
968+ {
969+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
970+ {
971+ __ret = true;
972+ break;
973+ }
974+ else if (__m == _M_bit[__bitcur])
975+ break;
976+ }
977+ }
978+ return __ret;
979+ }
980+
981+ const wchar_t*
982+ ctype<wchar_t>::
983+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
984+ {
985+ for (; __lo < __hi; ++__vec, ++__lo)
986+ {
987+ // Highest bitmask in ctype_base == 10, but extra in "C"
988+ // library for blank.
989+ const size_t __bitmasksize = 11;
990+ mask __m = 0;
991+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
992+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
993+ __m |= _M_bit[__bitcur];
994+ *__vec = __m;
995+ }
996+ return __hi;
997+ }
998+
999+ const wchar_t*
1000+ ctype<wchar_t>::
1001+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1002+ {
1003+ while (__lo < __hi && !this->do_is(__m, *__lo))
1004+ ++__lo;
1005+ return __lo;
1006+ }
1007+
1008+ const wchar_t*
1009+ ctype<wchar_t>::
1010+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1011+ {
1012+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1013+ ++__lo;
1014+ return __lo;
1015+ }
1016+
1017+ wchar_t
1018+ ctype<wchar_t>::
1019+ do_widen(char __c) const
1020+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1021+
1022+ const char*
1023+ ctype<wchar_t>::
1024+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1025+ {
1026+ while (__lo < __hi)
1027+ {
1028+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1029+ ++__lo;
1030+ ++__dest;
1031+ }
1032+ return __hi;
1033+ }
1034+
1035+ char
1036+ ctype<wchar_t>::
1037+ do_narrow(wchar_t __wc, char __dfault) const
1038+ {
1039+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1040+ return _M_narrow[__wc];
1041+#ifdef __UCLIBC_HAS_XLOCALE__
1042+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1043+#endif
1044+ const int __c = wctob(__wc);
1045+#ifdef __UCLIBC_HAS_XLOCALE__
1046+ __uselocale(__old);
1047+#endif
1048+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1049+ }
1050+
1051+ const wchar_t*
1052+ ctype<wchar_t>::
1053+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1054+ char* __dest) const
1055+ {
1056+#ifdef __UCLIBC_HAS_XLOCALE__
1057+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1058+#endif
1059+ if (_M_narrow_ok)
1060+ while (__lo < __hi)
1061+ {
1062+ if (*__lo >= 0 && *__lo < 128)
1063+ *__dest = _M_narrow[*__lo];
1064+ else
1065+ {
1066+ const int __c = wctob(*__lo);
1067+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1068+ }
1069+ ++__lo;
1070+ ++__dest;
1071+ }
1072+ else
1073+ while (__lo < __hi)
1074+ {
1075+ const int __c = wctob(*__lo);
1076+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1077+ ++__lo;
1078+ ++__dest;
1079+ }
1080+#ifdef __UCLIBC_HAS_XLOCALE__
1081+ __uselocale(__old);
1082+#endif
1083+ return __hi;
1084+ }
1085+
1086+ void
1087+ ctype<wchar_t>::_M_initialize_ctype()
1088+ {
1089+#ifdef __UCLIBC_HAS_XLOCALE__
1090+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1091+#endif
1092+ wint_t __i;
1093+ for (__i = 0; __i < 128; ++__i)
1094+ {
1095+ const int __c = wctob(__i);
1096+ if (__c == EOF)
1097+ break;
1098+ else
1099+ _M_narrow[__i] = static_cast<char>(__c);
1100+ }
1101+ if (__i == 128)
1102+ _M_narrow_ok = true;
1103+ else
1104+ _M_narrow_ok = false;
1105+ for (size_t __j = 0;
1106+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1107+ _M_widen[__j] = btowc(__j);
1108+
1109+ for (size_t __k = 0; __k <= 11; ++__k)
1110+ {
1111+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1112+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1113+ }
1114+#ifdef __UCLIBC_HAS_XLOCALE__
1115+ __uselocale(__old);
1116+#endif
1117+ }
1118+#endif // _GLIBCXX_USE_WCHAR_T
1119+}
1120diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
1121--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 17:00:00.000000000 -0700
1122+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2006-03-25 22:18:37.000000000 -0700
1123@@ -0,0 +1,100 @@
1124+// std::messages implementation details, GNU version -*- C++ -*-
1125+
1126+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1127+//
1128+// This file is part of the GNU ISO C++ Library. This library is free
1129+// software; you can redistribute it and/or modify it under the
1130+// terms of the GNU General Public License as published by the
1131+// Free Software Foundation; either version 2, or (at your option)
1132+// any later version.
1133+
1134+// This library is distributed in the hope that it will be useful,
1135+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1136+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1137+// GNU General Public License for more details.
1138+
1139+// You should have received a copy of the GNU General Public License along
1140+// with this library; see the file COPYING. If not, write to the Free
1141+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1142+// USA.
1143+
1144+// As a special exception, you may use this file as part of a free software
1145+// library without restriction. Specifically, if other files instantiate
1146+// templates or use macros or inline functions from this file, or you compile
1147+// this file and link it with other files to produce an executable, this
1148+// file does not by itself cause the resulting executable to be covered by
1149+// the GNU General Public License. This exception does not however
1150+// invalidate any other reasons why the executable file might be covered by
1151+// the GNU General Public License.
1152+
1153+//
1154+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1155+//
1156+
1157+// Written by Benjamin Kosnik <bkoz@redhat.com>
1158+
1159+#include <locale>
1160+#include <bits/c++locale_internal.h>
1161+
1162+#ifdef __UCLIBC_MJN3_ONLY__
1163+#warning fix gettext stuff
1164+#endif
1165+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1166+extern "C" char *__dcgettext(const char *domainname,
1167+ const char *msgid, int category);
1168+#undef gettext
1169+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1170+#else
1171+#undef gettext
1172+#define gettext(msgid) (msgid)
1173+#endif
1174+
1175+namespace std
1176+{
1177+ // Specializations.
1178+ template<>
1179+ string
1180+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1181+ {
1182+#ifdef __UCLIBC_HAS_XLOCALE__
1183+ __c_locale __old = __uselocale(_M_c_locale_messages);
1184+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1185+ __uselocale(__old);
1186+ return string(__msg);
1187+#elif defined __UCLIBC_HAS_LOCALE__
1188+ char* __old = strdup(setlocale(LC_ALL, NULL));
1189+ setlocale(LC_ALL, _M_name_messages);
1190+ const char* __msg = gettext(__dfault.c_str());
1191+ setlocale(LC_ALL, __old);
1192+ free(__old);
1193+ return string(__msg);
1194+#else
1195+ const char* __msg = gettext(__dfault.c_str());
1196+ return string(__msg);
1197+#endif
1198+ }
1199+
1200+#ifdef _GLIBCXX_USE_WCHAR_T
1201+ template<>
1202+ wstring
1203+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1204+ {
1205+# ifdef __UCLIBC_HAS_XLOCALE__
1206+ __c_locale __old = __uselocale(_M_c_locale_messages);
1207+ char* __msg = gettext(_M_convert_to_char(__dfault));
1208+ __uselocale(__old);
1209+ return _M_convert_from_char(__msg);
1210+# elif defined __UCLIBC_HAS_LOCALE__
1211+ char* __old = strdup(setlocale(LC_ALL, NULL));
1212+ setlocale(LC_ALL, _M_name_messages);
1213+ char* __msg = gettext(_M_convert_to_char(__dfault));
1214+ setlocale(LC_ALL, __old);
1215+ free(__old);
1216+ return _M_convert_from_char(__msg);
1217+# else
1218+ char* __msg = gettext(_M_convert_to_char(__dfault));
1219+ return _M_convert_from_char(__msg);
1220+# endif
1221+ }
1222+#endif
1223+}
1224diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h
1225--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 17:00:00.000000000 -0700
1226+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-25 22:18:37.000000000 -0700
1227@@ -0,0 +1,121 @@
1228+// std::messages implementation details, GNU version -*- C++ -*-
1229+
1230+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1231+//
1232+// This file is part of the GNU ISO C++ Library. This library is free
1233+// software; you can redistribute it and/or modify it under the
1234+// terms of the GNU General Public License as published by the
1235+// Free Software Foundation; either version 2, or (at your option)
1236+// any later version.
1237+
1238+// This library is distributed in the hope that it will be useful,
1239+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1240+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1241+// GNU General Public License for more details.
1242+
1243+// You should have received a copy of the GNU General Public License along
1244+// with this library; see the file COPYING. If not, write to the Free
1245+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1246+// USA.
1247+
1248+// As a special exception, you may use this file as part of a free software
1249+// library without restriction. Specifically, if other files instantiate
1250+// templates or use macros or inline functions from this file, or you compile
1251+// this file and link it with other files to produce an executable, this
1252+// file does not by itself cause the resulting executable to be covered by
1253+// the GNU General Public License. This exception does not however
1254+// invalidate any other reasons why the executable file might be covered by
1255+// the GNU General Public License.
1256+
1257+//
1258+// ISO C++ 14882: 22.2.7.1.2 messages functions
1259+//
1260+
1261+// Written by Benjamin Kosnik <bkoz@redhat.com>
1262+
1263+#ifdef __UCLIBC_MJN3_ONLY__
1264+#warning fix prototypes for *textdomain funcs
1265+#endif
1266+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1267+extern "C" char *__textdomain(const char *domainname);
1268+extern "C" char *__bindtextdomain(const char *domainname,
1269+ const char *dirname);
1270+#else
1271+#undef __textdomain
1272+#undef __bindtextdomain
1273+#define __textdomain(D) ((void)0)
1274+#define __bindtextdomain(D,P) ((void)0)
1275+#endif
1276+
1277+ // Non-virtual member functions.
1278+ template<typename _CharT>
1279+ messages<_CharT>::messages(size_t __refs)
1280+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1281+ _M_name_messages(_S_get_c_name())
1282+ { }
1283+
1284+ template<typename _CharT>
1285+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1286+ size_t __refs)
1287+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
1288+ {
1289+ const size_t __len = std::strlen(__s) + 1;
1290+ char* __tmp = new char[__len];
1291+ std::memcpy(__tmp, __s, __len);
1292+ _M_name_messages = __tmp;
1293+
1294+ // Last to avoid leaking memory if new throws.
1295+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
1296+ }
1297+
1298+ template<typename _CharT>
1299+ typename messages<_CharT>::catalog
1300+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1301+ const char* __dir) const
1302+ {
1303+ __bindtextdomain(__s.c_str(), __dir);
1304+ return this->do_open(__s, __loc);
1305+ }
1306+
1307+ // Virtual member functions.
1308+ template<typename _CharT>
1309+ messages<_CharT>::~messages()
1310+ {
1311+ if (_M_name_messages != _S_get_c_name())
1312+ delete [] _M_name_messages;
1313+ _S_destroy_c_locale(_M_c_locale_messages);
1314+ }
1315+
1316+ template<typename _CharT>
1317+ typename messages<_CharT>::catalog
1318+ messages<_CharT>::do_open(const basic_string<char>& __s,
1319+ const locale&) const
1320+ {
1321+ // No error checking is done, assume the catalog exists and can
1322+ // be used.
1323+ __textdomain(__s.c_str());
1324+ return 0;
1325+ }
1326+
1327+ template<typename _CharT>
1328+ void
1329+ messages<_CharT>::do_close(catalog) const
1330+ { }
1331+
1332+ // messages_byname
1333+ template<typename _CharT>
1334+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1335+ : messages<_CharT>(__refs)
1336+ {
1337+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1338+ delete [] this->_M_name_messages;
1339+ char* __tmp = new char[std::strlen(__s) + 1];
1340+ std::strcpy(__tmp, __s);
1341+ this->_M_name_messages = __tmp;
1342+
1343+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1344+ {
1345+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1346+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1347+ }
1348+ }
1349diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1350--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 17:00:00.000000000 -0700
1351+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-25 22:18:37.000000000 -0700
1352@@ -0,0 +1,692 @@
1353+// std::moneypunct implementation details, GNU version -*- C++ -*-
1354+
1355+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1356+//
1357+// This file is part of the GNU ISO C++ Library. This library is free
1358+// software; you can redistribute it and/or modify it under the
1359+// terms of the GNU General Public License as published by the
1360+// Free Software Foundation; either version 2, or (at your option)
1361+// any later version.
1362+
1363+// This library is distributed in the hope that it will be useful,
1364+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1365+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1366+// GNU General Public License for more details.
1367+
1368+// You should have received a copy of the GNU General Public License along
1369+// with this library; see the file COPYING. If not, write to the Free
1370+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1371+// USA.
1372+
1373+// As a special exception, you may use this file as part of a free software
1374+// library without restriction. Specifically, if other files instantiate
1375+// templates or use macros or inline functions from this file, or you compile
1376+// this file and link it with other files to produce an executable, this
1377+// file does not by itself cause the resulting executable to be covered by
1378+// the GNU General Public License. This exception does not however
1379+// invalidate any other reasons why the executable file might be covered by
1380+// the GNU General Public License.
1381+
1382+//
1383+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1384+//
1385+
1386+// Written by Benjamin Kosnik <bkoz@redhat.com>
1387+
1388+#define _LIBC
1389+#include <locale>
1390+#undef _LIBC
1391+#include <bits/c++locale_internal.h>
1392+
1393+#ifdef __UCLIBC_MJN3_ONLY__
1394+#warning optimize this for uclibc
1395+#warning tailor for stub locale support
1396+#endif
1397+
1398+#ifndef __UCLIBC_HAS_XLOCALE__
1399+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1400+#endif
1401+
1402+namespace std
1403+{
1404+ // Construct and return valid pattern consisting of some combination of:
1405+ // space none symbol sign value
1406+ money_base::pattern
1407+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1408+ {
1409+ pattern __ret;
1410+
1411+ // This insanely complicated routine attempts to construct a valid
1412+ // pattern for use with monyepunct. A couple of invariants:
1413+
1414+ // if (__precedes) symbol -> value
1415+ // else value -> symbol
1416+
1417+ // if (__space) space
1418+ // else none
1419+
1420+ // none == never first
1421+ // space never first or last
1422+
1423+ // Any elegant implementations of this are welcome.
1424+ switch (__posn)
1425+ {
1426+ case 0:
1427+ case 1:
1428+ // 1 The sign precedes the value and symbol.
1429+ __ret.field[0] = sign;
1430+ if (__space)
1431+ {
1432+ // Pattern starts with sign.
1433+ if (__precedes)
1434+ {
1435+ __ret.field[1] = symbol;
1436+ __ret.field[3] = value;
1437+ }
1438+ else
1439+ {
1440+ __ret.field[1] = value;
1441+ __ret.field[3] = symbol;
1442+ }
1443+ __ret.field[2] = space;
1444+ }
1445+ else
1446+ {
1447+ // Pattern starts with sign and ends with none.
1448+ if (__precedes)
1449+ {
1450+ __ret.field[1] = symbol;
1451+ __ret.field[2] = value;
1452+ }
1453+ else
1454+ {
1455+ __ret.field[1] = value;
1456+ __ret.field[2] = symbol;
1457+ }
1458+ __ret.field[3] = none;
1459+ }
1460+ break;
1461+ case 2:
1462+ // 2 The sign follows the value and symbol.
1463+ if (__space)
1464+ {
1465+ // Pattern either ends with sign.
1466+ if (__precedes)
1467+ {
1468+ __ret.field[0] = symbol;
1469+ __ret.field[2] = value;
1470+ }
1471+ else
1472+ {
1473+ __ret.field[0] = value;
1474+ __ret.field[2] = symbol;
1475+ }
1476+ __ret.field[1] = space;
1477+ __ret.field[3] = sign;
1478+ }
1479+ else
1480+ {
1481+ // Pattern ends with sign then none.
1482+ if (__precedes)
1483+ {
1484+ __ret.field[0] = symbol;
1485+ __ret.field[1] = value;
1486+ }
1487+ else
1488+ {
1489+ __ret.field[0] = value;
1490+ __ret.field[1] = symbol;
1491+ }
1492+ __ret.field[2] = sign;
1493+ __ret.field[3] = none;
1494+ }
1495+ break;
1496+ case 3:
1497+ // 3 The sign immediately precedes the symbol.
1498+ if (__precedes)
1499+ {
1500+ __ret.field[0] = sign;
1501+ __ret.field[1] = symbol;
1502+ if (__space)
1503+ {
1504+ __ret.field[2] = space;
1505+ __ret.field[3] = value;
1506+ }
1507+ else
1508+ {
1509+ __ret.field[2] = value;
1510+ __ret.field[3] = none;
1511+ }
1512+ }
1513+ else
1514+ {
1515+ __ret.field[0] = value;
1516+ if (__space)
1517+ {
1518+ __ret.field[1] = space;
1519+ __ret.field[2] = sign;
1520+ __ret.field[3] = symbol;
1521+ }
1522+ else
1523+ {
1524+ __ret.field[1] = sign;
1525+ __ret.field[2] = symbol;
1526+ __ret.field[3] = none;
1527+ }
1528+ }
1529+ break;
1530+ case 4:
1531+ // 4 The sign immediately follows the symbol.
1532+ if (__precedes)
1533+ {
1534+ __ret.field[0] = symbol;
1535+ __ret.field[1] = sign;
1536+ if (__space)
1537+ {
1538+ __ret.field[2] = space;
1539+ __ret.field[3] = value;
1540+ }
1541+ else
1542+ {
1543+ __ret.field[2] = value;
1544+ __ret.field[3] = none;
1545+ }
1546+ }
1547+ else
1548+ {
1549+ __ret.field[0] = value;
1550+ if (__space)
1551+ {
1552+ __ret.field[1] = space;
1553+ __ret.field[2] = symbol;
1554+ __ret.field[3] = sign;
1555+ }
1556+ else
1557+ {
1558+ __ret.field[1] = symbol;
1559+ __ret.field[2] = sign;
1560+ __ret.field[3] = none;
1561+ }
1562+ }
1563+ break;
1564+ default:
1565+ __ret = pattern();
1566+ }
1567+ return __ret;
1568+ }
1569+
1570+ template<>
1571+ void
1572+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1573+ const char*)
1574+ {
1575+ if (!_M_data)
1576+ _M_data = new __moneypunct_cache<char, true>;
1577+
1578+ if (!__cloc)
1579+ {
1580+ // "C" locale
1581+ _M_data->_M_decimal_point = '.';
1582+ _M_data->_M_thousands_sep = ',';
1583+ _M_data->_M_grouping = "";
1584+ _M_data->_M_grouping_size = 0;
1585+ _M_data->_M_curr_symbol = "";
1586+ _M_data->_M_curr_symbol_size = 0;
1587+ _M_data->_M_positive_sign = "";
1588+ _M_data->_M_positive_sign_size = 0;
1589+ _M_data->_M_negative_sign = "";
1590+ _M_data->_M_negative_sign_size = 0;
1591+ _M_data->_M_frac_digits = 0;
1592+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1593+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1594+
1595+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1596+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1597+ }
1598+ else
1599+ {
1600+ // Named locale.
1601+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1602+ __cloc));
1603+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1604+ __cloc));
1605+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1606+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1607+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1608+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1609+
1610+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1611+ if (!__nposn)
1612+ _M_data->_M_negative_sign = "()";
1613+ else
1614+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1615+ __cloc);
1616+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1617+
1618+ // _Intl == true
1619+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1620+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1621+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1622+ __cloc));
1623+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1624+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1625+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1626+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1627+ __pposn);
1628+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1629+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1630+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1631+ __nposn);
1632+ }
1633+ }
1634+
1635+ template<>
1636+ void
1637+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1638+ const char*)
1639+ {
1640+ if (!_M_data)
1641+ _M_data = new __moneypunct_cache<char, false>;
1642+
1643+ if (!__cloc)
1644+ {
1645+ // "C" locale
1646+ _M_data->_M_decimal_point = '.';
1647+ _M_data->_M_thousands_sep = ',';
1648+ _M_data->_M_grouping = "";
1649+ _M_data->_M_grouping_size = 0;
1650+ _M_data->_M_curr_symbol = "";
1651+ _M_data->_M_curr_symbol_size = 0;
1652+ _M_data->_M_positive_sign = "";
1653+ _M_data->_M_positive_sign_size = 0;
1654+ _M_data->_M_negative_sign = "";
1655+ _M_data->_M_negative_sign_size = 0;
1656+ _M_data->_M_frac_digits = 0;
1657+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1658+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1659+
1660+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1661+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1662+ }
1663+ else
1664+ {
1665+ // Named locale.
1666+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1667+ __cloc));
1668+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1669+ __cloc));
1670+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1671+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1672+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1673+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1674+
1675+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1676+ if (!__nposn)
1677+ _M_data->_M_negative_sign = "()";
1678+ else
1679+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1680+ __cloc);
1681+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1682+
1683+ // _Intl == false
1684+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1685+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1686+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1687+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1688+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1689+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1690+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1691+ __pposn);
1692+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1693+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1694+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1695+ __nposn);
1696+ }
1697+ }
1698+
1699+ template<>
1700+ moneypunct<char, true>::~moneypunct()
1701+ { delete _M_data; }
1702+
1703+ template<>
1704+ moneypunct<char, false>::~moneypunct()
1705+ { delete _M_data; }
1706+
1707+#ifdef _GLIBCXX_USE_WCHAR_T
1708+ template<>
1709+ void
1710+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1711+#ifdef __UCLIBC_HAS_XLOCALE__
1712+ const char*)
1713+#else
1714+ const char* __name)
1715+#endif
1716+ {
1717+ if (!_M_data)
1718+ _M_data = new __moneypunct_cache<wchar_t, true>;
1719+
1720+ if (!__cloc)
1721+ {
1722+ // "C" locale
1723+ _M_data->_M_decimal_point = L'.';
1724+ _M_data->_M_thousands_sep = L',';
1725+ _M_data->_M_grouping = "";
1726+ _M_data->_M_grouping_size = 0;
1727+ _M_data->_M_curr_symbol = L"";
1728+ _M_data->_M_curr_symbol_size = 0;
1729+ _M_data->_M_positive_sign = L"";
1730+ _M_data->_M_positive_sign_size = 0;
1731+ _M_data->_M_negative_sign = L"";
1732+ _M_data->_M_negative_sign_size = 0;
1733+ _M_data->_M_frac_digits = 0;
1734+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1735+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1736+
1737+ // Use ctype::widen code without the facet...
1738+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1739+ _M_data->_M_atoms[__i] =
1740+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1741+ }
1742+ else
1743+ {
1744+ // Named locale.
1745+#ifdef __UCLIBC_HAS_XLOCALE__
1746+ __c_locale __old = __uselocale(__cloc);
1747+#else
1748+ // Switch to named locale so that mbsrtowcs will work.
1749+ char* __old = strdup(setlocale(LC_ALL, NULL));
1750+ setlocale(LC_ALL, __name);
1751+#endif
1752+
1753+#ifdef __UCLIBC_MJN3_ONLY__
1754+#warning fix this... should be monetary
1755+#endif
1756+#ifdef __UCLIBC__
1757+# ifdef __UCLIBC_HAS_XLOCALE__
1758+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1759+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1760+# else
1761+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1762+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1763+# endif
1764+#else
1765+ union { char *__s; wchar_t __w; } __u;
1766+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1767+ _M_data->_M_decimal_point = __u.__w;
1768+
1769+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1770+ _M_data->_M_thousands_sep = __u.__w;
1771+#endif
1772+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1773+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1774+
1775+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1776+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1777+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1778+
1779+ wchar_t* __wcs_ps = 0;
1780+ wchar_t* __wcs_ns = 0;
1781+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1782+ try
1783+ {
1784+ mbstate_t __state;
1785+ size_t __len = strlen(__cpossign);
1786+ if (__len)
1787+ {
1788+ ++__len;
1789+ memset(&__state, 0, sizeof(mbstate_t));
1790+ __wcs_ps = new wchar_t[__len];
1791+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1792+ _M_data->_M_positive_sign = __wcs_ps;
1793+ }
1794+ else
1795+ _M_data->_M_positive_sign = L"";
1796+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1797+
1798+ __len = strlen(__cnegsign);
1799+ if (!__nposn)
1800+ _M_data->_M_negative_sign = L"()";
1801+ else if (__len)
1802+ {
1803+ ++__len;
1804+ memset(&__state, 0, sizeof(mbstate_t));
1805+ __wcs_ns = new wchar_t[__len];
1806+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1807+ _M_data->_M_negative_sign = __wcs_ns;
1808+ }
1809+ else
1810+ _M_data->_M_negative_sign = L"";
1811+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1812+
1813+ // _Intl == true.
1814+ __len = strlen(__ccurr);
1815+ if (__len)
1816+ {
1817+ ++__len;
1818+ memset(&__state, 0, sizeof(mbstate_t));
1819+ wchar_t* __wcs = new wchar_t[__len];
1820+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1821+ _M_data->_M_curr_symbol = __wcs;
1822+ }
1823+ else
1824+ _M_data->_M_curr_symbol = L"";
1825+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1826+ }
1827+ catch (...)
1828+ {
1829+ delete _M_data;
1830+ _M_data = 0;
1831+ delete __wcs_ps;
1832+ delete __wcs_ns;
1833+#ifdef __UCLIBC_HAS_XLOCALE__
1834+ __uselocale(__old);
1835+#else
1836+ setlocale(LC_ALL, __old);
1837+ free(__old);
1838+#endif
1839+ __throw_exception_again;
1840+ }
1841+
1842+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1843+ __cloc));
1844+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1845+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1846+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1847+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1848+ __pposn);
1849+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1850+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1851+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1852+ __nposn);
1853+
1854+#ifdef __UCLIBC_HAS_XLOCALE__
1855+ __uselocale(__old);
1856+#else
1857+ setlocale(LC_ALL, __old);
1858+ free(__old);
1859+#endif
1860+ }
1861+ }
1862+
1863+ template<>
1864+ void
1865+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1866+#ifdef __UCLIBC_HAS_XLOCALE__
1867+ const char*)
1868+#else
1869+ const char* __name)
1870+#endif
1871+ {
1872+ if (!_M_data)
1873+ _M_data = new __moneypunct_cache<wchar_t, false>;
1874+
1875+ if (!__cloc)
1876+ {
1877+ // "C" locale
1878+ _M_data->_M_decimal_point = L'.';
1879+ _M_data->_M_thousands_sep = L',';
1880+ _M_data->_M_grouping = "";
1881+ _M_data->_M_grouping_size = 0;
1882+ _M_data->_M_curr_symbol = L"";
1883+ _M_data->_M_curr_symbol_size = 0;
1884+ _M_data->_M_positive_sign = L"";
1885+ _M_data->_M_positive_sign_size = 0;
1886+ _M_data->_M_negative_sign = L"";
1887+ _M_data->_M_negative_sign_size = 0;
1888+ _M_data->_M_frac_digits = 0;
1889+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1890+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1891+
1892+ // Use ctype::widen code without the facet...
1893+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1894+ _M_data->_M_atoms[__i] =
1895+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1896+ }
1897+ else
1898+ {
1899+ // Named locale.
1900+#ifdef __UCLIBC_HAS_XLOCALE__
1901+ __c_locale __old = __uselocale(__cloc);
1902+#else
1903+ // Switch to named locale so that mbsrtowcs will work.
1904+ char* __old = strdup(setlocale(LC_ALL, NULL));
1905+ setlocale(LC_ALL, __name);
1906+#endif
1907+
1908+#ifdef __UCLIBC_MJN3_ONLY__
1909+#warning fix this... should be monetary
1910+#endif
1911+#ifdef __UCLIBC__
1912+# ifdef __UCLIBC_HAS_XLOCALE__
1913+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1914+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1915+# else
1916+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1917+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1918+# endif
1919+#else
1920+ union { char *__s; wchar_t __w; } __u;
1921+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1922+ _M_data->_M_decimal_point = __u.__w;
1923+
1924+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1925+ _M_data->_M_thousands_sep = __u.__w;
1926+#endif
1927+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1928+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1929+
1930+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1931+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1932+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1933+
1934+ wchar_t* __wcs_ps = 0;
1935+ wchar_t* __wcs_ns = 0;
1936+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1937+ try
1938+ {
1939+ mbstate_t __state;
1940+ size_t __len;
1941+ __len = strlen(__cpossign);
1942+ if (__len)
1943+ {
1944+ ++__len;
1945+ memset(&__state, 0, sizeof(mbstate_t));
1946+ __wcs_ps = new wchar_t[__len];
1947+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1948+ _M_data->_M_positive_sign = __wcs_ps;
1949+ }
1950+ else
1951+ _M_data->_M_positive_sign = L"";
1952+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1953+
1954+ __len = strlen(__cnegsign);
1955+ if (!__nposn)
1956+ _M_data->_M_negative_sign = L"()";
1957+ else if (__len)
1958+ {
1959+ ++__len;
1960+ memset(&__state, 0, sizeof(mbstate_t));
1961+ __wcs_ns = new wchar_t[__len];
1962+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1963+ _M_data->_M_negative_sign = __wcs_ns;
1964+ }
1965+ else
1966+ _M_data->_M_negative_sign = L"";
1967+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1968+
1969+ // _Intl == true.
1970+ __len = strlen(__ccurr);
1971+ if (__len)
1972+ {
1973+ ++__len;
1974+ memset(&__state, 0, sizeof(mbstate_t));
1975+ wchar_t* __wcs = new wchar_t[__len];
1976+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1977+ _M_data->_M_curr_symbol = __wcs;
1978+ }
1979+ else
1980+ _M_data->_M_curr_symbol = L"";
1981+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1982+ }
1983+ catch (...)
1984+ {
1985+ delete _M_data;
1986+ _M_data = 0;
1987+ delete __wcs_ps;
1988+ delete __wcs_ns;
1989+#ifdef __UCLIBC_HAS_XLOCALE__
1990+ __uselocale(__old);
1991+#else
1992+ setlocale(LC_ALL, __old);
1993+ free(__old);
1994+#endif
1995+ __throw_exception_again;
1996+ }
1997+
1998+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1999+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2000+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2001+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2002+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2003+ __pposn);
2004+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2005+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2006+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2007+ __nposn);
2008+
2009+#ifdef __UCLIBC_HAS_XLOCALE__
2010+ __uselocale(__old);
2011+#else
2012+ setlocale(LC_ALL, __old);
2013+ free(__old);
2014+#endif
2015+ }
2016+ }
2017+
2018+ template<>
2019+ moneypunct<wchar_t, true>::~moneypunct()
2020+ {
2021+ if (_M_data->_M_positive_sign_size)
2022+ delete [] _M_data->_M_positive_sign;
2023+ if (_M_data->_M_negative_sign_size
2024+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2025+ delete [] _M_data->_M_negative_sign;
2026+ if (_M_data->_M_curr_symbol_size)
2027+ delete [] _M_data->_M_curr_symbol;
2028+ delete _M_data;
2029+ }
2030+
2031+ template<>
2032+ moneypunct<wchar_t, false>::~moneypunct()
2033+ {
2034+ if (_M_data->_M_positive_sign_size)
2035+ delete [] _M_data->_M_positive_sign;
2036+ if (_M_data->_M_negative_sign_size
2037+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2038+ delete [] _M_data->_M_negative_sign;
2039+ if (_M_data->_M_curr_symbol_size)
2040+ delete [] _M_data->_M_curr_symbol;
2041+ delete _M_data;
2042+ }
2043+#endif
2044+}
2045diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2046--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 17:00:00.000000000 -0700
2047+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-25 22:18:37.000000000 -0700
2048@@ -0,0 +1,173 @@
2049+// std::numpunct implementation details, GNU version -*- C++ -*-
2050+
2051+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2052+//
2053+// This file is part of the GNU ISO C++ Library. This library is free
2054+// software; you can redistribute it and/or modify it under the
2055+// terms of the GNU General Public License as published by the
2056+// Free Software Foundation; either version 2, or (at your option)
2057+// any later version.
2058+
2059+// This library is distributed in the hope that it will be useful,
2060+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2061+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2062+// GNU General Public License for more details.
2063+
2064+// You should have received a copy of the GNU General Public License along
2065+// with this library; see the file COPYING. If not, write to the Free
2066+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2067+// USA.
2068+
2069+// As a special exception, you may use this file as part of a free software
2070+// library without restriction. Specifically, if other files instantiate
2071+// templates or use macros or inline functions from this file, or you compile
2072+// this file and link it with other files to produce an executable, this
2073+// file does not by itself cause the resulting executable to be covered by
2074+// the GNU General Public License. This exception does not however
2075+// invalidate any other reasons why the executable file might be covered by
2076+// the GNU General Public License.
2077+
2078+//
2079+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2080+//
2081+
2082+// Written by Benjamin Kosnik <bkoz@redhat.com>
2083+
2084+#define _LIBC
2085+#include <locale>
2086+#undef _LIBC
2087+#include <bits/c++locale_internal.h>
2088+
2089+#ifdef __UCLIBC_MJN3_ONLY__
2090+#warning tailor for stub locale support
2091+#endif
2092+#ifndef __UCLIBC_HAS_XLOCALE__
2093+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2094+#endif
2095+
2096+namespace std
2097+{
2098+ template<>
2099+ void
2100+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2101+ {
2102+ if (!_M_data)
2103+ _M_data = new __numpunct_cache<char>;
2104+
2105+ if (!__cloc)
2106+ {
2107+ // "C" locale
2108+ _M_data->_M_grouping = "";
2109+ _M_data->_M_grouping_size = 0;
2110+ _M_data->_M_use_grouping = false;
2111+
2112+ _M_data->_M_decimal_point = '.';
2113+ _M_data->_M_thousands_sep = ',';
2114+
2115+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2116+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2117+
2118+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2119+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2120+ }
2121+ else
2122+ {
2123+ // Named locale.
2124+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2125+ __cloc));
2126+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2127+ __cloc));
2128+
2129+ // Check for NULL, which implies no grouping.
2130+ if (_M_data->_M_thousands_sep == '\0')
2131+ _M_data->_M_grouping = "";
2132+ else
2133+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2134+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2135+ }
2136+
2137+ // NB: There is no way to extact this info from posix locales.
2138+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2139+ _M_data->_M_truename = "true";
2140+ _M_data->_M_truename_size = 4;
2141+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2142+ _M_data->_M_falsename = "false";
2143+ _M_data->_M_falsename_size = 5;
2144+ }
2145+
2146+ template<>
2147+ numpunct<char>::~numpunct()
2148+ { delete _M_data; }
2149+
2150+#ifdef _GLIBCXX_USE_WCHAR_T
2151+ template<>
2152+ void
2153+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2154+ {
2155+ if (!_M_data)
2156+ _M_data = new __numpunct_cache<wchar_t>;
2157+
2158+ if (!__cloc)
2159+ {
2160+ // "C" locale
2161+ _M_data->_M_grouping = "";
2162+ _M_data->_M_grouping_size = 0;
2163+ _M_data->_M_use_grouping = false;
2164+
2165+ _M_data->_M_decimal_point = L'.';
2166+ _M_data->_M_thousands_sep = L',';
2167+
2168+ // Use ctype::widen code without the facet...
2169+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2170+ _M_data->_M_atoms_out[__i] =
2171+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2172+
2173+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2174+ _M_data->_M_atoms_in[__j] =
2175+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2176+ }
2177+ else
2178+ {
2179+ // Named locale.
2180+ // NB: In the GNU model wchar_t is always 32 bit wide.
2181+#ifdef __UCLIBC_MJN3_ONLY__
2182+#warning fix this
2183+#endif
2184+#ifdef __UCLIBC__
2185+# ifdef __UCLIBC_HAS_XLOCALE__
2186+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2187+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2188+# else
2189+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2190+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2191+# endif
2192+#else
2193+ union { char *__s; wchar_t __w; } __u;
2194+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2195+ _M_data->_M_decimal_point = __u.__w;
2196+
2197+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2198+ _M_data->_M_thousands_sep = __u.__w;
2199+#endif
2200+
2201+ if (_M_data->_M_thousands_sep == L'\0')
2202+ _M_data->_M_grouping = "";
2203+ else
2204+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2205+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2206+ }
2207+
2208+ // NB: There is no way to extact this info from posix locales.
2209+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2210+ _M_data->_M_truename = L"true";
2211+ _M_data->_M_truename_size = 4;
2212+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2213+ _M_data->_M_falsename = L"false";
2214+ _M_data->_M_falsename_size = 5;
2215+ }
2216+
2217+ template<>
2218+ numpunct<wchar_t>::~numpunct()
2219+ { delete _M_data; }
2220+ #endif
2221+}
2222diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc
2223--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 17:00:00.000000000 -0700
2224+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2006-03-25 22:18:37.000000000 -0700
2225@@ -0,0 +1,406 @@
2226+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2227+
2228+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2229+//
2230+// This file is part of the GNU ISO C++ Library. This library is free
2231+// software; you can redistribute it and/or modify it under the
2232+// terms of the GNU General Public License as published by the
2233+// Free Software Foundation; either version 2, or (at your option)
2234+// any later version.
2235+
2236+// This library is distributed in the hope that it will be useful,
2237+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2238+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2239+// GNU General Public License for more details.
2240+
2241+// You should have received a copy of the GNU General Public License along
2242+// with this library; see the file COPYING. If not, write to the Free
2243+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2244+// USA.
2245+
2246+// As a special exception, you may use this file as part of a free software
2247+// library without restriction. Specifically, if other files instantiate
2248+// templates or use macros or inline functions from this file, or you compile
2249+// this file and link it with other files to produce an executable, this
2250+// file does not by itself cause the resulting executable to be covered by
2251+// the GNU General Public License. This exception does not however
2252+// invalidate any other reasons why the executable file might be covered by
2253+// the GNU General Public License.
2254+
2255+//
2256+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2257+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2258+//
2259+
2260+// Written by Benjamin Kosnik <bkoz@redhat.com>
2261+
2262+#include <locale>
2263+#include <bits/c++locale_internal.h>
2264+
2265+#ifdef __UCLIBC_MJN3_ONLY__
2266+#warning tailor for stub locale support
2267+#endif
2268+#ifndef __UCLIBC_HAS_XLOCALE__
2269+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2270+#endif
2271+
2272+namespace std
2273+{
2274+ template<>
2275+ void
2276+ __timepunct<char>::
2277+ _M_put(char* __s, size_t __maxlen, const char* __format,
2278+ const tm* __tm) const
2279+ {
2280+#ifdef __UCLIBC_HAS_XLOCALE__
2281+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2282+ _M_c_locale_timepunct);
2283+#else
2284+ char* __old = strdup(setlocale(LC_ALL, NULL));
2285+ setlocale(LC_ALL, _M_name_timepunct);
2286+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2287+ setlocale(LC_ALL, __old);
2288+ free(__old);
2289+#endif
2290+ // Make sure __s is null terminated.
2291+ if (__len == 0)
2292+ __s[0] = '\0';
2293+ }
2294+
2295+ template<>
2296+ void
2297+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2298+ {
2299+ if (!_M_data)
2300+ _M_data = new __timepunct_cache<char>;
2301+
2302+ if (!__cloc)
2303+ {
2304+ // "C" locale
2305+ _M_c_locale_timepunct = _S_get_c_locale();
2306+
2307+ _M_data->_M_date_format = "%m/%d/%y";
2308+ _M_data->_M_date_era_format = "%m/%d/%y";
2309+ _M_data->_M_time_format = "%H:%M:%S";
2310+ _M_data->_M_time_era_format = "%H:%M:%S";
2311+ _M_data->_M_date_time_format = "";
2312+ _M_data->_M_date_time_era_format = "";
2313+ _M_data->_M_am = "AM";
2314+ _M_data->_M_pm = "PM";
2315+ _M_data->_M_am_pm_format = "";
2316+
2317+ // Day names, starting with "C"'s Sunday.
2318+ _M_data->_M_day1 = "Sunday";
2319+ _M_data->_M_day2 = "Monday";
2320+ _M_data->_M_day3 = "Tuesday";
2321+ _M_data->_M_day4 = "Wednesday";
2322+ _M_data->_M_day5 = "Thursday";
2323+ _M_data->_M_day6 = "Friday";
2324+ _M_data->_M_day7 = "Saturday";
2325+
2326+ // Abbreviated day names, starting with "C"'s Sun.
2327+ _M_data->_M_aday1 = "Sun";
2328+ _M_data->_M_aday2 = "Mon";
2329+ _M_data->_M_aday3 = "Tue";
2330+ _M_data->_M_aday4 = "Wed";
2331+ _M_data->_M_aday5 = "Thu";
2332+ _M_data->_M_aday6 = "Fri";
2333+ _M_data->_M_aday7 = "Sat";
2334+
2335+ // Month names, starting with "C"'s January.
2336+ _M_data->_M_month01 = "January";
2337+ _M_data->_M_month02 = "February";
2338+ _M_data->_M_month03 = "March";
2339+ _M_data->_M_month04 = "April";
2340+ _M_data->_M_month05 = "May";
2341+ _M_data->_M_month06 = "June";
2342+ _M_data->_M_month07 = "July";
2343+ _M_data->_M_month08 = "August";
2344+ _M_data->_M_month09 = "September";
2345+ _M_data->_M_month10 = "October";
2346+ _M_data->_M_month11 = "November";
2347+ _M_data->_M_month12 = "December";
2348+
2349+ // Abbreviated month names, starting with "C"'s Jan.
2350+ _M_data->_M_amonth01 = "Jan";
2351+ _M_data->_M_amonth02 = "Feb";
2352+ _M_data->_M_amonth03 = "Mar";
2353+ _M_data->_M_amonth04 = "Apr";
2354+ _M_data->_M_amonth05 = "May";
2355+ _M_data->_M_amonth06 = "Jun";
2356+ _M_data->_M_amonth07 = "Jul";
2357+ _M_data->_M_amonth08 = "Aug";
2358+ _M_data->_M_amonth09 = "Sep";
2359+ _M_data->_M_amonth10 = "Oct";
2360+ _M_data->_M_amonth11 = "Nov";
2361+ _M_data->_M_amonth12 = "Dec";
2362+ }
2363+ else
2364+ {
2365+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2366+
2367+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2368+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2369+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2370+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2371+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2372+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2373+ __cloc);
2374+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2375+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2376+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2377+
2378+ // Day names, starting with "C"'s Sunday.
2379+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2380+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2381+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2382+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2383+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2384+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2385+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2386+
2387+ // Abbreviated day names, starting with "C"'s Sun.
2388+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2389+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2390+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2391+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2392+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2393+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2394+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2395+
2396+ // Month names, starting with "C"'s January.
2397+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2398+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2399+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2400+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2401+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2402+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2403+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2404+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2405+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2406+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2407+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2408+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2409+
2410+ // Abbreviated month names, starting with "C"'s Jan.
2411+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2412+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2413+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2414+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2415+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2416+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2417+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2418+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2419+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2420+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2421+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2422+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2423+ }
2424+ }
2425+
2426+#ifdef _GLIBCXX_USE_WCHAR_T
2427+ template<>
2428+ void
2429+ __timepunct<wchar_t>::
2430+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2431+ const tm* __tm) const
2432+ {
2433+#ifdef __UCLIBC_HAS_XLOCALE__
2434+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2435+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2436+ _M_c_locale_timepunct);
2437+#else
2438+ char* __old = strdup(setlocale(LC_ALL, NULL));
2439+ setlocale(LC_ALL, _M_name_timepunct);
2440+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2441+ setlocale(LC_ALL, __old);
2442+ free(__old);
2443+#endif
2444+ // Make sure __s is null terminated.
2445+ if (__len == 0)
2446+ __s[0] = L'\0';
2447+ }
2448+
2449+ template<>
2450+ void
2451+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2452+ {
2453+ if (!_M_data)
2454+ _M_data = new __timepunct_cache<wchar_t>;
2455+
2456+#warning wide time stuff
2457+// if (!__cloc)
2458+ {
2459+ // "C" locale
2460+ _M_c_locale_timepunct = _S_get_c_locale();
2461+
2462+ _M_data->_M_date_format = L"%m/%d/%y";
2463+ _M_data->_M_date_era_format = L"%m/%d/%y";
2464+ _M_data->_M_time_format = L"%H:%M:%S";
2465+ _M_data->_M_time_era_format = L"%H:%M:%S";
2466+ _M_data->_M_date_time_format = L"";
2467+ _M_data->_M_date_time_era_format = L"";
2468+ _M_data->_M_am = L"AM";
2469+ _M_data->_M_pm = L"PM";
2470+ _M_data->_M_am_pm_format = L"";
2471+
2472+ // Day names, starting with "C"'s Sunday.
2473+ _M_data->_M_day1 = L"Sunday";
2474+ _M_data->_M_day2 = L"Monday";
2475+ _M_data->_M_day3 = L"Tuesday";
2476+ _M_data->_M_day4 = L"Wednesday";
2477+ _M_data->_M_day5 = L"Thursday";
2478+ _M_data->_M_day6 = L"Friday";
2479+ _M_data->_M_day7 = L"Saturday";
2480+
2481+ // Abbreviated day names, starting with "C"'s Sun.
2482+ _M_data->_M_aday1 = L"Sun";
2483+ _M_data->_M_aday2 = L"Mon";
2484+ _M_data->_M_aday3 = L"Tue";
2485+ _M_data->_M_aday4 = L"Wed";
2486+ _M_data->_M_aday5 = L"Thu";
2487+ _M_data->_M_aday6 = L"Fri";
2488+ _M_data->_M_aday7 = L"Sat";
2489+
2490+ // Month names, starting with "C"'s January.
2491+ _M_data->_M_month01 = L"January";
2492+ _M_data->_M_month02 = L"February";
2493+ _M_data->_M_month03 = L"March";
2494+ _M_data->_M_month04 = L"April";
2495+ _M_data->_M_month05 = L"May";
2496+ _M_data->_M_month06 = L"June";
2497+ _M_data->_M_month07 = L"July";
2498+ _M_data->_M_month08 = L"August";
2499+ _M_data->_M_month09 = L"September";
2500+ _M_data->_M_month10 = L"October";
2501+ _M_data->_M_month11 = L"November";
2502+ _M_data->_M_month12 = L"December";
2503+
2504+ // Abbreviated month names, starting with "C"'s Jan.
2505+ _M_data->_M_amonth01 = L"Jan";
2506+ _M_data->_M_amonth02 = L"Feb";
2507+ _M_data->_M_amonth03 = L"Mar";
2508+ _M_data->_M_amonth04 = L"Apr";
2509+ _M_data->_M_amonth05 = L"May";
2510+ _M_data->_M_amonth06 = L"Jun";
2511+ _M_data->_M_amonth07 = L"Jul";
2512+ _M_data->_M_amonth08 = L"Aug";
2513+ _M_data->_M_amonth09 = L"Sep";
2514+ _M_data->_M_amonth10 = L"Oct";
2515+ _M_data->_M_amonth11 = L"Nov";
2516+ _M_data->_M_amonth12 = L"Dec";
2517+ }
2518+#if 0
2519+ else
2520+ {
2521+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2522+
2523+ union { char *__s; wchar_t *__w; } __u;
2524+
2525+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2526+ _M_data->_M_date_format = __u.__w;
2527+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2528+ _M_data->_M_date_era_format = __u.__w;
2529+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2530+ _M_data->_M_time_format = __u.__w;
2531+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2532+ _M_data->_M_time_era_format = __u.__w;
2533+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2534+ _M_data->_M_date_time_format = __u.__w;
2535+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2536+ _M_data->_M_date_time_era_format = __u.__w;
2537+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2538+ _M_data->_M_am = __u.__w;
2539+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2540+ _M_data->_M_pm = __u.__w;
2541+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2542+ _M_data->_M_am_pm_format = __u.__w;
2543+
2544+ // Day names, starting with "C"'s Sunday.
2545+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2546+ _M_data->_M_day1 = __u.__w;
2547+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2548+ _M_data->_M_day2 = __u.__w;
2549+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2550+ _M_data->_M_day3 = __u.__w;
2551+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2552+ _M_data->_M_day4 = __u.__w;
2553+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2554+ _M_data->_M_day5 = __u.__w;
2555+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2556+ _M_data->_M_day6 = __u.__w;
2557+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2558+ _M_data->_M_day7 = __u.__w;
2559+
2560+ // Abbreviated day names, starting with "C"'s Sun.
2561+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2562+ _M_data->_M_aday1 = __u.__w;
2563+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2564+ _M_data->_M_aday2 = __u.__w;
2565+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2566+ _M_data->_M_aday3 = __u.__w;
2567+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2568+ _M_data->_M_aday4 = __u.__w;
2569+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2570+ _M_data->_M_aday5 = __u.__w;
2571+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2572+ _M_data->_M_aday6 = __u.__w;
2573+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2574+ _M_data->_M_aday7 = __u.__w;
2575+
2576+ // Month names, starting with "C"'s January.
2577+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2578+ _M_data->_M_month01 = __u.__w;
2579+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2580+ _M_data->_M_month02 = __u.__w;
2581+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2582+ _M_data->_M_month03 = __u.__w;
2583+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2584+ _M_data->_M_month04 = __u.__w;
2585+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2586+ _M_data->_M_month05 = __u.__w;
2587+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2588+ _M_data->_M_month06 = __u.__w;
2589+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2590+ _M_data->_M_month07 = __u.__w;
2591+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2592+ _M_data->_M_month08 = __u.__w;
2593+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2594+ _M_data->_M_month09 = __u.__w;
2595+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2596+ _M_data->_M_month10 = __u.__w;
2597+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2598+ _M_data->_M_month11 = __u.__w;
2599+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2600+ _M_data->_M_month12 = __u.__w;
2601+
2602+ // Abbreviated month names, starting with "C"'s Jan.
2603+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2604+ _M_data->_M_amonth01 = __u.__w;
2605+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2606+ _M_data->_M_amonth02 = __u.__w;
2607+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2608+ _M_data->_M_amonth03 = __u.__w;
2609+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2610+ _M_data->_M_amonth04 = __u.__w;
2611+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2612+ _M_data->_M_amonth05 = __u.__w;
2613+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2614+ _M_data->_M_amonth06 = __u.__w;
2615+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2616+ _M_data->_M_amonth07 = __u.__w;
2617+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2618+ _M_data->_M_amonth08 = __u.__w;
2619+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2620+ _M_data->_M_amonth09 = __u.__w;
2621+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2622+ _M_data->_M_amonth10 = __u.__w;
2623+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2624+ _M_data->_M_amonth11 = __u.__w;
2625+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2626+ _M_data->_M_amonth12 = __u.__w;
2627+ }
2628+#endif // 0
2629+ }
2630+#endif
2631+}
2632diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h
2633--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 17:00:00.000000000 -0700
2634+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h 2005-10-21 02:34:06.000000000 -0600
2635@@ -0,0 +1,76 @@
2636+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2637+
2638+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
2639+//
2640+// This file is part of the GNU ISO C++ Library. This library is free
2641+// software; you can redistribute it and/or modify it under the
2642+// terms of the GNU General Public License as published by the
2643+// Free Software Foundation; either version 2, or (at your option)
2644+// any later version.
2645+
2646+// This library is distributed in the hope that it will be useful,
2647+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2648+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2649+// GNU General Public License for more details.
2650+
2651+// You should have received a copy of the GNU General Public License along
2652+// with this library; see the file COPYING. If not, write to the Free
2653+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2654+// USA.
2655+
2656+// As a special exception, you may use this file as part of a free software
2657+// library without restriction. Specifically, if other files instantiate
2658+// templates or use macros or inline functions from this file, or you compile
2659+// this file and link it with other files to produce an executable, this
2660+// file does not by itself cause the resulting executable to be covered by
2661+// the GNU General Public License. This exception does not however
2662+// invalidate any other reasons why the executable file might be covered by
2663+// the GNU General Public License.
2664+
2665+//
2666+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2667+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2668+//
2669+
2670+// Written by Benjamin Kosnik <bkoz@redhat.com>
2671+
2672+ template<typename _CharT>
2673+ __timepunct<_CharT>::__timepunct(size_t __refs)
2674+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2675+ _M_name_timepunct(_S_get_c_name())
2676+ { _M_initialize_timepunct(); }
2677+
2678+ template<typename _CharT>
2679+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2680+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2681+ _M_name_timepunct(_S_get_c_name())
2682+ { _M_initialize_timepunct(); }
2683+
2684+ template<typename _CharT>
2685+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2686+ size_t __refs)
2687+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2688+ _M_name_timepunct(NULL)
2689+ {
2690+ const size_t __len = std::strlen(__s) + 1;
2691+ char* __tmp = new char[__len];
2692+ std::memcpy(__tmp, __s, __len);
2693+ _M_name_timepunct = __tmp;
2694+
2695+ try
2696+ { _M_initialize_timepunct(__cloc); }
2697+ catch(...)
2698+ {
2699+ delete [] _M_name_timepunct;
2700+ __throw_exception_again;
2701+ }
2702+ }
2703+
2704+ template<typename _CharT>
2705+ __timepunct<_CharT>::~__timepunct()
2706+ {
2707+ if (_M_name_timepunct != _S_get_c_name())
2708+ delete [] _M_name_timepunct;
2709+ delete _M_data;
2710+ _S_destroy_c_locale(_M_c_locale_timepunct);
2711+ }
2712diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h
2713--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 17:00:00.000000000 -0700
2714+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2006-03-25 22:06:30.000000000 -0700
2715@@ -0,0 +1,64 @@
2716+// Locale support -*- C++ -*-
2717+
2718+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
2719+// Free Software Foundation, Inc.
2720+//
2721+// This file is part of the GNU ISO C++ Library. This library is free
2722+// software; you can redistribute it and/or modify it under the
2723+// terms of the GNU General Public License as published by the
2724+// Free Software Foundation; either version 2, or (at your option)
2725+// any later version.
2726+
2727+// This library is distributed in the hope that it will be useful,
2728+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2729+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2730+// GNU General Public License for more details.
2731+
2732+// You should have received a copy of the GNU General Public License along
2733+// with this library; see the file COPYING. If not, write to the Free
2734+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2735+// USA.
2736+
2737+// As a special exception, you may use this file as part of a free software
2738+// library without restriction. Specifically, if other files instantiate
2739+// templates or use macros or inline functions from this file, or you compile
2740+// this file and link it with other files to produce an executable, this
2741+// file does not by itself cause the resulting executable to be covered by
2742+// the GNU General Public License. This exception does not however
2743+// invalidate any other reasons why the executable file might be covered by
2744+// the GNU General Public License.
2745+
2746+//
2747+// ISO C++ 14882: 22.1 Locales
2748+//
2749+
2750+/** @file ctype_base.h
2751+ * This is an internal header file, included by other library headers.
2752+ * You should not attempt to use it directly.
2753+ */
2754+
2755+// Information as gleaned from /usr/include/ctype.h
2756+
2757+ /// @brief Base class for ctype.
2758+ struct ctype_base
2759+ {
2760+ // Note: In uClibc, the following two types depend on configuration.
2761+
2762+ // Non-standard typedefs.
2763+ typedef const __ctype_touplow_t* __to_type;
2764+
2765+ // NB: Offsets into ctype<char>::_M_table force a particular size
2766+ // on the mask type. Because of this, we don't use an enum.
2767+ typedef __ctype_mask_t mask;
2768+ static const mask upper = _ISupper;
2769+ static const mask lower = _ISlower;
2770+ static const mask alpha = _ISalpha;
2771+ static const mask digit = _ISdigit;
2772+ static const mask xdigit = _ISxdigit;
2773+ static const mask space = _ISspace;
2774+ static const mask print = _ISprint;
2775+ static const mask graph = _ISalpha | _ISdigit | _ISpunct;
2776+ static const mask cntrl = _IScntrl;
2777+ static const mask punct = _ISpunct;
2778+ static const mask alnum = _ISalpha | _ISdigit;
2779+ };
2780diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h
2781--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 17:00:00.000000000 -0700
2782+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2006-03-25 22:06:30.000000000 -0700
2783@@ -0,0 +1,69 @@
2784+// Locale support -*- C++ -*-
2785+
2786+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2787+//
2788+// This file is part of the GNU ISO C++ Library. This library is free
2789+// software; you can redistribute it and/or modify it under the
2790+// terms of the GNU General Public License as published by the
2791+// Free Software Foundation; either version 2, or (at your option)
2792+// any later version.
2793+
2794+// This library is distributed in the hope that it will be useful,
2795+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2796+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2797+// GNU General Public License for more details.
2798+
2799+// You should have received a copy of the GNU General Public License along
2800+// with this library; see the file COPYING. If not, write to the Free
2801+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2802+// USA.
2803+
2804+// As a special exception, you may use this file as part of a free software
2805+// library without restriction. Specifically, if other files instantiate
2806+// templates or use macros or inline functions from this file, or you compile
2807+// this file and link it with other files to produce an executable, this
2808+// file does not by itself cause the resulting executable to be covered by
2809+// the GNU General Public License. This exception does not however
2810+// invalidate any other reasons why the executable file might be covered by
2811+// the GNU General Public License.
2812+
2813+//
2814+// ISO C++ 14882: 22.1 Locales
2815+//
2816+
2817+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2818+// functions go in ctype.cc
2819+
2820+ bool
2821+ ctype<char>::
2822+ is(mask __m, char __c) const
2823+ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2824+
2825+ const char*
2826+ ctype<char>::
2827+ is(const char* __low, const char* __high, mask* __vec) const
2828+ {
2829+ while (__low < __high)
2830+ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2831+ return __high;
2832+ }
2833+
2834+ const char*
2835+ ctype<char>::
2836+ scan_is(mask __m, const char* __low, const char* __high) const
2837+ {
2838+ while (__low < __high
2839+ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2840+ ++__low;
2841+ return __low;
2842+ }
2843+
2844+ const char*
2845+ ctype<char>::
2846+ scan_not(mask __m, const char* __low, const char* __high) const
2847+ {
2848+ while (__low < __high
2849+ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2850+ ++__low;
2851+ return __low;
2852+ }
2853diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2854--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 17:00:00.000000000 -0700
2855+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2006-03-25 22:06:30.000000000 -0700
2856@@ -0,0 +1,92 @@
2857+// Locale support -*- C++ -*-
2858+
2859+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
2860+// Free Software Foundation, Inc.
2861+//
2862+// This file is part of the GNU ISO C++ Library. This library is free
2863+// software; you can redistribute it and/or modify it under the
2864+// terms of the GNU General Public License as published by the
2865+// Free Software Foundation; either version 2, or (at your option)
2866+// any later version.
2867+
2868+// This library is distributed in the hope that it will be useful,
2869+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2870+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2871+// GNU General Public License for more details.
2872+
2873+// You should have received a copy of the GNU General Public License along
2874+// with this library; see the file COPYING. If not, write to the Free
2875+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2876+// USA.
2877+
2878+// As a special exception, you may use this file as part of a free software
2879+// library without restriction. Specifically, if other files instantiate
2880+// templates or use macros or inline functions from this file, or you compile
2881+// this file and link it with other files to produce an executable, this
2882+// file does not by itself cause the resulting executable to be covered by
2883+// the GNU General Public License. This exception does not however
2884+// invalidate any other reasons why the executable file might be covered by
2885+// the GNU General Public License.
2886+
2887+//
2888+// ISO C++ 14882: 22.1 Locales
2889+//
2890+
2891+// Information as gleaned from /usr/include/ctype.h
2892+
2893+ const ctype_base::mask*
2894+ ctype<char>::classic_table() throw()
2895+ { return __C_ctype_b; }
2896+
2897+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
2898+ size_t __refs)
2899+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2900+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2901+ {
2902+ _M_toupper = __C_ctype_toupper;
2903+ _M_tolower = __C_ctype_tolower;
2904+ _M_table = __table ? __table : __C_ctype_b;
2905+ memset(_M_widen, 0, sizeof(_M_widen));
2906+ memset(_M_narrow, 0, sizeof(_M_narrow));
2907+ }
2908+
2909+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
2910+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2911+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2912+ {
2913+ _M_toupper = __C_ctype_toupper;
2914+ _M_tolower = __C_ctype_tolower;
2915+ _M_table = __table ? __table : __C_ctype_b;
2916+ memset(_M_widen, 0, sizeof(_M_widen));
2917+ memset(_M_narrow, 0, sizeof(_M_narrow));
2918+ }
2919+
2920+ char
2921+ ctype<char>::do_toupper(char __c) const
2922+ { return _M_toupper[static_cast<unsigned char>(__c)]; }
2923+
2924+ const char*
2925+ ctype<char>::do_toupper(char* __low, const char* __high) const
2926+ {
2927+ while (__low < __high)
2928+ {
2929+ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2930+ ++__low;
2931+ }
2932+ return __high;
2933+ }
2934+
2935+ char
2936+ ctype<char>::do_tolower(char __c) const
2937+ { return _M_tolower[static_cast<unsigned char>(__c)]; }
2938+
2939+ const char*
2940+ ctype<char>::do_tolower(char* __low, const char* __high) const
2941+ {
2942+ while (__low < __high)
2943+ {
2944+ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2945+ ++__low;
2946+ }
2947+ return __high;
2948+ }
2949diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h
2950--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 17:00:00.000000000 -0700
2951+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h 2006-03-25 22:06:30.000000000 -0700
2952@@ -0,0 +1,44 @@
2953+// Specific definitions for GNU/Linux -*- C++ -*-
2954+
2955+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2956+//
2957+// This file is part of the GNU ISO C++ Library. This library is free
2958+// software; you can redistribute it and/or modify it under the
2959+// terms of the GNU General Public License as published by the
2960+// Free Software Foundation; either version 2, or (at your option)
2961+// any later version.
2962+
2963+// This library is distributed in the hope that it will be useful,
2964+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2965+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2966+// GNU General Public License for more details.
2967+
2968+// You should have received a copy of the GNU General Public License along
2969+// with this library; see the file COPYING. If not, write to the Free
2970+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2971+// USA.
2972+
2973+// As a special exception, you may use this file as part of a free software
2974+// library without restriction. Specifically, if other files instantiate
2975+// templates or use macros or inline functions from this file, or you compile
2976+// this file and link it with other files to produce an executable, this
2977+// file does not by itself cause the resulting executable to be covered by
2978+// the GNU General Public License. This exception does not however
2979+// invalidate any other reasons why the executable file might be covered by
2980+// the GNU General Public License.
2981+
2982+#ifndef _GLIBCXX_OS_DEFINES
2983+#define _GLIBCXX_OS_DEFINES 1
2984+
2985+// System-specific #define, typedefs, corrections, etc, go here. This
2986+// file will come before all others.
2987+
2988+// This keeps isanum, et al from being propagated as macros.
2989+#define __NO_CTYPE 1
2990+
2991+#include <features.h>
2992+
2993+// We must not see the optimized string functions GNU libc defines.
2994+#define __NO_STRING_INLINES
2995+
2996+#endif
2997diff -urN gcc-4.1.0-dist/libstdc++-v3/configure gcc-4.1.0/libstdc++-v3/configure
2998--- gcc-4.1.0-dist/libstdc++-v3/configure 2006-03-26 12:08:28.000000000 -0700
2999+++ gcc-4.1.0/libstdc++-v3/configure 2006-03-25 22:06:30.000000000 -0700
3000@@ -4005,6 +4005,11 @@
3001 lt_cv_deplibs_check_method=pass_all
3002 ;;
3003
3004+linux-uclibc*)
3005+ lt_cv_deplibs_check_method=pass_all
3006+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
3007+ ;;
3008+
3009 netbsd* | knetbsd*-gnu)
3010 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
3011 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
3012@@ -5740,7 +5745,7 @@
3013 enableval="$enable_clocale"
3014
3015 case "$enableval" in
3016- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
3017+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
3018 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
3019 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
3020 { (exit 1); exit 1; }; } ;;
3021@@ -5765,6 +5770,9 @@
3022 # Default to "generic".
3023 if test $enable_clocale_flag = auto; then
3024 case ${target_os} in
3025+ linux-uclibc*)
3026+ enable_clocale_flag=uclibc
3027+ ;;
3028 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3029 cat >conftest.$ac_ext <<_ACEOF
3030 /* confdefs.h. */
3031@@ -5995,6 +6003,76 @@
3032 CTIME_CC=config/locale/generic/time_members.cc
3033 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3034 ;;
3035+ uclibc)
3036+ echo "$as_me:$LINENO: result: uclibc" >&5
3037+echo "${ECHO_T}uclibc" >&6
3038+
3039+ # Declare intention to use gettext, and add support for specific
3040+ # languages.
3041+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3042+ ALL_LINGUAS="de fr"
3043+
3044+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3045+ # Extract the first word of "msgfmt", so it can be a program name with args.
3046+set dummy msgfmt; ac_word=$2
3047+echo "$as_me:$LINENO: checking for $ac_word" >&5
3048+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3049+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3050+ echo $ECHO_N "(cached) $ECHO_C" >&6
3051+else
3052+ if test -n "$check_msgfmt"; then
3053+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3054+else
3055+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3056+for as_dir in $PATH
3057+do
3058+ IFS=$as_save_IFS
3059+ test -z "$as_dir" && as_dir=.
3060+ for ac_exec_ext in '' $ac_executable_extensions; do
3061+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3062+ ac_cv_prog_check_msgfmt="yes"
3063+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3064+ break 2
3065+ fi
3066+done
3067+done
3068+
3069+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3070+fi
3071+fi
3072+check_msgfmt=$ac_cv_prog_check_msgfmt
3073+if test -n "$check_msgfmt"; then
3074+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3075+echo "${ECHO_T}$check_msgfmt" >&6
3076+else
3077+ echo "$as_me:$LINENO: result: no" >&5
3078+echo "${ECHO_T}no" >&6
3079+fi
3080+
3081+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3082+ USE_NLS=yes
3083+ fi
3084+ # Export the build objects.
3085+ for ling in $ALL_LINGUAS; do \
3086+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3087+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3088+ done
3089+
3090+
3091+
3092+ CLOCALE_H=config/locale/uclibc/c_locale.h
3093+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3094+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3095+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3096+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3097+ CMESSAGES_H=config/locale/uclibc/messages_members.h
3098+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3099+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3100+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3101+ CTIME_H=config/locale/uclibc/time_members.h
3102+ CTIME_CC=config/locale/uclibc/time_members.cc
3103+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3104+ ;;
3105 esac
3106
3107 # This is where the testsuite looks for locale catalogs, using the
3108diff -urN gcc-4.1.0-dist/libstdc++-v3/configure.host gcc-4.1.0/libstdc++-v3/configure.host
3109--- gcc-4.1.0-dist/libstdc++-v3/configure.host 2006-03-26 12:08:28.000000000 -0700
3110+++ gcc-4.1.0/libstdc++-v3/configure.host 2006-03-25 22:06:30.000000000 -0700
3111@@ -261,6 +261,12 @@
3112 ;;
3113 esac
3114
3115+# Override for uClibc since linux-uclibc gets mishandled above.
3116+case "${host_os}" in
3117+ *-uclibc*)
3118+ os_include_dir="os/uclibc"
3119+ ;;
3120+esac
3121
3122 # Set any OS-dependent and CPU-dependent bits.
3123 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
3124diff -urN gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 gcc-4.1.0/libstdc++-v3/crossconfig.m4
3125--- gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 2006-03-26 12:08:28.000000000 -0700
3126+++ gcc-4.1.0/libstdc++-v3/crossconfig.m4 2006-03-25 22:06:30.000000000 -0700
3127@@ -143,6 +143,99 @@
3128 ;;
3129 esac
3130 ;;
3131+ *-uclibc*)
3132+# Temporary hack until we implement the float versions of the libm funcs
3133+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3134+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
3135+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3136+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
3137+ AC_SUBST(SECTION_FLAGS)
3138+ GLIBCXX_CHECK_LINKER_FEATURES
3139+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3140+ GLIBCXX_CHECK_WCHAR_T_SUPPORT
3141+
3142+ # For LFS.
3143+ AC_DEFINE(HAVE_INT64_T)
3144+ case "$target" in
3145+ *-uclinux*)
3146+ # Don't enable LFS with uClinux
3147+ ;;
3148+ *)
3149+ AC_DEFINE(_GLIBCXX_USE_LFS)
3150+ esac
3151+
3152+ # For showmanyc_helper().
3153+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3154+ GLIBCXX_CHECK_POLL
3155+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3156+
3157+ # For xsputn_2().
3158+ AC_CHECK_HEADERS(sys/uio.h)
3159+ GLIBCXX_CHECK_WRITEV
3160+
3161+# AC_DEFINE(HAVE_ACOSF)
3162+# AC_DEFINE(HAVE_ASINF)
3163+# AC_DEFINE(HAVE_ATANF)
3164+# AC_DEFINE(HAVE_ATAN2F)
3165+ AC_DEFINE(HAVE_CEILF)
3166+ AC_DEFINE(HAVE_COPYSIGN)
3167+# AC_DEFINE(HAVE_COPYSIGNF)
3168+# AC_DEFINE(HAVE_COSF)
3169+# AC_DEFINE(HAVE_COSHF)
3170+# AC_DEFINE(HAVE_EXPF)
3171+# AC_DEFINE(HAVE_FABSF)
3172+ AC_DEFINE(HAVE_FINITE)
3173+ AC_DEFINE(HAVE_FINITEF)
3174+ AC_DEFINE(HAVE_FLOORF)
3175+# AC_DEFINE(HAVE_FMODF)
3176+# AC_DEFINE(HAVE_FREXPF)
3177+ AC_DEFINE(HAVE_HYPOT)
3178+# AC_DEFINE(HAVE_HYPOTF)
3179+ AC_DEFINE(HAVE_ISINF)
3180+ AC_DEFINE(HAVE_ISINFF)
3181+ AC_DEFINE(HAVE_ISNAN)
3182+ AC_DEFINE(HAVE_ISNANF)
3183+# AC_DEFINE(HAVE_LOGF)
3184+# AC_DEFINE(HAVE_LOG10F)
3185+# AC_DEFINE(HAVE_MODFF)
3186+# AC_DEFINE(HAVE_SINF)
3187+# AC_DEFINE(HAVE_SINHF)
3188+# AC_DEFINE(HAVE_SINCOS)
3189+# AC_DEFINE(HAVE_SINCOSF)
3190+ AC_DEFINE(HAVE_SQRTF)
3191+# AC_DEFINE(HAVE_TANF)
3192+# AC_DEFINE(HAVE_TANHF)
3193+ if test x"long_double_math_on_this_cpu" = x"yes"; then
3194+ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
3195+# AC_DEFINE(HAVE_ACOSL)
3196+# AC_DEFINE(HAVE_ASINL)
3197+# AC_DEFINE(HAVE_ATANL)
3198+# AC_DEFINE(HAVE_ATAN2L)
3199+# AC_DEFINE(HAVE_CEILL)
3200+# AC_DEFINE(HAVE_COPYSIGNL)
3201+# AC_DEFINE(HAVE_COSL)
3202+# AC_DEFINE(HAVE_COSHL)
3203+# AC_DEFINE(HAVE_EXPL)
3204+# AC_DEFINE(HAVE_FABSL)
3205+# AC_DEFINE(HAVE_FINITEL)
3206+# AC_DEFINE(HAVE_FLOORL)
3207+# AC_DEFINE(HAVE_FMODL)
3208+# AC_DEFINE(HAVE_FREXPL)
3209+# AC_DEFINE(HAVE_HYPOTL)
3210+# AC_DEFINE(HAVE_ISINFL)
3211+# AC_DEFINE(HAVE_ISNANL)
3212+# AC_DEFINE(HAVE_LOGL)
3213+# AC_DEFINE(HAVE_LOG10L)
3214+# AC_DEFINE(HAVE_MODFL)
3215+# AC_DEFINE(HAVE_POWL)
3216+# AC_DEFINE(HAVE_SINL)
3217+# AC_DEFINE(HAVE_SINHL)
3218+# AC_DEFINE(HAVE_SINCOSL)
3219+# AC_DEFINE(HAVE_SQRTL)
3220+# AC_DEFINE(HAVE_TANL)
3221+# AC_DEFINE(HAVE_TANHL)
3222+ fi
3223+ ;;
3224 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3225 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3226 machine/endian.h machine/param.h sys/machine.h sys/types.h \
3227@@ -157,7 +250,7 @@
3228 AC_DEFINE(HAVE_INT64_T)
3229 case "$target" in
3230 *-uclinux*)
3231- # Don't enable LFS with uClibc
3232+ # Don't enable LFS with uClinux
3233 ;;
3234 *)
3235 AC_DEFINE(_GLIBCXX_USE_LFS)
3236diff -urN gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h
3237--- gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h 2006-03-26 12:08:28.000000000 -0700
3238+++ gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h 2006-03-25 22:06:30.000000000 -0700
3239@@ -101,7 +101,9 @@
3240 using std::wmemcpy;
3241 using std::wmemmove;
3242 using std::wmemset;
3243+#if _GLIBCXX_HAVE_WCSFTIME
3244 using std::wcsftime;
3245+#endif
3246
3247 #if _GLIBCXX_USE_C99
3248 using std::wcstold;
3249diff -urN gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h
3250--- gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h 2006-03-26 12:08:28.000000000 -0700
3251+++ gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h 2006-03-25 22:06:30.000000000 -0700
3252@@ -180,7 +180,9 @@
3253 using ::wcscoll;
3254 using ::wcscpy;
3255 using ::wcscspn;
3256+#if _GLIBCXX_HAVE_WCSFTIME
3257 using ::wcsftime;
3258+#endif
3259 using ::wcslen;
3260 using ::wcsncat;
3261 using ::wcsncmp;
diff --git a/meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch b/meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch
deleted file mode 100644
index 89d03a85e5..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1# DP: Build and install libstdc++_pic.a library.
2
3--- gcc-4.1.0/libstdc++-v3/src/Makefile.am 2004-11-15 17:33:05.000000000 -0600
4+++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.am 2005-04-25 20:05:59.186930896 -0500
5@@ -214,6 +214,10 @@
6 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
7
8
9+install-exec-local:
10+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
11+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
12+
13 # Added bits to build debug library.
14 if GLIBCXX_BUILD_DEBUG
15 all-local: build_debug
16--- gcc-4.1.0/libstdc++-v3/src/Makefile.in 2005-04-11 19:13:08.000000000 -0500
17+++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.in 2005-04-25 20:12:33.284316275 -0500
18@@ -627,7 +627,7 @@
19
20 install-data-am: install-data-local
21
22-install-exec-am: install-toolexeclibLTLIBRARIES
23+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
24
25 install-info: install-info-am
26
27@@ -660,6 +660,7 @@
28 distclean-libtool distclean-tags distdir dvi dvi-am html \
29 html-am info info-am install install-am install-data \
30 install-data-am install-data-local install-exec \
31+ install-exec-local \
32 install-exec-am install-info install-info-am install-man \
33 install-strip install-toolexeclibLTLIBRARIES installcheck \
34 installcheck-am installdirs maintainer-clean \
35@@ -745,6 +746,11 @@
36 install_debug:
37 (cd ${debugdir} && $(MAKE) \
38 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
39+
40+install-exec-local:
41+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
42+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
43+
44 # Tell versions [3.59,3.63) of GNU make to not export all variables.
45 # Otherwise a system limit (for SysV at least) may be exceeded.
46 .NOEXPORT:
diff --git a/meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch b/meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch
deleted file mode 100644
index 0e2092f3fb..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
2+++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
3@@ -500,7 +500,7 @@
4 #ifdef __linux__
5 # include <features.h>
6 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
7- && !defined(__ia64__)
8+ && !defined(__ia64__) && !defined(__UCLIBC__)
9 # ifndef GC_HAVE_BUILTIN_BACKTRACE
10 # define GC_HAVE_BUILTIN_BACKTRACE
11 # endif
diff --git a/meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch b/meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch
deleted file mode 100644
index dfb22d681b..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500
2+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500
3@@ -142,7 +142,7 @@
4 using ::vsprintf;
5 }
6
7-#if _GLIBCXX_USE_C99
8+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
9
10 #undef snprintf
11 #undef vfscanf
diff --git a/meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch b/meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch
deleted file mode 100644
index 2ccc80d9bb..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch
+++ /dev/null
@@ -1,12 +0,0 @@
1--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500
2+++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500
3@@ -7194,6 +7194,9 @@
4 cat >>conftest.$ac_ext <<_ACEOF
5 /* end confdefs.h. */
6 #include <complex.h>
7+#ifdef __UCLIBC__
8+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
9+#endif
10 int
11 main ()
12 {
diff --git a/meta/packages/gcc/gcc-4.1.1/304-index_macro.patch b/meta/packages/gcc/gcc-4.1.1/304-index_macro.patch
deleted file mode 100644
index 1fac112fa9..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/304-index_macro.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100
2+++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100
3@@ -59,6 +59,9 @@
4 #include <bits/allocator.h>
5 #include <ext/hash_fun.h>
6
7+/* cope w/ index defined as macro, SuSv3 proposal */
8+#undef index
9+
10 # ifdef __GC
11 # define __GC_CONST const
12 # else
13--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100
14+++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100
15@@ -53,6 +53,9 @@
16 #include <ext/memory> // For uninitialized_copy_n
17 #include <ext/numeric> // For power
18
19+/* cope w/ index defined as macro, SuSv3 proposal */
20+#undef index
21+
22 namespace __gnu_cxx
23 {
24 using std::size_t;
diff --git a/meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch
deleted file mode 100644
index 23fce7544d..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1--- gcc-4.1.0/libstdc++-v3/fragment.am 2005-03-21 11:40:14.000000000 -0600
2+++ gcc-4.1.0-patched/libstdc++-v3/fragment.am 2005-04-25 20:14:39.856251785 -0500
3@@ -21,5 +21,5 @@
4 $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
5
6 # -I/-D flags to pass when compiling.
7-AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
8+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include
9
10--- gcc-4.1.0/libstdc++-v3/libmath/Makefile.am 2005-03-21 11:40:18.000000000 -0600
11+++ gcc-4.1.0-patched/libstdc++-v3/libmath/Makefile.am 2005-04-25 20:14:39.682280735 -0500
12@@ -35,7 +35,7 @@
13
14 libmath_la_SOURCES = stubs.c
15
16-AM_CPPFLAGS = $(CANADIAN_INCLUDES)
17+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include
18
19 # Only compiling "C" sources in this directory.
20 LIBTOOL = @LIBTOOL@ --tag CC
diff --git a/meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch b/meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch
deleted file mode 100644
index 7992282cff..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348
2http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836
3
4--- gcc/gcc/configure.ac (revision 106699)
5+++ gcc/gcc/configure.ac (working copy)
6@@ -2446,7 +2446,7 @@
7 tls_first_minor=14
8 tls_as_opt="-m64 -Aesame --fatal-warnings"
9 ;;
10- sh-*-* | sh[34]-*-*)
11+ sh-*-* | sh[34]*-*-*)
12 conftest_s='
13 .section ".tdata","awT",@progbits
14 foo: .long 25
15--- gcc/gcc/configure
16+++ gcc/gcc/configure
17@@ -14846,7 +14846,7 @@
18 tls_first_minor=14
19 tls_as_opt="-m64 -Aesame --fatal-warnings"
20 ;;
21- sh-*-* | sh[34]-*-*)
22+ sh-*-* | sh[34]*-*-*)
23 conftest_s='
24 .section ".tdata","awT",@progbits
25 foo: .long 25
diff --git a/meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch b/meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch
deleted file mode 100644
index 1fa5ae1cd2..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1By Lennert Buytenhek <buytenh@wantstofly.org>
2Adds support for arm*b-linux* big-endian ARM targets
3
4See http://gcc.gnu.org/PR16350
5
6--- gcc-4.1.0/gcc/config/arm/linux-elf.h
7+++ gcc-4.1.0/gcc/config/arm/linux-elf.h
8@@ -28,19 +28,33 @@
9 #undef TARGET_VERSION
10 #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
11
12+/*
13+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
14+ * (big endian) configurations.
15+ */
16+#if TARGET_BIG_ENDIAN_DEFAULT
17+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
18+#define TARGET_ENDIAN_OPTION "mbig-endian"
19+#define TARGET_LINKER_EMULATION "armelfb_linux"
20+#else
21+#define TARGET_ENDIAN_DEFAULT 0
22+#define TARGET_ENDIAN_OPTION "mlittle-endian"
23+#define TARGET_LINKER_EMULATION "armelf_linux"
24+#endif
25+
26 #undef TARGET_DEFAULT_FLOAT_ABI
27 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
28
29 #undef TARGET_DEFAULT
30-#define TARGET_DEFAULT (0)
31+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
32
33 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
34
35-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
36+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
37
38 #undef MULTILIB_DEFAULTS
39 #define MULTILIB_DEFAULTS \
40- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
41+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
42
43 /* Now we define the strings used to build the spec file. */
44 #undef LIB_SPEC
45@@ -61,7 +75,7 @@
46 %{rdynamic:-export-dynamic} \
47 %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
48 -X \
49- %{mbig-endian:-EB}" \
50+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
51 SUBTARGET_EXTRA_LINK_SPEC
52
53 #undef LINK_SPEC
54--- gcc-4.1.0/gcc/config.gcc
55+++ gcc-4.1.0/gcc/config.gcc
56@@ -672,6 +672,11 @@
57 ;;
58 arm*-*-linux*) # ARM GNU/Linux with ELF
59 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
60+ case $target in
61+ arm*b-*)
62+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
63+ ;;
64+ esac
65 tmake_file="${tmake_file} t-linux arm/t-arm"
66 case ${target} in
67 arm*-*-linux-gnueabi)
diff --git a/meta/packages/gcc/gcc-4.1.1/801-arm-bigendian-eabi.patch b/meta/packages/gcc/gcc-4.1.1/801-arm-bigendian-eabi.patch
deleted file mode 100644
index 54490fc24f..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/801-arm-bigendian-eabi.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h
2===================================================================
3--- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h 2007-02-20 14:51:33.416193250 +0100
4+++ gcc-4.1.1/gcc/config/arm/linux-eabi.h 2007-02-20 14:52:11.622581000 +0100
5@@ -48,7 +48,8 @@
6 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
7
8 #undef SUBTARGET_EXTRA_LINK_SPEC
9-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
10+#define SUBTARGET_EXTRA_LINK_SPEC \
11+ " %{mbig-endian:-m armelfb_linux_eabi} %{mlittle-endian:-m armelf_linux_eabi} "
12
13 /* Use ld-linux.so.3 so that it will be possible to run "classic"
14 GNU/Linux binaries on an EABI system. */
diff --git a/meta/packages/gcc/gcc-4.1.1/README b/meta/packages/gcc/gcc-4.1.1/README
deleted file mode 100644
index b85840dc20..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/README
+++ /dev/null
@@ -1,4 +0,0 @@
1The numbered patches come from
2http://www.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/gcc/4.1.1/
3Other patches are locally added to fix things (mostly inherited and reapplied
4from gcc 3.4.4 where applicable)
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch b/meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch
deleted file mode 100644
index c4897c0330..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1# Dimitry Andric <dimitry@andric.com>, 2004-05-01
2#
3# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
4# anymore. (The required functions are now in libgcc.)
5#
6# Fixes errors like
7# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
8# collect2: ld returned 1 exit status
9# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
10# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat
11
12Index: gcc-4.0.2/gcc/config/arm/linux-elf.h
13===================================================================
14--- gcc-4.0.2.orig/gcc/config/arm/linux-elf.h 2005-03-04 16:14:01.000000000 +0000
15+++ gcc-4.0.2/gcc/config/arm/linux-elf.h 2005-11-11 18:02:54.000000000 +0000
16@@ -56,7 +56,7 @@
17 %{shared:-lc} \
18 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
19
20-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
21+#define LIBGCC_SPEC "-lgcc"
22
23 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
24 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch b/meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch
deleted file mode 100644
index c86c83ed15..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1Index: gcc-4.0.2/gcc/config/arm/t-linux
2===================================================================
3--- gcc-4.0.2.orig/gcc/config/arm/t-linux 2004-05-15 12:41:35.000000000 +0000
4+++ gcc-4.0.2/gcc/config/arm/t-linux 2005-11-11 16:07:53.000000000 +0000
5@@ -4,7 +4,10 @@
6 LIBGCC2_DEBUG_CFLAGS = -g0
7
8 LIB1ASMSRC = arm/lib1funcs.asm
9-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
10+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
11+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
12+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
13+ _fixsfsi _fixunssfsi _floatdidf _floatdisf
14
15 # MULTILIB_OPTIONS = mhard-float/msoft-float
16 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch b/meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch
deleted file mode 100644
index fa63846c8c..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1--- gcc-4.1.1/gcc/config/arm/linux-gas.h- 2005-06-25 03:22:41.000000000 +0200
2+++ gcc-4.1.1/gcc/config/arm/linux-gas.h 2006-06-18 10:23:46.000000000 +0200
3@@ -44,6 +44,7 @@
4
5 /* Clear the instruction cache from `beg' to `end'. This makes an
6 inline system call to SYS_cacheflush. */
7+#if !defined(__thumb__)
8 #define CLEAR_INSN_CACHE(BEG, END) \
9 { \
10 register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
11@@ -53,3 +54,18 @@
12 : "=r" (_beg) \
13 : "0" (_beg), "r" (_end), "r" (_flg)); \
14 }
15+#else
16+#define CLEAR_INSN_CACHE(BEG, END) \
17+{ \
18+ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
19+ register unsigned long _end __asm ("a2") = (unsigned long) (END); \
20+ register unsigned long _flg __asm ("a3") = 0; \
21+ register unsigned long _swi __asm ("a4") = 0xf0002; \
22+ __asm __volatile ("push {r7}\n" \
23+ " mov r7,a4\n" \
24+ " swi 0 @ sys_cacheflush\n" \
25+ " pop {r7}\n" \
26+ : "=r" (_beg) \
27+ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \
28+}
29+#endif
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-thumb.patch b/meta/packages/gcc/gcc-4.1.1/arm-thumb.patch
deleted file mode 100644
index 69e2f68cf2..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/arm-thumb.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- gcc-4.1.1/gcc/config/arm/lib1funcs.asm~gcc
7+++ gcc-4.1.1/gcc/config/arm/lib1funcs.asm
8@@ -995,10 +995,24 @@
9 .code 32
10 FUNC_START div0
11
12+#if ! defined __thumb__
13 stmfd sp!, {r1, lr}
14 mov r0, #SIGFPE
15 bl SYM(raise) __PLT__
16 RETLDM r1
17+#else
18+ push {r1, lr}
19+ mov r0, #SIGFPE
20+ bl SYM(raise) __PLT__
21+#if __ARM_ARCH__ > 4
22+ pop {r1, pc}
23+#else
24+ @ on 4T that won't work
25+ pop {r1}
26+ pop {r3}
27+ bx r3
28+#endif
29+#endif
30
31 FUNC_END div0
32
33@@ -1141,11 +1155,12 @@
34 code here switches to the correct mode before executing the function. */
35
36 .text
37- .align 0
38+ .align 1
39 .force_thumb
40
41 .macro call_via register
42 THUMB_FUNC_START _call_via_\register
43+ .hidden SYM (_call_via_\register)
44
45 bx \register
46 nop
47@@ -1242,6 +1257,7 @@
48 .code 16
49
50 THUMB_FUNC_START _interwork_call_via_\register
51+ .hidden SYM (_interwork_call_via_\register)
52
53 bx pc
54 nop
55--- gcc-4.1.1/gcc/config/arm/t-linux~gcc
56+++ gcc-4.1.1/gcc/config/arm/t-linux
57@@ -7,6 +7,7 @@
58 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
59 _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
60 _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
61+ _call_via_rX \
62 _fixsfsi _fixunssfsi _floatdidf _floatdisf
63
64 # MULTILIB_OPTIONS = mhard-float/msoft-float
diff --git a/meta/packages/gcc/gcc-4.1.1/cse.patch b/meta/packages/gcc/gcc-4.1.1/cse.patch
deleted file mode 100644
index 88b22c714f..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/cse.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1-- gcc-4_1-branch/gcc/cse.c 2006/07/20 14:20:26 115619
2+++ gcc-4_1-branch/gcc/cse.c 2006/07/20 15:07:25 115620
3@@ -4697,6 +4697,8 @@
4 unsigned src_const_hash;
5 /* Table entry for constant equivalent for SET_SRC, if any. */
6 struct table_elt *src_const_elt;
7+ /* Table entry for the destination address. */
8+ struct table_elt *dest_addr_elt;
9 };
10
11 static void
12@@ -5936,6 +5938,40 @@
13 so that the destination goes into that class. */
14 sets[i].src_elt = src_eqv_elt;
15
16+ /* Record destination addresses in the hash table. This allows us to
17+ check if they are invalidated by other sets. */
18+ for (i = 0; i < n_sets; i++)
19+ {
20+ if (sets[i].rtl)
21+ {
22+ rtx x = sets[i].inner_dest;
23+ struct table_elt *elt;
24+ enum machine_mode mode;
25+ unsigned hash;
26+
27+ if (MEM_P (x))
28+ {
29+ x = XEXP (x, 0);
30+ mode = GET_MODE (x);
31+ hash = HASH (x, mode);
32+ elt = lookup (x, hash, mode);
33+ if (!elt)
34+ {
35+ if (insert_regs (x, NULL, 0))
36+ {
37+ rehash_using_reg (x);
38+ hash = HASH (x, mode);
39+ }
40+ elt = insert (x, NULL, hash, mode);
41+ }
42+
43+ sets[i].dest_addr_elt = elt;
44+ }
45+ else
46+ sets[i].dest_addr_elt = NULL;
47+ }
48+ }
49+
50 invalidate_from_clobbers (x);
51
52 /* Some registers are invalidated by subroutine calls. Memory is
53@@ -6028,12 +6064,20 @@
54 }
55
56 /* We may have just removed some of the src_elt's from the hash table.
57- So replace each one with the current head of the same class. */
58+ So replace each one with the current head of the same class.
59+ Also check if destination addresses have been removed. */
60
61 for (i = 0; i < n_sets; i++)
62 if (sets[i].rtl)
63 {
64- if (sets[i].src_elt && sets[i].src_elt->first_same_value == 0)
65+ if (sets[i].dest_addr_elt
66+ && sets[i].dest_addr_elt->first_same_value == 0)
67+ {
68+ /* The elt was removed, which means this destination s not
69+ valid after this instruction. */
70+ sets[i].rtl = NULL_RTX;
71+ }
72+ else if (sets[i].src_elt && sets[i].src_elt->first_same_value == 0)
73 /* If elt was removed, find current head of same class,
74 or 0 if nothing remains of that class. */
75 {
diff --git a/meta/packages/gcc/gcc-4.1.1/fix-ICE-in-arm_unwind_emit_set.diff b/meta/packages/gcc/gcc-4.1.1/fix-ICE-in-arm_unwind_emit_set.diff
deleted file mode 100644
index 568e15abff..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/fix-ICE-in-arm_unwind_emit_set.diff
+++ /dev/null
@@ -1,18 +0,0 @@
1--- trunk/gcc/config/arm/arm.c 2006/09/19 13:18:27 117055
2+++ trunk/gcc/config/arm/arm.c 2006/09/19 13:19:24 117056
3@@ -15415,6 +15415,15 @@
4 /* Move from sp to reg. */
5 asm_fprintf (asm_out_file, "\t.movsp %r\n", REGNO (e0));
6 }
7+ else if (GET_CODE (e1) == PLUS
8+ && GET_CODE (XEXP (e1, 0)) == REG
9+ && REGNO (XEXP (e1, 0)) == SP_REGNUM
10+ && GET_CODE (XEXP (e1, 1)) == CONST_INT)
11+ {
12+ /* Set reg to offset from sp. */
13+ asm_fprintf (asm_out_file, "\t.movsp %r, #%d\n",
14+ REGNO (e0), (int)INTVAL(XEXP (e1, 1)));
15+ }
16 else
17 abort ();
18 break;
diff --git a/meta/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch b/meta/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch
deleted file mode 100644
index a56b1307df..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/gcc-4.1.1-pr13685-1.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1Submitted By: Alexander E. Patrakov
2Date: 2006-12-11
3Initial Package Version: 4.1.1
4Upstream Status: backport
5Origin: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28621
6Description: Fix crash of programs compiled with -Os -ffast-math
7(affects procps on the LiveCD)
8--- gcc-4.1.1/gcc/config/i386/i386.c
9+++ gcc-4.1.1/gcc/config/i386/i386.c
10@@ -1502,12 +1502,10 @@
11 }
12
13 /* Validate -mpreferred-stack-boundary= value, or provide default.
14- The default of 128 bits is for Pentium III's SSE __m128, but we
15- don't want additional code to keep the stack aligned when
16- optimizing for code size. */
17- ix86_preferred_stack_boundary = (optimize_size
18- ? TARGET_64BIT ? 128 : 32
19- : 128);
20+ The default of 128 bits is for Pentium III's SSE __m128, We can't
21+ change it because of optimize_size. Otherwise, we can't mix object
22+ files compiled with -Os and -On. */
23+ ix86_preferred_stack_boundary = 128;
24 if (ix86_preferred_stack_boundary_string)
25 {
26 i = atoi (ix86_preferred_stack_boundary_string);
diff --git a/meta/packages/gcc/gcc-4.1.1/gcc-ignore-cache.patch b/meta/packages/gcc/gcc-4.1.1/gcc-ignore-cache.patch
deleted file mode 100644
index 396b4b2345..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/gcc-ignore-cache.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1--- /gcc/orig-configure 2007-03-11 21:50:28.000000000 +0200
2+++ /gcc/configure 2007-03-11 21:53:27.000000000 +0200
3@@ -12272,9 +12272,11 @@
4 esac
5 saved_CFLAGS="${CFLAGS}"
6 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
7+ CONFIG_SITE=""
8 ${realsrcdir}/configure \
9 --enable-languages=${enable_languages-all} \
10- --target=$target_alias --host=$build_alias --build=$build_alias
11+ --target=$target_alias --host=$build_alias --build=$build_alias \
12+ --cache-file=./tmp-cache
13 CFLAGS="${saved_CFLAGS}"
14
15 # We just finished tests for the build machine, so rename
diff --git a/meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch b/meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch
deleted file mode 100644
index 3d33bcb978..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1--- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700
2+++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700
3@@ -1907,7 +1907,7 @@
4 *) gxx_include_dir=${with_gxx_include_dir} ;;
5 esac
6
7-FLAGS_FOR_TARGET=
8+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
9 case " $target_configdirs " in
10 *" newlib "*)
11 case " $target_configargs " in
12--- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700
13+++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700
14@@ -2669,7 +2669,7 @@
15 *) gxx_include_dir=${with_gxx_include_dir} ;;
16 esac
17
18-FLAGS_FOR_TARGET=
19+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
20 case " $target_configdirs " in
21 *" newlib "*)
22 case " $target_configargs " in
diff --git a/meta/packages/gcc/gcc-4.1.1/ldflags.patch b/meta/packages/gcc/gcc-4.1.1/ldflags.patch
deleted file mode 100644
index 9576f60778..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/ldflags.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1--- /tmp/Makefile.in 2006-02-23 20:56:01.399758728 +0100
2+++ gcc-4.1-20060217/Makefile.in 2006-02-23 20:56:16.874406224 +0100
3@@ -334,7 +334,7 @@
4 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
5 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
6 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
7-LDFLAGS_FOR_TARGET =
8+LDFLAGS_FOR_TARGET = @LDFLAGS@
9 PICFLAG_FOR_TARGET =
10
11 # ------------------------------------
12--- /tmp/Makefile.tpl 2006-02-23 20:50:34.077519272 +0100
13+++ gcc-4.1-20060217/Makefile.tpl 2006-02-23 21:04:31.092273688 +0100
14@@ -337,7 +337,7 @@
15 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
16 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
17 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
18-LDFLAGS_FOR_TARGET =
19+LDFLAGS_FOR_TARGET = @LDFLAGS@
20 PICFLAG_FOR_TARGET =
21
22 # ------------------------------------
diff --git a/meta/packages/gcc/gcc-4.1.1/ppc-gcc-41-20060515.patch b/meta/packages/gcc/gcc-4.1.1/ppc-gcc-41-20060515.patch
deleted file mode 100644
index 166e79c7e9..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/ppc-gcc-41-20060515.patch
+++ /dev/null
@@ -1,2225 +0,0 @@
1diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/ChangeLog gcc-41-20060515/gcc/ChangeLog
2--- gcc-41-20060515.orig/gcc/ChangeLog 2006-05-15 11:14:20.000000000 -0500
3+++ gcc-41-20060515/gcc/ChangeLog 2006-05-15 14:00:27.693964000 -0500
4@@ -724,6 +724,51 @@
5 * reload1.c (choose_reload_regs): Added call of regno_clobbered_p
6 with new meaning of SETS.
7
8+2006-02-14 Jakub Jelinek <jakub@redhat.com>
9+ Aldy Hernandez <aldyh@redhat.com>
10+
11+ PR target/25864
12+ * configure.ac: Add --with{out}-long-double-128 configure option.
13+ (TARGET_DEFAULT_LONG_DOUBLE_128): New test.
14+ * configure: Rebuilt.
15+ * config.in: Rebuilt.
16+ * doc/install.texi (Options specification): Document
17+ --with-long-double-128.
18+
19+ * config.gcc (sparc-*-linux*): Add sparc/t-linux to tmake_file.
20+ (sparc64-*-linux*): Likewise.
21+ * config/sparc/t-linux64 (SHLIB_MAPFILES): Removed.
22+ * config/sparc/t-linux: New file.
23+ * config/sparc/libgcc-sparc-glibc.ver (__fixtfdi, __fixunstfdi,
24+ __floatditf): Export at GCC_LDBL_3.0 if -m32 -mlong-double-128.
25+ (__divtc3, __multc3, __powitf2): Export at GCC_LDBL_4.0.0 if
26+ -m32 -mlong-double-128.
27+
28+ * config.gcc (alpha*-*-linux*): Add alpha/t-linux to tmake_file.
29+ * config/alpha/t-linux: New file.
30+ * config/alpha/libgcc-alpha-ldbl.ver: New file.
31+
32+ * config/sparc/linux.h (TARGET_OS_CPP_BUILTINS): Define
33+ __LONG_DOUBLE_128__ if TARGET_LONG_DOUBLE_128.
34+ (CPP_SUBTARGET_SPEC): Don't add -D__LONG_DOUBLE_128__ here.
35+ * config/sparc/linux64.h (TARGET_OS_CPP_BUILTINS): Define
36+ __LONG_DOUBLE_128__ if TARGET_LONG_DOUBLE_128 and TARGET_ARCH32.
37+ (CPP_ARCH32_SPEC): Remove.
38+
39+ * config/s390/s390.c (override_options): Handle
40+ TARGET_DEFAULT_LONG_DOUBLE_128.
41+
42+ * config/alpha/alpha.c (override_options): Handle
43+ TARGET_DEFAULT_LONG_DOUBLE_128.
44+
45+ * config/sparc/sparc.c (sparc_override_options): Handle
46+ TARGET_DEFAULT_LONG_DOUBLE_128.
47+
48+ * config/rs6000/linux.h [TARGET_DEFAULT_LONG_DOUBLE_128]
49+ (RS6000_DEFAULT_LONG_DOUBLE_SIZE): Define to 128.
50+ * config/rs6000/linux64.h [TARGET_DEFAULT_LONG_DOUBLE_128]
51+ (RS6000_DEFAULT_LONG_DOUBLE_SIZE): Define to 128.
52+
53 2006-02-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
54
55 * doc/install.texi: Add missing `@samp'.
56diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/alpha/alpha.c gcc-41-20060515/gcc/config/alpha/alpha.c
57--- gcc-41-20060515.orig/gcc/config/alpha/alpha.c 2006-05-15 11:13:49.000000000 -0500
58+++ gcc-41-20060515/gcc/config/alpha/alpha.c 2006-05-15 13:47:27.566272961 -0500
59@@ -516,6 +516,11 @@ override_options (void)
60 REAL_MODE_FORMAT (DFmode) = &vax_g_format;
61 REAL_MODE_FORMAT (TFmode) = NULL;
62 }
63+
64+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
65+ if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
66+ target_flags |= MASK_LONG_DOUBLE_128;
67+#endif
68 }
69
70 /* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */
71diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/alpha/libgcc-alpha-ldbl.ver gcc-41-20060515/gcc/config/alpha/libgcc-alpha-ldbl.ver
72--- gcc-41-20060515.orig/gcc/config/alpha/libgcc-alpha-ldbl.ver 1969-12-31 18:00:00.000000000 -0600
73+++ gcc-41-20060515/gcc/config/alpha/libgcc-alpha-ldbl.ver 2006-05-15 13:47:27.566272961 -0500
74@@ -0,0 +1,32 @@
75+%ifdef __LONG_DOUBLE_128__
76+
77+# long double 128 bit support in libgcc_s.so.1 is only available
78+# when configured with --with-long-double-128. Make sure all the
79+# symbols are available at @@GCC_LDBL_* versions to make it clear
80+# there is a configurable symbol set.
81+
82+%exclude {
83+ __fixtfdi
84+ __fixunstfdi
85+ __floatditf
86+
87+ __divtc3
88+ __multc3
89+ __powitf2
90+}
91+
92+%inherit GCC_LDBL_3.0 GCC_3.0
93+GCC_LDBL_3.0 {
94+ __fixtfdi
95+ __fixunstfdi
96+ __floatditf
97+}
98+
99+%inherit GCC_LDBL_4.0.0 GCC_4.0.0
100+GCC_LDBL_4.0.0 {
101+ __divtc3
102+ __multc3
103+ __powitf2
104+}
105+
106+%endif
107diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/alpha/t-linux gcc-41-20060515/gcc/config/alpha/t-linux
108--- gcc-41-20060515.orig/gcc/config/alpha/t-linux 1969-12-31 18:00:00.000000000 -0600
109+++ gcc-41-20060515/gcc/config/alpha/t-linux 2006-05-15 13:47:27.567272807 -0500
110@@ -0,0 +1 @@
111+SHLIB_MAPFILES += $(srcdir)/config/alpha/libgcc-alpha-ldbl.ver
112diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/rs6000/linux64.h gcc-41-20060515/gcc/config/rs6000/linux64.h
113--- gcc-41-20060515.orig/gcc/config/rs6000/linux64.h 2006-05-15 11:14:02.000000000 -0500
114+++ gcc-41-20060515/gcc/config/rs6000/linux64.h 2006-05-15 13:47:27.568272653 -0500
115@@ -570,3 +570,8 @@ while (0)
116 #endif
117
118 #define POWERPC_LINUX
119+
120+/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
121+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
122+#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
123+#endif
124diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/rs6000/linux.h gcc-41-20060515/gcc/config/rs6000/linux.h
125--- gcc-41-20060515.orig/gcc/config/rs6000/linux.h 2006-05-15 11:14:02.000000000 -0500
126+++ gcc-41-20060515/gcc/config/rs6000/linux.h 2006-05-15 13:47:27.567272807 -0500
127@@ -120,3 +120,8 @@
128 #endif
129
130 #define POWERPC_LINUX
131+
132+/* ppc linux has 128-bit long double support in glibc 2.4 and later. */
133+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
134+#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
135+#endif
136diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/s390/s390.c gcc-41-20060515/gcc/config/s390/s390.c
137--- gcc-41-20060515.orig/gcc/config/s390/s390.c 2006-05-15 11:13:50.000000000 -0500
138+++ gcc-41-20060515/gcc/config/s390/s390.c 2006-05-15 13:47:27.574271730 -0500
139@@ -1415,6 +1415,11 @@ override_options (void)
140 }
141 else if (s390_stack_guard)
142 error ("-mstack-guard implies use of -mstack-size");
143+
144+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
145+ if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
146+ target_flags |= MASK_LONG_DOUBLE_128;
147+#endif
148 }
149
150 /* Map for smallest class containing reg regno. */
151diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/sparc/libgcc-sparc-glibc.ver gcc-41-20060515/gcc/config/sparc/libgcc-sparc-glibc.ver
152--- gcc-41-20060515.orig/gcc/config/sparc/libgcc-sparc-glibc.ver 2006-05-15 11:13:55.000000000 -0500
153+++ gcc-41-20060515/gcc/config/sparc/libgcc-sparc-glibc.ver 2006-05-15 13:47:27.574271730 -0500
154@@ -26,3 +26,36 @@ GLIBC_VER {
155 __frame_state_for
156 __register_frame_info_table
157 }
158+
159+%if !defined (__arch64__) && defined (__LONG_DOUBLE_128__)
160+
161+# long double 128 bit support from 32-bit libgcc_s.so.1 is only available
162+# when configured with --with-long-double-128. Make sure all the
163+# symbols are available at @@GCC_LDBL_* versions to make it clear
164+# there is a configurable symbol set.
165+
166+%exclude {
167+ __fixtfdi
168+ __fixunstfdi
169+ __floatditf
170+
171+ __divtc3
172+ __multc3
173+ __powitf2
174+}
175+
176+%inherit GCC_LDBL_3.0 GCC_3.0
177+GCC_LDBL_3.0 {
178+ __fixtfdi
179+ __fixunstfdi
180+ __floatditf
181+}
182+
183+%inherit GCC_LDBL_4.0.0 GCC_4.0.0
184+GCC_LDBL_4.0.0 {
185+ __divtc3
186+ __multc3
187+ __powitf2
188+}
189+
190+%endif
191diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/sparc/linux64.h gcc-41-20060515/gcc/config/sparc/linux64.h
192--- gcc-41-20060515.orig/gcc/config/sparc/linux64.h 2006-05-15 11:13:55.000000000 -0500
193+++ gcc-41-20060515/gcc/config/sparc/linux64.h 2006-05-15 13:47:27.576271422 -0500
194@@ -20,22 +20,24 @@ along with GCC; see the file COPYING. I
195 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
196 Boston, MA 02110-1301, USA. */
197
198-#define TARGET_OS_CPP_BUILTINS() \
199- do \
200- { \
201- builtin_define_std ("unix"); \
202- builtin_define_std ("linux"); \
203- builtin_define ("_LONGLONG"); \
204- builtin_define ("__gnu_linux__"); \
205- builtin_assert ("system=linux"); \
206- builtin_assert ("system=unix"); \
207- builtin_assert ("system=posix"); \
208- if (flag_pic) \
209- { \
210- builtin_define ("__PIC__"); \
211- builtin_define ("__pic__"); \
212- } \
213- } \
214+#define TARGET_OS_CPP_BUILTINS() \
215+ do \
216+ { \
217+ builtin_define_std ("unix"); \
218+ builtin_define_std ("linux"); \
219+ builtin_define ("_LONGLONG"); \
220+ builtin_define ("__gnu_linux__"); \
221+ builtin_assert ("system=linux"); \
222+ builtin_assert ("system=unix"); \
223+ builtin_assert ("system=posix"); \
224+ if (flag_pic) \
225+ { \
226+ builtin_define ("__PIC__"); \
227+ builtin_define ("__pic__"); \
228+ } \
229+ if (TARGET_ARCH32 && TARGET_LONG_DOUBLE_128) \
230+ builtin_define ("__LONG_DOUBLE_128__"); \
231+ } \
232 while (0)
233
234 /* Don't assume anything about the header files. */
235@@ -59,13 +61,6 @@ Boston, MA 02110-1301, USA. */
236 #undef ASM_CPU_DEFAULT_SPEC
237 #define ASM_CPU_DEFAULT_SPEC "-Av9a"
238
239-#ifdef SPARC_BI_ARCH
240-
241-#undef CPP_ARCH32_SPEC
242-#define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__}"
243-
244-#endif
245-
246 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
247 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
248 provides part of the support for getting C++ file-scope static
249diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/sparc/linux.h gcc-41-20060515/gcc/config/sparc/linux.h
250--- gcc-41-20060515.orig/gcc/config/sparc/linux.h 2006-05-15 11:13:55.000000000 -0500
251+++ gcc-41-20060515/gcc/config/sparc/linux.h 2006-05-15 13:47:27.575271576 -0500
252@@ -23,17 +23,19 @@ Boston, MA 02110-1301, USA. */
253 #define TARGET_OS_CPP_BUILTINS() \
254 do \
255 { \
256- builtin_define_std ("unix"); \
257- builtin_define_std ("linux"); \
258- builtin_define ("__gnu_linux__"); \
259- builtin_assert ("system=linux"); \
260- builtin_assert ("system=unix"); \
261- builtin_assert ("system=posix"); \
262- if (flag_pic) \
263- { \
264- builtin_define ("__PIC__"); \
265- builtin_define ("__pic__"); \
266- } \
267+ builtin_define_std ("unix"); \
268+ builtin_define_std ("linux"); \
269+ builtin_define ("__gnu_linux__"); \
270+ builtin_assert ("system=linux"); \
271+ builtin_assert ("system=unix"); \
272+ builtin_assert ("system=posix"); \
273+ if (flag_pic) \
274+ { \
275+ builtin_define ("__PIC__"); \
276+ builtin_define ("__pic__"); \
277+ } \
278+ if (TARGET_LONG_DOUBLE_128) \
279+ builtin_define ("__LONG_DOUBLE_128__"); \
280 } \
281 while (0)
282
283@@ -100,8 +102,7 @@ Boston, MA 02110-1301, USA. */
284
285 #undef CPP_SUBTARGET_SPEC
286 #define CPP_SUBTARGET_SPEC \
287-"%{posix:-D_POSIX_SOURCE} \
288-%{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}"
289+"%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
290
291 #undef LIB_SPEC
292 #define LIB_SPEC \
293diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/sparc/sparc.c gcc-41-20060515/gcc/config/sparc/sparc.c
294--- gcc-41-20060515.orig/gcc/config/sparc/sparc.c 2006-05-15 11:13:55.000000000 -0500
295+++ gcc-41-20060515/gcc/config/sparc/sparc.c 2006-05-15 13:47:27.581270653 -0500
296@@ -790,6 +790,11 @@ sparc_override_options (void)
297 sparc_costs = &ultrasparc3_costs;
298 break;
299 };
300+
301+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
302+ if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
303+ target_flags |= MASK_LONG_DOUBLE_128;
304+#endif
305 }
306
307 #ifdef SUBTARGET_ATTRIBUTE_TABLE
308diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/sparc/t-linux gcc-41-20060515/gcc/config/sparc/t-linux
309--- gcc-41-20060515.orig/gcc/config/sparc/t-linux 1969-12-31 18:00:00.000000000 -0600
310+++ gcc-41-20060515/gcc/config/sparc/t-linux 2006-05-15 13:47:27.582270499 -0500
311@@ -0,0 +1,5 @@
312+# Override t-slibgcc-elf-ver to export some libgcc symbols with
313+# the symbol versions that glibc used.
314+# Avoid the t-linux version file.
315+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
316+ $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
317diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config/sparc/t-linux64 gcc-41-20060515/gcc/config/sparc/t-linux64
318--- gcc-41-20060515.orig/gcc/config/sparc/t-linux64 2006-05-15 11:13:55.000000000 -0500
319+++ gcc-41-20060515/gcc/config/sparc/t-linux64 2006-05-15 13:47:27.582270499 -0500
320@@ -8,12 +8,6 @@ INSTALL_LIBGCC = install-multilib
321 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \
322 crtfastmath.o
323
324-# Override t-slibgcc-elf-ver to export some libgcc symbols with
325-# the symbol versions that glibc used.
326-# Avoid the t-linux version file.
327-SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
328- $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
329-
330 CRTSTUFF_T_CFLAGS = `if test x$$($(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) \
331 -print-multi-os-directory) \
332 = x../lib64; then echo -mcmodel=medany; fi`
333diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config.gcc gcc-41-20060515/gcc/config.gcc
334--- gcc-41-20060515.orig/gcc/config.gcc 2006-05-15 11:14:20.000000000 -0500
335+++ gcc-41-20060515/gcc/config.gcc 2006-05-15 13:47:27.555274654 -0500
336@@ -568,7 +568,7 @@ alpha*-*-unicosmk*)
337 alpha*-*-linux*)
338 tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
339 target_cpu_default="MASK_GAS"
340- tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
341+ tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee alpha/t-linux"
342 ;;
343 alpha*-*-gnu*)
344 target_cpu_default="MASK_GAS"
345@@ -2056,7 +2056,7 @@ sparc-*-elf*)
346 sparc-*-linux*) # SPARC's running GNU/Linux, libc6
347 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux.h"
348 extra_options="${extra_options} sparc/long-double-switch.opt"
349- tmake_file="${tmake_file} sparc/t-crtfm"
350+ tmake_file="${tmake_file} sparc/t-linux sparc/t-crtfm"
351 ;;
352 sparc-*-rtems*)
353 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h"
354@@ -2175,7 +2175,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
355 sparc64-*-linux*) # 64-bit SPARC's running GNU/Linux
356 tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux64.h"
357 extra_options="${extra_options} sparc/long-double-switch.opt"
358- tmake_file="${tmake_file} sparc/t-linux64 sparc/t-crtfm"
359+ tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64 sparc/t-crtfm"
360 ;;
361 sparc64-*-netbsd*)
362 tm_file="sparc/biarch64.h ${tm_file}"
363diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/config.in gcc-41-20060515/gcc/config.in
364--- gcc-41-20060515.orig/gcc/config.in 2006-05-15 11:14:20.000000000 -0500
365+++ gcc-41-20060515/gcc/config.in 2006-05-15 13:47:27.559274038 -0500
366@@ -1277,6 +1277,12 @@
367 #endif
368
369
370+/* Define if TFmode long double should be the default */
371+#ifndef USED_FOR_TARGET
372+#undef TARGET_DEFAULT_LONG_DOUBLE_128
373+#endif
374+
375+
376 /* Define if your target C library provides stack protector support */
377 #ifndef USED_FOR_TARGET
378 #undef TARGET_LIBC_PROVIDES_SSP
379diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/configure gcc-41-20060515/gcc/configure
380--- gcc-41-20060515.orig/gcc/configure 2006-05-15 11:14:19.000000000 -0500
381+++ gcc-41-20060515/gcc/configure 2006-05-15 13:47:27.594268652 -0500
382@@ -931,6 +931,7 @@ Optional Packages:
383 --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
384 --without-libiconv-prefix don't search for libiconv in includedir and libdir
385 --with-system-libunwind use installed libunwind
386+ --with-long-double-128 Use 128-bit long double by default.
387 --with-gc={page,zone} choose the garbage collection mechanism to use
388 with the compiler
389 --with-system-zlib use installed libz
390@@ -7492,7 +7493,7 @@ if test "${gcc_cv_prog_makeinfo_modern+s
391 else
392 ac_prog_version=`$MAKEINFO --version 2>&1 |
393 sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
394- echo "configure:7495: version of makeinfo is $ac_prog_version" >&5
395+ echo "configure:7496: version of makeinfo is $ac_prog_version" >&5
396 case $ac_prog_version in
397 '') gcc_cv_prog_makeinfo_modern=no;;
398 4.[2-9]*)
399@@ -16213,6 +16214,46 @@ _ACEOF
400
401 fi
402
403+# Check if TFmode long double should be used by default or not.
404+# Some glibc targets used DFmode long double, but with glibc 2.4
405+# and later they can use TFmode.
406+case "$target" in
407+ powerpc*-*-*gnu* | \
408+ sparc*-*-linux* | \
409+ s390*-*-linux* | \
410+ alpha*-*-linux*)
411+
412+# Check whether --with-long-double-128 or --without-long-double-128 was given.
413+if test "${with_long_double_128+set}" = set; then
414+ withval="$with_long_double_128"
415+ gcc_cv_target_ldbl128="$with_long_double_128"
416+else
417+ gcc_cv_target_ldbl128=no
418+ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
419+ if test "x$with_sysroot" = x; then
420+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
421+ elif test "x$with_sysroot" = xyes; then
422+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
423+ else
424+ glibc_header_dir="${with_sysroot}/usr/include"
425+ fi
426+ else
427+ glibc_header_dir=/usr/include
428+ fi
429+ grep '^ *#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
430+ $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
431+ && gcc_cv_target_ldbl128=yes
432+fi;
433+ ;;
434+esac
435+if test x$gcc_cv_target_ldbl128 = xyes; then
436+
437+cat >>confdefs.h <<\_ACEOF
438+#define TARGET_DEFAULT_LONG_DOUBLE_128 1
439+_ACEOF
440+
441+fi
442+
443 # Find out what GC implementation we want, or may, use.
444
445 # Check whether --with-gc or --without-gc was given.
446diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/configure.ac gcc-41-20060515/gcc/configure.ac
447--- gcc-41-20060515.orig/gcc/configure.ac 2006-05-15 11:14:20.000000000 -0500
448+++ gcc-41-20060515/gcc/configure.ac 2006-05-15 13:47:27.597400000 -0500
449@@ -3130,6 +3130,39 @@ if test x$gcc_cv_libc_provides_ssp = xye
450 [Define if your target C library provides stack protector support])
451 fi
452
453+# Check if TFmode long double should be used by default or not.
454+# Some glibc targets used DFmode long double, but with glibc 2.4
455+# and later they can use TFmode.
456+case "$target" in
457+ powerpc*-*-*gnu* | \
458+ sparc*-*-linux* | \
459+ s390*-*-linux* | \
460+ alpha*-*-linux*)
461+ AC_ARG_WITH(long-double-128,
462+[ --with-long-double-128 Use 128-bit long double by default.],
463+ gcc_cv_target_ldbl128="$with_long_double_128",
464+ [gcc_cv_target_ldbl128=no
465+ if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
466+ if test "x$with_sysroot" = x; then
467+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
468+ elif test "x$with_sysroot" = xyes; then
469+ glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
470+ else
471+ glibc_header_dir="${with_sysroot}/usr/include"
472+ fi
473+ else
474+ glibc_header_dir=/usr/include
475+ fi
476+ grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
477+ $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
478+ && gcc_cv_target_ldbl128=yes])
479+ ;;
480+esac
481+if test x$gcc_cv_target_ldbl128 = xyes; then
482+ AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
483+ [Define if TFmode long double should be the default])
484+fi
485+
486 # Find out what GC implementation we want, or may, use.
487 AC_ARG_WITH(gc,
488 [ --with-gc={page,zone} choose the garbage collection mechanism to use
489diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/gcc/doc/install.texi gcc-41-20060515/gcc/doc/install.texi
490--- gcc-41-20060515.orig/gcc/doc/install.texi 2006-05-15 11:10:10.000000000 -0500
491+++ gcc-41-20060515/gcc/doc/install.texi 2006-05-15 13:47:27.600399538 -0500
492@@ -1224,6 +1224,14 @@ error message.
493 All support for systems which have been obsoleted in one release of GCC
494 is removed entirely in the next major release, unless someone steps
495 forward to maintain the port.
496+
497+@item --with-long-double-128
498+Specify if @code{long double} type should be 128-bit by default on selected
499+GNU/Linux architectures. If using @code{--without-long-double-128},
500+@code{long double} will be by default 64-bit, the same as @code{double} type.
501+When neither of these configure options are used, the default will be
502+128-bit @code{long double} when built against GNU C Library 2.4 and later,
503+64-bit @code{long double} otherwise.
504 @end table
505
506 @subheading Cross-Compiler-Specific Options
507diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/ChangeLog gcc-41-20060515/libstdc++-v3/ChangeLog
508--- gcc-41-20060515.orig/libstdc++-v3/ChangeLog 2006-05-15 11:15:42.000000000 -0500
509+++ gcc-41-20060515/libstdc++-v3/ChangeLog 2006-05-15 14:02:07.401662657 -0500
510@@ -153,6 +153,64 @@
511 Likewise.
512 * docs/html/ext/pb_assoc/tree_assoc_cntnr_node_iterator.html: Likewise.
513
514+2006-02-07 Jakub Jelinek <jakub@redhat.com>
515+ Benjamin Kosnik <bkoz@redhat.com>
516+
517+ PR target/25864
518+ * configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
519+ If true, set also port_specific_symbol_files and create
520+ as_symver_specs.
521+ (GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
522+ * configure: Rebuilt.
523+ * config.h.in: Rebuilt.
524+ * config/os/gnu-linux/ldbl-extra.ver: New file.
525+ * config/linker-map.gnu: Make sure no __float128 symbols are
526+ exported.
527+ * include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
528+ _GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
529+ _GLIBCXX_END_LDBL_NAMESPACE): Define.
530+ * include/bits/localefwd.h: Use them to conditionally scope facets.
531+ * include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
532+ with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
533+ [_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
534+ [_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
535+ [_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
536+ [_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
537+ * include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
538+ with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
539+ (std::money_get::__do_get, std::money_put::__do_put,
540+ std::num_get::__do_get, std::num_put::__do_put): New
541+ specializations.
542+ * include/Makefile.am: Conditionally define
543+ _GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
544+ * include/Makefile.in: Regenerate.
545+ * src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
546+ _GLIBCXX_SYNC_ID): Define, use them.
547+ * src/compatibility-ldbl.cc: New file.
548+ * src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
549+ symbols.
550+ * src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
551+ * src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
552+ * src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
553+ * src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
554+ * src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
555+ * src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
556+ * src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
557+ * src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
558+ * src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
559+ * config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
560+ Likewise.
561+ * config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
562+ Likewise.
563+ * src/Makefile.am (libstdc++-symbol.ver): Append instead of
564+ insert in the middle if port specific symbol file requests it.
565+ (ldbl_compat_sources): New variable.
566+ (sources): Use it.
567+ (compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
568+ * src/Makefile.in: Rebuilt.
569+ * testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
570+ GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
571+
572 2006-02-07 Paolo Carlini <pcarlini@suse.de>
573
574 * include/tr1/hashtable: Trivial formatting fixes.
575diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/config/linker-map.gnu gcc-41-20060515/libstdc++-v3/config/linker-map.gnu
576--- gcc-41-20060515.orig/libstdc++-v3/config/linker-map.gnu 2006-05-15 11:15:41.000000000 -0500
577+++ gcc-41-20060515/libstdc++-v3/config/linker-map.gnu 2006-05-15 13:47:27.603399076 -0500
578@@ -1,6 +1,6 @@
579 ## Linker script for GNU ld 2.13.91+ only.
580 ##
581-## Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
582+## Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
583 ##
584 ## This file is part of the libstdc++ version 3 distribution.
585 ##
586@@ -44,7 +44,10 @@ GLIBCXX_3.4 {
587 std::basic_[j-n]*;
588 std::basic_o[a-e]*;
589 # std::basic_ofstream;
590- std::basic_o[g-z]*;
591+# std::basic_o[g-z]*;
592+ std::basic_o[g-r]*;
593+ std::basic_ostr[a-d]*;
594+ std::basic_ostr[f-z]*;
595 std::basic_[p-r]*;
596 std::basic_streambuf*;
597 # std::basic_string
598@@ -88,7 +91,14 @@ GLIBCXX_3.4 {
599 std::locale::_[J-Ra-z]*;
600 std::locale::_S_normalize_category*;
601 std::locale::_[T-Za-z]*;
602- std::[A-Zm-r]*;
603+# std::[A-Zm-r]*;
604+ std::[A-Zmp-r]*;
605+ std::n[^u]*;
606+ std::nu[^m]*;
607+ std::num[^e]*;
608+ std::ostrstream*;
609+ std::out_of_range*;
610+ std::overflow_error*;
611 std::set_new_handler*;
612 std::set_terminate*;
613 std::set_unexpected*;
614@@ -256,7 +266,7 @@ GLIBCXX_3.4 {
615 _ZNSi[0-9][a-h]*;
616 _ZNSi[0-9][j-z]*;
617 _ZNSi6ignoreE[il][il];
618- _ZNSirsE*;
619+ _ZNSirsE*[^g];
620
621 # std::basic_istream<wchar_t>
622 _ZNSt13basic_istreamIwSt11char_traitsIwEEC*;
623@@ -265,7 +275,7 @@ GLIBCXX_3.4 {
624 _ZNSt13basic_istreamIwSt11char_traitsIwEE[0-9][a-h]*;
625 _ZNSt13basic_istreamIwSt11char_traitsIwEE[0-9][j-z]*;
626 _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreE[il][ijlm];
627- _ZNSt13basic_istreamIwSt11char_traitsIwEErsE*;
628+ _ZNSt13basic_istreamIwSt11char_traitsIwEErsE*[^g];
629
630 # std::istream operators and inserters
631 _ZSt7getlineI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_istream*;
632@@ -277,6 +287,37 @@ GLIBCXX_3.4 {
633 _ZStrsIe[cw]St11char_traitsI[cw]EERSt13basic_istream*;
634 _ZStrsIf[cw]St11char_traitsI[cw]EERSt13basic_istream*;
635
636+ # std::basic_ostream<char>
637+ _ZNSoC*;
638+ _ZNSoD*;
639+ _ZNKSo6sentrycvbEv;
640+ _ZNSo8_M_write*;
641+ _ZNSo[0-9][a-z]*;
642+ _ZNSolsE*[^g];
643+
644+ # std::basic_ostream<wchar_t>
645+ _ZNSt13basic_ostreamIwSt11char_traitsIwEEC*;
646+ _ZNSt13basic_ostreamIwSt11char_traitsIwEED*;
647+ _ZNKSt13basic_ostreamIwSt11char_traitsIwEE[0-9][a-z]*;
648+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE3putEw;
649+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE5flushEv;
650+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE5seekpE*;
651+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE5tellpEv;
652+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE5writeEPKw*;
653+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE6sentry*;
654+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE8_M_write*;
655+ _ZNSt13basic_ostreamIwSt11char_traitsIwEElsE*[^g];
656+
657+ # std::ostream operators and inserters
658+ _ZSt4end[ls]I[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
659+ _ZSt5flushI[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
660+ _ZStlsI[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
661+ _ZStlsI[cw]St11char_traitsI[cw]ESaI[cw]EERSt13basic_ostream*;
662+ _ZStlsISt11char_traitsI[cw]EERSt13basic_ostream*;
663+ _ZStlsId[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
664+ _ZStlsIe[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
665+ _ZStlsIf[cw]St11char_traitsI[cw]EERSt13basic_ostream*;
666+
667 # std::locale destructors
668 _ZNSt6localeD*;
669
670@@ -292,14 +333,23 @@ GLIBCXX_3.4 {
671 _ZNSt8ios_base4InitD*;
672
673 # bool std::has_facet
674- _ZSt9has_facet*;
675+ _ZSt9has_facetIS*;
676
677 # std::num_get
678 _ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
679
680+ # std::num_put
681+ _ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
682+
683 # std::money_get
684 _ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
685
686+ # std::money_put
687+ _ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE*;
688+
689+ # std::numeric_limits
690+ _ZNSt14numeric_limitsI[^g]*;
691+
692 # std::_Rb_tree
693 _ZSt18_Rb_tree_decrementPKSt18_Rb_tree_node_base;
694 _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base;
695@@ -327,7 +377,7 @@ GLIBCXX_3.4 {
696 _ZNSt12__basic_fileIcED*;
697
698 # std::__convert_to_v
699- _ZSt14__convert_to_v*;
700+ _ZSt14__convert_to_vI[^g]*;
701
702 # __gnu_cxx::stdio_sync_filebuf
703 _ZTVN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
704@@ -399,7 +449,8 @@ GLIBCXX_3.4 {
705 _ZTSN9__gnu_cxx13stdio_filebufI[cw]St11char_traitsI[cw]EEE;
706
707 # function-scope static objects requires a guard variable.
708- _ZGVNSt*;
709+ _ZGVNSt[^1]*;
710+ _ZGVNSt1[^7]*;
711
712 # virtual function thunks
713 _ZThn8_NS*;
714@@ -665,9 +716,9 @@ CXXABI_1.3 {
715 _ZTVN10__cxxabiv121__vmi_class_type_infoE;
716
717 # typeinfo structure (and some names)
718- _ZTI[a-z];
719- _ZTIP[a-z];
720- _ZTIPK[a-z];
721+ _ZTI[a-fh-z];
722+ _ZTIP[a-fh-z];
723+ _ZTIPK[a-fh-z];
724 _ZTIN10__cxxabiv117__array_type_infoE;
725 _ZTIN10__cxxabiv117__class_type_infoE;
726 _ZTIN10__cxxabiv116__enum_type_infoE;
727@@ -680,9 +731,9 @@ CXXABI_1.3 {
728 _ZTIN10__cxxabiv121__vmi_class_type_infoE;
729
730 # typeinfo name
731- _ZTS[a-z];
732- _ZTSP[a-z];
733- _ZTSPK[a-z];
734+ _ZTS[a-fh-z];
735+ _ZTSP[a-fh-z];
736+ _ZTSPK[a-fh-z];
737 _ZTSN10__cxxabiv117__array_type_infoE;
738 _ZTSN10__cxxabiv117__class_type_infoE;
739 _ZTSN10__cxxabiv116__enum_type_infoE;
740diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/config/locale/generic/c_locale.cc gcc-41-20060515/libstdc++-v3/config/locale/generic/c_locale.cc
741--- gcc-41-20060515.orig/libstdc++-v3/config/locale/generic/c_locale.cc 2006-05-15 11:15:39.000000000 -0500
742+++ gcc-41-20060515/libstdc++-v3/config/locale/generic/c_locale.cc 2006-05-15 13:47:27.605398768 -0500
743@@ -1,6 +1,6 @@
744 // Wrapper for underlying C-language localization -*- C++ -*-
745
746-// Copyright (C) 2001, 2002, 2003, 2004, 2005
747+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
748 // Free Software Foundation, Inc.
749 //
750 // This file is part of the GNU ISO C++ Library. This library is free
751@@ -168,3 +168,10 @@ namespace std
752 {
753 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
754 } // namespace std
755+
756+// XXX GLIBCXX_ABI Deprecated
757+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
758+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
759+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
760+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
761+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
762diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/config/locale/gnu/c_locale.cc gcc-41-20060515/libstdc++-v3/config/locale/gnu/c_locale.cc
763--- gcc-41-20060515.orig/libstdc++-v3/config/locale/gnu/c_locale.cc 2006-05-15 11:15:39.000000000 -0500
764+++ gcc-41-20060515/libstdc++-v3/config/locale/gnu/c_locale.cc 2006-05-15 13:47:27.606398615 -0500
765@@ -1,6 +1,6 @@
766 // Wrapper for underlying C-language localization -*- C++ -*-
767
768-// Copyright (C) 2001, 2002, 2003, 2004, 2005
769+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
770 // Free Software Foundation, Inc.
771 //
772 // This file is part of the GNU ISO C++ Library. This library is free
773@@ -132,3 +132,10 @@ namespace std
774 {
775 const char* const* const locale::_S_categories = __gnu_cxx::category_names;
776 } // namespace std
777+
778+// XXX GLIBCXX_ABI Deprecated
779+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
780+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
781+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
782+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct);
783+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
784diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver gcc-41-20060515/libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver
785--- gcc-41-20060515.orig/libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver 1969-12-31 18:00:00.000000000 -0600
786+++ gcc-41-20060515/libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver 2006-05-15 13:47:27.606398615 -0500
787@@ -0,0 +1,19 @@
788+# Appended to version file.
789+
790+GLIBCXX_LDBL_3.4 {
791+ _ZNSt14numeric_limitsIg*;
792+ _ZNSirsERg;
793+ _ZNSolsEg;
794+ _ZNSt13basic_istreamIwSt11char_traitsIwEErsERg;
795+ _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEg;
796+ _ZSt14__convert_to_vIgEvPKcRT_RSt12_Ios_IostateRKP*;
797+ _ZStlsIg[cw]St11char_traitsI[cw]EERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E;
798+ _ZStrsIg[cw]St11char_traitsI[cw]EERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E;
799+ *__gnu_cxx_ldbl128*;
800+};
801+
802+CXXABI_LDBL_1.3 {
803+ _ZT[IS]g;
804+ _ZT[IS]Pg;
805+ _ZT[IS]PKg;
806+};
807diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/config.h.in gcc-41-20060515/libstdc++-v3/config.h.in
808--- gcc-41-20060515.orig/libstdc++-v3/config.h.in 2006-05-15 11:15:42.000000000 -0500
809+++ gcc-41-20060515/libstdc++-v3/config.h.in 2006-05-15 13:47:27.601399384 -0500
810@@ -658,6 +658,9 @@
811 /* Define to 1 if a full hosted library is built, or 0 if freestanding. */
812 #undef _GLIBCXX_HOSTED
813
814+/* Define if compatibility should be provided for -mlong-double-64. */
815+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
816+
817 /* Define if ptrdiff_t is int. */
818 #undef _GLIBCXX_PTRDIFF_T_IS_INT
819
820diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/configure gcc-41-20060515/libstdc++-v3/configure
821--- gcc-41-20060515.orig/libstdc++-v3/configure 2006-05-15 11:15:42.000000000 -0500
822+++ gcc-41-20060515/libstdc++-v3/configure 2006-05-15 13:47:27.664389689 -0500
823@@ -309,7 +309,7 @@ ac_includes_default="\
824 # include <unistd.h>
825 #endif"
826
827-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 libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV SYMVER_MAP port_specific_symbol_files ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_DARWIN_EXPORT_TRUE ENABLE_SYMVERS_DARWIN_EXPORT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
828+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 libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV SYMVER_MAP port_specific_symbol_files ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_DARWIN_EXPORT_TRUE ENABLE_SYMVERS_DARWIN_EXPORT_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
829 ac_subst_files=''
830
831 # Initialize some variables set by options.
832@@ -87959,6 +87959,72 @@ echo "${ECHO_T}$glibcxx_ptrdiff_t_is_i"
833 echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
834
835
836+ac_ldbl_compat=no
837+case "$target" in
838+ powerpc*-*-*gnu* | \
839+ sparc*-*-linux* | \
840+ s390*-*-linux* | \
841+ alpha*-*-linux*)
842+ cat >conftest.$ac_ext <<_ACEOF
843+/* confdefs.h. */
844+_ACEOF
845+cat confdefs.h >>conftest.$ac_ext
846+cat >>conftest.$ac_ext <<_ACEOF
847+/* end confdefs.h. */
848+
849+int
850+main ()
851+{
852+
853+#if !defined __LONG_DOUBLE_128__ || (defined(__sparc__) && defined(__arch64__))
854+#error no need for long double compatibility
855+#endif
856+
857+ ;
858+ return 0;
859+}
860+_ACEOF
861+rm -f conftest.$ac_objext
862+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
863+ (eval $ac_compile) 2>conftest.er1
864+ ac_status=$?
865+ grep -v '^ *+' conftest.er1 >conftest.err
866+ rm -f conftest.er1
867+ cat conftest.err >&5
868+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
869+ (exit $ac_status); } &&
870+ { ac_try='test -z "$ac_c_werror_flag"
871+ || test ! -s conftest.err'
872+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
873+ (eval $ac_try) 2>&5
874+ ac_status=$?
875+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
876+ (exit $ac_status); }; } &&
877+ { ac_try='test -s conftest.$ac_objext'
878+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
879+ (eval $ac_try) 2>&5
880+ ac_status=$?
881+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
882+ (exit $ac_status); }; }; then
883+ ac_ldbl_compat=yes
884+else
885+ echo "$as_me: failed program was:" >&5
886+sed 's/^/| /' conftest.$ac_ext >&5
887+
888+ac_ldbl_compat=no
889+fi
890+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
891+ if test "$ac_ldbl_compat" = yes; then
892+
893+cat >>confdefs.h <<\_ACEOF
894+#define _GLIBCXX_LONG_DOUBLE_COMPAT 1
895+_ACEOF
896+
897+ port_specific_symbol_files="\$(top_srcdir)/config/os/gnu-linux/ldbl-extra.ver"
898+ fi
899+esac
900+
901+
902 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
903
904 if $GLIBCXX_IS_NATIVE ; then
905@@ -88811,6 +88877,17 @@ fi
906
907
908
909+if test $ac_ldbl_compat = yes; then
910+ GLIBCXX_LDBL_COMPAT_TRUE=
911+ GLIBCXX_LDBL_COMPAT_FALSE='#'
912+else
913+ GLIBCXX_LDBL_COMPAT_TRUE='#'
914+ GLIBCXX_LDBL_COMPAT_FALSE=
915+fi
916+
917+
918+
919+
920 cat >confcache <<\_ACEOF
921 # This file is a shell script that caches the results of configure
922 # tests run on this system so they can be shared between configure
923@@ -89166,6 +89243,13 @@ echo "$as_me: error: conditional \"ENABL
924 Usually this means the macro was only invoked conditionally." >&2;}
925 { (exit 1); exit 1; }; }
926 fi
927+if test -z "${GLIBCXX_LDBL_COMPAT_TRUE}" && test -z "${GLIBCXX_LDBL_COMPAT_FALSE}"; then
928+ { { echo "$as_me:$LINENO: error: conditional \"GLIBCXX_LDBL_COMPAT\" was never defined.
929+Usually this means the macro was only invoked conditionally." >&5
930+echo "$as_me: error: conditional \"GLIBCXX_LDBL_COMPAT\" was never defined.
931+Usually this means the macro was only invoked conditionally." >&2;}
932+ { (exit 1); exit 1; }; }
933+fi
934
935 : ${CONFIG_STATUS=./config.status}
936 ac_clean_files_save=$ac_clean_files
937@@ -89836,6 +89920,8 @@ s,@ENABLE_SYMVERS_GNU_TRUE@,$ENABLE_SYMV
938 s,@ENABLE_SYMVERS_GNU_FALSE@,$ENABLE_SYMVERS_GNU_FALSE,;t t
939 s,@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@,$ENABLE_SYMVERS_DARWIN_EXPORT_TRUE,;t t
940 s,@ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@,$ENABLE_SYMVERS_DARWIN_EXPORT_FALSE,;t t
941+s,@GLIBCXX_LDBL_COMPAT_TRUE@,$GLIBCXX_LDBL_COMPAT_TRUE,;t t
942+s,@GLIBCXX_LDBL_COMPAT_FALSE@,$GLIBCXX_LDBL_COMPAT_FALSE,;t t
943 s,@baseline_dir@,$baseline_dir,;t t
944 s,@ATOMICITY_SRCDIR@,$ATOMICITY_SRCDIR,;t t
945 s,@ATOMIC_WORD_SRCDIR@,$ATOMIC_WORD_SRCDIR,;t t
946diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/configure.ac gcc-41-20060515/libstdc++-v3/configure.ac
947--- gcc-41-20060515.orig/libstdc++-v3/configure.ac 2006-05-15 11:15:42.000000000 -0500
948+++ gcc-41-20060515/libstdc++-v3/configure.ac 2006-05-15 13:47:27.665389535 -0500
949@@ -281,6 +281,25 @@ fi
950 # This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no.
951 GLIBCXX_ENABLE_SYMVERS([yes])
952
953+ac_ldbl_compat=no
954+case "$target" in
955+ powerpc*-*-*gnu* | \
956+ sparc*-*-linux* | \
957+ s390*-*-linux* | \
958+ alpha*-*-linux*)
959+ AC_TRY_COMPILE(, [
960+#if !defined __LONG_DOUBLE_128__ || (defined(__sparc__) && defined(__arch64__))
961+#error no need for long double compatibility
962+#endif
963+ ], [ac_ldbl_compat=yes], [ac_ldbl_compat=no])
964+ if test "$ac_ldbl_compat" = yes; then
965+ AC_DEFINE([_GLIBCXX_LONG_DOUBLE_COMPAT],1,
966+ [Define if compatibility should be provided for -mlong-double-64.])
967+ port_specific_symbol_files="\$(top_srcdir)/config/os/gnu-linux/ldbl-extra.ver"
968+ fi
969+esac
970+GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes)
971+
972 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
973 GLIBCXX_CONFIGURE_TESTSUITE
974
975diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/include/bits/c++config gcc-41-20060515/libstdc++-v3/include/bits/c++config
976--- gcc-41-20060515.orig/libstdc++-v3/include/bits/c++config 2006-05-15 11:14:38.000000000 -0500
977+++ gcc-41-20060515/libstdc++-v3/include/bits/c++config 2006-05-15 13:47:27.668389073 -0500
978@@ -1,6 +1,6 @@
979 // Predefined symbols and macros -*- C++ -*-
980
981-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
982+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
983 // Free Software Foundation, Inc.
984 //
985 // This file is part of the GNU ISO C++ Library. This library is free
986@@ -65,6 +65,26 @@ namespace std
987 # define _GLIBCXX_STD std
988 #endif
989
990+/* Define if compatibility should be provided for -mlong-double-64. */
991+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
992+
993+// XXX GLIBCXX_ABI Deprecated
994+// Namespace associations for long double 128 mode.
995+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
996+# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
997+# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
998+# define _GLIBCXX_END_LDBL_NAMESPACE }
999+namespace std
1000+{
1001+ namespace __gnu_cxx_ldbl128 { }
1002+ using namespace __gnu_cxx_ldbl128 __attribute__((__strong__));
1003+}
1004+#else
1005+# define _GLIBCXX_LDBL_NAMESPACE
1006+# define _GLIBCXX_BEGIN_LDBL_NAMESPACE
1007+# define _GLIBCXX_END_LDBL_NAMESPACE
1008+#endif
1009+
1010 // Allow use of "export template." This is currently not a feature
1011 // that g++ supports.
1012 // #define _GLIBCXX_EXPORT_TEMPLATE 1
1013diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/include/bits/locale_facets.h gcc-41-20060515/libstdc++-v3/include/bits/locale_facets.h
1014--- gcc-41-20060515.orig/libstdc++-v3/include/bits/locale_facets.h 2006-05-15 11:14:38.000000000 -0500
1015+++ gcc-41-20060515/libstdc++-v3/include/bits/locale_facets.h 2006-05-15 13:47:27.673388304 -0500
1016@@ -1,6 +1,6 @@
1017 // Locale support -*- C++ -*-
1018
1019-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
1020+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
1021 // Free Software Foundation, Inc.
1022 //
1023 // This file is part of the GNU ISO C++ Library. This library is free
1024@@ -1910,6 +1910,7 @@ namespace std
1025 ~numpunct_byname() { }
1026 };
1027
1028+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1029 /**
1030 * @brief Facet for parsing number strings.
1031 *
1032@@ -2176,13 +2177,27 @@ namespace std
1033 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
1034 double&) const;
1035
1036+ // XXX GLIBCXX_ABI Deprecated
1037+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1038+ virtual iter_type
1039+ __do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
1040+ double&) const;
1041+#else
1042 virtual iter_type
1043 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
1044 long double&) const;
1045+#endif
1046
1047 virtual iter_type
1048 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
1049 void*&) const;
1050+
1051+ // XXX GLIBCXX_ABI Deprecated
1052+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1053+ virtual iter_type
1054+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
1055+ long double&) const;
1056+#endif
1057 //@}
1058 };
1059
1060@@ -2438,17 +2453,30 @@ namespace std
1061 virtual iter_type
1062 do_put(iter_type, ios_base&, char_type __fill, double __v) const;
1063
1064+ // XXX GLIBCXX_ABI Deprecated
1065+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1066+ virtual iter_type
1067+ __do_put(iter_type, ios_base&, char_type __fill, double __v) const;
1068+#else
1069 virtual iter_type
1070 do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
1071+#endif
1072
1073 virtual iter_type
1074 do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
1075+
1076+ // XXX GLIBCXX_ABI Deprecated
1077+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1078+ virtual iter_type
1079+ do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
1080+#endif
1081 //@}
1082 };
1083
1084 template <typename _CharT, typename _OutIter>
1085 locale::id num_put<_CharT, _OutIter>::id;
1086
1087+_GLIBCXX_END_LDBL_NAMESPACE
1088
1089 /**
1090 * @brief Facet for localized string comparison.
1091@@ -3953,6 +3981,7 @@ namespace std
1092 template<typename _CharT, bool _Intl>
1093 const bool moneypunct_byname<_CharT, _Intl>::intl;
1094
1095+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1096 /**
1097 * @brief Facet for parsing monetary amounts.
1098 *
1099@@ -4064,9 +4093,16 @@ namespace std
1100 * value. This function is a hook for derived classes to change the
1101 * value returned. @see get() for details.
1102 */
1103+ // XXX GLIBCXX_ABI Deprecated
1104+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1105+ virtual iter_type
1106+ __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
1107+ ios_base::iostate& __err, double& __units) const;
1108+#else
1109 virtual iter_type
1110 do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
1111 ios_base::iostate& __err, long double& __units) const;
1112+#endif
1113
1114 /**
1115 * @brief Read and parse a monetary value.
1116@@ -4079,6 +4115,13 @@ namespace std
1117 do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
1118 ios_base::iostate& __err, string_type& __digits) const;
1119
1120+ // XXX GLIBCXX_ABI Deprecated
1121+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1122+ virtual iter_type
1123+ do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
1124+ ios_base::iostate& __err, long double& __units) const;
1125+#endif
1126+
1127 template<bool _Intl>
1128 iter_type
1129 _M_extract(iter_type __s, iter_type __end, ios_base& __io,
1130@@ -4191,9 +4234,16 @@ namespace std
1131 * @param units Place to store result of parsing.
1132 * @return Iterator after writing.
1133 */
1134+ // XXX GLIBCXX_ABI Deprecated
1135+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1136+ virtual iter_type
1137+ __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
1138+ double __units) const;
1139+#else
1140 virtual iter_type
1141 do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
1142 long double __units) const;
1143+#endif
1144
1145 /**
1146 * @brief Format and output a monetary value.
1147@@ -4217,6 +4267,13 @@ namespace std
1148 do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
1149 const string_type& __digits) const;
1150
1151+ // XXX GLIBCXX_ABI Deprecated
1152+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1153+ virtual iter_type
1154+ do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
1155+ long double __units) const;
1156+#endif
1157+
1158 template<bool _Intl>
1159 iter_type
1160 _M_insert(iter_type __s, ios_base& __io, char_type __fill,
1161@@ -4226,6 +4283,8 @@ namespace std
1162 template<typename _CharT, typename _OutIter>
1163 locale::id money_put<_CharT, _OutIter>::id;
1164
1165+_GLIBCXX_END_LDBL_NAMESPACE
1166+
1167 /**
1168 * @brief Messages facet base class providing catalog typedef.
1169 */
1170diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/include/bits/locale_facets.tcc gcc-41-20060515/libstdc++-v3/include/bits/locale_facets.tcc
1171--- gcc-41-20060515.orig/libstdc++-v3/include/bits/locale_facets.tcc 2006-05-15 11:14:38.000000000 -0500
1172+++ gcc-41-20060515/libstdc++-v3/include/bits/locale_facets.tcc 2006-05-15 13:47:27.676387842 -0500
1173@@ -1,6 +1,6 @@
1174 // Locale support -*- C++ -*-
1175
1176-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
1177+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
1178 // Free Software Foundation, Inc.
1179 //
1180 // This file is part of the GNU ISO C++ Library. This library is free
1181@@ -272,6 +272,8 @@ namespace std
1182 __verify_grouping(const char* __grouping, size_t __grouping_size,
1183 const string& __grouping_tmp);
1184
1185+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1186+
1187 template<typename _CharT, typename _InIter>
1188 _InIter
1189 num_get<_CharT, _InIter>::
1190@@ -446,6 +448,8 @@ namespace std
1191 return __beg;
1192 }
1193
1194+_GLIBCXX_END_LDBL_NAMESPACE
1195+
1196 template<typename _ValueT>
1197 struct __to_unsigned_type
1198 { typedef _ValueT __type; };
1199@@ -460,6 +464,8 @@ namespace std
1200 { typedef unsigned long long __type; };
1201 #endif
1202
1203+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1204+
1205 template<typename _CharT, typename _InIter>
1206 template<typename _ValueT>
1207 _InIter
1208@@ -772,6 +778,21 @@ namespace std
1209 return __beg;
1210 }
1211
1212+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1213+ template<typename _CharT, typename _InIter>
1214+ _InIter
1215+ num_get<_CharT, _InIter>::
1216+ __do_get(iter_type __beg, iter_type __end, ios_base& __io,
1217+ ios_base::iostate& __err, double& __v) const
1218+ {
1219+ string __xtrc;
1220+ __xtrc.reserve(32);
1221+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
1222+ std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
1223+ return __beg;
1224+ }
1225+#endif
1226+
1227 template<typename _CharT, typename _InIter>
1228 _InIter
1229 num_get<_CharT, _InIter>::
1230@@ -822,6 +843,8 @@ namespace std
1231 __len = static_cast<int>(__w);
1232 }
1233
1234+_GLIBCXX_END_LDBL_NAMESPACE
1235+
1236 // Forwarding functions to peel signed from unsigned integer types and
1237 // either cast or compute the absolute value for the former, depending
1238 // on __basefield.
1239@@ -911,6 +934,8 @@ namespace std
1240 return __bufend - __buf;
1241 }
1242
1243+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1244+
1245 template<typename _CharT, typename _OutIter>
1246 void
1247 num_put<_CharT, _OutIter>::
1248@@ -1233,6 +1258,14 @@ namespace std
1249 do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
1250 { return _M_insert_float(__s, __io, __fill, char(), __v); }
1251
1252+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1253+ template<typename _CharT, typename _OutIter>
1254+ _OutIter
1255+ num_put<_CharT, _OutIter>::
1256+ __do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
1257+ { return _M_insert_float(__s, __io, __fill, char(), __v); }
1258+#endif
1259+
1260 template<typename _CharT, typename _OutIter>
1261 _OutIter
1262 num_put<_CharT, _OutIter>::
1263@@ -1474,6 +1507,23 @@ namespace std
1264 return __beg;
1265 }
1266
1267+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1268+ template<typename _CharT, typename _InIter>
1269+ _InIter
1270+ money_get<_CharT, _InIter>::
1271+ __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,
1272+ ios_base::iostate& __err, double& __units) const
1273+ {
1274+ string __str;
1275+ if (__intl)
1276+ __beg = _M_extract<true>(__beg, __end, __io, __err, __str);
1277+ else
1278+ __beg = _M_extract<false>(__beg, __end, __io, __err, __str);
1279+ std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
1280+ return __beg;
1281+ }
1282+#endif
1283+
1284 template<typename _CharT, typename _InIter>
1285 _InIter
1286 money_get<_CharT, _InIter>::
1287@@ -1678,7 +1728,18 @@ namespace std
1288 __io.width(0);
1289 return __s;
1290 }
1291-
1292+
1293+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
1294+ template<typename _CharT, typename _OutIter>
1295+ _OutIter
1296+ money_put<_CharT, _OutIter>::
1297+ __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
1298+ double __units) const
1299+ {
1300+ return this->do_put(__s, __intl, __io, __fill, (long double) __units);
1301+ }
1302+#endif
1303+
1304 template<typename _CharT, typename _OutIter>
1305 _OutIter
1306 money_put<_CharT, _OutIter>::
1307@@ -1726,6 +1787,7 @@ namespace std
1308 { return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
1309 : _M_insert<false>(__s, __io, __fill, __digits); }
1310
1311+_GLIBCXX_END_LDBL_NAMESPACE
1312
1313 // NB: Not especially useful. Without an ios_base object or some
1314 // kind of locale reference, we are left clawing at the air where
1315@@ -2511,12 +2573,12 @@ namespace std
1316 extern template class moneypunct<char, true>;
1317 extern template class moneypunct_byname<char, false>;
1318 extern template class moneypunct_byname<char, true>;
1319- extern template class money_get<char>;
1320- extern template class money_put<char>;
1321+ extern template class _GLIBCXX_LDBL_NAMESPACE money_get<char>;
1322+ extern template class _GLIBCXX_LDBL_NAMESPACE money_put<char>;
1323 extern template class numpunct<char>;
1324 extern template class numpunct_byname<char>;
1325- extern template class num_get<char>;
1326- extern template class num_put<char>;
1327+ extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
1328+ extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
1329 extern template class __timepunct<char>;
1330 extern template class time_put<char>;
1331 extern template class time_put_byname<char>;
1332@@ -2638,12 +2700,12 @@ namespace std
1333 extern template class moneypunct<wchar_t, true>;
1334 extern template class moneypunct_byname<wchar_t, false>;
1335 extern template class moneypunct_byname<wchar_t, true>;
1336- extern template class money_get<wchar_t>;
1337- extern template class money_put<wchar_t>;
1338+ extern template class _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
1339+ extern template class _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
1340 extern template class numpunct<wchar_t>;
1341 extern template class numpunct_byname<wchar_t>;
1342- extern template class num_get<wchar_t>;
1343- extern template class num_put<wchar_t>;
1344+ extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
1345+ extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
1346 extern template class __timepunct<wchar_t>;
1347 extern template class time_put<wchar_t>;
1348 extern template class time_put_byname<wchar_t>;
1349diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/include/bits/localefwd.h gcc-41-20060515/libstdc++-v3/include/bits/localefwd.h
1350--- gcc-41-20060515.orig/libstdc++-v3/include/bits/localefwd.h 2006-05-15 11:14:38.000000000 -0500
1351+++ gcc-41-20060515/libstdc++-v3/include/bits/localefwd.h 2006-05-15 13:47:27.676387842 -0500
1352@@ -129,10 +129,12 @@ namespace std
1353 class codecvt_byname;
1354
1355 // 22.2.2 and 22.2.3 numeric
1356+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1357 template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
1358 class num_get;
1359 template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
1360 class num_put;
1361+_GLIBCXX_END_LDBL_NAMESPACE
1362 template<typename _CharT> class numpunct;
1363 template<typename _CharT> class numpunct_byname;
1364
1365@@ -155,10 +157,12 @@ namespace std
1366
1367 // 22.2.6 money
1368 class money_base;
1369+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1370 template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
1371 class money_get;
1372 template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
1373 class money_put;
1374+_GLIBCXX_END_LDBL_NAMESPACE
1375 template<typename _CharT, bool _Intl = false>
1376 class moneypunct;
1377 template<typename _CharT, bool _Intl = false>
1378diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/include/Makefile.am gcc-41-20060515/libstdc++-v3/include/Makefile.am
1379--- gcc-41-20060515.orig/libstdc++-v3/include/Makefile.am 2006-05-15 11:14:39.000000000 -0500
1380+++ gcc-41-20060515/libstdc++-v3/include/Makefile.am 2006-05-15 13:47:27.666389381 -0500
1381@@ -825,13 +825,18 @@ ${host_builddir}/c++config.h: ${top_buil
1382 ${glibcxx_srcdir}/include/bits/c++config \
1383 stamp-${host_alias} \
1384 ${toplevel_srcdir}/gcc/DATESTAMP
1385- @cat ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
1386+ @ldbl_compat='' ;\
1387+ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
1388+ ${CONFIG_HEADER} > /dev/null 2>&1 \
1389+ && ldbl_compat='s,^#undef _GLIBCXX_LONG_DOUBLE_COMPAT$$,#define _GLIBCXX_LONG_DOUBLE_COMPAT 1,' ;\
1390+ sed -e "$$ldbl_compat" ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
1391 sed -e 's/^/#define __GLIBCXX__ /' \
1392- < ${toplevel_srcdir}/gcc/DATESTAMP >> $@ ;\
1393+ < ${toplevel_srcdir}/gcc/DATESTAMP >> $@ ;\
1394 sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
1395 -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
1396 -e 's/VERSION/_GLIBCXX_VERSION/g' \
1397 -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
1398+ -e '/[ ]_GLIBCXX_LONG_DOUBLE_COMPAT[ ]/d' \
1399 < ${CONFIG_HEADER} >> $@ ;\
1400 echo "#endif // _CXXCONFIG_" >>$@
1401
1402diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/include/Makefile.in gcc-41-20060515/libstdc++-v3/include/Makefile.in
1403--- gcc-41-20060515.orig/libstdc++-v3/include/Makefile.in 2006-05-15 11:14:39.000000000 -0500
1404+++ gcc-41-20060515/libstdc++-v3/include/Makefile.in 2006-05-15 13:47:27.668389073 -0500
1405@@ -1203,13 +1203,18 @@ ${host_builddir}/c++config.h: ${top_buil
1406 ${glibcxx_srcdir}/include/bits/c++config \
1407 stamp-${host_alias} \
1408 ${toplevel_srcdir}/gcc/DATESTAMP
1409- @cat ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
1410+ @ldbl_compat='' ;\
1411+ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
1412+ ${CONFIG_HEADER} > /dev/null 2>&1 \
1413+ && ldbl_compat='s,^#undef _GLIBCXX_LONG_DOUBLE_COMPAT$$,#define _GLIBCXX_LONG_DOUBLE_COMPAT 1,' ;\
1414+ sed -e "$$ldbl_compat" ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
1415 sed -e 's/^/#define __GLIBCXX__ /' \
1416- < ${toplevel_srcdir}/gcc/DATESTAMP >> $@ ;\
1417+ < ${toplevel_srcdir}/gcc/DATESTAMP >> $@ ;\
1418 sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
1419 -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
1420 -e 's/VERSION/_GLIBCXX_VERSION/g' \
1421 -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
1422+ -e '/[ ]_GLIBCXX_LONG_DOUBLE_COMPAT[ ]/d' \
1423 < ${CONFIG_HEADER} >> $@ ;\
1424 echo "#endif // _CXXCONFIG_" >>$@
1425
1426diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/compatibility.cc gcc-41-20060515/libstdc++-v3/src/compatibility.cc
1427--- gcc-41-20060515.orig/libstdc++-v3/src/compatibility.cc 2006-05-15 11:14:42.000000000 -0500
1428+++ gcc-41-20060515/libstdc++-v3/src/compatibility.cc 2006-05-15 13:47:27.681387073 -0500
1429@@ -1,6 +1,6 @@
1430 // Compatibility symbols for previous versions -*- C++ -*-
1431
1432-// Copyright (C) 2005
1433+// Copyright (C) 2005, 2006
1434 // Free Software Foundation, Inc.
1435 //
1436 // This file is part of the GNU ISO C++ Library. This library is free
1437@@ -49,6 +49,7 @@
1438 #include <istream>
1439 #include <fstream>
1440 #include <sstream>
1441+#include <cmath>
1442
1443 namespace std
1444 {
1445@@ -362,6 +363,107 @@ namespace std
1446
1447 #endif
1448
1449+// gcc-4.1.0
1450+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1451+#define _GLIBCXX_MATHL_WRAPPER(name, argdecl, args, ver) \
1452+extern "C" double \
1453+__ ## name ## l_wrapper argdecl \
1454+{ \
1455+ return name args; \
1456+} \
1457+asm (".symver __" #name "l_wrapper, " #name "l@" #ver)
1458+
1459+#define _GLIBCXX_MATHL_WRAPPER1(name, ver) \
1460+ _GLIBCXX_MATHL_WRAPPER (name, (double x), (x), ver)
1461+
1462+#define _GLIBCXX_MATHL_WRAPPER2(name, ver) \
1463+ _GLIBCXX_MATHL_WRAPPER (name, (double x, double y), (x, y), ver)
1464+
1465+#ifdef _GLIBCXX_HAVE_ACOSL
1466+_GLIBCXX_MATHL_WRAPPER1 (acos, GLIBCXX_3.4.3);
1467+#endif
1468+#ifdef _GLIBCXX_HAVE_ASINL
1469+_GLIBCXX_MATHL_WRAPPER1 (asin, GLIBCXX_3.4.3);
1470+#endif
1471+#ifdef _GLIBCXX_HAVE_ATAN2L
1472+_GLIBCXX_MATHL_WRAPPER2 (atan2, GLIBCXX_3.4);
1473+#endif
1474+#ifdef _GLIBCXX_HAVE_ATANL
1475+_GLIBCXX_MATHL_WRAPPER1 (atan, GLIBCXX_3.4.3);
1476+#endif
1477+#ifdef _GLIBCXX_HAVE_CEILL
1478+_GLIBCXX_MATHL_WRAPPER1 (ceil, GLIBCXX_3.4.3);
1479+#endif
1480+#ifdef _GLIBCXX_HAVE_COSHL
1481+_GLIBCXX_MATHL_WRAPPER1 (cosh, GLIBCXX_3.4);
1482+#endif
1483+#ifdef _GLIBCXX_HAVE_COSL
1484+_GLIBCXX_MATHL_WRAPPER1 (cos, GLIBCXX_3.4);
1485+#endif
1486+#ifdef _GLIBCXX_HAVE_EXPL
1487+_GLIBCXX_MATHL_WRAPPER1 (exp, GLIBCXX_3.4);
1488+#endif
1489+#ifdef _GLIBCXX_HAVE_FLOORL
1490+_GLIBCXX_MATHL_WRAPPER1 (floor, GLIBCXX_3.4.3);
1491+#endif
1492+#ifdef _GLIBCXX_HAVE_FMODL
1493+_GLIBCXX_MATHL_WRAPPER2 (fmod, GLIBCXX_3.4.3);
1494+#endif
1495+#ifdef _GLIBCXX_HAVE_FREXPL
1496+_GLIBCXX_MATHL_WRAPPER (frexp, (double x, int *y), (x, y), GLIBCXX_3.4.3);
1497+#endif
1498+#ifdef _GLIBCXX_HAVE_HYPOTL
1499+_GLIBCXX_MATHL_WRAPPER2 (hypot, GLIBCXX_3.4);
1500+#endif
1501+#ifdef _GLIBCXX_HAVE_LDEXPL
1502+_GLIBCXX_MATHL_WRAPPER (ldexp, (double x, int y), (x, y), GLIBCXX_3.4.3);
1503+#endif
1504+#ifdef _GLIBCXX_HAVE_LOG10L
1505+_GLIBCXX_MATHL_WRAPPER1 (log10, GLIBCXX_3.4);
1506+#endif
1507+#ifdef _GLIBCXX_HAVE_LOGL
1508+_GLIBCXX_MATHL_WRAPPER1 (log, GLIBCXX_3.4);
1509+#endif
1510+#ifdef _GLIBCXX_HAVE_MODFL
1511+_GLIBCXX_MATHL_WRAPPER (modf, (double x, double *y), (x, y), GLIBCXX_3.4.3);
1512+#endif
1513+#ifdef _GLIBCXX_HAVE_POWL
1514+_GLIBCXX_MATHL_WRAPPER2 (pow, GLIBCXX_3.4);
1515+#endif
1516+#ifdef _GLIBCXX_HAVE_SINHL
1517+_GLIBCXX_MATHL_WRAPPER1 (sinh, GLIBCXX_3.4);
1518+#endif
1519+#ifdef _GLIBCXX_HAVE_SINL
1520+_GLIBCXX_MATHL_WRAPPER1 (sin, GLIBCXX_3.4);
1521+#endif
1522+#ifdef _GLIBCXX_HAVE_SQRTL
1523+_GLIBCXX_MATHL_WRAPPER1 (sqrt, GLIBCXX_3.4);
1524+#endif
1525+#ifdef _GLIBCXX_HAVE_TANHL
1526+_GLIBCXX_MATHL_WRAPPER1 (tanh, GLIBCXX_3.4);
1527+#endif
1528+#ifdef _GLIBCXX_HAVE_TANL
1529+_GLIBCXX_MATHL_WRAPPER1 (tan, GLIBCXX_3.4);
1530+#endif
1531+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1532+
1533+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1534+extern void *_ZTVN10__cxxabiv123__fundamental_type_infoE[];
1535+extern void *_ZTVN10__cxxabiv119__pointer_type_infoE[];
1536+extern __attribute__((used, weak)) const char _ZTSe[2] = "e";
1537+extern __attribute__((used, weak)) const char _ZTSPe[3] = "Pe";
1538+extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe";
1539+extern __attribute__((used, weak)) const void *_ZTIe[2]
1540+ = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2],
1541+ (void *) _ZTSe };
1542+extern __attribute__((used, weak)) const void *_ZTIPe[4]
1543+ = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2],
1544+ (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe };
1545+extern __attribute__((used, weak)) const void *_ZTIPKe[4]
1546+ = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2],
1547+ (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe };
1548+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1549+
1550 #ifdef __APPLE__
1551 #if (defined(__ppc__) || defined (__ppc64__)) && defined (PIC)
1552 /* __eprintf shouldn't have been made visible from libstdc++, or
1553diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/compatibility-ldbl.cc gcc-41-20060515/libstdc++-v3/src/compatibility-ldbl.cc
1554--- gcc-41-20060515.orig/libstdc++-v3/src/compatibility-ldbl.cc 1969-12-31 18:00:00.000000000 -0600
1555+++ gcc-41-20060515/libstdc++-v3/src/compatibility-ldbl.cc 2006-05-15 13:47:27.680387227 -0500
1556@@ -0,0 +1,73 @@
1557+// Compatibility symbols for -mlong-double-64 compatibility -*- C++ -*-
1558+
1559+// Copyright (C) 2006
1560+// Free Software Foundation, Inc.
1561+//
1562+// This file is part of the GNU ISO C++ Library. This library is free
1563+// software; you can redistribute it and/or modify it under the
1564+// terms of the GNU General Public License as published by the
1565+// Free Software Foundation; either version 2, or (at your option)
1566+// any later version.
1567+
1568+// This library is distributed in the hope that it will be useful,
1569+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1570+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1571+// GNU General Public License for more details.
1572+
1573+// You should have received a copy of the GNU General Public License along
1574+// with this library; see the file COPYING. If not, write to the Free
1575+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1576+// USA.
1577+
1578+// As a special exception, you may use this file as part of a free software
1579+// library without restriction. Specifically, if other files instantiate
1580+// templates or use macros or inline functions from this file, or you compile
1581+// this file and link it with other files to produce an executable, this
1582+// file does not by itself cause the resulting executable to be covered by
1583+// the GNU General Public License. This exception does not however
1584+// invalidate any other reasons why the executable file might be covered by
1585+// the GNU General Public License.
1586+
1587+#include <locale>
1588+
1589+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1590+
1591+#ifdef __LONG_DOUBLE_128__
1592+#error "compatibility-ldbl.cc must be compiled with -mlong-double-64"
1593+#endif
1594+
1595+namespace std
1596+{
1597+#define C char
1598+ template class num_get<C, istreambuf_iterator<C> >;
1599+ template class num_put<C, ostreambuf_iterator<C> >;
1600+ template class money_get<C, istreambuf_iterator<C> >;
1601+ template class money_put<C, ostreambuf_iterator<C> >;
1602+ template const num_put<C>& use_facet<num_put<C> >(const locale&);
1603+ template const num_get<C>& use_facet<num_get<C> >(const locale&);
1604+ template const money_put<C>& use_facet<money_put<C> >(const locale&);
1605+ template const money_get<C>& use_facet<money_get<C> >(const locale&);
1606+ template bool has_facet<num_put<C> >(const locale&);
1607+ template bool has_facet<num_get<C> >(const locale&);
1608+ template bool has_facet<money_put<C> >(const locale&);
1609+ template bool has_facet<money_get<C> >(const locale&);
1610+#undef C
1611+#ifdef _GLIBCXX_USE_WCHAR_T
1612+#define C wchar_t
1613+ template class num_get<C, istreambuf_iterator<C> >;
1614+ template class num_put<C, ostreambuf_iterator<C> >;
1615+ template class money_get<C, istreambuf_iterator<C> >;
1616+ template class money_put<C, ostreambuf_iterator<C> >;
1617+ template const num_put<C>& use_facet<num_put<C> >(const locale&);
1618+ template const num_get<C>& use_facet<num_get<C> >(const locale&);
1619+ template const money_put<C>& use_facet<money_put<C> >(const locale&);
1620+ template const money_get<C>& use_facet<money_get<C> >(const locale&);
1621+ template bool has_facet<num_put<C> >(const locale&);
1622+ template bool has_facet<num_get<C> >(const locale&);
1623+ template bool has_facet<money_put<C> >(const locale&);
1624+ template bool has_facet<money_get<C> >(const locale&);
1625+#undef C
1626+#endif
1627+}
1628+
1629+#endif
1630diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/complex_io.cc gcc-41-20060515/libstdc++-v3/src/complex_io.cc
1631--- gcc-41-20060515.orig/libstdc++-v3/src/complex_io.cc 2006-05-15 11:14:42.000000000 -0500
1632+++ gcc-41-20060515/libstdc++-v3/src/complex_io.cc 2006-05-15 13:47:27.681387073 -0500
1633@@ -1,6 +1,6 @@
1634 // The template and inlines for the -*- C++ -*- complex number classes.
1635
1636-// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
1637+// Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
1638 //
1639 // This file is part of the GNU ISO C++ Library. This library is free
1640 // software; you can redistribute it and/or modify it under the
1641@@ -91,3 +91,20 @@ namespace std
1642 const complex<long double>&);
1643 #endif //_GLIBCXX_USE_WCHAR_T
1644 } // namespace std
1645+
1646+// XXX GLIBCXX_ABI Deprecated
1647+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1648+
1649+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
1650+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
1651+
1652+_GLIBCXX_LDBL_COMPAT (_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E,
1653+ _ZStlsIecSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E);
1654+_GLIBCXX_LDBL_COMPAT (_ZStlsIdwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E,
1655+ _ZStlsIewSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E);
1656+_GLIBCXX_LDBL_COMPAT (_ZStrsIdcSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E,
1657+ _ZStrsIecSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E);
1658+_GLIBCXX_LDBL_COMPAT (_ZStrsIdwSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E,
1659+ _ZStrsIewSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E);
1660+
1661+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1662diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/istream-inst.cc gcc-41-20060515/libstdc++-v3/src/istream-inst.cc
1663--- gcc-41-20060515.orig/libstdc++-v3/src/istream-inst.cc 2006-05-15 11:14:42.000000000 -0500
1664+++ gcc-41-20060515/libstdc++-v3/src/istream-inst.cc 2006-05-15 13:47:27.682386919 -0500
1665@@ -1,6 +1,6 @@
1666 // Explicit instantiation file.
1667
1668-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
1669+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2006
1670 // Free Software Foundation, Inc.
1671 //
1672 // This file is part of the GNU ISO C++ Library. This library is free
1673@@ -68,3 +68,19 @@ namespace std
1674 template wistream& operator>>(wistream&, _Setw);
1675 #endif
1676 } // namespace std
1677+
1678+// XXX GLIBCXX_ABI Deprecated
1679+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1680+
1681+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
1682+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
1683+_GLIBCXX_LDBL_COMPAT (_ZNSirsERd, _ZNSirsERe);
1684+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd,
1685+ _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe);
1686+// These 2 are in GCC 4.2+ only so far
1687+// _GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_,
1688+// _ZNSi10_M_extractIeEERSiRT_);
1689+// _GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_,
1690+// _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_);
1691+
1692+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1693diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/limits.cc gcc-41-20060515/libstdc++-v3/src/limits.cc
1694--- gcc-41-20060515.orig/libstdc++-v3/src/limits.cc 2006-05-15 11:14:42.000000000 -0500
1695+++ gcc-41-20060515/libstdc++-v3/src/limits.cc 2006-05-15 13:47:27.683386765 -0500
1696@@ -1,6 +1,6 @@
1697 // Static data members of -*- C++ -*- numeric_limits classes
1698
1699-// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
1700+// Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc.
1701 //
1702 // This file is part of the GNU ISO C++ Library. This library is free
1703 // software; you can redistribute it and/or modify it under the
1704@@ -447,3 +447,34 @@ namespace std
1705 const bool numeric_limits<long double>::tinyness_before;
1706 const float_round_style numeric_limits<long double>::round_style;
1707 } // namespace std
1708+
1709+// XXX GLIBCXX_ABI Deprecated
1710+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1711+
1712+#define _GLIBCXX_NUM_LIM_COMPAT(type, member, len) \
1713+ extern "C" type _ZNSt14numeric_limitsIeE ## len ## member ## E \
1714+ __attribute__ ((alias ("_ZNSt14numeric_limitsIdE" #len #member "E")))
1715+_GLIBCXX_NUM_LIM_COMPAT (bool, is_specialized, 14);
1716+_GLIBCXX_NUM_LIM_COMPAT (int, digits, 6);
1717+_GLIBCXX_NUM_LIM_COMPAT (int, digits10, 8);
1718+_GLIBCXX_NUM_LIM_COMPAT (bool, is_signed, 9);
1719+_GLIBCXX_NUM_LIM_COMPAT (bool, is_integer, 10);
1720+_GLIBCXX_NUM_LIM_COMPAT (bool, is_exact, 8);
1721+_GLIBCXX_NUM_LIM_COMPAT (int, radix, 5);
1722+_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent, 12);
1723+_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent10, 14);
1724+_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent, 12);
1725+_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent10, 14);
1726+_GLIBCXX_NUM_LIM_COMPAT (bool, has_infinity, 12);
1727+_GLIBCXX_NUM_LIM_COMPAT (bool, has_quiet_NaN, 13);
1728+_GLIBCXX_NUM_LIM_COMPAT (bool, has_signaling_NaN, 17);
1729+_GLIBCXX_NUM_LIM_COMPAT (std::float_denorm_style, has_denorm, 10);
1730+_GLIBCXX_NUM_LIM_COMPAT (bool, has_denorm_loss, 15);
1731+_GLIBCXX_NUM_LIM_COMPAT (bool, is_iec559, 9);
1732+_GLIBCXX_NUM_LIM_COMPAT (bool, is_bounded, 10);
1733+_GLIBCXX_NUM_LIM_COMPAT (bool, is_modulo, 9);
1734+_GLIBCXX_NUM_LIM_COMPAT (bool, traps, 5);
1735+_GLIBCXX_NUM_LIM_COMPAT (bool, tinyness_before, 15);
1736+_GLIBCXX_NUM_LIM_COMPAT (std::float_round_style, round_style, 11);
1737+
1738+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1739diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/locale.cc gcc-41-20060515/libstdc++-v3/src/locale.cc
1740--- gcc-41-20060515.orig/libstdc++-v3/src/locale.cc 2006-05-15 11:14:42.000000000 -0500
1741+++ gcc-41-20060515/libstdc++-v3/src/locale.cc 2006-05-15 14:06:44.932155273 -0500
1742@@ -41,6 +41,21 @@ namespace __gnu_internal
1743 static __glibcxx_mutex_define_initialized(locale_cache_mutex);
1744 }
1745
1746+// XXX GLIBCXX_ABI Deprecated
1747+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1748+# define _GLIBCXX_LOC_ID(mangled) extern std::locale::id mangled
1749+_GLIBCXX_LOC_ID (_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1750+_GLIBCXX_LOC_ID (_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1751+_GLIBCXX_LOC_ID (_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1752+_GLIBCXX_LOC_ID (_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1753+# ifdef _GLIBCXX_USE_WCHAR_T
1754+_GLIBCXX_LOC_ID (_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1755+_GLIBCXX_LOC_ID (_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1756+_GLIBCXX_LOC_ID (_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1757+_GLIBCXX_LOC_ID (_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1758+# endif
1759+#endif
1760+
1761 namespace std
1762 {
1763 // Definitions for static const data members of locale.
1764@@ -397,9 +412,29 @@ namespace std
1765 locale::id::_M_id() const
1766 {
1767 if (!_M_index)
1768- _M_index = 1 + __gnu_cxx::__exchange_and_add(&_S_refcount, 1);
1769+ {
1770+ // XXX GLIBCXX_ABI Deprecated
1771+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
1772+ locale::id *f = 0;
1773+# define _GLIBCXX_SYNC_ID(facet, mangled) \
1774+ if (this == &::mangled) \
1775+ f = &facet::id
1776+ _GLIBCXX_SYNC_ID (num_get<char>, _ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1777+ _GLIBCXX_SYNC_ID (num_put<char>, _ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1778+ _GLIBCXX_SYNC_ID (money_get<char>, _ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1779+ _GLIBCXX_SYNC_ID (money_put<char>, _ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE);
1780+# ifdef _GLIBCXX_USE_WCHAR_T
1781+ _GLIBCXX_SYNC_ID (num_get<wchar_t>, _ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1782+ _GLIBCXX_SYNC_ID (num_put<wchar_t>, _ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1783+ _GLIBCXX_SYNC_ID (money_get<wchar_t>, _ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1784+ _GLIBCXX_SYNC_ID (money_put<wchar_t>, _ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE);
1785+# endif
1786+ if (f)
1787+ _M_index = 1 + f->_M_id();
1788+ else
1789+#endif
1790+ _M_index = 1 + __gnu_cxx::__exchange_and_add(&_S_refcount, 1);
1791+ }
1792 return _M_index - 1;
1793 }
1794 } // namespace std
1795-
1796-
1797diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/locale-inst.cc gcc-41-20060515/libstdc++-v3/src/locale-inst.cc
1798--- gcc-41-20060515.orig/libstdc++-v3/src/locale-inst.cc 2006-05-15 11:14:42.000000000 -0500
1799+++ gcc-41-20060515/libstdc++-v3/src/locale-inst.cc 2006-05-15 13:47:27.684386611 -0500
1800@@ -1,6 +1,6 @@
1801 // Locale support -*- C++ -*-
1802
1803-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
1804+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2006
1805 // Free Software Foundation, Inc.
1806 //
1807 // This file is part of the GNU ISO C++ Library. This library is free
1808@@ -37,6 +37,7 @@
1809 // Instantiation configuration.
1810 #ifndef C
1811 # define C char
1812+# define C_is_char
1813 #endif
1814
1815 namespace std
1816@@ -48,6 +49,7 @@ namespace std
1817 template struct __moneypunct_cache<C, true>;
1818 template class moneypunct_byname<C, false>;
1819 template class moneypunct_byname<C, true>;
1820+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1821 template class money_get<C, istreambuf_iterator<C> >;
1822 template class money_put<C, ostreambuf_iterator<C> >;
1823 template
1824@@ -73,11 +75,13 @@ namespace std
1825 money_put<C, ostreambuf_iterator<C> >::
1826 _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
1827 const string_type&) const;
1828+_GLIBCXX_END_LDBL_NAMESPACE
1829
1830 // numpunct, numpunct_byname, num_get, and num_put
1831 template class numpunct<C>;
1832 template struct __numpunct_cache<C>;
1833 template class numpunct_byname<C>;
1834+_GLIBCXX_BEGIN_LDBL_NAMESPACE
1835 template class num_get<C, istreambuf_iterator<C> >;
1836 template class num_put<C, ostreambuf_iterator<C> >;
1837 template
1838@@ -161,7 +165,8 @@ namespace std
1839 num_put<C, ostreambuf_iterator<C> >::
1840 _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
1841 long double) const;
1842-
1843+_GLIBCXX_END_LDBL_NAMESPACE
1844+
1845 // time_get and time_put
1846 template class __timepunct<C>;
1847 template struct __timepunct_cache<C>;
1848@@ -314,3 +319,44 @@ namespace std
1849 ios_base::fmtflags, bool);
1850 #endif
1851 } // namespace std
1852+
1853+// XXX GLIBCXX_ABI Deprecated
1854+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char
1855+
1856+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
1857+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
1858+
1859+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
1860+ _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
1861+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
1862+ _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
1863+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
1864+ _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
1865+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
1866+ _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
1867+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
1868+ _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
1869+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
1870+ _ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
1871+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_,
1872+ _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_);
1873+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_,
1874+ _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_);
1875+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_,
1876+ _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_);
1877+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_,
1878+ _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_);
1879+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_,
1880+ _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_);
1881+_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_,
1882+ _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_);
1883+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
1884+ _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
1885+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
1886+ _ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
1887+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs,
1888+ _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs);
1889+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs,
1890+ _ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs);
1891+
1892+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1893diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/locale-misc-inst.cc gcc-41-20060515/libstdc++-v3/src/locale-misc-inst.cc
1894--- gcc-41-20060515.orig/libstdc++-v3/src/locale-misc-inst.cc 2006-05-15 11:14:42.000000000 -0500
1895+++ gcc-41-20060515/libstdc++-v3/src/locale-misc-inst.cc 2006-05-15 13:47:27.685386457 -0500
1896@@ -1,6 +1,7 @@
1897 // Locale support -*- C++ -*-
1898
1899-// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1900+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006
1901+// Free Software Foundation, Inc.
1902 //
1903 // This file is part of the GNU ISO C++ Library. This library is free
1904 // software; you can redistribute it and/or modify it under the
1905@@ -45,3 +46,19 @@ namespace std
1906 __convert_from_v(char*, const int, const char*, long double,
1907 const __c_locale&, int);
1908 } // namespace std
1909+
1910+// XXX GLIBCXX_ABI Deprecated
1911+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT
1912+
1913+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
1914+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
1915+
1916+# if _GLIBCXX_C_LOCALE_GNU
1917+_GLIBCXX_LDBL_COMPAT(_ZSt16__convert_from_vIdEiPciPKcT_RKP15__locale_structi,
1918+ _ZSt16__convert_from_vIeEiPciPKcT_RKP15__locale_structi);
1919+# else
1920+_GLIBCXX_LDBL_COMPAT(_ZSt16__convert_from_vIdEiPciPKcT_RKPii,
1921+ _ZSt16__convert_from_vIeEiPciPKcT_RKPii);
1922+# endif
1923+
1924+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
1925diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/Makefile.am gcc-41-20060515/libstdc++-v3/src/Makefile.am
1926--- gcc-41-20060515.orig/libstdc++-v3/src/Makefile.am 2006-05-15 11:14:42.000000000 -0500
1927+++ gcc-41-20060515/libstdc++-v3/src/Makefile.am 2006-05-15 13:47:27.677387688 -0500
1928@@ -35,10 +35,15 @@ libstdc++-symbol.ver: ${glibcxx_srcdir}
1929 $(port_specific_symbol_files)
1930 cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
1931 if test "x$(port_specific_symbol_files)" != x; then \
1932- sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
1933- sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
1934- cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
1935- rm tmp.top tmp.bottom; \
1936+ if grep '^# Appended to version file.' \
1937+ $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
1938+ cat $(port_specific_symbol_files) >> $@; \
1939+ else \
1940+ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
1941+ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
1942+ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
1943+ rm tmp.top tmp.bottom; \
1944+ fi; \
1945 fi
1946
1947 if ENABLE_SYMVERS_GNU
1948@@ -113,6 +118,12 @@ c++locale.cc: ${glibcxx_srcdir}/$(CLOCAL
1949 basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
1950 $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
1951
1952+if GLIBCXX_LDBL_COMPAT
1953+ldbl_compat_sources = compatibility-ldbl.cc
1954+else
1955+ldbl_compat_sources =
1956+endif
1957+
1958 # Sources present in the src directory.
1959 sources = \
1960 bitmap_allocator.cc \
1961@@ -160,7 +171,8 @@ sources = \
1962 wlocale-inst.cc \
1963 wstring-inst.cc \
1964 ${host_sources} \
1965- ${host_sources_extra}
1966+ ${host_sources_extra} \
1967+ ${ldbl_compat_sources}
1968
1969 VPATH = $(top_srcdir)/src:$(top_srcdir)
1970
1971@@ -191,6 +203,15 @@ concept-inst.lo: concept-inst.cc
1972 concept-inst.o: concept-inst.cc
1973 $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
1974
1975+if GLIBCXX_LDBL_COMPAT
1976+# Use special rules for compatibility-ldbl.cc compilation, as we need to
1977+# pass -mlong-double-64.
1978+compatibility-ldbl.lo: compatibility-ldbl.cc
1979+ $(LTCXXCOMPILE) -mlong-double-64 -c $<
1980+compatibility-ldbl.o: compatibility-ldbl.cc
1981+ $(CXXCOMPILE) -mlong-double-64 -c $<
1982+endif
1983+
1984 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
1985 # modified in a per-library or per-sub-library way. Need to manually
1986 # set this option because CONFIG_CXXFLAGS has to be after
1987diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/Makefile.in gcc-41-20060515/libstdc++-v3/src/Makefile.in
1988--- gcc-41-20060515.orig/libstdc++-v3/src/Makefile.in 2006-05-15 11:14:42.000000000 -0500
1989+++ gcc-41-20060515/libstdc++-v3/src/Makefile.in 2006-05-15 13:47:27.679387380 -0500
1990@@ -59,11 +59,27 @@ am__strip_dir = `echo $$p | sed -e 's|^.
1991 am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
1992 toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
1993 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
1994+am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \
1995+ mt_allocator.cc codecvt.cc compatibility.cc complex_io.cc \
1996+ ctype.cc debug.cc debug_list.cc functexcept.cc \
1997+ globals_locale.cc globals_io.cc ios.cc ios_failure.cc \
1998+ ios_init.cc ios_locale.cc limits.cc list.cc locale.cc \
1999+ locale_init.cc locale_facets.cc localename.cc stdexcept.cc \
2000+ strstream.cc tree.cc allocator-inst.cc concept-inst.cc \
2001+ fstream-inst.cc ext-inst.cc ios-inst.cc iostream-inst.cc \
2002+ istream-inst.cc istream.cc locale-inst.cc locale-misc-inst.cc \
2003+ misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \
2004+ streambuf.cc string-inst.cc valarray-inst.cc wlocale-inst.cc \
2005+ wstring-inst.cc atomicity.cc codecvt_members.cc \
2006+ collate_members.cc ctype_members.cc messages_members.cc \
2007+ monetary_members.cc numeric_members.cc time_members.cc \
2008+ basic_file.cc c++locale.cc compatibility-ldbl.cc
2009 am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
2010 ctype_members.lo messages_members.lo monetary_members.lo \
2011 numeric_members.lo time_members.lo
2012 am__objects_2 = basic_file.lo c++locale.lo
2013-am__objects_3 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
2014+@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_3 = compatibility-ldbl.lo
2015+am__objects_4 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
2016 codecvt.lo compatibility.lo complex_io.lo ctype.lo debug.lo \
2017 debug_list.lo functexcept.lo globals_locale.lo globals_io.lo \
2018 ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \
2019@@ -74,8 +90,9 @@ am__objects_3 = bitmap_allocator.lo pool
2020 locale-inst.lo locale-misc-inst.lo misc-inst.lo \
2021 ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.lo \
2022 string-inst.lo valarray-inst.lo wlocale-inst.lo \
2023- wstring-inst.lo $(am__objects_1) $(am__objects_2)
2024-am_libstdc___la_OBJECTS = $(am__objects_3)
2025+ wstring-inst.lo $(am__objects_1) $(am__objects_2) \
2026+ $(am__objects_3)
2027+am_libstdc___la_OBJECTS = $(am__objects_4)
2028 libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
2029 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
2030 depcomp =
2031@@ -84,7 +101,7 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_IN
2032 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
2033 CXXLD = $(CXX)
2034 SOURCES = $(libstdc___la_SOURCES)
2035-DIST_SOURCES = $(libstdc___la_SOURCES)
2036+DIST_SOURCES = $(am__libstdc___la_SOURCES_DIST)
2037 ETAGS = etags
2038 CTAGS = ctags
2039 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
2040@@ -152,6 +169,8 @@ GLIBCXX_C_HEADERS_C_TRUE = @GLIBCXX_C_HE
2041 GLIBCXX_HOSTED_FALSE = @GLIBCXX_HOSTED_FALSE@
2042 GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
2043 GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
2044+GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
2045+GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
2046 INSTALL_DATA = @INSTALL_DATA@
2047 INSTALL_PROGRAM = @INSTALL_PROGRAM@
2048 INSTALL_SCRIPT = @INSTALL_SCRIPT@
2049@@ -302,6 +321,8 @@ host_sources_extra = \
2050 basic_file.cc \
2051 c++locale.cc
2052
2053+@GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources =
2054+@GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc
2055
2056 # Sources present in the src directory.
2057 sources = \
2058@@ -350,7 +371,8 @@ sources = \
2059 wlocale-inst.cc \
2060 wstring-inst.cc \
2061 ${host_sources} \
2062- ${host_sources_extra}
2063+ ${host_sources_extra} \
2064+ ${ldbl_compat_sources}
2065
2066 libstdc___la_SOURCES = $(sources)
2067 libstdc___la_LIBADD = \
2068@@ -677,10 +699,15 @@ libstdc++-symbol.ver: ${glibcxx_srcdir}
2069 $(port_specific_symbol_files)
2070 cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
2071 if test "x$(port_specific_symbol_files)" != x; then \
2072- sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
2073- sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
2074- cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
2075- rm tmp.top tmp.bottom; \
2076+ if grep '^# Appended to version file.' \
2077+ $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
2078+ cat $(port_specific_symbol_files) >> $@; \
2079+ else \
2080+ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
2081+ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
2082+ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
2083+ rm tmp.top tmp.bottom; \
2084+ fi; \
2085 fi
2086 @ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@libstdc++-symbol.explist : libstdc++-symbol.ver \
2087 @ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ ${glibcxx_srcdir}/scripts/make_exports.pl \
2088@@ -733,6 +760,13 @@ concept-inst.lo: concept-inst.cc
2089 concept-inst.o: concept-inst.cc
2090 $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
2091
2092+# Use special rules for compatibility-ldbl.cc compilation, as we need to
2093+# pass -mlong-double-64.
2094+@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc
2095+@GLIBCXX_LDBL_COMPAT_TRUE@ $(LTCXXCOMPILE) -mlong-double-64 -c $<
2096+@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.o: compatibility-ldbl.cc
2097+@GLIBCXX_LDBL_COMPAT_TRUE@ $(CXXCOMPILE) -mlong-double-64 -c $<
2098+
2099 # Added bits to build debug library.
2100 @GLIBCXX_BUILD_DEBUG_TRUE@all-local: build_debug
2101 @GLIBCXX_BUILD_DEBUG_TRUE@install-data-local: install_debug
2102diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/ostream-inst.cc gcc-41-20060515/libstdc++-v3/src/ostream-inst.cc
2103--- gcc-41-20060515.orig/libstdc++-v3/src/ostream-inst.cc 2006-05-15 11:14:42.000000000 -0500
2104+++ gcc-41-20060515/libstdc++-v3/src/ostream-inst.cc 2006-05-15 13:47:27.685386457 -0500
2105@@ -1,6 +1,6 @@
2106 // Explicit instantiation file.
2107
2108-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
2109+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2006
2110 // Free Software Foundation, Inc.
2111 //
2112 // This file is part of the GNU ISO C++ Library. This library is free
2113@@ -74,3 +74,19 @@ namespace std
2114 template wostream& operator<<(wostream&, _Setw);
2115 #endif
2116 } // namespace std
2117+
2118+// XXX GLIBCXX_ABI Deprecated
2119+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
2120+
2121+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
2122+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
2123+_GLIBCXX_LDBL_COMPAT (_ZNSolsEd, _ZNSolsEe);
2124+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd,
2125+ _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe);
2126+// These 2 are in GCC 4.2+ only so far
2127+// _GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_,
2128+// _ZNSo9_M_insertIeEERSoT_);
2129+// _GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_,
2130+// _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_);
2131+
2132+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
2133diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/src/wlocale-inst.cc gcc-41-20060515/libstdc++-v3/src/wlocale-inst.cc
2134--- gcc-41-20060515.orig/libstdc++-v3/src/wlocale-inst.cc 2006-05-15 11:14:42.000000000 -0500
2135+++ gcc-41-20060515/libstdc++-v3/src/wlocale-inst.cc 2006-05-15 13:47:27.686386303 -0500
2136@@ -1,6 +1,7 @@
2137 // Locale support -*- C++ -*-
2138
2139-// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2140+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006
2141+// Free Software Foundation, Inc.
2142 //
2143 // This file is part of the GNU ISO C++ Library. This library is free
2144 // software; you can redistribute it and/or modify it under the
2145@@ -36,4 +37,45 @@
2146 #ifdef _GLIBCXX_USE_WCHAR_T
2147 #define C wchar_t
2148 #include "locale-inst.cc"
2149+
2150+// XXX GLIBCXX_ABI Deprecated
2151+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT
2152+
2153+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
2154+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
2155+
2156+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
2157+ _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
2158+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
2159+ _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
2160+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
2161+ _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
2162+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
2163+ _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
2164+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
2165+ _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
2166+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
2167+ _ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
2168+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES4_S4_RSt8ios_basewT_,
2169+ _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_);
2170+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES4_S4_RSt8ios_basewT_,
2171+ _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES3_S3_RSt8ios_basewT_);
2172+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES4_S4_RSt8ios_basewT_,
2173+ _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES3_S3_RSt8ios_basewT_);
2174+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES4_S4_RSt8ios_basewT_,
2175+ _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES3_S3_RSt8ios_basewT_);
2176+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES4_S4_RSt8ios_basewcT_,
2177+ _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_);
2178+_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_,
2179+ _ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIeEES3_S3_RSt8ios_basewcT_);
2180+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
2181+ _ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
2182+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
2183+ _ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
2184+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE,
2185+ _ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE);
2186+_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE,
2187+ _ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE);
2188+
2189+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
2190 #endif
2191diff -urpN -X /home/bergner/cvs/dontdiff gcc-41-20060515.orig/libstdc++-v3/testsuite/testsuite_abi.cc gcc-41-20060515/libstdc++-v3/testsuite/testsuite_abi.cc
2192--- gcc-41-20060515.orig/libstdc++-v3/testsuite/testsuite_abi.cc 2006-05-15 11:15:38.000000000 -0500
2193+++ gcc-41-20060515/libstdc++-v3/testsuite/testsuite_abi.cc 2006-05-15 14:14:57.231341148 -0500
2194@@ -187,8 +187,11 @@ check_version(symbol& test, bool added)
2195 known_versions.push_back("GLIBCXX_3.4.6");
2196 known_versions.push_back("GLIBCXX_3.4.7");
2197 known_versions.push_back("GLIBCXX_3.4.8");
2198+ known_versions.push_back("GLIBCXX_LDBL_3.4");
2199+ known_versions.push_back("GLIBCXX_LDBL_3.4.7");
2200 known_versions.push_back("CXXABI_1.3");
2201 known_versions.push_back("CXXABI_1.3.1");
2202+ known_versions.push_back("CXXABI_LDBL_1.3");
2203 }
2204 compat_list::iterator begin = known_versions.begin();
2205 compat_list::iterator end = known_versions.end();
2206@@ -224,9 +227,7 @@ check_version(symbol& test, bool added)
2207 // New version labels are ok. The rest are not.
2208 compat_list::iterator it2 = find(begin, end, test.name);
2209 if (it2 != end)
2210- {
2211- test.version_status = symbol::compatible;
2212- }
2213+ test.version_status = symbol::compatible;
2214 else
2215 test.version_status = symbol::incompatible;
2216 }
2217@@ -370,7 +371,7 @@ compare_symbols(const char* baseline_fil
2218 added_names.erase(it);
2219 }
2220 else
2221- missing_names.push_back(what);
2222+ missing_names.push_back(what);
2223 }
2224
2225 // Check missing names for compatibility.
diff --git a/meta/packages/gcc/gcc-4.1.1/ppc-sfp-long-double-gcc411-7.patch b/meta/packages/gcc/gcc-4.1.1/ppc-sfp-long-double-gcc411-7.patch
deleted file mode 100644
index e3a87c87d0..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/ppc-sfp-long-double-gcc411-7.patch
+++ /dev/null
@@ -1,4271 +0,0 @@
1 * config/rs6000/darwin-ldouble.c: Build file for SOFT_FLOAT.
2 (strong_alias): Define.
3 (__gcc_qmul): Provide non-FMA for soft-float.
4 (__gcc_qdiv): Same.
5 (__gcc_qneg): New.
6 (__gcc_qeq): New.
7 (__gcc_qle): New.
8 (__gcc_qge): New.
9 (__gcc_qunord): New.
10 (__gcc_stoq): New.
11 (__gcc_dtoq): New.
12 (__gcc_qtos): New.
13 (__gcc_qtod): New.
14 (__gcc_qtoi): New.
15 (__gcc_qtou): New.
16 (__gcc_itoq): New.
17 (__gcc_utoq): New.
18 (fmsub): New.
19 * config/rs6000/rs6000.c (rs6000_emit_move): Handle TFmode
20 constant for soft-float.
21 (rs6000_init_libfuncs): Initialize soft-float functions.
22 * config/rs6000/libgcc-ppc-glibc.ver: Version soft-float symbols.
23 * config/rs6000/rs6000.md (movtf): Allow soft-float.
24 (movtf_softfloat): New.
25 * config/rs6000/t-ppccomm (TARGET_LIBGCC2_CFLAGS): Add
26 -mlong-double-128.
27 (ldblspecs): Remove.
28 * config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Do not warn
29 about long double soft float.
30
31diff -urN gcc-4.1.1/gcc/config/rs6000/darwin-ldouble.c gcc-4.1.1-patched/gcc/config/rs6000/darwin-ldouble.c
32--- gcc-4.1.1/gcc/config/rs6000/darwin-ldouble.c 2006-03-23 16:23:58.000000000 -0600
33+++ gcc-4.1.1-patched/gcc/config/rs6000/darwin-ldouble.c 2006-09-12 14:30:16.000000000 -0500
34@@ -49,7 +49,8 @@
35
36 This code currently assumes big-endian. */
37
38-#if (!defined (__NO_FPRS__) && !defined (__LITTLE_ENDIAN__) \
39+#if ((!defined (__NO_FPRS__) || defined (_SOFT_FLOAT)) \
40+ && !defined (__LITTLE_ENDIAN__) \
41 && (defined (__MACH__) || defined (__powerpc__) || defined (_AIX)))
42
43 #define fabs(x) __builtin_fabs(x)
44@@ -60,14 +61,19 @@
45
46 #define nonfinite(a) unlikely (! isless (fabs (a), inf ()))
47
48+/* Define ALIASNAME as a strong alias for NAME. */
49+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
50+# define _strong_alias(name, aliasname) \
51+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
52+
53 /* All these routines actually take two long doubles as parameters,
54 but GCC currently generates poor code when a union is used to turn
55 a long double into a pair of doubles. */
56
57-extern long double __gcc_qadd (double, double, double, double);
58-extern long double __gcc_qsub (double, double, double, double);
59-extern long double __gcc_qmul (double, double, double, double);
60-extern long double __gcc_qdiv (double, double, double, double);
61+long double __gcc_qadd (double, double, double, double);
62+long double __gcc_qsub (double, double, double, double);
63+long double __gcc_qmul (double, double, double, double);
64+long double __gcc_qdiv (double, double, double, double);
65
66 #if defined __ELF__ && defined SHARED \
67 && (defined __powerpc64__ || !(defined __linux__ || defined __gnu_hurd__))
68@@ -139,6 +145,10 @@
69 return __gcc_qadd (a, b, -c, -d);
70 }
71
72+#ifdef _SOFT_FLOAT
73+static double fmsub (double, double, double);
74+#endif
75+
76 long double
77 __gcc_qmul (double a, double b, double c, double d)
78 {
79@@ -154,7 +164,11 @@
80 /* Sum terms of two highest orders. */
81
82 /* Use fused multiply-add to get low part of a * c. */
83+#ifndef _SOFT_FLOAT
84 asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t));
85+#else
86+ tau = fmsub (a, c, t);
87+#endif
88 v = a*d;
89 w = b*c;
90 tau += v + w; /* Add in other second-order terms. */
91@@ -187,7 +201,11 @@
92 numerically necessary. */
93
94 /* Use fused multiply-add to get low part of c * t. */
95+#ifndef _SOFT_FLOAT
96 asm ("fmsub %0,%1,%2,%3" : "=f"(sigma) : "f"(c), "f"(t), "f"(s));
97+#else
98+ sigma = fmsub (c, t, s);
99+#endif
100 v = a - s;
101
102 tau = ((v-sigma)+w)/c; /* Correction to t. */
103@@ -201,4 +219,3959 @@
104 return z.ldval;
105 }
106
107+#ifdef _SOFT_FLOAT
108+
109+long double __gcc_qneg (double, double);
110+int __gcc_qeq (double, double, double, double);
111+int __gcc_qne (double, double, double, double);
112+int __gcc_qge (double, double, double, double);
113+int __gcc_qle (double, double, double, double);
114+int __gcc_qunord (double, double, double, double);
115+long double __gcc_stoq (float);
116+long double __gcc_dtoq (double);
117+float __gcc_qtos (double, double);
118+double __gcc_qtod (double, double);
119+int __gcc_qtoi (double, double);
120+unsigned int __gcc_qtou (double, double);
121+long double __gcc_itoq (int);
122+long double __gcc_utoq (unsigned int);
123+
124+extern int __eqdf2 (double, double);
125+extern int __ledf2 (double, double);
126+extern int __gedf2 (double, double);
127+extern int __unorddf2 (double, double);
128+
129+/* Negate 'long double' value and return the result. */
130+long double
131+__gcc_qneg (double a, double aa)
132+{
133+ longDblUnion x;
134+
135+ x.dval[0] = -a;
136+ x.dval[1] = -aa;
137+ return x.ldval;
138+}
139+
140+/* Compare two 'long double' values for equality. */
141+int
142+__gcc_qeq (double a, double aa, double c, double cc)
143+{
144+ if (__eqdf2 (a, c) == 0)
145+ return __eqdf2 (aa, cc);
146+ return 1;
147+}
148+
149+strong_alias (__gcc_qeq, __gcc_qne);
150+
151+/* Compare two 'long double' values for less than or equal. */
152+int
153+__gcc_qle (double a, double aa, double c, double cc)
154+{
155+ if (__eqdf2 (a, c) == 0)
156+ return __ledf2 (aa, cc);
157+ return __ledf2 (a, c);
158+}
159+
160+strong_alias (__gcc_qle, __gcc_qlt);
161+
162+/* Compare two 'long double' values for greater than or equal. */
163+int
164+__gcc_qge (double a, double aa, double c, double cc)
165+{
166+ if (__eqdf2 (a, c) == 0)
167+ return __gedf2 (aa, cc);
168+ return __gedf2 (a, c);
169+}
170+
171+strong_alias (__gcc_qge, __gcc_qgt);
172+
173+/* Compare two 'long double' values for unordered. */
174+int
175+__gcc_qunord (double a, double aa, double c, double cc)
176+{
177+ if (__eqdf2 (a, c) == 0)
178+ return __unorddf2 (aa, cc);
179+ return __unorddf2 (a, c);
180+}
181+
182+/* Convert single to long double. */
183+long double
184+__gcc_stoq (float a)
185+{
186+ longDblUnion x;
187+
188+ x.dval[0] = (double) a;
189+ x.dval[1] = 0.0;
190+
191+ return x.ldval;
192+}
193+
194+/* Convert double to long double. */
195+long double
196+__gcc_dtoq (double a)
197+{
198+ longDblUnion x;
199+
200+ x.dval[0] = a;
201+ x.dval[1] = 0.0;
202+
203+ return x.ldval;
204+}
205+
206+/* Convert long double to single. */
207+float
208+__gcc_qtos (double a, double aa __attribute__ ((__unused__)))
209+{
210+ return (float) a;
211+}
212+
213+/* Convert long double to double. */
214+double
215+__gcc_qtod (double a, double aa __attribute__ ((__unused__)))
216+{
217+ return a;
218+}
219+
220+/* Convert long double to int. */
221+int
222+__gcc_qtoi (double a, double aa)
223+{
224+ double z = a + aa;
225+ return (int) z;
226+}
227+
228+/* Convert long double to unsigned int. */
229+unsigned int
230+__gcc_qtou (double a, double aa)
231+{
232+ double z = a + aa;
233+ return (unsigned int) z;
234+}
235+
236+/* Convert int to long double. */
237+long double
238+__gcc_itoq (int a)
239+{
240+ return __gcc_dtoq ((double) a);
241+}
242+
243+/* Convert unsigned int to long double. */
244+long double
245+__gcc_utoq (unsigned int a)
246+{
247+ return __gcc_dtoq ((double) a);
248+}
249+
250+typedef int QItype __attribute__ ((mode (QI)));
251+typedef int SItype __attribute__ ((mode (SI)));
252+typedef int DItype __attribute__ ((mode (DI)));
253+typedef unsigned int UQItype __attribute__ ((mode (QI)));
254+typedef unsigned int USItype __attribute__ ((mode (SI)));
255+typedef unsigned int UDItype __attribute__ ((mode (DI)));
256+
257+typedef unsigned int UHWtype __attribute__ ((mode (HI)));
258+extern const UQItype __clz_tab[256];
259+extern void abort (void);
260+typedef float DFtype __attribute__ ((mode (DF)));
261+
262+union _FP_UNION_D
263+{
264+ DFtype flt;
265+ struct
266+ {
267+
268+ unsigned sign:1;
269+ unsigned exp:11;
270+ unsigned frac1:53 - (((unsigned long) 1 << (53 - 1) % 32) != 0) - 32;
271+ unsigned frac0:32;
272+ } bits __attribute__ ((packed));
273+};
274+typedef float TFtype __attribute__ ((mode (TF)));
275+
276+union _FP_UNION_Q
277+{
278+ TFtype flt;
279+ struct
280+ {
281+
282+ unsigned sign:1;
283+ unsigned exp:15;
284+ unsigned long frac3:113 - (((unsigned long) 1 << (113 - 1) % 32) !=
285+ 0) - (32 * 3);
286+ unsigned long frac2:32;
287+ unsigned long frac1:32;
288+ unsigned long frac0:32;
289+ } bits __attribute__ ((packed));
290+};
291+
292+static double
293+fmsub (double a, double b, double c)
294+{
295+ int _fex = 0;
296+ long A_c __attribute__ ((unused)), A_s, A_e;
297+ unsigned long A_f0, A_f1;
298+ long B_c __attribute__ ((unused)), B_s, B_e;
299+ unsigned long B_f0, B_f1;
300+ long C_c __attribute__ ((unused)), C_s, C_e;
301+ unsigned long C_f0, C_f1;
302+ long X_c __attribute__ ((unused)), X_s, X_e;
303+ unsigned long X_f[4];
304+ long Y_c __attribute__ ((unused)), Y_s, Y_e;
305+ unsigned long Y_f[4];
306+ long Z_c __attribute__ ((unused)), Z_s, Z_e;
307+ unsigned long Z_f[4];
308+ long U_c __attribute__ ((unused)), U_s, U_e;
309+ unsigned long U_f[4];
310+ long V_c __attribute__ ((unused)), V_s, V_e;
311+ unsigned long V_f[4];
312+ long R_c __attribute__ ((unused)), R_s, R_e;
313+ unsigned long R_f0, R_f1;
314+ double r;
315+ long double u, v, x, y, z;
316+
317+/* FP_INIT_ROUNDMODE */
318+ do
319+ {
320+ }
321+ while (0);
322+
323+/* FP_UNPACK_RAW_D (A, a) */
324+ do
325+ {
326+ union _FP_UNION_D _flo;
327+ _flo.flt = (a);
328+ A_f0 = _flo.bits.frac0;
329+ A_f1 = _flo.bits.frac1;
330+ A_e = _flo.bits.exp;
331+ A_s = _flo.bits.sign;
332+ }
333+ while (0);
334+
335+/* FP_UNPACK_RAW_D (B, b) */
336+ do
337+ {
338+ union _FP_UNION_D _flo;
339+ _flo.flt = (b);
340+ B_f0 = _flo.bits.frac0;
341+ B_f1 = _flo.bits.frac1;
342+ B_e = _flo.bits.exp;
343+ B_s = _flo.bits.sign;
344+ }
345+ while (0);
346+
347+/* FP_UNPACK_RAW_D (C, c) */
348+ do
349+ {
350+ union _FP_UNION_D _flo;
351+ _flo.flt = (c);
352+ C_f0 = _flo.bits.frac0;
353+ C_f1 = _flo.bits.frac1;
354+ C_e = _flo.bits.exp;
355+ C_s = _flo.bits.sign;
356+ }
357+ while (0);
358+
359+ /* Extend double to quad. */
360+/* FP_EXTEND(Q,D,4,2,X,A) */
361+ do
362+ {
363+ if (113 < 53 || (32767 - 16383 < 2047 - 1023) || 16383 < 1023 + 53 - 1)
364+ abort ();
365+ X_s = A_s;
366+ do
367+ {
368+ X_f[0] = A_f0;
369+ X_f[1] = A_f1;
370+ X_f[2] = X_f[3] = 0;
371+ }
372+ while (0);
373+ if ((((A_e + 1) & 2047) > 1))
374+ {
375+ X_e = A_e + 16383 - 1023;
376+ do
377+ {
378+ long _up, _down, _skip, _i;
379+ _skip = ((113 - 53)) / 32;
380+ _up = ((113 - 53)) % 32;
381+ _down = 32 - _up;
382+ if (!_up)
383+ for (_i = 3; _i >= _skip; --_i)
384+ X_f[_i] = X_f[_i - _skip];
385+ else
386+ {
387+ for (_i = 3; _i > _skip; --_i)
388+ X_f[_i] =
389+ X_f[_i - _skip] << _up | X_f[_i - _skip - 1] >> _down;
390+ X_f[_i--] = X_f[0] << _up;
391+ }
392+ for (; _i >= 0; --_i)
393+ X_f[_i] = 0;
394+ }
395+ while (0);
396+ }
397+ else
398+ {
399+ if (A_e == 0)
400+ {
401+ if (((A_f1 | A_f0) == 0))
402+ X_e = 0;
403+ else
404+ {
405+ int _lz;
406+ _fex |= (0);
407+ do
408+ {
409+ if (A_f1)
410+ do
411+ {
412+ if (sizeof (unsigned long) ==
413+ sizeof (unsigned int))
414+ _lz = __builtin_clz (A_f1);
415+ else if (sizeof (unsigned long) ==
416+ sizeof (unsigned long))
417+ _lz = __builtin_clzl (A_f1);
418+ else if (sizeof (unsigned long) ==
419+ sizeof (unsigned long long))
420+ _lz = __builtin_clzll (A_f1);
421+ else
422+ abort ();
423+ }
424+ while (0);
425+ else
426+ {
427+ do
428+ {
429+ if (sizeof (unsigned long) ==
430+ sizeof (unsigned int))
431+ _lz = __builtin_clz (A_f0);
432+ else if (sizeof (unsigned long) ==
433+ sizeof (unsigned long))
434+ _lz = __builtin_clzl (A_f0);
435+ else if (sizeof (unsigned long) ==
436+ sizeof (unsigned long long))
437+ _lz = __builtin_clzll (A_f0);
438+ else
439+ abort ();
440+ }
441+ while (0);
442+ _lz += 32;
443+ }
444+ }
445+ while (0);
446+ do
447+ {
448+ long _up, _down, _skip, _i;
449+ _skip = (_lz + 113 - (2 * 32)) / 32;
450+ _up = (_lz + 113 - (2 * 32)) % 32;
451+ _down = 32 - _up;
452+ if (!_up)
453+ for (_i = 3; _i >= _skip; --_i)
454+ X_f[_i] = X_f[_i - _skip];
455+ else
456+ {
457+ for (_i = 3; _i > _skip; --_i)
458+ X_f[_i] =
459+ X_f[_i - _skip] << _up | X_f[_i - _skip -
460+ 1] >> _down;
461+ X_f[_i--] = X_f[0] << _up;
462+ }
463+ for (; _i >= 0; --_i)
464+ X_f[_i] = 0;
465+ }
466+ while (0);
467+ X_e = (16383 - 1023 + 1 + ((2 * 32) - 53) - _lz);
468+ }
469+ }
470+ else
471+ {
472+ X_e = 32767;
473+ if (!((A_f1 | A_f0) == 0))
474+ {
475+ if (!((A_f1) & ((unsigned long) 1 << (53 - 2) % 32)))
476+ _fex |= (0);
477+ do
478+ {
479+ long _up, _down, _skip, _i;
480+ _skip = ((113 - 53)) / 32;
481+ _up = ((113 - 53)) % 32;
482+ _down = 32 - _up;
483+ if (!_up)
484+ for (_i = 3; _i >= _skip; --_i)
485+ X_f[_i] = X_f[_i - _skip];
486+ else
487+ {
488+ for (_i = 3; _i > _skip; --_i)
489+ X_f[_i] =
490+ X_f[_i - _skip] << _up | X_f[_i - _skip -
491+ 1] >> _down;
492+ X_f[_i--] = X_f[0] << _up;
493+ }
494+ for (; _i >= 0; --_i)
495+ X_f[_i] = 0;
496+ }
497+ while (0);
498+ }
499+ }
500+ }
501+ }
502+ while (0);
503+
504+/* FP_EXTEND(Q,D,4,2,Y,B) */
505+ do
506+ {
507+ if (113 < 53 || (32767 - 16383 < 2047 - 1023) || 16383 < 1023 + 53 - 1)
508+ abort ();
509+ Y_s = B_s;
510+ do
511+ {
512+ Y_f[0] = B_f0;
513+ Y_f[1] = B_f1;
514+ Y_f[2] = Y_f[3] = 0;
515+ }
516+ while (0);
517+ if ((((B_e + 1) & 2047) > 1))
518+ {
519+ Y_e = B_e + 16383 - 1023;
520+ do
521+ {
522+ long _up, _down, _skip, _i;
523+ _skip = ((113 - 53)) / 32;
524+ _up = ((113 - 53)) % 32;
525+ _down = 32 - _up;
526+ if (!_up)
527+ for (_i = 3; _i >= _skip; --_i)
528+ Y_f[_i] = Y_f[_i - _skip];
529+ else
530+ {
531+ for (_i = 3; _i > _skip; --_i)
532+ Y_f[_i] =
533+ Y_f[_i - _skip] << _up | Y_f[_i - _skip - 1] >> _down;
534+ Y_f[_i--] = Y_f[0] << _up;
535+ }
536+ for (; _i >= 0; --_i)
537+ Y_f[_i] = 0;
538+ }
539+ while (0);
540+ }
541+ else
542+ {
543+ if (B_e == 0)
544+ {
545+ if (((B_f1 | B_f0) == 0))
546+ Y_e = 0;
547+ else
548+ {
549+ int _lz;
550+ _fex |= (0);
551+ do
552+ {
553+ if (B_f1)
554+ do
555+ {
556+ if (sizeof (unsigned long) ==
557+ sizeof (unsigned int))
558+ _lz = __builtin_clz (B_f1);
559+ else if (sizeof (unsigned long) ==
560+ sizeof (unsigned long))
561+ _lz = __builtin_clzl (B_f1);
562+ else if (sizeof (unsigned long) ==
563+ sizeof (unsigned long long))
564+ _lz = __builtin_clzll (B_f1);
565+ else
566+ abort ();
567+ }
568+ while (0);
569+ else
570+ {
571+ do
572+ {
573+ if (sizeof (unsigned long) ==
574+ sizeof (unsigned int))
575+ _lz = __builtin_clz (B_f0);
576+ else if (sizeof (unsigned long) ==
577+ sizeof (unsigned long))
578+ _lz = __builtin_clzl (B_f0);
579+ else if (sizeof (unsigned long) ==
580+ sizeof (unsigned long long))
581+ _lz = __builtin_clzll (B_f0);
582+ else
583+ abort ();
584+ }
585+ while (0);
586+ _lz += 32;
587+ }
588+ }
589+ while (0);
590+ do
591+ {
592+ long _up, _down, _skip, _i;
593+ _skip = (_lz + 113 - (2 * 32)) / 32;
594+ _up = (_lz + 113 - (2 * 32)) % 32;
595+ _down = 32 - _up;
596+ if (!_up)
597+ for (_i = 3; _i >= _skip; --_i)
598+ Y_f[_i] = Y_f[_i - _skip];
599+ else
600+ {
601+ for (_i = 3; _i > _skip; --_i)
602+ Y_f[_i] =
603+ Y_f[_i - _skip] << _up | Y_f[_i - _skip -
604+ 1] >> _down;
605+ Y_f[_i--] = Y_f[0] << _up;
606+ }
607+ for (; _i >= 0; --_i)
608+ Y_f[_i] = 0;
609+ }
610+ while (0);
611+ Y_e = (16383 - 1023 + 1 + ((2 * 32) - 53) - _lz);
612+ }
613+ }
614+ else
615+ {
616+ Y_e = 32767;
617+ if (!((B_f1 | B_f0) == 0))
618+ {
619+ if (!((B_f1) & ((unsigned long) 1 << (53 - 2) % 32)))
620+ _fex |= (0);
621+ do
622+ {
623+ long _up, _down, _skip, _i;
624+ _skip = ((113 - 53)) / 32;
625+ _up = ((113 - 53)) % 32;
626+ _down = 32 - _up;
627+ if (!_up)
628+ for (_i = 3; _i >= _skip; --_i)
629+ Y_f[_i] = Y_f[_i - _skip];
630+ else
631+ {
632+ for (_i = 3; _i > _skip; --_i)
633+ Y_f[_i] =
634+ Y_f[_i - _skip] << _up | Y_f[_i - _skip -
635+ 1] >> _down;
636+ Y_f[_i--] = Y_f[0] << _up;
637+ }
638+ for (; _i >= 0; --_i)
639+ Y_f[_i] = 0;
640+ }
641+ while (0);
642+ }
643+ }
644+ }
645+ }
646+ while (0);
647+
648+/* FP_EXTEND(Q,D,4,2,Z,C) */
649+ do
650+ {
651+ if (113 < 53 || (32767 - 16383 < 2047 - 1023) || 16383 < 1023 + 53 - 1)
652+ abort ();
653+ Z_s = C_s;
654+ do
655+ {
656+ Z_f[0] = C_f0;
657+ Z_f[1] = C_f1;
658+ Z_f[2] = Z_f[3] = 0;
659+ }
660+ while (0);
661+ if ((((C_e + 1) & 2047) > 1))
662+ {
663+ Z_e = C_e + 16383 - 1023;
664+ do
665+ {
666+ long _up, _down, _skip, _i;
667+ _skip = ((113 - 53)) / 32;
668+ _up = ((113 - 53)) % 32;
669+ _down = 32 - _up;
670+ if (!_up)
671+ for (_i = 3; _i >= _skip; --_i)
672+ Z_f[_i] = Z_f[_i - _skip];
673+ else
674+ {
675+ for (_i = 3; _i > _skip; --_i)
676+ Z_f[_i] =
677+ Z_f[_i - _skip] << _up | Z_f[_i - _skip - 1] >> _down;
678+ Z_f[_i--] = Z_f[0] << _up;
679+ }
680+ for (; _i >= 0; --_i)
681+ Z_f[_i] = 0;
682+ }
683+ while (0);
684+ }
685+ else
686+ {
687+ if (C_e == 0)
688+ {
689+ if (((C_f1 | C_f0) == 0))
690+ Z_e = 0;
691+ else
692+ {
693+ int _lz;
694+ _fex |= (0);
695+ do
696+ {
697+ if (C_f1)
698+ do
699+ {
700+ if (sizeof (unsigned long) ==
701+ sizeof (unsigned int))
702+ _lz = __builtin_clz (C_f1);
703+ else if (sizeof (unsigned long) ==
704+ sizeof (unsigned long))
705+ _lz = __builtin_clzl (C_f1);
706+ else if (sizeof (unsigned long) ==
707+ sizeof (unsigned long long))
708+ _lz = __builtin_clzll (C_f1);
709+ else
710+ abort ();
711+ }
712+ while (0);
713+ else
714+ {
715+ do
716+ {
717+ if (sizeof (unsigned long) ==
718+ sizeof (unsigned int))
719+ _lz = __builtin_clz (C_f0);
720+ else if (sizeof (unsigned long) ==
721+ sizeof (unsigned long))
722+ _lz = __builtin_clzl (C_f0);
723+ else if (sizeof (unsigned long) ==
724+ sizeof (unsigned long long))
725+ _lz = __builtin_clzll (C_f0);
726+ else
727+ abort ();
728+ }
729+ while (0);
730+ _lz += 32;
731+ }
732+ }
733+ while (0);
734+ do
735+ {
736+ long _up, _down, _skip, _i;
737+ _skip = (_lz + 113 - (2 * 32)) / 32;
738+ _up = (_lz + 113 - (2 * 32)) % 32;
739+ _down = 32 - _up;
740+ if (!_up)
741+ for (_i = 3; _i >= _skip; --_i)
742+ Z_f[_i] = Z_f[_i - _skip];
743+ else
744+ {
745+ for (_i = 3; _i > _skip; --_i)
746+ Z_f[_i] =
747+ Z_f[_i - _skip] << _up | Z_f[_i - _skip -
748+ 1] >> _down;
749+ Z_f[_i--] = Z_f[0] << _up;
750+ }
751+ for (; _i >= 0; --_i)
752+ Z_f[_i] = 0;
753+ }
754+ while (0);
755+ Z_e = (16383 - 1023 + 1 + ((2 * 32) - 53) - _lz);
756+ }
757+ }
758+ else
759+ {
760+ Z_e = 32767;
761+ if (!((C_f1 | C_f0) == 0))
762+ {
763+ if (!((C_f1) & ((unsigned long) 1 << (53 - 2) % 32)))
764+ _fex |= (0);
765+ do
766+ {
767+ long _up, _down, _skip, _i;
768+ _skip = ((113 - 53)) / 32;
769+ _up = ((113 - 53)) % 32;
770+ _down = 32 - _up;
771+ if (!_up)
772+ for (_i = 3; _i >= _skip; --_i)
773+ Z_f[_i] = Z_f[_i - _skip];
774+ else
775+ {
776+ for (_i = 3; _i > _skip; --_i)
777+ Z_f[_i] =
778+ Z_f[_i - _skip] << _up | Z_f[_i - _skip -
779+ 1] >> _down;
780+ Z_f[_i--] = Z_f[0] << _up;
781+ }
782+ for (; _i >= 0; --_i)
783+ Z_f[_i] = 0;
784+ }
785+ while (0);
786+ }
787+ }
788+ }
789+ }
790+ while (0);
791+
792+/* FP_PACK_RAW_Q(x,X) */
793+ do
794+ {
795+ union _FP_UNION_Q _flo;
796+ _flo.bits.frac0 = X_f[0];
797+ _flo.bits.frac1 = X_f[1];
798+ _flo.bits.frac2 = X_f[2];
799+ _flo.bits.frac3 = X_f[3];
800+ _flo.bits.exp = X_e;
801+ _flo.bits.sign = X_s;
802+ (x) = _flo.flt;
803+ }
804+ while (0);
805+
806+/* FP_PACK_RAW_Q(y,Y) */
807+ do
808+ {
809+ union _FP_UNION_Q _flo;
810+ _flo.bits.frac0 = Y_f[0];
811+ _flo.bits.frac1 = Y_f[1];
812+ _flo.bits.frac2 = Y_f[2];
813+ _flo.bits.frac3 = Y_f[3];
814+ _flo.bits.exp = Y_e;
815+ _flo.bits.sign = Y_s;
816+ (y) = _flo.flt;
817+ }
818+ while (0);
819+
820+/* FP_PACK_RAW_Q(z,Z) */
821+ do
822+ {
823+ union _FP_UNION_Q _flo;
824+ _flo.bits.frac0 = Z_f[0];
825+ _flo.bits.frac1 = Z_f[1];
826+ _flo.bits.frac2 = Z_f[2];
827+ _flo.bits.frac3 = Z_f[3];
828+ _flo.bits.exp = Z_e;
829+ _flo.bits.sign = Z_s;
830+ (z) = _flo.flt;
831+ }
832+ while (0);
833+
834+/* FP_HANDLE_EXCEPTIONS */
835+ do
836+ {
837+ }
838+ while (0);
839+
840+ /* Multiply. */
841+/* FP_INIT_ROUNDMODE */
842+ do
843+ {
844+ }
845+ while (0);
846+
847+/* FP_UNPACK_Q(X,x) */
848+ do
849+ {
850+ do
851+ {
852+ union _FP_UNION_Q _flo;
853+ _flo.flt = (x);
854+ X_f[0] = _flo.bits.frac0;
855+ X_f[1] = _flo.bits.frac1;
856+ X_f[2] = _flo.bits.frac2;
857+ X_f[3] = _flo.bits.frac3;
858+ X_e = _flo.bits.exp;
859+ X_s = _flo.bits.sign;
860+ }
861+ while (0);
862+ do
863+ {
864+ switch (X_e)
865+ {
866+ default:
867+ (X_f[3]) |= ((unsigned long) 1 << (113 - 1) % 32);
868+ do
869+ {
870+ long _up, _down, _skip, _i;
871+ _skip = (3) / 32;
872+ _up = (3) % 32;
873+ _down = 32 - _up;
874+ if (!_up)
875+ for (_i = 3; _i >= _skip; --_i)
876+ X_f[_i] = X_f[_i - _skip];
877+ else
878+ {
879+ for (_i = 3; _i > _skip; --_i)
880+ X_f[_i] =
881+ X_f[_i - _skip] << _up | X_f[_i - _skip -
882+ 1] >> _down;
883+ X_f[_i--] = X_f[0] << _up;
884+ }
885+ for (; _i >= 0; --_i)
886+ X_f[_i] = 0;
887+ }
888+ while (0);
889+ X_e -= 16383;
890+ X_c = 0;
891+ break;
892+ case 0:
893+ if (((X_f[0] | X_f[1] | X_f[2] | X_f[3]) == 0))
894+ X_c = 1;
895+ else
896+ {
897+ long _shift;
898+ do
899+ {
900+ if (X_f[3])
901+ {
902+ do
903+ {
904+ if (sizeof (unsigned long) ==
905+ sizeof (unsigned int))
906+ _shift = __builtin_clz (X_f[3]);
907+ else if (sizeof (unsigned long) ==
908+ sizeof (unsigned long))
909+ _shift = __builtin_clzl (X_f[3]);
910+ else if (sizeof (unsigned long) ==
911+ sizeof (unsigned long long))
912+ _shift = __builtin_clzll (X_f[3]);
913+ else
914+ abort ();
915+ }
916+ while (0);
917+ }
918+ else if (X_f[2])
919+ {
920+ do
921+ {
922+ if (sizeof (unsigned long) ==
923+ sizeof (unsigned int))
924+ _shift = __builtin_clz (X_f[2]);
925+ else if (sizeof (unsigned long) ==
926+ sizeof (unsigned long))
927+ _shift = __builtin_clzl (X_f[2]);
928+ else if (sizeof (unsigned long) ==
929+ sizeof (unsigned long long))
930+ _shift = __builtin_clzll (X_f[2]);
931+ else
932+ abort ();
933+ }
934+ while (0);
935+ _shift += 32;
936+ }
937+ else if (X_f[1])
938+ {
939+ do
940+ {
941+ if (sizeof (unsigned long) ==
942+ sizeof (unsigned int))
943+ _shift = __builtin_clz (X_f[1]);
944+ else if (sizeof (unsigned long) ==
945+ sizeof (unsigned long))
946+ _shift = __builtin_clzl (X_f[1]);
947+ else if (sizeof (unsigned long) ==
948+ sizeof (unsigned long long))
949+ _shift = __builtin_clzll (X_f[1]);
950+ else
951+ abort ();
952+ }
953+ while (0);
954+ _shift += 32 * 2;
955+ }
956+ else
957+ {
958+ do
959+ {
960+ if (sizeof (unsigned long) ==
961+ sizeof (unsigned int))
962+ _shift = __builtin_clz (X_f[0]);
963+ else if (sizeof (unsigned long) ==
964+ sizeof (unsigned long))
965+ _shift = __builtin_clzl (X_f[0]);
966+ else if (sizeof (unsigned long) ==
967+ sizeof (unsigned long long))
968+ _shift = __builtin_clzll (X_f[0]);
969+ else
970+ abort ();
971+ }
972+ while (0);
973+ _shift += 32 * 3;
974+ }
975+ }
976+ while (0);
977+ _shift -= ((4 * 32) - 113);
978+ do
979+ {
980+ long _up, _down, _skip, _i;
981+ _skip = ((_shift + 3)) / 32;
982+ _up = ((_shift + 3)) % 32;
983+ _down = 32 - _up;
984+ if (!_up)
985+ for (_i = 3; _i >= _skip; --_i)
986+ X_f[_i] = X_f[_i - _skip];
987+ else
988+ {
989+ for (_i = 3; _i > _skip; --_i)
990+ X_f[_i] =
991+ X_f[_i - _skip] << _up | X_f[_i - _skip -
992+ 1] >> _down;
993+ X_f[_i--] = X_f[0] << _up;
994+ }
995+ for (; _i >= 0; --_i)
996+ X_f[_i] = 0;
997+ }
998+ while (0);
999+ X_e -= 16383 - 1 + _shift;
1000+ X_c = 0;
1001+ _fex |= (0);
1002+ }
1003+ break;
1004+ case 32767:
1005+ if (((X_f[0] | X_f[1] | X_f[2] | X_f[3]) == 0))
1006+ X_c = 2;
1007+ else
1008+ {
1009+ X_c = 3;
1010+ if (!((X_f[3]) & ((unsigned long) 1 << (113 - 2) % 32)))
1011+ _fex |= (0);
1012+ } break;
1013+ }
1014+ }
1015+ while (0);
1016+ }
1017+ while (0);
1018+
1019+/* FP_UNPACK_Q(Y,y) */
1020+ do
1021+ {
1022+ do
1023+ {
1024+ union _FP_UNION_Q _flo;
1025+ _flo.flt = (y);
1026+ Y_f[0] = _flo.bits.frac0;
1027+ Y_f[1] = _flo.bits.frac1;
1028+ Y_f[2] = _flo.bits.frac2;
1029+ Y_f[3] = _flo.bits.frac3;
1030+ Y_e = _flo.bits.exp;
1031+ Y_s = _flo.bits.sign;
1032+ }
1033+ while (0);
1034+ do
1035+ {
1036+ switch (Y_e)
1037+ {
1038+ default:
1039+ (Y_f[3]) |= ((unsigned long) 1 << (113 - 1) % 32);
1040+ do
1041+ {
1042+ long _up, _down, _skip, _i;
1043+ _skip = (3) / 32;
1044+ _up = (3) % 32;
1045+ _down = 32 - _up;
1046+ if (!_up)
1047+ for (_i = 3; _i >= _skip; --_i)
1048+ Y_f[_i] = Y_f[_i - _skip];
1049+ else
1050+ {
1051+ for (_i = 3; _i > _skip; --_i)
1052+ Y_f[_i] =
1053+ Y_f[_i - _skip] << _up | Y_f[_i - _skip -
1054+ 1] >> _down;
1055+ Y_f[_i--] = Y_f[0] << _up;
1056+ }
1057+ for (; _i >= 0; --_i)
1058+ Y_f[_i] = 0;
1059+ }
1060+ while (0);
1061+ Y_e -= 16383;
1062+ Y_c = 0;
1063+ break;
1064+ case 0:
1065+ if (((Y_f[0] | Y_f[1] | Y_f[2] | Y_f[3]) == 0))
1066+ Y_c = 1;
1067+ else
1068+ {
1069+ long _shift;
1070+ do
1071+ {
1072+ if (Y_f[3])
1073+ {
1074+ do
1075+ {
1076+ if (sizeof (unsigned long) ==
1077+ sizeof (unsigned int))
1078+ _shift = __builtin_clz (Y_f[3]);
1079+ else if (sizeof (unsigned long) ==
1080+ sizeof (unsigned long))
1081+ _shift = __builtin_clzl (Y_f[3]);
1082+ else if (sizeof (unsigned long) ==
1083+ sizeof (unsigned long long))
1084+ _shift = __builtin_clzll (Y_f[3]);
1085+ else
1086+ abort ();
1087+ }
1088+ while (0);
1089+ }
1090+ else if (Y_f[2])
1091+ {
1092+ do
1093+ {
1094+ if (sizeof (unsigned long) ==
1095+ sizeof (unsigned int))
1096+ _shift = __builtin_clz (Y_f[2]);
1097+ else if (sizeof (unsigned long) ==
1098+ sizeof (unsigned long))
1099+ _shift = __builtin_clzl (Y_f[2]);
1100+ else if (sizeof (unsigned long) ==
1101+ sizeof (unsigned long long))
1102+ _shift = __builtin_clzll (Y_f[2]);
1103+ else
1104+ abort ();
1105+ }
1106+ while (0);
1107+ _shift += 32;
1108+ }
1109+ else if (Y_f[1])
1110+ {
1111+ do
1112+ {
1113+ if (sizeof (unsigned long) ==
1114+ sizeof (unsigned int))
1115+ _shift = __builtin_clz (Y_f[1]);
1116+ else if (sizeof (unsigned long) ==
1117+ sizeof (unsigned long))
1118+ _shift = __builtin_clzl (Y_f[1]);
1119+ else if (sizeof (unsigned long) ==
1120+ sizeof (unsigned long long))
1121+ _shift = __builtin_clzll (Y_f[1]);
1122+ else
1123+ abort ();
1124+ }
1125+ while (0);
1126+ _shift += 32 * 2;
1127+ }
1128+ else
1129+ {
1130+ do
1131+ {
1132+ if (sizeof (unsigned long) ==
1133+ sizeof (unsigned int))
1134+ _shift = __builtin_clz (Y_f[0]);
1135+ else if (sizeof (unsigned long) ==
1136+ sizeof (unsigned long))
1137+ _shift = __builtin_clzl (Y_f[0]);
1138+ else if (sizeof (unsigned long) ==
1139+ sizeof (unsigned long long))
1140+ _shift = __builtin_clzll (Y_f[0]);
1141+ else
1142+ abort ();
1143+ }
1144+ while (0);
1145+ _shift += 32 * 3;
1146+ }
1147+ }
1148+ while (0);
1149+ _shift -= ((4 * 32) - 113);
1150+ do
1151+ {
1152+ long _up, _down, _skip, _i;
1153+ _skip = ((_shift + 3)) / 32;
1154+ _up = ((_shift + 3)) % 32;
1155+ _down = 32 - _up;
1156+ if (!_up)
1157+ for (_i = 3; _i >= _skip; --_i)
1158+ Y_f[_i] = Y_f[_i - _skip];
1159+ else
1160+ {
1161+ for (_i = 3; _i > _skip; --_i)
1162+ Y_f[_i] =
1163+ Y_f[_i - _skip] << _up | Y_f[_i - _skip -
1164+ 1] >> _down;
1165+ Y_f[_i--] = Y_f[0] << _up;
1166+ }
1167+ for (; _i >= 0; --_i)
1168+ Y_f[_i] = 0;
1169+ }
1170+ while (0);
1171+ Y_e -= 16383 - 1 + _shift;
1172+ Y_c = 0;
1173+ _fex |= (0);
1174+ }
1175+ break;
1176+ case 32767:
1177+ if (((Y_f[0] | Y_f[1] | Y_f[2] | Y_f[3]) == 0))
1178+ Y_c = 2;
1179+ else
1180+ {
1181+ Y_c = 3;
1182+ if (!((Y_f[3]) & ((unsigned long) 1 << (113 - 2) % 32)))
1183+ _fex |= (0);
1184+ } break;
1185+ }
1186+ }
1187+ while (0);
1188+ }
1189+ while (0);
1190+
1191+/* FP_MUL_Q(U,X,Y) */
1192+ do
1193+ {
1194+ U_s = X_s ^ Y_s;
1195+ switch ((((X_c) << 2) | (Y_c)))
1196+ {
1197+ case (((0) << 2) | (0)):
1198+ U_c = 0;
1199+ U_e = X_e + Y_e + 1;
1200+ do
1201+ {
1202+ unsigned long _z_f[8];
1203+ unsigned long _b_f0, _b_f1;
1204+ unsigned long _c_f0, _c_f1;
1205+ unsigned long _d_f0, _d_f1;
1206+ unsigned long _e_f0, _e_f1;
1207+ unsigned long _f_f0, _f_f1;
1208+ do
1209+ {
1210+ USItype __m0 = (X_f[0]), __m1 = (Y_f[0]);
1211+ __asm__ ("mulhwu %0,%1,%2": "=r" ((_z_f[1])):"%r" (X_f[0]),
1212+ "r" (Y_f
1213+ [0]));
1214+ ((_z_f[0])) = __m0 * __m1;
1215+ }
1216+ while (0);
1217+ do
1218+ {
1219+ USItype __m0 = (X_f[0]), __m1 = (Y_f[1]);
1220+ __asm__ ("mulhwu %0,%1,%2": "=r" (_b_f1):"%r" (X_f[0]),
1221+ "r" (Y_f
1222+ [1]));
1223+ (_b_f0) = __m0 * __m1;
1224+ }
1225+ while (0);
1226+ do
1227+ {
1228+ USItype __m0 = (X_f[1]), __m1 = (Y_f[0]);
1229+ __asm__ ("mulhwu %0,%1,%2": "=r" (_c_f1):"%r" (X_f[1]),
1230+ "r" (Y_f
1231+ [0]));
1232+ (_c_f0) = __m0 * __m1;
1233+ }
1234+ while (0);
1235+ do
1236+ {
1237+ USItype __m0 = (X_f[1]), __m1 = (Y_f[1]);
1238+ __asm__ ("mulhwu %0,%1,%2": "=r" (_d_f1):"%r" (X_f[1]),
1239+ "r" (Y_f
1240+ [1]));
1241+ (_d_f0) = __m0 * __m1;
1242+ }
1243+ while (0);
1244+ do
1245+ {
1246+ USItype __m0 = (X_f[0]), __m1 = (Y_f[2]);
1247+ __asm__ ("mulhwu %0,%1,%2": "=r" (_e_f1):"%r" (X_f[0]),
1248+ "r" (Y_f
1249+ [2]));
1250+ (_e_f0) = __m0 * __m1;
1251+ }
1252+ while (0);
1253+ do
1254+ {
1255+ USItype __m0 = (X_f[2]), __m1 = (Y_f[0]);
1256+ __asm__ ("mulhwu %0,%1,%2": "=r" (_f_f1):"%r" (X_f[2]),
1257+ "r" (Y_f
1258+ [0]));
1259+ (_f_f0) = __m0 * __m1;
1260+ }
1261+ while (0);
1262+ do
1263+ {
1264+ unsigned long _c1, _c2;
1265+ (_z_f[1]) = _b_f0 + (_z_f[1]);
1266+ _c1 = (_z_f[1]) < _b_f0;
1267+ (_z_f[2]) = _b_f1 + 0;
1268+ _c2 = (_z_f[2]) < _b_f1;
1269+ (_z_f[2]) += _c1;
1270+ _c2 |= (_z_f[2]) < _c1;
1271+ (_z_f[3]) = 0 + 0 + _c2;
1272+ }
1273+ while (0);
1274+ do
1275+ {
1276+ unsigned long _c1, _c2;
1277+ (_z_f[1]) = _c_f0 + (_z_f[1]);
1278+ _c1 = (_z_f[1]) < _c_f0;
1279+ (_z_f[2]) = _c_f1 + (_z_f[2]);
1280+ _c2 = (_z_f[2]) < _c_f1;
1281+ (_z_f[2]) += _c1;
1282+ _c2 |= (_z_f[2]) < _c1;
1283+ (_z_f[3]) = 0 + (_z_f[3]) + _c2;
1284+ }
1285+ while (0);
1286+ do
1287+ {
1288+ unsigned long _c1, _c2;
1289+ (_z_f[2]) = _d_f0 + (_z_f[2]);
1290+ _c1 = (_z_f[2]) < _d_f0;
1291+ (_z_f[3]) = _d_f1 + (_z_f[3]);
1292+ _c2 = (_z_f[3]) < _d_f1;
1293+ (_z_f[3]) += _c1;
1294+ _c2 |= (_z_f[3]) < _c1;
1295+ (_z_f[4]) = 0 + 0 + _c2;
1296+ }
1297+ while (0);
1298+ do
1299+ {
1300+ unsigned long _c1, _c2;
1301+ (_z_f[2]) = _e_f0 + (_z_f[2]);
1302+ _c1 = (_z_f[2]) < _e_f0;
1303+ (_z_f[3]) = _e_f1 + (_z_f[3]);
1304+ _c2 = (_z_f[3]) < _e_f1;
1305+ (_z_f[3]) += _c1;
1306+ _c2 |= (_z_f[3]) < _c1;
1307+ (_z_f[4]) = 0 + (_z_f[4]) + _c2;
1308+ }
1309+ while (0);
1310+ do
1311+ {
1312+ unsigned long _c1, _c2;
1313+ (_z_f[2]) = _f_f0 + (_z_f[2]);
1314+ _c1 = (_z_f[2]) < _f_f0;
1315+ (_z_f[3]) = _f_f1 + (_z_f[3]);
1316+ _c2 = (_z_f[3]) < _f_f1;
1317+ (_z_f[3]) += _c1;
1318+ _c2 |= (_z_f[3]) < _c1;
1319+ (_z_f[4]) = 0 + (_z_f[4]) + _c2;
1320+ }
1321+ while (0);
1322+ do
1323+ {
1324+ USItype __m0 = (X_f[0]), __m1 = (Y_f[3]);
1325+ __asm__ ("mulhwu %0,%1,%2": "=r" (_b_f1):"%r" (X_f[0]),
1326+ "r" (Y_f
1327+ [3]));
1328+ (_b_f0) = __m0 * __m1;
1329+ }
1330+ while (0);
1331+ do
1332+ {
1333+ USItype __m0 = (X_f[3]), __m1 = (Y_f[0]);
1334+ __asm__ ("mulhwu %0,%1,%2": "=r" (_c_f1):"%r" (X_f[3]),
1335+ "r" (Y_f
1336+ [0]));
1337+ (_c_f0) = __m0 * __m1;
1338+ }
1339+ while (0);
1340+ do
1341+ {
1342+ USItype __m0 = (X_f[1]), __m1 = (Y_f[2]);
1343+ __asm__ ("mulhwu %0,%1,%2": "=r" (_d_f1):"%r" (X_f[1]),
1344+ "r" (Y_f
1345+ [2]));
1346+ (_d_f0) = __m0 * __m1;
1347+ }
1348+ while (0);
1349+ do
1350+ {
1351+ USItype __m0 = (X_f[2]), __m1 = (Y_f[1]);
1352+ __asm__ ("mulhwu %0,%1,%2": "=r" (_e_f1):"%r" (X_f[2]),
1353+ "r" (Y_f
1354+ [1]));
1355+ (_e_f0) = __m0 * __m1;
1356+ }
1357+ while (0);
1358+ do
1359+ {
1360+ unsigned long _c1, _c2;
1361+ (_z_f[3]) = _b_f0 + (_z_f[3]);
1362+ _c1 = (_z_f[3]) < _b_f0;
1363+ (_z_f[4]) = _b_f1 + (_z_f[4]);
1364+ _c2 = (_z_f[4]) < _b_f1;
1365+ (_z_f[4]) += _c1;
1366+ _c2 |= (_z_f[4]) < _c1;
1367+ (_z_f[5]) = 0 + 0 + _c2;
1368+ }
1369+ while (0);
1370+ do
1371+ {
1372+ unsigned long _c1, _c2;
1373+ (_z_f[3]) = _c_f0 + (_z_f[3]);
1374+ _c1 = (_z_f[3]) < _c_f0;
1375+ (_z_f[4]) = _c_f1 + (_z_f[4]);
1376+ _c2 = (_z_f[4]) < _c_f1;
1377+ (_z_f[4]) += _c1;
1378+ _c2 |= (_z_f[4]) < _c1;
1379+ (_z_f[5]) = 0 + (_z_f[5]) + _c2;
1380+ }
1381+ while (0);
1382+ do
1383+ {
1384+ unsigned long _c1, _c2;
1385+ (_z_f[3]) = _d_f0 + (_z_f[3]);
1386+ _c1 = (_z_f[3]) < _d_f0;
1387+ (_z_f[4]) = _d_f1 + (_z_f[4]);
1388+ _c2 = (_z_f[4]) < _d_f1;
1389+ (_z_f[4]) += _c1;
1390+ _c2 |= (_z_f[4]) < _c1;
1391+ (_z_f[5]) = 0 + (_z_f[5]) + _c2;
1392+ }
1393+ while (0);
1394+ do
1395+ {
1396+ unsigned long _c1, _c2;
1397+ (_z_f[3]) = _e_f0 + (_z_f[3]);
1398+ _c1 = (_z_f[3]) < _e_f0;
1399+ (_z_f[4]) = _e_f1 + (_z_f[4]);
1400+ _c2 = (_z_f[4]) < _e_f1;
1401+ (_z_f[4]) += _c1;
1402+ _c2 |= (_z_f[4]) < _c1;
1403+ (_z_f[5]) = 0 + (_z_f[5]) + _c2;
1404+ }
1405+ while (0);
1406+ do
1407+ {
1408+ USItype __m0 = (X_f[2]), __m1 = (Y_f[2]);
1409+ __asm__ ("mulhwu %0,%1,%2": "=r" (_b_f1):"%r" (X_f[2]),
1410+ "r" (Y_f
1411+ [2]));
1412+ (_b_f0) = __m0 * __m1;
1413+ }
1414+ while (0);
1415+ do
1416+ {
1417+ USItype __m0 = (X_f[1]), __m1 = (Y_f[3]);
1418+ __asm__ ("mulhwu %0,%1,%2": "=r" (_c_f1):"%r" (X_f[1]),
1419+ "r" (Y_f
1420+ [3]));
1421+ (_c_f0) = __m0 * __m1;
1422+ }
1423+ while (0);
1424+ do
1425+ {
1426+ USItype __m0 = (X_f[3]), __m1 = (Y_f[1]);
1427+ __asm__ ("mulhwu %0,%1,%2": "=r" (_d_f1):"%r" (X_f[3]),
1428+ "r" (Y_f
1429+ [1]));
1430+ (_d_f0) = __m0 * __m1;
1431+ }
1432+ while (0);
1433+ do
1434+ {
1435+ USItype __m0 = (X_f[2]), __m1 = (Y_f[3]);
1436+ __asm__ ("mulhwu %0,%1,%2": "=r" (_e_f1):"%r" (X_f[2]),
1437+ "r" (Y_f
1438+ [3]));
1439+ (_e_f0) = __m0 * __m1;
1440+ }
1441+ while (0);
1442+ do
1443+ {
1444+ USItype __m0 = (X_f[3]), __m1 = (Y_f[2]);
1445+ __asm__ ("mulhwu %0,%1,%2": "=r" (_f_f1):"%r" (X_f[3]),
1446+ "r" (Y_f
1447+ [2]));
1448+ (_f_f0) = __m0 * __m1;
1449+ }
1450+ while (0);
1451+ do
1452+ {
1453+ unsigned long _c1, _c2;
1454+ (_z_f[4]) = _b_f0 + (_z_f[4]);
1455+ _c1 = (_z_f[4]) < _b_f0;
1456+ (_z_f[5]) = _b_f1 + (_z_f[5]);
1457+ _c2 = (_z_f[5]) < _b_f1;
1458+ (_z_f[5]) += _c1;
1459+ _c2 |= (_z_f[5]) < _c1;
1460+ (_z_f[6]) = 0 + 0 + _c2;
1461+ }
1462+ while (0);
1463+ do
1464+ {
1465+ unsigned long _c1, _c2;
1466+ (_z_f[4]) = _c_f0 + (_z_f[4]);
1467+ _c1 = (_z_f[4]) < _c_f0;
1468+ (_z_f[5]) = _c_f1 + (_z_f[5]);
1469+ _c2 = (_z_f[5]) < _c_f1;
1470+ (_z_f[5]) += _c1;
1471+ _c2 |= (_z_f[5]) < _c1;
1472+ (_z_f[6]) = 0 + (_z_f[6]) + _c2;
1473+ }
1474+ while (0);
1475+ do
1476+ {
1477+ unsigned long _c1, _c2;
1478+ (_z_f[4]) = _d_f0 + (_z_f[4]);
1479+ _c1 = (_z_f[4]) < _d_f0;
1480+ (_z_f[5]) = _d_f1 + (_z_f[5]);
1481+ _c2 = (_z_f[5]) < _d_f1;
1482+ (_z_f[5]) += _c1;
1483+ _c2 |= (_z_f[5]) < _c1;
1484+ (_z_f[6]) = 0 + (_z_f[6]) + _c2;
1485+ }
1486+ while (0);
1487+ do
1488+ {
1489+ unsigned long _c1, _c2;
1490+ (_z_f[5]) = _e_f0 + (_z_f[5]);
1491+ _c1 = (_z_f[5]) < _e_f0;
1492+ (_z_f[6]) = _e_f1 + (_z_f[6]);
1493+ _c2 = (_z_f[6]) < _e_f1;
1494+ (_z_f[6]) += _c1;
1495+ _c2 |= (_z_f[6]) < _c1;
1496+ (_z_f[7]) = 0 + 0 + _c2;
1497+ }
1498+ while (0);
1499+ do
1500+ {
1501+ unsigned long _c1, _c2;
1502+ (_z_f[5]) = _f_f0 + (_z_f[5]);
1503+ _c1 = (_z_f[5]) < _f_f0;
1504+ (_z_f[6]) = _f_f1 + (_z_f[6]);
1505+ _c2 = (_z_f[6]) < _f_f1;
1506+ (_z_f[6]) += _c1;
1507+ _c2 |= (_z_f[6]) < _c1;
1508+ (_z_f[7]) = 0 + (_z_f[7]) + _c2;
1509+ }
1510+ while (0);
1511+ do
1512+ {
1513+ USItype __m0 = (X_f[3]), __m1 = (Y_f[3]);
1514+ __asm__ ("mulhwu %0,%1,%2": "=r" (_b_f1):"%r" (X_f[3]),
1515+ "r" (Y_f
1516+ [3]));
1517+ (_b_f0) = __m0 * __m1;
1518+ }
1519+ while (0);
1520+ do
1521+ {
1522+ if (__builtin_constant_p ((_z_f[7])) && ((_z_f[7])) == 0)
1523+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2": "=r" ((_z_f[7])), "=&r" ((_z_f[6])):"r" (_b_f1), "%r" (_b_f0),
1524+ "rI" ((_z_f
1525+ [6])));
1526+ else if (__builtin_constant_p ((_z_f[7]))
1527+ && ((_z_f[7])) == ~(USItype) 0)
1528+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2": "=r" ((_z_f[7])), "=&r" ((_z_f[6])):"r" (_b_f1), "%r" (_b_f0),
1529+ "rI" ((_z_f
1530+ [6])));
1531+ else
1532+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3": "=r" ((_z_f[7])), "=&r" ((_z_f[6])):"%r" (_b_f1), "r" ((_z_f[7])), "%r" (_b_f0),
1533+ "rI" ((_z_f
1534+ [6])));
1535+ }
1536+ while (0);
1537+ do
1538+ {
1539+ long _up, _down, _skip, _i;
1540+ unsigned long _s;
1541+ _skip = ((3 + 113) - 1) / 32;
1542+ _down = ((3 + 113) - 1) % 32;
1543+ _up = 32 - _down;
1544+ for (_s = _i = 0; _i < _skip; ++_i)
1545+ _s |= _z_f[_i];
1546+ if (!_down)
1547+ for (_i = 0; _i <= 7 - _skip; ++_i)
1548+ _z_f[_i] = _z_f[_i + _skip];
1549+ else
1550+ {
1551+ _s |= _z_f[_i] << _up;
1552+ for (_i = 0; _i < 7 - _skip; ++_i)
1553+ _z_f[_i] =
1554+ _z_f[_i + _skip] >> _down | _z_f[_i + _skip +
1555+ 1] << _up;
1556+ _z_f[_i++] = _z_f[7] >> _down;
1557+ }
1558+ for (; _i < 8; ++_i)
1559+ _z_f[_i] = 0;
1560+ _z_f[0] |= (_s != 0);
1561+ }
1562+ while (0);
1563+ (U_f[3] = (_z_f[3]), U_f[2] = (_z_f[2]), U_f[1] =
1564+ (_z_f[1]), U_f[0] = (_z_f[0]));
1565+ }
1566+ while (0);
1567+ if (((U_f[3]) & ((unsigned long) 1 << ((3 + 113) % 32))))
1568+ do
1569+ {
1570+ int _sticky;
1571+ do
1572+ {
1573+ long _up, _down, _skip, _i;
1574+ unsigned long _s;
1575+ _skip = (1) / 32;
1576+ _down = (1) % 32;
1577+ _up = 32 - _down;
1578+ for (_s = _i = 0; _i < _skip; ++_i)
1579+ _s |= U_f[_i];
1580+ if (!_down)
1581+ for (_i = 0; _i <= 3 - _skip; ++_i)
1582+ U_f[_i] = U_f[_i + _skip];
1583+ else
1584+ {
1585+ _s |= U_f[_i] << _up;
1586+ for (_i = 0; _i < 3 - _skip; ++_i)
1587+ U_f[_i] =
1588+ U_f[_i + _skip] >> _down | U_f[_i + _skip +
1589+ 1] << _up;
1590+ U_f[_i++] = U_f[3] >> _down;
1591+ }
1592+ for (; _i < 4; ++_i)
1593+ U_f[_i] = 0;
1594+ _sticky = (_s != 0);
1595+ }
1596+ while (0);
1597+ U_f[0] |= _sticky;
1598+ }
1599+ while (0);
1600+ else
1601+ U_e--;
1602+ break;
1603+ case (((3) << 2) | (3)):
1604+ do
1605+ {
1606+ if (((X_f[3]) & ((unsigned long) 1 << (113 - 2) % 32))
1607+ && !((Y_f[3]) & ((unsigned long) 1 << (113 - 2) % 32)))
1608+ {
1609+ U_s = Y_s;
1610+ (U_f[0] = Y_f[0], U_f[1] = Y_f[1], U_f[2] = Y_f[2], U_f[3] =
1611+ Y_f[3]);
1612+ }
1613+ else
1614+ {
1615+ U_s = X_s;
1616+ (U_f[0] = X_f[0], U_f[1] = X_f[1], U_f[2] = X_f[2], U_f[3] =
1617+ X_f[3]);
1618+ }
1619+ U_c = 3;
1620+ }
1621+ while (0);
1622+ break;
1623+ case (((3) << 2) | (0)):
1624+ case (((3) << 2) | (2)):
1625+ case (((3) << 2) | (1)):
1626+ U_s = X_s;
1627+ case (((2) << 2) | (2)):
1628+ case (((2) << 2) | (0)):
1629+ case (((1) << 2) | (0)):
1630+ case (((1) << 2) | (1)):
1631+ (U_f[0] = X_f[0], U_f[1] = X_f[1], U_f[2] = X_f[2], U_f[3] =
1632+ X_f[3]);
1633+ U_c = X_c;
1634+ break;
1635+ case (((0) << 2) | (3)):
1636+ case (((2) << 2) | (3)):
1637+ case (((1) << 2) | (3)):
1638+ U_s = Y_s;
1639+ case (((0) << 2) | (2)):
1640+ case (((0) << 2) | (1)):
1641+ (U_f[0] = Y_f[0], U_f[1] = Y_f[1], U_f[2] = Y_f[2], U_f[3] =
1642+ Y_f[3]);
1643+ U_c = Y_c;
1644+ break;
1645+ case (((2) << 2) | (1)):
1646+ case (((1) << 2) | (2)):
1647+ U_s = 0;
1648+ U_c = 3;
1649+ (U_f[3] =
1650+ ((((unsigned long) 1 << (113 - 2) % 32) << 1) - 1), U_f[2] =
1651+ -1, U_f[1] = -1, U_f[0] = -1);
1652+ _fex |= (0);
1653+ break;
1654+ default:
1655+ abort ();
1656+ }
1657+ }
1658+ while (0);
1659+
1660+/* FP_PACK_Q(u,U) */
1661+ do
1662+ {
1663+ do
1664+ {
1665+ switch (U_c)
1666+ {
1667+ case 0:
1668+ U_e += 16383;
1669+ if (U_e > 0)
1670+ {
1671+ do
1672+ {
1673+ if ((U_f[0]) & 7)
1674+ _fex |= (0);
1675+ switch (0)
1676+ {
1677+ case 0:
1678+ do
1679+ {
1680+ if (((U_f[0]) & 15) != ((unsigned long) 1 << 2))
1681+ do
1682+ {
1683+ unsigned long _t;
1684+ _t =
1685+ ((U_f[0] +=
1686+ ((unsigned long) 1 << 2)) <
1687+ ((unsigned long) 1 << 2));
1688+ U_f[1] += _t;
1689+ _t = (U_f[1] < _t);
1690+ U_f[2] += _t;
1691+ _t = (U_f[2] < _t);
1692+ U_f[3] += _t;
1693+ }
1694+ while (0);
1695+ }
1696+ while (0);
1697+ break;
1698+ case 1:
1699+ (void) 0;
1700+ break;
1701+ case 2:
1702+ do
1703+ {
1704+ if (!U_s && ((U_f[0]) & 7))
1705+ do
1706+ {
1707+ unsigned long _t;
1708+ _t =
1709+ ((U_f[0] +=
1710+ ((unsigned long) 1 << 3)) <
1711+ ((unsigned long) 1 << 3));
1712+ U_f[1] += _t;
1713+ _t = (U_f[1] < _t);
1714+ U_f[2] += _t;
1715+ _t = (U_f[2] < _t);
1716+ U_f[3] += _t;
1717+ }
1718+ while (0);
1719+ }
1720+ while (0);
1721+ break;
1722+ case 3:
1723+ do
1724+ {
1725+ if (U_s && ((U_f[0]) & 7))
1726+ do
1727+ {
1728+ unsigned long _t;
1729+ _t =
1730+ ((U_f[0] +=
1731+ ((unsigned long) 1 << 3)) <
1732+ ((unsigned long) 1 << 3));
1733+ U_f[1] += _t;
1734+ _t = (U_f[1] < _t);
1735+ U_f[2] += _t;
1736+ _t = (U_f[2] < _t);
1737+ U_f[3] += _t;
1738+ }
1739+ while (0);
1740+ }
1741+ while (0);
1742+ break;
1743+ }
1744+ }
1745+ while (0);
1746+ if (((U_f[3]) & ((unsigned long) 1 << ((3 + 113) % 32))))
1747+ {
1748+ ((U_f[3]) &= ~((unsigned long) 1 << ((3 + 113) % 32)));
1749+ U_e++;
1750+ }
1751+ do
1752+ {
1753+ long _up, _down, _skip, _i;
1754+ _skip = (3) / 32;
1755+ _down = (3) % 32;
1756+ _up = 32 - _down;
1757+ if (!_down)
1758+ for (_i = 0; _i <= 3 - _skip; ++_i)
1759+ U_f[_i] = U_f[_i + _skip];
1760+ else
1761+ {
1762+ for (_i = 0; _i < 3 - _skip; ++_i)
1763+ U_f[_i] =
1764+ U_f[_i + _skip] >> _down | U_f[_i + _skip +
1765+ 1] << _up;
1766+ U_f[_i++] = U_f[3] >> _down;
1767+ }
1768+ for (; _i < 4; ++_i)
1769+ U_f[_i] = 0;
1770+ }
1771+ while (0);
1772+ if (U_e >= 32767)
1773+ {
1774+ switch (0)
1775+ {
1776+ case 0:
1777+ U_c = 2;
1778+ break;
1779+ case 2:
1780+ if (!U_s)
1781+ U_c = 2;
1782+ break;
1783+ case 3:
1784+ if (U_s)
1785+ U_c = 2;
1786+ break;
1787+ }
1788+ if (U_c == 2)
1789+ {
1790+ U_e = 32767;
1791+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 0);
1792+ }
1793+ else
1794+ {
1795+ U_e = 32767 - 1;
1796+ (U_f[3] = (~(signed long) 0), U_f[2] =
1797+ (~(signed long) 0), U_f[1] =
1798+ (~(signed long) 0), U_f[0] = (~(signed long) 0));
1799+ } _fex |= (0);
1800+ _fex |= (0);
1801+ }
1802+ }
1803+ else
1804+ {
1805+ U_e = -U_e + 1;
1806+ if (U_e <= (3 + 113))
1807+ {
1808+ do
1809+ {
1810+ int _sticky;
1811+ do
1812+ {
1813+ long _up, _down, _skip, _i;
1814+ unsigned long _s;
1815+ _skip = (U_e) / 32;
1816+ _down = (U_e) % 32;
1817+ _up = 32 - _down;
1818+ for (_s = _i = 0; _i < _skip; ++_i)
1819+ _s |= U_f[_i];
1820+ if (!_down)
1821+ for (_i = 0; _i <= 3 - _skip; ++_i)
1822+ U_f[_i] = U_f[_i + _skip];
1823+ else
1824+ {
1825+ _s |= U_f[_i] << _up;
1826+ for (_i = 0; _i < 3 - _skip; ++_i)
1827+ U_f[_i] =
1828+ U_f[_i + _skip] >> _down | U_f[_i +
1829+ _skip +
1830+ 1] <<
1831+ _up;
1832+ U_f[_i++] = U_f[3] >> _down;
1833+ }
1834+ for (; _i < 4; ++_i)
1835+ U_f[_i] = 0;
1836+ _sticky = (_s != 0);
1837+ }
1838+ while (0);
1839+ U_f[0] |= _sticky;
1840+ }
1841+ while (0);
1842+ do
1843+ {
1844+ if ((U_f[0]) & 7)
1845+ _fex |= (0);
1846+ switch (0)
1847+ {
1848+ case 0:
1849+ do
1850+ {
1851+ if (((U_f[0]) & 15) !=
1852+ ((unsigned long) 1 << 2))
1853+ do
1854+ {
1855+ unsigned long _t;
1856+ _t =
1857+ ((U_f[0] +=
1858+ ((unsigned long) 1 << 2)) <
1859+ ((unsigned long) 1 << 2));
1860+ U_f[1] += _t;
1861+ _t = (U_f[1] < _t);
1862+ U_f[2] += _t;
1863+ _t = (U_f[2] < _t);
1864+ U_f[3] += _t;
1865+ }
1866+ while (0);
1867+ }
1868+ while (0);
1869+ break;
1870+ case 1:
1871+ (void) 0;
1872+ break;
1873+ case 2:
1874+ do
1875+ {
1876+ if (!U_s && ((U_f[0]) & 7))
1877+ do
1878+ {
1879+ unsigned long _t;
1880+ _t =
1881+ ((U_f[0] +=
1882+ ((unsigned long) 1 << 3)) <
1883+ ((unsigned long) 1 << 3));
1884+ U_f[1] += _t;
1885+ _t = (U_f[1] < _t);
1886+ U_f[2] += _t;
1887+ _t = (U_f[2] < _t);
1888+ U_f[3] += _t;
1889+ }
1890+ while (0);
1891+ }
1892+ while (0);
1893+ break;
1894+ case 3:
1895+ do
1896+ {
1897+ if (U_s && ((U_f[0]) & 7))
1898+ do
1899+ {
1900+ unsigned long _t;
1901+ _t =
1902+ ((U_f[0] +=
1903+ ((unsigned long) 1 << 3)) <
1904+ ((unsigned long) 1 << 3));
1905+ U_f[1] += _t;
1906+ _t = (U_f[1] < _t);
1907+ U_f[2] += _t;
1908+ _t = (U_f[2] < _t);
1909+ U_f[3] += _t;
1910+ }
1911+ while (0);
1912+ }
1913+ while (0);
1914+ break;
1915+ }
1916+ }
1917+ while (0);
1918+ if ((U_f[3]) &
1919+ (((unsigned long) 1 << ((3 + 113) % 32)) >> 1))
1920+ {
1921+ U_e = 1;
1922+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 0);
1923+ }
1924+ else
1925+ {
1926+ U_e = 0;
1927+ do
1928+ {
1929+ long _up, _down, _skip, _i;
1930+ _skip = (3) / 32;
1931+ _down = (3) % 32;
1932+ _up = 32 - _down;
1933+ if (!_down)
1934+ for (_i = 0; _i <= 3 - _skip; ++_i)
1935+ U_f[_i] = U_f[_i + _skip];
1936+ else
1937+ {
1938+ for (_i = 0; _i < 3 - _skip; ++_i)
1939+ U_f[_i] =
1940+ U_f[_i + _skip] >> _down | U_f[_i +
1941+ _skip +
1942+ 1] <<
1943+ _up;
1944+ U_f[_i++] = U_f[3] >> _down;
1945+ }
1946+ for (; _i < 4; ++_i)
1947+ U_f[_i] = 0;
1948+ }
1949+ while (0);
1950+ _fex |= (0);
1951+ }
1952+ }
1953+ else
1954+ {
1955+ U_e = 0;
1956+ if (!((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
1957+ {
1958+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 1);
1959+ do
1960+ {
1961+ if ((U_f[0]) & 7)
1962+ _fex |= (0);
1963+ switch (0)
1964+ {
1965+ case 0:
1966+ do
1967+ {
1968+ if (((U_f[0]) & 15) !=
1969+ ((unsigned long) 1 << 2))
1970+ do
1971+ {
1972+ unsigned long _t;
1973+ _t =
1974+ ((U_f[0] +=
1975+ ((unsigned long) 1 << 2)) <
1976+ ((unsigned long) 1 << 2));
1977+ U_f[1] += _t;
1978+ _t = (U_f[1] < _t);
1979+ U_f[2] += _t;
1980+ _t = (U_f[2] < _t);
1981+ U_f[3] += _t;
1982+ }
1983+ while (0);
1984+ }
1985+ while (0);
1986+ break;
1987+ case 1:
1988+ (void) 0;
1989+ break;
1990+ case 2:
1991+ do
1992+ {
1993+ if (!U_s && ((U_f[0]) & 7))
1994+ do
1995+ {
1996+ unsigned long _t;
1997+ _t =
1998+ ((U_f[0] +=
1999+ ((unsigned long) 1 << 3)) <
2000+ ((unsigned long) 1 << 3));
2001+ U_f[1] += _t;
2002+ _t = (U_f[1] < _t);
2003+ U_f[2] += _t;
2004+ _t = (U_f[2] < _t);
2005+ U_f[3] += _t;
2006+ }
2007+ while (0);
2008+ }
2009+ while (0);
2010+ break;
2011+ case 3:
2012+ do
2013+ {
2014+ if (U_s && ((U_f[0]) & 7))
2015+ do
2016+ {
2017+ unsigned long _t;
2018+ _t =
2019+ ((U_f[0] +=
2020+ ((unsigned long) 1 << 3)) <
2021+ ((unsigned long) 1 << 3));
2022+ U_f[1] += _t;
2023+ _t = (U_f[1] < _t);
2024+ U_f[2] += _t;
2025+ _t = (U_f[2] < _t);
2026+ U_f[3] += _t;
2027+ }
2028+ while (0);
2029+ }
2030+ while (0);
2031+ break;
2032+ }
2033+ }
2034+ while (0);
2035+ (U_f[0]) >>= (3);
2036+ }
2037+ _fex |= (0);
2038+ }
2039+ }
2040+ break;
2041+ case 1:
2042+ U_e = 0;
2043+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 0);
2044+ break;
2045+ case 2:
2046+ U_e = 32767;
2047+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 0);
2048+ break;
2049+ case 3:
2050+ U_e = 32767;
2051+ if (!1)
2052+ {
2053+ (U_f[3] =
2054+ ((((unsigned long) 1 << (113 - 2) % 32) << 1) - 1),
2055+ U_f[2] = -1, U_f[1] = -1, U_f[0] = -1);
2056+ U_s = 0;
2057+ }
2058+ else
2059+ (U_f[3]) |= ((unsigned long) 1 << (113 - 2) % 32);
2060+ break;
2061+ }
2062+ }
2063+ while (0);
2064+ do
2065+ {
2066+ union _FP_UNION_Q _flo;
2067+ _flo.bits.frac0 = U_f[0];
2068+ _flo.bits.frac1 = U_f[1];
2069+ _flo.bits.frac2 = U_f[2];
2070+ _flo.bits.frac3 = U_f[3];
2071+ _flo.bits.exp = U_e;
2072+ _flo.bits.sign = U_s;
2073+ (u) = _flo.flt;
2074+ }
2075+ while (0);
2076+ }
2077+ while (0);
2078+
2079+/* FP_HANDLE_EXCEPTIONS */
2080+ do
2081+ {
2082+ }
2083+ while (0);
2084+
2085+ /* Subtract. */
2086+/* FP_INIT_ROUNDMODE */
2087+ do
2088+ {
2089+ }
2090+ while (0);
2091+
2092+/* FP_UNPACK_SEMIRAW_Q(U,u) */
2093+ do
2094+ {
2095+ do
2096+ {
2097+ union _FP_UNION_Q _flo;
2098+ _flo.flt = (u);
2099+ U_f[0] = _flo.bits.frac0;
2100+ U_f[1] = _flo.bits.frac1;
2101+ U_f[2] = _flo.bits.frac2;
2102+ U_f[3] = _flo.bits.frac3;
2103+ U_e = _flo.bits.exp;
2104+ U_s = _flo.bits.sign;
2105+ }
2106+ while (0);
2107+ do
2108+ {
2109+ long _up, _down, _skip, _i;
2110+ _skip = (3) / 32;
2111+ _up = (3) % 32;
2112+ _down = 32 - _up;
2113+ if (!_up)
2114+ for (_i = 3; _i >= _skip; --_i)
2115+ U_f[_i] = U_f[_i - _skip];
2116+ else
2117+ {
2118+ for (_i = 3; _i > _skip; --_i)
2119+ U_f[_i] =
2120+ U_f[_i - _skip] << _up | U_f[_i - _skip - 1] >> _down;
2121+ U_f[_i--] = U_f[0] << _up;
2122+ }
2123+ for (; _i >= 0; --_i)
2124+ U_f[_i] = 0;
2125+ }
2126+ while (0);
2127+ }
2128+ while (0);
2129+
2130+/* FP_UNPACK_SEMIRAW_Q(Z,z) */
2131+ do
2132+ {
2133+ do
2134+ {
2135+ union _FP_UNION_Q _flo;
2136+ _flo.flt = (z);
2137+ Z_f[0] = _flo.bits.frac0;
2138+ Z_f[1] = _flo.bits.frac1;
2139+ Z_f[2] = _flo.bits.frac2;
2140+ Z_f[3] = _flo.bits.frac3;
2141+ Z_e = _flo.bits.exp;
2142+ Z_s = _flo.bits.sign;
2143+ }
2144+ while (0);
2145+ do
2146+ {
2147+ long _up, _down, _skip, _i;
2148+ _skip = (3) / 32;
2149+ _up = (3) % 32;
2150+ _down = 32 - _up;
2151+ if (!_up)
2152+ for (_i = 3; _i >= _skip; --_i)
2153+ Z_f[_i] = Z_f[_i - _skip];
2154+ else
2155+ {
2156+ for (_i = 3; _i > _skip; --_i)
2157+ Z_f[_i] =
2158+ Z_f[_i - _skip] << _up | Z_f[_i - _skip - 1] >> _down;
2159+ Z_f[_i--] = Z_f[0] << _up;
2160+ }
2161+ for (; _i >= 0; --_i)
2162+ Z_f[_i] = 0;
2163+ }
2164+ while (0);
2165+ }
2166+ while (0);
2167+
2168+/* FP_SUB_Q(V,U,Z) */
2169+ do
2170+ {
2171+ if (!(Z_e == 32767 && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0)))
2172+ Z_s ^= 1;
2173+ do
2174+ {
2175+ if (U_s == Z_s)
2176+ {
2177+ V_s = U_s;
2178+ int ediff = U_e - Z_e;
2179+ if (ediff > 0)
2180+ {
2181+ V_e = U_e;
2182+ if (Z_e == 0)
2183+ {
2184+ if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2185+ {
2186+ do
2187+ {
2188+ if (U_e == 32767
2189+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3]) ==
2190+ 0)
2191+ && !((U_f[3]) &
2192+ ((unsigned long) 1 << (113 - 2 + 3) %
2193+ 32)))
2194+ _fex |= (0);
2195+ }
2196+ while (0);
2197+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2198+ U_f[2], V_f[3] = U_f[3]);
2199+ goto add_done;
2200+ }
2201+ else
2202+ {
2203+ _fex |= (0);
2204+ ediff--;
2205+ if (ediff == 0)
2206+ {
2207+ do
2208+ {
2209+ unsigned long _c1, _c2, _c3;
2210+ V_f[0] = U_f[0] + Z_f[0];
2211+ _c1 = V_f[0] < U_f[0];
2212+ V_f[1] = U_f[1] + Z_f[1];
2213+ _c2 = V_f[1] < U_f[1];
2214+ V_f[1] += _c1;
2215+ _c2 |= V_f[1] < _c1;
2216+ V_f[2] = U_f[2] + Z_f[2];
2217+ _c3 = V_f[2] < U_f[2];
2218+ V_f[2] += _c2;
2219+ _c3 |= V_f[2] < _c2;
2220+ V_f[3] = U_f[3] + Z_f[3] + _c3;
2221+ }
2222+ while (0);
2223+ goto add3;
2224+ }
2225+ if (U_e == 32767)
2226+ {
2227+ do
2228+ {
2229+ if (U_e == 32767
2230+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3])
2231+ == 0)
2232+ && !((U_f[3]) &
2233+ ((unsigned long) 1 << (113 - 2 + 3)
2234+ % 32)))
2235+ _fex |= (0);
2236+ }
2237+ while (0);
2238+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2239+ U_f[2], V_f[3] = U_f[3]);
2240+ goto add_done;
2241+ }
2242+ goto add1;
2243+ }
2244+ }
2245+ else if (U_e == 32767)
2246+ {
2247+ do
2248+ {
2249+ if (U_e == 32767
2250+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0)
2251+ && !((U_f[3]) &
2252+ ((unsigned long) 1 << (113 - 2 + 3) % 32)))
2253+ _fex |= (0);
2254+ }
2255+ while (0);
2256+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2257+ U_f[2], V_f[3] = U_f[3]);
2258+ goto add_done;
2259+ }
2260+ (Z_f[3]) |= ((unsigned long) 1 << (113 - 1 + 3) % 32);
2261+ add1:if (ediff <= (3 + 113))
2262+ do
2263+ {
2264+ int _sticky;
2265+ do
2266+ {
2267+ long _up, _down, _skip, _i;
2268+ unsigned long _s;
2269+ _skip = (ediff) / 32;
2270+ _down = (ediff) % 32;
2271+ _up = 32 - _down;
2272+ for (_s = _i = 0; _i < _skip; ++_i)
2273+ _s |= Z_f[_i];
2274+ if (!_down)
2275+ for (_i = 0; _i <= 3 - _skip; ++_i)
2276+ Z_f[_i] = Z_f[_i + _skip];
2277+ else
2278+ {
2279+ _s |= Z_f[_i] << _up;
2280+ for (_i = 0; _i < 3 - _skip; ++_i)
2281+ Z_f[_i] =
2282+ Z_f[_i + _skip] >> _down | Z_f[_i +
2283+ _skip +
2284+ 1] << _up;
2285+ Z_f[_i++] = Z_f[3] >> _down;
2286+ }
2287+ for (; _i < 4; ++_i)
2288+ Z_f[_i] = 0;
2289+ _sticky = (_s != 0);
2290+ }
2291+ while (0);
2292+ Z_f[0] |= _sticky;
2293+ }
2294+ while (0);
2295+ else if (!((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2296+ (Z_f[3] = 0, Z_f[2] = 0, Z_f[1] = 0, Z_f[0] = 1);
2297+ do
2298+ {
2299+ unsigned long _c1, _c2, _c3;
2300+ V_f[0] = U_f[0] + Z_f[0];
2301+ _c1 = V_f[0] < U_f[0];
2302+ V_f[1] = U_f[1] + Z_f[1];
2303+ _c2 = V_f[1] < U_f[1];
2304+ V_f[1] += _c1;
2305+ _c2 |= V_f[1] < _c1;
2306+ V_f[2] = U_f[2] + Z_f[2];
2307+ _c3 = V_f[2] < U_f[2];
2308+ V_f[2] += _c2;
2309+ _c3 |= V_f[2] < _c2;
2310+ V_f[3] = U_f[3] + Z_f[3] + _c3;
2311+ }
2312+ while (0);
2313+ }
2314+ else if (ediff < 0)
2315+ {
2316+ ediff = -ediff;
2317+ V_e = Z_e;
2318+ if (U_e == 0)
2319+ {
2320+ if (((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
2321+ {
2322+ do
2323+ {
2324+ if (Z_e == 32767
2325+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) ==
2326+ 0)
2327+ && !((Z_f[3]) &
2328+ ((unsigned long) 1 << (113 - 2 + 3) %
2329+ 32)))
2330+ _fex |= (0);
2331+ }
2332+ while (0);
2333+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2334+ Z_f[2], V_f[3] = Z_f[3]);
2335+ goto add_done;
2336+ }
2337+ else
2338+ {
2339+ _fex |= (0);
2340+ ediff--;
2341+ if (ediff == 0)
2342+ {
2343+ do
2344+ {
2345+ unsigned long _c1, _c2, _c3;
2346+ V_f[0] = Z_f[0] + U_f[0];
2347+ _c1 = V_f[0] < Z_f[0];
2348+ V_f[1] = Z_f[1] + U_f[1];
2349+ _c2 = V_f[1] < Z_f[1];
2350+ V_f[1] += _c1;
2351+ _c2 |= V_f[1] < _c1;
2352+ V_f[2] = Z_f[2] + U_f[2];
2353+ _c3 = V_f[2] < Z_f[2];
2354+ V_f[2] += _c2;
2355+ _c3 |= V_f[2] < _c2;
2356+ V_f[3] = Z_f[3] + U_f[3] + _c3;
2357+ }
2358+ while (0);
2359+ goto add3;
2360+ }
2361+ if (Z_e == 32767)
2362+ {
2363+ do
2364+ {
2365+ if (Z_e == 32767
2366+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3])
2367+ == 0)
2368+ && !((Z_f[3]) &
2369+ ((unsigned long) 1 << (113 - 2 + 3)
2370+ % 32)))
2371+ _fex |= (0);
2372+ }
2373+ while (0);
2374+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2375+ Z_f[2], V_f[3] = Z_f[3]);
2376+ goto add_done;
2377+ }
2378+ goto add2;
2379+ }
2380+ }
2381+ else if (Z_e == 32767)
2382+ {
2383+ do
2384+ {
2385+ if (Z_e == 32767
2386+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0)
2387+ && !((Z_f[3]) &
2388+ ((unsigned long) 1 << (113 - 2 + 3) % 32)))
2389+ _fex |= (0);
2390+ }
2391+ while (0);
2392+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2393+ Z_f[2], V_f[3] = Z_f[3]);
2394+ goto add_done;
2395+ }
2396+ (U_f[3]) |= ((unsigned long) 1 << (113 - 1 + 3) % 32);
2397+ add2:if (ediff <= (3 + 113))
2398+ do
2399+ {
2400+ int _sticky;
2401+ do
2402+ {
2403+ long _up, _down, _skip, _i;
2404+ unsigned long _s;
2405+ _skip = (ediff) / 32;
2406+ _down = (ediff) % 32;
2407+ _up = 32 - _down;
2408+ for (_s = _i = 0; _i < _skip; ++_i)
2409+ _s |= U_f[_i];
2410+ if (!_down)
2411+ for (_i = 0; _i <= 3 - _skip; ++_i)
2412+ U_f[_i] = U_f[_i + _skip];
2413+ else
2414+ {
2415+ _s |= U_f[_i] << _up;
2416+ for (_i = 0; _i < 3 - _skip; ++_i)
2417+ U_f[_i] =
2418+ U_f[_i + _skip] >> _down | U_f[_i +
2419+ _skip +
2420+ 1] << _up;
2421+ U_f[_i++] = U_f[3] >> _down;
2422+ }
2423+ for (; _i < 4; ++_i)
2424+ U_f[_i] = 0;
2425+ _sticky = (_s != 0);
2426+ }
2427+ while (0);
2428+ U_f[0] |= _sticky;
2429+ }
2430+ while (0);
2431+ else if (!((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
2432+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 1);
2433+ do
2434+ {
2435+ unsigned long _c1, _c2, _c3;
2436+ V_f[0] = Z_f[0] + U_f[0];
2437+ _c1 = V_f[0] < Z_f[0];
2438+ V_f[1] = Z_f[1] + U_f[1];
2439+ _c2 = V_f[1] < Z_f[1];
2440+ V_f[1] += _c1;
2441+ _c2 |= V_f[1] < _c1;
2442+ V_f[2] = Z_f[2] + U_f[2];
2443+ _c3 = V_f[2] < Z_f[2];
2444+ V_f[2] += _c2;
2445+ _c3 |= V_f[2] < _c2;
2446+ V_f[3] = Z_f[3] + U_f[3] + _c3;
2447+ }
2448+ while (0);
2449+ }
2450+ else
2451+ {
2452+ if (!(((U_e + 1) & 32767) > 1))
2453+ {
2454+ if (U_e == 0)
2455+ {
2456+ V_e = 0;
2457+ if (((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
2458+ {
2459+ if (!((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2460+ _fex |= (0);
2461+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2462+ Z_f[2], V_f[3] = Z_f[3]);
2463+ goto add_done;
2464+ }
2465+ else if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2466+ {
2467+ _fex |= (0);
2468+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2469+ U_f[2], V_f[3] = U_f[3]);
2470+ goto add_done;
2471+ }
2472+ else
2473+ {
2474+ _fex |= (0);
2475+ do
2476+ {
2477+ unsigned long _c1, _c2, _c3;
2478+ V_f[0] = U_f[0] + Z_f[0];
2479+ _c1 = V_f[0] < U_f[0];
2480+ V_f[1] = U_f[1] + Z_f[1];
2481+ _c2 = V_f[1] < U_f[1];
2482+ V_f[1] += _c1;
2483+ _c2 |= V_f[1] < _c1;
2484+ V_f[2] = U_f[2] + Z_f[2];
2485+ _c3 = V_f[2] < U_f[2];
2486+ V_f[2] += _c2;
2487+ _c3 |= V_f[2] < _c2;
2488+ V_f[3] = U_f[3] + Z_f[3] + _c3;
2489+ }
2490+ while (0);
2491+ if ((V_f[3]) &
2492+ ((unsigned long) 1 << (113 - 1 + 3) % 32))
2493+ {
2494+ (V_f[3]) &=
2495+ ~(unsigned long) ((unsigned long) 1 <<
2496+ (113 - 1 + 3) % 32);
2497+ V_e = 1;
2498+ }
2499+ goto add_done;
2500+ }
2501+ }
2502+ else
2503+ {
2504+ do
2505+ {
2506+ if (U_e == 32767
2507+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3]) ==
2508+ 0)
2509+ && !((U_f[3]) &
2510+ ((unsigned long) 1 << (113 - 2 + 3) %
2511+ 32)))
2512+ _fex |= (0);
2513+ }
2514+ while (0);
2515+ do
2516+ {
2517+ if (Z_e == 32767
2518+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) ==
2519+ 0)
2520+ && !((Z_f[3]) &
2521+ ((unsigned long) 1 << (113 - 2 + 3) %
2522+ 32)))
2523+ _fex |= (0);
2524+ }
2525+ while (0);
2526+ V_e = 32767;
2527+ if (((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
2528+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2529+ Z_f[2], V_f[3] = Z_f[3]);
2530+ else if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2531+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2532+ U_f[2], V_f[3] = U_f[3]);
2533+ else
2534+ do
2535+ {
2536+ do
2537+ {
2538+ long _up, _down, _skip, _i;
2539+ _skip = (3) / 32;
2540+ _down = (3) % 32;
2541+ _up = 32 - _down;
2542+ if (!_down)
2543+ for (_i = 0; _i <= 3 - _skip; ++_i)
2544+ U_f[_i] = U_f[_i + _skip];
2545+ else
2546+ {
2547+ for (_i = 0; _i < 3 - _skip; ++_i)
2548+ U_f[_i] =
2549+ U_f[_i +
2550+ _skip] >> _down | U_f[_i +
2551+ _skip +
2552+ 1] <<
2553+ _up;
2554+ U_f[_i++] = U_f[3] >> _down;
2555+ }
2556+ for (; _i < 4; ++_i)
2557+ U_f[_i] = 0;
2558+ }
2559+ while (0);
2560+ do
2561+ {
2562+ long _up, _down, _skip, _i;
2563+ _skip = (3) / 32;
2564+ _down = (3) % 32;
2565+ _up = 32 - _down;
2566+ if (!_down)
2567+ for (_i = 0; _i <= 3 - _skip; ++_i)
2568+ Z_f[_i] = Z_f[_i + _skip];
2569+ else
2570+ {
2571+ for (_i = 0; _i < 3 - _skip; ++_i)
2572+ Z_f[_i] =
2573+ Z_f[_i +
2574+ _skip] >> _down | Z_f[_i +
2575+ _skip +
2576+ 1] <<
2577+ _up;
2578+ Z_f[_i++] = Z_f[3] >> _down;
2579+ }
2580+ for (; _i < 4; ++_i)
2581+ Z_f[_i] = 0;
2582+ }
2583+ while (0);
2584+ do
2585+ {
2586+ if (((U_f[3]) &
2587+ ((unsigned long) 1 << (113 - 2) %
2588+ 32))
2589+ && !((Z_f[3]) &
2590+ ((unsigned long) 1 << (113 - 2) %
2591+ 32)))
2592+ {
2593+ V_s = Z_s;
2594+ (V_f[0] = Z_f[0], V_f[1] =
2595+ Z_f[1], V_f[2] = Z_f[2], V_f[3] =
2596+ Z_f[3]);
2597+ }
2598+ else
2599+ {
2600+ V_s = U_s;
2601+ (V_f[0] = U_f[0], V_f[1] =
2602+ U_f[1], V_f[2] = U_f[2], V_f[3] =
2603+ U_f[3]);
2604+ }
2605+ V_c = 3;
2606+ }
2607+ while (0);
2608+ do
2609+ {
2610+ long _up, _down, _skip, _i;
2611+ _skip = (3) / 32;
2612+ _up = (3) % 32;
2613+ _down = 32 - _up;
2614+ if (!_up)
2615+ for (_i = 3; _i >= _skip; --_i)
2616+ V_f[_i] = V_f[_i - _skip];
2617+ else
2618+ {
2619+ for (_i = 3; _i > _skip; --_i)
2620+ V_f[_i] =
2621+ V_f[_i - _skip] << _up | V_f[_i -
2622+ _skip
2623+ -
2624+ 1] >>
2625+ _down;
2626+ V_f[_i--] = V_f[0] << _up;
2627+ }
2628+ for (; _i >= 0; --_i)
2629+ V_f[_i] = 0;
2630+ }
2631+ while (0);
2632+ }
2633+ while (0);
2634+ goto add_done;
2635+ }
2636+ }
2637+ do
2638+ {
2639+ unsigned long _c1, _c2, _c3;
2640+ V_f[0] = U_f[0] + Z_f[0];
2641+ _c1 = V_f[0] < U_f[0];
2642+ V_f[1] = U_f[1] + Z_f[1];
2643+ _c2 = V_f[1] < U_f[1];
2644+ V_f[1] += _c1;
2645+ _c2 |= V_f[1] < _c1;
2646+ V_f[2] = U_f[2] + Z_f[2];
2647+ _c3 = V_f[2] < U_f[2];
2648+ V_f[2] += _c2;
2649+ _c3 |= V_f[2] < _c2;
2650+ V_f[3] = U_f[3] + Z_f[3] + _c3;
2651+ }
2652+ while (0);
2653+ V_e = U_e + 1;
2654+ do
2655+ {
2656+ int _sticky;
2657+ do
2658+ {
2659+ long _up, _down, _skip, _i;
2660+ unsigned long _s;
2661+ _skip = (1) / 32;
2662+ _down = (1) % 32;
2663+ _up = 32 - _down;
2664+ for (_s = _i = 0; _i < _skip; ++_i)
2665+ _s |= V_f[_i];
2666+ if (!_down)
2667+ for (_i = 0; _i <= 3 - _skip; ++_i)
2668+ V_f[_i] = V_f[_i + _skip];
2669+ else
2670+ {
2671+ _s |= V_f[_i] << _up;
2672+ for (_i = 0; _i < 3 - _skip; ++_i)
2673+ V_f[_i] =
2674+ V_f[_i + _skip] >> _down | V_f[_i + _skip +
2675+ 1] << _up;
2676+ V_f[_i++] = V_f[3] >> _down;
2677+ }
2678+ for (; _i < 4; ++_i)
2679+ V_f[_i] = 0;
2680+ _sticky = (_s != 0);
2681+ }
2682+ while (0);
2683+ V_f[0] |= _sticky;
2684+ }
2685+ while (0);
2686+ if (V_e == 32767)
2687+ do
2688+ {
2689+ if (0 == 0 || (0 == 2 && !V_s) || (0 == 3 && V_s))
2690+ {
2691+ V_e = 32767;
2692+ (V_f[3] = 0, V_f[2] = 0, V_f[1] = 0, V_f[0] = 0);
2693+ }
2694+ else
2695+ {
2696+ V_e = 32767 - 1;
2697+ _fex |= (0);
2698+ _fex |= (0);
2699+ (V_f[3] = (~(signed long) 0), V_f[2] =
2700+ (~(signed long) 0), V_f[1] =
2701+ (~(signed long) 0), V_f[0] = (~(signed long) 0));
2702+ }
2703+ }
2704+ while (0);
2705+ goto add_done;
2706+ }
2707+ add3:if ((V_f[3]) &
2708+ ((unsigned long) 1 << (113 - 1 + 3) % 32))
2709+ {
2710+ (V_f[3]) &=
2711+ ~(unsigned long) ((unsigned long) 1 << (113 - 1 + 3) %
2712+ 32);
2713+ V_e++;
2714+ do
2715+ {
2716+ int _sticky;
2717+ do
2718+ {
2719+ long _up, _down, _skip, _i;
2720+ unsigned long _s;
2721+ _skip = (1) / 32;
2722+ _down = (1) % 32;
2723+ _up = 32 - _down;
2724+ for (_s = _i = 0; _i < _skip; ++_i)
2725+ _s |= V_f[_i];
2726+ if (!_down)
2727+ for (_i = 0; _i <= 3 - _skip; ++_i)
2728+ V_f[_i] = V_f[_i + _skip];
2729+ else
2730+ {
2731+ _s |= V_f[_i] << _up;
2732+ for (_i = 0; _i < 3 - _skip; ++_i)
2733+ V_f[_i] =
2734+ V_f[_i + _skip] >> _down | V_f[_i + _skip +
2735+ 1] << _up;
2736+ V_f[_i++] = V_f[3] >> _down;
2737+ }
2738+ for (; _i < 4; ++_i)
2739+ V_f[_i] = 0;
2740+ _sticky = (_s != 0);
2741+ }
2742+ while (0);
2743+ V_f[0] |= _sticky;
2744+ }
2745+ while (0);
2746+ if (V_e == 32767)
2747+ do
2748+ {
2749+ if (0 == 0 || (0 == 2 && !V_s) || (0 == 3 && V_s))
2750+ {
2751+ V_e = 32767;
2752+ (V_f[3] = 0, V_f[2] = 0, V_f[1] = 0, V_f[0] = 0);
2753+ }
2754+ else
2755+ {
2756+ V_e = 32767 - 1;
2757+ _fex |= (0);
2758+ _fex |= (0);
2759+ (V_f[3] = (~(signed long) 0), V_f[2] =
2760+ (~(signed long) 0), V_f[1] =
2761+ (~(signed long) 0), V_f[0] = (~(signed long) 0));
2762+ }
2763+ }
2764+ while (0);
2765+ }
2766+ add_done:;
2767+ }
2768+ else
2769+ {
2770+ int ediff = U_e - Z_e;
2771+ if (ediff > 0)
2772+ {
2773+ V_e = U_e;
2774+ V_s = U_s;
2775+ if (Z_e == 0)
2776+ {
2777+ if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2778+ {
2779+ do
2780+ {
2781+ if (U_e == 32767
2782+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3]) ==
2783+ 0)
2784+ && !((U_f[3]) &
2785+ ((unsigned long) 1 << (113 - 2 + 3) %
2786+ 32)))
2787+ _fex |= (0);
2788+ }
2789+ while (0);
2790+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2791+ U_f[2], V_f[3] = U_f[3]);
2792+ goto sub_done;
2793+ }
2794+ else
2795+ {
2796+ _fex |= (0);
2797+ ediff--;
2798+ if (ediff == 0)
2799+ {
2800+ do
2801+ {
2802+ unsigned long _c1, _c2, _c3;
2803+ V_f[0] = U_f[0] - Z_f[0];
2804+ _c1 = V_f[0] > U_f[0];
2805+ V_f[1] = U_f[1] - Z_f[1];
2806+ _c2 = V_f[1] > U_f[1];
2807+ V_f[1] -= _c1;
2808+ _c2 |= _c1 && (Z_f[1] == U_f[1]);
2809+ V_f[2] = U_f[2] - Z_f[2];
2810+ _c3 = V_f[2] > U_f[2];
2811+ V_f[2] -= _c2;
2812+ _c3 |= _c2 && (Z_f[2] == U_f[2]);
2813+ V_f[3] = U_f[3] - Z_f[3] - _c3;
2814+ }
2815+ while (0);
2816+ goto sub3;
2817+ }
2818+ if (U_e == 32767)
2819+ {
2820+ do
2821+ {
2822+ if (U_e == 32767
2823+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3])
2824+ == 0)
2825+ && !((U_f[3]) &
2826+ ((unsigned long) 1 << (113 - 2 + 3)
2827+ % 32)))
2828+ _fex |= (0);
2829+ }
2830+ while (0);
2831+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2832+ U_f[2], V_f[3] = U_f[3]);
2833+ goto sub_done;
2834+ }
2835+ goto sub1;
2836+ }
2837+ }
2838+ else if (U_e == 32767)
2839+ {
2840+ do
2841+ {
2842+ if (U_e == 32767
2843+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0)
2844+ && !((U_f[3]) &
2845+ ((unsigned long) 1 << (113 - 2 + 3) % 32)))
2846+ _fex |= (0);
2847+ }
2848+ while (0);
2849+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
2850+ U_f[2], V_f[3] = U_f[3]);
2851+ goto sub_done;
2852+ }
2853+ (Z_f[3]) |= ((unsigned long) 1 << (113 - 1 + 3) % 32);
2854+ sub1:if (ediff <= (3 + 113))
2855+ do
2856+ {
2857+ int _sticky;
2858+ do
2859+ {
2860+ long _up, _down, _skip, _i;
2861+ unsigned long _s;
2862+ _skip = (ediff) / 32;
2863+ _down = (ediff) % 32;
2864+ _up = 32 - _down;
2865+ for (_s = _i = 0; _i < _skip; ++_i)
2866+ _s |= Z_f[_i];
2867+ if (!_down)
2868+ for (_i = 0; _i <= 3 - _skip; ++_i)
2869+ Z_f[_i] = Z_f[_i + _skip];
2870+ else
2871+ {
2872+ _s |= Z_f[_i] << _up;
2873+ for (_i = 0; _i < 3 - _skip; ++_i)
2874+ Z_f[_i] =
2875+ Z_f[_i + _skip] >> _down | Z_f[_i +
2876+ _skip +
2877+ 1] << _up;
2878+ Z_f[_i++] = Z_f[3] >> _down;
2879+ }
2880+ for (; _i < 4; ++_i)
2881+ Z_f[_i] = 0;
2882+ _sticky = (_s != 0);
2883+ }
2884+ while (0);
2885+ Z_f[0] |= _sticky;
2886+ }
2887+ while (0);
2888+ else if (!((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
2889+ (Z_f[3] = 0, Z_f[2] = 0, Z_f[1] = 0, Z_f[0] = 1);
2890+ do
2891+ {
2892+ unsigned long _c1, _c2, _c3;
2893+ V_f[0] = U_f[0] - Z_f[0];
2894+ _c1 = V_f[0] > U_f[0];
2895+ V_f[1] = U_f[1] - Z_f[1];
2896+ _c2 = V_f[1] > U_f[1];
2897+ V_f[1] -= _c1;
2898+ _c2 |= _c1 && (Z_f[1] == U_f[1]);
2899+ V_f[2] = U_f[2] - Z_f[2];
2900+ _c3 = V_f[2] > U_f[2];
2901+ V_f[2] -= _c2;
2902+ _c3 |= _c2 && (Z_f[2] == U_f[2]);
2903+ V_f[3] = U_f[3] - Z_f[3] - _c3;
2904+ }
2905+ while (0);
2906+ }
2907+ else if (ediff < 0)
2908+ {
2909+ ediff = -ediff;
2910+ V_e = Z_e;
2911+ V_s = Z_s;
2912+ if (U_e == 0)
2913+ {
2914+ if (((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
2915+ {
2916+ do
2917+ {
2918+ if (Z_e == 32767
2919+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) ==
2920+ 0)
2921+ && !((Z_f[3]) &
2922+ ((unsigned long) 1 << (113 - 2 + 3) %
2923+ 32)))
2924+ _fex |= (0);
2925+ }
2926+ while (0);
2927+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2928+ Z_f[2], V_f[3] = Z_f[3]);
2929+ goto sub_done;
2930+ }
2931+ else
2932+ {
2933+ _fex |= (0);
2934+ ediff--;
2935+ if (ediff == 0)
2936+ {
2937+ do
2938+ {
2939+ unsigned long _c1, _c2, _c3;
2940+ V_f[0] = Z_f[0] - U_f[0];
2941+ _c1 = V_f[0] > Z_f[0];
2942+ V_f[1] = Z_f[1] - U_f[1];
2943+ _c2 = V_f[1] > Z_f[1];
2944+ V_f[1] -= _c1;
2945+ _c2 |= _c1 && (U_f[1] == Z_f[1]);
2946+ V_f[2] = Z_f[2] - U_f[2];
2947+ _c3 = V_f[2] > Z_f[2];
2948+ V_f[2] -= _c2;
2949+ _c3 |= _c2 && (U_f[2] == Z_f[2]);
2950+ V_f[3] = Z_f[3] - U_f[3] - _c3;
2951+ }
2952+ while (0);
2953+ goto sub3;
2954+ }
2955+ if (Z_e == 32767)
2956+ {
2957+ do
2958+ {
2959+ if (Z_e == 32767
2960+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3])
2961+ == 0)
2962+ && !((Z_f[3]) &
2963+ ((unsigned long) 1 << (113 - 2 + 3)
2964+ % 32)))
2965+ _fex |= (0);
2966+ }
2967+ while (0);
2968+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2969+ Z_f[2], V_f[3] = Z_f[3]);
2970+ goto sub_done;
2971+ }
2972+ goto sub2;
2973+ }
2974+ }
2975+ else if (Z_e == 32767)
2976+ {
2977+ do
2978+ {
2979+ if (Z_e == 32767
2980+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0)
2981+ && !((Z_f[3]) &
2982+ ((unsigned long) 1 << (113 - 2 + 3) % 32)))
2983+ _fex |= (0);
2984+ }
2985+ while (0);
2986+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
2987+ Z_f[2], V_f[3] = Z_f[3]);
2988+ goto sub_done;
2989+ }
2990+ (U_f[3]) |= ((unsigned long) 1 << (113 - 1 + 3) % 32);
2991+ sub2:if (ediff <= (3 + 113))
2992+ do
2993+ {
2994+ int _sticky;
2995+ do
2996+ {
2997+ long _up, _down, _skip, _i;
2998+ unsigned long _s;
2999+ _skip = (ediff) / 32;
3000+ _down = (ediff) % 32;
3001+ _up = 32 - _down;
3002+ for (_s = _i = 0; _i < _skip; ++_i)
3003+ _s |= U_f[_i];
3004+ if (!_down)
3005+ for (_i = 0; _i <= 3 - _skip; ++_i)
3006+ U_f[_i] = U_f[_i + _skip];
3007+ else
3008+ {
3009+ _s |= U_f[_i] << _up;
3010+ for (_i = 0; _i < 3 - _skip; ++_i)
3011+ U_f[_i] =
3012+ U_f[_i + _skip] >> _down | U_f[_i +
3013+ _skip +
3014+ 1] << _up;
3015+ U_f[_i++] = U_f[3] >> _down;
3016+ }
3017+ for (; _i < 4; ++_i)
3018+ U_f[_i] = 0;
3019+ _sticky = (_s != 0);
3020+ }
3021+ while (0);
3022+ U_f[0] |= _sticky;
3023+ }
3024+ while (0);
3025+ else if (!((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
3026+ (U_f[3] = 0, U_f[2] = 0, U_f[1] = 0, U_f[0] = 1);
3027+ do
3028+ {
3029+ unsigned long _c1, _c2, _c3;
3030+ V_f[0] = Z_f[0] - U_f[0];
3031+ _c1 = V_f[0] > Z_f[0];
3032+ V_f[1] = Z_f[1] - U_f[1];
3033+ _c2 = V_f[1] > Z_f[1];
3034+ V_f[1] -= _c1;
3035+ _c2 |= _c1 && (U_f[1] == Z_f[1]);
3036+ V_f[2] = Z_f[2] - U_f[2];
3037+ _c3 = V_f[2] > Z_f[2];
3038+ V_f[2] -= _c2;
3039+ _c3 |= _c2 && (U_f[2] == Z_f[2]);
3040+ V_f[3] = Z_f[3] - U_f[3] - _c3;
3041+ }
3042+ while (0);
3043+ }
3044+ else
3045+ {
3046+ if (!(((U_e + 1) & 32767) > 1))
3047+ {
3048+ if (U_e == 0)
3049+ {
3050+ V_e = 0;
3051+ if (((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
3052+ {
3053+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
3054+ Z_f[2], V_f[3] = Z_f[3]);
3055+ if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
3056+ V_s = (0 == 3);
3057+ else
3058+ {
3059+ _fex |= (0);
3060+ V_s = Z_s;
3061+ }
3062+ goto sub_done;
3063+ }
3064+ else if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
3065+ {
3066+ _fex |= (0);
3067+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
3068+ U_f[2], V_f[3] = U_f[3]);
3069+ V_s = U_s;
3070+ goto sub_done;
3071+ }
3072+ else
3073+ {
3074+ _fex |= (0);
3075+ do
3076+ {
3077+ unsigned long _c1, _c2, _c3;
3078+ V_f[0] = U_f[0] - Z_f[0];
3079+ _c1 = V_f[0] > U_f[0];
3080+ V_f[1] = U_f[1] - Z_f[1];
3081+ _c2 = V_f[1] > U_f[1];
3082+ V_f[1] -= _c1;
3083+ _c2 |= _c1 && (Z_f[1] == U_f[1]);
3084+ V_f[2] = U_f[2] - Z_f[2];
3085+ _c3 = V_f[2] > U_f[2];
3086+ V_f[2] -= _c2;
3087+ _c3 |= _c2 && (Z_f[2] == U_f[2]);
3088+ V_f[3] = U_f[3] - Z_f[3] - _c3;
3089+ }
3090+ while (0);
3091+ V_s = U_s;
3092+ if ((V_f[3]) &
3093+ ((unsigned long) 1 << (113 - 1 + 3) % 32))
3094+ {
3095+ do
3096+ {
3097+ unsigned long _c1, _c2, _c3;
3098+ V_f[0] = Z_f[0] - U_f[0];
3099+ _c1 = V_f[0] > Z_f[0];
3100+ V_f[1] = Z_f[1] - U_f[1];
3101+ _c2 = V_f[1] > Z_f[1];
3102+ V_f[1] -= _c1;
3103+ _c2 |= _c1 && (U_f[1] == Z_f[1]);
3104+ V_f[2] = Z_f[2] - U_f[2];
3105+ _c3 = V_f[2] > Z_f[2];
3106+ V_f[2] -= _c2;
3107+ _c3 |= _c2 && (U_f[2] == Z_f[2]);
3108+ V_f[3] = Z_f[3] - U_f[3] - _c3;
3109+ }
3110+ while (0);
3111+ V_s = Z_s;
3112+ }
3113+ else
3114+ if (((V_f[0] | V_f[1] | V_f[2] | V_f[3]) ==
3115+ 0))
3116+ V_s = (0 == 3);
3117+ goto sub_done;
3118+ }
3119+ }
3120+ else
3121+ {
3122+ do
3123+ {
3124+ if (U_e == 32767
3125+ && !((U_f[0] | U_f[1] | U_f[2] | U_f[3]) ==
3126+ 0)
3127+ && !((U_f[3]) &
3128+ ((unsigned long) 1 << (113 - 2 + 3) %
3129+ 32)))
3130+ _fex |= (0);
3131+ }
3132+ while (0);
3133+ do
3134+ {
3135+ if (Z_e == 32767
3136+ && !((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) ==
3137+ 0)
3138+ && !((Z_f[3]) &
3139+ ((unsigned long) 1 << (113 - 2 + 3) %
3140+ 32)))
3141+ _fex |= (0);
3142+ }
3143+ while (0);
3144+ V_e = 32767;
3145+ if (((U_f[0] | U_f[1] | U_f[2] | U_f[3]) == 0))
3146+ {
3147+ if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
3148+ {
3149+ V_s = 0;
3150+ (V_f[3] =
3151+ ((((unsigned long) 1 << (113 - 2) %
3152+ 32) << 1) - 1), V_f[2] = -1, V_f[1] =
3153+ -1, V_f[0] = -1);
3154+ do
3155+ {
3156+ long _up, _down, _skip, _i;
3157+ _skip = (3) / 32;
3158+ _up = (3) % 32;
3159+ _down = 32 - _up;
3160+ if (!_up)
3161+ for (_i = 3; _i >= _skip; --_i)
3162+ V_f[_i] = V_f[_i - _skip];
3163+ else
3164+ {
3165+ for (_i = 3; _i > _skip; --_i)
3166+ V_f[_i] =
3167+ V_f[_i -
3168+ _skip] << _up | V_f[_i -
3169+ _skip -
3170+ 1] >>
3171+ _down;
3172+ V_f[_i--] = V_f[0] << _up;
3173+ }
3174+ for (; _i >= 0; --_i)
3175+ V_f[_i] = 0;
3176+ }
3177+ while (0);
3178+ _fex |= (0);
3179+ }
3180+ else
3181+ {
3182+ V_s = Z_s;
3183+ (V_f[0] = Z_f[0], V_f[1] = Z_f[1], V_f[2] =
3184+ Z_f[2], V_f[3] = Z_f[3]);
3185+ }
3186+ }
3187+ else
3188+ {
3189+ if (((Z_f[0] | Z_f[1] | Z_f[2] | Z_f[3]) == 0))
3190+ {
3191+ V_s = U_s;
3192+ (V_f[0] = U_f[0], V_f[1] = U_f[1], V_f[2] =
3193+ U_f[2], V_f[3] = U_f[3]);
3194+ }
3195+ else
3196+ {
3197+ do
3198+ {
3199+ do
3200+ {
3201+ long _up, _down, _skip, _i;
3202+ _skip = (3) / 32;
3203+ _down = (3) % 32;
3204+ _up = 32 - _down;
3205+ if (!_down)
3206+ for (_i = 0; _i <= 3 - _skip;
3207+ ++_i)
3208+ U_f[_i] = U_f[_i + _skip];
3209+ else
3210+ {
3211+ for (_i = 0; _i < 3 - _skip;
3212+ ++_i)
3213+ U_f[_i] =
3214+ U_f[_i +
3215+ _skip] >> _down | U_f[_i
3216+ +
3217+ _skip
3218+ +
3219+ 1]
3220+ << _up;
3221+ U_f[_i++] = U_f[3] >> _down;
3222+ }
3223+ for (; _i < 4; ++_i)
3224+ U_f[_i] = 0;
3225+ }
3226+ while (0);
3227+ do
3228+ {
3229+ long _up, _down, _skip, _i;
3230+ _skip = (3) / 32;
3231+ _down = (3) % 32;
3232+ _up = 32 - _down;
3233+ if (!_down)
3234+ for (_i = 0; _i <= 3 - _skip;
3235+ ++_i)
3236+ Z_f[_i] = Z_f[_i + _skip];
3237+ else
3238+ {
3239+ for (_i = 0; _i < 3 - _skip;
3240+ ++_i)
3241+ Z_f[_i] =
3242+ Z_f[_i +
3243+ _skip] >> _down | Z_f[_i
3244+ +
3245+ _skip
3246+ +
3247+ 1]
3248+ << _up;
3249+ Z_f[_i++] = Z_f[3] >> _down;
3250+ }
3251+ for (; _i < 4; ++_i)
3252+ Z_f[_i] = 0;
3253+ }
3254+ while (0);
3255+ do
3256+ {
3257+ if (((U_f[3]) &
3258+ ((unsigned long) 1 << (113 - 2)
3259+ % 32))
3260+ && !((Z_f[3]) &
3261+ ((unsigned long) 1 <<
3262+ (113 - 2) % 32)))
3263+ {
3264+ V_s = Z_s;
3265+ (V_f[0] = Z_f[0], V_f[1] =
3266+ Z_f[1], V_f[2] =
3267+ Z_f[2], V_f[3] = Z_f[3]);
3268+ }
3269+ else
3270+ {
3271+ V_s = U_s;
3272+ (V_f[0] = U_f[0], V_f[1] =
3273+ U_f[1], V_f[2] =
3274+ U_f[2], V_f[3] = U_f[3]);
3275+ }
3276+ V_c = 3;
3277+ }
3278+ while (0);
3279+ do
3280+ {
3281+ long _up, _down, _skip, _i;
3282+ _skip = (3) / 32;
3283+ _up = (3) % 32;
3284+ _down = 32 - _up;
3285+ if (!_up)
3286+ for (_i = 3; _i >= _skip; --_i)
3287+ V_f[_i] = V_f[_i - _skip];
3288+ else
3289+ {
3290+ for (_i = 3; _i > _skip; --_i)
3291+ V_f[_i] =
3292+ V_f[_i -
3293+ _skip] << _up | V_f[_i -
3294+ _skip
3295+ -
3296+ 1]
3297+ >> _down;
3298+ V_f[_i--] = V_f[0] << _up;
3299+ }
3300+ for (; _i >= 0; --_i)
3301+ V_f[_i] = 0;
3302+ }
3303+ while (0);
3304+ }
3305+ while (0);
3306+ }
3307+ }
3308+ goto sub_done;
3309+ }
3310+ }
3311+ V_e = U_e;
3312+ do
3313+ {
3314+ unsigned long _c1, _c2, _c3;
3315+ V_f[0] = U_f[0] - Z_f[0];
3316+ _c1 = V_f[0] > U_f[0];
3317+ V_f[1] = U_f[1] - Z_f[1];
3318+ _c2 = V_f[1] > U_f[1];
3319+ V_f[1] -= _c1;
3320+ _c2 |= _c1 && (Z_f[1] == U_f[1]);
3321+ V_f[2] = U_f[2] - Z_f[2];
3322+ _c3 = V_f[2] > U_f[2];
3323+ V_f[2] -= _c2;
3324+ _c3 |= _c2 && (Z_f[2] == U_f[2]);
3325+ V_f[3] = U_f[3] - Z_f[3] - _c3;
3326+ }
3327+ while (0);
3328+ V_s = U_s;
3329+ if ((V_f[3]) & ((unsigned long) 1 << (113 - 1 + 3) % 32))
3330+ {
3331+ do
3332+ {
3333+ unsigned long _c1, _c2, _c3;
3334+ V_f[0] = Z_f[0] - U_f[0];
3335+ _c1 = V_f[0] > Z_f[0];
3336+ V_f[1] = Z_f[1] - U_f[1];
3337+ _c2 = V_f[1] > Z_f[1];
3338+ V_f[1] -= _c1;
3339+ _c2 |= _c1 && (U_f[1] == Z_f[1]);
3340+ V_f[2] = Z_f[2] - U_f[2];
3341+ _c3 = V_f[2] > Z_f[2];
3342+ V_f[2] -= _c2;
3343+ _c3 |= _c2 && (U_f[2] == Z_f[2]);
3344+ V_f[3] = Z_f[3] - U_f[3] - _c3;
3345+ }
3346+ while (0);
3347+ V_s = Z_s;
3348+ }
3349+ else if (((V_f[0] | V_f[1] | V_f[2] | V_f[3]) == 0))
3350+ {
3351+ V_e = 0;
3352+ V_s = (0 == 3);
3353+ goto sub_done;
3354+ }
3355+ goto norm;
3356+ }
3357+ sub3:if ((V_f[3]) &
3358+ ((unsigned long) 1 << (113 - 1 + 3) % 32))
3359+ {
3360+ int diff;
3361+ (V_f[3]) &= ((unsigned long) 1 << (113 - 1 + 3) % 32) - 1;
3362+ norm:do
3363+ {
3364+ if (V_f[3])
3365+ {
3366+ do
3367+ {
3368+ if (sizeof (unsigned long) ==
3369+ sizeof (unsigned int))
3370+ diff = __builtin_clz (V_f[3]);
3371+ else if (sizeof (unsigned long) ==
3372+ sizeof (unsigned long))
3373+ diff = __builtin_clzl (V_f[3]);
3374+ else if (sizeof (unsigned long) ==
3375+ sizeof (unsigned long long))
3376+ diff = __builtin_clzll (V_f[3]);
3377+ else
3378+ abort ();
3379+ }
3380+ while (0);
3381+ }
3382+ else if (V_f[2])
3383+ {
3384+ do
3385+ {
3386+ if (sizeof (unsigned long) ==
3387+ sizeof (unsigned int))
3388+ diff = __builtin_clz (V_f[2]);
3389+ else if (sizeof (unsigned long) ==
3390+ sizeof (unsigned long))
3391+ diff = __builtin_clzl (V_f[2]);
3392+ else if (sizeof (unsigned long) ==
3393+ sizeof (unsigned long long))
3394+ diff = __builtin_clzll (V_f[2]);
3395+ else
3396+ abort ();
3397+ }
3398+ while (0);
3399+ diff += 32;
3400+ }
3401+ else if (V_f[1])
3402+ {
3403+ do
3404+ {
3405+ if (sizeof (unsigned long) ==
3406+ sizeof (unsigned int))
3407+ diff = __builtin_clz (V_f[1]);
3408+ else if (sizeof (unsigned long) ==
3409+ sizeof (unsigned long))
3410+ diff = __builtin_clzl (V_f[1]);
3411+ else if (sizeof (unsigned long) ==
3412+ sizeof (unsigned long long))
3413+ diff = __builtin_clzll (V_f[1]);
3414+ else
3415+ abort ();
3416+ }
3417+ while (0);
3418+ diff += 32 * 2;
3419+ }
3420+ else
3421+ {
3422+ do
3423+ {
3424+ if (sizeof (unsigned long) ==
3425+ sizeof (unsigned int))
3426+ diff = __builtin_clz (V_f[0]);
3427+ else if (sizeof (unsigned long) ==
3428+ sizeof (unsigned long))
3429+ diff = __builtin_clzl (V_f[0]);
3430+ else if (sizeof (unsigned long) ==
3431+ sizeof (unsigned long long))
3432+ diff = __builtin_clzll (V_f[0]);
3433+ else
3434+ abort ();
3435+ }
3436+ while (0);
3437+ diff += 32 * 3;
3438+ }
3439+ }
3440+ while (0);
3441+ diff -= ((4 * 32) - (3 + 113));
3442+ do
3443+ {
3444+ long _up, _down, _skip, _i;
3445+ _skip = (diff) / 32;
3446+ _up = (diff) % 32;
3447+ _down = 32 - _up;
3448+ if (!_up)
3449+ for (_i = 3; _i >= _skip; --_i)
3450+ V_f[_i] = V_f[_i - _skip];
3451+ else
3452+ {
3453+ for (_i = 3; _i > _skip; --_i)
3454+ V_f[_i] =
3455+ V_f[_i - _skip] << _up | V_f[_i - _skip -
3456+ 1] >> _down;
3457+ V_f[_i--] = V_f[0] << _up;
3458+ }
3459+ for (; _i >= 0; --_i)
3460+ V_f[_i] = 0;
3461+ }
3462+ while (0);
3463+ if (V_e <= diff)
3464+ {
3465+ diff = diff - V_e + 1;
3466+ do
3467+ {
3468+ int _sticky;
3469+ do
3470+ {
3471+ long _up, _down, _skip, _i;
3472+ unsigned long _s;
3473+ _skip = (diff) / 32;
3474+ _down = (diff) % 32;
3475+ _up = 32 - _down;
3476+ for (_s = _i = 0; _i < _skip; ++_i)
3477+ _s |= V_f[_i];
3478+ if (!_down)
3479+ for (_i = 0; _i <= 3 - _skip; ++_i)
3480+ V_f[_i] = V_f[_i + _skip];
3481+ else
3482+ {
3483+ _s |= V_f[_i] << _up;
3484+ for (_i = 0; _i < 3 - _skip; ++_i)
3485+ V_f[_i] =
3486+ V_f[_i + _skip] >> _down | V_f[_i +
3487+ _skip +
3488+ 1] <<
3489+ _up;
3490+ V_f[_i++] = V_f[3] >> _down;
3491+ }
3492+ for (; _i < 4; ++_i)
3493+ V_f[_i] = 0;
3494+ _sticky = (_s != 0);
3495+ }
3496+ while (0);
3497+ V_f[0] |= _sticky;
3498+ }
3499+ while (0);
3500+ V_e = 0;
3501+ }
3502+ else
3503+ {
3504+ V_e -= diff;
3505+ (V_f[3]) &=
3506+ ~(unsigned long) ((unsigned long) 1 << (113 - 1 + 3) %
3507+ 32);
3508+ }
3509+ }
3510+ sub_done:;
3511+ }
3512+ }
3513+ while (0);
3514+ }
3515+ while (0);
3516+
3517+/* FP_PACK_SEMIRAW_Q(v,V) */
3518+ do
3519+ {
3520+ do
3521+ {
3522+ do
3523+ {
3524+ if ((V_f[0]) & 7)
3525+ _fex |= (0);
3526+ switch (0)
3527+ {
3528+ case 0:
3529+ do
3530+ {
3531+ if (((V_f[0]) & 15) != ((unsigned long) 1 << 2))
3532+ do
3533+ {
3534+ unsigned long _t;
3535+ _t =
3536+ ((V_f[0] +=
3537+ ((unsigned long) 1 << 2)) <
3538+ ((unsigned long) 1 << 2));
3539+ V_f[1] += _t;
3540+ _t = (V_f[1] < _t);
3541+ V_f[2] += _t;
3542+ _t = (V_f[2] < _t);
3543+ V_f[3] += _t;
3544+ }
3545+ while (0);
3546+ }
3547+ while (0);
3548+ break;
3549+ case 1:
3550+ (void) 0;
3551+ break;
3552+ case 2:
3553+ do
3554+ {
3555+ if (!V_s && ((V_f[0]) & 7))
3556+ do
3557+ {
3558+ unsigned long _t;
3559+ _t =
3560+ ((V_f[0] +=
3561+ ((unsigned long) 1 << 3)) <
3562+ ((unsigned long) 1 << 3));
3563+ V_f[1] += _t;
3564+ _t = (V_f[1] < _t);
3565+ V_f[2] += _t;
3566+ _t = (V_f[2] < _t);
3567+ V_f[3] += _t;
3568+ }
3569+ while (0);
3570+ }
3571+ while (0);
3572+ break;
3573+ case 3:
3574+ do
3575+ {
3576+ if (V_s && ((V_f[0]) & 7))
3577+ do
3578+ {
3579+ unsigned long _t;
3580+ _t =
3581+ ((V_f[0] +=
3582+ ((unsigned long) 1 << 3)) <
3583+ ((unsigned long) 1 << 3));
3584+ V_f[1] += _t;
3585+ _t = (V_f[1] < _t);
3586+ V_f[2] += _t;
3587+ _t = (V_f[2] < _t);
3588+ V_f[3] += _t;
3589+ }
3590+ while (0);
3591+ }
3592+ while (0);
3593+ break;
3594+ }
3595+ }
3596+ while (0);
3597+ if ((V_f[3]) & (((unsigned long) 1 << ((3 + 113) % 32)) >> 1))
3598+ {
3599+ (V_f[3]) &= ~(((unsigned long) 1 << ((3 + 113) % 32)) >> 1);
3600+ V_e++;
3601+ if (V_e == 32767)
3602+ do
3603+ {
3604+ if (0 == 0 || (0 == 2 && !V_s) || (0 == 3 && V_s))
3605+ {
3606+ V_e = 32767;
3607+ (V_f[3] = 0, V_f[2] = 0, V_f[1] = 0, V_f[0] = 0);
3608+ }
3609+ else
3610+ {
3611+ V_e = 32767 - 1;
3612+ _fex |= (0);
3613+ _fex |= (0);
3614+ (V_f[3] = (~(signed long) 0), V_f[2] =
3615+ (~(signed long) 0), V_f[1] =
3616+ (~(signed long) 0), V_f[0] = (~(signed long) 0));
3617+ }
3618+ }
3619+ while (0);
3620+ }
3621+ do
3622+ {
3623+ long _up, _down, _skip, _i;
3624+ _skip = (3) / 32;
3625+ _down = (3) % 32;
3626+ _up = 32 - _down;
3627+ if (!_down)
3628+ for (_i = 0; _i <= 3 - _skip; ++_i)
3629+ V_f[_i] = V_f[_i + _skip];
3630+ else
3631+ {
3632+ for (_i = 0; _i < 3 - _skip; ++_i)
3633+ V_f[_i] =
3634+ V_f[_i + _skip] >> _down | V_f[_i + _skip + 1] << _up;
3635+ V_f[_i++] = V_f[3] >> _down;
3636+ }
3637+ for (; _i < 4; ++_i)
3638+ V_f[_i] = 0;
3639+ }
3640+ while (0);
3641+ if (!(((V_e + 1) & 32767) > 1)
3642+ && !((V_f[0] | V_f[1] | V_f[2] | V_f[3]) == 0))
3643+ {
3644+ if (V_e == 0)
3645+ _fex |= (0);
3646+ else
3647+ {
3648+ if (!1)
3649+ {
3650+ (V_f[3] =
3651+ ((((unsigned long) 1 << (113 - 2) % 32) << 1) - 1),
3652+ V_f[2] = -1, V_f[1] = -1, V_f[0] = -1);
3653+ V_s = 0;
3654+ }
3655+ else
3656+ (V_f[3]) |= ((unsigned long) 1 << (113 - 2) % 32);
3657+ }
3658+ }
3659+ }
3660+ while (0);
3661+ do
3662+ {
3663+ union _FP_UNION_Q _flo;
3664+ _flo.bits.frac0 = V_f[0];
3665+ _flo.bits.frac1 = V_f[1];
3666+ _flo.bits.frac2 = V_f[2];
3667+ _flo.bits.frac3 = V_f[3];
3668+ _flo.bits.exp = V_e;
3669+ _flo.bits.sign = V_s;
3670+ (v) = _flo.flt;
3671+ }
3672+ while (0);
3673+ }
3674+ while (0);
3675+
3676+/* FP_HANDLE_EXCEPTIONS */
3677+ do
3678+ {
3679+ }
3680+ while (0);
3681+
3682+ /* Truncate quad to double. */
3683+/* FP_INIT_ROUNDMODE */
3684+ do
3685+ {
3686+ }
3687+ while (0);
3688+
3689+/* FP_UNPACK_SEMIRAW_Q(V,v) */
3690+ do
3691+ {
3692+ do
3693+ {
3694+ union _FP_UNION_Q _flo;
3695+ _flo.flt = (v);
3696+ V_f[0] = _flo.bits.frac0;
3697+ V_f[1] = _flo.bits.frac1;
3698+ V_f[2] = _flo.bits.frac2;
3699+ V_f[3] = _flo.bits.frac3;
3700+ V_e = _flo.bits.exp;
3701+ V_s = _flo.bits.sign;
3702+ }
3703+ while (0);
3704+ do
3705+ {
3706+ long _up, _down, _skip, _i;
3707+ _skip = (3) / 32;
3708+ _up = (3) % 32;
3709+ _down = 32 - _up;
3710+ if (!_up)
3711+ for (_i = 3; _i >= _skip; --_i)
3712+ V_f[_i] = V_f[_i - _skip];
3713+ else
3714+ {
3715+ for (_i = 3; _i > _skip; --_i)
3716+ V_f[_i] =
3717+ V_f[_i - _skip] << _up | V_f[_i - _skip - 1] >> _down;
3718+ V_f[_i--] = V_f[0] << _up;
3719+ }
3720+ for (; _i >= 0; --_i)
3721+ V_f[_i] = 0;
3722+ }
3723+ while (0);
3724+ }
3725+ while (0);
3726+
3727+/* FP_TRUNC(D,Q,2,4,R,V) */
3728+ do
3729+ {
3730+ if (113 < 53 || 16383 < 1023 + 53 - 1)
3731+ abort ();
3732+ R_s = V_s;
3733+ if ((((V_e + 1) & 32767) > 1))
3734+ {
3735+ R_e = V_e + 1023 - 16383;
3736+ if (R_e >= 2047)
3737+ do
3738+ {
3739+ if (0 == 0 || (0 == 2 && !R_s) || (0 == 3 && R_s))
3740+ {
3741+ R_e = 2047;
3742+ (R_f0 = 0, R_f1 = 0);
3743+ }
3744+ else
3745+ {
3746+ R_e = 2047 - 1;
3747+ _fex |= (0);
3748+ _fex |= (0);
3749+ (R_f0 = (~(signed long) 0), R_f1 = (~(signed long) 0));
3750+ }
3751+ }
3752+ while (0);
3753+ else
3754+ {
3755+ if (R_e <= 0)
3756+ {
3757+ if (R_e <= 1 - 53)
3758+ (V_f[3] = 0, V_f[2] = 0, V_f[1] = 0, V_f[0] = 0);
3759+ else
3760+ {
3761+ (V_f[3]) |= ((unsigned long) 1 << (113 - 1 + 3) % 32);
3762+ do
3763+ {
3764+ int _sticky;
3765+ do
3766+ {
3767+ long _up, _down, _skip, _i;
3768+ unsigned long _s;
3769+ _skip = (((3 + 113) - (3 + 53) + 1 - R_e)) / 32;
3770+ _down = (((3 + 113) - (3 + 53) + 1 - R_e)) % 32;
3771+ _up = 32 - _down;
3772+ for (_s = _i = 0; _i < _skip; ++_i)
3773+ _s |= V_f[_i];
3774+ if (!_down)
3775+ for (_i = 0; _i <= 3 - _skip; ++_i)
3776+ V_f[_i] = V_f[_i + _skip];
3777+ else
3778+ {
3779+ _s |= V_f[_i] << _up;
3780+ for (_i = 0; _i < 3 - _skip; ++_i)
3781+ V_f[_i] =
3782+ V_f[_i + _skip] >> _down | V_f[_i +
3783+ _skip +
3784+ 1] <<
3785+ _up;
3786+ V_f[_i++] = V_f[3] >> _down;
3787+ }
3788+ for (; _i < 4; ++_i)
3789+ V_f[_i] = 0;
3790+ _sticky = (_s != 0);
3791+ }
3792+ while (0);
3793+ V_f[0] |= _sticky;
3794+ }
3795+ while (0);
3796+ }
3797+ R_e = 0;
3798+ }
3799+ else
3800+ do
3801+ {
3802+ int _sticky;
3803+ do
3804+ {
3805+ long _up, _down, _skip, _i;
3806+ unsigned long _s;
3807+ _skip = (((3 + 113) - (3 + 53))) / 32;
3808+ _down = (((3 + 113) - (3 + 53))) % 32;
3809+ _up = 32 - _down;
3810+ for (_s = _i = 0; _i < _skip; ++_i)
3811+ _s |= V_f[_i];
3812+ if (!_down)
3813+ for (_i = 0; _i <= 3 - _skip; ++_i)
3814+ V_f[_i] = V_f[_i + _skip];
3815+ else
3816+ {
3817+ _s |= V_f[_i] << _up;
3818+ for (_i = 0; _i < 3 - _skip; ++_i)
3819+ V_f[_i] =
3820+ V_f[_i + _skip] >> _down | V_f[_i + _skip +
3821+ 1] << _up;
3822+ V_f[_i++] = V_f[3] >> _down;
3823+ }
3824+ for (; _i < 4; ++_i)
3825+ V_f[_i] = 0;
3826+ _sticky = (_s != 0);
3827+ }
3828+ while (0);
3829+ V_f[0] |= _sticky;
3830+ }
3831+ while (0);
3832+ do
3833+ {
3834+ R_f0 = V_f[0];
3835+ R_f1 = V_f[1];
3836+ }
3837+ while (0);
3838+ }
3839+ }
3840+ else
3841+ {
3842+ if (V_e == 0)
3843+ {
3844+ R_e = 0;
3845+ (R_f0 = 0, R_f1 = 0);
3846+ if (!((V_f[0] | V_f[1] | V_f[2] | V_f[3]) == 0))
3847+ {
3848+ _fex |= (0);
3849+ _fex |= (0);
3850+ }
3851+ }
3852+ else
3853+ {
3854+ R_e = 2047;
3855+ if (((V_f[0] | V_f[1] | V_f[2] | V_f[3]) == 0))
3856+ (R_f0 = 0, R_f1 = 0);
3857+ else
3858+ {
3859+ do
3860+ {
3861+ if (V_e == 32767
3862+ && !((V_f[0] | V_f[1] | V_f[2] | V_f[3]) == 0)
3863+ && !((V_f[3]) &
3864+ ((unsigned long) 1 << (113 - 2 + 3) % 32)))
3865+ _fex |= (0);
3866+ }
3867+ while (0);
3868+ do
3869+ {
3870+ long _up, _down, _skip, _i;
3871+ _skip = (((3 + 113) - (3 + 53))) / 32;
3872+ _down = (((3 + 113) - (3 + 53))) % 32;
3873+ _up = 32 - _down;
3874+ if (!_down)
3875+ for (_i = 0; _i <= 3 - _skip; ++_i)
3876+ V_f[_i] = V_f[_i + _skip];
3877+ else
3878+ {
3879+ for (_i = 0; _i < 3 - _skip; ++_i)
3880+ V_f[_i] =
3881+ V_f[_i + _skip] >> _down | V_f[_i + _skip +
3882+ 1] << _up;
3883+ V_f[_i++] = V_f[3] >> _down;
3884+ }
3885+ for (; _i < 4; ++_i)
3886+ V_f[_i] = 0;
3887+ }
3888+ while (0);
3889+ do
3890+ {
3891+ R_f0 = V_f[0];
3892+ R_f1 = V_f[1];
3893+ }
3894+ while (0);
3895+ (R_f1) |= ((unsigned long) 1 << (53 - 2 + 3) % 32);
3896+ }
3897+ }
3898+ }
3899+ }
3900+ while (0);
3901+
3902+/* FP_PACK_SEMIRAW_D(r,R) */
3903+ do
3904+ {
3905+ do
3906+ {
3907+ do
3908+ {
3909+ if ((R_f0) & 7)
3910+ _fex |= (0);
3911+ switch (0)
3912+ {
3913+ case 0:
3914+ do
3915+ {
3916+ if (((R_f0) & 15) != ((unsigned long) 1 << 2))
3917+ do
3918+ {
3919+ if (__builtin_constant_p (0) && (0) == 0)
3920+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2": "=r" (R_f1), "=&r" (R_f0):"r" (R_f1), "%r" (R_f0),
3921+ "rI" (((unsigned long) 1 <<
3922+ 2)));
3923+ else if (__builtin_constant_p (0)
3924+ && (0) == ~(USItype) 0)
3925+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2": "=r" (R_f1), "=&r" (R_f0):"r" (R_f1), "%r" (R_f0),
3926+ "rI" (((unsigned long) 1 <<
3927+ 2)));
3928+ else
3929+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3": "=r" (R_f1), "=&r" (R_f0):"%r" (R_f1), "r" (0), "%r" (R_f0),
3930+ "rI" (((unsigned long) 1 <<
3931+ 2)));
3932+ }
3933+ while (0);
3934+ }
3935+ while (0);
3936+ break;
3937+ case 1:
3938+ (void) 0;
3939+ break;
3940+ case 2:
3941+ do
3942+ {
3943+ if (!R_s && ((R_f0) & 7))
3944+ do
3945+ {
3946+ if (__builtin_constant_p (0) && (0) == 0)
3947+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2": "=r" (R_f1), "=&r" (R_f0):"r" (R_f1), "%r" (R_f0),
3948+ "rI" (((unsigned long) 1 <<
3949+ 3)));
3950+ else if (__builtin_constant_p (0)
3951+ && (0) == ~(USItype) 0)
3952+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2": "=r" (R_f1), "=&r" (R_f0):"r" (R_f1), "%r" (R_f0),
3953+ "rI" (((unsigned long) 1 <<
3954+ 3)));
3955+ else
3956+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3": "=r" (R_f1), "=&r" (R_f0):"%r" (R_f1), "r" (0), "%r" (R_f0),
3957+ "rI" (((unsigned long) 1 <<
3958+ 3)));
3959+ }
3960+ while (0);
3961+ }
3962+ while (0);
3963+ break;
3964+ case 3:
3965+ do
3966+ {
3967+ if (R_s && ((R_f0) & 7))
3968+ do
3969+ {
3970+ if (__builtin_constant_p (0) && (0) == 0)
3971+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2": "=r" (R_f1), "=&r" (R_f0):"r" (R_f1), "%r" (R_f0),
3972+ "rI" (((unsigned long) 1 <<
3973+ 3)));
3974+ else if (__builtin_constant_p (0)
3975+ && (0) == ~(USItype) 0)
3976+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2": "=r" (R_f1), "=&r" (R_f0):"r" (R_f1), "%r" (R_f0),
3977+ "rI" (((unsigned long) 1 <<
3978+ 3)));
3979+ else
3980+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3": "=r" (R_f1), "=&r" (R_f0):"%r" (R_f1), "r" (0), "%r" (R_f0),
3981+ "rI" (((unsigned long) 1 <<
3982+ 3)));
3983+ }
3984+ while (0);
3985+ }
3986+ while (0);
3987+ break;
3988+ }
3989+ }
3990+ while (0);
3991+ if ((R_f1) & (((unsigned long) 1 << (3 + 53) % 32) >> 1))
3992+ {
3993+ (R_f1) &= ~(((unsigned long) 1 << (3 + 53) % 32) >> 1);
3994+ R_e++;
3995+ if (R_e == 2047)
3996+ do
3997+ {
3998+ if (0 == 0 || (0 == 2 && !R_s) || (0 == 3 && R_s))
3999+ {
4000+ R_e = 2047;
4001+ (R_f0 = 0, R_f1 = 0);
4002+ }
4003+ else
4004+ {
4005+ R_e = 2047 - 1;
4006+ _fex |= (0);
4007+ _fex |= (0);
4008+ (R_f0 = (~(signed long) 0), R_f1 =
4009+ (~(signed long) 0));
4010+ }
4011+ }
4012+ while (0);
4013+ }
4014+ (void) (((3) < 32) ? (
4015+ {
4016+ R_f0 = R_f0 >> (3) | R_f1 << (32 - (3)); R_f1 >>= (3);}):(
4017+ {
4018+ R_f0 = R_f1 >> ((3) - 32); R_f1 = 0;}));
4019+ if (!(((R_e + 1) & 2047) > 1) && !((R_f1 | R_f0) == 0))
4020+ {
4021+ if (R_e == 0)
4022+ _fex |= (0);
4023+ else
4024+ {
4025+ if (!1)
4026+ {
4027+ (R_f0 = -1, R_f1 =
4028+ ((((unsigned long) 1 << (53 - 2) % 32) << 1) - 1));
4029+ R_s = 0;
4030+ }
4031+ else
4032+ (R_f1) |= ((unsigned long) 1 << (53 - 2) % 32);
4033+ }
4034+ }
4035+ }
4036+ while (0);
4037+ do
4038+ {
4039+ union _FP_UNION_D _flo;
4040+ _flo.bits.frac0 = R_f0;
4041+ _flo.bits.frac1 = R_f1;
4042+ _flo.bits.exp = R_e;
4043+ _flo.bits.sign = R_s;
4044+ (r) = _flo.flt;
4045+ }
4046+ while (0);
4047+ }
4048+ while (0);
4049+
4050+/* FP_HANDLE_EXCEPTIONS */
4051+ do
4052+ {
4053+ }
4054+ while (0);
4055+
4056+ return r;
4057+}
4058+
4059+
4060+#endif
4061+
4062 #endif
4063diff -urN gcc42-trunc-20060802/gcc/config/rs6000/libgcc-ppc-glibc.ver gcc42-patched-20060802/gcc/config/rs6000/libgcc-ppc-glibc.ver
4064--- gcc42-trunc-20060802/gcc/config/rs6000/libgcc-ppc-glibc.ver 2006-08-02 11:07:16.000000000 -0500
4065+++ gcc42-patched-20060802/gcc/config/rs6000/libgcc-ppc-glibc.ver 2006-09-01 08:28:29.000000000 -0500
4066@@ -21,11 +21,32 @@
4067 %else
4068 GCC_3.4.4 {
4069 %endif
4070+%else
4071+GCC_4.2.0 {
4072+%endif
4073
4074 # long double support
4075 __gcc_qadd
4076 __gcc_qsub
4077 __gcc_qmul
4078 __gcc_qdiv
4079-}
4080+
4081+%ifdef _SOFT_FLOAT
4082+ __gcc_qneg
4083+ __gcc_qeq
4084+ __gcc_qne
4085+ __gcc_ggt
4086+ __gcc_qge
4087+ __gcc_qlt
4088+ __gcc_qle
4089+ __gcc_qunord
4090+ __gcc_stoq
4091+ __gcc_dtoq
4092+ __gcc_qtos
4093+ __gcc_qtod
4094+ __gcc_qtoi
4095+ __gcc_qtou
4096+ __gcc_itoq
4097+ __gcc_utoq
4098 %endif
4099+}
4100diff -urN gcc42-trunc-20060802/gcc/config/rs6000/rs6000.c gcc42-patched-20060802/gcc/config/rs6000/rs6000.c
4101--- gcc42-trunc-20060802/gcc/config/rs6000/rs6000.c 2006-08-02 11:07:16.000000000 -0500
4102+++ gcc42-patched-20060802/gcc/config/rs6000/rs6000.c 2006-09-01 08:28:29.000000000 -0500
4103@@ -4016,8 +4016,7 @@
4104
4105 /* 128-bit constant floating-point values on Darwin should really be
4106 loaded as two parts. */
4107- if (!TARGET_IEEEQUAD
4108- && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
4109+ if (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128
4110 && mode == TFmode && GET_CODE (operands[1]) == CONST_DOUBLE)
4111 {
4112 /* DImode is used, not DFmode, because simplify_gen_subreg doesn't
4113@@ -9175,9 +9174,6 @@
4114 static void
4115 rs6000_init_libfuncs (void)
4116 {
4117- if (!TARGET_HARD_FLOAT)
4118- return;
4119-
4120 if (DEFAULT_ABI != ABI_V4 && TARGET_XCOFF
4121 && !TARGET_POWER2 && !TARGET_POWERPC)
4122 {
4123@@ -9196,6 +9192,27 @@
4124 set_optab_libfunc (sub_optab, TFmode, "__gcc_qsub");
4125 set_optab_libfunc (smul_optab, TFmode, "__gcc_qmul");
4126 set_optab_libfunc (sdiv_optab, TFmode, "__gcc_qdiv");
4127+
4128+ if (TARGET_SOFT_FLOAT)
4129+ {
4130+ set_optab_libfunc (neg_optab, TFmode, "__gcc_qneg");
4131+ set_optab_libfunc (eq_optab, TFmode, "__gcc_qeq");
4132+ set_optab_libfunc (ne_optab, TFmode, "__gcc_qne");
4133+ set_optab_libfunc (gt_optab, TFmode, "__gcc_qgt");
4134+ set_optab_libfunc (ge_optab, TFmode, "__gcc_qge");
4135+ set_optab_libfunc (lt_optab, TFmode, "__gcc_qlt");
4136+ set_optab_libfunc (le_optab, TFmode, "__gcc_qle");
4137+ set_optab_libfunc (unord_optab, TFmode, "__gcc_qunord");
4138+
4139+ set_conv_libfunc (sext_optab, TFmode, SFmode, "__gcc_stoq");
4140+ set_conv_libfunc (sext_optab, TFmode, DFmode, "__gcc_dtoq");
4141+ set_conv_libfunc (trunc_optab, SFmode, TFmode, "__gcc_qtos");
4142+ set_conv_libfunc (trunc_optab, DFmode, TFmode, "__gcc_qtod");
4143+ set_conv_libfunc (sfix_optab, SImode, TFmode, "__gcc_qtoi");
4144+ set_conv_libfunc (ufix_optab, SImode, TFmode, "__gcc_qtou");
4145+ set_conv_libfunc (sfloat_optab, TFmode, SImode, "__gcc_itoq");
4146+ set_conv_libfunc (ufloat_optab, TFmode, SImode, "__gcc_utoq");
4147+ }
4148 }
4149 else
4150 {
4151diff -urN gcc42-trunc-20060802/gcc/config/rs6000/rs6000.md gcc42-patched-20060802/gcc/config/rs6000/rs6000.md
4152--- gcc42-trunc-20060802/gcc/config/rs6000/rs6000.md 2006-08-02 11:07:16.000000000 -0500
4153+++ gcc42-patched-20060802/gcc/config/rs6000/rs6000.md 2006-09-01 08:28:29.000000000 -0500
4154@@ -7920,42 +7920,44 @@
4155 "")
4156
4157 (define_insn "*movcc_internal1"
4158- [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
4159- (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
4160+ [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
4161+ (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
4162 "register_operand (operands[0], CCmode)
4163 || register_operand (operands[1], CCmode)"
4164 "@
4165 mcrf %0,%1
4166 mtcrf 128,%1
4167 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
4168+ crxor %0,%0,%0
4169 mfcr %0%Q1
4170 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
4171 mr %0,%1
4172+ {lil|li} %0,%1
4173 mf%1 %0
4174 mt%0 %1
4175 mt%0 %1
4176 {l%U1%X1|lwz%U1%X1} %0,%1
4177 {st%U0%U1|stw%U0%U1} %1,%0"
4178 [(set (attr "type")
4179- (cond [(eq_attr "alternative" "0")
4180+ (cond [(eq_attr "alternative" "0,3")
4181 (const_string "cr_logical")
4182 (eq_attr "alternative" "1,2")
4183 (const_string "mtcr")
4184- (eq_attr "alternative" "5,7")
4185+ (eq_attr "alternative" "6,7,9")
4186 (const_string "integer")
4187- (eq_attr "alternative" "6")
4188- (const_string "mfjmpr")
4189 (eq_attr "alternative" "8")
4190+ (const_string "mfjmpr")
4191+ (eq_attr "alternative" "10")
4192 (const_string "mtjmpr")
4193- (eq_attr "alternative" "9")
4194+ (eq_attr "alternative" "11")
4195 (const_string "load")
4196- (eq_attr "alternative" "10")
4197+ (eq_attr "alternative" "12")
4198 (const_string "store")
4199 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
4200 (const_string "mfcrf")
4201 ]
4202 (const_string "mfcr")))
4203- (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
4204+ (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
4205
4206 ;; For floating-point, we normally deal with the floating-point registers
4207 ;; unless -msoft-float is used. The sole exception is that parameter passing
4208@@ -8313,8 +8315,7 @@
4209 (define_expand "movtf"
4210 [(set (match_operand:TF 0 "general_operand" "")
4211 (match_operand:TF 1 "any_operand" ""))]
4212- "!TARGET_IEEEQUAD
4213- && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
4214+ "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
4215 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
4216
4217 ; It's important to list the o->f and f->o moves before f->f because
4218@@ -8333,6 +8334,19 @@
4219 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
4220 [(set_attr "length" "8,8,8,20,20,16")])
4221
4222+(define_insn_and_split "*movtf_softfloat"
4223+ [(set (match_operand:TF 0 "nonimmediate_operand" "=r,Y,r")
4224+ (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
4225+ "!TARGET_IEEEQUAD
4226+ && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
4227+ && (gpc_reg_operand (operands[0], TFmode)
4228+ || gpc_reg_operand (operands[1], TFmode))"
4229+ "#"
4230+ "&& reload_completed"
4231+ [(pc)]
4232+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
4233+ [(set_attr "length" "20,20,16")])
4234+
4235 (define_expand "extenddftf2"
4236 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
4237 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
4238diff -urN gcc42-trunc-20060802/gcc/config/rs6000/sysv4.h gcc42-patched-20060802/gcc/config/rs6000/sysv4.h
4239--- gcc42-trunc-20060802/gcc/config/rs6000/sysv4.h 2006-08-02 11:07:16.000000000 -0500
4240+++ gcc42-patched-20060802/gcc/config/rs6000/sysv4.h 2006-09-01 08:28:29.000000000 -0500
4241@@ -215,10 +215,6 @@
4242 error ("-msecure-plt not supported by your assembler"); \
4243 } \
4244 \
4245- if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128 \
4246- && rs6000_explicit_options.long_double) \
4247- warning (0, "-msoft-float and -mlong-double-128 not supported"); \
4248- \
4249 /* Treat -fPIC the same as -mrelocatable. */ \
4250 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
4251 { \
4252diff -urN gcc42-trunc-20060802/gcc/config/rs6000/t-ppccomm gcc42-patched-20060802/gcc/config/rs6000/t-ppccomm
4253--- gcc42-trunc-20060802/gcc/config/rs6000/t-ppccomm 2006-08-02 11:07:16.000000000 -0500
4254+++ gcc42-patched-20060802/gcc/config/rs6000/t-ppccomm 2006-09-01 08:28:29.000000000 -0500
4255@@ -12,15 +12,8 @@
4256 cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
4257
4258 ifneq (,$findstring gnu,$(target))
4259-TARGET_LIBGCC2_CFLAGS += -specs=ldblspecs
4260-
4261+TARGET_LIBGCC2_CFLAGS += -mlong-double-128
4262 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc-glibc.ver
4263-
4264-# Hack to use -mlong-double-128 only when not compiling nof libgcc
4265-mklibgcc: ldblspecs
4266-
4267-ldblspecs: specs
4268- sed -e '/cc1_options/{ n; s/$$/ %{!msoft-float:-mlong-double-128}/; }' < specs > $@
4269 endif
4270
4271 # Switch synonyms
diff --git a/meta/packages/gcc/gcc-4.1.1/sh3-installfix-fixheaders.patch b/meta/packages/gcc/gcc-4.1.1/sh3-installfix-fixheaders.patch
deleted file mode 100644
index a06cd2e075..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/sh3-installfix-fixheaders.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- gcc-4.1.1/gcc/Makefile.in_orig 2007-01-31 21:24:23.000000000 +0000
2+++ gcc-4.1.1/gcc/Makefile.in 2007-01-31 21:24:43.000000000 +0000
3@@ -3772,8 +3772,6 @@
4 $(INSTALL_SCRIPT) $(mkinstalldirs) \
5 $(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
6 $(INSTALL_SCRIPT) $(srcdir)/fixproto $(DESTDIR)$(itoolsdir)/fixproto ; \
7- $(INSTALL_PROGRAM) build/fix-header$(build_exeext) \
8- $(DESTDIR)$(itoolsdir)/fix-header$(build_exeext) ; \
9 else :; fi
10 echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \
11 > $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
diff --git a/meta/packages/gcc/gcc-4.1.1/unbreak-armv4t.patch b/meta/packages/gcc/gcc-4.1.1/unbreak-armv4t.patch
deleted file mode 100644
index b3399abfdb..0000000000
--- a/meta/packages/gcc/gcc-4.1.1/unbreak-armv4t.patch
+++ /dev/null
@@ -1,12 +0,0 @@
1diff -urN gcc-4.1.1/gcc/config/arm/linux-eabi.h gcc-4.1.1-arm9tdmi/gcc/config/arm/linux-eabi.h
2--- gcc-4.1.1/gcc/config/arm/linux-eabi.h 2006-10-22 11:11:49.000000000 -0700
3+++ gcc-4.1.1-arm9tdmi/gcc/config/arm/linux-eabi.h 2006-10-24 21:34:01.000000000 -0700
4@@ -45,7 +45,7 @@
5 The ARM10TDMI core is the default for armv5t, so set
6 SUBTARGET_CPU_DEFAULT to achieve this. */
7 #undef SUBTARGET_CPU_DEFAULT
8-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
9+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
10
11 #undef SUBTARGET_EXTRA_LINK_SPEC
12 #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
diff --git a/meta/packages/gcc/gcc-4.1.2.inc b/meta/packages/gcc/gcc-4.1.2.inc
new file mode 100644
index 0000000000..fdce5afc2b
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.1.2.inc
@@ -0,0 +1,60 @@
1require gcc-common.inc
2
3DEPENDS = "mpfr gmp"
4
5SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2 \
6 file://100-uclibc-conf.patch;patch=1 \
7 file://110-arm-eabi.patch;patch=1 \
8 file://200-uclibc-locale.patch;patch=1 \
9 file://300-libstdc++-pic.patch;patch=1 \
10 file://301-missing-execinfo_h.patch;patch=1 \
11 file://302-c99-snprintf.patch;patch=1 \
12 file://303-c99-complex-ugly-hack.patch;patch=1 \
13 file://304-index_macro.patch;patch=1 \
14 file://602-sdk-libstdc++-includes.patch;patch=1 \
15 file://740-sh-pr24836.patch;patch=1 \
16 file://800-arm-bigendian.patch;patch=1 \
17 file://arm-nolibfloat.patch;patch=1 \
18 file://arm-softfloat.patch;patch=1 \
19 file://gcc41-configure.in.patch;patch=1 \
20 file://arm-thumb.patch;patch=1 \
21 file://arm-thumb-cache.patch;patch=1 \
22 file://ldflags.patch;patch=1 \
23 file://zecke-xgcc-cpp.patch;patch=1 \
24 file://unbreak-armv4t.patch;patch=1 \
25 file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \
26 file://cache-amnesia.patch;patch=1 \
27 file://gfortran.patch;patch=1 \
28 file://gcc-4.0.2-e300c2c3.patch;patch=1 \
29 file://pr34130.patch;patch=1 \
30 "
31
32SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
33
34SRC_URI_avr32 = "http://www.angstrom-distribution.org/unstable/sources/gcc-4.1.2-atmel.1.1.0.tar.gz \
35# file://100-uclibc-conf.patch;patch=1 \
36# file://200-uclibc-locale.patch;patch=1 \
37# file://300-libstdc++-pic.patch;patch=1 \
38 file://301-missing-execinfo_h.patch;patch=1 \
39 file://302-c99-snprintf.patch;patch=1 \
40 file://303-c99-complex-ugly-hack.patch;patch=1 \
41 file://304-index_macro.patch;patch=1 \
42 file://602-sdk-libstdc++-includes.patch;patch=1 \
43 file://gcc41-configure.in.patch;patch=1 \
44 file://ldflags.patch;patch=1 \
45 file://zecke-xgcc-cpp.patch;patch=1 \
46 file://cache-amnesia.patch;patch=1 \
47 "
48
49do_compile_prepend_avr32() {
50 ln -sf ${S}/libstdc++-v3/config/os/uclibc/ ${S}/libstdc++-v3/config/os/uclibc-linux
51}
52
53
54# Language Overrides
55FORTRAN = ""
56JAVA = ""
57
58EXTRA_OECONF += " --disable-libssp "
59
60ARM_INSTRUCTION_SET = "arm"
diff --git a/meta/packages/gcc/gcc-4.2.2.inc b/meta/packages/gcc/gcc-4.2.2.inc
new file mode 100644
index 0000000000..2674fccdbe
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.2.2.inc
@@ -0,0 +1,74 @@
1require gcc-common.inc
2
3DEPENDS = "mpfr gmp"
4
5SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
6 file://100-uclibc-conf.patch;patch=1 \
7 file://103-uclibc-conf-noupstream.patch;patch=1 \
8 file://200-uclibc-locale.patch;patch=1 \
9 file://203-uclibc-locale-no__x.patch;patch=1 \
10 file://204-uclibc-locale-wchar_fix.patch;patch=1 \
11 file://205-uclibc-locale-update.patch;patch=1 \
12 file://300-libstdc++-pic.patch;patch=1 \
13 file://301-missing-execinfo_h.patch;patch=1 \
14 file://302-c99-snprintf.patch;patch=1 \
15 file://303-c99-complex-ugly-hack.patch;patch=1 \
16 file://304-index_macro.patch;patch=1 \
17 file://305-libmudflap-susv3-legacy.patch;patch=1 \
18 file://306-libstdc++-namespace.patch;patch=1 \
19 file://307-locale_facets.patch;patch=1 \
20 file://402-libbackend_dep_gcov-iov.h.patch;patch=1 \
21 file://602-sdk-libstdc++-includes.patch;patch=1 \
22 file://740-sh-pr24836.patch;patch=1 \
23 file://800-arm-bigendian.patch;patch=1 \
24 file://801-arm-bigendian-eabi.patch;patch=1 \
25 file://904-flatten-switch-stmt-00.patch;patch=1 \
26 file://arm-nolibfloat.patch;patch=1 \
27 file://arm-softfloat.patch;patch=1 \
28 file://gcc41-configure.in.patch;patch=1 \
29 file://arm-thumb.patch;patch=1 \
30 file://arm-thumb-cache.patch;patch=1 \
31 file://ldflags.patch;patch=1 \
32 file://zecke-xgcc-cpp.patch;patch=1 \
33 file://unbreak-armv4t.patch;patch=1 \
34 file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \
35 file://cache-amnesia.patch;patch=1 \
36 file://gfortran.patch;patch=1 \
37 file://gcc-4.0.2-e300c2c3.patch;patch=1 \
38 file://pr34130.patch;patch=1 \
39 file://fortran-static-linking.patch;patch=1 \
40 file://intermask-bigendian.patch;patch=1 \
41"
42
43SRC_URI_append_ep93xx = " \
44 file://arm-crunch-saveregs.patch;patch=1 \
45 file://arm-crunch-20000320.patch;patch=1 \
46 file://arm-crunch-compare.patch;patch=1 \
47 file://arm-crunch-compare-unordered.patch;patch=1 \
48 file://arm-crunch-compare-geu.patch;patch=1 \
49 file://arm-crunch-eabi-ieee754.patch;patch=1 \
50 file://arm-crunch-eabi-ieee754-div.patch;patch=1 \
51 file://arm-crunch-64bit-disable0.patch;patch=1 \
52 file://arm-crunch-offset.patch;patch=1 \
53 file://arm-crunch-fp_consts.patch;patch=1 \
54 file://arm-crunch-neg2.patch;patch=1 \
55 file://arm-crunch-predicates3.patch;patch=1 \
56 file://arm-crunch-cfcvtds-disable.patch;patch=1 \
57 file://arm-crunch-floatsi-disable.patch;patch=1 \
58 file://arm-crunch-truncsi-disable.patch;patch=1 \
59 file://arm-crunch-cfcvt64-disable.patch;patch=1 \
60 file://arm-crunch-cirrus-bugfixes.patch;patch=1 \
61 "
62
63PACKAGE_ARCH_ep93xx = "${MACHINE_ARCH}"
64
65SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
66
67# Language Overrides
68FORTRAN = ""
69FORTRAN_linux-gnueabi = ",fortran"
70JAVA = ""
71
72EXTRA_OECONF += " --disable-libssp --disable-bootstrap "
73
74ARM_INSTRUCTION_SET = "arm" \ No newline at end of file
diff --git a/meta/packages/gcc/gcc-common.inc b/meta/packages/gcc/gcc-common.inc
new file mode 100644
index 0000000000..1097614969
--- /dev/null
+++ b/meta/packages/gcc/gcc-common.inc
@@ -0,0 +1,35 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5
6inherit autotools gettext
7
8FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
9
10def get_gcc_fpu_setting(bb, d):
11 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
12 return "--with-float=soft"
13 return ""
14
15# We really need HOST_SYS here for some packages and TARGET_SYS for others.
16# For now, libgcc is most important so we fix for that - RP.
17SHLIBSDIR = "${STAGING_DIR}/${TARGET_SYS}/shlibs"
18
19DEBIANNAME_libgcc = "libgcc1"
20
21MIRRORS_prepend () {
22${GNU_MIRROR}/gcc/releases/ ftp://gcc.gnu.org/pub/gcc/releases/
23${GNU_MIRROR}/gcc/ http://mirrors.rcn.net/pub/sourceware/gcc/releases/
24${GNU_MIRROR}/gcc/releases/ http://gcc.get-software.com/releases/
25${GNU_MIRROR}/gcc/ http://gcc.get-software.com/releases/
26}
27
28#
29# Set some default values
30#
31gcclibdir = "${libdir}/gcc"
32BINV = "${PV}"
33S = "${WORKDIR}/gcc-${PV}"
34B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
35
diff --git a/meta/packages/gcc/gcc3-build.inc b/meta/packages/gcc/gcc-configure-common.inc
index 2924f0f9dd..9971c08c20 100644
--- a/meta/packages/gcc/gcc3-build.inc
+++ b/meta/packages/gcc/gcc-configure-common.inc
@@ -1,22 +1,15 @@
1MIRRORS_prepend () { 1#
2${GNU_MIRROR}/gcc/releases/ ftp://gcc.gnu.org/pub/gcc/releases/ 2# Build the list of lanaguages to build.
3${GNU_MIRROR}/gcc/ http://mirrors.rcn.net/pub/sourceware/gcc/releases/ 3#
4${GNU_MIRROR}/gcc/releases/ http://gcc.get-software.com/releases/ 4# These can be overridden by the version specific .inc file.
5${GNU_MIRROR}/gcc/ http://gcc.get-software.com/releases/
6}
7
8gcclibdir ?= "${libdir}/gcc"
9S = "${WORKDIR}/gcc-${PV}"
10B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
11BINV ?= "${PV}"
12 5
13# gcj doesn't work on some architectures 6# Java (gcj doesn't work on all architectures)
14JAVA ?= ",java" 7JAVA ?= ",java"
15JAVA_arm ?= "" 8JAVA_arm ?= ""
16JAVA_armeb ?= "" 9JAVA_armeb ?= ""
17JAVA_mipsel ?= "" 10JAVA_mipsel ?= ""
18JAVA_sh3 ?= "" 11JAVA_sh3 ?= ""
19# gcc4-build sets this to f95 12# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
20FORTRAN ?= ",f77" 13FORTRAN ?= ",f77"
21LANGUAGES ?= "c,c++${FORTRAN}${JAVA}" 14LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
22 15
@@ -32,16 +25,13 @@ EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d,
32 --enable-symvers=gnu \ 25 --enable-symvers=gnu \
33 --enable-libstdcxx-pch \ 26 --enable-libstdcxx-pch \
34 --program-prefix=${TARGET_PREFIX} \ 27 --program-prefix=${TARGET_PREFIX} \
35 ${EXTRA_OECONF_PATHS} \ 28 ${EXTRA_OECONF_PATHS}"
36 ${EXTRA_OECONF_DEP}"
37 29
38EXTRA_OECONF_PATHS = " \ 30# Build uclibc compilers without cxa_atexit support
39 --with-local-prefix=${prefix}/local \ 31EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
40 --with-gxx-include-dir=${includedir}/c++/${BINV}" 32EXTRA_OECONF_append_linux-gnueabi = " --enable-__cxa_atexit"
41 33EXTRA_OECONF_append_linux-uclibc = " --disable-__cxa_atexit"
42EXTRA_OECONF_DEP = "" 34EXTRA_OECONF_append_linux-uclibcgnueabi = " --disable-__cxa_atexit"
43EXTRA_OECONF_uclibc = "--disable-__cxa_atexit"
44EXTRA_OECONF_glibc = "--enable-__cxa_atexit"
45EXTRA_OECONF += "${@get_gcc_fpu_setting(bb, d)}" 35EXTRA_OECONF += "${@get_gcc_fpu_setting(bb, d)}"
46CPPFLAGS = "" 36CPPFLAGS = ""
47 37
@@ -54,21 +44,6 @@ ARCH_FLAGS_FOR_TARGET_slugos = "${TARGET_CC_ARCH}"
54ARCH_FLAGS_FOR_TARGET_unslung = "${TARGET_CC_ARCH}" 44ARCH_FLAGS_FOR_TARGET_unslung = "${TARGET_CC_ARCH}"
55EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'" 45EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
56 46
57require gcc-fpu.inc
58
59python __anonymous () {
60 import bb, re
61 if (re.match('linux-uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None):
62 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_uclibc}', d)
63 elif (re.match('linux-uclibcgnueabi$', bb.data.getVar('TARGET_OS', d, 1)) != None):
64 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_uclibc}', d)
65 elif (re.match('linux-gnueabi$', bb.data.getVar('TARGET_OS', d, 1)) != None):
66 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_glibc}', d)
67 elif (re.match('linux$', bb.data.getVar('TARGET_OS', d, 1)) != None):
68 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_glibc}', d)
69
70}
71
72do_configure () { 47do_configure () {
73 # Setup these vars for cross building only 48 # Setup these vars for cross building only
74 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the 49 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
@@ -96,3 +71,4 @@ do_configure () {
96 (cd ${S} && gnu-configize) || die "failure running gnu-configize" 71 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
97 oe_runconf 72 oe_runconf
98} 73}
74
diff --git a/meta/packages/gcc/gcc3-build-cross.inc b/meta/packages/gcc/gcc-configure-cross.inc
index 6a0d132a7d..ca7a6b5869 100644
--- a/meta/packages/gcc/gcc3-build-cross.inc
+++ b/meta/packages/gcc/gcc-configure-cross.inc
@@ -1,3 +1,5 @@
1require gcc-configure-common.inc
2
1USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}' 3USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
2 4
3EXTRA_OECONF_PATHS = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \ 5EXTRA_OECONF_PATHS = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \
@@ -18,14 +20,20 @@ do_compile_prepend () {
18 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}" 20 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
19} 21}
20 22
23LIBGCCS_VAR = "-lgcc_s"
24LIBGCCS_VAR_avr32 = ""
25
21do_stage_append () { 26do_stage_append () {
22 for d in info man share/doc share/locale ; do 27 for d in info man share/doc share/locale ; do
23 rm -rf ${CROSS_DIR}/$d 28 rm -rf ${CROSS_DIR}/$d
24 done 29 done
25 30
26 # These aren't useful on the cross toolchain 31 # Fix a few include links so cross builds are happier
27 rm -f ${CROSS_DIR}/bin/*gcov 32 if [ ! -e ${STAGING_INCDIR}/c++ ]; then
28 rm -f ${CROSS_DIR}/bin/*gccbug 33 mkdir -p ${STAGING_INCDIR}
34 ln -sf ${CROSS_DIR}/${TARGET_SYS}/include/c++ \
35 ${STAGING_INCDIR}/
36 fi
29 37
30 # We use libiberty from binutils 38 # We use libiberty from binutils
31 rm -f ${CROSS_DIR}/lib/libiberty.a 39 rm -f ${CROSS_DIR}/lib/libiberty.a
@@ -41,8 +49,8 @@ do_stage_append () {
41 done 49 done
42 50
43 #fix up libsupc++ and libstdc++ la files 51 #fix up libsupc++ and libstdc++ la files
44 sed -i "s|dependency_libs\s*=\s*.*|dependency_libs='-L${CROSS_DIR}/${TARGET_SYS}/lib -lgcc_s -lc -lm '|" ${CROSS_DIR}/${TARGET_SYS}/lib/libsupc++.la || true 52 sed -i "s|dependency_libs\s*=\s*.*|dependency_libs='-L${CROSS_DIR}/${TARGET_SYS}/lib ${LIBGCCS_VAR} -lc -lm '|" ${CROSS_DIR}/${TARGET_SYS}/lib/libsupc++.la || true
45 sed -i "s|dependency_libs\s*=\s*.*|dependency_libs='-L${CROSS_DIR}/${TARGET_SYS}/lib -lgcc_s -lc -lm '|" ${CROSS_DIR}/${TARGET_SYS}/lib/libstdc++.la || true 53 sed -i "s|dependency_libs\s*=\s*.*|dependency_libs='-L${CROSS_DIR}/${TARGET_SYS}/lib ${LIBGCCS_VAR} -lc -lm '|" ${CROSS_DIR}/${TARGET_SYS}/lib/libstdc++.la || true
46} 54}
47 55
48do_package_write_ipk[depends] += "virtual/libc:do_package" 56do_package_write_ipk[depends] += "virtual/libc:do_package
diff --git a/meta/packages/gcc/gcc-configure-sdk.inc b/meta/packages/gcc/gcc-configure-sdk.inc
new file mode 100644
index 0000000000..f8c4de8c78
--- /dev/null
+++ b/meta/packages/gcc/gcc-configure-sdk.inc
@@ -0,0 +1,51 @@
1require gcc-configure-common.inc
2
3# The two lines below conflict, this needs fixing - RP
4USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
5USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibcgnueabi", "no", "", d )}'
6
7EXTRA_OECONF_PATHS = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \
8 --with-gxx-include-dir=${STAGING_DIR_TARGET}/${layout_includedir}/c++ \
9 --with-sysroot=${prefix}/${TARGET_SYS} \
10 --with-build-sysroot=${STAGING_DIR_TARGET}"
11
12#
13# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
14# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
15#
16export AR_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/ar"
17export AS_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/as"
18export DLLTOOL_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/dlltool"
19export LD_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/ld"
20export LIPO_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/lipo"
21export NM_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/nm"
22export OBJDUMP_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/objdump"
23export RANLIB_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/ranlib"
24export STRIP_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/strip"
25export WINDRES_FOR_TARGET = "${CROSS_DIR}/${TARGET_SYS}/bin/windres"
26
27#
28# We need to override this and make sure the compiler can find staging
29#
30export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
31
32do_configure () {
33 export CC_FOR_BUILD="${BUILD_CC}"
34 export CXX_FOR_BUILD="${BUILD_CXX}"
35 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
36 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
37 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
38 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
39 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
40 oe_runconf
41}
42
43do_compile () {
44 export CC="${BUILD_CC}"
45 export AR_FOR_TARGET="${TARGET_SYS}-ar"
46 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
47 export LD_FOR_TARGET="${TARGET_SYS}-ld"
48 export NM_FOR_TARGET="${TARGET_SYS}-nm"
49 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
50 base_do_compile
51}
diff --git a/meta/packages/gcc/gcc-configure-target.inc b/meta/packages/gcc/gcc-configure-target.inc
new file mode 100644
index 0000000000..04045aa541
--- /dev/null
+++ b/meta/packages/gcc/gcc-configure-target.inc
@@ -0,0 +1,6 @@
1require gcc-configure-common.inc
2
3EXTRA_OECONF_PATHS = " \
4 --with-local-prefix=${prefix}/local \
5 --with-gxx-include-dir=${includedir}/c++/${BINV}"
6
diff --git a/meta/packages/gcc/gcc-cross-initial.inc b/meta/packages/gcc/gcc-cross-initial.inc
index 2165bf22ce..e0675263ea 100644
--- a/meta/packages/gcc/gcc-cross-initial.inc
+++ b/meta/packages/gcc/gcc-cross-initial.inc
@@ -1,9 +1,11 @@
1DEPENDS = "virtual/${TARGET_PREFIX}binutils" 1DEPENDS = "virtual/${TARGET_PREFIX}binutils"
2DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}" 2# @todo Please add comment on why this is (still?) needed?
3DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel', 'powerpc']]}"
3PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial" 4PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
4PACKAGES = "" 5PACKAGES = ""
5 6
6# This is intended to be a -very- basic config 7# This is intended to be a -very- basic config
8# sysroot is needed in case we use libc-initial
7EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \ 9EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \
8 --with-newlib \ 10 --with-newlib \
9 --disable-shared \ 11 --disable-shared \
@@ -13,6 +15,8 @@ EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \
13 --enable-languages=c \ 15 --enable-languages=c \
14 --enable-target-optspace \ 16 --enable-target-optspace \
15 --program-prefix=${TARGET_PREFIX} \ 17 --program-prefix=${TARGET_PREFIX} \
18 --with-sysroot=${STAGING_DIR_TARGET} \
19 --with-build-sysroot=${STAGING_DIR_TARGET} \
16 ${@get_gcc_fpu_setting(bb, d)}" 20 ${@get_gcc_fpu_setting(bb, d)}"
17 21
18do_stage_prepend () { 22do_stage_prepend () {
diff --git a/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3-2.bb b/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3-2.bb
deleted file mode 100644
index 1639511362..0000000000
--- a/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3-2.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
diff --git a/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb b/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..aff22fb694
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb
@@ -0,0 +1,2 @@
1require gcc-cross_csl-arm-2005q3.bb
2require gcc-cross-initial.inc
diff --git a/meta/packages/gcc/gcc-cross-kernel-3.4.4+csl-arm-2005q3-2/gcc-3.4.4-makefile-fix.patch b/meta/packages/gcc/gcc-cross-kernel-3.4.4+csl-arm-2005q3-2/gcc-3.4.4-makefile-fix.patch
deleted file mode 100644
index 74c1f26833..0000000000
--- a/meta/packages/gcc/gcc-cross-kernel-3.4.4+csl-arm-2005q3-2/gcc-3.4.4-makefile-fix.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1--- gcc-3.4.4/gcc/Makefile.in.orig 2005-07-25 21:00:37 +0200
2+++ gcc-3.4.4/gcc/Makefile.in 2005-07-25 21:01:19 +0200
3@@ -304,7 +304,7 @@
4 if [ "$(host)" = "$(target)" ] ; then \
5 echo ar; \
6 else \
7- t='$(program_transform_name)'; echo ar | sed -e $$t ; \
8+ t='$(program_transform_name)'; echo ar | sed -e "$$t" ; \
9 fi; \
10 fi`
11 AR_FLAGS_FOR_TARGET =
12@@ -317,7 +317,7 @@
13 if [ "$(host)" = "$(target)" ] ; then \
14 echo $(RANLIB); \
15 else \
16- t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
17+ t='$(program_transform_name)'; echo ranlib | sed -e "$$t" ; \
18 fi; \
19 fi`
20 NM_FOR_TARGET = ` \
21@@ -329,7 +329,7 @@
22 if [ "$(host)" = "$(target)" ] ; then \
23 echo nm; \
24 else \
25- t='$(program_transform_name)'; echo nm | sed -e $$t ; \
26+ t='$(program_transform_name)'; echo nm | sed -e "$$t" ; \
27 fi; \
28 fi`
29
diff --git a/meta/packages/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb b/meta/packages/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..46a56fa339
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
@@ -0,0 +1,10 @@
1# This kernel compiler is required by the Freecom FSG-3 machine
2# Please talk to Rod Whitby before considering removing this file.
3
4DEFAULT_PREFERENCE = "-1"
5
6require gcc-cross-kernel.inc
7require gcc-cross-initial_csl-arm-2005q3.bb
8
9SRC_URI += "file://gcc-3.4.4-makefile-fix.patch;patch=1"
10
diff --git a/meta/packages/gcc/gcc-cross-kernel.inc b/meta/packages/gcc/gcc-cross-kernel.inc
index 42da6fef81..fe6539b808 100644
--- a/meta/packages/gcc/gcc-cross-kernel.inc
+++ b/meta/packages/gcc/gcc-cross-kernel.inc
@@ -1,6 +1,5 @@
1SECTION = "devel" 1# Cut-down gcc for kernel builds
2# cut-down gcc for kernel builds 2# Only installs ${TARGET_PREFIX}gcc-${PV}, not ${TARGET_PREFIX}gcc.
3# only installs ${TARGET_PREFIX}gcc-${PV}, not ${TARGET_PREFIX}gcc.
4 3
5PROVIDES = "virtual/${TARGET_PREFIX}gcc-${PV}" 4PROVIDES = "virtual/${TARGET_PREFIX}gcc-${PV}"
6 5
@@ -13,4 +12,3 @@ do_stage () {
13 oe_runmake install-common install-headers install-libgcc 12 oe_runmake install-common install-headers install-libgcc
14 install -m 0755 xgcc ${CROSS_DIR}/bin/${TARGET_PREFIX}gcc-${PV} 13 install -m 0755 xgcc ${CROSS_DIR}/bin/${TARGET_PREFIX}gcc-${PV}
15} 14}
16
diff --git a/meta/packages/gcc/gcc-cross-kernel_csl-arm-2005q3-2.bb b/meta/packages/gcc/gcc-cross-kernel_csl-arm-2005q3-2.bb
deleted file mode 100644
index cf1542d1e7..0000000000
--- a/meta/packages/gcc/gcc-cross-kernel_csl-arm-2005q3-2.bb
+++ /dev/null
@@ -1,5 +0,0 @@
1require gcc-cross-initial_${PV}.bb
2require gcc-cross-kernel.inc
3
4SRC_URI += "file://gcc-3.4.4-makefile-fix.patch;patch=1"
5
diff --git a/meta/packages/gcc/gcc-cross-sdk_3.4.4.bb b/meta/packages/gcc/gcc-cross-sdk_3.4.4.bb
index 4b2c583fcb..1a7faa5b8c 100644
--- a/meta/packages/gcc/gcc-cross-sdk_3.4.4.bb
+++ b/meta/packages/gcc/gcc-cross-sdk_3.4.4.bb
@@ -1,16 +1,8 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5require gcc_${PV}.bb
6PR = "r3" 1PR = "r3"
7 2
8inherit sdk 3require gcc-${PV}.inc
9 4require gcc-cross-sdk.inc
10FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" 5require gcc-configure-sdk.inc
11
12DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
13PACKAGES = "${PN}"
14
15require gcc3-build-sdk.inc
16require gcc-package-sdk.inc 6require gcc-package-sdk.inc
7
8SRC_URI += 'file://sdk-libstdc++-includes.patch;patch=1'
diff --git a/meta/packages/gcc/gcc-cross-sdk_4.1.2.bb b/meta/packages/gcc/gcc-cross-sdk_4.1.2.bb
index 23327c06d6..89f698477f 100644
--- a/meta/packages/gcc/gcc-cross-sdk_4.1.2.bb
+++ b/meta/packages/gcc/gcc-cross-sdk_4.1.2.bb
@@ -1,13 +1,10 @@
1PR = "r6" 1PR = "r5"
2 2
3inherit sdk 3require gcc-${PV}.inc
4 4require gcc-cross-sdk.inc
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" 5require gcc-configure-sdk.inc
6
7DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native"
8
9require gcc_${PV}.bb
10require gcc4-build-sdk.inc
11require gcc-package-sdk.inc 6require gcc-package-sdk.inc
12 7
8DEPENDS += "gmp-native mpfr-native"
9
13EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}" 10EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}"
diff --git a/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb b/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb
index ba360698bd..7e3a459ea8 100644
--- a/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb
+++ b/meta/packages/gcc/gcc-cross-sdk_4.2.2.bb
@@ -1,20 +1,13 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5PR = "r3" 1PR = "r3"
6 2
7inherit sdk 3inherit sdk
8 4
9FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" 5require gcc-${PV}.inc
10 6require gcc-cross-sdk.inc
11PACKAGES = "${PN}" 7require gcc-configure-sdk.inc
12
13require gcc_${PV}.bb
14require gcc4-build-sdk.inc
15require gcc-package-sdk.inc 8require gcc-package-sdk.inc
16 9
17DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native" 10DEPENDS += "gmp-native mpfr-native"
18 11
19EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \ 12EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
20 --disable-libgomp --disable-libmudflap \ 13 --disable-libgomp --disable-libmudflap \
diff --git a/meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3-2.bb b/meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3-2.bb
deleted file mode 100644
index fa5794b7b2..0000000000
--- a/meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3-2.bb
+++ /dev/null
@@ -1,11 +0,0 @@
1PR = "r1"
2
3inherit sdk
4
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
6
7DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
8
9require gcc_${PV}.bb
10require gcc4-build-sdk.inc
11require gcc-package-sdk.inc
diff --git a/meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3.bb b/meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..258931ee4b
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-sdk_csl-arm-2005q3.bb
@@ -0,0 +1,8 @@
1PR = "r3"
2
3inherit sdk
4
5require gcc-${PV}.inc
6require gcc-cross-sdk.inc
7require gcc-configure-sdk.inc
8require gcc-package-sdk.inc
diff --git a/meta/packages/gcc/gcc-cross_csl-arm-2005q3-2.bb b/meta/packages/gcc/gcc-cross_csl-arm-2005q3-2.bb
deleted file mode 100644
index f95e2e1177..0000000000
--- a/meta/packages/gcc/gcc-cross_csl-arm-2005q3-2.bb
+++ /dev/null
@@ -1,15 +0,0 @@
1require gcc_csl-arm-2005q3-2.bb
2# path mangling, needed by the cross packaging
3require gcc-paths-cross.inc
4inherit cross
5# NOTE: split PR. If the main .oe changes something that affects its *build*
6# remember to increment this one too.
7PR = "r0"
8
9DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
10PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
11
12# cross build
13require gcc3-build-cross.inc
14# cross packaging
15require gcc-package-cross.inc
diff --git a/meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb b/meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..09f09faacd
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb
@@ -0,0 +1,6 @@
1PR = "r2"
2
3require gcc-csl-arm-2005q3.inc
4require gcc-cross.inc
5require gcc-configure-cross.inc
6require gcc-package-cross.inc
diff --git a/meta/packages/gcc/gcc-cross_csl-arm-2006q1.bb b/meta/packages/gcc/gcc-cross_csl-arm-2006q1.bb
index db4872d73a..49ac900184 100644
--- a/meta/packages/gcc/gcc-cross_csl-arm-2006q1.bb
+++ b/meta/packages/gcc/gcc-cross_csl-arm-2006q1.bb
@@ -1,19 +1,6 @@
1require gcc_csl-arm-2006q1.bb
2# path mangling, needed by the cross packaging
3require gcc-paths-cross.inc
4inherit cross
5# NOTE: split PR. If the main .oe changes something that affects its *build*
6# remember to increment this one too.
7PR = "r1" 1PR = "r1"
8 2
9DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc" 3require gcc-csl-arm-2006q1.inc
10# gmp-native mpfr-native" 4require gcc-cross.inc
11 5require gcc-configure-cross.inc
12PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
13
14# cross build
15require gcc4-build-cross.inc
16# cross packaging
17require gcc-package-cross.inc 6require gcc-package-cross.inc
18
19S = "${WORKDIR}/gcc-2006q1"
diff --git a/meta/packages/gcc/gcc-csl-arm-2005q3.inc b/meta/packages/gcc/gcc-csl-arm-2005q3.inc
new file mode 100644
index 0000000000..5d77ecbd07
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm-2005q3.inc
@@ -0,0 +1,22 @@
1require gcc-common.inc
2
3BINV = "3.4.4"
4PV = "3.4.4+csl-arm-2005q3"
5PV_chinook-compat = "3.4.4cs2005q3.2"
6
7FILESDIR = "${FILE_DIRNAME}/gcc-csl-arm"
8
9SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/arm-none-eabi/arm-2005q3-2-arm-none-eabi.src.tar.bz2 \
10 file://gcc_optab_arm.patch;patch=1 \
11 file://gcc-3.4.4-eabi-bigendian.patch;patch=1"
12
13S = "${WORKDIR}/gcc-2005q3"
14
15do_unpack2() {
16 cd ${WORKDIR}
17 tar -xvjf ./arm-2005q3-2-arm-none-eabi/gcc-2005q3-2.tar.bz2
18}
19
20addtask unpack2 after do_unpack before do_patch
21
22
diff --git a/meta/packages/gcc/gcc-csl-arm-2006q1.inc b/meta/packages/gcc/gcc-csl-arm-2006q1.inc
new file mode 100644
index 0000000000..a208170b47
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm-2006q1.inc
@@ -0,0 +1,19 @@
1require gcc-common.inc
2
3BINV = "4.1.0"
4PV = "4.1.0+csl-arm-2006q1-6"
5
6FILESDIR = "${FILE_DIRNAME}/gcc-csl-arm"
7
8SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/arm-none-eabi/arm-2006q1-6-arm-none-eabi.src.tar.bz2 \
9 file://gcc-configure-no-fortran.patch;patch=1;pnum=1 \
10 file://gcc-new-makeinfo.patch;patch=1"
11
12S = "${WORKDIR}/gcc-2006q1"
13
14do_unpack2() {
15 cd ${WORKDIR}
16 tar -xvjf ./arm-2006q1-6-arm-none-eabi/gcc-2006q1-6.tar.bz2
17}
18
19addtask unpack2 after do_unpack before do_patch
diff --git a/meta/packages/gcc/gcc-fpu.inc b/meta/packages/gcc/gcc-fpu.inc
deleted file mode 100644
index bb03d95567..0000000000
--- a/meta/packages/gcc/gcc-fpu.inc
+++ /dev/null
@@ -1,6 +0,0 @@
1
2def get_gcc_fpu_setting(bb, d):
3 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
4 return "--with-float=soft"
5 return ""
6
diff --git a/meta/packages/gcc/gcc-native.inc b/meta/packages/gcc/gcc-native.inc
index 3cf20a4589..6fa615ffc7 100644
--- a/meta/packages/gcc/gcc-native.inc
+++ b/meta/packages/gcc/gcc-native.inc
@@ -4,8 +4,6 @@ PROVIDES = "gcc-native-${PV}"
4 4
5inherit native 5inherit native
6 6
7FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
8
9# This is intended to be a -very- basic config 7# This is intended to be a -very- basic config
10EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \ 8EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${layout_prefix} \
11 --with-newlib \ 9 --with-newlib \
diff --git a/meta/packages/gcc/gcc-native_3.4.4.bb b/meta/packages/gcc/gcc-native_3.4.4.bb
index d70a4f5464..6f74a1ea46 100644
--- a/meta/packages/gcc/gcc-native_3.4.4.bb
+++ b/meta/packages/gcc/gcc-native_3.4.4.bb
@@ -1,3 +1,6 @@
1require gcc_${PV}.bb 1PR = "r7"
2
3require gcc-${PV}.inc
4require gcc-configure-target.inc
2require gcc-native.inc 5require gcc-native.inc
3PROVIDES += "gcc3-native" 6PROVIDES += "gcc3-native"
diff --git a/meta/packages/gcc/gcc-package-cross.inc b/meta/packages/gcc/gcc-package-cross.inc
index e1ffbd4e41..54294f4fa6 100644
--- a/meta/packages/gcc/gcc-package-cross.inc
+++ b/meta/packages/gcc/gcc-package-cross.inc
@@ -1,71 +1,65 @@
1# Packages emitted by our gcc-cross builds.
2#
3INHIBIT_PACKAGE_STRIP ?= "" 1INHIBIT_PACKAGE_STRIP ?= ""
4HAS_G2C ?= "yes"
5HAS_GFORTRAN ?= "no"
6OLD_INHIBIT_PACKAGE_STRIP := "${INHIBIT_PACKAGE_STRIP}" 2OLD_INHIBIT_PACKAGE_STRIP := "${INHIBIT_PACKAGE_STRIP}"
7INHIBIT_PACKAGE_STRIP = "1" 3INHIBIT_PACKAGE_STRIP = "1"
8 4
9# Do not generate *-dev packages as they are generated by 'gcc' recipe
10PACKAGES = "libgcc libstdc++ libg2c libgfortran" 5PACKAGES = "libgcc libstdc++ libg2c libgfortran"
11 6
12# Called from within gcc-cross, so libdir is set wrong 7# Called from within gcc-cross, so libdir is set wrong
13FILES_libg2c = "${target_libdir}/libg2c.so.*" 8FILES_libg2c = "${target_libdir}/libg2c.so.*"
14FILES_libg2c-dev = "${target_libdir}/libg2c.so \
15 ${target_libdir}/libg2c.a \
16 ${target_libdir}/libfrtbegin.a"
17 9
18FILES_libgfortran = "${target_libdir}/libgfortran.so.*" 10FILES_libgfortran = "${target_libdir}/libgfortran.so.*"
19FILES_libgfortran-dev = "${target_libdir}/libgfortran.a \
20 ${target_libdir}/libgfortran.so \
21 ${target_libdir}/libgfortranbegin.a"
22 11
23FILES_libgcc = "${target_base_libdir}/libgcc_s.so.1" 12FILES_libgcc = "${target_base_libdir}/libgcc_s.so.1"
24FILES_libgcc-dev = "${target_base_libdir}/libgcc_s.so"
25 13
26FILES_libstdc++ = "${target_libdir}/libstdc++.so.*" 14FILES_libstdc++ = "${target_libdir}/libstdc++.so.*"
27FILES_libstdc++-dev = "${target_includedir}/c++/${PV} \
28 ${target_libdir}/libstdc++.so \
29 ${target_libdir}/libstdc++.la \
30 ${target_libdir}/libstdc++.a \
31 ${target_libdir}/libsupc++.la \
32 ${target_libdir}/libsupc++.a"
33
34python do_package() {
35 if bb.data.getVar('DEBIAN_NAMES', d, 1):
36 bb.data.setVar('PKG_libgcc', 'libgcc1', d)
37 bb.build.exec_func('package_do_package', d)
38}
39 15
40do_install () { 16do_install () {
41 oe_runmake 'DESTDIR=${D}' install 17 oe_runmake 'DESTDIR=${D}' install
42 18
43 # Move libgcc_s into /lib 19 # Move libgcc_s into /lib
44 mkdir -p ${D}${target_base_libdir} 20 mkdir -p ${D}${target_base_libdir}
45 if [ -f ${D}${target_base_libdir}/libgcc_s.so.? ]; then 21 if [ -f ${D}${target_base_libdir}/libgcc_s.so.? ]; then
46 # Already in the right location 22 # Already in the right location
47 : 23 :
48 elif [ -f ${D}${prefix}/lib/libgcc_s.so.? ]; then 24 elif [ -f ${D}${prefix}/lib/libgcc_s.so.? ]; then
49 mv -f ${D}${prefix}/lib/libgcc_s.so* ${D}${target_base_libdir} 25 mv -f ${D}${prefix}/lib/libgcc_s.so* ${D}${target_base_libdir} || true
50 else 26
51 mv -f ${D}${prefix}/*/lib/libgcc_s.so* ${D}${target_base_libdir} 27 elif [ -f ${D}${prefix}/*/lib/nof/libgcc_s.so.? ]; then
52 fi 28 mv -f ${D}${prefix}/*/lib/nof/libgcc_s.so* ${D}${target_base_libdir}
29 else
30 mv -f ${D}${prefix}/*/lib/libgcc_s.so* ${D}${target_base_libdir} || true
31 fi
32
33
53 34
54 # Move libstdc++ and libg2c into libdir (resetting our prefix to /usr 35 # Move libstdc++ and libg2c into libdir (resetting our prefix to /usr
55 mkdir -p ${D}${target_libdir} 36 mkdir -p ${D}${target_libdir}
56 mv -f ${D}${prefix}/*/lib/libstdc++.so* ${D}${target_libdir} 37
57 if [ "${HAS_G2C}" = "yes" ]; then 38 if [ -f ${D}${prefix}/*/lib/nof/libstdc++.so ]; then
58 mv -f ${D}${prefix}/*/lib/libg2c.so* ${D}${target_libdir} || true 39
59 fi 40 mv -f ${D}${prefix}/*/lib/nof/libstdc++.so* ${D}${target_libdir} || true
60 if [ "${HAS_GFORTRAN}" = "yes" ]; then 41 mv -f ${D}${prefix}/*/lib/nof/libg2c.so* ${D}${target_libdir} || true
61 mv -f ${D}${prefix}/*/lib/libgfortran*.so* ${D}${target_libdir} 42 mv -f ${D}${prefix}/*/lib/nof/libgfortran*.so* ${D}${target_libdir} || true
62 fi 43
44 else
45 mv -f ${D}${prefix}/*/lib/libstdc++.so* ${D}${target_libdir} || true
46 mv -f ${D}${prefix}/*/lib/libg2c.so* ${D}${target_libdir} || true
47 mv -f ${D}${prefix}/*/lib/libgfortran*.so* ${D}${target_libdir} || true
48 fi
49
50
63 51
64 # Manually run the target stripper since we won't get it run by 52 # Manually run the target stripper since we won't get it run by
65 # the packaging. 53 # the packaging.
66 if [ "x${OLD_INHIBIT_PACKAGE_STRIP}" != "x1" ]; then 54 if [ "x${OLD_INHIBIT_PACKAGE_STRIP}" != "x1" ]; then
67 ${TARGET_PREFIX}strip ${D}${target_libdir}/libstdc++.so.* 55 ${TARGET_PREFIX}strip ${D}${target_libdir}/libstdc++.so.*
68 ${TARGET_PREFIX}strip ${D}${target_libdir}/libg2c.so.* || true 56 ${TARGET_PREFIX}strip ${D}${target_libdir}/libg2c.so.* || true
69 ${TARGET_PREFIX}strip ${D}${target_base_libdir}/libgcc_s.so.* 57 ${TARGET_PREFIX}strip ${D}${target_base_libdir}/libgcc_s.so.* || true
70 fi 58 ${TARGET_PREFIX}strip ${D}${target_libdir}/libgfortran*.so* || true
59 fi
60
61 # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
62 # gfortran is fully backwards compatible. This is a safe and practical solution.
63 ln -sf ${CROSS_DIR}/bin/${TARGET_PREFIX}gfortran ${CROSS_DIR}/bin/${TARGET_PREFIX}g77 || true
64 ln -sf ${CROSS_DIR}/${TARGET_SYS}/bin/gfortran ${CROSS_DIR}/${TARGET_SYS}/bin/g77 || true
71} 65}
diff --git a/meta/packages/gcc/gcc-package-sdk.inc b/meta/packages/gcc/gcc-package-sdk.inc
index 635ab6d1f4..a36e632c9f 100644
--- a/meta/packages/gcc/gcc-package-sdk.inc
+++ b/meta/packages/gcc/gcc-package-sdk.inc
@@ -1,12 +1,4 @@
1#
2# Note gcc-package.inc was already included before us.
3#
4# We override PACKAGES and FILES to change the packaging
5#
6
7INHIBIT_PACKAGE_STRIP ?= "" 1INHIBIT_PACKAGE_STRIP ?= ""
8HAS_G2C ?= "yes"
9HAS_GFORTRAN ?= "no"
10OLD_INHIBIT_PACKAGE_STRIP := "${INHIBIT_PACKAGE_STRIP}" 2OLD_INHIBIT_PACKAGE_STRIP := "${INHIBIT_PACKAGE_STRIP}"
11INHIBIT_PACKAGE_STRIP = "1" 3INHIBIT_PACKAGE_STRIP = "1"
12 4
@@ -29,6 +21,12 @@ FILES_${PN} = "\
29 ${prefix}/${TARGET_SYS}/bin/* \ 21 ${prefix}/${TARGET_SYS}/bin/* \
30 ${prefix}/${TARGET_SYS}/lib/* \ 22 ${prefix}/${TARGET_SYS}/lib/* \
31 " 23 "
24FILES_${PN}-doc = "\
25 ${infodir} \
26 ${mandir} \
27 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
28 "
29
32do_install () { 30do_install () {
33 oe_runmake 'DESTDIR=${D}' install 31 oe_runmake 'DESTDIR=${D}' install
34 32
diff --git a/meta/packages/gcc/gcc-package-target.inc b/meta/packages/gcc/gcc-package-target.inc
new file mode 100644
index 0000000000..2c19c5ecc7
--- /dev/null
+++ b/meta/packages/gcc/gcc-package-target.inc
@@ -0,0 +1,157 @@
1PACKAGES = "\
2 ${PN} ${PN}-symlinks \
3 g++ g++-symlinks \
4 cpp cpp-symlinks \
5 g77 g77-symlinks \
6 gfortran gfortran-symlinks \
7 gcov gcov-symlinks \
8 libmudflap libmudflap-dev \
9 libgcc-dev \
10 libstdc++-dev \
11 libg2c-dev \
12 libgfortran-dev \
13 ${PN}-doc \
14"
15
16FILES_${PN} = "\
17 ${bindir}/${TARGET_PREFIX}gcc \
18 ${bindir}/${TARGET_PREFIX}gccbug \
19 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2 \
20 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
21 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
22 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
23 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
24"
25FILES_${PN}-symlinks = "\
26 ${bindir}/cc \
27 ${bindir}/gcc \
28 ${bindir}/gccbug \
29"
30
31FILES_g77 = "\
32 ${bindir}/${TARGET_PREFIX}g77 \
33 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
34"
35FILES_g77-symlinks = "\
36 ${bindir}/g77 \
37 ${bindir}/f77 \
38"
39FILES_gfortran = "\
40 ${bindir}/${TARGET_PREFIX}gfortran \
41 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
42"
43FILES_gfortran-symlinks = "\
44 ${bindir}/gfortran \
45 ${bindir}/f95"
46
47FILES_cpp = "\
48 ${bindir}/${TARGET_PREFIX}cpp \
49 ${base_libdir}/cpp \
50 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
51FILES_cpp-symlinks = "${bindir}/cpp"
52
53FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov"
54FILES_gcov-symlinks = "${bindir}/gcov"
55
56FILES_libgcc = "${base_libdir}/libgcc*.so.*"
57FILES_libgcc-dev = "${base_libdir}/libgcc*.so"
58
59# Called from within gcc-cross, so libdir is set wrong
60FILES_libg2c = "${target_libdir}/libg2c.so.*"
61FILES_libg2c-dev = "\
62 ${libdir}/libg2c.so \
63 ${libdir}/libg2c.a \
64 ${libdir}/libfrtbegin.a \
65"
66
67FILES_g++ = "\
68 ${bindir}/${TARGET_PREFIX}g++ \
69 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
70"
71FILES_g++-symlinks = "\
72 ${bindir}/c++ \
73 ${bindir}/g++ \
74"
75
76FILES_libstdc++ = "${libdir}/libstdc++.so.*"
77FILES_libstdc++-dev = "\
78 ${includedir}/c++/${BINV} \
79 ${libdir}/libstdc++.so \
80 ${libdir}/libstdc++.la \
81 ${libdir}/libstdc++.a \
82 ${libdir}/libsupc++.la \
83 ${libdir}/libsupc++.a \
84"
85
86FILES_libgfortran-dev = "${libdir}/libgfortran.a \
87 ${libdir}/libgfortran.so \
88 ${libdir}/libgfortranbegin.a"
89
90FILES_libmudflap = "${libdir}/libmudflap*.so.*"
91FILES_libmudflap-dev = "\
92 ${libdir}/libmudflap*.so \
93 ${libdir}/libmudflap*.a \
94 ${libdir}/libmudflap*.a \
95"
96
97FILES_${PN}-doc = "\
98 ${infodir} \
99 ${mandir} \
100 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
101"
102
103do_install () {
104 autotools_do_install
105
106 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
107 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
108 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
109
110 # Hack around specs file assumptions
111 test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
112
113 # Move libgcc_s into /lib
114 mkdir -p ${D}${base_libdir}
115 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
116 mv ${D}${libdir}/nof/libgcc_s.so.* ${D}${base_libdir}
117 else
118 mv ${D}${libdir}/libgcc_s.so.* ${D}${base_libdir}
119 fi
120 rm -f ${D}${libdir}/libgcc_s.so
121 ln -sf `echo ${libdir}/gcc/${TARGET_SYS}/${BINV} \
122 | tr -s / \
123 | sed -e 's,^/,,' -e 's,[^/]*,..,g'`/lib/libgcc_s.so.1 \
124 ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/libgcc_s.so
125
126 # We don't need libtool libraries
127 rm -f ${D}${libdir}/libg2c.la &>/dev/null || true
128
129 # Cleanup manpages..
130 rm -rf ${D}${mandir}/man7
131
132 # We use libiberty from binutils
133 rm -f ${D}${libdir}/libiberty.a
134
135 cd ${D}${bindir}
136
137 # We care about g++ not c++
138 rm -f *c++
139
140 # We don't care about the gcc-<version> ones for this
141 rm -f *gcc-?.?*
142
143 # These sometimes show up, they are strange, we remove them
144 rm -f ${TARGET_ARCH}-*${TARGET_ARCH}-*
145
146 # Symlinks so we can use these trivially on the target
147 ln -sf ${TARGET_SYS}-g77 g77 || true
148 ln -sf ${TARGET_SYS}-gfortran gfortran || true
149 ln -sf ${TARGET_SYS}-g++ g++
150 ln -sf ${TARGET_SYS}-gcc gcc
151 ln -sf g77 f77 || true
152 ln -sf gfortran f95 || true
153 ln -sf g++ c++
154 ln -sf gcc cc
155 ln -sf ${bindir}/${TARGET_SYS}-cpp ${D}${base_libdir}/cpp
156 ln -sf ${bindir}/${TARGET_SYS}-cpp ${D}${bindir}/cpp
157}
diff --git a/meta/packages/gcc/gcc-paths-cross.inc b/meta/packages/gcc/gcc-paths-cross.inc
deleted file mode 100644
index 3c08b1805d..0000000000
--- a/meta/packages/gcc/gcc-paths-cross.inc
+++ /dev/null
@@ -1,7 +0,0 @@
1# Note that we use := here, and require that this
2# is included at the correct point (before inheriting
3# cross) to ensure that libdir and includedir are
4# target paths, not CROSS_DIR paths.
5target_libdir := "${libdir}"
6target_includedir := "${includedir}"
7target_base_libdir := "${base_libdir}"
diff --git a/meta/packages/gcc/gcc3-build-sdk.inc b/meta/packages/gcc/gcc3-build-sdk.inc
deleted file mode 100644
index e2ec9565a7..0000000000
--- a/meta/packages/gcc/gcc3-build-sdk.inc
+++ /dev/null
@@ -1,27 +0,0 @@
1USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
2
3SRC_URI += 'file://sdk-libstdc++-includes.patch;patch=1'
4
5STAGING_TARGET_INCDIR = "${STAGING_DIR}/${TARGET_SYS}/include"
6STAGING_TARGET_LIBDIR = "${STAGING_DIR}/${TARGET_SYS}/lib"
7
8do_configure () {
9 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
10 (cd ${S}/libstdc++-v3 && autoreconf)
11 oe_runconf
12 mkdir -p gcc
13 ln -sf ${CROSS_DIR}/bin/${TARGET_PREFIX}as gcc/as
14 ln -sf ${CROSS_DIR}/bin/${TARGET_PREFIX}ld gcc/ld
15 ln -sf ${STAGING_TARGET_INCDIR}/* ${S}/include
16 ln -sf ${STAGING_TARGET_LIBDIR}/crt*.o gcc/
17}
18
19do_compile () {
20 export CC="${BUILD_CC}"
21 export AR_FOR_TARGET="${TARGET_SYS}-ar"
22 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
23 export LD_FOR_TARGET="${TARGET_SYS}-ld"
24 export NM_FOR_TARGET="${TARGET_SYS}-nm"
25 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
26 oe_runmake CFLAGS_FOR_TARGET="-I${STAGING_TARGET_INCDIR}"
27}
diff --git a/meta/packages/gcc/gcc4-build-cross.inc b/meta/packages/gcc/gcc4-build-cross.inc
deleted file mode 100644
index 8da5875a79..0000000000
--- a/meta/packages/gcc/gcc4-build-cross.inc
+++ /dev/null
@@ -1,6 +0,0 @@
1FORTRAN = ",fortran"
2HAS_GFORTRAN ?= "yes"
3HAS_G2C = "no"
4
5include gcc3-build-cross.inc
6
diff --git a/meta/packages/gcc/gcc4-build-sdk.inc b/meta/packages/gcc/gcc4-build-sdk.inc
deleted file mode 100644
index d6af5fe933..0000000000
--- a/meta/packages/gcc/gcc4-build-sdk.inc
+++ /dev/null
@@ -1,20 +0,0 @@
1USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
2USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibcgnueabi", "no", "", d )}'
3
4EXTRA_OECONF += "--with-sysroot=${prefix}/${TARGET_SYS} --with-build-sysroot=${STAGING_DIR_TARGET}"
5
6do_configure () {
7 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
8 (cd ${S}/libstdc++-v3 && autoreconf)
9 oe_runconf
10}
11
12do_compile () {
13 export CC="${BUILD_CC}"
14 export AR_FOR_TARGET="${TARGET_SYS}-ar"
15 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
16 export LD_FOR_TARGET="${TARGET_SYS}-ld"
17 export NM_FOR_TARGET="${TARGET_SYS}-nm"
18 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
19 oe_runmake
20}
diff --git a/meta/packages/gcc/gcc4-build.inc b/meta/packages/gcc/gcc4-build.inc
deleted file mode 100644
index b8a214a590..0000000000
--- a/meta/packages/gcc/gcc4-build.inc
+++ /dev/null
@@ -1,6 +0,0 @@
1FORTRAN = ",f95"
2HAS_GFORTRAN ?= "yes"
3HAS_G2C = "no"
4
5include gcc3-build.inc
6
diff --git a/meta/packages/gcc/gcc_3.4.4.bb b/meta/packages/gcc/gcc_3.4.4.bb
index 69a00582a8..5e2598079b 100644
--- a/meta/packages/gcc/gcc_3.4.4.bb
+++ b/meta/packages/gcc/gcc_3.4.4.bb
@@ -1,30 +1,5 @@
1PR = "r6" 1PR = "r7"
2DESCRIPTION = "The GNU cc and gcc C compilers."
3HOMEPAGE = "http://www.gnu.org/software/gcc/"
4SECTION = "devel"
5LICENSE = "GPL"
6 2
7inherit autotools gettext 3require gcc-${PV}.inc
8 4require gcc-configure-target.inc
9require gcc-package.inc 5require gcc-package-target.inc
10
11SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
12 file://gcc34-reverse-compare.patch;patch=1 \
13 file://gcc34-arm-ldm.patch;patch=1 \
14 file://gcc34-arm-ldm-peephole.patch;patch=1 \
15 file://gcc34-arm-tune.patch;patch=1 \
16 file://gcc-3.4.1-uclibc-100-conf.patch;patch=1 \
17 file://gcc-3.4.1-uclibc-200-locale.patch;patch=1 \
18 file://gcc-3.4.0-arm-lib1asm.patch;patch=1 \
19 file://gcc-3.4.0-arm-nolibfloat.patch;patch=1 \
20 file://gcc-3.4.0-arm-bigendian.patch;patch=1 \
21 file://gcc-3.4.0-arm-bigendian-uclibc.patch;patch=1 \
22 file://GCC3.4.0VisibilityPatch.diff;patch=1 \
23 file://15342.patch;patch=1 \
24 file://jarfix.patch;patch=1 \
25 file://always-fixincperm.patch;patch=1"
26
27SRC_URI += "file://gcc34-configure.in.patch;patch=1"
28SRC_URI += "file://gcc34-thumb-support.patch;patch=1"
29
30require gcc3-build.inc
diff --git a/meta/packages/gcc/gcc_4.0.2.bb b/meta/packages/gcc/gcc_4.0.2.bb
index 299b6bbd8c..5e2598079b 100644
--- a/meta/packages/gcc/gcc_4.0.2.bb
+++ b/meta/packages/gcc/gcc_4.0.2.bb
@@ -1,27 +1,5 @@
1DESCRIPTION = "The GNU cc and gcc C compilers." 1PR = "r7"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5DEPENDS = "mpfr gmp"
6PR = "r1"
7 2
8inherit autotools gettext 3require gcc-${PV}.inc
9 4require gcc-configure-target.inc
10require gcc-package.inc 5require gcc-package-target.inc
11
12SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
13 file://arm-nolibfloat.patch;patch=1 \
14 file://arm-softfloat.patch;patch=1 \
15 file://ldflags.patch;patch=1"
16
17# uclibc patches below
18SRC_URI_append = " file://100-uclibc-conf.patch;patch=1 \
19 file://200-uclibc-locale.patch;patch=1 \
20 file://301-missing-execinfo_h.patch;patch=1 \
21 file://302-c99-snprintf.patch;patch=1 \
22 file://303-c99-complex-ugly-hack.patch;patch=1 \
23 file://800-arm-bigendian.patch;patch=1 \
24 file://zecke-host-cpp-ac-hack.patch;patch=1 "
25
26
27require gcc4-build.inc
diff --git a/meta/packages/gcc/gcc_4.1.2.bb b/meta/packages/gcc/gcc_4.1.2.bb
index c4a124081f..c51eb23b05 100644
--- a/meta/packages/gcc/gcc_4.1.2.bb
+++ b/meta/packages/gcc/gcc_4.1.2.bb
@@ -1,54 +1,7 @@
1PR = "r3" 1PR = "r11"
2DESCRIPTION = "The GNU cc and gcc C compilers."
3HOMEPAGE = "http://www.gnu.org/software/gcc/"
4SECTION = "devel"
5LICENSE = "GPL"
6 2
7ARM_INSTRUCTION_SET = "arm" 3require gcc-${PV}.inc
8 4require gcc-configure-target.inc
9inherit autotools gettext 5require gcc-package-target.inc
10
11require gcc-package.inc
12
13SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2 \
14 file://100-uclibc-conf.patch;patch=1 \
15 file://110-arm-eabi.patch;patch=1 \
16 file://200-uclibc-locale.patch;patch=1 \
17 file://300-libstdc++-pic.patch;patch=1 \
18 file://301-missing-execinfo_h.patch;patch=1 \
19 file://302-c99-snprintf.patch;patch=1 \
20 file://303-c99-complex-ugly-hack.patch;patch=1 \
21 file://304-index_macro.patch;patch=1 \
22 file://602-sdk-libstdc++-includes.patch;patch=1 \
23 file://740-sh-pr24836.patch;patch=1 \
24 file://800-arm-bigendian.patch;patch=1 \
25 file://arm-nolibfloat.patch;patch=1 \
26 file://arm-softfloat.patch;patch=1 \
27 file://gcc41-configure.in.patch;patch=1 \
28 file://arm-thumb.patch;patch=1 \
29 file://arm-thumb-cache.patch;patch=1 \
30 file://ldflags.patch;patch=1 \
31 file://zecke-xgcc-cpp.patch;patch=1 \
32 file://unbreak-armv4t.patch;patch=1 \
33 file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \
34 file://cache-amnesia.patch;patch=1 \
35 "
36
37SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
38
39#Set the fortran bits
40# 'fortran' or '', not 'f77' like gcc3 had
41FORTRAN = ""
42HAS_GFORTRAN = "no"
43HAS_G2C = "no"
44
45#Set the java bits
46JAVA_arm = ""
47JAVA = ""
48
49LANGUAGES = "c,c++${FORTRAN}${JAVA}"
50require gcc3-build.inc
51
52
53EXTRA_OECONF += " --disable-libssp "
54 6
7ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
diff --git a/meta/packages/gcc/gcc_4.2.2.bb b/meta/packages/gcc/gcc_4.2.2.bb
index 6c5a17e151..7238aed4d7 100644
--- a/meta/packages/gcc/gcc_4.2.2.bb
+++ b/meta/packages/gcc/gcc_4.2.2.bb
@@ -1,96 +1,10 @@
1DESCRIPTION = "The GNU cc and gcc C compilers." 1PR = "r6"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5PR = "r8"
6 2
7inherit autotools gettext 3require gcc-${PV}.inc
4require gcc-configure-target.inc
5require gcc-package-target.inc
8 6
9require gcc-package.inc 7SRC_URI_append = "file://fortran-cross-compile-hack.patch;patch=1"
10 8
11SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ 9ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
12 file://100-uclibc-conf.patch;patch=1 \
13 file://103-uclibc-conf-noupstream.patch;patch=1 \
14 file://200-uclibc-locale.patch;patch=1 \
15 file://203-uclibc-locale-no__x.patch;patch=1 \
16 file://204-uclibc-locale-wchar_fix.patch;patch=1 \
17 file://205-uclibc-locale-update.patch;patch=1 \
18 file://300-libstdc++-pic.patch;patch=1 \
19 file://301-missing-execinfo_h.patch;patch=1 \
20 file://302-c99-snprintf.patch;patch=1 \
21 file://303-c99-complex-ugly-hack.patch;patch=1 \
22 file://304-index_macro.patch;patch=1 \
23 file://305-libmudflap-susv3-legacy.patch;patch=1 \
24 file://306-libstdc++-namespace.patch;patch=1 \
25 file://307-locale_facets.patch;patch=1 \
26 file://402-libbackend_dep_gcov-iov.h.patch;patch=1 \
27 file://602-sdk-libstdc++-includes.patch;patch=1 \
28 file://740-sh-pr24836.patch;patch=1 \
29 file://800-arm-bigendian.patch;patch=1 \
30 file://801-arm-bigendian-eabi.patch;patch=1 \
31 file://904-flatten-switch-stmt-00.patch;patch=1 \
32 file://arm-nolibfloat.patch;patch=1 \
33 file://arm-softfloat.patch;patch=1 \
34 file://gcc41-configure.in.patch;patch=1 \
35 file://arm-thumb.patch;patch=1 \
36 file://arm-thumb-cache.patch;patch=1 \
37 file://ldflags.patch;patch=1 \
38 file://zecke-xgcc-cpp.patch;patch=1 \
39 file://unbreak-armv4t.patch;patch=1 \
40 file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \
41 file://cache-amnesia.patch;patch=1 \
42 file://gfortran.patch;patch=1 \
43 file://gcc-4.0.2-e300c2c3.patch;patch=1 \
44 file://pr34130.patch;patch=1 \
45 file://fortran-static-linking.patch;patch=1 \
46 file://intermask-bigendian.patch;patch=1 \
47"
48 10
49SRC_URI_append_ep93xx = " \
50 file://arm-crunch-saveregs.patch;patch=1 \
51 file://arm-crunch-20000320.patch;patch=1 \
52 file://arm-crunch-compare.patch;patch=1 \
53 file://arm-crunch-compare-unordered.patch;patch=1 \
54 file://arm-crunch-compare-geu.patch;patch=1 \
55 file://arm-crunch-eabi-ieee754.patch;patch=1 \
56 file://arm-crunch-eabi-ieee754-div.patch;patch=1 \
57 file://arm-crunch-64bit-disable0.patch;patch=1 \
58 file://arm-crunch-offset.patch;patch=1 \
59 file://arm-crunch-fp_consts.patch;patch=1 \
60 file://arm-crunch-neg2.patch;patch=1 \
61 file://arm-crunch-predicates3.patch;patch=1 \
62 file://arm-crunch-cfcvtds-disable.patch;patch=1 \
63 file://arm-crunch-floatsi-disable.patch;patch=1 \
64 file://arm-crunch-truncsi-disable.patch;patch=1 \
65 file://arm-crunch-cfcvt64-disable.patch;patch=1 \
66 file://arm-crunch-cirrus-bugfixes.patch;patch=1 \
67 "
68
69PACKAGE_ARCH_ep93xx = "${MACHINE_ARCH}"
70
71SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
72
73#Set the fortran bits
74# 'i,fortran' or '', not 'f77' like gcc3 had
75FORTRAN = ""
76FORTRAN_linux-gnueabi = ",fortran"
77
78DEPENDS += " gmp mpfr "
79
80#Set the java bits
81JAVA = ""
82JAVA_arm = ""
83
84LANGUAGES = "c,c++${FORTRAN}${JAVA}"
85require gcc3-build.inc
86ARCH_FLAGS_FOR_TARGET=-isystem${STAGING_INCDIR}
87
88
89EXTRA_OECONF += " --disable-libssp --disable-bootstrap "
90
91# We know some one is including us, but we only want to apply this fortran hack for the real gcc
92python __anonymous () {
93 import bb
94 if bb.data.getVar('PN', d, True) == "gcc":
95 bb.data.setVar('SRC_URI_append', ' file://fortran-cross-compile-hack.patch;patch=1', d)
96}
diff --git a/meta/packages/gcc/gcc_csl-arm-2005q3-2.bb b/meta/packages/gcc/gcc_csl-arm-2005q3-2.bb
deleted file mode 100644
index 6a39587235..0000000000
--- a/meta/packages/gcc/gcc_csl-arm-2005q3-2.bb
+++ /dev/null
@@ -1,27 +0,0 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5BINV = "3.4.4"
6PV = "3.4.4+csl-arm-2005q3-2"
7PR = "r1"
8
9FILESDIR = "${FILE_DIRNAME}/gcc-csl-arm"
10
11inherit autotools gettext
12
13require gcc-package.inc
14
15SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2005q3-2-arm-none-linux-gnueabi.src.tar.bz2"
16
17do_unpack2() {
18 cd ${WORKDIR}
19 tar -xvjf ./arm-2005q3-2-arm-none-linux-gnueabi/gcc-2005q3-2.tar.bz2
20 rm -rf ./arm-2005q3-2-arm-none-linux-gnueabi
21}
22
23addtask unpack2 after do_unpack before do_patch
24
25require gcc3-build.inc
26
27S = "${WORKDIR}/gcc-2005q3"
diff --git a/meta/packages/gcc/gcc_csl-arm-2005q3.bb b/meta/packages/gcc/gcc_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..cc7540af15
--- /dev/null
+++ b/meta/packages/gcc/gcc_csl-arm-2005q3.bb
@@ -0,0 +1,5 @@
1PR = "r3"
2
3require gcc-${PV}.inc
4require gcc-configure-target.inc
5require gcc-package-target.inc
diff --git a/meta/packages/gcc/gcc_csl-arm-2006q1.bb b/meta/packages/gcc/gcc_csl-arm-2006q1.bb
index a4d7c5ba17..832167ca4e 100644
--- a/meta/packages/gcc/gcc_csl-arm-2006q1.bb
+++ b/meta/packages/gcc/gcc_csl-arm-2006q1.bb
@@ -1,31 +1,5 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5BINV = "4.1.0"
6PV = "4.1.0+csl-arm-2006q1-6"
7PR = "r1" 1PR = "r1"
8 2
9FILESDIR = "${FILE_DIRNAME}/gcc-csl-arm" 3require gcc-${PV}.inc
10 4require gcc-configure-target.inc
11inherit autotools gettext 5require gcc-package-target.inc
12
13require gcc-package.inc
14
15SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/arm-none-eabi/arm-2006q1-6-arm-none-eabi.src.tar.bz2 \
16 file://gcc-configure-no-fortran.patch;patch=1;pnum=1 \
17 file://gcc-new-makeinfo.patch;patch=1"
18
19#the optabi patch is already applied
20
21do_unpack2() {
22 cd ${WORKDIR}
23 pwd
24 tar -xvjf ./arm-2006q1-6-arm-none-eabi/gcc-2006q1-6.tar.bz2
25}
26
27addtask unpack2 after do_unpack before do_patch
28
29require gcc4-build.inc
30
31S = "${WORKDIR}/gcc-2006q1"