OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [gcc-zippatch.patch] - Blame information for rev 139

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/config.sub gcc-5.3.0-zip/config.sub
2
--- gcc-5.3.0-original/config.sub       2015-01-02 04:30:21.000000000 -0500
3
+++ gcc-5.3.0-zip/config.sub    2016-01-30 12:27:56.023073747 -0500
4
@@ -316,7 +316,7 @@
5
        | visium \
6
        | we32k \
7
        | x86 | xc16x | xstormy16 | xtensa \
8
-       | z8k | z80)
9
+       | z8k | z80 | zip)
10
                basic_machine=$basic_machine-unknown
11
                ;;
12
        c54x)
13
@@ -1547,6 +1547,9 @@
14
 # system, and we'll never get to this point.
15
 
16
 case $basic_machine in
17
+       zip-*)
18
+               os=-elf
19
+               ;;
20
        score-*)
21
                os=-elf
22
                ;;
23
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/configure gcc-5.3.0-zip/configure
24
--- gcc-5.3.0-original/configure        2015-05-03 13:29:57.000000000 -0400
25
+++ gcc-5.3.0-zip/configure     2016-01-30 16:19:48.264867231 -0500
26
@@ -3927,6 +3927,8 @@
27
   vax-*-*)
28
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
29
     ;;
30
+  zip*)
31
+    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
32
 esac
33
 
34
 # If we aren't building newlib, then don't build libgloss, since libgloss
35
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/configure.ac gcc-5.3.0-zip/configure.ac
36
--- gcc-5.3.0-original/configure.ac     2015-05-03 13:29:57.000000000 -0400
37
+++ gcc-5.3.0-zip/configure.ac  2016-02-12 10:47:23.847194843 -0500
38
@@ -1274,6 +1274,10 @@
39
   vax-*-*)
40
     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
41
     ;;
42
+  zip*)
43
+    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb gprof"
44
+    unsupported_languages="$unsupported_languages fortran java"
45
+    ;;
46
 esac
47
 
48
 # If we aren't building newlib, then don't build libgloss, since libgloss
49 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cfgexpand.c gcc-5.3.0-zip/gcc/cfgexpand.c
50
--- gcc-5.3.0-original/gcc/cfgexpand.c  2015-07-23 06:39:26.000000000 -0400
51
+++ gcc-5.3.0-zip/gcc/cfgexpand.c       2016-04-01 06:40:17.288326711 -0400
52
@@ -108,6 +108,14 @@
53
 #include "tree-chkp.h"
54
 #include "rtl-chkp.h"
55
 
56
+#ifdef DO_ZIP_DEBUGS
57
+#include <stdio.h>
58
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX);} while(0)
59
+extern void    zip_debug_rtx(const_rtx);
60
+#else
61
+#define        ZIP_DEBUG_LINE(STR,RTX)
62
+#endif
63
+
64
 /* Some systems use __main in a way incompatible with its use in gcc, in these
65
    cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
66
    give the same symbol without quotes for an alternative entry point.  You
67 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cgraphbuild.c gcc-5.3.0-zip/gcc/cgraphbuild.c
68
--- gcc-5.3.0-original/gcc/cgraphbuild.c        2015-01-09 15:18:42.000000000 -0500
69
+++ gcc-5.3.0-zip/gcc/cgraphbuild.c     2016-03-24 22:13:24.815287808 -0400
70
@@ -62,6 +62,13 @@
71
 #include "ipa-prop.h"
72
 #include "ipa-inline.h"
73
 
74
+#ifdef DO_ZIP_DEBUGS
75
+extern void zip_debug_rtx(const_rtx);
76
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
77
+#else
78
+#define        ZIP_DEBUG_LINE(STR,RTX)
79
+#endif
80
+
81
 /* Context of record_reference.  */
82
 struct record_reference_ctx
83
 {
84 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/common/config/zip/zip-common.c gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c
85
--- gcc-5.3.0-original/gcc/common/config/zip/zip-common.c       1969-12-31 19:00:00.000000000 -0500
86
+++ gcc-5.3.0-zip/gcc/common/config/zip/zip-common.c    2016-02-14 00:54:31.821055716 -0500
87
@@ -0,0 +1,52 @@
88
+////////////////////////////////////////////////////////////////////////////////
89
+//
90
+// Filename:   common/config/zip/zip-common.c
91
+//
92
+// Project:    Zip CPU backend for the GNU Compiler Collection
93
+//
94
+// Purpose:    To eliminate the frame register automatically.
95
+//
96
+// Creator:    Dan Gisselquist, Ph.D.
97
+//             Gisselquist Technology, LLC
98
+//
99
+////////////////////////////////////////////////////////////////////////////////
100
+//
101
+// Copyright (C) 2016, Gisselquist Technology, LLC
102
+//
103
+// This program is free software (firmware): you can redistribute it and/or
104
+// modify it under the terms of  the GNU General Public License as published
105
+// by the Free Software Foundation, either version 3 of the License, or (at
106
+// your option) any later version.
107
+//
108
+// This program is distributed in the hope that it will be useful, but WITHOUT
109
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
110
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
111
+// for more details.
112
+//
113
+// You should have received a copy of the GNU General Public License along
114
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
115
+// target there if the PDF file isn't present.)  If not, see
116
+// <http://www.gnu.org/licenses/> for a copy.
117
+//
118
+// License:    GPL, v3, as defined and found on www.gnu.org,
119
+//             http://www.gnu.org/licenses/gpl.html
120
+//
121
+//
122
+////////////////////////////////////////////////////////////////////////////////
123
+#include "config.h"
124
+#include "system.h"
125
+#include "coretypes.h"
126
+#include "tm.h"
127
+#include "common/common-target.h"
128
+#include "common/common-target-def.h"
129
+
130
+static const struct default_options zip_option_optimization_table[] =
131
+  {
132
+    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
133
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
134
+  };
135
+
136
+#undef TARGET_OPTION_OPTIMIZATION_TABLE
137
+#define        TARGET_OPTION_OPTIMIZATION_TABLE        zip_option_optimization_table
138
+
139
+struct gcc_targetm_common      targetm_common = TARGETM_COMMON_INITIALIZER;
140
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h
141 138 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-05-06 10:50:31.943799053 -0400
142 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h    2015-07-24 12:00:26.000000000 -0400
143
@@ -21,7 +21,7 @@
144
 #ifndef GCC_AARCH64_LINUX_H
145
 #define GCC_AARCH64_LINUX_H
146
 
147
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
148
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
149
 
150
 #undef  ASAN_CC1_SPEC
151
 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
152
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/alpha/linux-elf.h gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h
153 138 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-05-06 10:50:31.943799053 -0400
154 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h  2015-01-05 07:33:28.000000000 -0500
155
@@ -23,8 +23,8 @@
156
 #define EXTRA_SPECS \
157
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
158
 
159
-#define GLIBC_DYNAMIC_LINKER   "/tools/lib/ld-linux.so.2"
160
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
161
+#define GLIBC_DYNAMIC_LINKER   "/lib/ld-linux.so.2"
162
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
163
 #if DEFAULT_LIBC == LIBC_UCLIBC
164
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
165
 #elif DEFAULT_LIBC == LIBC_GLIBC
166
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/arm/linux-eabi.h gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h
167 138 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-05-06 10:50:31.943799053 -0400
168 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h   2015-01-05 07:33:28.000000000 -0500
169
@@ -68,8 +68,8 @@
170
    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
171
 
172
 #undef  GLIBC_DYNAMIC_LINKER
173
-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/tools/lib/ld-linux.so.3"
174
-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/tools/lib/ld-linux-armhf.so.3"
175
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
176
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
177
 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
178
 
179
 #define GLIBC_DYNAMIC_LINKER \
180
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/arm/linux-elf.h gcc-5.3.0-zip/gcc/config/arm/linux-elf.h
181 138 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-05-06 10:50:31.943799053 -0400
182 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/arm/linux-elf.h    2015-06-23 05:26:54.000000000 -0400
183
@@ -62,7 +62,7 @@
184
 
185
 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
186
 
187
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
188
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
189
 
190
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
191
    %{static:-Bstatic} \
192
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/bfin/linux.h gcc-5.3.0-zip/gcc/config/bfin/linux.h
193 138 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-05-06 10:50:31.943799053 -0400
194 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/bfin/linux.h       2015-01-05 07:33:28.000000000 -0500
195
@@ -45,7 +45,7 @@
196
   %{shared:-G -Bdynamic} \
197
   %{!shared: %{!static: \
198
    %{rdynamic:-export-dynamic} \
199
-   -dynamic-linker /tools/lib/ld-uClibc.so.0} \
200
+   -dynamic-linker /lib/ld-uClibc.so.0} \
201
    %{static}} -init __init -fini __fini"
202
 
203
 #undef TARGET_SUPPORTS_SYNC_CALLS
204
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/cris/linux.h gcc-5.3.0-zip/gcc/config/cris/linux.h
205 138 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-05-06 10:50:31.943799053 -0400
206 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/cris/linux.h       2015-01-05 07:33:28.000000000 -0500
207
@@ -102,7 +102,7 @@
208
 #undef CRIS_DEFAULT_CPU_VERSION
209
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
210
 
211
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
212
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
213
 
214
 #undef CRIS_LINK_SUBTARGET_SPEC
215
 #define CRIS_LINK_SUBTARGET_SPEC \
216
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/freebsd-spec.h gcc-5.3.0-zip/gcc/config/freebsd-spec.h
217 138 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-05-06 10:50:31.943799053 -0400
218 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/freebsd-spec.h     2015-06-25 13:53:14.000000000 -0400
219
@@ -129,9 +129,9 @@
220
 #endif
221
 
222
 #if FBSD_MAJOR < 6
223
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
224
+#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
225
 #else
226
-#define FBSD_DYNAMIC_LINKER "/tools/libexec/ld-elf.so.1"
227
+#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
228
 #endif
229
 
230
 /* NOTE: The freebsd-spec.h header is included also for various
231
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/frv/linux.h gcc-5.3.0-zip/gcc/config/frv/linux.h
232 138 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-05-06 10:50:31.943799053 -0400
233 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/frv/linux.h        2015-01-05 07:33:28.000000000 -0500
234
@@ -34,7 +34,7 @@
235
 #define ENDFILE_SPEC \
236
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
237
 
238
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
239
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
240
 
241
 #undef LINK_SPEC
242
 #define LINK_SPEC "\
243
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/gnu.h gcc-5.3.0-zip/gcc/config/i386/gnu.h
244 138 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-05-06 10:50:31.943799053 -0400
245 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/gnu.h 2015-01-05 07:33:28.000000000 -0500
246
@@ -22,7 +22,7 @@
247
 #define GNU_USER_LINK_EMULATION "elf_i386"
248
 
249
 #undef GNU_USER_DYNAMIC_LINKER
250
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so"
251
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so"
252
 
253
 #undef STARTFILE_SPEC
254
 #if defined HAVE_LD_PIE
255
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h
256 138 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-05-06 10:50:31.943799053 -0400
257 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h      2015-01-05 07:33:28.000000000 -0500
258
@@ -22,6 +22,6 @@
259
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
260
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64_fbsd"
261
 
262
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
263
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-kfreebsd-x86-64.so.1"
264
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/lib/ld-kfreebsd-x32.so.1"
265
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
266
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
267
+#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
268
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h
269 138 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-05-06 10:50:31.943799053 -0400
270 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h        2015-01-05 07:33:28.000000000 -0500
271
@@ -19,4 +19,4 @@
272
 <http://www.gnu.org/licenses/>.  */
273
 
274
 #define GNU_USER_LINK_EMULATION "elf_i386_fbsd"
275
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
276
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
277
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux64.h gcc-5.3.0-zip/gcc/config/i386/linux64.h
278 138 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-05-06 10:50:31.947799027 -0400
279 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux64.h     2015-01-05 07:33:28.000000000 -0500
280
@@ -27,6 +27,6 @@
281
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
282
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
283
 
284
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
285
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux-x86-64.so.2"
286
-#define GLIBC_DYNAMIC_LINKERX32 "/tools/libx32/ld-linux-x32.so.2"
287
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
288
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
289
+#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
290
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux.h gcc-5.3.0-zip/gcc/config/i386/linux.h
291 138 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-05-06 10:50:31.947799027 -0400
292 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/i386/linux.h       2015-01-05 07:33:28.000000000 -0500
293
@@ -20,4 +20,4 @@
294
 <http://www.gnu.org/licenses/>.  */
295
 
296
 #define GNU_USER_LINK_EMULATION "elf_i386"
297
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
298
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
299
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/ia64/linux.h gcc-5.3.0-zip/gcc/config/ia64/linux.h
300 138 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-05-06 10:50:31.947799027 -0400
301 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/ia64/linux.h       2015-01-05 07:33:28.000000000 -0500
302
@@ -55,7 +55,7 @@
303
 /* Define this for shared library support because it isn't in the main
304
    linux.h file.  */
305
 
306
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux-ia64.so.2"
307
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
308
 
309
 #undef LINK_SPEC
310
 #define LINK_SPEC "\
311
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/knetbsd-gnu.h gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h
312 138 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-05-06 10:50:31.947799027 -0400
313 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h      2015-01-05 07:33:28.000000000 -0500
314
@@ -32,4 +32,4 @@
315
 
316
 
317
 #undef GNU_USER_DYNAMIC_LINKER
318
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
319
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
320
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h
321 138 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-05-06 10:50:31.947799027 -0400
322 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h 2015-01-05 07:33:28.000000000 -0500
323
@@ -31,5 +31,4 @@
324
   while (0)
325
 
326
 #undef GNU_USER_DYNAMIC_LINKER
327
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
328
-
329
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
330
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/linux.h gcc-5.3.0-zip/gcc/config/linux.h
331 138 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-05-06 10:50:31.947799027 -0400
332 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/linux.h    2015-01-05 07:33:28.000000000 -0500
333
@@ -73,10 +73,10 @@
334
    GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
335
    GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
336
    supporting both 32-bit and 64-bit compilation.  */
337
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
338
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
339
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
340
-#define UCLIBC_DYNAMIC_LINKERX32 "/tools/lib/ldx32-uClibc.so.0"
341
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
342
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
343
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
344
+#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
345
 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
346
 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
347
 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
348
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h
349 138 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-05-06 10:50:31.947799027 -0400
350 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h 2015-01-05 07:33:28.000000000 -0500
351
@@ -67,7 +67,7 @@
352
    %{shared:-shared} \
353
    %{symbolic:-Bsymbolic} \
354
    %{rdynamic:-export-dynamic} \
355
-   -dynamic-linker /tools/lib/ld-linux.so.2"
356
+   -dynamic-linker /lib/ld-linux.so.2"
357
 
358
 #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
359
 
360
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/m68k/linux.h gcc-5.3.0-zip/gcc/config/m68k/linux.h
361 138 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-05-06 10:50:31.947799027 -0400
362 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/m68k/linux.h       2015-01-05 07:33:28.000000000 -0500
363
@@ -71,7 +71,7 @@
364
    When the -shared link option is used a final link is not being
365
    done.  */
366
 
367
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
368
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
369
 
370
 #undef LINK_SPEC
371
 #define LINK_SPEC "-m m68kelf %{shared} \
372
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/microblaze/linux.h gcc-5.3.0-zip/gcc/config/microblaze/linux.h
373 138 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-05-06 10:50:31.947799027 -0400
374 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/microblaze/linux.h 2015-05-28 10:08:19.000000000 -0400
375
@@ -28,7 +28,7 @@
376
 #undef TLS_NEEDS_GOT
377
 #define TLS_NEEDS_GOT 1
378
 
379
-#define DYNAMIC_LINKER "/tools/lib/ld.so.1"
380
+#define DYNAMIC_LINKER "/lib/ld.so.1"
381
 #undef  SUBTARGET_EXTRA_SPECS
382
 #define SUBTARGET_EXTRA_SPECS \
383
   { "dynamic_linker", DYNAMIC_LINKER }
384
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mips/linux.h gcc-5.3.0-zip/gcc/config/mips/linux.h
385 138 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-05-06 10:50:31.947799027 -0400
386 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mips/linux.h       2015-01-05 07:33:28.000000000 -0500
387
@@ -22,20 +22,20 @@
388
 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
389
 
390
 #define GLIBC_DYNAMIC_LINKER32 \
391
-  "%{mnan=2008:/tools/lib/ld-linux-mipsn8.so.1;:/tools/lib/ld.so.1}"
392
+  "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
393
 #define GLIBC_DYNAMIC_LINKER64 \
394
-  "%{mnan=2008:/tools/lib64/ld-linux-mipsn8.so.1;:/tools/lib64/ld.so.1}"
395
+  "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
396
 #define GLIBC_DYNAMIC_LINKERN32 \
397
-  "%{mnan=2008:/tools/lib32/ld-linux-mipsn8.so.1;:/tools/lib32/ld.so.1}"
398
+  "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
399
 
400
 #undef UCLIBC_DYNAMIC_LINKER32
401
 #define UCLIBC_DYNAMIC_LINKER32 \
402
-  "%{mnan=2008:/tools/lib/ld-uClibc-mipsn8.so.0;:/tools/lib/ld-uClibc.so.0}"
403
+  "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
404
 #undef UCLIBC_DYNAMIC_LINKER64
405
 #define UCLIBC_DYNAMIC_LINKER64 \
406
-  "%{mnan=2008:/tools/lib/ld64-uClibc-mipsn8.so.0;:/tools/lib/ld64-uClibc.so.0}"
407
+  "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
408
 #define UCLIBC_DYNAMIC_LINKERN32 \
409
-  "%{mnan=2008:/tools/lib32/ld-uClibc-mipsn8.so.0;:/tools/lib32/ld-uClibc.so.0}"
410
+  "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
411
 
412
 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
413
 #define GNU_USER_DYNAMIC_LINKERN32 \
414
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mn10300/linux.h gcc-5.3.0-zip/gcc/config/mn10300/linux.h
415 138 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-05-06 10:50:31.947799027 -0400
416 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/mn10300/linux.h    2015-01-05 07:33:28.000000000 -0500
417
@@ -32,7 +32,7 @@
418
 #undef  ASM_SPEC
419
 #define ASM_SPEC ""
420
 
421
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
422
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
423
 
424
 #undef  LINK_SPEC
425
 #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
426
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/pa/pa-linux.h gcc-5.3.0-zip/gcc/config/pa/pa-linux.h
427 138 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-05-06 10:50:31.947799027 -0400
428 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/pa/pa-linux.h      2015-09-24 20:04:26.000000000 -0400
429
@@ -37,7 +37,7 @@
430
 /* Define this for shared library support because it isn't in the main
431
    linux.h file.  */
432
 
433
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
434
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
435
 
436
 #undef LINK_SPEC
437
 #define LINK_SPEC "\
438
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/linux64.h gcc-5.3.0-zip/gcc/config/rs6000/linux64.h
439 138 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-05-06 10:50:31.947799027 -0400
440 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/linux64.h   2015-03-09 19:18:57.000000000 -0400
441
@@ -357,14 +357,14 @@
442
 #undef LINK_OS_DEFAULT_SPEC
443
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
444
 
445
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
446
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
447
 #ifdef LINUX64_DEFAULT_ABI_ELFv2
448
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/tools/lib64/ld64.so.1;:/tools/lib64/ld64.so.2}"
449
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
450
 #else
451
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/tools/lib64/ld64.so.2;:/tools/lib64/ld64.so.1}"
452
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
453
 #endif
454
-#define UCLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-uClibc.so.0"
455
-#define UCLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64-uClibc.so.0"
456
+#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
457
+#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
458
 #if DEFAULT_LIBC == LIBC_UCLIBC
459
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
460
 #elif DEFAULT_LIBC == LIBC_GLIBC
461
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h
462 138 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-05-06 10:50:31.947799027 -0400
463 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h     2015-09-24 09:46:45.000000000 -0400
464
@@ -757,8 +757,8 @@
465
 
466
 #define LINK_START_LINUX_SPEC ""
467
 
468
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
469
-#define UCLIBC_DYNAMIC_LINKER "/tools/lib/ld-uClibc.so.0"
470
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
471
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
472
 #if DEFAULT_LIBC == LIBC_UCLIBC
473
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
474
 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
475
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/s390/linux.h gcc-5.3.0-zip/gcc/config/s390/linux.h
476 138 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-05-06 10:50:31.947799027 -0400
477 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/s390/linux.h       2015-05-11 03:14:10.000000000 -0400
478
@@ -60,8 +60,8 @@
479
 #define MULTILIB_DEFAULTS { "m31" }
480
 #endif
481
 
482
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld.so.1"
483
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld64.so.1"
484
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
485
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
486
 
487
 #undef  LINK_SPEC
488
 #define LINK_SPEC \
489
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sh/linux.h gcc-5.3.0-zip/gcc/config/sh/linux.h
490 138 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-05-06 10:50:31.947799027 -0400
491 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sh/linux.h 2015-01-05 07:33:28.000000000 -0500
492
@@ -43,7 +43,7 @@
493
 
494
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
495
 
496
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
497
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
498
 
499
 #undef SUBTARGET_LINK_EMUL_SUFFIX
500
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
501
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux64.h gcc-5.3.0-zip/gcc/config/sparc/linux64.h
502 138 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-05-06 10:50:31.947799027 -0400
503 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux64.h    2015-01-05 07:33:28.000000000 -0500
504
@@ -84,8 +84,8 @@
505
    When the -shared link option is used a final link is not being
506
    done.  */
507
 
508
-#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
509
-#define GLIBC_DYNAMIC_LINKER64 "/tools/lib64/ld-linux.so.2"
510
+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
511
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
512
 
513
 #ifdef SPARC_BI_ARCH
514
 
515
@@ -193,7 +193,7 @@
516
 #else /* !SPARC_BI_ARCH */
517
 
518
 #undef LINK_SPEC
519
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/tools/lib64 %{shared:-shared} \
520
+#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
521
   %{!shared: \
522
     %{!static: \
523
       %{rdynamic:-export-dynamic} \
524
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux.h gcc-5.3.0-zip/gcc/config/sparc/linux.h
525 138 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-05-06 10:50:31.947799027 -0400
526 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/sparc/linux.h      2015-01-05 07:33:28.000000000 -0500
527
@@ -83,7 +83,7 @@
528
    When the -shared link option is used a final link is not being
529
    done.  */
530
 
531
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
532
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
533
 
534
 #undef  LINK_SPEC
535
 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
536
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/vax/linux.h gcc-5.3.0-zip/gcc/config/vax/linux.h
537 138 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-05-06 10:50:31.947799027 -0400
538 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/vax/linux.h        2015-01-05 07:33:28.000000000 -0500
539
@@ -41,7 +41,7 @@
540
   %{!shared: \
541
     %{!static: \
542
       %{rdynamic:-export-dynamic} \
543
-      -dynamic-linker /tools/lib/ld.so.1} \
544
+      -dynamic-linker /lib/ld.so.1} \
545
     %{static:-static}}"
546
 
547
 #undef  WCHAR_TYPE
548
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/xtensa/linux.h gcc-5.3.0-zip/gcc/config/xtensa/linux.h
549 138 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-05-06 10:50:31.947799027 -0400
550 102 dgisselq
+++ gcc-5.3.0-zip/gcc/config/xtensa/linux.h     2015-01-05 07:33:28.000000000 -0500
551
@@ -44,7 +44,7 @@
552
   %{mlongcalls:--longcalls} \
553
   %{mno-longcalls:--no-longcalls}"
554
 
555
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
556
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
557
 
558
 #undef LINK_SPEC
559
 #define LINK_SPEC \
560
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/netbsd.h gcc-5.3.0-zip/gcc/config/zip/netbsd.h
561
--- gcc-5.3.0-original/gcc/config/zip/netbsd.h  1969-12-31 19:00:00.000000000 -0500
562
+++ gcc-5.3.0-zip/gcc/config/zip/netbsd.h       2016-01-30 15:04:14.796899050 -0500
563
@@ -0,0 +1,82 @@
564
+////////////////////////////////////////////////////////////////////////////////
565
+//
566
+// Filename:   netbsd.h
567
+//
568
+// Project:    Zip CPU backend for the GNU Compiler Collection
569
+//
570
+// Purpose:
571
+//
572
+// Creator:    Dan Gisselquist, Ph.D.
573
+//             Gisselquist Technology, LLC
574
+//
575
+////////////////////////////////////////////////////////////////////////////////
576
+//
577
+// Copyright (C) 2016, Gisselquist Technology, LLC
578
+//
579
+// This program is free software (firmware): you can redistribute it and/or
580
+// modify it under the terms of  the GNU General Public License as published
581
+// by the Free Software Foundation, either version 3 of the License, or (at
582
+// your option) any later version.
583
+//
584
+// This program is distributed in the hope that it will be useful, but WITHOUT
585
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
586
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
587
+// for more details.
588
+//
589
+// You should have received a copy of the GNU General Public License along
590
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
591
+// target there if the PDF file isn't present.)  If not, see
592
+// <http://www.gnu.org/licenses/> for a copy.
593
+//
594
+// License:    GPL, v3, as defined and found on www.gnu.org,
595
+//             http://www.gnu.org/licenses/gpl.html
596
+//
597
+//
598
+////////////////////////////////////////////////////////////////////////////////
599
+#ifndef        ZIP_NETBSD_H
600
+#define        ZIP_NETBSD_H
601
+
602
+/* Define default target values. */
603
+
604
+#undef MACHINE_TYPE
605
+#define        MACHINE_TYPE    "NetBSD/Zip ELF"
606
+
607
+#undef TARGET_OS_CPP_BUILTINS
608
+#define        TARGET_OS_CPP_BUILTINS()        \
609
+       do { NETBSD_OS_CPP_BUILTINS_ELF();              \
610
+       builtin_define("__ZIPCPU__");                   \
611
+       builtin_assert("cpu=zip");                      \
612
+       builtin_assert("machine=zip");                  \
613
+       } while(0);
614
+
615
+#undef CPP_SPEC
616
+#define        CPP_SPEC        NETBSD_CPP_SPEC
617
+
618
+#undef STARTFILE_SPEC
619
+#define        STARTFILE_SPEC  NETBSD_STARTFILE_SPEC
620
+
621
+#undef ENDFILE_SPEC
622
+#define        ENDFILE_SPEC    NETBSD_ENDFILE_SPEC
623
+
624
+#undef LIB_SPEC
625
+#define        LIB_SPEC        NETBSD_LIB_SPEC
626
+
627
+#undef TARGET_VERSION
628
+#define        TARGET_VERSION  fprintf(stderr, " (%s)", MACHINE_TYPE);
629
+
630
+/* Make gcc agree with <machine/ansi.h> */
631
+
632
+#undef WCHAR_TYPE
633
+#define        WCHAR_TYPE      "int"
634
+
635
+#undef WCHAR_TYPE_SIZE
636
+#define        WCHAR_TYPE_SIZE 32
637
+
638
+#undef WINT_TYPE
639
+#define        WINT_TYPE       "int"
640
+
641
+/* Clean up after the generic Zip/ELF configuration. */
642
+#undef MD_EXEC_PREFIX
643
+#undef MD_STARTFILE_PREFIX
644
+
645
+#endif /* ZIP_NETBSD_H */
646
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/t-zip gcc-5.3.0-zip/gcc/config/zip/t-zip
647
--- gcc-5.3.0-original/gcc/config/zip/t-zip     1969-12-31 19:00:00.000000000 -0500
648
+++ gcc-5.3.0-zip/gcc/config/zip/t-zip  2016-02-04 19:00:59.939652587 -0500
649
@@ -0,0 +1,47 @@
650
+################################################################################
651
+##
652
+## Filename:   t-zip
653
+##
654
+## Project:    Zip CPU backend for the GNU Compiler Collection
655
+##
656
+## Purpose:
657
+##
658
+## Creator:    Dan Gisselquist, Ph.D.
659
+##             Gisselquist Technology, LLC
660
+##
661
+################################################################################
662
+##
663
+## Copyright (C) 2016, Gisselquist Technology, LLC
664
+##
665
+## This program is free software (firmware): you can redistribute it and/or
666
+## modify it under the terms of  the GNU General Public License as published
667
+## by the Free Software Foundation, either version 3 of the License, or (at
668
+## your option) any later version.
669
+##
670
+## This program is distributed in the hope that it will be useful, but WITHOUT
671
+## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
672
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
673
+## for more details.
674
+##
675
+## You should have received a copy of the GNU General Public License along
676
+## with this program.  (It's in the $(ROOT)/doc directory, run make with no
677
+## target there if the PDF file isn't present.)  If not, see
678
+## <http://www.gnu.org/licenses/> for a copy.
679
+##
680
+## License:    GPL, v3, as defined and found on www.gnu.org,
681
+##             http://www.gnu.org/licenses/gpl.html
682
+##
683
+##
684
+################################################################################
685
+
686
+FPBIT = fp-bit.c
687
+DPBIT = dp-bit.c
688
+
689
+# dp-bit.c: $(srcdir)/config/fp-bit.c
690
+       # cat $(srcdir)/config/fp-bit.c > dp-bit.c
691
+#
692
+# fp-bit.c: $(srcdir)/config/fp-bit.c
693
+       # echo '#define FLOAT" > fp-bit.c
694
+       # cat $(srcdir)/config/fp-bit.c >> fp-bit.c
695
+
696
+
697
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
698
--- gcc-5.3.0-original/gcc/config/zip/zip.c     1969-12-31 19:00:00.000000000 -0500
699 138 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-05-02 21:56:27.075389925 -0400
700
@@ -0,0 +1,2185 @@
701 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
702
+//
703
+// Filename:   zip.c
704
+//
705
+// Project:    Zip CPU backend for the GNU Compiler Collection
706
+//
707
+// Purpose:
708
+//
709
+// Creator:    Dan Gisselquist, Ph.D.
710
+//             Gisselquist Technology, LLC
711
+//
712
+////////////////////////////////////////////////////////////////////////////////
713
+//
714
+// Copyright (C) 2016, Gisselquist Technology, LLC
715
+//
716
+// This program is free software (firmware): you can redistribute it and/or
717
+// modify it under the terms of  the GNU General Public License as published
718
+// by the Free Software Foundation, either version 3 of the License, or (at
719
+// your option) any later version.
720
+//
721
+// This program is distributed in the hope that it will be useful, but WITHOUT
722
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
723
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
724
+// for more details.
725
+//
726
+// You should have received a copy of the GNU General Public License along
727
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
728
+// target there if the PDF file isn't present.)  If not, see
729
+// <http://www.gnu.org/licenses/> for a copy.
730
+//
731
+// License:    GPL, v3, as defined and found on www.gnu.org,
732
+//             http://www.gnu.org/licenses/gpl.html
733
+//
734
+//
735
+////////////////////////////////////////////////////////////////////////////////
736
+#include "config.h"
737
+#include "system.h"
738
+#include "coretypes.h"
739
+#include "tm.h"
740
+#include "rtl.h"
741
+#include "dominance.h"
742
+#include "cfg.h"
743
+#include "cfgrtl.h"
744
+#include "cfganal.h"
745
+#include "lcm.h"
746
+#include "cfgbuild.h"
747
+#include "cfgcleanup.h"
748
+#include "predict.h"
749
+#include "basic-block.h"
750
+#include "df.h"
751
+#include "hashtab.h"
752
+#include "hash-set.h"
753
+#include "machmode.h"
754
+#include "symtab.h"
755
+#include "rtlhash.h"
756
+#include "tree.h"
757
+#include "regs.h"
758
+#include "hard-reg-set.h"
759
+#include "real.h"
760
+#include "insn-config.h"
761
+#include "conditions.h"
762
+#include "output.h"
763
+#include "insn-attr.h"
764
+#include "flags.h"
765
+#include "expr.h"
766
+#include "function.h"
767
+#include "recog.h"
768
+#include "toplev.h"
769
+#include "ggc.h"
770
+#include "builtins.h"
771
+#include "calls.h"
772
+#include "langhooks.h"
773
+#include "optabs.h"
774
+#include "explow.h"
775
+#include "emit-rtl.h"
776 122 dgisselq
+#include "ifcvt.h"
777 102 dgisselq
+
778
+// #include "tmp_p.h"
779
+#include "target.h"
780
+#include "target-def.h"
781
+// #include "tm-constrs.h"
782 122 dgisselq
+#include "tm-preds.h"
783 102 dgisselq
+
784
+#include "diagnostic.h"
785
+// #include "integrate.h"
786
+
787
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
788
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
789
+static bool    zip_return_in_memory(const_tree, const_tree);
790
+static bool    zip_frame_pointer_required(void);
791
+
792
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
793
+               const_tree type, bool named);
794
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
795
+
796
+static void    zip_asm_trampoline_template(FILE *);
797
+static void    zip_trampoline_init(rtx, tree, rtx);
798
+static void    zip_init_builtins(void);
799
+static tree zip_builtin_decl(unsigned, bool);
800
+// static void zip_asm_output_anchor(rtx x);
801
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
802
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
803
+                       enum machine_mode tmode, int    ignore);
804
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
805
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
806
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
807
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
808
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
809 122 dgisselq
+static          HOST_WIDE_INT  zip_min_opb_imm = -0x20000;
810
+static          HOST_WIDE_INT  zip_max_opb_imm =  0x1ffff;
811 102 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
812
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
813
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
814
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
815
+static int     zip_sched_issue_rate(void) { return 1; }
816
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
817
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
818
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
819
+       void    zip_debug_rtx(const_rtx x);
820
+static void    zip_override_options(void);
821
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
822
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
823 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
824 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void);
825 122 dgisselq
+#ifdef HAVE_cc0
826
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
827
+#error "We're not supposed to have CC0 anymore"
828
+#else
829
+static bool    zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b);
830
+#endif
831 102 dgisselq
+
832
+
833 103 dgisselq
+#define        ALL_DEBUG_OFF   false
834 102 dgisselq
+#define        ALL_DEBUG_ON    false
835
+
836
+enum ZIP_BUILTIN_ID_CODE {
837
+       ZIP_BUILTIN_RTU,
838
+       ZIP_BUILTIN_HALT,
839
+       ZIP_BUILTIN_IDLE,
840
+       ZIP_BUILTIN_SYSCALL,
841
+       ZIP_BUILTIN_SAVE_CONTEXT,
842
+       ZIP_BUILTIN_RESTORE_CONTEXT,
843
+       ZIP_BUILTIN_BITREV,
844
+       ZIP_BUILTIN_CC,
845 117 dgisselq
+       ZIP_BUILTIN_UCC,
846 102 dgisselq
+       ZIP_BUILTIN_MAX
847
+};
848
+
849
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
850
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
851
+
852
+
853
+#include "gt-zip.h"
854
+
855
+/* The Global 'targetm' Variable. */
856
+struct gcc_target      targetm = TARGET_INITIALIZER;
857
+
858
+
859
+enum   reg_class zip_reg_class(int);
860
+
861
+#define        LOSE_AND_RETURN(msgid, x)               \
862
+       do {                                    \
863
+               zip_operand_lossage(msgid, x);  \
864
+               return;                         \
865
+       } while(0)
866
+
867
+/* Per-function machine data. */
868
+struct GTY(()) machine_function
869
+{
870
+       /* number of pretented arguments for varargs */
871
+       int     pretend_size;
872
+
873
+       /* Number of bytes saved on the stack for local variables. */
874
+       int     local_vars_size;
875
+
876
+       /* Number of bytes saved on stack for register save area */
877
+       int     saved_reg_size;
878
+       int     save_ret;
879
+
880
+       int     sp_fp_offset;
881
+       bool    fp_needed;
882
+       int     size_for_adjusting_sp;
883
+};
884
+
885
+/* Allocate a chunk of memory for per-function machine-dependent data. */
886
+
887
+static struct machine_function *
888
+zip_init_machine_status(void) {
889
+       return ggc_cleared_alloc<machine_function>();
890
+}
891
+
892
+static void
893
+zip_override_options(void)
894
+{
895
+       init_machine_status = zip_init_machine_status;
896
+}
897
+
898
+enum   reg_class
899
+zip_reg_class(int regno)
900
+{
901
+       if (is_ZIP_GENERAL_REG(regno)) {
902
+               return GENERAL_REGS;
903
+       } else if (is_ZIP_REG(regno)) {
904
+               return ALL_REGS;
905
+       } return NO_REGS;
906
+}
907
+
908
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
909
+static bool
910
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
911
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
912
+       return (size == -1)||(size > UNITS_PER_WORD);
913
+}
914
+
915
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
916
+ * insn.  Formatted output isn't easily implemented, since we use output operand
917
+ * lossage to output the actual message and handle the categorization of the
918
+ * error.  */
919
+
920
+static void
921
+zip_operand_lossage(const char *msgid, rtx op) {
922
+       fprintf(stderr, "Operand lossage??\n");
923
+       debug_rtx(op);
924
+       zip_debug_rtx(op);
925
+       output_operand_lossage("%s", msgid);
926
+}
927
+
928
+/* The PRINT_OPERAND_ADDRESS worker.   */
929
+void
930
+zip_print_operand_address(FILE *file, rtx x) {
931
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
932
+
933
+       if (dbg) zip_debug_rtx(x);
934
+       switch(GET_CODE(x)) {
935
+               case REG:
936 127 dgisselq
+                       gcc_assert(is_ZIP_REG(REGNO(x)));
937 102 dgisselq
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
938
+                       break;
939
+               case SYMBOL_REF:
940
+                       fprintf(file, "%s", XSTR(x,0));
941
+                       break;
942
+               case LABEL_REF:
943
+                       x = LABEL_REF_LABEL(x);
944
+               case CODE_LABEL:
945
+                       { char buf[256];
946
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
947
+#ifdef ASM_OUTPUT_LABEL_REF
948
+                       ASM_OUTPUT_LABEL_REF(file, buf);
949
+#else
950
+                       assemble_name(file, buf);
951
+#endif
952
+                       }
953
+                       break;
954
+               case PLUS:
955 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
956
+                               fprintf(stderr, "Unsupported address construct\n");
957
+                               zip_debug_rtx(x);
958 102 dgisselq
+                               abort();
959 127 dgisselq
+                       } gcc_assert(is_ZIP_REG(REGNO(XEXP(x,0))));
960
+                       if (CONST_INT_P(XEXP(x, 1))) {
961 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
962
+                                       fprintf(file, "%ld(%s)",
963 135 dgisselq
+                                       (long)INTVAL(XEXP(x, 1)),
964 102 dgisselq
+                                       reg_names[REGNO(XEXP(x, 0))]);
965
+                               } else {
966
+                                       fprintf(file, "(%s)",
967
+                                       reg_names[REGNO(XEXP(x, 0))]);
968
+                               }
969
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
970
+                               fprintf(file, "%s(%s)", XSTR(x,0),
971
+                                       reg_names[REGNO(XEXP(x, 0))]);
972
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
973
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
974
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
975
+                               fprintf(file, "%s-%s(%s)",
976
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
977
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
978
+                                       reg_names[REGNO(XEXP(x, 0))]);
979
+                       } else
980
+                               fprintf(file, "#INVALID(%s)",
981
+                                       reg_names[REGNO(XEXP(x, 0))]);
982
+                       /*
983
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
984
+                               fprintf(file, "%s(%s)",
985
+                                       GET_CODE(XEXP(addr, 1)),
986
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
987
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
988
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
989
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
990
+                               fprintf(file, "%s-%s(%s)",
991
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
992
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
993
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
994
+                       }
995
+                       */
996
+                       break;
997
+               // We don't support direct memory addressing within our
998
+               // instruction set, even though the instructions themselves
999
+               // would support direct memory addressing of the lower 18 bits
1000
+               // of memory space.
1001
+               case MEM:
1002
+                       if (dbg) zip_debug_rtx(x);
1003
+                       zip_print_operand_address(file, XEXP(x, 0));
1004
+                       break;
1005 111 dgisselq
+               case CONST_INT:
1006 135 dgisselq
+                       fprintf(file, "%ld",(long)INTVAL(x));
1007 111 dgisselq
+                       break;
1008 102 dgisselq
+               default:
1009 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
1010
+                       zip_debug_rtx(x);
1011 102 dgisselq
+                       abort(); break;
1012
+                       // output_addr_const(file, x);
1013
+               break;
1014
+       }
1015
+}
1016
+
1017
+/* The PRINT_OPERAND worker. */
1018
+
1019
+void
1020
+zip_print_operand(FILE *file, rtx x, int code)
1021
+{
1022
+       rtx operand = x;
1023
+       int     rgoff = 0;
1024
+
1025
+       // fprintf(file, "Print Operand!\n");
1026
+
1027
+       /* New code entries should just be added to the switch below.  If
1028
+        * handling is finished, just return.  If handling was just a
1029
+        * modification of the operand, the modified operand should be put in
1030
+        * "operand", and then do a break to let default handling
1031
+        * (zero-modifier) output the operand.
1032
+        */
1033
+       switch(code) {
1034
+               case 0:
1035
+                       /* No code, print as usual. */
1036
+                       break;
1037
+               case 'L':
1038
+                       /* Lower of two registers, print one up */
1039
+                       rgoff = 1;
1040
+                       break;
1041
+               case 'R':
1042
+               case 'H':
1043
+                       /* Higher of a register pair, print normal */
1044
+                       break;
1045
+
1046
+               default:
1047
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1048
+       }
1049
+
1050
+       /* Print an operand as without a modifier letter. */
1051
+       switch (GET_CODE(operand)) {
1052
+       case REG:
1053
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1054
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1055
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1056
+               return;
1057
+       case SCRATCH:
1058
+               LOSE_AND_RETURN("Need a scratch register", x);
1059
+               return;
1060
+
1061
+       case CODE_LABEL:
1062
+       case LABEL_REF:
1063
+       case SYMBOL_REF:
1064
+       case PLUS:
1065
+               PRINT_OPERAND_ADDRESS(file, operand);
1066
+               return;
1067
+       case MEM:
1068
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1069
+               return;
1070
+
1071
+       default:
1072
+               /* No need to handle all strange variants, let
1073
+                * output_addr_const do it for us.
1074
+                */
1075
+               if (CONSTANT_P(operand)) {
1076
+                       output_addr_const(file, operand);
1077
+                       return;
1078
+               }
1079
+
1080
+               LOSE_AND_RETURN("unexpected operand", x);
1081
+       }
1082
+}
1083
+
1084
+static bool
1085
+zip_frame_pointer_required(void)
1086
+{
1087
+       // This should really depend upon whether we have variable sized
1088
+       // arguments in our frame or not.  Once this fails, let's look
1089
+       // at what the problem was and then whether or not we can detect
1090
+       // it.
1091
+       //
1092
+       // Use a GCC global to determine our answer
1093 103 dgisselq
+       if (cfun->calls_alloca)
1094
+               return true;
1095 102 dgisselq
+       return (frame_pointer_needed);
1096
+/*
1097
+*/
1098
+}
1099
+
1100
+/* Determine whether or not a register needs to be saved on the stack or not.
1101
+ */
1102
+static bool
1103
+zip_save_reg(int regno) {
1104
+       if (regno == 0)
1105
+               return ((!crtl->is_leaf)
1106
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1107
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1108
+               return  ((df_regs_ever_live_p(regno))
1109
+                               &&(!call_used_regs[regno]));
1110
+       else if (regno == zip_FP)
1111
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1112
+                               &&(!call_used_regs[regno])));
1113
+       else if (regno < zip_FP)
1114
+               return  ((df_regs_ever_live_p(regno))
1115
+                               &&(!call_used_regs[regno]));
1116
+       return false;
1117
+}
1118
+
1119
+/* Compute the size of the local area and the size to be adjusted by the
1120
+ * prologue and epilogue.
1121
+ *
1122
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1123
+ *
1124
+ *     Stack Pointer ->
1125 124 dgisselq
+ *                     Outgoing arguments
1126 102 dgisselq
+ *                     Local variables (could be variable size)
1127
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1128
+ *                     Saved return address, if saved
1129
+ *                     Other Saved registers
1130
+ *                     Saved frame pointer (if used)
1131
+ *                     Saved R12, if used
1132
+ *                     (Stack pointer is not saved)
1133
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1134
+ *                     Called arguments (not passed in registers)
1135
+ *                     Return arguments (not R1, args.pretend_args_size)
1136
+ *             (Prior function's stack frame ... )
1137
+ *
1138
+ */
1139
+static void
1140
+zip_compute_frame(void) {
1141
+       int     regno;
1142
+       int     args_size;
1143 124 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1144 102 dgisselq
+
1145 124 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-COMPUTE-FRAME\n");
1146 102 dgisselq
+       // gcc_assert(crtl);
1147
+       gcc_assert(cfun);
1148
+       gcc_assert(cfun->machine);
1149
+
1150
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1151
+
1152
+       if(crtl->args.pretend_args_size > 0) {
1153
+               args_size += crtl->args.pretend_args_size;
1154
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1155
+                       // crtl->args.pretend_args_size);
1156
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1157
+       }
1158
+
1159
+       cfun->machine->local_vars_size = get_frame_size();
1160
+
1161
+       // Save callee-saved registers.
1162
+       cfun->machine->saved_reg_size = 0;
1163
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1164
+               if (zip_save_reg(regno))
1165
+                       cfun->machine->saved_reg_size ++;
1166
+       }
1167
+
1168
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1169
+
1170
+       if ((cfun->machine->fp_needed)&&
1171
+                       (!df_regs_ever_live_p(zip_FP))) {
1172
+               cfun->machine->saved_reg_size ++;
1173
+       }
1174
+
1175
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1176
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1177
+                       + cfun->machine->saved_reg_size
1178
+                       + args_size;
1179 124 dgisselq
+       if(dbg) {
1180
+               fprintf(stderr, "\tFRAME-POINTR: %s\n",
1181
+                       cfun->machine->fp_needed?"Yes":"No");
1182
+               fprintf(stderr, "\tARGS-SIZE   : %d\n",
1183
+                       args_size);
1184
+               fprintf(stderr, "\tLOCALS-SIZE : %d\n",
1185
+                       cfun->machine->local_vars_size);
1186
+               fprintf(stderr, "\tREGISTERS   : %d\n",
1187
+                       cfun->machine->saved_reg_size);
1188
+               fprintf(stderr, "\tSP_FP_OFFSET: %d\n",
1189
+                       cfun->machine->sp_fp_offset);
1190
+               fprintf(stderr, "\tSP-ADJUSTMNT: %d\n",
1191
+                       cfun->machine->size_for_adjusting_sp);
1192
+       }
1193 102 dgisselq
+}
1194
+
1195
+void
1196
+zip_expand_prologue(void) {
1197
+       rtx     insn;
1198
+
1199
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1200
+       zip_compute_frame();
1201
+
1202 124 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: Computing Prologue instructions\n");
1203 127 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: SP-FP offset is %d\n",
1204
+                       cfun->machine->sp_fp_offset);
1205 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1206 138 dgisselq
+               insn = emit_insn(gen_subsi3_reg_clobber(stack_pointer_rtx,
1207 102 dgisselq
+                               stack_pointer_rtx,
1208
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1209
+                               SImode)));
1210
+                       // cfun->machine->sp_fp_offset
1211
+
1212
+               RTX_FRAME_RELATED_P(insn) = 1;
1213
+       }
1214
+
1215
+       {
1216
+               int offset = 0, regno;
1217
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1218
+                       if (zip_save_reg(regno)) {
1219 127 dgisselq
+                               if (dbg) fprintf(stderr,
1220
+                                       "PROLOGUE: Saving R%d in %d+%d(SP)\n",
1221
+                                       regno, cfun->machine->sp_fp_offset,
1222
+                                       offset);
1223 124 dgisselq
+                               insn=emit_insn(gen_movsi_sto_off(
1224
+                                       stack_pointer_rtx,
1225
+                                       GEN_INT(cfun->machine->sp_fp_offset
1226
+                                               +offset++),
1227 102 dgisselq
+                                       gen_rtx_REG(SImode, regno)));
1228
+                               RTX_FRAME_RELATED_P(insn) = 1;
1229
+                       }
1230
+               }
1231 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1232
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1233 102 dgisselq
+       }
1234
+
1235
+       if (cfun->machine->fp_needed) {
1236
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1237
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1238
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1239 124 dgisselq
+                               stack_pointer_rtx,
1240
+                               GEN_INT(cfun->machine->sp_fp_offset)));
1241 102 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1242 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1243 102 dgisselq
+       }
1244
+}
1245
+
1246
+bool
1247
+zip_use_return_insn(void)
1248
+{
1249
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1250
+                       ||(get_frame_size()!=0)) {
1251
+               // If R0 ever gets pushed to the stack, then we cannot
1252
+               // use a master return from anywhere.  We need to clean up the
1253
+               // stack first.
1254
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1255
+                                               &&(!call_used_regs[0]))) {
1256
+                       return false;
1257
+               }
1258
+       }
1259
+       zip_compute_frame();
1260
+       return (cfun->machine->size_for_adjusting_sp == 0);
1261
+}
1262
+
1263
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1264
+ * upon the current stack pointer.  It should use the frame poitner only,
1265
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1266
+ * take advantage of it to omit stack adjustments before returning ...
1267
+ *
1268
+ * Let's see if we can use their approach here.
1269
+ *
1270
+ * We can't.  Consider our choices:
1271
+ *     LOD (FP),R0
1272
+ *     LOD 1(FP),R4
1273
+ *     LOD 2(FP),R5
1274
+ *     LOD 3(FP),R6
1275
+ *     LOD 4(FP),FP
1276
+ *     ... Then what is the stack pointer?
1277
+ * or
1278
+ *     LOD (FP),R0
1279
+ *     LOD 1(FP),R4
1280
+ *     LOD 2(FP),R5
1281
+ *     LOD 3(FP),R6
1282
+ *     MOV FP,SP
1283
+ *     LOD 4(SP),FP
1284
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1285
+ *     exploit our pipeline memory function
1286
+ * or
1287
+ *     MOV FP,SP
1288
+ *     LOD (SP),R0
1289
+ *     LOD 1(SP),R4
1290
+ *     LOD 2(SP),R5
1291
+ *     LOD 3(SP),R6
1292
+ *     LOD 4(SP),FP
1293
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1294
+ *
1295
+ */
1296
+void
1297
+zip_expand_epilogue(void) {
1298
+       int     regno, offset;
1299
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1300 138 dgisselq
+       rtx     insn;
1301 102 dgisselq
+
1302
+       zip_compute_frame();
1303
+
1304
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1305
+       if (cfun->machine->fp_needed) {
1306 124 dgisselq
+               // This is done special--if you can't trust the stack pointer
1307
+               // enough so that you must have a frame pointer, then you can't
1308
+               // trust its offset enough to restore from it.  Hence, we start
1309
+               // by moving the frame pointer to the stack pointer to recover
1310
+               // the stack pointer back to a usable value.
1311 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1312 138 dgisselq
+               insn = emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1313
+               RTX_FRAME_RELATED_P(insn) = 1;
1314 102 dgisselq
+       }
1315
+
1316
+       if (cfun->machine->saved_reg_size != 0) {
1317 124 dgisselq
+               if (cfun->machine->fp_needed)
1318
+                       offset = 0;
1319
+               else
1320
+                       offset = cfun->machine->sp_fp_offset;
1321 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1322
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1323
+                       if (zip_save_reg(regno)) {
1324
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1325 138 dgisselq
+                               rtx reg = gen_rtx_REG(SImode, regno);
1326
+                               insn = emit_insn(gen_movsi_lod_off(
1327
+                                               reg,
1328 124 dgisselq
+                                               stack_pointer_rtx,
1329
+                                               GEN_INT(offset++)));
1330 138 dgisselq
+                               add_reg_note(insn, REG_CFA_RESTORE, reg);
1331
+                               RTX_FRAME_RELATED_P(insn) = 1;
1332 102 dgisselq
+                       }
1333
+               }
1334
+       }
1335
+
1336 124 dgisselq
+       if (cfun->machine->fp_needed) {
1337
+               // Restore the stack pointer back to the original, the
1338
+               // difference being the difference from the frame pointer
1339
+               // to the original stack
1340 138 dgisselq
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1341
+                       stack_pointer_rtx,
1342 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp
1343
+                               -cfun->machine->sp_fp_offset)));
1344 138 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1345 124 dgisselq
+       } else {
1346
+               // else now the difference is between the stack pointer and
1347
+               // the original stack pointer.
1348 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1349
+                               cfun->machine->size_for_adjusting_sp);
1350 138 dgisselq
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1351
+                       stack_pointer_rtx,
1352 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp)));
1353 138 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1354 102 dgisselq
+       }
1355
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1356
+
1357 138 dgisselq
+       // The return RTX is not allowed to be frame related
1358
+       insn = emit_jump_insn(ret_rtx);
1359
+       // RTX_FRAME_RELATED_P(insn) = 1;
1360 102 dgisselq
+}
1361
+
1362
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1363
+ *
1364
+ * We currently only support calculating the return address for the current
1365
+ * frame.
1366
+ */
1367
+
1368
+/*
1369
+rtx
1370
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1371
+{
1372
+       if (count)
1373
+               return NULL_RTX;
1374
+
1375
+       zip_compute_frame();
1376
+
1377
+       // saved return address for current function is at fp - 1
1378
+       if (cfun->machine->save_ret)
1379
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1380
+                               -UNITS_PER_WORD));
1381
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1382
+}
1383
+*/
1384
+
1385
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1386
+ * return the OFFSET.
1387
+ */
1388
+int
1389
+zip_initial_elimination_offset(int from, int to) {
1390
+       int     ret = 0;
1391
+       zip_compute_frame();
1392
+
1393
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1394
+               ret = cfun->machine->sp_fp_offset;
1395 117 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1396
+               ret = cfun->machine->sp_fp_offset;
1397 102 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1398 117 dgisselq
+               // ret = cfun->machine->local_vars_size;
1399
+               ret = 0;
1400 102 dgisselq
+       } else {
1401
+               abort();
1402
+       }
1403
+
1404
+       return ret;
1405
+}
1406
+
1407
+/*
1408
+ * Code taken from m68k ...
1409
+ */
1410
+static bool
1411
+zip_can_eliminate(int from, int to)
1412
+{
1413
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1414
+       if ((from == zip_FP)&&(to == zip_SP))
1415
+               return !cfun->machine->fp_needed;
1416
+       return true;
1417
+}
1418
+
1419
+/*
1420
+static void
1421
+zip_basic_check(void)
1422
+{
1423
+       gcc_assert(mode_base_align[SImode]==4);
1424
+       if ((BITS_PER_UNIT != 32)
1425
+                       ||(GET_MODE_SIZE(SImode)!=1)
1426
+                       ||(GET_MODE_SIZE(DImode)!=1)
1427
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1428
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1429
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1430
+               gcc_assert(BITS_PER_UNIT==32);
1431
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1432
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1433
+       }
1434
+}
1435
+*/
1436
+
1437
+#define        zip_basic_check()
1438
+
1439
+/* Compute the number of word sized regiters needed to hold a function
1440
+ * argument of mode INT_MODE and tree type TYPE.
1441
+ */
1442
+int
1443
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1444
+       int     size;
1445
+
1446
+       zip_basic_check();
1447
+
1448
+       if (targetm.calls.must_pass_in_stack(mode, type))
1449
+               return 0;
1450
+
1451
+       if ((type)&&(mode == BLKmode))
1452
+               size = int_size_in_bytes(type);
1453
+       else
1454
+               size = GET_MODE_SIZE(mode);
1455
+
1456
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1457
+}
1458
+
1459
+/* pushed in function prologue */
1460
+/*
1461
+static int
1462
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1463
+               tree type, bool name ATTRIBUTE_UNUSED) {
1464
+       int     words;
1465
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1466
+
1467
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1468
+               words = 0;
1469
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1470
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1471
+       else
1472
+               words = 0;
1473
+
1474
+       return words * UNITS_PER_WORD;
1475
+}
1476
+*/
1477
+
1478
+static void
1479
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1480
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1481
+       CUMULATIVE_ARGS *cum;
1482
+       int     nreg;
1483
+
1484
+       zip_basic_check();
1485
+
1486
+       cum = get_cumulative_args(ca);
1487
+       nreg = zip_num_arg_regs(mode, type);
1488
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1489
+               (*cum) = NUM_ARG_REGS;
1490
+       else
1491
+               (*cum) += nreg;
1492
+}
1493
+
1494
+static rtx
1495
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1496
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1497
+       CUMULATIVE_ARGS *cum;
1498
+
1499
+       zip_basic_check();
1500
+
1501
+
1502
+       if (!named)
1503
+               return NULL_RTX;
1504
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1505
+               //return NULL_RTX;
1506
+       cum = get_cumulative_args(ca);
1507
+
1508
+       if ((*cum) >= NUM_ARG_REGS)
1509
+               return NULL_RTX;
1510
+       return
1511
+               gen_rtx_REG(mode, (*cum)+1);
1512
+}
1513
+
1514 122 dgisselq
+#ifdef HAVE_cc0
1515 102 dgisselq
+/* NOTICE_UPDATE_CC sends us here
1516
+ */
1517
+void
1518
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1519
+{
1520 122 dgisselq
+#error "The CC0 code was supposed to be removed"
1521 102 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1522
+       enum    attr_ccresult  ccr;
1523
+       enum    attr_conditional  conditionally_executed;
1524
+
1525
+       // The default is that nothing has changed.
1526
+       // cc_status = cc_status_prev;
1527
+       rtx     src, dest;
1528
+
1529
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1530
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1531
+       if (dbg) debug_rtx(exp);
1532
+
1533
+       ccr = get_attr_ccresult(insn);
1534
+       if (ccr == CCRESULT_UNKNOWN) {
1535
+               CC_STATUS_INIT;
1536
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1537
+               return;
1538
+       }
1539
+
1540
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1541
+               // This works up and until we add cc0 parallel instructions
1542
+               // to our instruction set.
1543
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1544
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1545
+       } else if (GET_CODE(exp) == SET) {
1546
+               dest = SET_DEST(exp);
1547
+               src  = SET_SRC (exp);
1548
+       } else {
1549
+               // First, do nothing if we haven't touched the condition codes.
1550
+               // Condition codes can only be changed as a result of a set
1551
+               // expression ...?
1552
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1553
+               return;
1554
+       }
1555
+
1556 111 dgisselq
+
1557
+       if (ccr == CCRESULT_UNCHANGED) {
1558
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1559
+
1560
+               // We can't just run away here ... even though the CC result
1561
+               // hasn't changed, GCC's ability to recognize it as a valid
1562
+               // result has changed.  In other words, if we just 'set' a
1563
+               // value contained within either value1 or value2, then we'll
1564
+               // need to update those values so that they are no longer looked
1565
+               // upon as potentially containing the current CC values.
1566
+
1567
+               if (dest) {
1568
+                       if (dest == cc0_rtx)
1569
+                               CC_STATUS_INIT;
1570
+                       else if ((REG_P(dest))&&(dest != pc_rtx)) {
1571
+                               // An example here might be a load instruction
1572
+                               if (reg_mentioned_p(dest, cc_status.value1))
1573
+                                       cc_status.value1 = NULL_RTX;
1574
+                               if (reg_mentioned_p(dest, cc_status.value2))
1575
+                                       cc_status.value2 = NULL_RTX;
1576
+                       }
1577
+               }
1578
+               return;
1579
+       }
1580
+
1581 102 dgisselq
+       // Gotta wait on this test, until we know whether or not the
1582
+       // conditionally executed instruction was designed to set the
1583
+       // CC0 register.
1584
+       conditionally_executed = get_attr_conditional(insn);
1585
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1586
+               // cc_status is unchanged
1587 111 dgisselq
+               // However, GCC's vision of it may have changed
1588
+               //
1589
+               // Initialize CC_STATUS
1590 102 dgisselq
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1591 111 dgisselq
+               CC_STATUS_INIT;
1592 102 dgisselq
+               return;
1593 111 dgisselq
+       } else if (GET_CODE(src)==IF_THEN_ELSE) {
1594
+               // Same thing as above
1595
+               CC_STATUS_INIT;
1596
+               return;
1597 102 dgisselq
+       }
1598
+
1599
+       if (ccr == CCRESULT_VALIDZN)
1600
+               cc_status.flags = CC_NO_OVERFLOW;
1601
+       else
1602
+               cc_status.flags = 0;
1603
+       cc_status.value1 = dest;
1604
+       if (dest == cc0_rtx)
1605
+               cc_status.value2 = src;
1606
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1607
+               cc_status.value2 = src;
1608
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1609
+               cc_status.value2 = src;
1610
+       else
1611
+               cc_status.value2 = 0;
1612
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1613
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1614
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1615
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1616
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1617
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1618
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1619
+               count_occurrences(dest,src,0));
1620
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1621
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1622
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1623
+               reg_referenced_p(dest,src)?"Is":"Is not");
1624
+
1625
+//
1626
+// These results are only used in final.c, where they are used to remove
1627
+// compare instructions if the optimizer is on.  If I produce nothing, no
1628
+// compare instructions will be removed.  If I produce something, a smart
1629
+// decision may be made to remove compare instructions.
1630
+//
1631
+// cc_status will be compared  with subsequent
1632
+//     (set (cc0) (something)) (i.e. compare only) instructions
1633
+//
1634
+//     (set (cc0) (compare (x) (y)))
1635
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1636
+//             cc0
1637
+//     src1 = (compare (x) (y))
1638
+//     if (src1 == compare)&&(y == (const_int 0))
1639
+//             src2 = (x)
1640
+//     else
1641
+//             src2 = null
1642
+//
1643
+//     Four conditions:
1644
+//     1. if (val1)&&(src1 == val1)
1645
+//             This would be true if I had seen a (set (val1) (src1)) insn
1646
+//             If I have seen a (set (val1) (src1))
1647
+//                     or equivalently a (set (val1) (compare (x) (y)))
1648
+//     or
1649
+//     2. if (val2)&&(src1 == val2)
1650
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1651
+//             and only if val2 was still valid.
1652
+//     or
1653
+//     3. if (src2)&&(value1)&&(src2 == value1)
1654
+//             This would be true if we are comparing against zero, and the
1655
+//             number we are comparing against zero is value 1
1656
+//     or
1657
+//     4. if (src2)&&(value2)&&(src2 == value2)
1658
+//             ... or value2.  This is the common ZipCPU case.
1659
+//
1660
+//             then delete the compare.
1661
+//
1662
+}
1663 122 dgisselq
+#else
1664 102 dgisselq
+
1665 122 dgisselq
+void   zip_canonicalize_comparison(int *code, rtx *op0, rtx *op1,
1666
+               bool preserve_op0)
1667
+{
1668
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1669 102 dgisselq
+
1670 122 dgisselq
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
1671
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, gen_rtx_REG(CCmode,zip_CC), const0_rtx));
1672
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
1673
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
1674
+
1675
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
1676
+               rtx tem = *op0;
1677
+               *op0 = *op1;
1678
+               *op1 = tem;
1679
+               *code = (int)swap_condition((enum rtx_code)*code);
1680
+       }
1681
+
1682
+       if ((*code == LE)||(*code == LEU)||(*code == GTU)) {
1683
+               int offset = 1; // (*code == GTU) ? 1 : -1;
1684
+               bool    swap = false;
1685
+
1686
+               if (CONST_INT_P(*op1)) {
1687
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
1688
+                       swap = true;
1689
+               } else if (REG_P(*op1)) {
1690 138 dgisselq
+                       *op1 = plus_constant(GET_MODE(*op1), *op1, offset, true);
1691 122 dgisselq
+                       swap = true;
1692
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
1693
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
1694
+                               INTVAL(XEXP(*op1,1))+offset);
1695
+                       swap = true;
1696
+               } if (swap) {
1697
+                       if (*code == LE)
1698
+                               (*code)= LT;
1699
+                       else if (*code == LEU)
1700
+                               (*code)= LTU;
1701
+                       else // (*code == GTU)
1702
+                               (*code) = GEU;
1703
+               }
1704
+       }
1705
+}
1706
+
1707
+static bool
1708
+zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b) {
1709
+       *a = zip_CC;
1710
+       *b = INVALID_REGNUM;
1711
+       return true;
1712
+}
1713
+
1714
+#endif
1715
+
1716
+
1717 102 dgisselq
+/* totally buggy - we can't return pointers to nested functions */
1718
+static void
1719
+zip_asm_trampoline_template(FILE *f) {
1720
+       // Whereas at one time I thought I wouldn't need it, now I know I
1721
+       // need this trampoline function, although it is for a completely
1722
+       // different purpose than the one I was familiar with.
1723 138 dgisselq
+       fprintf(f, "\tbrev\t0,r1\n");
1724
+       fprintf(f, "\tldilo\t0,r1\n");
1725 102 dgisselq
+       fprintf(f, "\tjmp r1\n");
1726
+}
1727
+
1728
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1729
+static void
1730
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1731
+       tree fndecl ATTRIBUTE_UNUSED,
1732
+       rtx chain_value ATTRIBUTE_UNUSED) {
1733
+// #warning "This needs to be filled out"
1734
+       abort();
1735
+}
1736
+
1737
+static tree
1738
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1739
+       tree type)
1740
+{
1741
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1742
+       zip_basic_check();
1743
+
1744
+       if(t) {
1745
+               zip_builtins[code] = t;
1746
+               zip_builtins_icode[code] = icode;
1747
+       }
1748
+
1749
+       return t;
1750
+
1751
+}
1752
+
1753
+void   zip_init_builtins(void) {
1754
+       zip_basic_check();
1755
+
1756
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1757
+#ifdef HAVE_zip_rtu
1758
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1759
+#endif
1760
+#ifdef HAVE_zip_halt
1761
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1762
+#endif
1763
+#ifdef HAVE_zip_idle
1764
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1765
+#endif
1766
+
1767
+#ifdef HAVE_zip_syscall
1768
+// Support int SYSCALL(callID, int a, int b, int c);
1769
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1770
+                       build_function_type_list(void_type_node, NULL_TREE));
1771
+#endif
1772
+
1773
+#ifdef HAVE_zip_save_context
1774
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1775
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1776
+#endif
1777
+
1778
+#ifdef HAVE_zip_restore_context
1779
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1780
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1781
+#endif
1782
+
1783
+#ifdef HAVE_zip_bitrev
1784
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1785
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1786
+               NULL_TREE));
1787
+#endif
1788
+
1789
+#ifdef HAVE_zip_cc
1790
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1791
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1792
+#endif
1793
+
1794 117 dgisselq
+#ifdef HAVE_zip_ucc
1795
+  def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
1796
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1797
+#endif
1798
+
1799 102 dgisselq
+}
1800
+
1801
+static tree
1802
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1803
+{
1804
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1805
+    return error_mark_node;
1806
+
1807
+  return zip_builtins[zip_builtin_code];
1808
+}
1809
+
1810
+static rtx
1811
+zip_expand_builtin(tree exp, rtx target,
1812
+               rtx subtarget ATTRIBUTE_UNUSED,
1813
+               machine_mode tmode ATTRIBUTE_UNUSED,
1814
+               int     ignore ATTRIBUTE_UNUSED) {
1815
+
1816
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1817
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1818
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1819
+       enum    insn_code icode = zip_builtins_icode[code];
1820
+       rtx     pat, op[5];
1821
+       call_expr_arg_iterator  iter;
1822
+       tree    arg;
1823
+
1824
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1825
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1826
+               arg = first_call_expr_arg(exp, &iter);
1827
+               if (arg == error_mark_node)
1828
+                       return NULL_RTX;
1829
+               op[0] = expand_normal(arg);
1830
+               if (GET_CODE(op[0]) != REG)
1831
+                       op[0] = force_reg(Pmode, op[0]);
1832
+               pat = GEN_FCN(icode)(op[0]);
1833
+       } else if (code == ZIP_BUILTIN_BITREV) {
1834
+               arg = first_call_expr_arg(exp, &iter);
1835
+               if (arg == error_mark_node) {
1836
+                       return NULL_RTX;
1837
+               }
1838
+               op[0] = expand_normal(arg);
1839
+               if (!target)
1840
+                       target = gen_reg_rtx(SImode);
1841
+               pat = GEN_FCN(icode)(target, op[0]);
1842 117 dgisselq
+       } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
1843 102 dgisselq
+               if (!target)
1844
+                       target = gen_reg_rtx(SImode);
1845
+               pat = GEN_FCN(icode)(target);
1846
+       } else // RTU, HALT, IDLE
1847
+               pat = GEN_FCN(icode)();
1848
+       if (!pat)
1849
+               return NULL_RTX;
1850
+       emit_insn(pat);
1851
+       return (nonvoid ? target : const0_rtx);
1852
+}
1853
+
1854
+static bool
1855
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1856
+       zip_basic_check();
1857
+
1858
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1859
+}
1860
+
1861
+static bool
1862
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1863
+       return ((mode)==SFmode)||((mode)==DFmode);
1864
+}
1865
+
1866
+static int
1867
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1868
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1869
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1870
+       return 1;
1871
+}
1872
+
1873
+static bool
1874
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1875
+       addr_space_t as ATTRIBUTE_UNUSED) {
1876
+       return false;
1877
+}
1878
+
1879
+/*
1880
+static void
1881
+zip_asm_output_anchor(rtx x) {
1882
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1883
+}
1884
+*/
1885
+
1886
+static void
1887
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1888
+       int     i;
1889
+       i = lvl;
1890
+       if ((true)||(lvl == 0))
1891
+               fprintf(stderr, "%s", pfx);
1892
+       else
1893
+               i += strlen(pfx);
1894
+       while(i-->0)
1895
+               fprintf(stderr, "  ");
1896
+       fprintf(stderr, "%s\n", str);
1897
+}
1898
+
1899
+static void
1900
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1901
+       int     i;
1902
+
1903
+       i = lvl;
1904
+       if ((true)||(lvl == 0))
1905
+               fprintf(stderr, "%s", pfx);
1906
+       else
1907
+               i = lvl+strlen(pfx);
1908
+       while(i-->0)
1909
+               fprintf(stderr, "  ");
1910
+       switch(m) {
1911
+               case VOIDmode:
1912
+                       fprintf(stderr, "%s:V\n", str);
1913
+                       break;
1914
+               case BLKmode:
1915
+                       fprintf(stderr, "%s:BLK\n", str);
1916
+                       break;
1917
+               case BImode:
1918
+                       fprintf(stderr, "%s:BI\n", str);
1919
+                       break;
1920
+#ifdef HAVE_QImode
1921
+               case QImode:
1922
+                       fprintf(stderr, "%s:QI\n", str);
1923
+                       break;
1924
+#endif
1925
+#ifdef HAVE_HImode
1926
+               case HImode:
1927
+                       fprintf(stderr, "%s:HI\n", str);
1928
+                       break;
1929
+#endif
1930
+               case SImode:
1931
+                       fprintf(stderr, "%s:SI\n", str);
1932
+                       break;
1933 122 dgisselq
+               case CCmode:
1934
+                       fprintf(stderr, "%s:CC\n", str);
1935
+                       break;
1936 102 dgisselq
+               case DImode:
1937
+                       fprintf(stderr, "%s:DI\n", str);
1938
+                       break;
1939
+               default:
1940
+                       fprintf(stderr, "%s:?\n", str);
1941
+       }
1942
+}
1943
+
1944
+static void
1945
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1946
+       if (x == NULL_RTX) {
1947
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1948
+               return;
1949
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1950
+               char    buf[64];
1951
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1952
+               zip_debug_print(pfx, lvl, buf);
1953 117 dgisselq
+               gcc_assert(0 && "Bad RTX Code");
1954 102 dgisselq
+               return;
1955
+       } switch(GET_CODE(x)) { // rtl.def
1956 122 dgisselq
+       case PARALLEL:
1957
+               zip_debug_print(pfx, lvl, "(PARALLEL");
1958
+               for(int j=0; j<XVECLEN(x,0);j++)
1959
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1960
+               zip_debug_print(pfx, lvl, ")");
1961
+               debug_rtx(x);
1962
+               break;
1963 102 dgisselq
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1964 122 dgisselq
+       case SEQUENCE:
1965
+               zip_debug_print(pfx, lvl, "(SEQUENCE");
1966
+               for(int j=0; j<XVECLEN(x,0);j++)
1967
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1968
+               zip_debug_print(pfx, lvl, ")");
1969
+               debug_rtx(x);
1970
+               break;
1971 102 dgisselq
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1972
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1973
+       case INSN:
1974
+               zip_debug_print(pfx, lvl, "(INSN");
1975
+               /*
1976
+               { const rtx_insn *tmp_rtx;
1977
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1978
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1979
+               }}
1980
+               */
1981
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1982
+               zip_debug_print(pfx, lvl, ")");
1983 117 dgisselq
+               debug_rtx(x);
1984 102 dgisselq
+               break;
1985
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1986 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1987
+               zip_debug_print(pfx, lvl, ")");
1988
+               /*
1989 102 dgisselq
+               if (JUMP_LABEL(x)) {
1990 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
1991
+                               char    buf[64];
1992
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
1993
+                               zip_debug_print(pfx, lvl+1, buf);
1994
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
1995
+                               char    buf[64];
1996
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
1997
+                               zip_debug_print(pfx, lvl+1, buf);
1998
+                       } else
1999
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
2000 102 dgisselq
+               } else
2001 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
2002
+               debug_rtx(x);
2003
+               */
2004 102 dgisselq
+               break;
2005
+       case CALL:
2006
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
2007
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
2008
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
2009
+               zip_debug_print(pfx, lvl, ")");
2010
+               break;
2011
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
2012
+               debug_rtx(x);
2013
+               break;
2014
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
2015
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
2016
+       case NOTE:
2017
+               {       char buf[128];
2018
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
2019
+                       zip_debug_print(pfx, lvl, buf);
2020
+               }break;
2021
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
2022
+               debug_rtx(x);
2023
+               break;
2024
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
2025
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
2026
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
2027
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
2028
+       case CODE_LABEL:
2029
+               {
2030
+                       char    buf[64];
2031 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
2032 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2033
+               } break;
2034
+       case SET:
2035
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
2036 117 dgisselq
+               zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
2037
+               zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
2038 102 dgisselq
+               zip_debug_print(pfx, lvl, ")");
2039 117 dgisselq
+               debug_rtx(x);
2040 102 dgisselq
+               break;
2041 122 dgisselq
+       case REG: {
2042 127 dgisselq
+               char buf[25], mstr[4];
2043
+               mstr[0] = '\0';
2044
+               if (GET_MODE(x) == SImode)
2045
+                       strcpy(mstr, ":SI");
2046
+               else if (GET_MODE(x) == DImode)
2047
+                       strcpy(mstr, ":DI");
2048
+               else if (GET_MODE(x) == VOIDmode)
2049
+                       strcpy(mstr, ":V");
2050 102 dgisselq
+               if (REGNO(x) == zip_PC)
2051 127 dgisselq
+                       sprintf(buf, "(PC%s)", mstr);
2052 102 dgisselq
+               else if (REGNO(x) == zip_CC)
2053 127 dgisselq
+                       sprintf(buf, "(CC%s)", mstr);
2054 102 dgisselq
+               else if (REGNO(x) == zip_SP)
2055 127 dgisselq
+                       sprintf(buf, "(SP%s)", mstr);
2056 102 dgisselq
+               else if (REGNO(x) == zip_FP)
2057 127 dgisselq
+                       sprintf(buf, "(REG%s FP)", mstr);
2058 102 dgisselq
+               else if (REGNO(x) == zip_GOT)
2059 127 dgisselq
+                       sprintf(buf, "(REG%s GBL)", mstr);
2060 102 dgisselq
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2061 127 dgisselq
+                       sprintf(buf, "(REG%s RTN-VL)", mstr);
2062 102 dgisselq
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2063 127 dgisselq
+                       sprintf(buf, "(REG%s RTN-AD)", mstr);
2064 122 dgisselq
+               else
2065 127 dgisselq
+                       sprintf(buf, "(REG%s %d)", mstr, REGNO(x));
2066
+               if (mstr[0])
2067
+                       zip_debug_print(pfx, lvl, buf);
2068
+               else
2069
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2070 102 dgisselq
+               } break;
2071
+       case IF_THEN_ELSE: // 51
2072
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2073
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2074
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2075
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2076
+               zip_debug_print(pfx, lvl, ")");
2077
+               break;
2078
+       case PC:
2079
+               zip_debug_print(pfx, lvl, "(PC)");
2080
+               break;
2081
+       case CC0:
2082
+               zip_debug_print(pfx, lvl, "(CC0)");
2083
+               break;
2084
+       case COMPARE:
2085 127 dgisselq
+               zip_debug_print_m(pfx, lvl, "(COMPARE", GET_MODE(x));
2086 102 dgisselq
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2087
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2088
+               zip_debug_print(pfx, lvl, ")");
2089
+               break;
2090 111 dgisselq
+       case CONST:
2091
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2092
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2093
+               zip_debug_print(pfx, lvl, ")");
2094
+               break;
2095 102 dgisselq
+       case CONST_INT:
2096
+               { char buf[25];
2097
+               if (GET_MODE(x)==SImode)
2098 135 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", (long)INTVAL(x));
2099 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2100 135 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", (long)INTVAL(x));
2101 102 dgisselq
+               else
2102 135 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", (long)INTVAL(x));
2103 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2104
+               } break;
2105
+       case LABEL_REF:
2106 122 dgisselq
+               { char buf[256];
2107 111 dgisselq
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2108
+               zip_debug_print(pfx, lvl, buf);
2109
+               }
2110 102 dgisselq
+               break;
2111
+       case SYMBOL_REF:
2112
+               {
2113
+                       char buf[64];
2114
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2115
+                       // fprintf(file, "%s", XSTR(x,0));
2116
+                       zip_debug_print(pfx, lvl, buf);
2117
+               }
2118
+               break;
2119
+       case MEM:
2120
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2121
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2122
+               zip_debug_print(pfx, lvl, ")");
2123
+               break;
2124
+       /*
2125
+       case VALUE:
2126
+               {
2127
+                       char buf[64];
2128
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2129
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2130
+               }
2131
+               break;
2132
+       */
2133
+       case PLUS:
2134
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2135
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2136
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2137
+               zip_debug_print(pfx, lvl, ")");
2138
+               break;
2139
+       case MINUS:
2140
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2141
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2142
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2143
+               zip_debug_print(pfx, lvl, ")");
2144
+               break;
2145
+       case AND:
2146
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2147
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2148
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2149
+               zip_debug_print(pfx, lvl, ")");
2150
+               break;
2151
+       case IOR:
2152
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2153
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2154
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2155
+               zip_debug_print(pfx, lvl, ")");
2156
+               break;
2157
+       case XOR:
2158
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2159
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2160
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2161
+               zip_debug_print(pfx, lvl, ")");
2162
+               break;
2163
+       case MULT:
2164
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2165
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2166
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2167
+               zip_debug_print(pfx, lvl, ")");
2168
+               break;
2169
+       case EQ:        //
2170
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2171
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2172
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2173
+               zip_debug_print(pfx, lvl, ")");
2174
+               break;
2175
+       case NE:        //
2176
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2177
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2178
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2179
+               zip_debug_print(pfx, lvl, ")");
2180
+               break;
2181
+       case GE:        //
2182
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2183
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2184
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2185
+               zip_debug_print(pfx, lvl, ")");
2186
+               break;
2187
+       case GT:        //
2188
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2189
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2190
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2191
+               zip_debug_print(pfx, lvl, ")");
2192
+               break;
2193
+       case LE:        //
2194
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2195
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2196
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2197
+               zip_debug_print(pfx, lvl, ")");
2198
+               break;
2199
+       case LT:        //
2200
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2201
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2202
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2203
+               zip_debug_print(pfx, lvl, ")");
2204
+               break;
2205
+       case GEU:       //
2206
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2207
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2208
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2209
+               zip_debug_print(pfx, lvl, ")");
2210
+               break;
2211
+       case GTU:       //
2212
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2213
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2214
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2215
+               zip_debug_print(pfx, lvl, ")");
2216
+               break;
2217
+       case LEU:       //
2218
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2219
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2220
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2221
+               zip_debug_print(pfx, lvl, ")");
2222
+               break;
2223
+       case LTU:       //
2224
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2225
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2226
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2227
+               zip_debug_print(pfx, lvl, ")");
2228
+               break;
2229
+       case SCRATCH:   //
2230
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2231
+               break;
2232
+       case SUBREG:
2233
+               { char buf[25];
2234 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2235
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2236
+                               SUBREG_BYTE(x));
2237
+                       zip_debug_print(pfx, lvl, buf);
2238
+               } else if (MEM_P(XEXP(x,0))) {
2239
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2240
+                       zip_debug_print(pfx, lvl, buf);
2241
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2242
+                       zip_debug_print(pfx, lvl, ")");
2243
+               } else {
2244
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2245
+                       zip_debug_print(pfx, lvl, buf);
2246
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2247
+                       zip_debug_print(pfx, lvl, ")");
2248
+               }}
2249
+               break;
2250 127 dgisselq
+       case ASHIFT:
2251
+               zip_debug_print_m(pfx, lvl, "(ASHIFT", GET_MODE(x));
2252
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2253
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2254
+               zip_debug_print(pfx, lvl, ")");
2255
+               break;
2256
+       case ASHIFTRT:
2257
+               zip_debug_print_m(pfx, lvl, "(ASHIFTRT", GET_MODE(x));
2258
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2259
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2260
+               zip_debug_print(pfx, lvl, ")");
2261
+               break;
2262
+       case LSHIFTRT:
2263
+               zip_debug_print_m(pfx, lvl, "(LSHIFTRT", GET_MODE(x));
2264
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2265
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2266
+               zip_debug_print(pfx, lvl, ")");
2267
+               break;
2268 102 dgisselq
+       default:
2269 111 dgisselq
+               { char buf[128];
2270 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2271
+               zip_debug_print(pfx, lvl, buf);
2272
+               debug_rtx(x);
2273
+               } break;
2274
+       }
2275
+}
2276
+
2277
+void
2278
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2279
+       zip_debug_rtx_1(pfx, x, 0);
2280
+}
2281
+
2282
+void
2283
+zip_debug_rtx(const_rtx x) {
2284
+       zip_debug_rtx_pfx("", x);
2285
+}
2286
+
2287
+void
2288
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2289
+}
2290
+
2291
+void
2292
+zip_debug_bb(basic_block bb) {
2293
+       rtx_insn        *insn;
2294
+
2295
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2296
+       FOR_BB_INSNS(bb, insn)
2297
+       {
2298
+               zip_debug_rtx(insn);
2299
+       }
2300
+}
2301
+
2302
+
2303
+static bool
2304 122 dgisselq
+zip_legitimate_opb(rtx x, bool strict)
2305 102 dgisselq
+{
2306 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2307 102 dgisselq
+
2308 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2309 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2310
+
2311
+       if (NULL_RTX == x)
2312
+               return false;
2313 122 dgisselq
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2314
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> Mode failure\n");
2315 102 dgisselq
+               return false;
2316 122 dgisselq
+       } else if ((strict)&&(REG_P(x))) {
2317
+               if (REGNO(x)<zip_CC) {
2318
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2319
+                       return true;
2320
+               } else return false;
2321
+       } else if (register_operand(x, GET_MODE(x))) {
2322
+               // This also handles subregs
2323
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2324
+               return true;
2325 111 dgisselq
+       } else if ((CONST_INT_P(x))
2326
+               &&(INTVAL(x) >= zip_min_opb_imm)
2327
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2328 136 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const) %ld <= %ld <= %ld\n", (long)zip_min_opb_imm, (long)INTVAL(x), (long)zip_max_opb_imm);
2329 111 dgisselq
+               return true;
2330 122 dgisselq
+       // } else if ((GET_CODE(x) == LABEL_REF)||(GET_CODE(x)==CODE_LABEL)) {
2331
+               // return true;
2332 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2333
+               // Is it a valid register?
2334 122 dgisselq
+               if ((!strict)&&(!register_operand((rtx)XEXP((rtx)x,0), GET_MODE(x)))) {
2335 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2336 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2337
+                       return false;
2338 122 dgisselq
+               } else if ((strict)&&((!REG_P(XEXP(x,0)))||(REGNO(XEXP(x,0))>=zip_CC))) {
2339 102 dgisselq
+                       return false;
2340
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2341
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2342
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2343 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2344 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2345
+                               // gcc_unreachable();
2346 102 dgisselq
+                       return true;
2347
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2348 122 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == CODE_LABEL)
2349 102 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2350
+                       // While we can technically support this, the problem
2351
+                       // is that the symbol address could be anywhere, and we
2352
+                       // have no way of recovering if it's outside of our
2353
+                       // 14 allowable bits.
2354 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2355 102 dgisselq
+                       return false;
2356
+               }
2357
+       }
2358
+
2359 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2360 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2361
+       return false;
2362
+}
2363
+
2364
+static bool
2365
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2366
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2367
+
2368
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2369
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2370
+
2371 122 dgisselq
+       if (!zip_legitimate_opb(x, strict))
2372 102 dgisselq
+               return false;
2373 122 dgisselq
+       else if ((GET_CODE(x)==PLUS)&&(CONST_INT_P(XEXP(x,1)))) {
2374
+               if ((INTVAL(XEXP(x, 1)) > zip_max_mov_offset)
2375
+                       ||(INTVAL(XEXP(x, 1)) < zip_min_mov_offset)) {
2376 135 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> NO! (reg+int), int out of bounds: %ld\n", (long)INTVAL(XEXP(x,1)));
2377 102 dgisselq
+                       return false;
2378
+               }
2379
+       }
2380
+
2381 122 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> Yes\n");
2382 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2383 122 dgisselq
+       return true;
2384 102 dgisselq
+}
2385
+
2386
+int
2387
+zip_pd_mov_operand(rtx op)
2388
+{
2389
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2390
+
2391
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2392
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2393
+}
2394
+
2395
+int
2396 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2397
+{
2398
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2399
+
2400
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2401
+       if (!CONST_INT_P(op))
2402
+               return false;
2403
+       if (INTVAL(op) > zip_max_mov_offset)
2404
+               return false;
2405
+       if (INTVAL(op) < zip_min_mov_offset)
2406
+               return false;
2407
+       return true;
2408
+}
2409
+
2410
+int
2411
+zip_pd_imm_operand(rtx op)
2412
+{
2413
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2414
+
2415
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2416
+       if (!CONST_INT_P(op))
2417
+               return false;
2418
+       if (INTVAL(op) > zip_max_anchor_offset)
2419
+               return false;
2420
+       if (INTVAL(op) < zip_min_anchor_offset)
2421
+               return false;
2422
+       return true;
2423
+}
2424
+
2425
+int
2426 102 dgisselq
+zip_address_operand(rtx op)
2427
+{
2428
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2429
+
2430
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2431 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2432
+               return false;
2433
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2434
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2435
+               return false;
2436
+       else
2437
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2438 102 dgisselq
+}
2439
+
2440
+int
2441 111 dgisselq
+zip_pd_opb_operand(rtx op)
2442 102 dgisselq
+{
2443
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2444
+
2445 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2446 122 dgisselq
+       return zip_legitimate_opb(op, false); //, !can_create_pseudo_p());
2447 102 dgisselq
+}
2448
+
2449
+int
2450
+zip_ct_address_operand(rtx op)
2451
+{
2452
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2453
+
2454
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2455 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2456 102 dgisselq
+}
2457
+
2458
+int
2459
+zip_const_address_operand(rtx x) {
2460
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2461
+
2462
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2463
+       if (dbg) zip_debug_rtx(x);
2464 127 dgisselq
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2465
+               fprintf(stderr, "is ZIP-CONST-ADDRESS? -> NO, BAD MODE\n");
2466 102 dgisselq
+               return false;
2467 127 dgisselq
+       }
2468 102 dgisselq
+       if ((GET_CODE(x) == LABEL_REF)
2469
+                       ||(GET_CODE(x) == CODE_LABEL)
2470
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2471 127 dgisselq
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (LBL)\n");
2472 102 dgisselq
+               return true;
2473
+       } else if (CONST_INT_P(x)) {
2474 127 dgisselq
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (INT)\n");
2475 102 dgisselq
+               return true;
2476
+       } else if (GET_CODE(x) == PLUS) {
2477
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2478
+               return ((zip_const_address_operand(XEXP(x,0)))
2479
+                       &&(CONST_INT_P(XEXP(x,1))));
2480
+       } else if (GET_CODE(x) == MINUS) {
2481
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2482
+               return ((zip_const_address_operand(XEXP(x,0)))
2483
+                       &&(zip_const_address_operand(XEXP(x,1))));
2484
+       }
2485
+
2486
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2487
+       if (dbg) zip_debug_rtx(x);
2488
+       return false;
2489
+}
2490
+
2491
+int
2492
+zip_ct_const_address_operand(rtx x) {
2493
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2494
+
2495
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2496
+       return zip_const_address_operand(x);
2497
+}
2498
+
2499
+int
2500
+zip_pd_const_address_operand(rtx x) {
2501
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2502
+
2503
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2504
+       return zip_const_address_operand(x);
2505
+}
2506
+
2507
+
2508
+static bool
2509
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2510
+{
2511
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2512
+
2513
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2514
+       if (dbg) zip_debug_rtx(x);
2515
+
2516
+       // Only insist the register be a valid register if strict is true
2517 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2518 102 dgisselq
+               return true;
2519 111 dgisselq
+       // else if (zip_const_address_operand(x))
2520
+               // return true;
2521 102 dgisselq
+
2522
+       return false;
2523
+}
2524
+
2525 111 dgisselq
+static rtx
2526
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2527
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2528
+
2529
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2530
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2531
+               return x;
2532
+
2533
+       if (GET_CODE(x)==PLUS) {
2534
+               if (!REG_P(XEXP(x,0)))
2535
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2536
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2537
+                       &&(!CONST_INT_P(XEXP(x,1))))
2538
+                       x = force_reg(GET_MODE(x),x);
2539
+       } else if (MEM_P(x))
2540
+               x = force_reg(GET_MODE(x),x);
2541
+
2542
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2543
+       return x;
2544
+}
2545
+
2546 102 dgisselq
+void
2547
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2548
+{
2549
+       assemble_name(stream, name);
2550
+       fprintf(stream, "\t.equ ");
2551
+       assemble_name(stream, value);
2552
+       fputc('\n', stream);
2553
+}
2554
+
2555 111 dgisselq
+#define        USE_SUBREG
2556
+#ifdef USE_SUBREG
2557
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2558
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2559
+#else
2560
+#define        SREG_P(RTX)     false
2561
+#define        SMEM_P(RTX)     false
2562
+#endif
2563 102 dgisselq
+
2564
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2565 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2566 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2567
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2568
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2569
+       switch(GET_CODE(condition)) {
2570
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2571
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2572
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2573
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2574
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2575
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2576
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2577
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2578
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2579
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2580
+       default:
2581
+               zip_debug_rtx(condition);
2582
+               internal_error("CSTORE Unsupported condition");
2583
+               return NULL;
2584
+       }
2585
+}
2586
+
2587 127 dgisselq
+/*
2588 102 dgisselq
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2589
+       static char     result[64] = "";
2590
+       switch(condition) {
2591
+               //
2592
+               // Result already exists in the iffalse register
2593
+               // Can't change it.  Therefore, on the
2594
+               // condition ... move true register to the
2595
+               // destination
2596
+               //
2597
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2598
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2599
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2600
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2601
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2602
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2603
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2604
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2605
+               //
2606
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2607
+               // .C will never be set on an equal condition.  Therefore, we
2608
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2609
+               // as long as .Z wasn't true.  We then undo this when we're
2610
+               // done.  This is possible since none of these instructions
2611
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2612
+               // the condition codes.
2613
+               //
2614
+               // This is obviously not very optimal.  Avoid this by all means
2615
+               // if you can
2616
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2617
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2618
+               // two instructions
2619
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2620
+               //
2621
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2622
+               // painful.  We can change the condition codes to make it so,
2623
+               // but the instruction requires the condition codes not be
2624
+               // changed.  Hence, we must change them back if we do so.
2625
+               //
2626
+               // .C will be set on less than but not equal.  Hence !.C will
2627
+               // be true on greater than or equal.
2628
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2629
+               default:
2630
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2631
+                       return NULL;
2632
+       } return result;
2633
+}
2634 127 dgisselq
+*/
2635 102 dgisselq
+
2636 127 dgisselq
+bool
2637
+zip_supported_condition(int c) {
2638
+       switch(c) {
2639
+       case NE: case LT: case EQ: case GT: case GE: case LTU:
2640
+               return true;
2641
+               break;
2642
+       default:
2643
+               break;
2644
+       } return false;
2645 102 dgisselq
+}
2646
+
2647 127 dgisselq
+bool
2648
+zip_signed_comparison(int c) {
2649
+       switch(c) {
2650
+       case NE: case LT: case EQ: case GT: case GE:
2651
+               return true;
2652
+       default:
2653
+               break;
2654
+       } return false;
2655
+}
2656
+
2657
+void
2658
+zip_expand_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2659 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2660 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2661
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2662
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2663
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2664
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2665 127 dgisselq
+
2666
+       // Start with the condition
2667
+       rtx     cmpa = XEXP(condition,0), cmpb=XEXP(condition,1);
2668
+       enum rtx_code   cmpcode = GET_CODE(condition);
2669
+
2670
+       //; Do we need to swap or adjust the condition?
2671
+       if (zip_supported_condition((int)cmpcode)) {
2672
+               // Keep everything as is
2673
+       } else if ((zip_supported_condition(reverse_condition(cmpcode)))
2674
+                       &&(!MEM_P(iffalse))) {
2675
+               rtx tem = iffalse;
2676
+               iffalse = iftrue;
2677
+               iftrue = tem;
2678
+
2679
+               cmpcode = reverse_condition(cmpcode);
2680
+       } else if ((zip_supported_condition((int)swap_condition(cmpcode)))
2681
+               &&((REG_P(cmpb))||(can_create_pseudo_p()))) {
2682
+               rtx tem = cmpa;
2683
+               cmpa = cmpb;
2684
+               cmpa = tem;
2685
+               cmpcode = swap_condition(cmpcode);
2686
+
2687
+               if ((GET_CODE(cmpa)==PLUS)&&(zip_signed_comparison((int)cmpcode))
2688
+                       &&(REG_P(XEXP(cmpa,0)))
2689
+                       &&(CONST_INT_P(XEXP(cmpa,1)))
2690
+                       &&(abs(INTVAL(XEXP(cmpa,1)))<(1<<17))) {
2691
+
2692
+                       // If we were doing CMP x(Rb),Ra
2693
+                       // and we just changed it to CMP Ra,x(Rb)
2694
+                       // adjust it to CMP -x(Ra),Rb
2695
+                       cmpb = plus_constant(SImode, cmpb, -INTVAL(XEXP(cmpa,1)));
2696
+                       cmpa = XEXP(cmpa,0);
2697
+               } else if (!REG_P(cmpa)) {
2698
+                       // Otherwise, if we had anything else in Rb other than
2699
+                       // a register ... such as a constant, then load it into
2700
+                       // a register before comparing it.  So
2701
+                       //      CMP x,Ra
2702
+                       // became
2703
+                       //      CMP Ra,x
2704
+                       // now becomes
2705
+                       //      LDI x,Rt
2706
+                       //      CMP Ra,Rt
2707
+                       // (We already tested for can_create_pseudo_p() above..)
2708
+                       tem = gen_reg_rtx(SImode);
2709
+                       emit_move_insn(tem, cmpa);
2710
+                       cmpa = tem;
2711 102 dgisselq
+               }
2712 127 dgisselq
+       } else {
2713
+               // Here's our last chance.
2714
+               // This will adjust for less than equal types of stuff
2715
+               int     cod = (int)cmpcode;
2716
+               zip_canonicalize_comparison(&cod, &cmpa, &cmpb, false);
2717
+               cmpcode = (enum rtx_code)cod;
2718 102 dgisselq
+       }
2719
+
2720 127 dgisselq
+       gcc_assert(zip_supported_condition((int)cmpcode));
2721
+
2722
+       //; Always do the default move
2723
+       emit_move_insn(dst, iffalse);
2724
+
2725
+       rtx     cc_rtx = gen_rtx_REG(CCmode, zip_CC);
2726
+
2727
+       //; Now let's get our comparison right
2728
+       emit_insn(gen_rtx_SET(VOIDmode, cc_rtx,
2729
+               gen_rtx_COMPARE(CCmode, cmpa, cmpb)));
2730
+
2731
+       //; Finally, let's load the value on true
2732
+       emit_insn(gen_movsicc_bare(dst,
2733
+                       gen_rtx_fmt_ee(cmpcode, SImode, NULL_RTX, NULL_RTX),
2734
+                       iftrue, dst));
2735 102 dgisselq
+}
2736
+
2737
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2738
+       // We know upon entry that REG_P(dst) must be true
2739
+       if (!REG_P(dst))
2740
+               internal_error("%s","ADDSICC into something other than register");
2741
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2742
+               switch (GET_CODE(condition)) {
2743
+               case EQ: return "ADD.Z\t%3,%0";
2744
+               case NE: return "ADD.NZ\t%3,%0";
2745
+               case LT: return "ADD.LT\t%3,%0";
2746
+               case GT: return "ADD.GT\t%3,%0";
2747
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2748
+               case GE: return "ADD.GE\t%3,%0";
2749
+               case LTU: return "ADD.C\t%3,%0";
2750
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2751
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2752
+               // Can do a GEU comparison, and then undo on the Zero condition
2753
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2754
+               default:
2755
+                       internal_error("%s", "Zip/No usable addsi expansion");
2756
+                       break;
2757
+               }
2758
+       } else {
2759
+               // MOV A+REG,REG
2760
+               switch (GET_CODE(condition)) {
2761
+               case EQ: return "MOV.Z\t%3+%2,%0";
2762
+               case NE: return "MOV.NZ\t%3+%2,%0";
2763
+               case LT: return "MOV.LT\t%3+%2,%0";
2764
+               case GT: return "MOV.GT\t%3+%2,%0";
2765
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2766
+               case GE: return "MOV.GE\t%3+%2,%0";
2767
+               case LTU: return "MOV.C\t%3+%2,%0";
2768
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2769
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2770
+               // Can do a GEU comparison, and then undo on the Zero condition
2771
+               // EXCEPT: with a move instruction, what's there to undo?  We
2772
+               // just clobbered our register!
2773
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2774
+               default:
2775
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2776
+                       break;
2777
+               }
2778
+       }
2779
+
2780
+       return "BREAK";
2781
+}
2782
+
2783 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2784 102 dgisselq
+       int     rv = 14;
2785
+       if ((mode == DImode)||(mode == DFmode))
2786
+               rv += 2;
2787
+       return rv;
2788
+}
2789
+
2790 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
2791 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void) {
2792
+       // Let's try their suggested approach, keeping us from modifying jumps
2793
+       // after reload.  This should also allow our peephole2 optimizations
2794
+       // to adjust things back to what they need to be if necessary.
2795
+       return (reload_completed || reload_in_progress);
2796
+}
2797 122 dgisselq
+
2798
+rtx_insn       *zip_ifcvt_info;
2799
+
2800
+void
2801
+zip_ifcvt_modify_tests(ce_if_block *ce_info ATTRIBUTE_UNUSED, rtx *true_expr, rtx *false_expr) {
2802
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2803
+       if (dbg) fprintf(stderr, "IFCVT-MODIFY-TESTS\n");
2804
+       if (*true_expr) switch(GET_CODE(*true_expr)) {
2805
+               case LE:
2806
+               case GTU:
2807
+               case GEU:
2808
+               case LEU:
2809
+                       if (dbg) fprintf(stderr, "TRUE, missing expr\n");
2810
+                       if (dbg) zip_debug_rtx(*true_expr);
2811
+                       *true_expr = NULL_RTX;
2812
+                       break;
2813
+               default: // LT, GT, GTE, LTU, NE, EQ
2814
+                       break;
2815
+       }
2816
+
2817
+       if (*false_expr) switch(GET_CODE(*false_expr)) {
2818
+               case LE:
2819
+               case GTU:
2820
+               case GEU:
2821
+               case LEU:
2822
+                       if (dbg) fprintf(stderr, "FALSE, missing expr\n");
2823
+                       if (dbg) zip_debug_rtx(*false_expr);
2824
+                       *false_expr = NULL_RTX;
2825
+               default:
2826
+                       break;
2827
+       }
2828
+       if ((dbg)&&((!*true_expr)||(!*false_expr)))
2829
+               fprintf(stderr, "IFCVT-MODIFY-TESTS -- FAIL\n");
2830
+}
2831
+
2832
+void
2833
+zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2834
+/*
2835
+       fprintf(stderr, "IFCVT -- CANCEL\n");
2836
+       zip_ifcvt_info = NULL;
2837
+*/
2838
+}
2839
+
2840
+void
2841
+zip_ifcvt_modify_final(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2842
+/*
2843
+rtx_insn *insn;
2844
+FOR_BB_INSNS(ceinfo->test_bb, insn)
2845
+       fprintf(stderr, "IFCVT -- FINAL\n");
2846
+       zip_debug_rtx_pfx("FINAL-TEST-BB", insn);
2847
+       zip_ifcvt_info = NULL;
2848
+*/
2849
+}
2850
+
2851
+void
2852
+zip_ifcvt_machdep_init(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2853
+/*
2854
+       zip_ifcvt_info = NULL;
2855
+       rtx_insn *insn, *ifinsn = NULL;
2856
+       FOR_BB_INSNS(ceinfo->test_bb, insn) {
2857
+               rtx     p;
2858
+               p = single_set(insn);
2859
+               if (!p) continue;
2860
+               if (SET_DEST(p)==pc_rtx) {
2861
+                       ifinsn = insn;
2862
+               }
2863
+               if (!REG_P(SET_DEST(p)))
2864
+                       continue;
2865
+               if (GET_MODE(SET_DEST(p))!=CCmode)
2866
+                       continue;
2867
+               if (REGNO(SET_DEST(p))!=zip_CC)
2868
+                       continue;
2869
+               zip_ifcvt_info = insn;
2870
+       }
2871
+
2872
+       if (zip_ifcvt_info)
2873
+               zip_debug_rtx_pfx("PUTATIVE-CMP",zip_ifcvt_info);
2874
+       if (ifinsn)
2875
+               zip_debug_rtx_pfx("PRIOR-JMP",ifinsn);
2876
+*/
2877
+}
2878
+
2879 127 dgisselq
+int    zip_insn_sets_cc(rtx_insn *insn) {
2880
+       return (get_attr_ccresult(insn)==CCRESULT_SET);
2881
+}
2882
+
2883
+int    zip_is_conditional(rtx_insn *insn) {
2884
+       return (get_attr_conditional(insn)==CONDITIONAL_YES);
2885
+}
2886 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.h gcc-5.3.0-zip/gcc/config/zip/zip.h
2887
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
2888 138 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-04-30 19:30:48.670201745 -0400
2889
@@ -0,0 +1,4060 @@
2890 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
2891
+//
2892
+// Filename:   gcc/config/zip/zip.h
2893
+//
2894
+// Project:    Zip CPU backend for the GNU Compiler Collection
2895
+//
2896
+// Purpose:
2897
+//
2898
+// Creator:    Dan Gisselquist, Ph.D.
2899
+//             Gisselquist Technology, LLC
2900
+//
2901
+////////////////////////////////////////////////////////////////////////////////
2902
+//
2903
+// Copyright (C) 2016, Gisselquist Technology, LLC
2904
+//
2905
+// This program is free software (firmware): you can redistribute it and/or
2906
+// modify it under the terms of  the GNU General Public License as published
2907
+// by the Free Software Foundation, either version 3 of the License, or (at
2908
+// your option) any later version.
2909
+//
2910
+// This program is distributed in the hope that it will be useful, but WITHOUT
2911
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
2912
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2913
+// for more details.
2914
+//
2915
+// You should have received a copy of the GNU General Public License along
2916
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
2917
+// target there if the PDF file isn't present.)  If not, see
2918
+// <http://www.gnu.org/licenses/> for a copy.
2919
+//
2920
+// License:    GPL, v3, as defined and found on www.gnu.org,
2921
+//             http://www.gnu.org/licenses/gpl.html
2922
+//
2923
+//
2924
+////////////////////////////////////////////////////////////////////////////////
2925
+#ifndef        GCC_ZIP_H
2926
+#define        GCC_ZIP_H
2927
+
2928
+
2929
+//
2930
+//
2931 127 dgisselq
+// Zip CPU configuration defines
2932 102 dgisselq
+//
2933
+//
2934
+#define        ZIP_USER        0        // Assume we are in supervisor mode
2935
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
2936
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
2937
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
2938
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
2939
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
2940
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
2941
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
2942
+#define        ZIP_HAS_DI      1
2943 127 dgisselq
+// Should we use the peephole optimizations?
2944
+#define        ZIP_PEEPHOLE    1       // 0 means no peephole optimizations.
2945 138 dgisselq
+// How about the new long multiply instruction set?
2946
+#define        ZIP_LONGMPY     1       // 0 means use the old instruction set
2947 102 dgisselq
+
2948
+// Zip has 16 registers in each user mode.
2949
+//     Register 15 is the program counter (PC)
2950
+//     Register 14 is the condition codes (CC)
2951
+//     Register 13 is the stack pointer   (SP)
2952
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
2953
+//     Register  0 (may be) the return address pointer
2954
+// Registers 16-31 may only be used in supervisor mode.
2955
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
2956
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
2957
+
2958 103 dgisselq
+// #define     zip_FP_PSEUDO   16
2959
+#define        zip_PC          15
2960
+#define        zip_CC          14
2961
+#define        zip_SP          13
2962
+#define        zip_FP          12
2963
+#define        zip_GOT         11
2964
+#define        zip_AP          10
2965
+#define        zip_R1          1
2966
+#define        zip_R0          0
2967 102 dgisselq
+
2968
+#define        ZIP_FIRST_ARG_REGNO     1
2969
+#define        ZIP_LAST_ARG_REGNO      5
2970 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
2971
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
2972 102 dgisselq
+
2973
+/* The overall framework of an assembler file */
2974
+
2975
+#define        ASM_COMMENT_START       ";"
2976
+#define        ASM_APP_ON              ""
2977
+#define        ASM_APP_OFF             ""
2978
+
2979
+#define        FILE_ASM_OP             "\t.file\n"
2980
+
2981
+/* Output and Generation of Labels */
2982
+#define        GLOBAL_ASM_OP           "\t.global\t"
2983
+
2984
+#undef BITS_PER_UNIT
2985
+#define        BITS_PER_UNIT   (32)
2986
+
2987
+/* Assembler Commands for Alignment */
2988
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
2989 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
2990 102 dgisselq
+
2991
+
2992
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
2993
+ * for an instruction operand X. */
2994
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
2995
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
2996
+
2997
+/* Passing arguments in registers */
2998
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
2999
+
3000
+/* Define how to find the value returned by a function.  VALTYPE is the data
3001
+ * type of the value (as a tree).  If the precise function being called is known
3002
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
3003
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
3004
+
3005
+/* Define how to find the value returned by a library function assuming the
3006
+ * value has mode MODE.
3007
+ */
3008
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
3009
+
3010
+
3011
+/* STACK AND CALLING */
3012
+
3013
+
3014
+/* Define this macro as a C expression that is nonzero for registers that are
3015
+ * used by the epilogue or the return pattern.  The stack and frame pointer
3016
+ * registers are already assumed to be used as needed.
3017
+ */
3018
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
3019
+
3020
+
3021
+/* The best alignment to use in cases where we have a choice. */
3022 127 dgisselq
+#define        FASTEST_ALIGNMENT       BITS_PER_WORD
3023 102 dgisselq
+
3024
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3025
+ * largest integer machine mode that should actually be used.  All integer
3026
+ * machine modes of this size and smaller can be used for structures and unions
3027
+ * with the appropriate sizes.  If this macro is undefined,
3028
+ * GET_MODE_BITSIZE(DImode) is assumed.
3029
+ *
3030
+ * ZipCPU -- The default looks good enough for us.
3031
+ */
3032
+
3033
+/* Generate Code for Profiling
3034
+ */
3035
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3036
+
3037
+
3038
+/* A C expression which is nonzero if register number NUM is suitable for use
3039
+ * as an index register in operand addresses.
3040
+ */
3041
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3042
+
3043
+
3044
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3045
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3046
+ * operand of mode MODE.
3047
+ */
3048 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3049
+// DRIVER_SELF_SPECS
3050
+// OPTION_DEFAULT_SPECS
3051
+// CPP_SPEC
3052
+// CPLUSPLUS_CPP_SPEC
3053
+// CC1_SPEC
3054
+// CC1PLUS_SPEC
3055
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3056
+ * to pass to the assembler.  It can also specify how to translate options you
3057
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3058
+ * 'sun3.h' for an example of this.
3059
+ *
3060
+ * Do not define thismacro if it does not need to do anything.
3061
+ */
3062
+// #undef      ASM_SPEC
3063
+// ASM_FINAL_SPEC
3064
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3065
+
3066
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3067
+ * to pass to the linker.  It can also specify how to translate options you give
3068
+ * to GCC into options for GCC to pass to the linker.
3069
+ *
3070
+ * Do not define this macro if it does not need to do anything.
3071
+ */
3072
+
3073
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3074
+ * difference between the two is that LIB_SPEC is used at the end of the
3075
+ * command given to the linker.
3076
+ *
3077
+ * If this macro is not defined, a default is provided that loads the standard
3078
+ * C library from the usual place.  See 'gcc.c'.
3079
+ */
3080
+#undef LIB_SPEC
3081
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3082
+#define        LIB_SPEC        ""
3083
+
3084
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3085
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3086
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3087
+ *
3088
+ * If this macro is not defined, the GCC driver provides a default that passes
3089
+ * the string '-lgcc' to the linker.
3090
+ */
3091
+#undef LIBGCC_SPEC
3092
+#define        LIBGCC_SPEC     ""
3093
+
3094
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3095
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3096
+ * modified to refer to different versions of 'libgcc.a' depending on the
3097
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3098
+ * and '-shared-libgcc'.  On targets where these modifications are
3099
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3100
+ * driver how to place a reference to 'libgcc' on the link command line, but
3101
+ * unlike LIBGCC_SPEC, it is used unmodified.
3102
+ */
3103
+#define        REAL_LIBGCC_SPEC        ""
3104
+
3105
+// USE_LD_AS_NEEDED
3106
+// LINK_EH_SPEC
3107
+
3108
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3109
+ * difference between the two is that STARTFILE_SPEC is used at the very
3110
+ * beginning of the command given to the linker.
3111
+ *
3112
+ * If this macro is not defined, a default is provided that loads the standard
3113
+ * C startup file from the usual place.  See 'gcc.c'
3114
+ */
3115
+#undef STARTFILE_SPEC
3116
+#define        STARTFILE_SPEC  ""
3117
+
3118
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3119
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3120
+ * of the command given to the linker.
3121
+ *
3122
+ * Do not define this macro if it does not do anything.
3123
+ */
3124
+// #undef      ENDFILE_SPEC
3125
+// #define     ENDFILE_SPEC    ""
3126
+
3127
+// THREAD_MODEL_SPEC
3128
+// SYSROOT_SUFFIX_SPEC
3129
+// SYSROOT_HEADERS_SUFFIX_SPEC
3130
+// EXTRA_SPECS
3131
+// LINK_LIBGCC_SPECIAL_1
3132
+// LINK_GCC_C_SEQUENCE_SPEC
3133
+// LINK_COMMAND_SPEC
3134
+// TARGET_ALWAYS_STRIP_DOTDOT
3135
+// MULTILIB_DEFAULTS
3136
+// RELATIVE_PREFIX_NOT_LINKDIR
3137
+// MD_EXEC_PREFIX
3138
+// STANDARD_STARTFILE_PREFIX
3139
+// STANDARD_STARTFILE_PREFIX_1
3140
+// STANDARD_STARTFILE_PREFIX_2
3141
+// MD_STARTFILE_PREFIX
3142
+// MD_STARTFILE_PREFIX_1
3143
+// INIT_ENVIRONMENT
3144
+// LOCAL_INCLUDE_DIR
3145
+#undef LOCAL_INCLUDE_DIR
3146
+
3147
+// NATIVE_SYSTEM_HEADER_COMPONENT
3148
+// INCLUDE_DEFAULTS
3149
+
3150 102 dgisselq
+/* 17.03 Run-time Target Specification */
3151
+
3152
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3153
+ * code that defines built-in preprocessor macros and assertions for the target
3154
+ * CPU, using the functions builtin_define, builtin_define_std, and
3155
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3156
+ * semicolon, and since it has finished command line option proccessing your
3157
+ * code can use those results freely.
3158
+ *
3159
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3160
+ * command line parameters we've been given indicate that our CPU has.  That
3161
+ * way, code can be adjusted depending upon the CPU's capabilities.
3162
+ */
3163
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3164
+       { builtin_define("__ZIPCPU__");                 \
3165
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3166
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3167
+       }
3168
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3169
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3170
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3171
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3172
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3173
+       // If (we support int64s) builtin_define("___int64_t_defined");
3174
+
3175
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3176
+ * macro is optional and is used for the target operating system instead.
3177
+ */
3178
+
3179
+/* Option macros: (we need to define these eventually ... )
3180
+ *
3181
+ *     TARGET_HANDLE_OPTION
3182
+ *     TARGET_HANDLE_C_OPTION
3183
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3184
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3185
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3186
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3187
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3188
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3189
+ *     C_COMMON_OVERRIDE_OTPTIONS
3190
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3191
+ *     TARGET_OPTION_INIT_STRUCT
3192
+ *     TARGET_OPTION_DEFAULT_PARAMS
3193
+ */
3194
+
3195
+/* SWITCHABLE_TARGET
3196
+ *
3197
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3198
+ * here.
3199
+ */
3200
+
3201
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3202
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3203
+ * otherwise.  This is intended to relate to the float and double types, but not
3204
+ * necessarily "long double".  By default, returns true if the adddf3
3205
+ * instruction pattern is available and false otherwise, on the assumption that
3206
+ * hardware floating point supports exceptions and rounding modes but software
3207
+ * floating point does not.
3208
+ *
3209
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3210
+ * support all of these bells and whistles when full functionality is even
3211
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3212
+ * set this to zero, so let's come back to this.
3213
+ */
3214
+// #warning "Wrong answer encoded to date"
3215 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3216 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3217
+
3218
+/* 17.04 Defining data structures for per-function information */
3219
+
3220
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3221
+ * information.  This macro is called once per function, before generation of
3222
+ * any RTL has begun.  The intention is to allow the initialization of the
3223
+ * function pointer init_machine_status.
3224
+ */
3225
+// #warning "I may need to define this to handle function return addresses ..."
3226
+
3227
+/* 17.05 Storage Layout */
3228
+
3229
+/* Storage Layout */
3230
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3231
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3232
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3233
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3234
+#define        BITS_PER_WORD           32
3235
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3236
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3237
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3238
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3239
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3240
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3241
+ * default is BITS_PER_WORD.
3242
+ *
3243
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3244
+ */
3245
+#define        POINTER_SIZE            32      // Ptr width in bits
3246
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3247
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3248
+ * than zero if pointers should be zero-extended, zero if they should be sign
3249
+ * extended, and negative if some other conversion is needed.  In the last case,
3250
+ * the extension is done by the target's ptr_extend instruction.
3251
+ *
3252
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3253
+ * the same width.
3254
+ *
3255
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3256
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3257
+ * two.  Hence, we specify how we would do that here.
3258
+ */
3259 127 dgisselq
+#define        POINTERS_EXTEND_UNSIGNED        1
3260 102 dgisselq
+
3261
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3262
+ * object whose type is type and which has he specified mode and signedness is
3263
+ * to be stored in a register.  This macro is only called when type is a scalar
3264
+ * type.
3265
+ *
3266
+ * On most RISC machines, which only have operations that operate on a full
3267
+ * register, define this macro to set m to word_mode if m is an integer mode
3268
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3269
+ * widened because wider precision floating-point operations are usually more
3270
+ * expensive than their narrower counterparts.
3271
+ *
3272
+ * For most machines, the macro definition does not change unsigndep.  However,
3273
+ * some machines, have instructions that preferentially handle either signed or
3274
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3275
+ * loads from memory and 32-bit add instructions sign-extend the result to
3276
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3277
+ * is more efficient.
3278
+ *
3279
+ * Do not define this macro if it would never modify m.
3280
+ *
3281
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3282
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3283
+ */
3284
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3285
+
3286
+// TARGET_PROMOTE_FUNCTION_MODE
3287
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3288
+ * stack, in bits.  All stack parameters receive at least this much alignment
3289
+ * regardless of data type.  On most machines, this is the same as the size of
3290
+ * an integer.
3291
+ */
3292
+#define        PARM_BOUNDARY   32
3293
+
3294
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3295
+ * hardware for the stack pointer on this machine.  The definition is a C
3296
+ * expression for the desired alignment (measured in bits).  This value is used
3297
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3298
+ * this should be the same as PARM_BOUNDARY.
3299
+ */
3300
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3301
+
3302
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3303 127 dgisselq
+#define        PREFERRED_STACK_BOUNDARY        STACK_BOUNDARY
3304 102 dgisselq
+
3305 127 dgisselq
+/* INCOMING_STACK_BOUNDARY ... Define this macro if the incoming stack boundary
3306
+ * may be different from PREFERRED_STACK_BOUNDARY.  This macro must evaluate
3307
+ * to a value equal to or larger than STACK_BOUNDARY.
3308 102 dgisselq
+ */
3309 127 dgisselq
+#define        INCOMING_STACK_BOUNDARY STACK_BOUNDARY
3310 102 dgisselq
+
3311
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3312
+ */
3313
+#define        FUNCTION_BOUNDARY       32
3314
+
3315
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3316
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3317
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3318
+ */
3319
+#define BIGGEST_ALIGNMENT      32
3320
+
3321 127 dgisselq
+/* MALLOC_ABI_ALIGNMENT
3322
+ */
3323
+
3324
+/* ATTRIBUTE_ALIGNED_VALUE
3325
+ */
3326
+
3327 102 dgisselq
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3328
+ * given to an object that can be referenced in one operation, without
3329
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3330
+ * larger on machines that don't have byte or halfword store operations.
3331
+ */
3332
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3333
+
3334 127 dgisselq
+/* BIGGEST_FIELD_ALIGNMENT ... Biggest alignment that any structure or union
3335
+ * field can require on this machine, in bits.  If defined, this overrides
3336
+ * BIGGEST_ALIGNMENT for structure and union fields only, unless the field
3337
+ * alignment has been set by the __attribute__((aligned(n))) construct.
3338
+ */
3339
+#define        BIGGEST_FIELD_ALIGNMENT BITS_PER_UNIT
3340
+
3341
+/* ADJUST_FIELD_ALIGN
3342
+ */
3343
+#define        ADJUST_FIELD_ALIGN(A,B) BITS_PER_WORD
3344
+
3345
+/* MAX_STACK_ALIGNMENT
3346
+ */
3347
+#define        MAX_STACK_ALIGNMENT     BITS_PER_WORD
3348
+
3349
+/* MAX_OFILE_ALIGNMENT
3350
+ */
3351
+
3352
+/* DATA_ALIGNMENT(TYPE, BASIC-ALIGN) ... If defined, a C expression to compute
3353
+ * the alignment for a variable in the static store.  TYPE is the data type, and
3354
+ * BASIC-ALIGN is the alignment that the object would ordinarily have.  The
3355
+ * value of this macro is used instead of that alignment to align the object.
3356
+ *
3357
+ * If this macro is not defined, then BASIC-ALIGN is used.
3358
+ *
3359
+ * ZipCPU -- in hindsight, if this macro is not defined then the compiler is
3360
+ * broken.  So we define it to be our fastest alignment, or 32-bits.
3361
+ */
3362
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     BITS_PER_WORD
3363
+
3364
+
3365
+/* DATA_ABI_ALIGNMENT(TYPE,BASIC-ALIGN)
3366
+ */
3367
+
3368
+/* CONSTANT_ALIGNMENT(CONST, BASIC-ALIGN) ... If defined, a C expression to
3369
+ * compute the alignment given to a constant that is being placed in memory.
3370
+ * CONST is the constant and BASIC-ALIGN is the alignment that the object
3371
+ * would ordinarily have.  The value of this macro is used instead of that
3372
+ * alignment to align the object.
3373
+ *
3374
+ * If this macro is not defined, then BASIC-ALIGN is used.
3375
+ *
3376
+ * ZipCPU -- in hindsiht, if this macro is not defined then the compiler is
3377
+ * broken.  We'll define it as above.
3378
+ *
3379
+ */
3380
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  BITS_PER_WORD
3381
+
3382
+/* LOCAL_ALIGNMENT(TYPE,BASIC-ALIGN) ... If defined ...
3383
+ */
3384
+#define        LOCAL_ALIGNMENT(TYP,ALIGN)      BITS_PER_WORD
3385
+
3386
+/* TARGET_VECTOR_ALIGNMENT
3387
+ */
3388
+
3389
+/* STACK_SLOT_ALIGNMENT
3390
+ */
3391
+#define        STACK_SLOT_ALIGNMENT(T,M,B)     BITS_PER_WORD
3392
+
3393
+/* LOCAL_DECL_ALIGNMEN(DECL)
3394
+ */
3395
+#define        LOCAL_DECL_ALIGNMENT(DECL)      BITS_PER_WORD
3396
+
3397
+/* MINIMUM_ALIGNMENT
3398
+ */
3399
+#define        MINIMUM_ALIGNMENT(EXP,MOD,ALIGN)        BITS_PER_WORD
3400
+
3401
+/* EMPTY_FIELD_BOUNDARY
3402
+ * Alignment of field after 'int : 0' in a structure.
3403
+ */
3404
+#define        EMPTY_FIELD_BOUNDARY    BITS_PER_WORD
3405
+
3406
+/* STRUCTURE_SIE_BOUNDARY
3407
+ * ZipCPU -- Every structures size must be a multiple of 32-bits.
3408
+ */
3409
+#define        STRUCTURE_SIZE_BOUNDARY BITS_PER_WORD
3410
+
3411 102 dgisselq
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3412
+ * fail to work when given unaligned data.  If instructions will merely go
3413
+ * slower in that case, define this macro as 0.
3414 125 dgisselq
+ *
3415
+ * ZipCPU -- Since we have defined our smallest addressable unit to be a 32-bit
3416
+ * word (one byte, on our machine), and since reading any amount of 32-bit words
3417
+ * is easy, then there really are no instructions that will ever fail.
3418 102 dgisselq
+ */
3419 125 dgisselq
+#define        STRICT_ALIGNMENT        0
3420 102 dgisselq
+
3421 127 dgisselq
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3422
+ * other C compilers handle alignment of bit-fields and the structures that
3423
+ * contain them.
3424
+ *
3425
+ * The behavior is that the type written for a named bit-field (int, short, or
3426
+ * other integer type) imposes an alignment for the entire structure, as if the
3427
+ * structure really did contain an ordinary field of that type.  In addition,
3428
+ * the bit-field is placed within the structure so that it would fit within
3429
+ * such a field, not crossing a boundary for it.
3430
+ *
3431
+ * Thus, no most machines, a named bit-field whose type is written as int would
3432
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3433
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3434
+ * by other alignment parameters.)
3435
+ *
3436
+ * An unnamed bit-field will not affect the alignment of the containing
3437
+ * structure.
3438
+ *
3439
+ * If the macro is defined, its definition should be a C expression, a non
3440
+ * zero value for the expression enables this behavior.
3441
+ * Look at the fundamental type that is used for a bit-field and use that to
3442
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3443
+ * have the same alignment as 'int', not 'char'.
3444
+ */
3445
+#undef PCC_BITFIELD_TYPE_MATTERS
3446
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3447
+
3448 102 dgisselq
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3449
+ * largest integer machine mode that should actually be used.  All integer
3450
+ * machine modes of this size or smaller can be used for structures and unions
3451
+ * with the appropriate sizes.  If this macro is undefined,
3452
+ * GET_MODE_BITSIZE(DImode) is assumed.
3453
+ *
3454
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3455
+ * size on bits of the largest integer machine mode.  However, that's the case
3456
+ * with most DI implementations: A long is two words, spliced together.  We'd
3457
+ * like to support that eventually, but we need to get there.  Hence, let's use
3458
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3459
+ */
3460
+#if (ZIP_HAS_DI != 0)
3461
+#define        MAX_FIXED_MODE_SIZE     64
3462
+#else
3463
+#define        MAX_FIXED_MODE_SIZE     32
3464
+#endif
3465
+
3466
+
3467
+/* 17.06 Layout of Source Language Data Types */
3468
+
3469
+#undef CHAR_TYPE_SIZE
3470
+#undef SHORT_TYPE_SIZE
3471
+#undef INT_TYPE_SIZE
3472
+#undef LONG_TYPE_SIZE
3473
+#undef LONG_LONG_TYPE_SIZE
3474
+//
3475
+#define        CHAR_TYPE_SIZE  32
3476
+#define        SHORT_TYPE_SIZE 32
3477
+#define        INT_TYPE_SIZE   32
3478
+#define        LONG_TYPE_SIZE  32
3479
+#define        LONG_LONG_TYPE_SIZE     64
3480
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3481
+#undef FLOAT_TYPE_SIZE
3482
+#undef DOUBLE_TYPE_SIZE
3483
+#undef LONG_DOUBLE_TYPE_SIZE
3484
+#define        FLOAT_TYPE_SIZE         32
3485
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3486
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3487
+// SHORT_FRAC_TYPE_SIZE
3488
+// LONG_FFRACT_TYPE_SIZE
3489
+// LONG_LONG_FRACT_TIME_SIZE
3490
+#undef SHORT_ACCUM_TYPE_SIZE
3491
+#undef ACCUM_TYPE_SIZE
3492
+#undef LONG_ACCUM_TYPE_SIZE
3493
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3494
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3495
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3496
+
3497
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3498
+ * hook and should be defined if that hook is overriden to be true.  It causes
3499
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3500
+ * rather than the default __.  A port which uses this macro should also arrange
3501
+ * to use t-gnu-prefix in the libgcc config.host.
3502
+ *
3503
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3504
+ */
3505
+
3506
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3507
+ * in float.h,, assuming, if applicable, that the floating-point control word
3508
+ * is in its default state.  If you do not define this macro the value of
3509
+ * FLT_EVAL_METHOD will be zero.
3510
+ *
3511
+ * ZipCPU --- ???
3512
+ */
3513
+
3514
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3515
+ * floating-point format supported by the hardware.  If you define this macro,
3516
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3517
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3518
+ * default.
3519
+ *
3520
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3521
+ * really needs to be determined, then, based upon a compile time parameter
3522
+ * where the one compiling the code states whether or not the H/W even has
3523
+ * floating point support.
3524
+ *
3525
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3526
+ * need to change this.
3527
+ */
3528
+#undef WIDEST_HARDWARE_FP_SIZE
3529
+// #warning "Definition needs to change if no FPU present"
3530
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3531
+
3532
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3533
+ * whether the type char should be signed or unsigned by default.  The user
3534
+ * can always override this default with the options -fsigned-char and
3535
+ * -funsigned-char.
3536
+ *
3537
+ * ZipCPU--let's go with the default behavior.
3538
+ */
3539
+#define        DEFAULT_SIGNED_CHAR     1
3540
+
3541
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3542 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3543 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3544
+ * false if all enum types should be allocated like int.
3545
+ *
3546
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3547
+ * override it.
3548
+ */
3549
+
3550
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3551
+ * type to use for size values.  The typedef name size_t is defined using the
3552
+ * contents of the string.
3553
+ *
3554
+ * If you don't define this macro, the default is "long unsigned int".  Since
3555
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3556
+ * the default seems perfect for us.
3557
+ */
3558
+#define        SIZE_TYPE       "unsigned int"
3559
+
3560
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3561
+ * This macro is a C expression for a string describing the name of the data
3562
+ * type from which the precision of sizetype is extracted.  The string has the
3563
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3564
+ * default is SIZE_TYPE --- which seems good enough for us.
3565
+ */
3566
+
3567
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3568 127 dgisselq
+ * type to use for the result of subtracting two pointers.  The typedef name
3569 102 dgisselq
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3570
+ * more information.
3571
+ *
3572
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3573
+ * for us.
3574
+ */
3575
+#define        PTRDIFF_TYPE    "int"
3576
+
3577
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3578
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3579
+ * the contents of  the string.  If you don't define this macro, the default is
3580
+ * 'int'--good enough for ZipCPU.
3581
+ */
3582
+
3583
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3584
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3585
+ */
3586
+#undef WCHAR_TYPE_SIZE
3587
+#define        WCHAR_TYPE_SIZE 32
3588
+
3589
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3590
+ * type to use for wide characters passed to printf and returned from getwc.
3591
+ * The typedef name wint_t is defined using the contents of the string.  See
3592
+ *
3593 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3594
+ * best for us again.
3595 102 dgisselq
+ */
3596
+
3597
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3598
+ * data type that can represent any value of any standard or extended signed
3599
+ * integer type.  The typedef name intmax_t is defined using the contents of
3600
+ * the string.
3601
+ *
3602
+ * If you don't define this macro, the default is the first of "int", "long int"
3603
+ * or "long long int" that has as much precision as "long long int".
3604
+ */
3605
+
3606
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3607
+ */
3608
+
3609
+#undef SIG_ATOMIC_TYPE
3610
+#if (ZIP_ATOMIC != 0)
3611
+#define        SIG_ATOMIC_TYPE "int"
3612
+#else
3613
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3614
+#endif
3615
+#undef INT8_TYPE
3616
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3617
+#undef INT16_TYPE
3618
+#define        INT16_TYPE              NULL
3619
+#undef INT32_TYPE
3620
+#define        INT32_TYPE              "int"
3621
+#undef UINT8_TYPE
3622
+#define        UINT8_TYPE              NULL
3623
+#undef UINT16_TYPE
3624
+#define        UINT16_TYPE             NULL
3625
+#undef UINT32_TYPE
3626
+#define        UINT32_TYPE             "unsigned int"
3627
+#undef INT_LEAST8_TYPE
3628
+#define        INT_LEAST8_TYPE         "int"
3629
+#undef INT_LEAST16_TYPE
3630
+#define        INT_LEAST16_TYPE        "int"
3631
+#undef INT_LEAST32_TYPE
3632
+#define        INT_LEAST32_TYPE        "int"
3633
+#undef UINT_LEAST8_TYPE
3634
+#define        UINT_LEAST8_TYPE        "unsigned int"
3635
+#undef UINT_LEAST16_TYPE
3636
+#define        UINT_LEAST16_TYPE       "unsigned int"
3637
+#undef UINT_LEAST32_TYPE
3638
+#define        UINT_LEAST32_TYPE       "unsigned int"
3639
+#undef INT_FAST8_TYPE
3640
+#define        INT_FAST8_TYPE          "int"
3641
+#undef INT_FAST16_TYPE
3642
+#define        INT_FAST16_TYPE         "int"
3643
+#undef INT_FAST32_TYPE
3644
+#define        INT_FAST32_TYPE         "int"
3645
+#undef UINT_FAST8_TYPE
3646
+#define        UINT_FAST8_TYPE         "unsigned int"
3647
+#undef UINT_FAST16_TYPE
3648
+#define        UINT_FAST16_TYPE        "unsigned int"
3649
+#undef UINT_FAST32_TYPE
3650
+#define        UINT_FAST32_TYPE        "unsigned int"
3651
+#undef INTPTR_TYPE
3652
+#define        INTPTR_TYPE             "unsigned int"
3653
+#undef UINTPTR_TYPE
3654
+#define        UINTPTR_TYPE            "unsigned int"
3655
+
3656
+#undef INT64_TYPE
3657
+#undef UINT64_TYPE
3658
+#undef INT_LEAST64_TYPE
3659
+#undef UINT_LEAST64_TYPE
3660
+#undef INT_FAST64_TYPE
3661
+#undef UINT_FAST64_TYPE
3662
+
3663
+#if (ZIP_HAS_DI != 0)
3664
+#define        INT64_TYPE              "long int"
3665
+#define        UINT64_TYPE             "long unsigned int"
3666
+#define        INT_LEAST64_TYPE        "long int"
3667
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3668
+#define        INT_FAST64_TYPE         "long int"
3669
+#define        UINT_FAST64_TYPE        "long unsigned int"
3670
+#else
3671
+#define        INT64_TYPE              NULL
3672
+#define        UINT64_TYPE             NULL
3673
+#define        INT_LEAST64_TYPE        NULL
3674
+#define        UINT_LEAST64_TYPE       NULL
3675
+#define        INT_FAST64_TYPE         NULL
3676
+#define        UINT_FAST64_TYPE        NULL
3677
+#endif
3678
+
3679
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3680
+
3681
+
3682
+/* 17.07 Register Usage / Register definitions */
3683
+
3684
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3685
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3686
+ * pseudo register's numbrer really is assigned the number
3687
+ * FIRST_PSEUDO_REGISTER.
3688
+ *
3689
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3690
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3691
+ * compiler can take register number 16 and above and do whatever it wants
3692
+ * with it.
3693
+ */
3694
+#ifdef DEFINE_USER_REGS
3695 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3696 102 dgisselq
+#else
3697 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3698
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3699
+#  else
3700
+#    define    FIRST_PSEUDO_REGISTER   16
3701
+#  endif
3702 102 dgisselq
+#endif
3703
+
3704
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3705
+ * fixed purposes all throughout the compiled code and are therefore not
3706
+ * available for general allocation.  These would include the stack pointer, the
3707
+ * frame pointer (except on machines where that can be used as a general
3708
+ * register when no frame pointer is needed), the program counter on machines
3709
+ * where that is considered one of the addressable registers, and any other
3710
+ * numbered register with a standard use.
3711
+ *
3712
+ * This information is expressed as a sequence of numbers, separated by commas,
3713
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3714
+ * otherwise.
3715
+ *
3716
+ * For the Zip CPU, we have three fixed registers that are not available for
3717
+ * general allocation:
3718
+ *
3719
+ *     SP      The stack pointer
3720
+ *     CC      The condition codes and CPU state register
3721
+ *     PC      The program counter
3722
+ *
3723
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3724
+ * table pointer) are registers that we hope will not be so fixed.
3725
+ */
3726 127 dgisselq
+#ifdef DEFINE_USER_REGS
3727
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
3728 103 dgisselq
+#else
3729 127 dgisselq
+#  ifdef       zip_FP_PSEUDO
3730
+#    define    FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3731
+#  else
3732
+#    define    FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3733
+#  endif
3734 103 dgisselq
+#endif
3735 102 dgisselq
+
3736
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3737
+ * that is clobbered (in general) by function calls as well as for fixed
3738
+ * registers.  This macro therefore identifies the registers that are not
3739
+ * available for general allocation of values that must live across function
3740
+ * calls.
3741
+ *
3742
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3743
+ * it on function entry and restores it on function exit, if the register is
3744
+ * used within the function.
3745
+ *
3746
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3747
+ * register above R5.
3748
+ */
3749 127 dgisselq
+#ifdef DEFINE_USER_REGS
3750
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
3751 103 dgisselq
+#else
3752 127 dgisselq
+#  ifdef       zip_FP_PSEUDO
3753
+#    define    CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3754
+#  else
3755
+#    define    CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3756
+#  endif
3757 103 dgisselq
+#endif
3758 102 dgisselq
+
3759
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3760
+ * to the value of CALL_USED_REGISTERS.
3761
+ */
3762
+
3763
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3764
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3765
+ * across a call without some part of it being clobbbered.  For most machines,
3766
+ * this macro need not be defined.  It is only required for machines that do
3767 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3768 102 dgisselq
+ *
3769 127 dgisselq
+ * ZipCPU--Always preserves the entire contents of those registers that are
3770
+ * preserved across calls, so this shouldnt need to be defined.
3771 102 dgisselq
+ */
3772 127 dgisselq
+// #define     HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3773 102 dgisselq
+
3774
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3775
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3776
+ * reg_class_contents, to take into account any dependence of these register
3777
+ * sets on target flags.  The first three of these are of type char[]
3778
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3779
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3780
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3781
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3782
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3783
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3784
+ * applied.
3785
+ *
3786
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3787
+ * GBL register allocation go.  But for now, we'll leave this at its default
3788
+ * value.
3789
+ */
3790
+// #warning "Revisit me after FP and GBL allocation"
3791
+
3792
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3793
+ * windows. ...
3794
+ *
3795
+ * Zip CPU has no register windows.
3796
+ */
3797
+
3798
+/* OUTGOING_REGNO ... same thing.
3799
+ */
3800
+
3801
+/* LOCAL_REGNO ... same thing.
3802
+ */
3803
+
3804
+/* PC_REGNUM ... If the program counter has a register number, define this as
3805
+ * that register number.  Otherwise do not define it.
3806
+ */
3807
+#define        PC_REGNUM       zip_PC
3808
+
3809
+
3810
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3811
+ * containing the number of hard registers in the order in which GCC should
3812
+ * prefer to use them (from most preferred to least.
3813
+ *
3814 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3815 102 dgisselq
+ * else being equal).
3816
+ *
3817
+ * Since the default is the ZipCPU desired case, we won't define this here.
3818
+ */
3819
+
3820
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3821
+ * this macro, so we won't either.
3822
+ */
3823
+
3824
+/* HONOR_REG_ALLOC_ORDER ...
3825
+ */
3826
+
3827
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3828
+ * this macro, so we won't either.
3829
+ */
3830
+
3831
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3832
+ * consecutive hard registers, starting at register number REGNO, required to
3833
+ * hold a value of mode MODE.
3834
+ *
3835
+ * On a machine where all registers are exactly one word, a suitable definition
3836
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3837
+ *
3838
+ * On ZipCPU, we might do
3839
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3840
+ * but I think the default (above) code should work as well.  Hence, let's stick
3841
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3842
+ * XImode) and expect us to follow them properly some how.
3843
+ *
3844
+ * Okay, now in hind sight, we know that the default doesn't work for our
3845
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3846
+ * this expression to work in bits rather than in bytes and we'll know more
3847
+ * of what we are doing.
3848
+ */
3849
+#undef HARD_REGNO_NREGS
3850
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3851
+               / (UNITS_PER_WORD))
3852
+
3853
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3854
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3855
+ * to take up more space than in registers starting at register number REGNO
3856
+ * (as determined by multiplying GCC's notion of the size of the register when
3857
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3858
+ * By default this is zero.
3859
+ *
3860
+ * Zip CPU --- The default looks good enough to me.
3861
+ */
3862
+
3863
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3864
+ *
3865
+ * ZipCPU ---
3866
+ */
3867
+
3868
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3869
+ * registers that hold values of mode mode is not the word size.  It is a C
3870
+ * expression that should give the natural size in bytes for the specified mode.
3871
+ * It is used by the register allocator to try to optimize its results.
3872
+ *
3873
+ * ZipCPU ---
3874
+ */
3875
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3876
+
3877
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3878 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3879 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3880
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3881
+ * for the numbers of fixed registers, because the allocation mechanism
3882
+ * considered them to be always occupied.
3883
+ *
3884
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3885
+ * suitable default definition mentioned above should be sufficient.
3886
+ */
3887
+#undef HARD_REGNO_MODE_OK
3888 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3889 102 dgisselq
+
3890
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3891
+ * okay to rename a hard register FROM to another hard register TO.  One common
3892
+ * use of this macro is to prevernt renaming of a register to another register
3893
+ * that is not saved by a prologue in an interrupt handler.  The default is
3894
+ * always nonzero.
3895
+ *
3896
+ * ZipCPU --- The default looks good enough to us.
3897
+ */
3898
+#undef HARD_REGNO_RENAME_OK
3899
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3900
+
3901
+
3902
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
3903
+ * M1 is accessible in mode M2 without copying.
3904
+ *
3905
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
3906
+ * so lets' set to one.
3907
+ */
3908
+#define        MODES_TIEABLE_P(M1,M2)  1
3909
+
3910
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
3911
+ * This target hook should return true if it is OK to use a hard register
3912
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
3913
+ * to prevent using of a register that is not saved by a prologue in an
3914
+ * interrupt handler.  The default version of this hook always returns true.
3915
+ *
3916
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
3917
+ * context, you have an entirely new set of registers (the supervisor set), so
3918
+ * this is a non-issue.
3919
+ */
3920
+
3921
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
3922
+ * copies to/from CCmode register(s).  You should only define this macro if
3923
+ * support for copying to/from CCmode is incomplete.
3924
+ *
3925
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
3926
+ * default definition.
3927
+ */
3928
+
3929
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
3930
+ *
3931
+ * Zip CPU has no stack-like registers, as their definition is different from
3932
+ * the ZipCPU stack pointer register.
3933
+ */
3934
+
3935 127 dgisselq
+// #define     ZIP_REG_BYTE_SIZE       1
3936 102 dgisselq
+
3937
+/* 17.08 Register Classes */
3938
+
3939
+/* enum reg_class ... An enumerate type that must be defined with all the
3940
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
3941
+ * must be the last register class, followed by one more enumerated value,
3942
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
3943
+ * classes there are.
3944
+ *
3945
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
3946
+ * all_regs, and go from there.
3947
+ */
3948
+enum   reg_class {
3949
+       NO_REGS, GENERAL_REGS,
3950
+#ifdef DEFINE_USER_REGS
3951
+       USER_REGS,
3952
+#endif
3953
+       ALL_REGS, LIM_REG_CLASSES
3954
+};
3955
+
3956
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
3957
+ */
3958
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
3959
+
3960
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
3961
+ * classes as C string constants.  These names are used in writing some of the
3962
+ * debugging dumps.
3963
+ */
3964 127 dgisselq
+#ifdef DEFINE_USER_REGS
3965
+#  define      REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
3966
+#else
3967
+#  define      REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
3968
+#endif
3969 102 dgisselq
+
3970
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
3971 127 dgisselq
+ * classes, as integers which are bit masks.  The nth integer specifies the
3972 102 dgisselq
+ * contents of class n.  That way the integer mask is interpreted as that
3973
+ * register r is in the class if (mask&(1<<r)) is 1.
3974
+ *
3975
+ * When the machine has more than 32 registers ... that's not us.
3976
+ *
3977
+ * ZipCPU --- This is straight forward, three register classes, etc.
3978
+ */
3979 127 dgisselq
+#ifdef DEFINE_USER_REGS
3980
+#    define    REG_CLASS_CONTENTS { { 0x000000000}, {0x00003fff}, {0x0ffff0000l}, {0x0ffffffffl} }
3981 103 dgisselq
+#else
3982 127 dgisselq
+#  ifdef       zip_FP_PSEUDO
3983
+#    define    REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
3984
+#  else
3985
+#    define    REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
3986
+#  endif
3987 103 dgisselq
+#endif
3988 102 dgisselq
+
3989
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
3990
+ * containing hard register REGNO.  In general there is more than one such
3991
+ * class;  Choose a class which is minimal, meaning that no smaller class also
3992
+ * contains the register.
3993
+ */
3994
+#undef REGNO_REG_CLASS
3995 103 dgisselq
+#ifdef zip_FP_PSEUDO
3996
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
3997
+#else
3998 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
3999 103 dgisselq
+#endif
4000 102 dgisselq
+
4001
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
4002
+ * a valid base register must belong.  A base register is one used in an address
4003
+ * which is the register value plus a displacement.
4004
+ */
4005
+#undef BASE_REG_CLASS
4006
+#define        BASE_REG_CLASS  GENERAL_REGS
4007
+
4008
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
4009
+ * which allows the selection of a bse register in a mode dependent manner.  If
4010
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
4011
+ */
4012
+#undef MODE_BASE_CLASS
4013
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
4014
+
4015
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
4016
+ * class to which a valid base register must belong in order to be used in a
4017
+ * base plus index register address.  You should define this macro if base plus
4018
+ * index addresses have different requirements than other base register uses.
4019
+ *
4020
+ * Zip CPU does not support the base plus index addressing mode, thus ...
4021
+ */
4022 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
4023
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
4024 102 dgisselq
+
4025
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
4026
+ * which a valid index register must belong.  An index register is one used in
4027
+ * an address where its value is either multiplied by a scale factor or added
4028
+ * to another register (as well as added to a displacement).
4029
+ *
4030
+ * ZipCPU -- Has no index registers.
4031
+ */
4032
+#undef INDEX_REG_CLASS
4033
+#define        INDEX_REG_CLASS NO_REGS
4034
+
4035
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
4036
+ * number num is suitable for use as a base register in operand addresses.
4037
+ */
4038
+#undef REGNO_OK_FOR_BASE_P
4039 127 dgisselq
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM>=FIRST_PSEUDO_REGISTER)||(NUM != zip_CC))
4040 102 dgisselq
+
4041
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
4042
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
4043 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
4044 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
4045
+ *
4046
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
4047
+ */
4048
+
4049
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
4050
+ * addresses, accessing memory in mode mode.
4051
+ *
4052
+ * Use of this macro is deprecated.
4053
+ */
4054
+
4055 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
4056 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
4057
+ * operand addresses, accessing memory in mode M in address space AS.  This is
4058
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
4059
+ * the context in which the register appears in the memory reference.
4060
+ *
4061
+ * ZipCPU---We aren't specific in how we use our registers.
4062
+ */
4063
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
4064
+
4065
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
4066
+ * num is suitable for use as an index register in opernad addressess.  It may
4067
+ * be either a suitable hard register or a pseudo register that has been
4068 111 dgisselq
+ * allocated such as a hard register.
4069 102 dgisselq
+ *
4070
+ * ZipCPU has no index registers, therefore we declare this to be zero.
4071
+ */
4072
+#undef REGNO_OK_FOR_INDEX_P
4073
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
4074
+
4075
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
4076
+ * additional preference on the register class to use when it is necessary to
4077
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
4078
+ * preferred register class is found or hook preferred_rename_class is not
4079
+ * implemented.  SOmething returning a more restrictive class makes better code.
4080
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
4081
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
4082
+ * preferred_rename_class, code size can be reduced.
4083
+ */
4084
+// #undef TARGET_PREFERRED_RENAME_CLASS
4085
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
4086
+
4087
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
4088
+ * restri tions on the register class to use when it is necessary to copy value
4089
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
4090
+ * perhaps a smaller class.
4091
+ *
4092
+ * The default fversion of this hook always returns value of RC argument, which
4093
+ * sounds quite appropriate for the ZipCPU.
4094
+ */
4095
+
4096
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
4097
+ * restrictions on the register class to use when it is necessary to copy
4098
+ * value X into a register in class CLASS.  On many machines, the following
4099
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
4100
+ * Sometimes returning a more restrictive class makes better code.  For example,
4101
+ * on the 68k, when x is an integer constant that is in range for a moveq
4102
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
4103 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
4104 102 dgisselq
+ * 'moveq' will be used.
4105
+ *
4106
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
4107
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
4108
+ * Hence, we only allow loads into the GENERAL_REG class.
4109
+ */
4110
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
4111
+
4112
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
4113
+ * RELOAD_CLASS, but for output instead of input reloads.
4114
+ *
4115
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
4116
+ */
4117
+
4118
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
4119
+ *
4120
+ * Don't define this macro unless the target machine has limitations which
4121
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
4122
+ */
4123
+
4124
+/* TARGET_SECONDARY_RELOAD
4125
+ * SECONDARY_ ...
4126
+ * Don't think we need these ...
4127
+ */
4128
+
4129
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
4130
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
4131
+ *
4132
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
4133
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
4134
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
4135
+ *
4136
+ * This macro helps control the handling of multiple word values in the reload
4137
+ * pass.
4138
+ *
4139
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
4140
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
4141
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
4142
+ */
4143
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
4144
+
4145
+/* CANNOT_CHANGE_MODE_CLASS
4146
+ * ???
4147
+ */
4148
+
4149
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
4150
+ */
4151
+
4152
+/* TARRGET_LRA_P
4153
+ * Default looks good.
4154
+ */
4155
+
4156
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
4157 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
4158 102 dgisselq
+ * number
4159
+ *
4160
+ * The default version of this target hook returns always zero---good enough for
4161
+ * the ZipCPU.
4162
+ */
4163
+
4164
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4165
+ * if we need register usage leveling.  That means if a few hard registers are
4166
+ * equally good for the assignment, we choose the least used hard register.  The
4167
+ * register usage leveling may be profitable for some targets.  Don't use usage
4168
+ * leveling for targets with conditional execution or targets with big register
4169
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4170
+ * version of this target hook returns always false.
4171
+ *
4172
+ * ZipCPU --- Default is the right answer.
4173
+ */
4174
+
4175
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4176
+ * Default looks good.
4177
+ */
4178
+
4179
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4180
+ * Default looks good.
4181
+ */
4182
+
4183
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4184
+ */
4185
+
4186
+/* TARGET_SPILL_CLASS
4187
+ *
4188
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4189
+ * user set of registers.  However, we're not building for that mode (now),
4190
+ * so we'll leave this at the default of NO_REGS.
4191
+ */
4192
+
4193
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4194
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4195
+ * instruction code for the cstore being performed.  Not defining this hook is
4196
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4197
+ * patterns.
4198
+ *
4199
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4200
+ * default therefore.
4201
+ */
4202
+
4203
+/* 17.09 Stack Layout and Calling Conventions */
4204
+
4205
+
4206
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4207
+ * moves the stack pointer to a smaller address, and false otherwise.
4208
+ *
4209
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4210
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4211
+ * is our convention, we'll define it as such.
4212
+ */
4213
+#undef STACK_GROWS_DOWNWARD
4214
+#define        STACK_GROWS_DOWNWARD    1
4215
+
4216
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4217
+ * pushed on the stack.  In RTL, a push operation will be
4218
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4219
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4220
+ * direction and on whether the stack pointer points to the last item on the
4221
+ * stack or whether it points to the space for the next item on the stack.
4222
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4223
+ * always right, and PRE_INC otherwise, which is often wrong.
4224
+ *
4225
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4226
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4227
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4228
+ */
4229
+
4230
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4231
+ * local variable slots are at negative offsets from the frame pointer.
4232
+ *
4233
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4234 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4235 102 dgisselq
+ * this should be the case as well.
4236
+ */
4237
+#undef FRAME_GROWS_DOWNWARD
4238
+#define        FRAME_GROWS_DOWNWARD    1
4239
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4240
+
4241
+
4242
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4243
+ * function occupy decreasing addresses on the stack.
4244
+ *
4245
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4246
+ * it is of no consequence to the hardware.
4247
+ */
4248
+
4249
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4250
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4251
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4252
+ * Otherwise it is found by adding the length of the first slot to the value
4253
+ * START_FRAME_OFFSET.
4254
+ *
4255
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4256
+ * the code is getting generated.  However, the ECO32 code I am copying from
4257
+ * suggests that 0 is the right value, so we'll use that here.
4258
+ */
4259
+// #warning "Re-evaluate me"
4260
+#define        STARTING_FRAME_OFFSET   0
4261
+
4262
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4263
+ * stack during reload.  The nonzero default for this macro is suitable for most
4264
+ * ports.
4265
+ *
4266
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4267
+ * shows up on the stack we may need to adjust it.
4268
+ */
4269
+
4270
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4271
+ * which outgoing arguments are placed.  If not specified, the default value
4272
+ * of zero is used.  This is the proper value for most machines.
4273
+ */
4274
+#define        STACK_POINTER_OFFSET    0
4275
+
4276
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4277
+ * argument's address.  On some machines it may depend on the data type of the
4278
+ * function.
4279
+ */
4280
+#define        FIRST_PARM_OFFSET(F)    0
4281
+
4282
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4283
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4284
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4285
+ * The default is correct for most machines, ...
4286
+ *
4287
+ * ZipCPU --- so we'll use it for the ZipCPU.
4288
+ */
4289
+
4290
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4291
+ * the address of the initial stack frame.  This address is passed to
4292
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4293
+ * a reasonable default value will be used.  Define this macro in order to make
4294
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4295
+ * and __builtin_return_address(C) for (C) not equal to zero.
4296
+ *
4297
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4298
+ */
4299
+
4300
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4301
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4302
+ * example, on the SPARC, we must flush all of the register windows to the stack
4303
+ * before we can access arbitrary stack frames.  You will seldom need to define
4304
+ * this macro.  The default is to do nothing.
4305
+ *
4306
+ * ZipCPU --- which is what we shall do here.
4307
+ */
4308
+
4309
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4310
+ * an RTX that is used to store the address of the current frame into the
4311
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4312
+ * for most machines.  One reason you may need to define this target hook is if
4313
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4314
+ *
4315
+ * ZipCPU --- leave this undefined, since the default value should be correct
4316
+ * for "most" machines.
4317
+ */
4318
+
4319
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4320
+ */
4321
+
4322
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4323
+ * representing the value of the return address for the frame COUNT steps up
4324
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4325
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4326
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4327
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4328
+ * there is no way to determine the return address of other frames.
4329
+ *
4330
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4331
+ */
4332
+#undef RETURN_ADDR_RTX
4333
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4334
+
4335
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4336
+ * return address of a particular stack frame is accessed from the frame pointer
4337
+ * of the previous stack frame.  The zero default for this macro is suitable
4338
+ * for most ports.
4339
+ *
4340
+ * ZipCPU---Default works here as well.
4341
+ */
4342
+
4343
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4344
+ * the location of the incoming return address at the beginning of any function,
4345
+ * before the prologue.  This RTL is either a REG, indicating that the return
4346
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4347
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4348
+ * DWARF_FRAME_REGNUM(REGNO).
4349
+ *
4350
+ * ZipCPU --- While our incoming return address could theoretically be in any
4351
+ * register, our machine description file is going to place it into register
4352
+ * R0, so that's what we return here.
4353
+ */
4354
+#undef INCOMING_RETURN_ADDR_RTX
4355
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4356
+
4357
+
4358
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4359
+ */
4360
+
4361
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4362
+ * register number that is considered to always have the value zero.  This
4363
+ * should only be defined if the target has an architected zero register (ZipCPU
4364
+ * does not), and someone decided it was a good idea to use that register number
4365
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4366
+ * ZipCPU port will avoid it as well).
4367
+ *
4368
+ */
4369
+
4370
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4371
+ */
4372
+
4373
+/* INCOMING_FRAME_SP_OFFSET
4374
+ */
4375
+#define        INCOMING_FRAME_SP_OFFSET        0
4376
+
4377
+/* ARG_POINTER_CFA_OFFSET
4378
+ */
4379
+
4380
+/* FRAME_POINTER_CFA_OFFSET
4381
+ */
4382
+
4383
+/* CFA_FRAME_BASE_OFFSET
4384
+ */
4385
+
4386
+/* 17.09.02 Exception handling support */
4387
+
4388
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4389
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4390
+ * N registers are usable.  The exception handling library routines communicate
4391
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4392
+ * these registers should be call clobbered; it is possible to use call-saved
4393
+ * registers, but may negatively impact code size.  The target must support at
4394
+ * least 2 data registers, but should define 4 if their are enough free
4395
+ * registers.
4396
+ *
4397
+ * You must define this macro if you want to support call frame exception
4398
+ * handling like that provided by DWARF 2.
4399
+ */
4400
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4401
+
4402
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4403
+ * a location in which to store a stack adjustment to be applied before function
4404
+ * return.  This is used to unwind the stack to an exception handler's call
4405
+ * frame.  It will be assigned zero on code paths that return normally.
4406
+ *
4407
+ * Do not define this macro if the stack pointer is saved and restored by the
4408
+ * regular prolog and epilog code in the call frame itself (which it is for the
4409
+ * ZipCPU); in this case, the exception handling library routines will update
4410
+ * the stack location to be restored in place.  Otherwise, you must define this
4411
+ * macro if you want to support call frame exception handling like that provided
4412
+ * by DWARF 2.
4413
+ *
4414
+ */
4415
+
4416
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4417
+ * location in which to store the address of an exception handler to which we
4418
+ * should return.  It will not be assigned on code paths that return normally.
4419
+ *
4420
+ * Typcally this is the location in the call frame at which the normal return
4421
+ * address is stored.  For targets that return by popping an address of the
4422
+ * stack, this might be a memory address just below the target callf rame
4423
+ * rather than inside the current call frame.  If defined,
4424
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4425
+ * to calculate the location of the target call frame.
4426
+ *
4427
+ * If you want to support call frame exception handling, you must define either
4428
+ * this macro or the eh_return instruction pattern.
4429
+ */
4430
+// #warning "I don't know what to do here."
4431
+
4432
+/*
4433
+ *
4434
+ *
4435
+ *
4436
+ *   REST OF SECTION SKIPPED ...
4437
+ *
4438
+ *
4439
+ *
4440
+ */
4441
+
4442
+/* 17.09.03 Specifying how stack checking is done */
4443
+
4444
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4445
+ * configuration files in a machine-dependent manner.  You should define this
4446
+ * macro if stack checking is required by the ABI of your machine or if you
4447
+ * would like to do stack checking in some more efficient way than the generic
4448
+ * appraoch.  The default value of this macro is zero.
4449
+ *
4450
+ * ZipCPU --- The default makes sense for us.
4451
+ */
4452
+// #define STACK_CHECK_BUILTIN 0
4453
+
4454
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4455
+ * done by the configuration files in a machine-dependent manner.  You should
4456
+ * define this macro if you would like to do static stack checking in some more
4457
+ * efficient way than the generic approach.  The default value of this macro
4458
+ * is zero.
4459
+ *
4460
+ * ZipCPU --- The default makes sense for us.
4461
+ */
4462
+
4463
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4464
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4465
+ * interval.  You will normally define this macro so that the interval is no
4466
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4467
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4468
+ *
4469
+ * ZipCPU --- Default.
4470
+ */
4471
+
4472
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4473
+ * the stack pointer page by page when doing probes.  This can be necessary
4474
+ * on systems where the stack pointer contains the bottom address of the memory
4475
+ * area accessible to the executing thread at any point in time.  In this
4476
+ * situation, an alternate signal stack is required in order to be able to
4477
+ * recover from a stack overflow.  The default value of this macro is zero.
4478
+ *
4479
+ * ZipCPU -- Default.
4480
+ */
4481
+
4482
+/* STACK_CHECK_PROTECT
4483
+ */
4484
+/* STACK_CHECK_MAX_FRAME_SIZE
4485
+ * ... you should normally not change the default value of this macro.
4486
+ */
4487
+/* STACK_CHECK_FIXED_FRAME_SIZE
4488
+ * ... you ... will normally use the default of four words.
4489
+ */
4490
+
4491
+/* STACK_CHECK_MAX_VAR_SIZE
4492
+ * ... you will normally not need to override that default.
4493
+ */
4494
+
4495
+/* 17.09.04 Registers that Address the Stack Frame*/
4496
+
4497
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4498
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4499
+ * machines, the hardware determines which register this is.
4500
+ */
4501
+#undef STACK_POINTER_REGNUM
4502
+#define        STACK_POINTER_REGNUM    zip_SP
4503
+
4504
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4505
+ * which is used to access certain automatic variables in the stack frame.  On
4506
+ * some machines, the hardware determines which register this is.  On other
4507
+ * machines you can choose any register you wish for this purpose.
4508
+ *
4509
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4510
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4511
+ * this purpose and watch what the compiler does with it.
4512
+ */
4513 103 dgisselq
+#ifdef zip_FP_PSEUDO
4514
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4515
+#else
4516 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4517 103 dgisselq
+#endif
4518 102 dgisselq
+
4519
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4520
+ * pointer and starting offset of the automatic variables is not known until
4521
+ * after register allocation has been done (for example, because the saved
4522
+ * registers are between these two locations).  On those machines, define
4523
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4524
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4525
+ * to be the actual hard register number used for the frame pointer.
4526
+ *
4527
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4528
+ *
4529
+ * ZipCPU --- we do not define this macro.
4530
+ */
4531 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4532
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4533
+#endif
4534 102 dgisselq
+
4535
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4536
+ * is used to access the function's argument list.  On some machines, this is
4537
+ * the same as the frame pointer register.  On some machines, the hardware
4538
+ * determines which register this is.  On other machines, you can choose any
4539
+ * register you wish for this purpose.  If this is not the same register as the
4540
+ * frame pointer register, then you must mark it as a fixed register according
4541
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4542
+ *
4543
+ * ZipCPU --- We really don't want to lose another register to something
4544
+ * pointless, so let's set this to be the frame pointer register.  Especially
4545
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4546
+ * should work for a rather large stack frame.
4547
+ */
4548 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4549 102 dgisselq
+
4550
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4551
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4552
+ * should be the same.  The default definition is sufficient for us.
4553
+ */
4554
+
4555
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4556
+ * ZipCPU doesn't need this macro
4557
+ */
4558
+
4559
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4560
+ * pointer register, which is used to access the current function's return
4561
+ * address from the stack.  On some machines, the return address is not at a
4562
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4563
+ * This register can be defined to point to the return address on the stack, and
4564
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4565
+ * stack pointer.
4566
+ *
4567
+ * Do not define this macro unless there is no other way to get the return
4568
+ * address from the stack.
4569
+ *
4570
+ * ZipCPU---we need this.
4571
+ */
4572
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4573
+
4574
+
4575
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4576
+ * static chain pointer.  If register windows are used, the register number as
4577
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4578
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4579
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4580
+ * defined.
4581
+ *
4582
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4583
+ */
4584
+// #warning "I have no reason to believe this will even work"
4585
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4586
+
4587
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4588
+ * al for targets that may use different static chain locations for different
4589
+ * nested functions.  This may be required if the target has function attributes
4590
+ * that affect the calling conventions of the function and those calling
4591
+ * conventions use different static chain locations.
4592
+ *
4593
+ * ZipCPU --- don't need this.
4594
+ */
4595
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4596
+
4597
+
4598
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4599
+ * registers that can be saved in a call frame.  This is used to size data
4600
+ * structures used in DWARF2 exception handling.
4601
+ *
4602
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4603
+ * exception handling ABI in the face of adding new hard registers for ISA
4604
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4605
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4606
+ * reduce the runtime memory requirements of the exception handling routines,
4607
+ * which can be substantial if the ISA contains a lot of registers that are not
4608
+ * call-saved.
4609
+ *
4610
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4611
+ *
4612
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4613
+ * be saved and examined as well in any debug/exception context.  Hence, we
4614
+ * define this to be all of our registers.
4615
+ */
4616
+#undef DWARF_FRAME_REGISTERS
4617
+#define        DWARF_FRAME_REGISTERS   16
4618
+
4619
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4620
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4621
+ *
4622
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4623
+ * the ZipCPU.
4624
+ */
4625
+
4626
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4627
+ * representation for dwarf registers is different than the internal
4628
+ * representation for unwind column.  Given a dwarf register, this macro should
4629
+ * return the unwind column number to use instead.
4630
+ *
4631
+ * ... ???
4632
+ */
4633
+
4634
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4635
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4636
+ * different from that used in other debug info sections.  Given a GCC hard
4637
+ * register number, this macro should return the .eh_frame register number.
4638
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4639
+ *
4640
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4641
+ * should still work for us.
4642
+ */
4643
+
4644
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4645
+ * numbers held in the call frame info that GCC has collected using
4646
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4647
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4648
+ *
4649
+ * ZipCPU --- Default is good enough.
4650
+ */
4651
+
4652
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4653
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4654
+ * if target register size is larger than the size of void *.  The default
4655
+ * is to store register values as void *type.
4656
+ *
4657
+ * ZipCPU --- Default is what we need.
4658
+ */
4659
+
4660
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4661
+ * always uses extended unwind context with version, args_size, and by_value
4662
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4663
+ *
4664
+ */
4665
+
4666
+
4667
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4668
+
4669
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4670
+ * if a function must have and use a frame pointer.  This target hook is
4671
+ * called in the reload pass.  If its return value is true, the function will
4672
+ * have a frame pointer.
4673
+ *
4674
+ * This target hook can in principle examine the current function and decide
4675
+ * according to the facts, but on most machines the constant false or the
4676
+ * constant true suffices.  Use false when the machine allows code to be
4677
+ * generated with no frame pointer, and doing so saves some time or space.
4678
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4679
+ *
4680
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4681
+ * we'll treat this as a constant false--which is also the default value.
4682
+ */
4683
+#define        target_frame_pointer_required   zip_frame_pointer_required
4684
+
4685
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4686
+ * depth-var the difference between the frame pointer and the stack pointer
4687
+ * values immediately after the function prologue.  The value would be computed
4688
+ * from information such as the result of get_frame_size() and the tables of
4689
+ * registers regs_ever_live and call_used_regs.
4690
+ *
4691
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4692
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4693
+ * always returns true; in that case you may set depth-var to anything.
4694
+ *
4695
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4696
+ */
4697
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4698
+
4699
+
4700
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4701
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4702
+ * If it is not defined, the only elimination attempted by the compiler is to
4703
+ * replace references to the frame pointer with references to the stack pointer.
4704
+ *
4705
+ * On some machines, the position of the argument pointer is not known until
4706
+ * the compilation is completed.  In such a case, a separate hard register
4707
+ * must be used for the argument pointer.  This register can be eliminated by
4708
+ * replacing it with either the frame pointer or the argument pointer,
4709
+ * depending on whether or not the frame pointer has been eliminated.
4710
+ *
4711
+ * ZipCPU we'll take their suggestion and define this as:
4712
+ */
4713
+#undef ELIMINABLE_REGS
4714 103 dgisselq
+#ifdef zip_FP_PSEUDO
4715 102 dgisselq
+#define        ELIMINABLE_REGS \
4716 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4717
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4718
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4719
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4720
+#else
4721
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4722
+#  define      ELIMINABLE_REGS \
4723
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4724
+# else
4725
+#  define      ELIMINABLE_REGS \
4726 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4727
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4728
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4729 103 dgisselq
+# endif
4730
+#endif
4731 102 dgisselq
+
4732
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4733
+ * true if the compiler is allowed to try to replace register number FROM with
4734
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4735
+ * is defined, and will usually return true since most of the cases preventing
4736
+ * register elimination are things that the compiler  already knows about.
4737
+ *
4738
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4739 117 dgisselq
+ * the frame pointer was needed?  Yes it does, but it's kept separately.  We'll
4740
+ * just say everything can be eliminated.
4741 102 dgisselq
+ */
4742
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4743
+
4744
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4745
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4746
+ * the specified pair of registers.  This macro must be defined if
4747
+ * ELIMINABLE_REGS is defined.
4748
+ *
4749 117 dgisselq
+ * ZipCPU---We had at one time set this to a default offset of 0.  This didn't
4750
+ * work.  It turns out that this is not only the *initial* elimination offset,
4751
+ * but also the offset along the way.  Hence, when a variable needs to be
4752
+ * spilled to the stack, this offset must change.  Reload goes and checks for
4753
+ * this, and adjusts registers if the offset has changed.  Hence, without this,
4754
+ * we get negative (i.e. illegal) stack offsets.
4755 102 dgisselq
+ */
4756
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4757
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4758
+       while(0)                                        \
4759
+
4760
+/* 17.09.06 Passing function arguments on the stack */
4761
+
4762
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4763
+ * prototype as an integral type smaller than int should actually be
4764
+ * passed as an int.  In addition to avoiding errors in certain cases of
4765
+ * mismatch, it also makes for better code on certain machines.  The default is
4766
+ * to not promote prototypes.
4767
+ *
4768
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4769
+ * (which should still be an int) up to an int anyway.
4770
+ */
4771
+#undef TARGET_PROMOTE_PROTOTYPES
4772
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4773
+
4774
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4775
+ * pass outgoing arguments.  If the target machine does not have a push
4776
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4777
+ * to allocate the entire argument block and then store the arguments into it.
4778
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4779
+ *
4780
+ * ZipCPU does not have a push instruction, so we set this to zero.
4781
+ */
4782
+#undef PUSH_ARGS
4783
+#define        PUSH_ARGS       0
4784
+
4785
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4786
+ * be evaluated last to first, rather than first to last.  If this macro is
4787
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4788
+ * grow in opposite directions, and zero otherwise.
4789
+ *
4790
+ * ZipCPU---Let's evaluate our arguments first to last.
4791
+ */
4792
+#define        PUSH_ARGS_REVERSED      1
4793
+
4794
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4795
+ * actually pushed onto the stack when an instruction attempts to push
4796
+ * (NPUSHED) bytes.
4797
+ *
4798
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4799
+ * happens.
4800
+ */
4801
+// #warning "No appropriate definition seemed right."
4802
+
4803
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4804
+ * of space required for outgoing arguments will be computed and placed into
4805
+ * crtl->outgoing_args_size.  No space will be pushed onto the stack for each call; instead the function prologue should increase the stack frame size by this
4806
+ * amount.
4807
+ *
4808
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4809
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4810
+ * for good performance.  I mean, think of it, free performance increase?  Who
4811
+ * could argue with that?
4812
+ */
4813
+#undef ACCUMULATE_OUTGOING_ARGS
4814
+#define        ACCUMULATE_OUTGOING_ARGS        1
4815
+
4816
+
4817
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4818
+ * that stack space has been allocated for arguments even when their values
4819
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4820
+ * the area reserved for arguments passed in registers for the function
4821
+ * represented by FN, which can be zero if GCC is calling a library function.
4822
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4823
+ *
4824
+ * This space can be allocated by the caller, or be part of the machine
4825
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4826
+ *
4827
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4828
+ * therefore.
4829
+ */
4830
+// #undef      REG_PARM_STACK_SPACE
4831
+
4832
+
4833
+
4834
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4835
+ * incoming register arguments.  Define this macro if space guaranteed when
4836
+ * compiling a function body is different to space required when making a call,
4837
+ * a situation that can arise with K&R style function definitions.
4838
+ *
4839
+ */
4840
+
4841
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4842
+ * is the responsibility of the caller to allocate the area reserved for
4843
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4844
+ * if the function called is a library function.
4845
+ *
4846
+ * ZipCPU---Why allocate space you don't need?
4847
+ */
4848
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4849
+
4850
+
4851
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4852
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4853
+ *
4854
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4855
+ */
4856
+
4857
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4858
+ * number of bytes of its own arguments that a function pops on returning, or 0
4859
+ * if the function pops no arguments and the caller must therefore pop them all
4860
+ * after the function returns.
4861
+ *
4862
+ * ZipCPU --- If we define this, we'll lose our gain from
4863
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4864
+ */
4865
+
4866
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4867
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4868
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4869
+ * which all arguments to the function have been accumulated.
4870
+ *
4871
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4872
+ * this is zero.
4873
+ */
4874
+#undef CALL_POPS_ARGS
4875
+#define        CALL_POPS_ARGS(CUM)     0
4876
+
4877
+
4878
+/* 17.09.07 Passing arguments in registers */
4879
+
4880
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4881
+ * is passed in a register, and if so, which register.
4882
+ */
4883
+/*
4884
+ * This has been poisoned ... so let's not define it anymore and look for
4885
+ * a better way to do this ...
4886
+ *
4887
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4888
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4889
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4890
+ *     : gen_rtx_REG(MODE, CUM))
4891
+ */
4892
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4893
+
4894
+
4895
+/* TARGET_MUST_PASS_IN_STACK ...
4896
+ */
4897
+// #undef      TARGET_MUST_PASS_IN_STACK
4898
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4899
+
4900
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4901
+ * has register windows, ... which ZipCPU does not have.
4902
+ */
4903
+
4904
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4905
+ * pseudo register should be created for pic_offset_table_rtx during function
4906
+ * expand.
4907
+ *
4908
+ * This should be defined by global parameters, isn't it?
4909
+ */
4910
+
4911
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4912
+ * pic_offset_table_rtx.  This hook is called at the start of register
4913
+ * allocation.
4914
+ *
4915
+ * ZipCPU---Let's revisit this.
4916
+ */
4917
+// #warning "Come back and relook at relocations"
4918
+
4919
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
4920
+ * at the beginning of an argument that must be put in registers.  The value
4921
+ * must be zero for arguments that are passed entirely in registers or that
4922
+ * are entirely pushed on the stack.
4923
+ */
4924
+// #undef      TARGET_ARG_PARTIAL_BYTES
4925
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
4926
+
4927
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
4928
+ * return true if an argument at the position indicated by CUM should be passed
4929
+ * by reference.  This predicate is queried after target independent reasons
4930
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
4931
+ *
4932
+ */
4933
+// #undef      TARGET_PASS_BY_REFERENCE
4934
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
4935
+
4936
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
4937
+ * first argument of 'FUNCTION_ARG' and other related values.
4938
+ *
4939
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
4940
+ */
4941
+#define        CUMULATIVE_ARGS int
4942
+
4943
+/*
4944
+ * OVERRIDE_ABI_FORMAT
4945
+ */
4946
+
4947
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
4948
+ * variable CUM for the state at the beginning of the argument list.
4949
+ *
4950
+ *
4951
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
4952
+ * R1 (unless it has been redefined above ...)
4953
+ */
4954
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
4955
+
4956
+/* INIT_CUMULATIVE_LIBCALL_ARGS
4957
+ * INIT_CUMULATIVE_INCOMING_ARGS
4958
+ *
4959
+ * These default to the last INIT_CUM_ARGS value above.
4960
+ */
4961
+
4962
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
4963
+ * the summarizer variable pointed to by CUM to advance past an argument in
4964
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
4965
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
4966
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
4967
+ * anything if the argument in question was passed on the stack.  The compiler
4968
+ * knows how to track the amount of stack space used for arguments without
4969
+ * any special help.
4970
+ *
4971
+ * ZipCPU---Here we simply copy from ECO32.
4972
+ */
4973
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
4974
+
4975
+/*
4976
+ * TARGET_ARG_OFFSET --- not necessary
4977
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
4978
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
4979
+ * BLOCK_REG_PADDING
4980
+ * TARGET_FUNCTION_ARG_BOUNDARY
4981
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
4982
+ */
4983
+
4984
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
4985
+ * the number of a hard register in which function arguments are sometimes
4986
+ * passed.  This does not include implicit arguments such as the static chain
4987
+ * and the structure-value address.  On many machines, no registers can be used
4988
+ * for this purpose since all function arguments are pushed on the stack.
4989
+ */
4990
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
4991
+
4992
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
4993
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
4994
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
4995
+ * require complex arguments to be split and treated as their individual
4996
+ * components.
4997
+ *
4998
+ * The default value of this hook is NULL, which is treated as always false,
4999
+ * and which should be good enough for ZipCPU--which can go either way.
5000
+ */
5001
+
5002
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
5003
+ * for the target.  The default version of the hook returns void*.
5004
+ *
5005
+ */
5006
+
5007
+/* TARGET_ENUM_VA_LIST_P
5008
+ */
5009
+
5010
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
5011
+ * convention specified by FN.  The default version of this returns va_list_type_node.
5012
+ */
5013
+
5014
+/* TARGET_FN_ABI_VA_LIST
5015
+ */
5016
+
5017
+/* TARGET_CANONICAL_VA_LIST_TYPE
5018
+ */
5019
+
5020
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
5021
+ */
5022
+
5023
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
5024
+ * port can handle pointers with machine mode MODE.  The default version of this
5025
+ * hook returns true for both ptr_mode and Pmode.
5026
+ *
5027
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
5028
+ * default behavior is quite appropriate.
5029
+ */
5030
+
5031
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
5032
+ * memory reference REF may alias with the system C library errno location.
5033
+ * The default version of this hook assumes the system C library errno location
5034
+ * is either a declaration of type int or accessed by dereferencing a pointer
5035
+ * to int.
5036
+ *
5037
+ * ZipCPU --- Default sounds good to me.
5038
+ */
5039
+
5040
+
5041
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
5042
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
5043
+ * a scalar mode to be considered supported, all the basic arithmetic and
5044
+ * comparisons must work.
5045
+ *
5046
+ * The default version of this hook returns true for any mode required to
5047
+ * handle the basic C types (as defined by the port).  Included here are the
5048
+ * double-word arithmetic supported by the code in optabs.c.
5049
+ */
5050
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
5051
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
5052
+
5053
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
5054
+ * port is prepared to handle instructions involving vector mode MODE.  At the
5055
+ * very least, it must have move patterns for this mode.
5056
+ *
5057
+ * ZipCPU---does not support any vector modes.
5058
+ */
5059
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
5060
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
5061
+
5062
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
5063
+ * try to use a scalar mode to store an array of NELEMS elements, given that
5064
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
5065
+ *
5066
+ * ZipCPU---Sounds good.
5067
+ */
5068
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
5069
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
5070
+
5071
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
5072
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
5073
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
5074
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
5075
+ * modes exist.
5076
+ *
5077
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
5078
+ * (if we can).  Let's allow both of those and see how far we get.
5079
+ */
5080
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
5081
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
5082
+
5083
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
5084
+ * nonzero for machine modes for which the port has small register classes.  If
5085
+ * target hook returns nonzero for a given MODE, the compiler will try to
5086
+ * minimize the lifetime of registers in MODE.  The hook may be called with
5087
+ * VOIDmode as an argument.  In this case, the hook is expected to return
5088
+ * nonzero if it returns nonzero for any mode.
5089
+ *
5090
+ * The default version of this hook returns false for any mode.
5091
+ *
5092
+ * ZipCPU---Default sounds good.
5093
+ */
5094
+
5095
+/* 17.09.08 How scalar function values are returned */
5096
+
5097
+/* TARGET_FUNCTION_VALUE
5098
+ */
5099
+
5100
+/* LIBCALL_VALUE
5101
+ */
5102
+
5103
+
5104
+/* 17.09.09 How large values are returned */
5105
+
5106
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
5107
+ * nonzero value to say to return the function value in memory, just as large
5108
+ * structures are always returned.  Here type will be the data type of the value
5109
+ * and FNTYP will be the type of the function doing the returning, or NULL
5110
+ * for libcalls.
5111
+ *
5112
+ */
5113
+#undef TARGET_RETURN_IN_MEMORY
5114
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
5115
+
5116
+/* DEFAULT_PCC_STRUCT_RETURN
5117
+ * TARGET_STRUCT_VALUE_RTX
5118
+ * PCC_STATIC_STRUCT_RETURN
5119
+ * TARGET_GET_RAW_RESULT_MODE
5120
+ * TARGET_GET_RAW_ARG_MODE
5121
+ */
5122
+
5123
+
5124
+/* 17.09.10 Caller-Saves Register Allocation */
5125
+/* 17.09.11 Function Entry and Exit */
5126 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
5127
+// TARGET_ASM_FUNCTION_END_PROLOGUE
5128
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
5129
+// TARGET_ASM_FUNCTION_EPILOGUE
5130
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
5131
+ * if the return instruction or the function epilogue ignores the value of the
5132
+ * stack pointer; in other words, if it is safe to delete an instruction to
5133
+ * adjust the stack pointer before a return from the function.
5134
+ *
5135
+ * The default is 0.
5136
+ *
5137
+ * Note that this macro's value is relevant only for functions for which frame
5138
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
5139
+ * in a function that has no frame pointer, and the compiler knows this
5140
+ * regardless of EXIT_IGNORE_STACK.
5141
+ *
5142
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
5143
+ * our options otherwise could have been, our epilogue code does not use the
5144
+ * stack register at all, but rather starts by moving the frame register into
5145
+ * the stack register.
5146
+ */
5147
+#define EXIT_IGNORE_STACK      1
5148
+// EPILOGUE_USES(regno)
5149
+// EH_USES(regno)
5150
+// TARGET_ASM_OUTPUT_MI_THUNK
5151
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
5152
+
5153 102 dgisselq
+/* 17.09.12 Generating code for profiling */
5154 111 dgisselq
+// FUNCTION_PROFILER
5155
+// PROFILE_HOOK
5156
+// NO_PROFILE_COUNTERS
5157
+// PROFILE_BEFORE_PROLOGUE
5158
+// TARGET_KEEP_LEAF_WHEN_PROFILED
5159
+
5160 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
5161 111 dgisselq
+
5162
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5163
+ * call optimizations for the specified call expression EXP.  DECL will be the
5164
+ * called function, or NULL if this is an indirect call.
5165
+ *
5166
+ * It is not uncommon for limitations of calling conventions to prevent tail
5167
+ * calls to functions outside the current unit of translation, or during PIC
5168
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5169
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5170
+ * successful sibling call optimization may vary greatly between different
5171
+ * architectures.
5172
+ *
5173
+ * ?? What's a sibling call?
5174
+ */
5175
+
5176
+// TARGET_EXTRA_LIVE_ON_ENTRY
5177
+// TARGET_SET_UP_BY_PROLOGUE
5178
+// TARGET_WARN_FUNC_RETURN
5179
+
5180 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5181 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5182
+// TARGET_STACK_PROTECT_FAIL
5183
+// TARGET_SUPPORTS_SPLIT_STACK
5184
+
5185 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5186
+
5187 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5188
+
5189 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5190
+ * ZipCPU --- default is good enough for us.
5191
+ */
5192
+
5193
+/* 17.10 Implementing VARARGS MACROS */
5194
+
5195
+/* ...
5196
+ */
5197
+
5198
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5199
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5200
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5201
+ * stack so that all the arguments appear to have been passed consecutively
5202
+ * on the stack.  Once this is done, you can use the standard implementation
5203
+ * of varargs that works for machines that pass all their arguments on the
5204
+ * stack.
5205
+ */
5206
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5207
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5208
+
5209
+/* ...
5210
+ */
5211
+
5212
+/* 17.11 Trampolines for Nested Functions */
5213
+
5214
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5215
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5216
+ * a block of data that contains the constant parts of a trampoline.  This code
5217
+ * should not include a label--the label is taken care of automatically.
5218
+ *
5219
+ * ZipCPU -- looks like we need to do this.
5220
+ */
5221
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5222
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5223
+
5224
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5225
+ * is to be placed.  The default value is readonly_data_section.
5226
+ *
5227
+ * ZipCPU--default should be good enough.
5228
+ */
5229
+
5230
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5231
+ * as an integer.
5232
+ *
5233
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5234
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5235
+ * of bytes, but we may need to change this later.
5236
+ *
5237
+ */
5238
+// #warning "May need to redefine trampoline_size in words, not bytes"
5239
+#undef TRAMPOLINE_SIZE
5240
+#define        TRAMPOLINE_SIZE 3
5241
+
5242
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5243
+ *
5244
+ * Well that's well known in ZipCPU --- 32-bits.
5245
+ */
5246
+#undef TRAMPOLINE_ALIGNMENT
5247
+#define        TRAMPOLINE_ALIGNMENT    32
5248
+
5249
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5250
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5251
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5252
+ * rtx for the static chain value that should be passed to the function when
5253
+ * it is called.
5254
+ *
5255
+ * ZipCPU ... Can we get by without this?
5256
+ */
5257
+#undef TARGET_TRAMPOLINE_INIT
5258
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5259
+
5260
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5261
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5262
+ * contains the address of the memory block that was passed to
5263
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5264
+ * should be different from the address at which the template was stored, the
5265
+ * different address should be returned; otherwise addr should be returned
5266
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5267
+ * calls.
5268
+ *
5269
+ * ZipCPU--works for us!
5270
+ */
5271
+
5272
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5273
+ * the instruction cache in the specified interval.  The definition of this
5274
+ * macro would typically be a series of asm statements.   Both BEG and END are
5275
+ * pointer expressions.
5276
+ *
5277
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5278
+ */
5279
+
5280
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5281 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5282 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5283
+ * named __transfer_from_trampoline.
5284
+ *
5285
+ * We may need to rethink trampolines on ZipCPU.
5286
+ */
5287
+
5288
+
5289
+/* 17.12 Implicit Calls to Library Routines */
5290
+
5291
+/* DECLARE_LIBRARY_RENAMES
5292
+ *
5293
+ * ZipCPU: Don't need it.
5294
+ */
5295
+
5296
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5297
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5298
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5299
+ * initializing all the normal library routines.
5300
+ *
5301
+ * Most ports don't need to define this hook, so we won't either.
5302
+ */
5303
+
5304
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5305
+ * routines start with two underscores.  If set to true, these routines start
5306
+ * with __gnu_ instead.
5307
+ *
5308
+ * ZipCPU: No change necessary.
5309
+ */
5310
+
5311
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5312
+ * true if the library routine that implements the floating point comparison
5313
+ * operator comparison in mode mode will return a boolean and false if it will
5314
+ * return a tristate.
5315
+ *
5316
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5317
+ */
5318
+
5319
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5320
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5321
+ * algorithm which makes use of simple logical and arithmetic operations for
5322
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5323
+ * which makes use of a 64-bit by 32-bit divide primitive.
5324
+ *
5325
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5326
+ * we have no HW DIVIDE (for now).
5327
+ */
5328
+#define        TARGET_HAS_NO_HW_DIVIDE
5329
+
5330
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5331
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5332
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5333
+ * the value of EDOM on your system.
5334
+ *
5335
+ * EDOM is the error created when a math argument is out of the domain of the
5336
+ * function.
5337
+ *
5338
+ * ZipCPU: Don't need it---I don't think.
5339
+ */
5340
+
5341
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5342
+ * expression that refers to the global "variable" errno.  (On certain
5343
+ * systems, errno may not actually be a variable.)  If you don't define this
5344
+ * macro, a reasonable default is used.
5345
+ *
5346
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5347
+ * I doubt we'll be using errno for a while.
5348
+ */
5349
+
5350
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5351
+ * message sending conventions by default.  This calling convention involves
5352
+ * passing the object, the selector and the method arguments all at once to the
5353
+ * method-lookup library function.  This is the usual setting when targetting
5354
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5355
+ *
5356
+ * If the macro is set to 0, ...
5357
+ *
5358
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5359
+ * an O/S yet.
5360
+ */
5361
+
5362
+
5363
+
5364
+/* 17.13 Addressing Modes */
5365
+
5366
+/* C expressions that are nonzero if the machine supports pre-increment,
5367
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5368
+ */
5369
+#define        HAVE_PRE_INCREMENT      (0)
5370
+#define        HAVE_PRE_DECREMENT      (0)
5371
+#define        HAVE_POST_INCREMENT     (0)
5372
+#define        HAVE_POST_DECREMENT     (0)
5373
+
5374
+/* C expression that is nonzero if the machine supports pre- or post- address
5375
+ * side-effect generation involving constants other than the size of the memory
5376
+ * operand.
5377
+ */
5378
+#define        HAVE_PRE_MODIFY_DISP    (0)
5379
+#define        HAVE_POST_MODIFY_DISP   (0)
5380
+
5381
+/* C expression that is non-zero if the machine supports pre- or post-address
5382
+ * side-effect generation involving a register displacement.
5383
+ */
5384
+#define        HAVE_PRE_MODIFY_REG     (0)
5385
+#define        HAVE_POST_MODIFY_REG    (0)
5386
+
5387
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5388
+ * which is a valid address.  On most machines the default definition ... is
5389
+ * acceptable, but a few machines are more restrictive as to which constant
5390
+ * addresses are supported.
5391
+ *
5392
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5393
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5394
+ * general programming model do not.  Further, without knowing where the final
5395
+ * address will be located, this is an unusable model.  Therefore we will
5396
+ * define this as not supported.
5397
+ *
5398
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5399
+ * they are also constant addresses.  Hence, we leave this at its default.
5400
+ */
5401
+// #undef      CONSTANT_ADDRESS_P
5402
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5403
+
5404 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5405
+ * accepts integer values expressions whose values are not explicitly known,
5406
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5407
+ * expressions, in addition to const_int and const_double expressions.
5408 102 dgisselq
+ *
5409
+ * Huh???
5410
+ */
5411
+// #define CONSTANT_P(X) ???
5412
+
5413 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5414
+ * appear in a valid memory address.  Note that it is up to you to specify a
5415
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5416
+ * ever accept.
5417 102 dgisselq
+ */
5418
+#define        MAX_REGS_PER_ADDRESS    1
5419
+
5420
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5421
+ * whether RTX is a legitimate memory address on the target machine for a
5422
+ * memory operation of mode MODE.
5423
+ */
5424
+#undef TARGET_LEGITIMATE_ADDRESS_P
5425
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5426
+
5427
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5428
+ * default 'm' character for general memory addresses.  This defines the
5429
+ * constraint letter which matches the memory addresses accepted by
5430
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5431
+ * address format in your back end without changing the semantics of the 'm'
5432
+ * constraint.  This is necessary in order to preserve functionality of inline
5433
+ * assembly constructs using the 'm' constraint.
5434
+ *
5435
+ * ZipCPU--doesn't look like we need to define this at all.
5436
+ */
5437
+
5438
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5439
+ * X or to provide a simplified version of X from which alias.c can easily find
5440
+ * the base term.  This macro is used in only two places: find_base_value and
5441
+ * find_base_term in alias.c.
5442
+ *
5443
+ * It is always safe for this macro  to not be defined.  It exists so that
5444
+ * alias analysis can understand machine-dependent addresses.
5445
+ *
5446
+ * ZipCPU: We'll skip this then.
5447
+ */
5448
+
5449
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5450
+ * memory address RTX for an operand of mode MODE and should try to return a
5451
+ * valid memory address.  RTX will always be the result of a call to
5452
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5453
+ * function to produce RTX.
5454
+ *
5455 111 dgisselq
+ * ZipCPU --
5456 102 dgisselq
+ */
5457 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5458
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5459 102 dgisselq
+
5460
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5461
+ * that attempts to replace X, which is an address that needs reloading, with
5462
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5463
+ * statement label elsewhere in the code.  It is not necessary to define this
5464
+ * macro, but it might be useful for performance reasons.
5465
+ *
5466
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5467
+ * may also be a difficult macro to use.  Look at other implementations before
5468
+ * we dive into this.
5469
+ */
5470
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5471
+// #define LEGITIMIZE_RELOAD_ADDRESS
5472
+
5473
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5474
+ * if memory address addr in address space addrspace can have different meanings
5475
+ * depending on the machine mode of the memory reference it is used for or if
5476
+ * the address is valid for some modes but not others.
5477
+ */
5478
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5479
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5480
+
5481 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5482
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5483
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5484
+ *
5485
+ * The default definition returns true.
5486 102 dgisselq
+ */
5487
+
5488
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5489
+ */
5490
+
5491
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5492
+ * should not be emitted into debug sections.
5493
+ */
5494
+
5495
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5496
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5497
+ * MODE is the mode of X.  The default version returns false.
5498
+ */
5499 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5500 102 dgisselq
+
5501
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5502
+ * if pool entries for constant RTX can be placed in an object_block structure.
5503
+ * MODE is the mode of X.  The default version returns false for all constants.
5504
+ *
5505
+ *????
5506
+ */
5507
+// #warning "Huh?"
5508
+
5509
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5510
+ * entries for DECL should be placed in an object_block structure.  The default
5511
+ * version returns true for all DECL's.
5512
+ *
5513
+ * Sounds good.
5514
+ */
5515
+
5516
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5517
+ * function that implements the reciprocal of the machine specific builtin
5518
+ * function fndecl, or NULL_TREE if such a function is not available.
5519
+ */
5520
+
5521
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5522
+ * DECL of a function f that given an address addr as an argument returns a mask
5523
+ * m that can be used to extrract from two vectors the relevant data that
5524
+ * resides in addr in case addr is not properly aligned.
5525
+ *
5526
+ * Zip CPU does not support vectorization.
5527
+ */
5528
+
5529
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5530
+ * such data accesses and manipulation.
5531
+ */
5532
+
5533
+/* 17.14 Anchored Addresses */
5534
+
5535
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5536
+ * a section anchor.  On most targets, it should be the smallest offset that
5537
+ * can be applied to a base register while still giving a legitimate address for
5538
+ * every mode.  The default value is 0.
5539
+ *
5540
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5541
+ * operation, which would be a signed 14 bit number.
5542
+ */
5543
+#undef TARGET_MIN_ANCHOR_OFFSET
5544
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5545
+
5546
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5547
+ * (inclusive) offset that should be applied to section anchors.  The default
5548
+ * value is 0.
5549
+ */
5550
+#undef TARGET_MAX_ANCHOR_OFFSET
5551
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5552
+
5553
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5554
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5555
+ * true.  The hook is called with the assembly output position set to the
5556
+ * beginning of SYMBOL_REF_BLOCK(X).
5557
+ *
5558
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5559
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5560
+ * is not available, the hook's default definition is NULL, which disables the
5561
+ * use of section anchors altogether.
5562
+ *
5563
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5564
+ * must define this hook.
5565
+ */
5566
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5567
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5568
+
5569
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5570
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5571
+ *
5572
+ * The default version is correct for most targets, but you might need to intercept this hook to handle things like target specific attributes or target-specific sections.
5573
+ *
5574
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5575
+ */
5576
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5577
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5578
+
5579
+/* 17.15 Condition Code Status */
5580
+
5581
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5582
+
5583
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5584
+ * the mdep component of cc_status.  It defaults to int.
5585
+ *
5586
+ * ZipCPU---Int is good for us.
5587
+ */
5588
+
5589
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5590
+ * "empty".  The default definition does nothing, since most machines don't
5591
+ * use the field anyway.  If you want to use the field, you should probably
5592
+ * define  this macro to initialize it.
5593
+ */
5594
+
5595
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5596
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5597
+ * macro's responsibility to recognize insns that set the condition code as
5598
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5599
+ *
5600
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5601
+ *
5602
+ */
5603 122 dgisselq
+#ifdef HAVE_cc0
5604 102 dgisselq
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5605 122 dgisselq
+#endif
5606 102 dgisselq
+
5607
+
5608
+/* 17.15.2 Representation of condition codes using registers */
5609
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5610
+ * this section isn't supposed to apply.
5611
+ */
5612
+
5613 122 dgisselq
+/* SELECT_CC_MODE(op, x, y) ... On many machines, the condition code may be
5614
+ * produced by other instructions than compares, for example the branch can use
5615
+ * directyl the condition code set by a subtract instruction.  However, on some
5616
+ * machines when the condition code is set this way some bits (such as the
5617
+ * overflow bit) are not set in the same way as a test instruction, so that a
5618
+ * different branch instruction must be used for some conditional branches.
5619
+ * When this happens, use the machinemode of the condition code register to
5620
+ * record different formats of the condition code register.  Modes can also be
5621
+ * used to reccord which compare instruction (e.g. a signed or an unsigned
5622
+ * comparison) produced the condition codes.
5623
+ *
5624
+ * If other modes than CCmode are required, add them to 'machine-modes.def' and
5625
+ * define SELECT_CC_MODE to choose a mode given an operand of a compare.  This
5626
+ * is needed because the modes have to be chosen not only during RTL generation
5627
+ * but also, for example, by instruction combination.  The result of
5628
+ * SELECT_CC_MODE should be consistent with the mode used in the patterns; ...
5629
+ *
5630
+ * ZipCPU ... We have only one CC Mode, so we'll use the CCmode defined in
5631
+ * machine-modes.def and should be fine with it.  Hence, this doesn't need
5632
+ * to be defined.
5633 102 dgisselq
+ */
5634
+
5635
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5636
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5637
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5638
+ * does not have a GT comparison, but you can use an LT comparison instead and
5639
+ * swap the order of the operands.
5640
+ *
5641
+ * On such machines, implement this hook to do any required conversions:  code
5642
+ * is the initial comparison code and op0 and op1 are the left and right
5643
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5644
+ * implementation is not allowed to change the value of op0 since the value
5645
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5646
+ * not allowed to swap operands in that case.
5647
+ *
5648
+ * GCC will not assume that the comparison resulting from this macro is valid
5649
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5650
+ *
5651
+ * You need not implement this hook if it would never change the comparison
5652
+ * code or operands.
5653
+ *
5654
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5655
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5656
+ * painful.  Therefore, we *need* this capability to make certain we can use
5657
+ * our comparisons successfully.
5658
+ *
5659
+ * The only problem is ... this hook appears to only be called on non-CC0
5660
+ * machines.  Hence, defining it hasn't done anything for us.
5661
+ */
5662 122 dgisselq
+#define        TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5663 102 dgisselq
+
5664 122 dgisselq
+/* REVERSIBLE_CC_MODE(MODE) ... A C expression whose value is one if it is
5665
+ * always safe to reverse a comparison whose mode is MODE.  If SELECT_CC_MODE
5666
+ * can ever return MODE for a floating-point inequality comparison, than
5667
+ * REVERSIBLE_CC_MODE(MODE) must be zero.
5668
+ *
5669
+ * You need not define this macro if it would always return zero or if the
5670
+ * floating-point format is anything other than IEEE_FLOAT_FORMAT.  For example,
5671
+ * here ...
5672
+ *
5673
+ * ZipCPU -- We'll always return zero, so this need not be defined.
5674
+ */
5675
+
5676
+/* REVERSE_CONDITION(CODE,MODE) ... A C expression whose value is reversed
5677
+ * condition code of thecode for comparison done in CC_MODE MODE.  This macro
5678
+ * is used only in case REVERSIBLE_CC_MODE(MODE) is nonzero. ...
5679
+ *
5680
+ * ZipCPU ... Since REVERSIBLE_CC_MODE(MODE) will always be zero, we'll leave
5681
+ * this undefined.
5682
+ */
5683
+
5684
+/* bool TARGET_FIXED_CONDITION_CODE_REGS(int *, int *) ... On targets which do
5685
+ * not use (cc0), and which use a hard register rather than a pseudo-register
5686
+ * to hold condition codes, the regular CSE passes are often not able to
5687
+ * identify cases in which the hard register is set to a common value.  Use this
5688
+ * hook to enable a small pass which optimizes such cases.  This hook should
5689
+ * return true to enable this pass, and it should set the integers to which its
5690
+ * arguments point to the hard register numbers used for condition codes.  When
5691
+ * there is only one such register, as is true on most systems, the integer
5692
+ * pointed to by p2 should  be set to INVALID_REGNUM.
5693
+ *
5694
+ * The default version of this hook returns false.
5695
+ *
5696
+ * ZipCPU --- I like the idea of enabling optimizations.  Let's return
5697
+ * something other than false.
5698
+ */
5699
+#define        TARGET_FIXED_CONDITION_CODE_REGS        zip_fixed_condition_code_regs
5700
+
5701
+/* machine_mode TARGET_CC_MODES_COMPATIBLE(M1,M2) .. On targets which use
5702
+ * multiple condition code modes in class MODE_CC, it is sometimes the case
5703
+ * that a comparison can be validly done in more than one mode.  On such a
5704
+ * system, define this target hook to take two mode arguments and to return a
5705
+ * mode in which both comparisons may be validly done.  If there is no such
5706
+ * mode, return VOIDmode.
5707
+ *
5708
+ * The default version of this hook checks whether the modes are the same.  If
5709
+ * they are, it returns that mode.  If they are different, it returns VOIDmode.
5710
+ *
5711
+ * ZipCPU--Given that we only have the one CCmode, the default definition works
5712
+ * well enough for us.
5713
+ */
5714
+
5715
+/* unsigned int TARGET_FLAGS_REGNUM ... If the target has a dedicated flags
5716
+ * register, and it needs to use the post-reload comparison elimination pass,
5717
+ * then this value should be set appropriately.
5718
+ *
5719
+ * ZipCPU---Looks like we can set this easily enough without any problems.
5720
+ */
5721
+#undef TARGET_FLAGS_REGNUM
5722
+#define        TARGET_FLAGS_REGNUM     zip_CC
5723
+
5724 102 dgisselq
+/* 17.16 Relative costs of operations */
5725
+
5726
+
5727
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5728
+// #define     TARGET_REGISTER_MOVE_COST
5729
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5730
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5731
+ * cost of moving data of mode M from a register in class FRM to one in class
5732
+ * TO.  The classes are expressed using the enumeration values such as
5733
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5734
+ * relative to that.
5735
+ *
5736
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5737
+ * on some machines it is expensive to move between registers if they are not
5738
+ * general registers.
5739
+ *
5740
+ * If reload sees ...
5741
+ *
5742
+ * ZipCPU ... We can leave this at its default value of 2.
5743
+ */
5744
+
5745
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5746
+ * cost of moving data of mode MOD between a register of class CL and memory.
5747
+ * IN is false if the value is to be written to memory, true if it is to be
5748
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5749
+ * If moving between registers and memory is more expensive that between two
5750
+ * registers, you should add this target hook to express the relative cost.
5751
+ *
5752
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5753
+ * cost of copying via a secondary reload register, if one is needed.  If your
5754
+ * machine requires a secondary reload register to copy between memory and a
5755
+ * register of CL but the reload mechanism is more complex than copying via
5756
+ * an intermediate, use this target hook to reflect the actual cost of the
5757
+ * move.
5758
+ *
5759
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5760
+ * moves, so let's make certain this is defined.
5761
+ */
5762
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5763
+
5764
+// #warning "This needs to be double checked, and annotated"
5765 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5766 102 dgisselq
+
5767
+/* Define this macro as a C expression which is nonzero if accessing less than
5768
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5769
+ * a word of memory.
5770
+ */
5771
+#define        SLOW_BYTE_ACCESS        1
5772
+
5773
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5774
+ * instructions, below which a sequence of instructions should be generated
5775
+ * instead of a string move instruction or a library call.  Increasing the
5776
+ * value will always make code faster, but eventually incurs high cost in
5777
+ * increased code size.
5778
+ */
5779
+#define        MOVE_RATIO(SPD) 5
5780
+
5781
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5782
+ */
5783
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5784
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5785
+
5786
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5787
+ * which a sequence of instructions should be generated to clear memory instead
5788
+ * of a string clear instruction or a library call.  Increasing the value will
5789
+ * always make the code faster, but eventually incurs high cost in increased
5790
+ * code size.
5791
+ */
5792
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5793
+
5794
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5795
+ * to call a constant function address than to call an address kept in a
5796
+ * register.
5797
+ *
5798
+ * On the Zip CPU, constant function addresses--especially relative ones,
5799
+ * can be optimized into a single cycle delay.  Register jumps will always
5800
+ * stall the whole (5-stage) pipeline.
5801
+ */
5802
+#define        NO_FUNCTION_CSE
5803
+
5804 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5805
+ * the relative costs of RTL expressions.
5806
+ *
5807
+ * The cost may depend on the precise form of the expression, which is avaialble
5808
+ * for examination in X, and the fact that X appears as operand OPNO of an
5809
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5810
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5811
+ * == X or (b) XVEC(Y,OPNO) contains X.
5812
+ *
5813
+ * ...
5814
+ * The hook returns true when all subexpressions of x have been processed and
5815
+ * false when rtx_cost should recurse.
5816 102 dgisselq
+ */
5817 111 dgisselq
+
5818 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5819
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5820
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5821
+ * than one form of an address is known, the form with the lowest cost will be
5822
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5823
+ * most complex will be used.
5824
+ *
5825
+ * ZipCPU really has only one address cost, the only type of address it
5826
+ * supports.  Sure, index addressing would cost us more, but we don't support
5827
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5828
+ * docs state that, "On RISC amchines, all instructions normally have the same
5829
+ * length and execution time.  Hence all addresses will have equal costs."
5830
+ */
5831
+#undef TARGET_ADDRESS_COST
5832
+#define        TARGET_ADDRESS_COST     zip_address_cost
5833
+
5834
+
5835
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5836
+ * of the eager delay slot filler to disallow speculatively executed
5837
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5838
+ * architectures posess both branches with and without delay slots.  As the
5839
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5840
+ * when ordinary branches are available.  Use of delay slot branches filled
5841
+ * using basic filler is often still desirable as the delay slot can hide a
5842
+ * pipeline bubble.
5843
+ */
5844
+// How should Zip CPU define this--we have no delay slots.
5845
+
5846
+
5847
+/* 17.17 Instruction Scheduler */
5848
+
5849
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5850
+
5851
+/* 17.18 Dividing the Output into Sections */
5852
+
5853
+/* Switch to the text or data segment. */
5854
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5855
+#define        DATA_SECTION_ASM_OP     "\t.data"
5856
+
5857
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5858
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5859
+
5860
+
5861
+/* 17.19 Position Independent Code */
5862
+
5863
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5864
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5865
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5866
+
5867
+/* 17.20 Defining the Output Assembler Language */
5868
+
5869
+/* 17.20.4 Output and Generation of Labels */
5870
+
5871
+/* ASM_OUTPUT_LABEL
5872
+ * ... A default definition of this macro is provided which is correct for
5873
+ * most systems.
5874
+ */
5875
+
5876
+/* ASM_OUTPUT_FUNCTION_LABEL
5877
+ * ... if not defined, then the function name is defined in the usual manner
5878
+ * as a label.
5879
+ */
5880
+
5881
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5882
+ * is known to refer to a compiler-generated label.  The default definition
5883
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5884
+ * efficient.
5885
+ */
5886
+
5887
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5888
+ * to specify the size of a symbol, without any arguments.  ON systems that
5889
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5890
+ * define this macro.
5891
+ *
5892
+ * Define this amcro only if it is correct to use the default definitions of
5893
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5894
+ * If you need your own custom definitions of those macros, or if you do not
5895
+ * need explicit symbol sizes at all, do not define this macro.
5896
+ */
5897
+
5898
+/* ASM_OUTPUT_SIZE_DIRECTIVE
5899
+ * ASM_OUTPUT_MEASURED_SIZE
5900
+ */
5901
+
5902
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
5903
+ * the character '$' in label names.  By default constructors and destructors
5904
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
5905
+ * used instead.
5906
+ */
5907
+
5908
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
5909
+ * character '.' in label names.  By default constructors and destructors in
5910
+ * G++ have names that use '.'.  If this macro is defined, these names are
5911
+ * rewritten to avoid '.'.
5912
+ */
5913
+
5914
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
5915
+ * specify the type of a symbol, without any arguments.  On systems that use
5916
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
5917
+ *
5918
+ * Define this macro only if it is correct to use the default definition of
5919
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
5920
+ * definition of this macr, or if you do not need explicit symbol types at all,
5921
+ * do not define this macro.
5922
+ */
5923
+
5924
+/* TYPE OPERAND_FMD ... A
5925
+ */
5926
+
5927
+/* ASM_OUTPUT_TYPE_DIRECTIVE
5928
+ */
5929
+
5930
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
5931
+ * if this macro is not defined, then the function name is defined in the usual
5932
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
5933
+ */
5934
+
5935
+/* ASM_DECLARE_FUNCTION_SIZE
5936
+ * ASM_DECLARE_COLD_FUNCTION_NAME
5937
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
5938
+ * ASM_DECLARE_OBJECT_NAME
5939
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
5940
+ */
5941
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
5942
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
5943
+ * claiming a register REGNO for a global variable DECL with name NAME.
5944
+ *
5945
+ * If you don't defin this macro, that is equivalent to dfining it to do
5946
+ * nothing.
5947
+ */
5948
+
5949
+/* ASM_FINISH_DECLARE_OBJECT
5950
+ * TARGET_ASM_GLOBALIZE_LABEL
5951
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
5952
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
5953
+ * ASM_WEAKEN_LABEL
5954
+ * ASM_WEAKEN_DECL
5955
+ * ASM_OUTPUT_WEAKREF
5956
+ * SUPPORTS_WEAK
5957
+ * TARGET_SUPPORTS_WEAK
5958
+ * MAKE_DECL_ONE_ONLY
5959
+ * SUPPORTS_ONE_ONLY
5960
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
5961
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
5962
+ * ASM_OUTPUT_EXTERNAL
5963
+ * TARGET_ASM_EXTERNAL_LIBCALL
5964
+ * TARGET_ASM_MARK_DECLPRESERVED
5965
+ * ASM_OUTPUT_LABELREF
5966
+ * TARGET_MANGLE_ASSEMBLER_NAME
5967
+ * ASM_OUTPUT_SYMBOL_REF
5968
+ * ASM_OUTPUT_LABEL_REF
5969
+ * TARGET_ASM_INTERNAL_LABEL
5970
+ * ASM_OUTPUT_DEBUG_LABEL
5971
+ * ASM_GENERATE_INTERNAL_LABEL
5972
+ * ASM_FORMAT_PRIVATE_NAME
5973
+ */
5974
+
5975
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
5976
+ * assembler code which defines (equates) the symbol NAME to have the value
5977
+ * VALUE.
5978
+ *
5979
+ * ZipCPU---So many other things that we need depend upon this, that we need
5980
+ * to implement a non-default version.
5981
+ */
5982
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
5983
+
5984
+/* ASM_OUTPUT_DEF_FROM_DECLS
5985
+ * TARGET_DEFERRED_OUTPUT_DEFS
5986
+ * ASM_OUTPUT_WEAK_ALIAS
5987
+ * OBJ_GEN_METHOD_LABEL
5988
+ */
5989
+
5990
+
5991
+/* 17.20.7 Output of Assembler Instructions */
5992
+
5993
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
5994
+       "R10","R11","R12","SP","CC","PC" }
5995
+
5996
+/* REGISTER_PREFIX     (Undefined by default)
5997
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
5998
+ * USER_LABEL_PREFIX   defaults to "*"
5999
+ * IMMEDIATE_PREFIX    (Undefined by default)
6000
+ *
6001
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
6002
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
6003
+ * 'md' file must support multiple assembler formats.  In that case, the various
6004
+ * 'tm.h' files can define these macros differently.
6005
+ */
6006
+// #define     USER_LABEL_PREFIX       "*"
6007
+
6008
+/* Defining memory operand address formats is in this section. */
6009
+
6010
+/* 17.20.10 Assembler Commands for Alignment */
6011
+
6012
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
6013
+ * which is a common destination of jumps and has no fallthru incoming
6014
+ * edge.  This macro need not be defined if you don't want any special alignment
6015
+ * to be done at such a time.  Most machine descriptions do not currently define
6016
+ * this macro.
6017
+ *
6018
+ * ZipCPU---The assembler should automatically deal with label alignment, so
6019
+ * let's not do anything about it here.
6020
+ */
6021
+
6022
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
6023
+ */
6024
+
6025
+/* LABEL_ALIGN_AFTER_BARRIER
6026
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
6027
+ */
6028
+
6029
+/* LOOP_ALIGN(label)
6030
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
6031
+ * LABEL_ALIGN
6032
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
6033
+ */
6034
+
6035
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
6036
+ * stream an assembler instruction to advance the location counter by nbytes
6037
+ * bytes.
6038
+ */
6039
+
6040
+/* TARGET_ASM_LABEL_ALIGN */
6041
+/* Assembler Commands for Alignment */
6042
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
6043 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
6044 102 dgisselq
+
6045
+
6046
+
6047
+/* 17.21 Controlling Debugging Information Format */
6048
+/* 17.22 Cross Compilation and Floating Point */
6049 111 dgisselq
+
6050
+// REAL_VALUE_TYPE
6051
+// REAL_VALUES_EQUAL
6052
+// REAL_VALUES_LESS ... Tess whether x is less than y
6053
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
6054
+ * If x is negative, returns zero.
6055
+ */
6056
+// REAL_VALUE_ATOF
6057
+// REAL_VALUE_NEGATIVE
6058
+// REAL_VALUE_ISINF
6059
+// REAL_VALUE_ISNAN
6060
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
6061
+ * on two floating point values X and Y, storing the result in OUT (which must
6062
+ * be a variable).
6063
+ *
6064
+ * The operation to be performed is specified by CODE.  Only the following
6065
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
6066
+ * MIN_EXPR.
6067
+ *
6068
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
6069
+ * floating point format cannot represent infinity, it will call abort().
6070
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
6071
+ */
6072
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
6073
+ * value X.
6074
+ */
6075
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
6076
+ */
6077 102 dgisselq
+/* 17.23 Mode switching instructions */
6078
+/* 17.24 Defining target-specific uses of __attribute__ */
6079
+#undef TARGET_OPTION_OVERRIDE
6080
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
6081
+
6082
+/* 17.25 Emulating TLS */
6083
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
6084
+
6085
+ // ZipCPU isn't MIPS.
6086
+
6087
+/* 17.27 Parameters for Precompiled Header Validity Checking */
6088
+/* 17.28 C++ ABI parameters */
6089
+/* 17.29 Adding support for named address spaces */
6090
+/* 17.30 Miscellaneous Parameters */
6091
+
6092
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
6093
+ * not your architecture has conditional branches that can span all of memory.
6094
+ * It is used in conjunction with an optimization that partitions hot and
6095
+ * cold basic blocks into separate sections of the executable.  If this macro
6096
+ * is set to false, gcc will convert any conditional branches that attempt to
6097
+ * cross between sections into unconditional branches or indirect jumps.
6098
+ *
6099
+ * ZipCPU --- The assembler renders long unconditional branch code without
6100
+ * problems, so we can pretend that such long branches exist.
6101
+ */
6102
+#define        HAS_LONG_COND_BRANCH true
6103
+
6104
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
6105
+ * or not your architecture has unconditional branches that can span all of
6106
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
6107
+ * conjunction with an optimization that partitions hot and cold basic blocks
6108
+ * into separate sections of the executable.  If this macro is set to false,
6109
+ * gcc will convert any unconditional branches that attempt to cross between
6110
+ * sections into indirect jumps.
6111
+ *
6112
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
6113
+ * jump.
6114
+ */
6115
+#define        HAS_LONG_UNCOND_BRANCH  true
6116
+
6117
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
6118
+ * mode that eleemnts of a jump-table should have.
6119
+ *
6120
+ */
6121
+#define        CASE_VECTOR_MODE        SImode
6122
+
6123
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
6124
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
6125
+ * If you define this, it enables extra code in branch shortening to deal with
6126
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
6127
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
6128
+ *
6129
+ * ZipCPU---No advantage here.
6130
+ */
6131
+
6132
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
6133
+ * jump-tables should contain relative addresses.  You need not define this
6134
+ * macro if jump-tables never contain relative addresses, or jump-tables
6135
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6136
+ *
6137
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6138
+ * code.
6139
+ */
6140
+
6141
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6142
+ * number of different values for which it is best to use a jump-table instead
6143
+ * of a tree of conditional branches.  The default is four for machines with a
6144
+ * casesi instruction and five otherwise.  This is best for most machines.
6145
+ *
6146
+ * ZipCPU---Leave at the default.
6147
+ */
6148
+
6149
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6150
+ * registers with integral mode smaller than a word are always performed on the
6151
+ * entire register.  Most RISC machines have this property and most CISC
6152
+ * machines do not.
6153
+ *
6154
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6155
+ */
6156
+#undef WORD_REGISTER_OPERATIONS
6157
+#define        WORD_REGISTER_OPERATIONS        1
6158
+
6159
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6160
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6161
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6162
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6163
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6164
+ * UNKNOWN for other modes.
6165
+ *
6166
+ * Do not define this macro if it would always return UNKNOWN.
6167
+ *
6168
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6169
+ */
6170
+#undef LOAD_EXTEND_OP
6171
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6172
+
6173
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6174
+ *
6175
+ * ZipCPU---All immediates are sign extended, so yes.
6176
+ */
6177
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6178
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6179
+
6180
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6181
+ */
6182
+
6183
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6184
+ * quickly between memory and registers or between two memory locations.
6185
+ *
6186
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6187
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6188
+ * Therefore, this is defined to be one.
6189
+ */
6190
+#define        MOVE_MAX        1
6191
+
6192
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6193
+ * move quickly between memory and registers or between two memory ...
6194
+ *
6195
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6196
+ * definition of this.
6197
+ */
6198
+
6199
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6200
+ * the number of bits actually used for the count of a shift operation is equal
6201
+ * to the number of bits needed to represent the size of the object being
6202
+ * shifted.
6203
+ *
6204
+ * You need not define this macro if it would have the value of zero.
6205
+ *
6206
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6207
+ * value in the register, therefore this value should be zero, the default.
6208
+ */
6209
+
6210
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6211
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6212
+ * more than the width of the mode.
6213
+ *
6214
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6215
+ * This is the case for the ZipCPU as well.
6216
+ */
6217
+
6218
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6219
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6220
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6221
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6222
+ *
6223
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6224
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6225
+ */
6226
+#undef TRULY_NOOP_TRUNCATION
6227
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6228
+
6229
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6230
+ * mode can be such that the values are always extended to a wider integral
6231
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6232
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6233
+ * use zero-extended.
6234
+ *
6235
+ */
6236
+// #undef      TARGET_MODE_REP_EXTENDED
6237
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6238
+
6239
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6240
+ * comparison operator with an integral mode and stored by a store-flag
6241
+ * instruction (cstoremode4) when the condition is true.  This description
6242
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6243
+ * whose results have MODE_INT mode.
6244
+ *
6245
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6246
+ */
6247
+
6248
+/* FLOAT_STORE_FLAG_VALUE
6249
+ *
6250
+ * ZipCPU
6251
+ */
6252
+
6253
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6254
+ * comparison operations that return a vector result ...
6255
+ *
6256
+ * ZipCPU---Doesn't support vector operations.
6257
+ */
6258
+
6259
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6260
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6261
+ *
6262
+ * A C expression that indicates whetther the architecture defines a value for
6263
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6264
+ * undefined.  If the value is defined for only the RTL expression, the macro should evaluate to 1.  If the value also applies to the corresponding optab
6265
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6266
+ * defined, value should be set to this value.
6267
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6268
+ * be undefined.
6269
+ *
6270
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6271
+ */
6272
+
6273
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6274
+ * define this to be the integer mode corresponding to the width of a
6275
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6276
+ * On some machines you must define this to be one of the partial
6277
+ * integer modes, such as PSImode.
6278
+ */
6279
+#undef Pmode
6280
+#define        Pmode   SImode
6281
+
6282
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6283
+ * function being called, in call RTL expressions.  On most CISC machines, where
6284
+ * an instruction can begin at any byte address, this should be QImode.  On most
6285
+ * RISC machines, where all instructions have fixed size and alignment, this
6286
+ * should be a mode with the same size and alignment as the machine instruction
6287
+ * words--typically SImode or HImode.
6288
+ *
6289
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6290
+ * addresses on the ZipCPU.
6291
+ */
6292
+#undef FUNCTION_MODE
6293
+#define        FUNCTION_MODE   SImode
6294
+
6295
+/* STDC_0_IN_SYSTEM_HEADERS
6296
+ */
6297
+
6298
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6299
+ * file to be included at the start of all compilations, as if it had been
6300
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6301
+ * or if the header is not found, or if the user specifies -ffreestanding or
6302
+ * -nostdinc, no header is included.
6303
+ *
6304
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6305
+ * as NULL.
6306
+ */
6307
+#undef TARGET_C_PREINCLUDE
6308
+#define        TARGET_C_PREINCLUDE     NULL
6309
+
6310
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6311
+ * specific C++ implicit extern C functions.  If this function returns true
6312
+ * for the name of a file-scope function, that function implicitly gets extern
6313
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6314
+ * An example of such function is WinMain on Win32 targets.
6315
+ *
6316
+ * ZipCPU---Not ready to deal with this yet.
6317
+ */
6318
+
6319
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6320
+ * support C++ as well as C.  This macro inhibits the usual method of using
6321
+ * system header files in C++, which is to pretend that the file's contents
6322
+ * are enclosed in 'extern "C" {...}'.
6323
+ *
6324
+ *
6325
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6326
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6327
+ */
6328
+
6329
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6330
+ * target specific pragmas.
6331
+ *
6332
+ * ZipCPU --- let's not.
6333
+ */
6334
+
6335
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6336
+ * expanded in the arguments of #pragma pack().
6337
+ *
6338
+ * ZipCPU ... why?
6339
+ */
6340
+
6341
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6342
+ * default other than 0 (meaning the machine default), define this macro to
6343
+ * the necessary value (in bytes).  This must be a value that would also be
6344
+ * valid to use with #pragma pack() (that is a small power of two.
6345
+ */
6346
+
6347
+/* DOLLARS_IN_IDENTIFIERS
6348
+ * ZipCPU --- Default (not changing C)
6349
+ */
6350
+
6351
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6352
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6353
+ * in the delay slot of INSN, even if they appear to use a resource set or
6354
+ * clobbered in INSN.  INSN is always a ...
6355
+ *
6356
+ * ZipCPU --- You need not define this macro if it would always return zero.
6357
+ */
6358
+
6359
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6360
+ * that is nonzero if it is safe for the delay slot schedule to place
6361
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6362
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6363
+ * machines where some insn or jump_insn is really a function call and ...
6364
+ *
6365
+ * ZipCPU --- You need not define this macro if it would always return zero.
6366
+ */
6367
+
6368
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6369
+ * nonzero if, in some cases, global symbols from one translation unit may not
6370
+ * be bound to undefined symbols in another translation unit without user
6371
+ * intervention.  For instance, under Microsoft Windows symbols must be
6372
+ * explicitly imported from shared libraries (DLLs).
6373
+ *
6374
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6375
+ * so we won't.
6376
+ */
6377
+
6378
+/* TARGET_MD_ASM_ADJUST
6379
+ */
6380
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6381
+ * define this macro if the default of "m" is wrong.
6382
+ *
6383
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6384
+ * works doesn't sound like a problem.  Let's not define this.
6385
+ */
6386
+
6387
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6388
+ * variable that specifies where the linker should look for libraries.
6389
+ *
6390
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6391
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6392
+ * libraries.
6393
+ */
6394
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6395
+
6396
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6397
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6398
+ *
6399
+ * ZipCPU does not.
6400
+ */
6401
+
6402
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6403
+ * instructions to execute via conditional execution instructions instead of a
6404
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6405
+ * cc0 and 1 if it does use cc0.
6406
+ *
6407
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6408
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6409
+ * something else, so let's keep looking into this.
6410
+ */
6411
+
6412
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6413 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6414 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6415
+ * structure, struct ce_if_block, which contains information about the currently
6416
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6417
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6418
+ * or FALSE to a null pointer if the tests cannot be converted.
6419
+ *
6420
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6421
+ * execution and conditional testing capabilities.
6422
+ */
6423 122 dgisselq
+#define        IFCVT_MODIFY_TESTS(CI,TR,FL)    zip_ifcvt_modify_tests(CI,&TR,&FL)
6424 102 dgisselq
+
6425
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6426
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6427
+ * into conditions combined by and and or operations.  BB contains the basic
6428
+ * block that contains the test that is currently being processed and about to
6429
+ * be turned into a condition.
6430
+ *
6431
+ *
6432
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6433
+ * execution and conditional testing capabilities.
6434
+ */
6435
+// #warning "Need to come back to this."
6436 122 dgisselq
+#define        IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
6437 102 dgisselq
+
6438
+
6439
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6440
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6441
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6442
+ * information about the currently processed blocks.
6443
+ *
6444
+ *
6445
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6446
+ * execution and conditional testing capabilities.
6447
+ */
6448
+// #warning "Need to come back to this."
6449
+
6450
+
6451
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6452
+ * machine dependent modifications in converting code to conditional
6453
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6454
+ * structure pointed to be CEINFO.
6455
+ *
6456
+ *
6457
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6458
+ * execution and conditional testing capabilities.
6459
+ */
6460
+// #warning "Need to come back to this."
6461 122 dgisselq
+#define        IFCVT_MODIFY_FINAL(CEINFO)      zip_ifcvt_modify_final(CEINFO)
6462 102 dgisselq
+
6463
+
6464
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6465
+ * dependent modifications in converting code to conditional execution.  The
6466
+ * involved basic blocks can be found in the struct ce_if_block structure that
6467
+ * is pointed to by CEINFO.
6468
+ *
6469
+ *
6470
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6471
+ * execution and conditional testing capabilities.
6472
+ */
6473
+// #warning "Need to come back to this."
6474 122 dgisselq
+#define        IFCVT_MODIFY_CANCEL(CEINFO)     zip_ifcvt_modify_cancel(CEINFO)
6475 102 dgisselq
+
6476
+
6477
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6478
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6479
+ * that is pointed by CEINFO.
6480
+ *
6481
+ *
6482
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6483
+ * execution and conditional testing capabilities.
6484
+ */
6485
+// #warning "Need to come back to this."
6486 122 dgisselq
+#define        IFCVT_MACHDEP_INIT(CEINFO)      zip_ifcvt_machdep_init(CEINFO)
6487 102 dgisselq
+
6488
+
6489
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6490
+ * target specific pass over the instruction stream.  The compiler will run it
6491
+ * at all optimization levels, just before the point at which it normally does
6492
+ * delayed branch scheduling.
6493
+ *
6494
+ * You need not implement the hook if it has nothing to do.
6495
+ *
6496
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6497
+ * just get us started.
6498
+ */
6499
+
6500
+
6501
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6502
+ * specific builtin functions that need to be defined.  It should be a function
6503
+ * that performs the necessary setup.  Machine specific builtin functions can be
6504
+ * useful to expand special machine instructions that would otherwise not
6505
+ * normally be generated because they have no equivalent in the source language.
6506
+ *
6507
+ * To create a built in function, call the function lang_hooks.builtin_function
6508
+ * which is defined by the language front end.  You can use any type nodes
6509
+ * set up by build_common_tree_nodes; only language front ends that use those
6510
+ * two functions will call "TARGET_INIT_BUILTINS".
6511
+ *
6512
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6513
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6514
+ * restore_context(cstackregno).
6515
+ *
6516
+ */
6517
+#undef TARGET_INIT_BUILTINS
6518
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6519
+
6520
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6521
+ * machine specific builtin functions that need to be defined.  It should be a
6522
+ * function that returns the builtin function declaration for the builtin
6523
+ * function code code.  If there is no such builtin and it cannot be initialized
6524
+ * at this time if INITP is true the function should return NULL_TREE.  If
6525
+ * CODE is out of range the fucntion should return error-mark_node.
6526
+ *
6527
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6528
+ */
6529
+#undef TARGET_BUILTIN_DECL
6530
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6531
+
6532
+
6533
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6534
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6535
+ * TREE is the expression for the function call; the result should go to
6536
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6537
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6538
+ * non-zero if the value is to be ignored.  This function should return the
6539
+ * result of the call to the built-in function.
6540
+ *
6541
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6542
+ */
6543
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6544
+
6545
+
6546
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6547
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6548
+ *
6549
+ * ZipCPU --- not interested.
6550
+ */
6551
+/* TARGET_CHKP_BOUND_TYPE
6552
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6553
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6554
+ *
6555
+ * ZipCPU --- Same as last one.
6556
+ */
6557
+
6558
+
6559
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6560
+ * for a machine specific built-in function that was set up by
6561
+ * TARGET_INIT_BUILTINS.
6562
+ *
6563
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6564
+ * to then overload it?
6565
+ */
6566
+
6567
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6568
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6569
+ * is the declaration of the built-in function.  NARGS is the number of
6570
+ * arguments passed to the function; the arguments themselves are pointed to by
6571
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6572
+ * containing as simplified expression for the call's result.  If IGNORE is
6573
+ * true the value will be ignored.
6574
+ *
6575
+ * ZipCPU --- You know, this and the previous couple sound like something
6576
+ * whereby I might be able replace bit-reversal code with my bit reverse
6577
+ * instruction.  That would be very useful, but not necessary to get me
6578
+ * started.
6579
+ */
6580
+
6581
+/* TARGET_GIMPLE_FOLD_BUILTIN
6582
+ * TARGET_COMPARE_VERSION_PRIORITY
6583
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6584
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6585
+ * TARGET_CAN_USE_DOLOOP_P
6586
+ * TARGET_INVALID_WITHIN_DOOLOOP
6587
+ * TARGET_LEGITIMATE_COMBINED_INSN
6588
+ * TARGET_CAN_FOLLOW_JUMP
6589
+ * TARGET_COMMUTATIVE_P
6590
+ */
6591
+
6592
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6593
+ * register has been copied in a pseudo register, it is often not necessary
6594
+ * ...
6595
+ */
6596
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6597
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6598
+ * can use this hook to enhance precision of analysis for unspec and
6599
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6600
+ * elements of RTX in which case flags should be passed along.
6601
+ */
6602
+
6603
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6604
+ * it changes its current function context (CFUN).  You can define this
6605
+ * function if the back end needs to perform any initialization or reset
6606
+ * actions on a per-function basis.  For example, it may be used to implement
6607
+ * function attributes that affect register usage or code generation patterns.
6608
+ */
6609
+
6610
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6611
+ * suffix for object files on your target machine.  If you do not define this
6612
+ * macro, GCC will use ".o" as the suffix for object files.
6613
+ */
6614
+#define        TARGET_OBJECT_SUFFIX    ".o"
6615
+
6616
+/* TARGET_EXECUTABLE_SUFFIX
6617
+ */
6618
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6619
+
6620
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6621
+ * files specified on its command line and create an export list for the linker.
6622
+ * Define this macro for systems like AIX, where the linker discards object
6623
+ * files that are not referenced from main and uses export lists.
6624
+ *
6625
+ * ZipCPU --- shoudln't need this.
6626
+ */
6627
+
6628
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6629
+ * representing a variant of the method call mdecl, if Java Native Interface
6630
+ * (JNI) methods must be invoked differently from other methods on your
6631
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6632
+ * using the stdcall calling convention and this macro is then ...
6633
+ *
6634
+ * ZipCPU----Don't need this.  (yet)
6635
+ */
6636
+
6637
+
6638
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6639
+ * point in which a new jump instructions could be created.  On machines that
6640
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6641
+ * would typically be reload, so thiss target hook should be defined to a
6642
+ * function such as:
6643
+ *
6644 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6645
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6646
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6647
+ * fortch, preventing our comparison optimizations from being used.  By setting
6648
+ * this function appropriately, we can prevent it from reversing conditions into
6649
+ * conditions we don't support.
6650 102 dgisselq
+ */
6651 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6652 102 dgisselq
+
6653
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6654
+ * class for which branch target register optimizations should be applied.  All
6655
+ * registers in this class should be usable interchangably.  After reload,
6656
+ * registers in this class will be re-allocated and loads will be hoisted out of
6657
+ * loops and be subjected to inter-block scheduling.
6658
+ *
6659
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6660
+ */
6661
+
6662
+
6663
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6664
+ * optimization will by default exclude callee-saved registers that are not
6665
+ * already live during the current function.  If this target hook returns true,
6666
+ * they will be included.  The target code must then make sure that all target
6667
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6668
+ * be saved are saaved.
6669
+ *
6670
+ * ZipCPU---
6671
+ */
6672
+
6673
+
6674
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6675
+ * if the target supports conditional execution.  This target hook is required
6676
+ * only when the target has several different modes and they have different
6677
+ * conditional execution capability, such as ARM.
6678
+ *
6679
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6680
+ * long version load immediate ...)
6681
+ */
6682
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6683
+
6684
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6685
+ * emit a comparison instruction for the first compare in a sequence of
6686
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6687
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6688
+ * compare are saved in prep_seq and the compare instructions are saved in
6689
+ * gen_seq.  They will be emitted when all the compares in the conditional
6690
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6691
+ * for op0 and op1.
6692
+ *
6693
+ *
6694
+ * ZipCPU---???
6695
+ */
6696
+
6697
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6698
+ * prepares to emit a conditional comparison within a sequence of conditional
6699
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6700
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6701
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6702
+ * emitted when all the compares in the conditional comparison are generated
6703
+ * without error.  The pPREV expression is the result of a prior call to either
6704
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6705
+ * PREV and this comparison is not supported, otherwise the result must be the
6706
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6707
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6708
+ * on the compares.
6709
+ *
6710
+ *
6711
+ * ZipCPU --- ???
6712
+ */
6713
+
6714
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6715
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6716
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6717
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6718
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6719
+ *
6720
+ *
6721
+ * ZipCPU -- ???
6722
+ */
6723
+
6724
+
6725
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6726
+ * C expression that specifies the maximum number of floating point
6727
+ * multiplications that should be emitted when expanding exponentiation by an
6728
+ * integer constant inline.  When this value is defined, exponentiation
6729
+ * requiring more than this number of multiplications is implemented by calling
6730
+ * the system library's pow, powf, or powl routines.  The default value
6731
+ places no upper bound on the multiplication count.
6732
+ *
6733
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6734
+ * ready for this macro.
6735
+ */
6736
+
6737
+
6738
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6739
+ * register any extra include files for the target.  The parameter stdinc
6740
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6741
+ * system root directory.  The parameter PFX is the prefix for the GCC
6742
+ * directoiry.
6743
+ *
6744
+ *
6745
+ * ZipCPU---None yet.
6746
+ */
6747
+
6748
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6749
+ * register any extrra include files for the target before any standard headers.
6750
+ * The parameter stdinc indicates if normal include files are present.
6751
+ *
6752
+ * ZipCPU --- None.
6753
+ */
6754
+
6755
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6756
+ * for the target.  The parameter path is the integer to register.  On Darwin
6757
+ * systems, this is used for Framework includes, which have semantics that are
6758
+ * different from -I.
6759
+ *
6760
+ *
6761
+ * ZipCPU --- None.
6762
+ */
6763
+
6764
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6765
+ * safe to use a local alias for a virtual function FN when constructing
6766
+ * thunks, false otherwise.  By default, the macro returns true for all
6767
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6768
+ * false otherwise.
6769
+ *
6770
+ *
6771
+ * ZipCPU --- ???
6772
+ */
6773
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6774
+
6775
+
6776
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6777
+ * variable containing target-specific format checking information for the
6778
+ * -Wformat option.  The default is to have no target-specific format checks.
6779
+ *
6780
+ * ZipCPU --- Default
6781
+ */
6782
+
6783
+/* TARGET_N_FORMAT_TYPES
6784
+ *
6785
+ * ZipCPU --- Default
6786
+ */
6787
+
6788
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6789
+ * a global variable containing target-specific format overrides for the
6790
+ * -Wformat option.  The default is to have no target specific format overrides.
6791
+ *
6792
+ * ZipCPU --- Default
6793
+ */
6794
+
6795
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6796
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6797
+ *
6798
+ * If defined, the (first) macro is the name of a global variable containing
6799
+ * target-specific format overrides for the -Wformat option.
6800
+ */
6801
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6802
+ * optional initialization routine for target specific customizations of the
6803
+* system printf and scanf formatter settings.
6804
+ */
6805
+
6806
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6807
+ * macro returns the diagnostic message when it is illegal to pass an argument
6808
+ * VAL to function FN with prototype TLIST.
6809
+ *
6810
+ * ZipCPU---Default.
6811
+ */
6812
+
6813
+/* TARGET_INVALID_CONVERSION
6814
+ * TARGET_INVALID_UNARY_OP
6815
+ * TARGET_INVALID_BINARY_OP
6816
+ * TARGET_INVALID_PARAMETER_TYPE
6817
+ * TARGET_INVALID_RETURN_TYPE
6818
+ * TARGET_PROMOTED_TYPE
6819
+ * TARGET_CONVERT_TO_TYPE
6820
+ * TARGET_USE_JCR_SECTION_TYPE
6821
+ * OBJC_JBLEN
6822
+ * LIBGCC2_UNWIND_ATTRIBUTE
6823
+ * TARGET_UPDATE_STACK_BOUNDARY
6824
+ * TARGET_GET_DRAP_RTX
6825
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6826
+ */
6827
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6828
+ * instructions to synthesize a constant. If there is another constant already
6829
+ * in a register that is close enough in value then it is preferable that the
6830
+ * new constant is computed from the register using immediate addition or
6831
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6832
+ * constant we also add a lower and an upper constant anchor to the available
6833
+ * expressions.  These are then queried when encountering new constants.  The
6834
+ * anchors are computed by rounding the constant up and down to a multiple of
6835
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6836
+ * positive value accepted by immediate-add plus one.  We currently assume that
6837
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6838
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6839
+ * to 0x8000.  The default value is zero, which disables this optimization.
6840
+ *
6841
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6842
+ * access registers plus immediates.  To use this, we *need* this capability.
6843
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6844
+ * signed immediate offsets)
6845
+ *
6846
+ * On ZipCPU---2^17
6847
+ */
6848
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6849
+
6850
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6851
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6852
+ * if address Sanitizer is not supported by the target.
6853
+ */
6854
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6855
+
6856
+/* TARGET_MEMMODEL_CHECK
6857
+ */
6858
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6859
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6860
+ */
6861
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6862
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6863
+ * The default value of this hook is based on target's libc.
6864
+ */
6865
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6866
+
6867
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6868
+ * an appropriate alignment in bits for an atomic object of machine mode
6869
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6870
+ * is used.
6871
+ *
6872
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6873
+ */
6874
+
6875
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6876
+ * assignments that may raise floating-point exceptions to raise exceptions
6877
+ * corresponding to the arithmetic operation whose result was successfully
6878
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6879
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6880
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6881
+ * set *hold to an expression equivalent
6882
+ *
6883
+ * ZipCPU --- ???
6884
+ */
6885
+
6886
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6887
+ * the compilation unit and no named sections are available.  It is called once
6888
+ * for each symbol that must be recorded in the offload function and variable
6889
+ * table.
6890
+ *
6891
+ * ZipCPU --- Offloaded functions?
6892
+ */
6893
+
6894
+/* TARGET_OFFLOAD_OPTIONS
6895
+ *
6896
+ * ZipCPU---none defined
6897
+ */
6898
+
6899
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
6900
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
6901
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
6902
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
6903
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
6904
+ * HOST_WIDE_INT representation.
6905
+ *
6906
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
6907
+ * are wider than DImode ...)
6908
+ */
6909
+#define        TARGET_SUPPORTS_WIDE_INT        0
6910
+
6911
+
6912
+/* Now, for the prototype functions ...*/
6913
+// These have been moved to zip-protos.h
6914
+
6915
+// extern void zip_init_builtins(void);
6916
+// extern void zip_asm_output_anchor(rtx x);
6917
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
6918
+// extern void zip_asm_trampoline_template(FILE *);
6919
+// extern void zip_initial_elimination_offset(int from, int to);
6920
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
6921
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
6922
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
6923
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
6924
+// extern      int zip_address_operand(rtx op);
6925
+// extern      int zip_const_address_operand(rtx op);
6926
+// extern void zip_expand_prologue(void);
6927
+// extern void zip_expand_epilogue(void);
6928
+// extern bool zip_gen_move_rtl(rtx, rtx);
6929
+// extern bool zip_load_address_lod(rtx, rtx);
6930
+// extern bool zip_load_address_sto(rtx, rtx);
6931
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
6932
+// extern void zip_print_operand_address(FILE *fp, rtx x);
6933
+// extern bool zip_use_return_insn(void);
6934
+
6935 111 dgisselq
+#define        UQQmode USQmode
6936
+#define        UHQmode USQmode
6937
+#define        UHAmode USAmode
6938
+#define        QQmode  SQmode
6939
+#define        HQmode  SQmode
6940 102 dgisselq
+#define        QImode  SImode
6941
+#define        HImode  SImode
6942 111 dgisselq
+#define        QAmode  SAmode
6943
+#define        HAmode  SAmode
6944 102 dgisselq
+
6945
+#include "insn-modes.h"
6946
+#include "zip-protos.h"
6947
+
6948
+#endif /* GCC_ZIP_H */
6949
+
6950
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
6951
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
6952 138 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-05-04 11:07:24.042917943 -0400
6953
@@ -0,0 +1,3219 @@
6954 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6955
+;;
6956
+;; Filename:   zip.md
6957
+;;
6958
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
6959
+;;
6960
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
6961
+;;             GNU compiler collection (GCC).
6962
+;;
6963
+;;
6964
+;; Creator:    Dan Gisselquist, Ph.D.
6965
+;;             Gisselquist Technology, LLC
6966
+;;
6967
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6968
+;;
6969
+;; Copyright (C) 2015, Gisselquist Technology, LLC
6970
+;;
6971
+;; This program is free software (firmware): you can redistribute it and/or
6972
+;; modify it under the terms of  the GNU General Public License as published
6973
+;; by the Free Software Foundation, either version 3 of the License, or (at
6974
+;; your option) any later version.
6975
+;;
6976
+;; This program is distributed in the hope that it will be useful, but WITHOUT
6977
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
6978
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6979
+;; for more details.
6980
+;;
6981
+;; License:    GPL, v3, as defined and found on www.gnu.org,
6982
+;;             http://www.gnu.org/licenses/gpl.html
6983
+;;
6984
+;;
6985
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6986
+;;
6987
+;;
6988
+;; - Immediate integer operand constraints
6989
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
6990
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
6991
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
6992
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
6993
+;;     'R'     0...31                                          (Shift value)
6994
+;; - Memory constraints
6995 111 dgisselq
+;;     "Q"     Op-B capable references to memory
6996
+;;     "S"     References to constant memory
6997 102 dgisselq
+;; - Address constraints
6998 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
6999
+;;     "T"     Constant memory addresses
7000 102 dgisselq
+(define_constraint "M"
7001
+  "An 13-bit signed immediate such as a MOV instruction can handle"
7002
+  (and (match_code "const_int")
7003
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
7004
+(define_constraint "N"
7005
+  "An 14-bit signed immediate offset such as an Op-B register offset"
7006
+  (and (match_code "const_int")
7007
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
7008
+(define_constraint "O"
7009
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
7010
+  (and (match_code "const_int")
7011
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
7012
+(define_constraint "R"
7013
+  "Bits that a value may be shifted"
7014
+  (and (match_code "const_int")
7015
+       (match_test "(ival < 32) && (ival >= 0)")))
7016
+;;
7017
+;
7018
+;
7019
+; Our builtin functions, by identifier
7020
+;
7021
+(define_constants
7022 117 dgisselq
+       [(UNSPEC_RTU             1)
7023
+       (UNSPEC_HALT             2)
7024
+       (UNSPEC_IDLE             3)
7025
+       (UNSPEC_SYSCALL          4)
7026
+       (UNSPEC_SAVE_CONTEXT     5)
7027
+       (UNSPEC_RESTORE_CONTEXT  6)
7028
+       (UNSPEC_BITREV           7)
7029
+       (UNSPEC_GETUCC           8)
7030
+       (UNSPEC_GETCC            9)
7031
+       (UNSPEC_LDILO           10)
7032 127 dgisselq
+       ; (UNSPEC_RAW_CALL      11)
7033 102 dgisselq
+       ])
7034
+;
7035
+;
7036
+; Registers by name
7037
+(define_constants
7038
+  [(RTN_REG            0)      ; Return address register
7039
+   (RTNV_REG           1)      ; Subroutine return value register
7040
+   (AP_REG             10)     ; Hopefully never used
7041
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
7042
+   (FP_REG             12)
7043
+   (SP_REG             13)
7044
+   (CC_REG             14)
7045
+   (PC_REG             15)
7046
+  ])
7047
+;
7048
+;
7049
+;
7050
+
7051
+;; Predicates
7052
+(define_predicate "zip_const_address_operand_p"
7053
+       (match_code "symbol_ref,const,label_ref,code_label")
7054
+{
7055
+       return zip_const_address_operand(op);
7056
+})
7057
+
7058
+(define_predicate "zip_address_operand_p"
7059
+       (match_code "reg,plus")
7060
+{
7061 111 dgisselq
+       return zip_pd_opb_operand(op);
7062 102 dgisselq
+})
7063
+
7064 111 dgisselq
+(define_predicate "zip_opb_operand_p"
7065 122 dgisselq
+       (match_code "reg,plus,const_int,subreg")
7066 111 dgisselq
+{
7067
+       return zip_pd_opb_operand(op);
7068
+})
7069
+
7070 122 dgisselq
+(define_predicate "zip_opb_immv_p"
7071
+       (match_code "const_int")
7072
+{
7073
+       return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
7074
+})
7075
+
7076 111 dgisselq
+(define_predicate "zip_opb_single_operand_p"
7077 122 dgisselq
+       (match_code "reg,subreg,const_int")
7078 111 dgisselq
+{
7079
+       return zip_pd_opb_operand(op);
7080
+})
7081
+
7082 102 dgisselq
+(define_predicate "zip_mov_operand_p"
7083
+       (match_code "reg,plus")
7084
+{
7085
+       return zip_pd_mov_operand(op);
7086
+})
7087
+
7088
+(define_predicate "zip_memory_operand_p"
7089
+       (match_code "mem")
7090
+{
7091 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
7092 102 dgisselq
+})
7093
+
7094 111 dgisselq
+(define_predicate "zip_imm_operand_p"
7095
+       (match_code "const_int")
7096
+{
7097
+       return zip_pd_imm_operand(op);
7098
+})
7099
+
7100
+(define_predicate "zip_mvimm_operand_p"
7101
+       (match_code "const_int")
7102
+{
7103
+       return zip_pd_mvimm_operand(op);
7104
+})
7105
+
7106
+(define_predicate "zip_movdst_operand_p"
7107
+       (match_code "mem,reg,subreg")
7108
+{
7109
+       if (MEM_P(op)) // Check for valid store address
7110
+               return zip_pd_opb_operand(XEXP(op,0));
7111 122 dgisselq
+       else if (SUBREG_P(op))
7112
+               return 1;
7113
+       else if ((REG_P(op))||(SUBREG_P(op)))
7114
+               return register_operand(op, GET_MODE(op));
7115 111 dgisselq
+       return 1;
7116
+})
7117
+
7118
+(define_predicate "zip_movsrc_operand_p"
7119
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
7120
+{
7121
+       if (MEM_P(op))
7122
+               return zip_pd_opb_operand(XEXP(op,0));
7123
+       else if (GET_CODE(op)==PLUS)
7124
+               return zip_pd_opb_operand(op);
7125 122 dgisselq
+       else if (SUBREG_P(op)) {
7126
+               //; As far as predicates are concerned, subregs must be valid.
7127
+               //; The details of them are settled within the constraints.
7128
+               return 1;
7129
+       } else if ((REG_P(op))||(SUBREG_P(op)))
7130
+               return register_operand(op,SImode);
7131
+       else if (CONST_INT_P(op))
7132
+               return 1;
7133 111 dgisselq
+       return 1;
7134
+})
7135
+
7136 102 dgisselq
+;; Constraints
7137
+;
7138
+(define_memory_constraint "S"
7139
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7140
+       (and (match_code "mem")
7141
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7142
+(define_memory_constraint "Q"
7143
+       "Any memory addressed suitably for a load or store instruction"
7144
+       (and (match_code "mem")
7145
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7146
+(define_address_constraint "U"
7147
+       "An address suitable for a load or store instruction"
7148
+       (and (match_code "reg,plus")
7149
+               (match_test "zip_ct_address_operand(op)")))
7150
+(define_address_constraint "T"
7151
+       "Any constant address, to include those made by symbols unknown at compile time"
7152
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7153
+               (match_test "zip_ct_const_address_operand(op)")))
7154
+;
7155
+;
7156
+;; Attributes
7157
+;
7158
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7159
+(define_attr "conditional" "no,yes" (const_string "no"))
7160
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7161
+;
7162
+; Mode attributes
7163
+; (define_mode_iterator ZI [QI HI SI])
7164
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7165
+(define_mode_iterator ZI [SI])
7166
+(define_mode_attr zipa [(SI "")])
7167
+;
7168
+;
7169
+;
7170
+;; Instructions
7171
+;
7172
+; (define_insn
7173
+;      optional name
7174
+;      RTL template -- a vector of incomplete RTL expressions describing the
7175
+;              semantics of the instruction.  It is incomplete because it may
7176
+;              contain match_operand, match_operator, and match_dup expressions
7177
+;      The condition --- contains a C expression, may be an empty string
7178
+;      output template or output statement--fragment of C code returning a str
7179
+;      Attributes --
7180
+;      )
7181
+;
7182
+; (match_operand:m n predicate constraint)
7183
+;      Placeholder for operand #n of the instruction
7184
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7185
+;                              (expression, machine mode)
7186
+;              we can build functions:
7187
+;                      "isregister"    to describe a register
7188
+;                      "isimmediate"   to describe an immediate
7189
+;                      "offsetreg"     to describe a register plus offset
7190
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7191
+;              But ... functions "address_operand", "immediate_operand",
7192
+;                      "register_operand", "indirect_operand"
7193
+;              "comparison_operatot" and "ordered_comparison_operator"
7194
+;              are also available--be aware, they include more comparisons
7195
+;              than Zip CPU can do.
7196
+;
7197
+;
7198
+;
7199
+;
7200
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7201
+;;
7202
+;; Move instructions: both
7203
+;      (arbitrary) from variables to variables, but this gets
7204
+;              expanded into:
7205
+;      from registers to registers
7206
+;      from immediates to registers
7207
+;;
7208
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7209
+;
7210
+;
7211
+;
7212
+(define_expand "mov<mode>"
7213 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7214
+               (match_operand:ZI 1 "general_operand" ""))]
7215 102 dgisselq
+       ""
7216 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7217
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7218
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7219
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7220
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7221
+
7222
+       //; Need to load into a register between memory slots
7223
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7224
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7225
+               if (can_create_pseudo_p()) {
7226
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7227
+                       emit_insn(gen_movsi(tmp,operands[1]));
7228
+                       operands[1] = tmp;
7229
+               }
7230 102 dgisselq
+       }
7231 111 dgisselq
+
7232
+       //; Op[0] has a bad address, need to legitimize it
7233
+       if ((MEM_P(operands[0]))&&
7234
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7235
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7236
+               )
7237
+               {
7238
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7239
+               if (can_create_pseudo_p()) {
7240
+                       rtx tmp = gen_reg_rtx(Pmode);
7241
+                       //; Load the address into a register
7242
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7243
+                       XEXP(operands[0],0) = tmp;
7244
+                       mark_reg_pointer(tmp,1);
7245
+               }
7246
+       }
7247
+       //; Op[1] is a constant.  Need to load into a register before we can
7248
+       //; place it into memory.
7249
+       if ((MEM_P(operands[0]))&&
7250
+               ((CONSTANT_P(operands[1]))
7251
+               ||(CONST_INT_P(operands[1])))) {
7252
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7253
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7254
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7255
+               if (can_create_pseudo_p()) {
7256
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7257
+                       emit_insn(gen_movsi(tmp,operands[1]));
7258
+                       operands[1] = tmp;
7259
+               }
7260
+       }
7261
+       //; Op[1] has a bad address, need to legitimize it
7262
+       if ((MEM_P(operands[1]))&&
7263
+               //; (!REG_P(XEXP(operands[1],0)))
7264
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7265 122 dgisselq
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))) {
7266 111 dgisselq
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7267
+               if (can_create_pseudo_p()) {
7268
+                       rtx tmp = gen_reg_rtx(Pmode);
7269
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7270
+                       XEXP(operands[1],0) = tmp;
7271
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7272
+                       rtx tmp = operands[0];
7273
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7274
+                       XEXP(operands[1],0) = tmp;
7275
+               }
7276
+       }
7277
+       }
7278 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7279 111 dgisselq
+(define_insn "movsi_raw"
7280
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7281
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7282 122 dgisselq
+       "(register_operand(operands[0],SImode))||(register_operand(operands[1],SImode))"
7283 111 dgisselq
+       "@
7284
+       MOV\t%1,%0
7285
+       STO\t%1,%0
7286
+       LOD\t%1,%0
7287
+       LDI\t%1,%0"
7288
+       [(set_attr "ccresult" "unchanged")])
7289 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7290
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7291
+               (match_operand:ZI 1 "register_operand" "r"))]
7292
+       ""
7293
+       "MOV    %1,%0"
7294
+       [(set_attr "ccresult" "unchanged")])
7295 124 dgisselq
+(define_insn "mov<mode>_reg_off" ; Register to register move, used by prologue
7296 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7297
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7298 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7299
+               ]
7300 102 dgisselq
+       ""
7301
+       "MOV    %2(%1),%0"
7302
+       [(set_attr "ccresult" "unchanged")])
7303 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7304
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7305
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7306
+;      ""
7307
+;      "LOD    %1,%0"
7308
+;      [(set_attr "ccresult" "unchanged")])
7309
+;(define_insn "mov<mode>_sto"  ; Store into memory
7310
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7311
+;              (match_operand:ZI 1 "register_operand" "r"))]
7312
+;      ""
7313
+;      "STO    %1,%0"
7314
+;      [(set_attr "ccresult" "unchanged")])
7315
+(define_expand "mov<mode>_lod" ; Load from memory
7316 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7317
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7318 103 dgisselq
+       "")
7319
+(define_insn "*movsi_lod"
7320
+       [(set (match_operand:SI 0 "register_operand" "=r")
7321 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7322 102 dgisselq
+       ""
7323 103 dgisselq
+       "LOD\t%1,%0"
7324
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7325 124 dgisselq
+(define_insn "movsi_lod_off" ; used by epilogue code
7326
+       [(set (match_operand:SI 0 "register_operand" "=r")
7327
+               (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7328
+                       (match_operand:SI 2 "const_int_operand" "N"))))]
7329
+       ""
7330
+       "LOD\t%2(%1),%0"
7331
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7332 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7333 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7334
+               (match_operand:ZI 1 "register_operand" "r"))]
7335 103 dgisselq
+       "")
7336
+(define_insn "*movsi_sto"
7337 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7338 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7339 102 dgisselq
+       ""
7340 111 dgisselq
+       "STO\t%1,%0"
7341 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7342 124 dgisselq
+(define_insn "movsi_sto_off" ; used by prologue code
7343
+       [(set (mem:SI (plus:SI
7344
+                       (match_operand:SI 0 "register_operand" "r")
7345
+                       (match_operand:SI 1 "const_int_operand" "N")))
7346
+               (match_operand:SI 2 "register_operand" "r"))]
7347
+       ""
7348
+       "STO\t%2,%1(%0)"
7349
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7350 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7351
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7352
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7353
+       ""
7354
+       "LDI    %1,%0"
7355
+       [(set_attr "ccresult" "unchanged")])
7356
+;
7357
+;
7358
+;
7359
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7360
+;;
7361
+;; Load and store multiple values
7362
+;;
7363
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7364
+;
7365
+; So far, from the code I've seen from GCC's output,
7366
+; these instructions do not appear to be necessary.
7367
+;
7368
+;(define_insn "load_multiple"
7369
+;      for(a=0; a<%2; a++)
7370
+;              LOD a(%1),%0+a
7371
+;(define_insn "store_multiple"
7372
+;      for(a=0; a<%2; a++)
7373
+;              STO %0+a,a(%1)
7374
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7375
+;
7376
+;
7377
+;
7378
+;
7379
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7380
+;;
7381 127 dgisselq
+;; Substitution Pattern
7382
+;;
7383
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7384
+;
7385
+;
7386
+(define_subst "cc_substitution"
7387
+       ; The pattern may not have any match_dup expressions.
7388
+       [(set (match_operand:SI 0 "" "") (match_operand:SI 1 "" ""))
7389
+               (clobber (reg:CC CC_REG))]
7390
+       ""
7391
+       [(set (match_dup 0) (match_dup 1))
7392
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
7393
+       ])
7394
+;
7395
+(define_subst_attr "cc_subst" "cc_substitution" "_raw" "_clobber")
7396
+;
7397
+;
7398
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7399
+;;
7400 102 dgisselq
+;; General arithmetic instructions
7401
+;;
7402
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7403
+;
7404
+;
7405
+;
7406
+;
7407 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7408 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7409 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7410 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7411 127 dgisselq
+       ])
7412
+(define_insn_and_split "add<mode>3_split_reg"
7413
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7414
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7415
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7416
+       ""
7417
+       "#"     ; This code means the instruction *must* be split
7418
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7419
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1) (match_dup 2)))
7420
+               (clobber (reg:CC CC_REG))])]
7421
+       ""
7422
+       [(set_attr "predicable" "yes")])
7423
+(define_insn_and_split "add<mode>3_split_off"
7424
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7425
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7426
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7427
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7428
+       ""
7429
+       "#"     ; This code means the instruction *must* be split
7430
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7431
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1)
7432
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7433
+               (clobber (reg:CC CC_REG))])]
7434
+       ""
7435
+       [(set_attr "predicable" "yes")])
7436
+(define_insn "addsi3_reg_clobber"
7437 122 dgisselq
+       [(set (match_operand:SI 0 "register_operand" "=r")
7438
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7439
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7440 127 dgisselq
+       (clobber (reg:CC CC_REG))]
7441
+       ""
7442
+       "ADD    %2,%0"
7443
+       [(set_attr "ccresult" "set")])
7444
+(define_insn "addsi3_reg_raw"
7445
+       [(set (match_operand:SI 0 "register_operand" "=r")
7446
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7447
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7448 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7449 102 dgisselq
+       ""
7450
+       "ADD    %2,%0"
7451
+       [(set_attr "ccresult" "set")])
7452 127 dgisselq
+(define_insn "add<mode>3_off_raw"
7453 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7454 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7455
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7456 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7457
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7458 102 dgisselq
+       ""
7459
+       "ADD    %3+%2,%0"
7460
+       [(set_attr "ccresult" "set")])
7461 127 dgisselq
+(define_insn "add<mode>3_off_clobber"
7462
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7463
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7464
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7465
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7466
+       (clobber (reg:CC CC_REG))]
7467
+       ""
7468
+       "ADD    %3+%2,%0"
7469
+       [(set_attr "ccresult" "set")])
7470 102 dgisselq
+;
7471
+;
7472
+;
7473 103 dgisselq
+(define_expand "sub<mode>3"
7474 138 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7475 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7476 138 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7477 127 dgisselq
+(define_insn_and_split "sub<mode>3_split_reg"
7478 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7479
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7480 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7481
+       ""
7482
+       "#"
7483
+       "(reload_completed)"
7484
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1) (match_dup 2)))
7485
+       (clobber (reg:CC CC_REG))])]
7486
+       ""
7487 138 dgisselq
+       [(set_attr "ccresult" "set") (set_attr "predicable" "yes")])
7488 127 dgisselq
+(define_insn "sub<mode>3_reg_raw"
7489
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7490
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7491 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7492 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7493 102 dgisselq
+       ""
7494
+       "SUB    %2,%0"
7495
+       [(set_attr "ccresult" "set")])
7496 127 dgisselq
+(define_insn "sub<mode>3_reg_clobber"
7497 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7498 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7499 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7500
+       (clobber (reg:CC CC_REG))]
7501
+       ""
7502
+       "SUB    %2,%0"
7503
+       [(set_attr "ccresult" "set")])
7504
+(define_insn_and_split "sub<mode>3_off_split"
7505
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7506
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7507 103 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7508 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7509
+       ""
7510
+       "#"
7511
+       "(reload_completed)"
7512
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1)
7513
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7514
+       (clobber (reg:CC CC_REG))])]
7515
+       ""
7516
+       [(set_attr "ccresult" "set")])
7517
+(define_insn "sub<mode>3_off_raw"
7518
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7519
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7520
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7521 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7522
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7523 102 dgisselq
+       ""
7524
+       "SUB    %3+%2,%0"
7525
+       [(set_attr "ccresult" "set")])
7526 127 dgisselq
+(define_insn "sub<mode>3_off_clobber"
7527
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7528
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7529
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7530
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7531
+       (clobber (reg:CC CC_REG))]
7532
+       ""
7533
+       "SUB    %3+%2,%0"
7534
+       [(set_attr "ccresult" "set")])
7535 138 dgisselq
+(define_insn "mul<mode>3_oldstyle"
7536 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7537
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7538
+                       (match_operand:ZI 2 "register_operand" "r")))
7539 122 dgisselq
+       (clobber (match_scratch:ZI 3 "=r"))
7540
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7541 102 dgisselq
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7542 138 dgisselq
+       "(!ZIP_LONGMPY)"
7543 102 dgisselq
+       "MOV    %1,%0
7544
+       MPYS    %2,%0
7545
+       MOV     %1,%3
7546
+       ROL     16,%3
7547
+       MPYS    %2,%3
7548
+       ROL     16,%3
7549
+       AND     0x0ffff,%3
7550
+       ADD     %3,%0
7551
+       MOV     %2,%3
7552
+       ROL     16,%3
7553
+       MPYS    %1,%3
7554
+       ROL     16,%3
7555
+       AND     0x0ffff,%3
7556
+       ADD     %3,%0"
7557
+       [(set_attr "ccresult" "unknown")])
7558 138 dgisselq
+;
7559
+;
7560
+(define_expand "mul<mode>3"
7561
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7562
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7563
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7564
+       "(ZIP_LONGMPY)")
7565
+(define_insn_and_split "mul<mode>3_split_reg"
7566
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7567
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7568
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7569
+       "(ZIP_LONGMPY)"
7570
+       "#"
7571
+       "(reload_completed)"
7572
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1) (match_dup 2)))
7573
+       (clobber (reg:CC CC_REG))])]
7574
+       ""
7575
+       [(set_attr "ccresult" "set")])
7576
+(define_insn_and_split "mul<mode>3_split_off"
7577
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7578
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7579
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7580
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7581
+       "(ZIP_LONGMPY)"
7582
+       "#"
7583
+       "(reload_completed)"
7584
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1)
7585
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7586
+       (clobber (reg:CC CC_REG))])]
7587
+       ""
7588
+       [(set_attr "ccresult" "set")])
7589
+(define_insn "mul<mode>3_reg_clobber"
7590
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7591
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7592
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7593
+       (clobber (reg:CC CC_REG))]
7594
+       "(ZIP_LONGMPY)"
7595
+       "MPY\t%2,%0"
7596
+       [(set_attr "ccresult" "set")])
7597
+(define_insn "mul<mode>3_reg_raw"
7598
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7599
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7600
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7601
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7602
+       "(ZIP_LONGMPY)"
7603
+       "MPY\t%2,%0"
7604
+       [(set_attr "ccresult" "set")])
7605
+(define_insn "mul<mode>3_off_raw"
7606
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7607
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7608
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7609
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7610
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7611
+       "(ZIP_LONGMPY)"
7612
+       "MPY\t%3+%2,%0"
7613
+       [(set_attr "ccresult" "set")])
7614
+(define_insn "mul<mode>3_off_clobber"
7615
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7616
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7617
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7618
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7619
+       (clobber (reg:CC CC_REG))]
7620
+       "(ZIP_LONGMPY)"
7621
+       "MPY\t%3+%2,%0"
7622
+       [(set_attr "ccresult" "set")])
7623
+;
7624
+;
7625
+(define_expand "smulsi3_highpart"
7626
+       [(set (match_operand:SI 0 "register_operand" "=r")
7627
+           (truncate:SI (ashiftrt:DI (mult:DI
7628
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7629
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7630
+               (const_int 32))))]
7631
+       "(ZIP_LONGMPY)")
7632
+(define_insn_and_split "smulsi3_highpart_split_reg"
7633
+       [(set (match_operand:SI 0 "register_operand" "=r")
7634
+           (truncate:SI (ashiftrt:DI (mult:DI
7635
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7636
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7637
+               (const_int 32))))]
7638
+       "(ZIP_LONGMPY)"
7639
+       "#"
7640
+       "(reload_completed)"
7641
+       [(parallel [(set (match_dup 0)
7642
+               (truncate:SI (ashiftrt:DI
7643
+                       (mult:DI
7644
+                               (sign_extend:DI (match_dup 1))
7645
+                               (sign_extend:DI (match_dup 2)))
7646
+                       (const_int 32))))
7647
+       (clobber (reg:CC CC_REG))])]
7648
+       ""
7649
+       [(set_attr "ccresult" "set")])
7650
+(define_insn_and_split "smulsi3_highpart_split_off"
7651
+       [(set (match_operand:SI 0 "register_operand" "=r")
7652
+          (truncate:SI (ashift:DI (mult:DI
7653
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7654
+               (sign_extend:DI
7655
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7656
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7657
+                       (const_int 32))))]
7658
+       "(ZIP_LONGMPY)"
7659
+       "#"
7660
+       "(reload_completed)"
7661
+       [(parallel [(set (match_dup 0)
7662
+               (truncate:SI (ashiftrt:DI
7663
+                       (mult:SI
7664
+                               (sign_extend:DI (match_dup 1))
7665
+                               (sign_extend:DI
7666
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7667
+                       (const_int 32))))
7668
+       (clobber (reg:CC CC_REG))])]
7669
+       ""
7670
+       [(set_attr "ccresult" "set")])
7671
+(define_insn "smulsi3_highpart_reg_clobber"
7672
+       [(set (match_operand:SI 0 "register_operand" "=r")
7673
+            (truncate:SI (ashiftrt:DI
7674
+               (mult:SI
7675
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7676
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7677
+               (const_int 32))))
7678
+       (clobber (reg:CC CC_REG))]
7679
+       "(ZIP_LONGMPY)"
7680
+       "MPYSHI\t%2,%0"
7681
+       [(set_attr "ccresult" "set")])
7682
+(define_insn "smulsi3_highpart_reg_raw"
7683
+       [(set (match_operand:SI 0 "register_operand" "=r")
7684
+           (truncate:SI (ashiftrt:DI
7685
+               (mult:SI
7686
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7687
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7688
+               (const_int 32))))
7689
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7690
+       "(ZIP_LONGMPY)"
7691
+       "MPYSHI\t%2,%0"
7692
+       [(set_attr "ccresult" "set")])
7693
+(define_insn "smulsi3_highpart_off_raw"
7694
+       [(set (match_operand:SI 0 "register_operand" "=r")
7695
+           (truncate:SI (ashiftrt:DI
7696
+               (mult:SI
7697
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7698
+                 (sign_extend:DI (plus:SI
7699
+                               (match_operand:SI 2 "register_operand" "r")
7700
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7701
+               (const_int 32))))
7702
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7703
+       "(ZIP_LONGMPY)"
7704
+       "MPYSHI\t%3+%2,%0"
7705
+       [(set_attr "ccresult" "set")])
7706
+(define_insn "smulsi3_highpart_off_clobber"
7707
+       [(set (match_operand:SI 0 "register_operand" "=r")
7708
+           (truncate:SI (ashiftrt:DI
7709
+               (mult:SI
7710
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7711
+                 (sign_extend:DI (plus:SI
7712
+                       (match_operand:SI 2 "register_operand" "r")
7713
+                       (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7714
+               (const_int 32))))
7715
+       (clobber (reg:CC CC_REG))]
7716
+       "(ZIP_LONGMPY)"
7717
+       "MPYSHI\t%3+%2,%0"
7718
+       [(set_attr "ccresult" "set")])
7719
+;
7720
+;
7721
+(define_expand "umulsi3_highpart"
7722
+       [(set (match_operand:SI 0 "register_operand" "=r")
7723
+           (truncate:SI (ashiftrt:DI (mult:DI
7724
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7725
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7726
+               (const_int 32))))]
7727
+       "(ZIP_LONGMPY)")
7728
+(define_insn_and_split "umulsi3_highpart_split_reg"
7729
+       [(set (match_operand:SI 0 "register_operand" "=r")
7730
+           (truncate:SI (ashiftrt:DI (mult:DI
7731
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7732
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7733
+               (const_int 32))))]
7734
+       "(ZIP_LONGMPY)"
7735
+       "#"
7736
+       "(reload_completed)"
7737
+       [(parallel [(set (match_dup 0)
7738
+               (truncate:SI (ashiftrt:DI
7739
+                       (mult:SI
7740
+                               (zero_extend:DI (match_dup 1))
7741
+                               (zero_extend:DI (match_dup 2)))
7742
+                       (const_int 32))))
7743
+       (clobber (reg:CC CC_REG))])]
7744
+       ""
7745
+       [(set_attr "ccresult" "set")])
7746
+(define_insn_and_split "umulsi3_highpart_split_off"
7747
+       [(set (match_operand:SI 0 "register_operand" "=r")
7748
+               (truncate:SI (ashiftrt:DI
7749
+               (mult:DI
7750
+                 (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7751
+                 (zero_extend:DI
7752
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7753
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7754
+               (const_int 32))))]
7755
+       "(ZIP_LONGMPY)"
7756
+       "#"
7757
+       "(reload_completed)"
7758
+       [(parallel [(set (match_dup 0)
7759
+               (truncate:SI (ashiftrt:DI
7760
+                       (mult:DI
7761
+                               (zero_extend:DI (match_dup 1))
7762
+                               (zero_extend:DI
7763
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7764
+                       (const_int 32))))
7765
+       (clobber (reg:CC CC_REG))])]
7766
+       ""
7767
+       [(set_attr "ccresult" "set")])
7768
+(define_insn "umulsi3_highpart_reg_clobber"
7769
+       [(set (match_operand:SI 0 "register_operand" "=r")
7770
+           (truncate:SI (ashiftrt:DI
7771
+               (mult:DI
7772
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7773
+                   (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7774
+               (const_int 32))))
7775
+       (clobber (reg:CC CC_REG))]
7776
+       "(ZIP_LONGMPY)"
7777
+       "MPYSHI\t%2,%0"
7778
+       [(set_attr "ccresult" "set")])
7779
+(define_insn "umulsi3_highpart_reg_raw"
7780
+       [(set (match_operand:SI 0 "register_operand" "=r")
7781
+           (truncate:SI (ashiftrt:DI
7782
+               (mult:DI
7783
+                  (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7784
+                  (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7785
+               (const_int 32))))
7786
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7787
+       "(ZIP_LONGMPY)"
7788
+       "MPYSHI\t%2,%0"
7789
+       [(set_attr "ccresult" "set")])
7790
+(define_insn "umulsi3_highpart_off_raw"
7791
+       [(set (match_operand:SI 0 "register_operand" "=r")
7792
+           (truncate:SI (ashiftrt:DI
7793
+               (mult:DI
7794
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7795
+                   (zero_extend:DI (plus:SI
7796
+                               (match_operand:SI 2 "register_operand" "r")
7797
+                               (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7798
+               (const_int 32))))
7799
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7800
+       "(ZIP_LONGMPY)"
7801
+       "MPYSHI\t%3+%2,%0"
7802
+       [(set_attr "ccresult" "set")])
7803
+(define_insn "umulsi3_highpart_off_clobber"
7804
+       [(set (match_operand:SI 0 "register_operand" "=r")
7805
+           (truncate:SI (ashiftrt:DI
7806
+               (mult:DI
7807
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7808
+                   (zero_extend:DI (plus:SI
7809
+                       (match_operand:SI 2 "register_operand" "r")
7810
+                       (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7811
+               (const_int 32))))
7812
+       (clobber (reg:CC CC_REG))]
7813
+       "(ZIP_LONGMPY)"
7814
+       "MPYSHI\t%3+%2,%0"
7815
+       [(set_attr "ccresult" "set")])
7816
+;
7817
+;
7818 111 dgisselq
+(define_expand "div<mode>3"
7819 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7820 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7821 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7822
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7823 111 dgisselq
+       "(ZIP_DIVIDE)")
7824
+(define_insn "div<mode>3_reg"
7825
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7826
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7827 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7828
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7829 111 dgisselq
+       "(ZIP_DIVIDE)"
7830 102 dgisselq
+       "DIVS   %2,%0"
7831
+       [(set_attr "ccresult" "set")])
7832
+(define_insn "div<mode>3_off"
7833
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7834 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7835
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7836 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7837
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7838 111 dgisselq
+       "(ZIP_DIVIDE)"
7839 102 dgisselq
+       "DIVS   %3+%2,%0"
7840
+       [(set_attr "ccresult" "set")])
7841 111 dgisselq
+(define_expand "udiv<mode>3"
7842 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7843 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7844 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7845
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7846 111 dgisselq
+       "(ZIP_DIVIDE)")
7847
+(define_insn "udiv<mode>3_reg"
7848
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7849
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7850 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7851
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7852 111 dgisselq
+       "(ZIP_DIVIDE)"
7853 102 dgisselq
+       "DIVU   %2,%0"
7854
+       [(set_attr "ccresult" "set")])
7855
+(define_insn "udiv<mode>3_off"
7856
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7857 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7858
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7859 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7860
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7861 111 dgisselq
+       "(ZIP_DIVIDE)"
7862 102 dgisselq
+       "DIVU   %3+%2,%0"
7863
+       [(set_attr "ccresult" "set")])
7864
+;;
7865
+;; modsi3
7866
+;; umodsi3
7867
+;;
7868
+(define_insn "umin<mode>3"
7869
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7870
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7871
+                       (match_operand:ZI 2 "register_operand" "r")))
7872 122 dgisselq
+       (clobber (reg:CC CC_REG))
7873 102 dgisselq
+       ]
7874
+       ""
7875
+       "CMP    %0,%2
7876
+       MOV.C   %2,%0"
7877
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7878
+(define_insn "umax<mode>3"
7879
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7880
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7881
+                       (match_operand:ZI 2 "register_operand" "r")))
7882 122 dgisselq
+       (clobber (reg:CC CC_REG))
7883 102 dgisselq
+       ]
7884
+       ""
7885
+       "CMP    %2,%0
7886
+       MOV.C   %2,%0"
7887
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7888
+(define_insn "smin<mode>3"
7889
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7890
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
7891
+                       (match_operand:ZI 2 "register_operand" "r")))
7892 122 dgisselq
+       (clobber (reg:CC CC_REG))
7893 102 dgisselq
+       ]
7894
+       ""
7895
+       "CMP    %2,%0
7896
+       MOV.GT  %2,%0"
7897
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7898
+(define_insn "smax<mode>3"
7899
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7900
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
7901
+                       (match_operand:ZI 2 "register_operand" "r")))
7902 122 dgisselq
+       (clobber (reg:CC CC_REG))
7903 102 dgisselq
+       ]
7904
+       ""
7905
+       "CMP    %0,%2
7906
+       MOV.LT  %2,%0"
7907
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7908 127 dgisselq
+;
7909
+;
7910 111 dgisselq
+(define_expand "and<mode>3"
7911 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7912 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7913 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7914
+(define_insn_and_split "and<mode>3_reg_split"
7915 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7916
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7917 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7918
+       ""
7919
+       "#"
7920
+       "(reload_completed)"
7921
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1) (match_dup 2)))
7922
+       (clobber (reg:CC CC_REG))])]
7923
+       ""
7924
+       [(set_attr "ccresult" "set")])
7925
+(define_insn "and<mode>3_reg_raw"
7926
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7927
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7928 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7929
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7930 102 dgisselq
+       ""
7931
+       "AND    %2,%0"
7932
+       [(set_attr "ccresult" "set")])
7933 127 dgisselq
+(define_insn "and<mode>3_reg_clobber"
7934 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7935 127 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7936
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7937
+       (clobber (reg:CC CC_REG))]
7938
+       ""
7939
+       "AND    %2,%0"
7940
+       [(set_attr "ccresult" "set")])
7941
+(define_insn_and_split "and<mode>3_off_split"
7942
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7943 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7944
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7945 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7946
+       ""
7947
+       "#"
7948
+       "(reload_completed)"
7949
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1)
7950
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7951
+       (clobber (reg:CC CC_REG))])]
7952
+       ""
7953
+       [(set_attr "ccresult" "set")])
7954
+(define_insn "and<mode>3_off_raw"
7955
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7956
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7957
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7958 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7959
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7960 102 dgisselq
+       ""
7961
+       "AND    %3+%2,%0"
7962
+       [(set_attr "ccresult" "set")])
7963 127 dgisselq
+(define_insn "and<mode>3_off_clobber"
7964
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7965
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7966
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7967
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7968
+       (clobber (reg:CC CC_REG))]
7969
+       ""
7970
+       "AND    %3+%2,%0"
7971
+       [(set_attr "ccresult" "set")])
7972
+;
7973
+;
7974 111 dgisselq
+(define_expand "ior<mode>3"
7975 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7976 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7977 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7978
+(define_insn_and_split "ior<mode>3_reg_split"
7979 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7980
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7981 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7982
+       ""
7983
+       "#"
7984
+       "(reload_completed)"
7985
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1) (match_dup 2)))
7986
+       (clobber (reg:CC CC_REG))])]
7987
+       ""
7988
+       [(set_attr "ccresult" "set")])
7989
+(define_insn "ior<mode>3_reg_raw"
7990
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7991
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7992 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7993
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7994 102 dgisselq
+       ""
7995
+       "OR     %2,%0"
7996
+       [(set_attr "ccresult" "set")])
7997 127 dgisselq
+(define_insn "ior<mode>3_reg_clobber"
7998 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7999 127 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8000
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8001
+       (clobber (reg:CC CC_REG))]
8002
+       ""
8003
+       "OR     %2,%0"
8004
+       [(set_attr "ccresult" "set")])
8005
+(define_insn_and_split "ior<mode>3_off_split"
8006
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8007 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8008
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8009 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8010
+       ""
8011
+       "#"
8012
+       "(reload_completed)"
8013
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1)
8014
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8015
+       (clobber (reg:CC CC_REG))])]
8016
+       ""
8017
+       [(set_attr "ccresult" "set")])
8018
+(define_insn "ior<mode>3_off_raw"
8019
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8020
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8021
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8022 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8023
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8024 102 dgisselq
+       ""
8025
+       "OR     %3+%2,%0"
8026
+       [(set_attr "ccresult" "set")])
8027 127 dgisselq
+(define_insn "ior<mode>3_off_clobber"
8028
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8029
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8030
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8031
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8032
+       (clobber (reg:CC CC_REG))]
8033
+       ""
8034
+       "OR     %3+%2,%0"
8035
+       [(set_attr "ccresult" "set")])
8036
+;
8037
+;
8038
+;
8039 111 dgisselq
+(define_expand "xor<mode>3"
8040 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8041 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8042 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
8043
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
8044
+       "")
8045 127 dgisselq
+(define_insn_and_split "xor<mode>3_reg_split"
8046 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8047
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8048 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8049
+       ""
8050
+       "#"
8051
+       "(reload_completed)"
8052
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1) (match_dup 2)))
8053
+       (clobber (reg:CC CC_REG))])]
8054
+       ""
8055
+       [(set_attr "ccresult" "set")])
8056
+(define_insn "xor<mode>3_reg_raw"
8057
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8058
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8059 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8060
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8061 102 dgisselq
+       ""
8062
+       "XOR    %2,%0"
8063
+       [(set_attr "ccresult" "set")])
8064 127 dgisselq
+(define_insn "xor<mode>3_reg_clobber"
8065 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8066 127 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8067
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8068
+       (clobber (reg:CC CC_REG))]
8069
+       ""
8070
+       "XOR    %2,%0"
8071
+       [(set_attr "ccresult" "set")])
8072
+(define_insn_and_split "xor<mode>3_off_split"
8073
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8074 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8075
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8076 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8077
+       ""
8078
+       "#"
8079
+       "(reload_completed)"
8080
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1)
8081
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8082
+       (clobber (reg:CC CC_REG))])]
8083
+       ""
8084
+       [(set_attr "ccresult" "set")])
8085
+(define_insn "xor<mode>3_off_raw"
8086
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8087
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8088
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8089 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8090
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8091 102 dgisselq
+       ""
8092
+       "XOR    %3+%2,%0"
8093
+       [(set_attr "ccresult" "set")])
8094 127 dgisselq
+(define_insn "xor<mode>3_off_clobber"
8095
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8096
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8097
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8098
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8099
+       (clobber (reg:CC CC_REG))]
8100
+       ""
8101
+       "XOR    %3+%2,%0"
8102
+       [(set_attr "ccresult" "set")])
8103 102 dgisselq
+;(define_insn "addv<mode>4"
8104
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
8105
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
8106
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
8107 122 dgisselq
+       ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8108 102 dgisselq
+                       ;(label_ref (match_operand 3))
8109
+                       ;(pc)))]
8110
+       ;""
8111
+       ;"MOV   %1,%0
8112
+       ;ADD    %2,%0
8113
+       ;BV     %3"
8114
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8115
+;;(define_insn "subvsi4"
8116
+;;     MOV     %1,%0
8117
+;;     SUB     %2,%0
8118
+;;     BV      %3
8119
+;;(mulvsi4)
8120
+;;(define_insn "uaddvsi4"
8121
+;;     ADD     %2,%0
8122
+;;     BC      %3
8123
+;;(define_insn "usubvsi4"
8124
+;;     MOV     %1,%0
8125
+;;     SUB     %2,%0
8126
+;;     BC      %3
8127
+;;
8128
+;; (define_insn "umulvsi4"
8129
+;;     ... ???)
8130
+;;
8131 127 dgisselq
+(define_expand "ashr<mode>3"
8132 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8133
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8134 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8135
+(define_insn_and_split "ashr<mode>3_split"
8136
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8137
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8138
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8139
+       ""
8140
+       "#"
8141
+       "(reload_completed)"
8142
+       [(parallel [(set (match_dup 0) (ashiftrt:ZI (match_dup 1) (match_dup 2)))
8143
+       (clobber (reg:CC CC_REG))])]
8144
+       ""
8145
+       [(set_attr "ccresult" "set")])
8146
+(define_insn "ashr<mode>3_raw"
8147
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8148
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8149 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8150
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8151 102 dgisselq
+       ""
8152
+       "ASR    %2,%0"
8153
+       [(set_attr "ccresult" "set")])
8154 127 dgisselq
+(define_insn "ashr<mode>3_clobber"
8155 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8156 127 dgisselq
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8157
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8158
+       (clobber (reg:CC CC_REG))]
8159
+       ""
8160
+       "ASR    %2,%0"
8161
+       [(set_attr "ccresult" "set")])
8162
+;
8163
+;
8164
+(define_expand "ashl<mode>3"
8165
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8166 111 dgisselq
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8167 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8168
+(define_insn_and_split "ashl<mode>3_split"
8169
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8170
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8171
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8172
+       ""
8173
+       "#"
8174
+       "(reload_completed)"
8175
+       [(parallel [(set (match_dup 0) (ashift:ZI (match_dup 1) (match_dup 2)))
8176
+       (clobber (reg:CC CC_REG))])]
8177
+       ""
8178
+       [(set_attr "ccresult" "set")])
8179
+(define_insn "ashl<mode>3_raw"
8180
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8181
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8182 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8183
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8184 111 dgisselq
+       ""
8185 122 dgisselq
+       "LSL    %2,%0"
8186 111 dgisselq
+       [(set_attr "ccresult" "set")])
8187 127 dgisselq
+(define_insn "ashl<mode>3_clobber"
8188 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8189 127 dgisselq
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8190
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8191
+       (clobber (reg:CC CC_REG))]
8192
+       ""
8193
+       "LSL    %2,%0"
8194
+       [(set_attr "ccresult" "set")])
8195
+;
8196
+;
8197
+(define_expand "lshr<mode>3"
8198
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8199 102 dgisselq
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8200 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8201
+(define_insn_and_split "lshr<mode>3_split"
8202
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8203
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8204
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8205
+       ""
8206
+       "#"
8207
+       "(reload_completed)"
8208
+       [(parallel [(set (match_dup 0) (lshiftrt:ZI (match_dup 1) (match_dup 2)))
8209
+       (clobber (reg:CC CC_REG))])]
8210
+       ""
8211
+       [(set_attr "ccresult" "set")])
8212
+(define_insn "lshr<mode>3_raw"
8213
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8214
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8215
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8216 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8217 102 dgisselq
+       ""
8218
+       "LSR    %2,%0"
8219
+       [(set_attr "ccresult" "set")])
8220 127 dgisselq
+(define_insn "lshr<mode>3_clobber"
8221 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8222 127 dgisselq
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8223
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8224
+       (clobber (reg:CC CC_REG))]
8225
+       ""
8226
+       "LSR    %2,%0"
8227
+       [(set_attr "ccresult" "set")])
8228
+;
8229
+;
8230
+(define_expand "rotl<mode>3"
8231
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8232 102 dgisselq
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8233 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8234
+(define_insn_and_split "rotl<mode>3_split"
8235
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8236
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8237
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8238
+       ""
8239
+       "#"
8240
+       "(reload_completed)"
8241
+       [(parallel [(set (match_dup 0) (rotate:ZI (match_dup 1) (match_dup 2)))
8242
+       (clobber (reg:CC CC_REG))])]
8243
+       ""
8244
+       [(set_attr "ccresult" "set")])
8245
+(define_insn "rotl<mode>3_raw"
8246
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8247
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8248 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8249
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8250 102 dgisselq
+       ""
8251
+       "ROL    %2,%0"
8252
+       [(set_attr "ccresult" "set")])
8253 127 dgisselq
+(define_insn "rotl<mode>3_clobber"
8254
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8255
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8256
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8257
+       (clobber (reg:CC CC_REG))]
8258
+       ""
8259
+       "ROL    %2,%0"
8260
+       [(set_attr "ccresult" "set")])
8261 102 dgisselq
+;
8262 127 dgisselq
+;
8263
+;
8264 102 dgisselq
+(define_insn "neg<mode>2"
8265
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8266
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
8267 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8268 102 dgisselq
+       ""
8269
+       "NEG    %1,%0"
8270
+       [(set_attr "ccresult" "validzn")])
8271
+(define_insn "abs<mode>2"
8272
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8273
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
8274 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8275 102 dgisselq
+       ""
8276
+       "TEST   %0
8277
+       NEG.LT  %0"
8278
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8279
+(define_insn "popcount<mode>2"
8280
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8281
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8282 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8283 102 dgisselq
+       ""
8284
+       "POPC   %1,%0"
8285
+       [(set_attr "ccresult" "set")])
8286
+(define_expand "parity<mode>2"
8287 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8288 102 dgisselq
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8289 127 dgisselq
+               (clobber (reg:CC CC_REG))])
8290 122 dgisselq
+       (parallel [
8291
+               (set (match_dup 0) (and:ZI (match_dup 0) (const_int -2)))
8292
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
8293 102 dgisselq
+       ])
8294
+(define_insn "one_cmpl<mode>2"
8295
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8296
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
8297 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8298 102 dgisselq
+       ""
8299
+       "XOR    -1,%0"
8300
+       [(set_attr "ccresult" "set")])
8301
+;
8302
+;
8303
+;
8304
+;
8305 117 dgisselq
+;
8306 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8307
+;;
8308
+;; General arithmetic instructions -- double words
8309
+;;
8310
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8311
+;
8312
+;
8313
+;
8314 111 dgisselq
+(define_expand "movdi3"
8315
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
8316
+               (match_operand:DI 1 "general_operand" ""))])
8317
+(define_insn "movdi_lod"
8318
+       [(set (match_operand:DI 0 "register_operand" "=r")
8319 122 dgisselq
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "")))]
8320 111 dgisselq
+       ""
8321
+       {
8322 122 dgisselq
+               if (REG_P(operands[1]))
8323 111 dgisselq
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
8324 122 dgisselq
+               else if (GET_CODE(operands[1])==PLUS) {
8325
+                       if ((REG_P(XEXP(operands[1],0)))
8326
+                               &&(CONST_INT_P(XEXP(operands[1],1)))) {
8327 111 dgisselq
+                               static  char    buf[64];
8328
+                               sprintf(buf,
8329
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
8330 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[1],1)),
8331
+                                       (long)INTVAL(XEXP(operands[1],1)+1));
8332 111 dgisselq
+                               return buf;
8333
+                       }
8334 122 dgisselq
+               } return "BREAK";
8335 111 dgisselq
+       }
8336
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8337
+(define_insn "movdi_sto"
8338
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
8339
+               (match_operand:DI 1 "register_operand" "r"))]
8340
+       ""
8341
+       {
8342
+               if (REG_P(operands[0]))
8343
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
8344
+               else if (GET_CODE(operands[0])==PLUS) {
8345
+                       if ((REG_P(XEXP(operands[0],0)))
8346
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
8347
+                               static  char    buf[64];
8348
+                               sprintf(buf,
8349
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
8350 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[0],1)),
8351
+                                       (long)INTVAL(XEXP(operands[0],1)+1));
8352 111 dgisselq
+                               return buf;
8353
+                       }
8354 127 dgisselq
+               } return "BREAK";
8355 111 dgisselq
+       }
8356
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8357
+(define_insn "movdi_ldi"
8358
+       [(set (match_operand:DI 0 "register_operand" "=r")
8359
+               (match_operand:DI 1 "immediate_operand" "i"))]
8360
+       ""
8361
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
8362
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8363 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
8364
+       [(set (match_operand:DI 0 "register_operand" "=r")
8365 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
8366 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8367 122 dgisselq
+       (clobber (reg:CC CC_REG))
8368 102 dgisselq
+       ]
8369
+       ""
8370
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
8371
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8372
+;
8373
+(define_insn "subdi3"
8374
+       [(set (match_operand:DI 0 "register_operand" "=r")
8375 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
8376 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8377 122 dgisselq
+       (clobber (reg:CC CC_REG))
8378 102 dgisselq
+       ]
8379
+       ""
8380
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
8381
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8382
+;
8383
+(define_insn "anddi3"
8384
+       [(set (match_operand:DI 0 "register_operand" "=r")
8385
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
8386
+                       (match_operand:DI 2 "register_operand" "r")))
8387 122 dgisselq
+       (clobber (reg:CC CC_REG))
8388 102 dgisselq
+       ]
8389
+       ""
8390
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
8391
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8392
+;
8393
+(define_insn "iordi3"
8394
+       [(set (match_operand:DI 0 "register_operand" "=r")
8395
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
8396
+                       (match_operand:DI 2 "register_operand" "r")))
8397 122 dgisselq
+       (clobber (reg:CC CC_REG))
8398 102 dgisselq
+       ]
8399
+       ""
8400
+       "OR     %2,%0\n\tOR\t%H2,%H0"
8401
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8402
+;
8403
+(define_insn "xordi3"
8404
+       [(set (match_operand:DI 0 "register_operand" "=r")
8405
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
8406
+                       (match_operand:DI 2 "register_operand" "r")))
8407 122 dgisselq
+       (clobber (reg:CC CC_REG))
8408 102 dgisselq
+       ]
8409
+       ""
8410
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
8411
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8412
+;
8413
+(define_insn "negdi2"
8414
+       [(set (match_operand:DI 0 "register_operand" "=r")
8415 122 dgisselq
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))
8416
+       (clobber (reg:CC CC_REG))
8417
+       ]
8418 102 dgisselq
+       ""
8419
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
8420
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8421
+;
8422
+(define_insn "absdi2"
8423 122 dgisselq
+       [(set (match_operand:DI 0 "register_operand" "=r")
8424
+               (abs:DI (match_operand:DI 1 "register_operand" "0")))
8425
+       (clobber (match_scratch:SI 2 "=r"))
8426
+       (clobber (reg:CC CC_REG))
8427
+       ]
8428 102 dgisselq
+       ""
8429
+       "CLR    %2
8430
+       TEST    %H0             ; Problem, we can't tell conditions
8431
+       LDILO.LT        1,%2
8432
+       XOR.LT  -1,%L0
8433
+       XOR.LT  -1,%H0
8434
+       ADD     %2,%L0
8435 122 dgisselq
+       ADD.C   1,%H0"
8436 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8437
+(define_insn "one_cmpldi2"
8438
+       [(set (match_operand:DI 0 "register_operand" "=r")
8439
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
8440 122 dgisselq
+       (clobber (reg:CC CC_REG))
8441 102 dgisselq
+       ]
8442
+       ""
8443
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
8444
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8445
+(define_insn "umindi3"
8446
+       [(set (match_operand:DI 0 "register_operand" "=r")
8447
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
8448
+                       (match_operand:DI 2 "register_operand" "r")))
8449 122 dgisselq
+       (clobber (reg:CC CC_REG))
8450 102 dgisselq
+       ]
8451
+       ""
8452
+       "CMP    %H0,%H2
8453
+       CMP.Z   %L0,%L2
8454
+       MOV.C   %H2,%H0
8455
+       MOV.C   %L2,%L0"
8456
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8457
+(define_insn "umaxdi3"
8458
+       [(set (match_operand:DI 0 "register_operand" "=r")
8459
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
8460
+                       (match_operand:DI 2 "register_operand" "r")))
8461 122 dgisselq
+       (clobber (reg:CC CC_REG))
8462 102 dgisselq
+       ]
8463
+       ""
8464
+       "CMP    %H2,%H0
8465
+       CMP.Z   %L2,%L0
8466
+       MOV.C   %H2,%H0
8467
+       MOV.C   %L2,%L0"
8468
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8469
+(define_insn "popcountdi2"
8470
+       [(set (match_operand:SI 0 "register_operand" "=r")
8471 122 dgisselq
+               (popcount:SI (match_operand:DI 1 "register_operand" "r")))
8472 102 dgisselq
+       (clobber (match_scratch:SI 2 "=r"))
8473 122 dgisselq
+       (clobber (reg:CC CC_REG))
8474 102 dgisselq
+       ]
8475
+       ""
8476
+       "POPC   %L1,%0
8477
+       POPC    %H1,%2
8478
+       ADD     %2,%0"
8479
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8480
+(define_expand "paritydi2"
8481
+       [(set (match_operand:SI 0 "register_operand" "=r")
8482
+               (popcount (match_operand:DI 1 "register_operand" "r")))
8483
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
8484
+       ])
8485 117 dgisselq
+;(define_insn "extendsidi2"
8486
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8487
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
8488
+;      ""
8489
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
8490
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8491
+;(define_insn "mulsidi3"
8492
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8493
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
8494
+;                      (match_operand:SI 2 "register_operand" "r")))
8495
+;      (clobber (match_scratch:SI 3 "=r"))]
8496
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
8497
+;      ""
8498
+;      "MOV    %1,%L0
8499
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
8500
+;      MOV     %1,%3                   ; R3 = R1
8501
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
8502
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
8503
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
8504
+;      AND     0x0ffff,%3
8505
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
8506
+;      MOV     %2,%3
8507
+;      ROL     16,%3
8508
+;      MPYS    %1,%3
8509
+;      ROL     16,%3
8510
+;      AND     0x0ffff,%3
8511
+;      ADD     %3,%0"
8512
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8513
+
8514 102 dgisselq
+;
8515
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
8516
+;      mult:di, div:di, divu:di
8517
+;
8518
+;
8519
+;
8520
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8521
+;;
8522
+;; Conditional arithmetic instructions
8523
+;;
8524
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8525
+;
8526
+;
8527
+;
8528
+;
8529
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8530 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 2 "register_operand" "r")
8531
+               (match_operand:ZI 3 "zip_opb_operand_p" "rO")))
8532 102 dgisselq
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8533
+                       (match_operator 1 "ordered_comparison_operator"
8534 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8535 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8536
+       ""
8537
+       )
8538
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8539
+       [(set (match_operand:SI 0 "register_operand" "=r")
8540
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
8541 122 dgisselq
+                       [(match_operand:DI 2 "register_operand" "r")
8542
+                               (match_operand:DI 3 "register_operand" "r")])
8543
+                       (const_int 1) (const_int 0)))
8544
+       (clobber (reg:CC CC_REG))]
8545 102 dgisselq
+       ""
8546
+       {
8547
+               switch(GET_CODE(operands[1])) {
8548
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
8549
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
8550
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
8551
+               case LEU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0\n";
8552
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
8553
+               case GEU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0\n";
8554
+               default:
8555
+                       gcc_unreachable();
8556
+               }
8557
+       }
8558
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8559
+;
8560
+;
8561
+;
8562
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8563
+;;
8564
+;; Comparison instructions, both compare and test
8565
+;;
8566
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8567
+;
8568
+;
8569
+;
8570
+;; This will only work so well, since the direction of the compare is
8571
+;; important in unsigned compares.
8572
+;;
8573 122 dgisselq
+(define_expand "cmp<mode>"
8574
+       [(set (reg:CC CC_REG) (compare:CC
8575
+               (match_operand:ZI 0 "register_operand" "r")
8576
+               (match_operand:ZI 1 "nonmemory_operand" "")))]
8577 102 dgisselq
+       ""
8578 122 dgisselq
+       {
8579
+               if (!zip_opb_operand_p(operands[1],SImode)) {
8580
+                       if (can_create_pseudo_p()) {
8581
+                               //; fprintf(stderr, "Generating pseudo register for compare\n");
8582
+                               rtx tmp = gen_reg_rtx(SImode);
8583
+                               emit_insn(gen_movsi(tmp,operands[1]));
8584
+                               operands[1] = tmp;
8585
+                       } else FAIL;
8586
+               }
8587
+       })
8588
+(define_insn "cmp<mode>_reg"
8589
+       [(set (reg:CC CC_REG) (compare:CC
8590
+               (match_operand:ZI 0 "register_operand" "r")
8591
+               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO")))]
8592
+       ""
8593 102 dgisselq
+       "CMP\t%1,%0"
8594
+       [(set_attr "ccresult" "set")])
8595
+(define_insn "cmp<mode>_off"
8596 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8597
+               (match_operand:ZI 0 "register_operand" "r")
8598 138 dgisselq
+               (plus:SI (match_operand:ZI 1 "register_operand" "r")
8599 122 dgisselq
+                       (match_operand 2 "zip_opb_immv_p" "N"))))]
8600 102 dgisselq
+       ""
8601
+       "CMP\t%2+%1,%0"
8602
+       [(set_attr "ccresult" "set")])
8603
+(define_insn "test<mode>"
8604 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_operand:ZI 0 "register_operand" "r")
8605
+                               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO"))
8606 102 dgisselq
+                       (const_int 0)))]
8607
+       ""
8608
+       "TEST   %1,%0"
8609
+       [(set_attr "ccresult" "set")])
8610
+(define_insn "test<mode>_off"
8611 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8612
+               (and:ZI (match_operand:ZI 0 "register_operand" "r")
8613
+                       (plus:ZI
8614
+                               (match_operand:ZI 1 "register_operand" "r")
8615
+                               (match_operand:ZI 2 "zip_opb_immv_p" "N")))
8616
+               (const_int 0)))]
8617 102 dgisselq
+       ""
8618
+       "TEST   %2+%1,%0"
8619
+       [(set_attr "ccresult" "set")])
8620
+(define_insn "nop"
8621
+       [(const_int 0)]
8622
+       ""
8623
+       "NOOP"
8624
+       [(set_attr "ccresult" "unchanged")])
8625
+;
8626
+;
8627
+;
8628
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8629
+;;
8630
+;; Conditional execution predicates
8631
+;;
8632
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8633
+;
8634
+; Sadly, these aren't complete like they should be.  Although these are all of
8635
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
8636
+; other conditions then these.  That is, (cond_exec ...) is not as well
8637
+; recognized as (if_then_else ...).  So we have to duplicate things to support
8638
+; both methods.
8639
+;
8640
+(define_cond_exec
8641 122 dgisselq
+       [(ne (reg:CC CC_REG) (const_int 0))]
8642 102 dgisselq
+       ""
8643
+       "(NZ)"
8644
+       [(set_attr "conditional" "yes")])
8645
+(define_cond_exec
8646 122 dgisselq
+       [(lt (reg:CC CC_REG) (const_int 0))]
8647 102 dgisselq
+       ""
8648
+       "(LT)"
8649
+       [(set_attr "conditional" "yes")])
8650
+(define_cond_exec
8651 122 dgisselq
+       [(eq (reg:CC CC_REG) (const_int 0))]
8652 102 dgisselq
+       ""
8653
+       "(Z)"
8654
+       [(set_attr "conditional" "yes")])
8655
+(define_cond_exec
8656 122 dgisselq
+       [(gt (reg:CC CC_REG) (const_int 0))]
8657 102 dgisselq
+       ""
8658
+       "(GT)"
8659
+       [(set_attr "conditional" "yes")])
8660
+(define_cond_exec
8661 122 dgisselq
+       [(ge (reg:CC CC_REG) (const_int 0))]
8662 102 dgisselq
+       ""
8663
+       "(GE)"
8664
+       [(set_attr "conditional" "yes")])
8665
+(define_cond_exec
8666 122 dgisselq
+       [(ltu (reg:CC CC_REG) (const_int 0))]
8667 102 dgisselq
+       ""
8668
+       "(C)"
8669
+       [(set_attr "conditional" "yes")])
8670
+;
8671
+;
8672
+;
8673
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8674
+;;
8675
+;; Conditional move instructions, since these won't accept conditional
8676
+;;     execution RTL
8677
+;;
8678
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8679
+;
8680
+; // Look for #define HAVE_conditional_move to understand how these might be
8681
+; // used.
8682
+;
8683
+(define_insn "set_zero_or_one<mode>"
8684
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8685
+                       (match_operator 1 "ordered_comparison_operator"
8686 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8687 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8688
+       ""
8689
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
8690
+       }
8691
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8692 127 dgisselq
+(define_expand "mov<mode>cc"
8693 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8694 127 dgisselq
+               (if_then_else:ZI (match_operand 1 "comparison_operator")
8695 102 dgisselq
+                       (match_operand:ZI 2 "general_operand" "rio")
8696
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
8697
+       ""
8698
+       {
8699 127 dgisselq
+       zip_expand_movsicc(operands[0], operands[1], operands[2], operands[3]);
8700
+       DONE;
8701
+       })
8702
+(define_insn_and_split "movsicc_bare"
8703
+       [(set (match_operand:SI 0 "register_operand" "=r")
8704
+               (if_then_else (match_operator 1 "ordered_comparison_operator"
8705
+                               [(reg:CC CC_REG) (const_int 0)])
8706
+                       (match_operand:SI 2 "general_operand" "rio")
8707
+                       (match_operand:SI 3 "register_operand" "0")))]
8708
+       "(zip_supported_condition(GET_CODE(operands[1])))"
8709
+       "#"
8710
+       "(reload_completed)"
8711
+       [(cond_exec (match_operator 1 "ordered_comparison_operator"
8712
+                               [(reg:CC CC_REG) (const_int 0)])
8713
+                       (set (match_dup 0) (match_dup 2)))]
8714
+       "" [(set_attr "predicable" "no")])
8715 102 dgisselq
+(define_insn "add<mode>cc"
8716
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
8717
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8718 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8719 102 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
8720
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
8721
+                       (match_dup 0)))]
8722
+       ""
8723
+       {
8724
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
8725
+       }
8726
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8727
+;
8728
+;
8729
+;
8730
+; While an interesting approach, the following suffers from problems when the
8731
+; move amount is constant.  At anything less than four, moves should not require
8732
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
8733
+; are not required and should result in a hardcoded result.  Practically,
8734
+; though, this should really be a define_expand instruction, calling on the
8735 127 dgisselq
+; RTX's of all the respective subinstructions found below.  Or, perhaps, it is
8736
+; better as a subroutine?
8737 102 dgisselq
+;
8738
+;(define_insn "movmemSI"
8739
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
8740
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
8741
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
8742
+;              (match_operand 3 "" "")                 ;Alignment
8743
+;              (clobber (match_scratch:SI 4 "=r"))
8744
+;              (clobber (match_scratch:SI 5 "=r"))
8745
+;              (clobber (match_scratch:SI 6 "=r"))
8746
+;              (clobber (match_scratch:SI 7 "=r"))]
8747
+;      ""
8748
+;      "TEST\t1,%2
8749
+;      LOD.NZ\t%1,%4
8750
+;      STO.NZ\t%4,%0
8751
+;      ADD.NZ\t1,%0
8752
+;      ADD.NZ\t1,%1
8753
+;      TEST\t2,%2
8754
+;      LOD.NZ\t%1,%4
8755
+;      LOD.NZ\t1(%1),%5
8756
+;      STO.NZ\t%4,(%0)
8757
+;      STO.NZ\t%4,1(%0)
8758
+;      ADD.NZ\t2,%0
8759
+;      ADD.NZ\t2,%1
8760
+;      AND\t-4,%2
8761
+;      BZ\t.Lskp%=\n.Ltop%=:
8762
+;      LOD\t(%1),%4
8763
+;      LOD\t1(%1),%5
8764
+;      LOD\t2(%1,%6
8765
+;      LOD\t3(%1),%7
8766
+;      STO\t%4,(%1)
8767
+;      STO\t%5,1(%1)
8768
+;      STO\t%6,2(%1)
8769
+;      STO\t%7,3(%1)
8770
+;      SUB\t4,%2
8771
+;      BZ\t%.Lskp%=
8772
+;      BRA\t.Ltop%=\n.Lskp%=:"
8773
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8774
+;(define_insn "setmemsi"
8775
+;      [(parallel
8776
+;              [(set (mem:BLK
8777
+;                      (match_operand 0 "register_operand" "+r")); Destination
8778
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8779
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8780
+;              (match_operand 3 "" "")]
8781
+;      ""
8782
+;      "TEST\t1,%1
8783
+;      STO.NZ\t%2,(%0)
8784
+;      ADD.NZ\t1,%0
8785
+;      TEST\t2,%1
8786
+;      STO.NZ\t%2,(%0)
8787
+;      STO.NZ\t%2,1(%0)
8788
+;      ADD.NZ\t2,%0
8789
+;      AND\t-4,%1
8790
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8791
+;      STO\t%2,(%0)
8792
+;      STO\t%2,1(%0)
8793
+;      STO\t%2,2(%0)
8794
+;      STO\t%2,3(%0)
8795
+;      SUB\t%4,%0
8796
+;      BZ\t.Lskp%=
8797
+;      BRA\t.Ltop%=\n.Lskp%=:"
8798
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8799
+;;
8800
+;
8801
+;
8802
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8803
+;;
8804
+;; Control flow instructions
8805
+;;
8806
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8807
+;
8808
+;
8809
+;
8810
+(define_expand "jump"
8811
+       [(set (pc)
8812
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8813 127 dgisselq
+(define_insn "jump_const"
8814
+       [(set (pc)
8815 102 dgisselq
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8816
+       ""
8817
+       "BRA    %0"
8818
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8819
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8820
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8821
+               (label_ref (match_operand 0 "" "")))]
8822
+       ""
8823
+       "BRA    %0"
8824
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8825
+;
8826
+; This is really the same thing as an indirect jump ... the big difference
8827
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8828
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8829
+; should be able to catch and except on it ...)
8830
+;
8831
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8832
+(define_insn "jump_variable"
8833
+       [(set (pc)
8834
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8835
+       ""
8836
+       "JMP    %0"
8837
+       [(set_attr "ccresult" "unchanged")])
8838
+;
8839
+; Indirect jumps ... both to registers, and registers plus offsets
8840
+;
8841
+(define_insn "indirect_jump"
8842
+       [(set (pc)
8843
+               (match_operand:SI 0 "register_operand" "r"))]
8844
+       ""
8845
+       "JMP    %0"
8846
+       [(set_attr "ccresult" "unchanged")])
8847
+(define_insn "indirect_jump_mem"
8848
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8849
+       ""
8850
+       "LOD    %0,PC"
8851
+       [(set_attr "ccresult" "unchanged")])
8852
+(define_insn "indirect_jump_off"
8853
+       [(set (pc)
8854
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8855
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8856
+       ""
8857
+       "JMP    %1(%0)"
8858
+       [(set_attr "ccresult" "unchanged")])
8859
+;;
8860
+; cbranchsi4
8861
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8862
+;;     Op 1&2 the operands of the compare instruction
8863
+;;     Op 3 is the jump label
8864
+;;
8865
+;;
8866
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8867
+;;
8868
+(define_expand "cbranch<mode>4"
8869 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 1 "register_operand" "r")
8870
+               (match_operand:ZI 2 "zip_opb_operand_p" "rO")))
8871 102 dgisselq
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8872 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8873 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8874
+                       (pc)))]
8875
+       ""
8876
+       {
8877 125 dgisselq
+               if (true) {
8878 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
8879 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
8880
+               //; Let's check for these two branch codes, and swap the
8881
+               //; comparison to simplify them.
8882 122 dgisselq
+               //; fprintf(stderr, "CBRANCH\n");
8883
+               //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
8884
+               //; zip_debug_rtx_pfx("- A  : ", operands[1]);
8885
+               //; zip_debug_rtx_pfx("- B  : ", operands[2]);
8886
+               //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
8887 117 dgisselq
+               //; Can we do better if we reverse some compares?
8888 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
8889 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
8890
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8891 102 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8892
+                       DONE;
8893
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
8894 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
8895
+                       emit_insn(gen_cmpsi_off(operands[2], operands[1],
8896
+                                       GEN_INT(1)));
8897
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8898 102 dgisselq
+                       DONE;
8899 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
8900 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
8901 117 dgisselq
+                       //; Swap operands, turn into a GTE compare
8902 122 dgisselq
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8903 117 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
8904
+                       DONE;
8905 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
8906
+
8907
+               //; Except ... we can do better for some instructions, such as
8908
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
8909
+               //; would be difficult to explain to users why MIN_INT didn't
8910
+               //; compare properly.  Hence we only adjust constant integers.
8911
+               //;
8912 122 dgisselq
+               if (GET_CODE(operands[0])==LE) {
8913
+                       if ((CONST_INT_P(operands[2]))
8914 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8915 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
8916
+                               emit_insn(gen_cmpsi(operands[1],
8917
+                                               GEN_INT(INTVAL(operands[2])+1)));
8918
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8919
+                               DONE;
8920
+                       //; Now for the controversial ones--where we add one
8921
+                       //; when it may or may not be permissable.  For now, we
8922
+                       //; just do it anyway and postpone the philosophical
8923
+                       //; discussion for later.
8924
+                       } else if (REG_P(operands[2])) {
8925
+                               emit_insn(gen_cmpsi_off(operands[1],
8926
+                                               operands[2],GEN_INT(1)));
8927
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8928
+                               DONE;
8929
+                       } else if ((GET_CODE(operands[2])==PLUS)
8930
+                               &&(REG_P(XEXP(operands[2],0)))
8931
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
8932
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
8933
+                               emit_insn(gen_cmpsi_off(operands[1],
8934
+                                               XEXP(operands[2],0),
8935
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
8936
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8937
+                               DONE;
8938
+                       }
8939
+               } else if (GET_CODE(operands[0])==LEU) {
8940
+                       if ((CONST_INT_P(operands[2]))
8941 102 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8942 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
8943
+                               emit_insn(gen_cmpsi(operands[1],
8944
+                                               GEN_INT(INTVAL(operands[2])+1)));
8945
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8946
+                               DONE;
8947
+                       //; Now for the controversial ones--this time having
8948
+                       //; to do with unsigned compares.
8949
+                       } else if (REG_P(operands[2])) {
8950
+                               emit_insn(gen_cmpsi_off(operands[1],
8951
+                                                       operands[2],GEN_INT(1)));
8952
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8953
+                               DONE;
8954
+                       } else if ((GET_CODE(operands[2])==PLUS)
8955
+                               &&(REG_P(XEXP(operands[2],0)))
8956
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
8957
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
8958
+                               emit_insn(gen_cmpsi_off(operands[1],
8959
+                                       XEXP(operands[2],0),
8960
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
8961
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8962
+                               DONE;
8963
+                       }
8964 124 dgisselq
+               }}
8965 102 dgisselq
+       })
8966
+(define_insn "cbranch_jmp_eq"
8967 122 dgisselq
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8968 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8969
+                (pc)))]
8970
+       ""
8971
+       "BZ\t%0"
8972
+       [(set_attr "predicable" "no")
8973
+               (set_attr "conditional" "yes")
8974
+               (set_attr "ccresult" "unchanged")])
8975
+(define_insn "cbranch_jmp_neq"
8976 122 dgisselq
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
8977 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8978
+                (pc)))]
8979
+       ""
8980
+       "BNZ\t%0"
8981
+       [(set_attr "predicable" "no")
8982
+               (set_attr "conditional" "yes")
8983
+               (set_attr "ccresult" "unchanged")])
8984
+(define_insn "cbranch_jmp_lt"
8985 122 dgisselq
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8986 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8987
+                (pc)))]
8988
+       ""
8989
+       "BLT\t%0"
8990
+       [(set_attr "predicable" "no")
8991
+               (set_attr "conditional" "yes")
8992
+               (set_attr "ccresult" "unchanged")])
8993
+(define_insn "cbranch_jmp_le"
8994 122 dgisselq
+       [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
8995 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8996
+                (pc)))]
8997
+       ""
8998
+       "BLT\t%0
8999
+       BZ\t%0"
9000
+       [(set_attr "predicable" "no")
9001
+               (set_attr "conditional" "yes")
9002
+               (set_attr "ccresult" "unchanged")])
9003
+(define_insn "cbranch_jmp_gt"
9004 122 dgisselq
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
9005 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9006
+                (pc)))]
9007
+       ""
9008
+       "BGT\t%0"
9009
+       [(set_attr "predicable" "no")
9010
+               (set_attr "conditional" "yes")
9011
+               (set_attr "ccresult" "unchanged")])
9012
+(define_insn "cbranch_jmp_ge"
9013 122 dgisselq
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9014 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9015
+                (pc)))]
9016
+       ""
9017
+       "BGE\t%0"
9018
+       [(set_attr "predicable" "no")
9019
+               (set_attr "conditional" "yes")
9020
+               (set_attr "ccresult" "unchanged")])
9021
+(define_insn "cbranch_jmp_ltu"
9022 122 dgisselq
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9023 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9024
+                (pc)))]
9025
+       ""
9026
+       "BC\t%0"
9027
+       [(set_attr "predicable" "no")
9028
+               (set_attr "conditional" "yes")
9029
+               (set_attr "ccresult" "unchanged")])
9030
+(define_insn "cbranch_jmp_gtu"
9031 122 dgisselq
+       [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9032 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9033 122 dgisselq
+                (pc)))
9034
+       ;(clobber (reg:CC CC_REG))
9035
+       ]
9036 102 dgisselq
+       ""      ; Flip the condition, and then we can jump
9037 127 dgisselq
+       "BC\t.Lgtu%=\n\tBZ\t.Lgtu%=\n\tBRA\t%0\n.Lgtu%=:"
9038 102 dgisselq
+       [(set_attr "predicable" "no")
9039
+               (set_attr "conditional" "yes")
9040
+               (set_attr "ccresult" "unknown")])
9041
+(define_insn "cbranch_jmp_leu"
9042 122 dgisselq
+       [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9043 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9044
+                (pc)))]
9045
+       ""      ; Need to check for both LTU (i.e. C) and Z
9046
+       "BC\t%0
9047
+       BZ\t%0"
9048
+       [(set_attr "predicable" "no")
9049
+               (set_attr "conditional" "yes")
9050
+               (set_attr "ccresult" "unchanged")])
9051
+(define_insn "cbranch_jmp_geu"
9052 122 dgisselq
+       [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9053 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9054 122 dgisselq
+                (pc)))
9055
+       ;(clobber (reg:CC CC_REG))
9056
+       ]
9057 127 dgisselq
+       ""
9058
+       "BC\t.Lgeu%=\n\tBRA\t%0\n.Lgeu%=:"
9059 102 dgisselq
+       [(set_attr "predicable" "no")
9060
+               (set_attr "conditional" "yes")
9061
+               (set_attr "ccresult" "unknown")])
9062
+(define_insn "cbranchdi4"
9063
+       [(set (pc) (if_then_else
9064
+               (match_operator 0 "ordered_comparison_operator"
9065
+                       [(match_operand:DI 1 "register_operand" "r")
9066 122 dgisselq
+                               (match_operand:DI 2 "register_operand" "r")])
9067 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
9068
+                       (pc)))
9069 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9070 102 dgisselq
+       ""
9071
+       {
9072
+               switch(GET_CODE(operands[0])) {
9073
+               case EQ:
9074
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
9075
+               case NE:
9076
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
9077
+               case LE:
9078
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9079
+               case GT:
9080
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
9081
+               case LT:
9082
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
9083
+               case GE:
9084
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\nBZ\t%3\n.Ldi%=:";
9085
+               case LTU:
9086
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
9087
+               case LEU:
9088
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9089
+               case GTU:
9090
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
9091
+               case GEU:
9092
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
9093
+               default:
9094
+                       gcc_unreachable();
9095
+               }
9096
+       }
9097
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9098
+;
9099
+;
9100
+;
9101
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9102
+;;
9103
+;; Subroutine call
9104
+;;
9105
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9106
+;
9107
+;
9108
+; There are two types of calls: "call" and "call_value".
9109
+;
9110
+; Each of these types of calls are then expanded into one of:
9111
+;
9112
+;      _const          - A call to a constant address, such as a symbol
9113
+;                      reference or a fixed location
9114
+;
9115
+;      _label          - This should be the same as _const, except that for
9116
+;                      some reason the RTL and matching rules are separate.
9117
+;                      Hence we have a separate rule for this.
9118
+;
9119
+;      _mem            - The memory address we wish to jump to is stored in
9120
+;                      memory somewhere, and we have only a pointer.  In this
9121
+;                      case, we load that pointer straight to the PC and go.
9122
+;
9123
+;      _var            - The address to jump to is given as an offset to a
9124
+;                      register, such as X+R3.  This is an indirect jump.
9125
+;                      Although we support it, it does require different RTL
9126
+;                      code.
9127
+;
9128
+(define_expand "call"
9129
+       [(call (match_operand 0 "" "")
9130
+               (match_operand 1 "" ""))]
9131
+       ""
9132
+       {
9133
+               if (MEM_P(operands[0])) {
9134
+                       // This should always be the case
9135
+                       rtx addr = XEXP(operands[0],0);
9136
+                       if (zip_const_address_operand_p(addr, SImode)) {
9137 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
9138 102 dgisselq
+                               emit_call_insn(gen_void_call_const(addr,
9139
+                                               operands[1]));
9140
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
9141
+                                                       XEXP(addr,0)))) {
9142
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
9143
+                                                                operands[1]));
9144
+                       } else {
9145
+                               emit_call_insn(gen_void_call_var(addr,
9146
+                                                                operands[1]));
9147
+                       }
9148
+                       DONE;
9149
+               }
9150
+       })
9151
+;
9152
+;
9153
+;
9154
+; How do we want to do this better?
9155
+;      Replace the RTL w/
9156
+;              return_label= gen_label_rtx();
9157
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
9158
+;                      gen_rtx_REG(zip_PC),return_label));
9159
+;              emit_jump(label_rtx(
9160
+;
9161
+;              emit_label(return_label);
9162
+;
9163
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
9164
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
9165
+; label gets removed and the call gets lost.  Hence we do it this way (below).
9166
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
9167
+; recognize as such, but for now we'll use .Lcall# as our label.
9168
+;
9169
+(define_insn "void_call_const"
9170 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9171 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9172 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9173
+               (clobber (reg:CC CC_REG))]
9174 102 dgisselq
+       ""
9175
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9176
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9177
+(define_insn "void_call_mem"
9178 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9179 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9180 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9181
+               (clobber (reg:CC CC_REG))]
9182 102 dgisselq
+       ""
9183
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
9184
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9185
+;
9186
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9187
+(define_insn "void_call_var"
9188 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9189 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9190 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9191
+               (clobber (reg:CC CC_REG))]
9192 102 dgisselq
+       ""
9193
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
9194
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9195
+(define_expand "call_value"
9196 122 dgisselq
+       [(parallel [(set (reg:SI RTNV_REG)
9197 102 dgisselq
+               (call (match_operand:SI 1 "" "")
9198 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
9199 122 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))
9200
+       (clobber (reg:CC CC_REG))])]
9201 102 dgisselq
+       ""
9202
+       {
9203 122 dgisselq
+               //; extern void zip_debug_rtx(const_rtx);
9204
+               //; fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
9205
+               //; zip_debug_rtx(operands[1]);
9206 102 dgisselq
+               if (MEM_P(operands[1])) {
9207 122 dgisselq
+                       //; fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
9208
+                       //; zip_debug_rtx(operands[1]);
9209
+                       //; This should always be the case
9210 102 dgisselq
+                       rtx addr = XEXP(operands[1],0);
9211
+                       if (zip_const_address_operand_p(addr, SImode)) {
9212 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_reg_call_const()\n");
9213 102 dgisselq
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
9214
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
9215 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9216 102 dgisselq
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
9217
+                       } else {
9218 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9219 102 dgisselq
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
9220
+                       }
9221
+                       DONE;
9222
+               }
9223
+       })
9224
+(define_insn "reg_call_const"
9225 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9226 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9227 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9228 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9229
+               (clobber (reg:CC CC_REG))]
9230 102 dgisselq
+       ""
9231
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9232
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9233
+(define_insn "reg_call_mem"
9234
+       [(set (reg:SI RTNV_REG)
9235 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9236
+                       (match_operand 1 "const_int_operand" "n")))
9237 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9238
+               (clobber (reg:CC CC_REG))]
9239 102 dgisselq
+       ""
9240 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
9241 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9242 111 dgisselq
+;
9243 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9244
+(define_insn "reg_call_var"
9245 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9246 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9247 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9248 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9249
+               (clobber (reg:CC CC_REG))]
9250 102 dgisselq
+       ""
9251 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
9252 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9253
+;
9254
+;
9255
+;
9256
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9257
+;;
9258
+;; Frame manipulation RTX
9259
+;;
9260
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9261
+;
9262
+;
9263
+;
9264
+(define_expand "prologue"
9265
+       [(const_int 0)]
9266
+       ""
9267
+       "{ zip_expand_prologue(); DONE; }")
9268
+(define_expand "epilogue"
9269
+       [(return)]
9270
+       ""
9271
+       "{ zip_expand_epilogue(); DONE; }")
9272
+(define_expand "return" ; In order to use the function predicate, this *must*
9273
+       [(return)]      ; be a define_expand
9274
+       "zip_use_return_insn()")
9275
+       ; "JMP  R0"
9276
+       ; [(set_attr "ccresult" "unchanged")])
9277
+(define_insn "*return" ; A "*" -- means it cannot be called from C
9278
+       [(return)]
9279
+       ""
9280
+       "JMP    R0"
9281
+       [(set_attr "ccresult" "unchanged")])
9282
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
9283
+       [(simple_return)]
9284
+       ""
9285
+       "JMP    R0"
9286
+       [(set_attr "ccresult" "unchanged")])
9287
+;
9288
+;
9289
+;
9290
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9291
+;;
9292
+;; Zip Builtin Functions
9293
+;;
9294
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9295
+;
9296
+;
9297
+;
9298
+(define_insn "zip_rtu"
9299
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
9300 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9301 102 dgisselq
+       "(!ZIP_USER)"
9302
+       "RTU"
9303
+       [(set_attr "ccresult" "unknown")])
9304
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
9305
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
9306 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9307 102 dgisselq
+       "(!ZIP_USER)"
9308
+       "HALT"
9309
+       [(set_attr "ccresult" "unknown")])
9310
+(define_insn "zip_idle"
9311
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
9312 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9313 102 dgisselq
+       ""
9314
+       "WAIT"
9315
+       [(set_attr "ccresult" "unknown")])
9316
+(define_insn "zip_syscall"
9317
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
9318
+       ""
9319
+       "CLR\tCC"
9320
+       [(set_attr "ccresult" "unknown")])
9321
+;
9322
+;
9323
+; Operator "save_context"
9324
+;
9325 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
9326
+;      if we don't list it as a "+r" register, the compiler may allocate it
9327
+;      among the other registers, thus we clobber it in the middle of the
9328
+;      operation before the task is complete.
9329 102 dgisselq
+;
9330
+(define_insn "zip_save_context"
9331 117 dgisselq
+       [(unspec_volatile
9332
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
9333 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
9334
+               (clobber (match_scratch:SI 1 "=r"))
9335
+               (clobber (match_scratch:SI 2 "=r"))
9336
+               (clobber (match_scratch:SI 3 "=r"))
9337 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
9338 102 dgisselq
+       "(!ZIP_USER)"
9339
+       "MOV\tuR0,%1
9340
+       MOV\tuR1,%2
9341
+       MOV\tuR2,%3
9342
+       MOV\tuR3,%4
9343
+       STO\t%1,%0
9344
+       STO\t%2,1(%0)
9345
+       STO\t%3,2(%0)
9346
+       STO\t%4,3(%0)
9347
+       MOV\tuR4,%1
9348
+       MOV\tuR5,%2
9349
+       MOV\tuR6,%3
9350
+       MOV\tuR7,%4
9351
+       STO\t%1,4(%0)
9352
+       STO\t%2,5(%0)
9353
+       STO\t%3,6(%0)
9354
+       STO\t%4,7(%0)
9355
+       MOV\tuR8,%1
9356
+       MOV\tuR9,%2
9357
+       MOV\tuR10,%3
9358
+       MOV\tuR11,%4
9359
+       STO\t%1,8(%0)
9360
+       STO\t%2,9(%0)
9361
+       STO\t%3,10(%0)
9362
+       STO\t%4,11(%0)
9363
+       MOV\tuR12,%1
9364
+       MOV\tuSP,%2
9365
+       MOV\tuCC,%3
9366
+       MOV\tuPC,%4
9367
+       STO\t%1,12(%0)
9368
+       STO\t%2,13(%0)
9369
+       STO\t%3,14(%0)
9370
+       STO\t%4,15(%0)"
9371 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9372 117 dgisselq
+;
9373
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
9374
+; even though we don't really read (or change) its value throughout this
9375
+; operation.
9376
+;
9377 102 dgisselq
+(define_insn "zip_restore_context"
9378
+       [(unspec_volatile [
9379 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
9380 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
9381
+       (clobber (match_scratch:SI 2 "=r"))
9382
+       (clobber (match_scratch:SI 3 "=r"))
9383 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
9384 102 dgisselq
+       "(!ZIP_USER)"
9385
+       "LOD\t0(%0),%1
9386
+       LOD\t1(%0),%2
9387
+       LOD\t2(%0),%3
9388
+       LOD\t3(%0),%4
9389
+       MOV\t%1,uR0
9390
+       MOV\t%2,uR1
9391
+       MOV\t%3,uR2
9392
+       MOV\t%4,uR3
9393
+       LOD\t4(%0),%1
9394
+       LOD\t5(%0),%2
9395
+       LOD\t6(%0),%3
9396
+       LOD\t7(%0),%4
9397
+       MOV\t%1,uR4
9398
+       MOV\t%2,uR5
9399
+       MOV\t%3,uR6
9400
+       MOV\t%4,uR7
9401
+       LOD\t8(%0),%1
9402
+       LOD\t9(%0),%2
9403
+       LOD\t10(%0),%3
9404
+       LOD\t11(%0),%4
9405
+       MOV\t%1,uR8
9406
+       MOV\t%2,uR9
9407
+       MOV\t%3,uR10
9408
+       MOV\t%4,uR11
9409
+       LOD\t12(%0),%1
9410
+       LOD\t13(%0),%2
9411
+       LOD\t14(%0),%3
9412
+       LOD\t15(%0),%4
9413
+       MOV\t%1,uR12
9414
+       MOV\t%2,uSP
9415
+       MOV\t%3,uCC
9416
+       MOV\t%4,uPC"
9417 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9418 102 dgisselq
+(define_insn "zip_bitrev"
9419
+       [(set (match_operand:SI 0 "register_operand" "=r")
9420
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
9421
+       ]
9422
+       ""
9423
+       "BREV\t%1,%0"
9424 122 dgisselq
+       [(set_attr "ccresult" "unchanged")])
9425 102 dgisselq
+(define_insn "zip_cc"
9426
+       [(set (match_operand:SI 0 "register_operand" "=r")
9427
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9428
+       ""
9429
+       "MOV\tCC,%0"
9430
+       [(set_attr "ccresult" "unchanged")])
9431 117 dgisselq
+(define_insn "zip_ucc"
9432
+       [(set (match_operand:SI 0 "register_operand" "=r")
9433
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
9434
+       ""
9435
+       "MOV\tuCC,%0"
9436
+       [(set_attr "ccresult" "unchanged")])
9437 111 dgisselq
+(define_insn "zip_cc_sto"
9438
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
9439 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9440 111 dgisselq
+       ""
9441
+       "STO\tCC,(%0)"
9442
+       [(set_attr "ccresult" "unchanged")])
9443
+(define_insn "zip_cc_sto_off"
9444
+       [(set (mem:SI (plus:SI
9445
+                       (match_operand:SI 0 "register_operand" "r")
9446
+                       (match_operand:SI 1 "const_int_operand" "N")))
9447 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9448 111 dgisselq
+       ""
9449
+       "STO\tCC,%1(%0)"
9450
+       [(set_attr "ccresult" "unchanged")])
9451 102 dgisselq
+(define_insn "ldilo"
9452
+       [(set (match_operand:SI 0 "register_operand" "=r")
9453
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
9454
+       ""
9455
+       "LDILO  %1,%0"
9456
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9457
+
9458
+;
9459
+;
9460
+;
9461
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9462
+;;
9463
+;; Floating point Op-codes
9464
+;;
9465
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9466
+;
9467
+;
9468
+;
9469
+(define_insn "addsf3"
9470
+       [(set (match_operand:SF 0 "register_operand" "=r")
9471
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
9472 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9473
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9474 102 dgisselq
+       "(ZIP_FPU)"
9475
+       "FPADD  %2,%0"
9476
+       [(set_attr "ccresult" "unknown")])
9477
+(define_insn "subsf3"
9478
+       [(set (match_operand:SF 0 "register_operand" "=r")
9479
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
9480 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9481
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9482 102 dgisselq
+       "(ZIP_FPU)"
9483
+       "FPSUB  %2,%0"
9484
+       [(set_attr "ccresult" "unknown")])
9485
+(define_insn "mulsf3"
9486
+       [(set (match_operand:SF 0 "register_operand" "=r")
9487
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
9488 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9489
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9490 102 dgisselq
+       "(ZIP_FPU)"
9491
+       "FPMUL  %2,%0"
9492
+       [(set_attr "ccresult" "unknown")])
9493
+(define_insn "divsf3"
9494
+       [(set (match_operand:SF 0 "register_operand" "=r")
9495
+               (div:SF (match_operand:SF 1 "register_operand" "0")
9496 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9497
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9498 102 dgisselq
+       "(ZIP_FPU)"
9499
+       "FPDIV  %2,%0"
9500
+       [(set_attr "ccresult" "unknown")])
9501 111 dgisselq
+(define_expand "negsf2"
9502
+       [(set (match_operand:SF 0 "register_operand" "=r")
9503
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
9504
+       ]
9505
+       ""
9506
+       {
9507
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9508
+               if (can_create_pseudo_p()) {
9509
+                       rtx tmp = gen_reg_rtx(SImode);
9510
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
9511 122 dgisselq
+                       emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
9512 111 dgisselq
+                       DONE;
9513
+               } else {
9514
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9515 122 dgisselq
+                       emit_insn(gen_iorsi3(operands[0], operands[0],
9516
+                               gen_int_mode(1,SImode)));
9517 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9518
+                       DONE;
9519
+               }
9520
+       })
9521
+(define_expand "abssf2"
9522 122 dgisselq
+       [(set (match_operand:SF 0 "register_operand" "=r")
9523
+               (abs:SF (match_operand:SF 1 "register_operand" "0")))
9524 111 dgisselq
+       ]
9525
+       ""
9526
+       {
9527
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9528
+               if (can_create_pseudo_p()) {
9529
+                       rtx tmp = gen_reg_rtx(SImode);
9530
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
9531 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0], tmp));
9532 111 dgisselq
+                       DONE;
9533
+               } else {
9534
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9535 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0],
9536
+                               gen_int_mode(-2,SImode)));
9537 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9538
+                       DONE;
9539
+               }
9540
+       })
9541 102 dgisselq
+;
9542
+;
9543
+;
9544
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9545
+;;
9546
+;; Trap Instruction
9547
+;;
9548
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9549
+;
9550
+;
9551
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
9552
+; *nothing* should ever trap, and so we should never get here.  However, the
9553
+; compiler seems to want a trap instruction for some reason.  (It keeps us
9554
+; from calling the abort() function, if we don't define these ...)  So let's
9555
+; just grab onto the break instruction and declare it to be a trap instruction
9556
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
9557
+; will work for both user and system instructions.
9558
+;
9559
+(define_insn "trap"
9560
+       [(trap_if (const_int 1) (const_int 0))]
9561
+       ""
9562
+       "BREAK"
9563
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9564
+;
9565
+(define_expand "ctrap<mode>4"
9566 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9567
+               (match_operand:ZI 1 "register_operand" "r")
9568
+               (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
9569 102 dgisselq
+       (trap_if (match_operator 0 "ordered_comparison_operator"
9570 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9571 102 dgisselq
+                       (match_operand 3 "const_int_operand" "O"))]
9572
+       ""
9573
+       )
9574
+(define_insn "trapif"
9575
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
9576 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9577 102 dgisselq
+                       (match_operand 1 "const_int_operand" "O"))]
9578
+       ""
9579
+       "BREAK\t%1"
9580
+       [(set_attr "predicable" "no")])
9581
+;
9582
+;
9583
+;
9584
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9585
+;;
9586
+;; Unimplemented (or not yet implemented) RTL Codes
9587
+;;
9588
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9589
+;
9590
+;
9591
+;
9592
+;(define_insn "sync_compare_and_swapsi"
9593
+;      [(set ...
9594
+;              )]
9595
+;      "(ZIP_ATMOC)"
9596
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
9597
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
9598
+;      CMP     %0,%2   DCD-valid
9599
+;      STO.Z   %2,%1   PF-valid
9600
+;
9601
+;(define_insn "sync_lock_test_and_setsi"
9602
+;      LOCK
9603
+;      LOD     %1,%0
9604
+;      STO     %0,%1
9605
+;
9606
+;(define_insn "sync_lock_releasesi"
9607
+;      STO     %1,%0
9608
+;
9609
+;
9610
+;(define_insn "negvsi3"
9611
+;      "MOV    %1,%0
9612
+;      XOR     -1,%0
9613
+;      ADD     1,%0
9614
+;      BV      %2"
9615
+;      "")
9616 124 dgisselq
+;
9617
+; Match:
9618
+;      CMP     R1,R0
9619
+;      BGTU    lbl
9620
+; Transform to:
9621
+;      CMP     R0,R1
9622
+;      BC      lbl
9623
+;
9624 117 dgisselq
+(define_peephole2
9625 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9626
+               (match_operand:SI 0 "register_operand")
9627
+               (match_operand:SI 1 "register_operand")))
9628
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9629
+                       (label_ref (match_operand 2 ""))
9630 117 dgisselq
+                       (pc)))]
9631 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9632 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
9633
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9634 117 dgisselq
+                       (label_ref (match_dup 2))
9635
+                       (pc)))]
9636
+       "")
9637 127 dgisselq
+(define_peephole2
9638
+       [(match_scratch:SI 3 "=r")
9639
+       (set (reg:CC CC_REG) (compare:CC
9640
+               (match_operand:SI 0 "register_operand")
9641
+               (match_operand 1 "const_int_operand")))
9642
+       (match_dup 3)
9643
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9644
+                       (label_ref (match_operand 2 ""))
9645
+                       (pc)))]
9646
+       "(ZIP_PEEPHOLE)"
9647
+       [(set (match_dup 3) (match_dup 1))
9648
+       (set (reg:CC CC_REG) (compare:CC (match_dup 3) (match_dup 0)))
9649
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9650
+                       (label_ref (match_dup 2))
9651
+                       (pc)))]
9652
+       "")
9653
+;(define_peephole2
9654
+;      [(set (reg:CC CC_REG) (compare:CC
9655
+;              (match_operand:SI 0 "register_operand")
9656
+;              (match_operand 1 "const_int_operand")))
9657
+;      (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9658
+;                      (label_ref (match_operand 2 ""))
9659
+;                      (pc)))]
9660
+;      ""
9661
+;      [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9662
+;      (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9663
+;                      (label_ref (match_dup 2))
9664
+;                      (pc)))]
9665
+;      "operands[1] = GEN_INT(INTVAL(operands[1])-1);")
9666 124 dgisselq
+;
9667
+;
9668
+; Match:
9669
+;      CMP     R1,R0
9670
+;      BGEU    lbl
9671
+; Transform to:
9672
+;      CMP     1(R0),R1
9673
+;      BC      lbl
9674
+;
9675 117 dgisselq
+(define_peephole2
9676 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9677
+               (match_operand:SI 0 "register_operand")
9678
+               (match_operand:SI 1 "register_operand")))
9679
+       (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9680
+                       (label_ref (match_operand 2 ""))
9681 117 dgisselq
+                       (pc)))]
9682 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9683 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9684
+               (match_dup 1) (plus (match_dup 0) (const_int 1))))
9685
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9686 117 dgisselq
+                       (label_ref (match_dup 2))
9687
+                       (pc)))]
9688
+       "")
9689 124 dgisselq
+;
9690
+;
9691
+; Match:
9692
+;      CMP     R1,R0
9693
+;      BGE     lbl
9694
+; Transform to:
9695
+;      CMP     1(R0),R1
9696
+;      BLT     lbl
9697
+;
9698 117 dgisselq
+(define_peephole2
9699 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9700
+               (match_operand:SI 0 "register_operand")
9701
+               (match_operand:SI 1 "register_operand")))
9702
+       (set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9703
+                       (label_ref (match_operand 2 ""))
9704 117 dgisselq
+                       (pc)))]
9705 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9706 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1)
9707
+                       (plus:SI (match_dup 0) (const_int 1))))
9708
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9709 117 dgisselq
+                       (label_ref (match_dup 2))
9710
+                       (pc)))]
9711
+       "")
9712 124 dgisselq
+;
9713
+;
9714
+; Match:
9715
+;      CMP     R1,R0
9716
+;      BLEU    lbl
9717
+; Transform to:
9718
+;      CMP     1(R1),R0
9719
+;      BLT     lbl
9720
+;
9721 117 dgisselq
+(define_peephole2
9722 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9723
+               (match_operand:SI 0 "register_operand" "")
9724 117 dgisselq
+               (match_operand:SI 1 "register_operand" "")))
9725 122 dgisselq
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9726 117 dgisselq
+                       (label_ref (match_operand 2 "" ""))
9727
+                       (pc)))]
9728 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9729 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9730
+                       (plus (match_dup 1) (const_int 1))))
9731
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9732 117 dgisselq
+                       (label_ref (match_dup 2))
9733
+                       (pc)))]
9734
+       "")
9735
+;
9736 127 dgisselq
+(define_peephole2
9737
+       [(set (reg:CC CC_REG)
9738
+               (compare:CC (match_operand:SI 0 "register_operand" "")
9739
+                       (match_operand:SI 1 "const_int_operand" "")))
9740
+       (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
9741
+                       (label_ref (match_operand 2 "" ""))
9742
+                       (pc)))]
9743
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
9744
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9745
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9746
+                       (label_ref (match_dup 2))
9747
+                       (pc)))]
9748
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
9749
+(define_peephole2
9750
+       [(set (reg:CC CC_REG)
9751
+               (compare:CC (match_operand:SI 0 "register_operand" "")
9752
+                       (match_operand:SI 1 "const_int_operand" "")))
9753
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9754
+                       (label_ref (match_operand 2 "" ""))
9755
+                       (pc)))]
9756
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
9757
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9758
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9759
+                       (label_ref (match_dup 2))
9760
+                       (pc)))]
9761
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
9762 102 dgisselq
+;
9763 117 dgisselq
+;
9764
+;
9765
+;
9766 127 dgisselq
+; Match:
9767
+;      (parallel [(set () ()) (clobber (CC))])
9768
+;      (compare () ())
9769
+; Transform to:
9770
+;      (parallel [(set () ()) (set (CC) (0))]
9771
+;      (compare () ())
9772 117 dgisselq
+;
9773 127 dgisselq
+(define_peephole2
9774
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
9775
+               (clobber (reg:CC CC_REG))])
9776
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 2 "")
9777
+                       (match_operand:SI 3 "")))]
9778
+       "(ZIP_PEEPHOLE)&&zip_insn_sets_cc(insn)"
9779
+       [(parallel [(set (match_dup 0) (match_dup 1))
9780
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9781
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (match_dup 3)))]
9782
+       "")
9783
+;
9784
+;
9785
+;
9786 122 dgisselq
+; Match:
9787 127 dgisselq
+;      (parallel [(set () ()) (clobber (CC))])
9788
+;      (set () ())
9789
+;      (compare () ())
9790
+; Transform to:
9791
+;      (parallel [(set () ()) (set (CC) (0))]
9792
+;      (set () ())
9793
+;      (compare () ())
9794
+;
9795
+(define_peephole2
9796
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
9797
+               (clobber (reg:CC CC_REG))])
9798
+       (set (match_operand 2 "") (match_operand 3 ""))
9799
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 4 "")
9800
+                       (match_operand:SI 5 "")))]
9801
+       "(ZIP_PEEPHOLE)&&(zip_insn_sets_cc(insn))&&((!REG_P(operands[2]))||(REGNO(operands[2])!=CC_REG))"
9802
+       [(parallel [(set (match_dup 0) (match_dup 1))
9803
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9804
+       (set (match_dup 2) (match_dup 3))
9805
+       (set (reg:CC CC_REG) (compare:CC (match_dup 4) (match_dup 5)))]
9806
+       "")
9807
+;
9808
+;
9809
+;
9810
+; Match:
9811 122 dgisselq
+;      MOV A(R1),R3
9812
+;      CMP R3,R0
9813
+;      (R3 is dead)
9814
+; Transform to:
9815
+;      CMP A(R1),R0
9816
+;
9817
+(define_peephole2
9818
+       [(set (match_operand:SI 3 "register_operand")
9819
+               (plus:SI (match_operand:SI 1 "register_operand")
9820
+                       (match_operand:SI 2 "zip_mvimm_operand_p")))
9821
+       (set (reg:CC CC_REG)
9822
+               (compare:CC (match_operand:SI 0 "register_operand")
9823
+                       (match_dup 3)))]
9824 127 dgisselq
+       "(ZIP_PEEPHOLE)&&peep2_regno_dead_p(2, REGNO(operands[3]))"
9825 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9826
+               (plus:SI (match_dup 1) (match_dup 2))))]
9827
+       "")
9828
+;
9829
+;
9830
+; Match:
9831
+;      ALU OpB,R0
9832
+;      CMP 0,R0
9833
+; Transform to:
9834
+;      ALU OpB,R0
9835
+;
9836
+(define_peephole2
9837 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9838
+                       (match_operand:SI 1 ""))
9839 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9840
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9841 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9842 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
9843
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9844
+       ])
9845
+;
9846
+;
9847
+; Match:
9848
+;      ALU OpB,R0
9849
+;      MOV R1,R2       // Can be LDI, LOD, STO, etc.
9850 127 dgisselq
+;      CMP 0,R0
9851 122 dgisselq
+; Transform to:
9852
+;      ALU OpB,R0
9853
+;      MOV R0,R1
9854
+;
9855
+(define_peephole2
9856 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9857
+                       (match_operand:SI 1 ""))
9858 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9859 124 dgisselq
+       (set (match_operand:SI 2 "nonimmediate_operand") (match_operand:SI 3 ""))
9860 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9861 127 dgisselq
+       "(ZIP_PEEPHOLE)&&((!REG_P(operands[2]))||((REGNO(operands[2])!=REGNO(operands[0]))&&((REGNO(operands[2])>=FIRST_PSEUDO_REGISTER)||(REGNO(operands[2])<CC_REG))))"
9862 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
9863
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9864
+       (set (match_dup 2) (match_dup 3))
9865
+       ])
9866
+;
9867
+;
9868
+; Match:
9869
+;      ALU OpB,R0
9870
+;      MOV R0,R1
9871
+;      CMP 0,R1
9872
+; Transform to:
9873
+;      ALU OpB,R0
9874
+;      MOV R0,R1
9875
+;
9876
+(define_peephole2
9877 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9878
+                       (match_operand:SI 1 ""))
9879 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9880 124 dgisselq
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))
9881 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
9882 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9883 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
9884
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9885
+       (set (match_dup 2) (match_dup 3))
9886
+       ])
9887
+;
9888 124 dgisselq
+;
9889
+; Match:
9890
+;      MOV R1,R0
9891
+;      ADD $x,R0
9892
+;      (CCREG is dead, and x is within range ...)
9893
+; Transform to:
9894 127 dgisselq
+;      MOV $x(R1),R0
9895 124 dgisselq
+(define_peephole2
9896
+       [(set (match_operand:SI 0 "register_operand")
9897
+               (match_operand:SI 1 "register_operand"))
9898
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
9899
+                               (match_operand 2 "zip_mvimm_operand_p")))
9900
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9901
+       ]
9902 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))"
9903 124 dgisselq
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
9904
+;
9905 127 dgisselq
+; Match:
9906
+;      MOV A(R0),R0
9907
+;      ADD $x,R1
9908
+;      (CCREG is dead, and (A+x) is within range ...)
9909
+; Transform to:
9910
+;      MOV $x(R1),R0
9911 124 dgisselq
+;
9912 127 dgisselq
+(define_peephole2
9913
+       [(set (match_operand:SI 0 "register_operand")
9914
+               (plus:SI (match_operand:SI 1 "register_operand")
9915
+                       (match_operand 2 "zip_mvimm_operand_p")))
9916
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
9917
+                               (match_operand 3 "zip_mvimm_operand_p")))
9918
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9919
+       ]
9920
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
9921
+               &&(INTVAL(operands[2])+INTVAL(operands[3])<((1<<17)))
9922
+               &&(INTVAL(operands[2])+INTVAL(operands[3])>=-(1<<17))"
9923
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
9924
+       "operands[2]=GEN_INT(INTVAL(operands[2])+INTVAL(operands[3]));")
9925 124 dgisselq
+;
9926 127 dgisselq
+;
9927
+;
9928 124 dgisselq
+; Match:
9929
+;      ADD $x,R0
9930
+;      MOV R0,R1
9931
+;      (CCREG is dead, and R0 is dead)
9932
+; Transform to:
9933
+;      MOV (A+$x)(R0),R1
9934
+; ... again, how do I build this plus?
9935
+;
9936
+(define_peephole2
9937
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9938
+                       (plus:SI (match_dup 0)
9939
+                               (match_operand 1 "zip_mvimm_operand_p")))
9940
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9941
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))]
9942 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2,CC_REG))"
9943 124 dgisselq
+       [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])
9944
+;
9945
+;
9946 127 dgisselq
+;
9947 124 dgisselq
+; Match:
9948 127 dgisselq
+;      ADD $x,R0
9949
+;      MOV A(R0),R1
9950
+;      (CCREG is dead, and R0 is dead)
9951
+; Transform to:
9952
+;      MOV (A+$x)(R0),R1
9953
+;
9954
+(define_peephole2
9955
+       [(parallel [
9956
+               (set (match_operand:SI 0 "register_operand")
9957
+                       (plus:SI (match_dup 0)
9958
+                               (match_operand 1 "zip_mvimm_operand_p")))
9959
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9960
+       (set (match_operand:SI 2 "register_operand")
9961
+               (plus:SI (match_dup 0)
9962
+                       (match_operand 3 "zip_mvimm_operand_p")))
9963
+       ]
9964
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
9965
+               &&(peep2_regno_dead_p(1,REGNO(operands[0])))
9966
+               &&(INTVAL(operands[1])+INTVAL(operands[3])<((1<<17)))
9967
+               &&(INTVAL(operands[1])+INTVAL(operands[3])>=-(1<<17))"
9968
+       [(set (match_dup 0) (plus:SI (match_dup 2) (match_dup 3)))]
9969
+       "operands[3]=GEN_INT(INTVAL(operands[1])+INTVAL(operands[3]));")
9970
+;
9971
+;
9972
+;
9973
+; Match:
9974 124 dgisselq
+;      ADD     $x,R0
9975
+;      ADD     R0,Rn
9976
+;      (R0 is dead, if R0 is not Rn)
9977
+; Transform to:
9978
+;      ADD     $x(R0),Rn
9979
+;
9980
+(define_peephole2
9981
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9982
+                       (plus:SI (match_dup 0)
9983
+                               (match_operand 1 "zip_opb_immv_p")))
9984
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9985
+       (parallel [(set (match_operand:SI 2 "register_operand")
9986
+                       (plus:SI (match_dup 2) (match_dup 0)))
9987
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
9988
+       ]
9989 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[2]))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
9990 124 dgisselq
+       [(parallel [(set (match_dup 2)
9991
+                       (plus:SI (match_dup 2)
9992
+                               (plus:SI (match_dup 0)
9993
+                                       (match_dup 1))))
9994
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
9995
+       ])
9996
+;
9997
+; Match:
9998
+;      ADD     $x,R0
9999
+;      LOD     -x(R0),R1
10000
+; Transform to:
10001
+;      LOD     (R0),R1
10002
+;      ADD     $x,R0
10003
+;
10004
+(define_peephole2
10005
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10006
+                       (plus:SI (match_dup 0)
10007
+                               (match_operand 1 "zip_opb_immv_p")))
10008
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10009
+       (set (match_operand:SI 3 "register_operand")
10010
+               (mem:SI (plus:SI (match_dup 0)
10011
+                       (match_operand 2 "zip_opb_immv_p"))))
10012
+       ]
10013 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10014 124 dgisselq
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10015
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10016
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10017
+       ])
10018 127 dgisselq
+(define_peephole2
10019
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10020
+                       (plus:SI (match_dup 0)
10021
+                               (match_operand 1 "zip_opb_immv_p")))
10022
+               (clobber (reg:CC CC_REG))])
10023
+       (set (match_operand:SI 3 "register_operand")
10024
+               (mem:SI (plus:SI (match_dup 0)
10025
+                       (match_operand 2 "zip_opb_immv_p"))))
10026
+       ]
10027
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10028
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10029
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10030
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10031
+       ])
10032 124 dgisselq
+;
10033
+;
10034
+;
10035
+; Match:
10036
+;      ADD     $x,R0
10037
+;      STO     R1,-x(R0)
10038
+; Transform to:
10039
+;      STO     R1,(R0)
10040
+;      ADD     $x,R0
10041
+;
10042
+(define_peephole2
10043
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10044
+                       (plus:SI (match_dup 0)
10045
+                               (match_operand 1 "zip_opb_immv_p")))
10046
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10047
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10048
+               (match_operand:SI 3 "register_operand"))
10049
+       ]
10050 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10051 124 dgisselq
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10052
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10053
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10054
+       ])
10055 127 dgisselq
+(define_peephole2
10056
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10057
+                       (plus:SI (match_dup 0)
10058
+                               (match_operand 1 "zip_opb_immv_p")))
10059
+               (clobber (reg:CC CC_REG))])
10060
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10061
+               (match_operand:SI 3 "register_operand"))
10062
+       ]
10063
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10064
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10065
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10066
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10067
+       ])
10068 124 dgisselq
+;
10069
+;
10070
+; Match:
10071
+;      ADD     $x,R0
10072
+;      ANY     R1,R2 (destination is not R0, source does not reference R0)
10073
+;      ADD     R0,Rn (could be 1 or 2, not 0)
10074
+;      (R0 is dead)
10075
+; Transform to:
10076
+;      ANY     R1,R2
10077
+;      ADD     $x(R0),Rn
10078
+;
10079
+;
10080
+;
10081 127 dgisselq
+; Match:
10082
+;      MOV     R1,R0
10083
+;      AND     #/R2,R0
10084
+;      (Ry dead ...)
10085
+; Transform to:
10086
+;      TEST    #/Rz,Rx
10087 124 dgisselq
+;
10088 127 dgisselq
+(define_peephole2
10089
+       [(set (match_operand:SI 0 "register_operand")
10090
+               (match_operand:SI 1 "register_operand"))
10091
+       (parallel [(set (match_dup 0)
10092
+                       (and:SI (match_dup 0)
10093
+                               (match_operand:SI 2 "zip_opb_single_operand_p")))
10094
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10095
+       ]
10096
+       "((1)||(ZIP_PEEPHOLE))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10097
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_dup 1) (match_dup 2))
10098
+                       (const_int 0)))])
10099
+;
10100
+; Match:
10101
+;      (call ...
10102
+;      (set (pc) (label))
10103
+;  or (in asm)
10104
+;      MOV     .Lcallx(PC),R0
10105
+;      BRA     (somewhere)
10106
+; .Lcallx
10107
+;      BRA     (somewhere-else)
10108
+; Transform to:
10109
+;
10110
+;      (sequence [(call ...
10111
+;              (set (pc) (label))])
10112
+;   or (in asm)
10113
+;      "LDI    (somewhere-else),R0
10114
+;      BRA     subroutine"
10115
+;
10116
+; While the following looks good, it doesnt work.  My guess is that the reason
10117
+; why it doesnt work is that the jump at the end crosses basic block boundaries.
10118
+;
10119
+;(define_insn "void_call_mem_unspec"
10120
+;      [(call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p" ""))] UNSPEC_RAW_CALL)
10121
+;                      (match_operand 1 "const_int_operand" "n"))
10122
+;              (clobber (reg:SI RTN_REG))
10123
+;              (clobber (reg:CC CC_REG))]
10124
+;      ""
10125
+;      "BRA\t%0,PC"
10126
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10127
+;(define_peephole2
10128
+;      [(parallel [(call (mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))
10129
+;                      (match_operand 1 "const_int_operand"))
10130
+;              (clobber (reg:SI RTN_REG))
10131
+;              (clobber (reg:CC CC_REG))])
10132
+;      ; The match operand for the (set (pc) ...) cannot have anything but
10133
+;      ; VOIDmode, or it wont match.
10134
+;      (set (pc) (match_operand:VOID 2 "zip_const_address_operand_p"))]
10135
+;      ""
10136
+;      [(set (reg:SI RTN_REG) (match_dup 2))
10137
+;      (call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))] UNSPEC_RAW_CALL)
10138
+;                      (match_operand 1 "const_int_operand"))
10139
+;              (use (reg:SI RTN_REG))
10140
+;              (clobber (reg:SI RTN_REG))
10141
+;              (clobber (reg:CC CC_REG))]
10142
+;      "fprintf(stderr, \"CALL-JUMP Matched\");")
10143
+;
10144
+;
10145
+;
10146
+; So, the following *should* have worked as well.  However, this falls apart
10147
+; because the 'final' routine can't tell if we are calling a subroutine in this
10148
+; function or not.
10149
+;
10150
+;(define_peephole
10151
+       ;[(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p"))
10152
+                       ;(match_operand 1 "const_int_operand"))
10153
+               ;(clobber (reg:SI RTN_REG))
10154
+               ;(clobber (reg:CC CC_REG))])
10155
+       ;(set (pc) (label_ref (match_operand 2 "")))]
10156
+       ;""
10157
+       ;"LDI\t%2,R0\;BRA\t%0"
10158
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10159
+;
10160 124 dgisselq
+; and for
10161
+;      BRA target
10162
+;      BRA target ; two branches to the same identical target in a row ...
10163
+;
10164
+;
10165
+;
10166 102 dgisselq
+; STILL MISSING:
10167
+;      SYSCALL(ID)
10168
+;              MOV %ID,R0
10169
+;              CLR     CC
10170
+;      cmove   ... the conditional move, created from a
10171
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
10172
+;      pattern
10173
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip-modes.def gcc-5.3.0-zip/gcc/config/zip/zip-modes.def
10174
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
10175 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
10176
@@ -0,0 +1,23 @@
10177 102 dgisselq
+/*
10178
+ * Commends in C-long comment form
10179
+ * class
10180
+ *     Mode = "SI"
10181
+ *     PRECISION, BYTESIZE, COUNT ??
10182
+ *     FORMAT
10183
+ *     EXPR
10184 111 dgisselq
+ *
10185
+ * The manual says I need to define BITS_PER_UNIT here.
10186 102 dgisselq
+ */
10187
+// INT_MODE(QI, 1);
10188
+// INT_MODE(HI, 1);
10189
+// INT_MODE(SI, 1);
10190
+// INT_MODE(DI, 2);
10191
+
10192
+// FLOAT_MODE(SF, 1, ieee_single_format);
10193
+// FLOAT_MODE(DF, 2, ieee_single_format);
10194
+
10195
+// We cannot override machmodes.def from here.  Thus, even though our QI,
10196
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
10197
+// change needed to be made in machmodes.def.  Hence, here is a target
10198
+// configuration change--in machmodes.def--that properly belonged in the
10199
+// config directory.
10200
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip-protos.h gcc-5.3.0-zip/gcc/config/zip/zip-protos.h
10201
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
10202 127 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-04-21 16:19:02.122215475 -0400
10203
@@ -0,0 +1,82 @@
10204 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
10205
+//
10206
+// Filename:   zip-protos.h
10207
+//
10208
+// Project:    Zip CPU backend for the GNU Compiler Collection
10209
+//
10210
+// Purpose:
10211
+//
10212
+// Creator:    Dan Gisselquist, Ph.D.
10213
+//             Gisselquist Technology, LLC
10214
+//
10215
+////////////////////////////////////////////////////////////////////////////////
10216
+//
10217
+// Copyright (C) 2016, Gisselquist Technology, LLC
10218
+//
10219
+// This program is free software (firmware): you can redistribute it and/or
10220
+// modify it under the terms of  the GNU General Public License as published
10221
+// by the Free Software Foundation, either version 3 of the License, or (at
10222
+// your option) any later version.
10223
+//
10224
+// This program is distributed in the hope that it will be useful, but WITHOUT
10225
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
10226
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10227
+// for more details.
10228
+//
10229
+// You should have received a copy of the GNU General Public License along
10230
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
10231
+// target there if the PDF file isn't present.)  If not, see
10232
+// <http://www.gnu.org/licenses/> for a copy.
10233
+//
10234
+// License:    GPL, v3, as defined and found on www.gnu.org,
10235
+//             http://www.gnu.org/licenses/gpl.html
10236
+//
10237
+//
10238
+////////////////////////////////////////////////////////////////////////////////
10239
+#ifndef        ZIP_PROTOS_H
10240
+#define        ZIP_PROTOS_H
10241
+
10242 127 dgisselq
+extern bool    zip_supported_condition(int c);
10243 102 dgisselq
+extern void    zip_expand_prologue(void);
10244
+extern void    zip_expand_epilogue(void);
10245 127 dgisselq
+extern void    zip_expand_movsicc(rtx,rtx,rtx,rtx);
10246 102 dgisselq
+extern int     zip_initial_elimination_offset(int, int);
10247
+extern void    zip_print_operand(FILE *, rtx, int);
10248
+extern void    zip_print_operand_address(FILE *, rtx);
10249
+extern enum    reg_class       zip_reg_class(int);
10250
+extern rtx     zip_return_addr_rtx(int, rtx);
10251
+extern int     zip_num_arg_regs(enum machine_mode, tree);
10252
+
10253
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
10254 122 dgisselq
+
10255
+#ifdef HAVE_cc0
10256 102 dgisselq
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
10257 122 dgisselq
+#else
10258
+extern void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
10259
+#endif
10260 102 dgisselq
+extern int     zip_address_operand(rtx op);
10261
+extern int     zip_const_address_operand(rtx op);
10262
+extern bool    zip_gen_move_rtl(rtx, rtx);
10263
+extern bool    zip_use_return_insn(void);
10264
+extern const char *zip_set_zero_or_one(rtx, rtx);
10265
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10266
+
10267 127 dgisselq
+extern int     zip_insn_sets_cc(rtx_insn *insn);
10268
+extern int     zip_is_conditional(rtx_insn *insn);
10269 102 dgisselq
+extern int     zip_ct_address_operand(rtx op);
10270 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
10271 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
10272 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
10273
+extern int     zip_pd_mvimm_operand(rtx op);
10274 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
10275
+extern int     zip_pd_const_address_operand(rtx op);
10276
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10277
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
10278
+
10279 122 dgisselq
+extern void    zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
10280
+extern void    zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
10281
+extern void    zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
10282
+extern void    zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
10283
+
10284 102 dgisselq
+#endif
10285
+
10286
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
10287
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
10288
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
10289
@@ -479,6 +479,10 @@
10290
 tilepro*-*-*)
10291
        cpu_type=tilepro
10292
        ;;
10293
+zip*)
10294
+       cpu_type=zip
10295
+       tmake_file=zip/t-zip
10296
+       ;;
10297
 esac
10298
 
10299
 tm_file=${cpu_type}/${cpu_type}.h
10300
@@ -2972,6 +2976,15 @@
10301
        c_target_objs="m32c-pragma.o"
10302
        cxx_target_objs="m32c-pragma.o"
10303
        ;;
10304
+zip-*-netbsd*)
10305
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
10306
+       tmake_file="${tmake_file} zip/t-zip"
10307
+       ;;
10308
+zip*)
10309
+       target_has_targetm_common=yes
10310
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
10311
+       tmake_file="${tmake_file} zip/t-zip"
10312
+       ;;
10313
 *)
10314
        echo "*** Configuration ${target} not supported" 1>&2
10315
        exit 1
10316
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
10317
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
10318 138 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-05-04 11:07:38.874831028 -0400
10319
@@ -70,6 +70,7 @@
10320
 #include "dbgcnt.h"
10321
 #include "rtl-iter.h"
10322
 
10323
+
10324
 /* The basic idea of common subexpression elimination is to go
10325
    through the code, keeping a record of expressions that would
10326
    have the same value at the current scan point, and replacing
10327
@@ -634,6 +635,16 @@
10328 102 dgisselq
 
10329
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
10330
 
10331 111 dgisselq
+// #define     DO_ZIP_DEBUGS
10332 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
10333
+#include <stdio.h>
10334 138 dgisselq
+extern void    zip_debug_rtx(const_rtx);
10335
+extern void    zip_debug_rtx_pfx(char *, const_rtx);
10336 102 dgisselq
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
10337
+#else
10338
+#define        ZIP_DEBUG_LINE(STR,RTX)
10339
+#endif
10340
+
10341
 static bool
10342
 fixed_base_plus_p (rtx x)
10343
 {
10344 138 dgisselq
@@ -2898,6 +2909,7 @@
10345 102 dgisselq
          validate_canon_reg (&XVECEXP (x, i, j), insn);
10346
     }
10347
 
10348
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
10349
   return x;
10350
 }
10351
 
10352 138 dgisselq
@@ -3125,6 +3137,8 @@
10353
   rtx new_rtx = 0;
10354
   int changed = 0;
10355
 
10356
+ZIP_DEBUG_LINE("CSE:FOLD-RTX", insn);
10357
+
10358
   /* Operands of X.  */
10359
   /* Workaround -Wmaybe-uninitialized false positive during
10360
      profiledbootstrap by initializing them.  */
10361
@@ -3144,14 +3158,16 @@
10362 102 dgisselq
   if (x == 0)
10363
     return x;
10364
 
10365
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
10366
   /* Try to perform some initial simplifications on X.  */
10367
   code = GET_CODE (x);
10368
   switch (code)
10369
     {
10370
     case MEM:
10371
     case SUBREG:
10372
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
10373
-        return new_rtx;
10374
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
10375
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
10376
+        return new_rtx; }
10377
       return x;
10378
 
10379
     case CONST:
10380 138 dgisselq
@@ -3208,6 +3224,8 @@
10381 102 dgisselq
        rtx folded_arg = XEXP (x, i), const_arg;
10382
        machine_mode mode_arg = GET_MODE (folded_arg);
10383
 
10384
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
10385
+
10386
        switch (GET_CODE (folded_arg))
10387
          {
10388
          case MEM:
10389 138 dgisselq
@@ -3317,6 +3335,7 @@
10390 102 dgisselq
        }
10391
 
10392
       apply_change_group ();
10393
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
10394
     }
10395
 
10396
   /* If X is an arithmetic operation, see if we can simplify it.  */
10397 138 dgisselq
@@ -4203,6 +4222,7 @@
10398 102 dgisselq
 {
10399
   rtx dest = SET_DEST (set);
10400
   rtx src = SET_SRC (set);
10401
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
10402
 
10403
   if (REG_P (dest)
10404
       && REG_P (src) && ! HARD_REGISTER_P (src)
10405 138 dgisselq
@@ -4258,6 +4278,7 @@
10406 102 dgisselq
            }
10407
        }
10408
     }
10409
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
10410
 }
10411
 
10412
 /* Record all the SETs in this instruction into SETS_PTR,
10413 138 dgisselq
@@ -4351,6 +4372,7 @@
10414 102 dgisselq
   rtx tem;
10415
   rtx x = PATTERN (insn);
10416
   int i;
10417
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
10418
 
10419
   if (CALL_P (insn))
10420
     {
10421 138 dgisselq
@@ -4364,6 +4386,7 @@
10422 102 dgisselq
       canon_reg (SET_SRC (x), insn);
10423
       apply_change_group ();
10424
       fold_rtx (SET_SRC (x), insn);
10425
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
10426
     }
10427
   else if (GET_CODE (x) == CLOBBER)
10428
     {
10429 138 dgisselq
@@ -4400,6 +4423,7 @@
10430 102 dgisselq
     canon_reg (PATTERN (insn), insn);
10431
   else if (GET_CODE (x) == PARALLEL)
10432
     {
10433
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
10434
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
10435
        {
10436
          rtx y = XVECEXP (x, 0, i);
10437 138 dgisselq
@@ -4491,6 +4515,7 @@
10438 102 dgisselq
 
10439
      The result of apply_change_group can be ignored; see canon_reg.  */
10440
 
10441
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
10442
   apply_change_group ();
10443
 }
10444
 
10445
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
10446
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
10447
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
10448
@@ -480,6 +480,8 @@
10449
 #define LOG2_BITS_PER_UNIT 3
10450
 #elif BITS_PER_UNIT == 16
10451
 #define LOG2_BITS_PER_UNIT 4
10452
+#elif BITS_PER_UNIT == 32
10453
+#define LOG2_BITS_PER_UNIT 5
10454
 #else
10455
 #error Unknown BITS_PER_UNIT
10456
 #endif
10457 127 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/df-scan.c gcc-5.3.0-zip/gcc/df-scan.c
10458
--- gcc-5.3.0-original/gcc/df-scan.c    2015-01-09 15:18:42.000000000 -0500
10459
+++ gcc-5.3.0-zip/gcc/df-scan.c 2016-04-14 16:12:03.614777002 -0400
10460
@@ -61,6 +61,14 @@
10461
 
10462
 typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
10463
 
10464
+// #define     DO_ZIP_DEBUGS
10465
+#ifdef DO_ZIP_DEBUGS
10466
+extern void    zip_debug_rtx(const_rtx);
10467
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10468
+#else
10469
+#define        ZIP_DEBUG_LINE(STR,RTX)
10470
+#endif
10471
+
10472
 
10473
 #ifndef HAVE_epilogue
10474
 #define HAVE_epilogue 0
10475 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
10476
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
10477
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
10478
@@ -0,0 +1,214 @@
10479
+This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdfetex 2014.5.7)  30 JAN 2016 15:17
10480
+entering extended mode
10481
+ restricted \write18 enabled.
10482
+ file:line:error style messages enabled.
10483
+ %&-line parsing enabled.
10484
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
10485
+gcc.texi
10486
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
10487
+Loading texinfo [version 2013-09-11.11]:
10488
+\bindingoffset=\dimen16
10489
+\normaloffset=\dimen17
10490
+\pagewidth=\dimen18
10491
+\pageheight=\dimen19
10492
+\outerhsize=\dimen20
10493
+\outervsize=\dimen21
10494
+\cornerlong=\dimen22
10495
+\cornerthick=\dimen23
10496
+\topandbottommargin=\dimen24
10497
+\headlinebox=\box16
10498
+\footlinebox=\box17
10499
+\margin=\insert252
10500
+\EMsimple=\toks13
10501
+\groupbox=\box18
10502
+\groupinvalidhelp=\toks14
10503
+\mil=\dimen25
10504
+\exdentamount=\skip18
10505
+\inmarginspacing=\skip19
10506
+\centerpenalty=\count27
10507
+ pdf,
10508
+\tempnum=\count28
10509
+\lnkcount=\count29
10510
+\filename=\toks15
10511
+\filenamelength=\count30
10512
+\pgn=\count31
10513
+\toksA=\toks16
10514
+\toksB=\toks17
10515
+\toksC=\toks18
10516
+\toksD=\toks19
10517
+\boxA=\box19
10518
+\countA=\count32
10519
+\nopdfimagehelp=\toks20
10520
+ fonts,
10521
+\sffam=\fam8
10522
+\textleading=\dimen26
10523
+ markup,
10524
+\fontdepth=\count33
10525
+ glyphs,
10526
+\errorbox=\box20
10527
+
10528
+page headings,
10529
+\titlepagetopglue=\skip20
10530
+\titlepagebottomglue=\skip21
10531
+\evenheadline=\toks21
10532
+\oddheadline=\toks22
10533
+\evenfootline=\toks23
10534
+\oddfootline=\toks24
10535
+ tables,
10536
+\tableindent=\dimen27
10537
+\itemindent=\dimen28
10538
+\itemmargin=\dimen29
10539
+\itemmax=\dimen30
10540
+\itemno=\count34
10541
+\multitableparskip=\skip22
10542
+\multitableparindent=\skip23
10543
+\multitablecolspace=\dimen31
10544
+\multitablelinespace=\skip24
10545
+\colcount=\count35
10546
+\everytab=\toks25
10547
+ conditionals,
10548
+\doignorecount=\count36
10549
+ indexing,
10550
+\whatsitskip=\skip25
10551
+\whatsitpenalty=\count37
10552
+\secondaryindent=\skip26
10553
+\partialpage=\box21
10554
+\doublecolumnhsize=\dimen32
10555
+ sectioning,
10556
+\unnumberedno=\count38
10557
+\chapno=\count39
10558
+\secno=\count40
10559
+\subsecno=\count41
10560
+\subsubsecno=\count42
10561
+\appendixno=\count43
10562
+\absseclevel=\count44
10563
+\secbase=\count45
10564
+\chapheadingskip=\skip27
10565
+\secheadingskip=\skip28
10566
+\subsecheadingskip=\skip29
10567
+ toc,
10568
+\tocfile=\write0
10569
+\contentsrightmargin=\skip30
10570
+\savepageno=\count46
10571
+\lastnegativepageno=\count47
10572
+\tocindent=\dimen33
10573
+ environments,
10574
+\lispnarrowing=\skip31
10575
+\envskipamount=\skip32
10576
+\circthick=\dimen34
10577
+\cartouter=\dimen35
10578
+\cartinner=\dimen36
10579
+\normbskip=\skip33
10580
+\normpskip=\skip34
10581
+\normlskip=\skip35
10582
+\lskip=\skip36
10583
+\rskip=\skip37
10584
+\nonfillparindent=\dimen37
10585
+\tabw=\dimen38
10586
+\verbbox=\box22
10587
+
10588
+defuns,
10589
+\defbodyindent=\skip38
10590
+\defargsindent=\skip39
10591
+\deflastargmargin=\skip40
10592
+\defunpenalty=\count48
10593
+\parencount=\count49
10594
+\brackcount=\count50
10595
+ macros,
10596
+\paramno=\count51
10597
+\macname=\toks26
10598
+ cross references,
10599
+\auxfile=\write1
10600
+\savesfregister=\count52
10601
+\toprefbox=\box23
10602
+\printedrefnamebox=\box24
10603
+\infofilenamebox=\box25
10604
+\printedmanualbox=\box26
10605
+ insertions,
10606
+\footnoteno=\count53
10607
+\SAVEfootins=\box27
10608
+\SAVEmargin=\box28
10609
+
10610
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
10611
+This is `epsf.tex' v2.7.4 <14 February 2011>
10612
+\epsffilein=\read1
10613
+\epsfframemargin=\dimen39
10614
+\epsfframethickness=\dimen40
10615
+\epsfrsize=\dimen41
10616
+\epsftmp=\dimen42
10617
+\epsftsize=\dimen43
10618
+\epsfxsize=\dimen44
10619
+\epsfysize=\dimen45
10620
+\pspoints=\dimen46
10621
+)
10622
+\noepsfhelp=\toks27
10623
+ localization,
10624
+\nolanghelp=\toks28
10625
+\countUTFx=\count54
10626
+\countUTFy=\count55
10627
+\countUTFz=\count56
10628
+ formatting,
10629
+\defaultparindent=\dimen47
10630
+ and turning on texinfo input format.)
10631
+\openout1 = `gcc.aux'.
10632
+
10633
+@cpindfile=@write2
10634
+@fnindfile=@write3
10635
+@vrindfile=@write4
10636
+@tpindfile=@write5
10637
+@kyindfile=@write6
10638
+@pgindfile=@write7
10639
+texinfo.tex: doing @include of gcc-common.texi
10640
+
10641
+
10642
+./gcc.texi:25: I can't find file `gcc-common.texi'.
10643
+@temp ->@input gcc-common.texi
10644
+
10645
+@includezzz ...and @input #1 }@expandafter }@temp
10646
+                                                  @popthisfilestack
10647
+l.25 @include gcc-common.texi
10648
+
10649
+(Press Enter to retry, or Control-D to exit)
10650
+Please type another input file name: include/gcc-common.texi
10651
+(./include/gcc-common.texi
10652
+texinfo.tex: doing @include of gcc-vers.texi
10653
+
10654
+
10655
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
10656
+@temp ->@input gcc-vers.texi
10657
+
10658
+@includezzz ...and @input #1 }@expandafter }@temp
10659
+                                                  @popthisfilestack
10660
+l.11 @include gcc-vers.texi
10661
+
10662
+(Press Enter to retry, or Control-D to exit)
10663
+Please type another input file name: include/gcc-vers.texi
10664
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
10665
+@temp ->@input gcc-vers.texi
10666
+
10667
+@includezzz ...and @input #1 }@expandafter }@temp
10668
+                                                  @popthisfilestack
10669
+l.11 @include gcc-vers.texi
10670
+
10671
+(Press Enter to retry, or Control-D to exit)
10672
+Please type another input file name:
10673
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
10674
+@temp ->@input gcc-vers.texi
10675
+
10676
+@includezzz ...and @input #1 }@expandafter }@temp
10677
+                                                  @popthisfilestack
10678
+l.11 @include gcc-vers.texi
10679
+
10680
+(Press Enter to retry, or Control-D to exit)
10681
+Please type another input file name:
10682
+./include/gcc-common.texi:11: Emergency stop.
10683
+@temp ->@input gcc-vers.texi
10684
+
10685
+@includezzz ...and @input #1 }@expandafter }@temp
10686
+                                                  @popthisfilestack
10687
+l.11 @include gcc-vers.texi
10688
+
10689
+End of file on the terminal!
10690
+
10691
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
10692
+duced!
10693 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
10694
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
10695 138 dgisselq
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-05-02 07:48:47.925017436 -0400
10696 117 dgisselq
@@ -81,6 +81,15 @@
10697
 #include "builtins.h"
10698
 #include "rtl-iter.h"
10699
 
10700
+// #define     DO_ZIP_DEBUGS
10701
+#include <stdio.h>
10702
+#ifdef DO_ZIP_DEBUGS
10703
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10704
+extern void    zip_debug_rtx(const_rtx);
10705
+#else
10706
+#define        ZIP_DEBUG_LINE(STR,RTX)
10707
+#endif
10708
+
10709
 struct target_rtl default_target_rtl;
10710
 #if SWITCHABLE_TARGET
10711
 struct target_rtl *this_target_rtl = &default_target_rtl;
10712 127 dgisselq
@@ -2979,6 +2988,8 @@
10713 117 dgisselq
       break;
10714
     }
10715
 
10716
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
10717
+
10718
   /* This rtx may not be shared.  If it has already been seen,
10719
      replace it with a copy of itself.  */
10720
 
10721 127 dgisselq
@@ -2989,6 +3000,8 @@
10722 117 dgisselq
     }
10723
   RTX_FLAG (x, used) = 1;
10724
 
10725
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
10726
+
10727
   /* Now scan the subexpressions recursively.
10728
      We can store any replaced subexpressions directly into X
10729
      since we know X is not shared!  Any vectors in X
10730 127 dgisselq
@@ -3665,7 +3678,9 @@
10731
     split_branch_probability = XINT (note, 0);
10732
   probability = split_branch_probability;
10733
 
10734
+ZIP_DEBUG_LINE("Before split", trial);
10735
   seq = safe_as_a <rtx_insn *> (split_insns (pat, trial));
10736
+ZIP_DEBUG_LINE("After split", seq);
10737
 
10738
   split_branch_probability = -1;
10739
 
10740
@@ -3834,6 +3849,7 @@
10741
     if (! tem->deleted () && INSN_P (tem))
10742
       tem = try_split (PATTERN (tem), tem, 1);
10743
 
10744
+
10745
   /* Return either the first or the last insn, depending on which was
10746
      requested.  */
10747
   return last
10748 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
10749
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
10750 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
10751 102 dgisselq
@@ -7999,6 +7999,8 @@
10752
    the back of the caller.
10753
    The normal operating mode is to pass FALSE for this parameter.  */
10754
 
10755
+#include "print-tree.h"
10756
+
10757
 rtx
10758
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
10759
                  enum expand_modifier modifier, rtx *alt_rtl,
10760 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
10761
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
10762 127 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-04-20 20:52:07.186056061 -0400
10763 111 dgisselq
@@ -109,6 +109,14 @@
10764
 #include "wide-int-print.h"
10765
 #include "rtl-iter.h"
10766
 
10767 122 dgisselq
+// #define     DO_ZIP_DEBUGS
10768 111 dgisselq
+#ifdef DO_ZIP_DEBUGS
10769
+extern void zip_debug_rtx(const_rtx);
10770
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10771
+#else
10772
+#define        ZIP_DEBUG_LINE(STR,RTX)
10773
+#endif
10774
+
10775
 #ifdef XCOFF_DEBUGGING_INFO
10776
 #include "xcoffout.h"          /* Needed for external data
10777
                                   declarations for e.g. AIX 4.x.  */
10778
@@ -2071,6 +2079,8 @@
10779
   /* Output the insns.  */
10780
   for (insn = first; insn;)
10781
     {
10782
+       ZIP_DEBUG_LINE("final()\n", insn);
10783
+
10784
       if (HAVE_ATTR_length)
10785
        {
10786
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
10787 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
10788
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
10789
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
10790
@@ -330,7 +330,8 @@
10791
         the size of a CC mode is four units.  */
10792
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
10793
 
10794
-      m->bytesize = 4;
10795
+       /* For the ZipCPU, however, it is only one unit */
10796
+      m->bytesize = 1;
10797
       m->ncomponents = 1;
10798
       m->component = 0;
10799
       break;
10800
@@ -766,11 +767,12 @@
10801
 
10802
   /* So put the default value unless the target needs a non standard
10803
      value. */
10804
-#ifdef BITS_PER_UNIT
10805
-  bits_per_unit = BITS_PER_UNIT;
10806
-#else
10807
-  bits_per_unit = 8;
10808
-#endif
10809
+// #ifdef BITS_PER_UNIT
10810
+  // bits_per_unit = BITS_PER_UNIT;
10811
+// #else
10812
+  bits_per_unit = 32;
10813
+#warning "Is there a more automated way to set bits per unit?"
10814
+// #endif
10815
 
10816
 #ifdef MAX_BITSIZE_MODE_ANY_INT
10817
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
10818
@@ -1083,7 +1085,7 @@
10819
       first = modes[c];
10820
       last = 0;
10821
       for (m = first; m; last = m, m = m->next)
10822
-       ;
10823
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
10824
 
10825
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
10826
         end will try to use it for bitfields in structures and the
10827
@@ -1268,7 +1270,7 @@
10828
            continue;
10829
          if (m->precision != (unsigned int) -1)
10830
            {
10831
-             if (m2->precision != 2 * m->precision)
10832
+             if (m2->precision < 2 * m->precision)
10833
                continue;
10834
            }
10835
          else
10836
@@ -1323,7 +1325,6 @@
10837
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
10838
     else
10839
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
10840
-
10841
   puts ("#undef MODE_MASK");
10842
   print_closer ();
10843
 }
10844
@@ -1351,12 +1352,23 @@
10845
   int c;
10846
   struct mode_data *m;
10847
 
10848
+  puts(
10849
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
10850
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
10851
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
10852
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
10853
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
10854
+" * of the target word in size.  However, this tries to do a little something\n"
10855
+" * teach our compiler what we are doing.\n"
10856
+" */\n");
10857
   print_maybe_const_decl ("%sunsigned char",
10858
                          "mode_base_align", "NUM_MACHINE_MODES",
10859
                          alignment);
10860
 
10861
   for_all_modes (c, m)
10862
-    tagged_printf ("%u", m->alignment, m->name);
10863
+    tagged_printf ("%u", 4*m->bytesize,
10864
+               // m->alignment,
10865
+               m->name);
10866
 
10867
   print_closer ();
10868
 }
10869 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
10870
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
10871 122 dgisselq
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-06 14:06:50.207563805 -0400
10872 117 dgisselq
@@ -80,6 +80,14 @@
10873
 #include "target.h"
10874
 #include "rtl-iter.h"
10875
 
10876
+// #define     DO_ZIP_DEBUGS
10877
+#ifdef DO_ZIP_DEBUGS
10878
+#include <stdio.h>
10879
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
10880
+extern void zip_debug_rtx(const_rtx);
10881
+#else
10882
+#define        ZIP_DEBUG_LINE(STR,RTX)
10883
+#endif
10884
 /* Optimize jump y; x: ... y: jumpif... x?
10885
    Don't know if it is worth bothering with.  */
10886
 /* Optimize two cases of conditional jump to conditional jump?
10887
@@ -1136,6 +1144,7 @@
10888
   int i;
10889
   const char *fmt;
10890
 
10891
+ZIP_DEBUG_LINE("Mark jump label",insn);
10892
   switch (code)
10893
     {
10894
     case PC:
10895
@@ -1248,6 +1257,8 @@
10896
       break;
10897
     }
10898
 
10899
+ZIP_DEBUG_LINE("Post case",insn);
10900
+
10901
   fmt = GET_RTX_FORMAT (code);
10902
 
10903
   /* The primary target of a tablejump is the label of the ADDR_VEC,
10904 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
10905
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
10906 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
10907 102 dgisselq
@@ -184,11 +184,11 @@
10908
    larger types, then corresponding modes must be added here.  The
10909
    name OI is reserved for a 256-bit type (needed by some back ends).
10910
     */
10911
-INT_MODE (QI, 1);
10912
-INT_MODE (HI, 2);
10913
-INT_MODE (SI, 4);
10914
-INT_MODE (DI, 8);
10915
-INT_MODE (TI, 16);
10916
+// INT_MODE (QI, 1);
10917
+// INT_MODE (HI, 1);
10918
+INT_MODE (SI, 1);
10919
+INT_MODE (DI, 2);
10920
+INT_MODE (TI, 4);
10921
 
10922
 /* No partial integer modes are defined by default.  */
10923
 
10924 111 dgisselq
@@ -206,35 +206,35 @@
10925 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
10926
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
10927
 
10928
-FLOAT_MODE (SF, 4, ieee_single_format);
10929
-FLOAT_MODE (DF, 8, ieee_double_format);
10930
+FLOAT_MODE (SF, 1, ieee_single_format);
10931
+FLOAT_MODE (DF, 2, ieee_double_format);
10932
 
10933
 /* Basic CC modes.
10934
    FIXME define this only for targets that need it.  */
10935 111 dgisselq
 CC_MODE (CC);
10936 102 dgisselq
 
10937
 /* Fixed-point modes.  */
10938 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
10939 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
10940
-FRACT_MODE (SQ, 4, 31); /* s.31 */
10941
-FRACT_MODE (DQ, 8, 63); /* s.63 */
10942
-FRACT_MODE (TQ, 16, 127); /* s.127 */
10943 111 dgisselq
-
10944
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
10945 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
10946
-UFRACT_MODE (USQ, 4, 32); /* .32 */
10947
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
10948
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
10949 111 dgisselq
-
10950
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
10951
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
10952
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
10953
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
10954
-
10955
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
10956
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
10957
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
10958
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
10959
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
10960
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
10961
+FRACT_MODE (SQ, 1, 31); /* s.31 */
10962
+FRACT_MODE (DQ, 2, 63); /* s.63 */
10963
+FRACT_MODE (TQ, 4, 127); /* s.127 */
10964
+
10965
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
10966
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
10967 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
10968
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
10969
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
10970 111 dgisselq
+
10971
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
10972
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
10973
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
10974
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
10975
+
10976
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
10977
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
10978
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
10979
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
10980 102 dgisselq
 
10981 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
10982
 #if HAVE_EXTRA_MODES
10983 102 dgisselq
@@ -246,9 +246,9 @@
10984
 COMPLEX_MODES (FLOAT);
10985
 
10986
 /* Decimal floating point modes.  */
10987
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
10988
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
10989
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
10990
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
10991
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
10992
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
10993
 
10994
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
10995
    The tm.h file specifies which one.  It is not a distinct mode.  */
10996
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
10997
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
10998
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
10999
@@ -180,13 +180,7 @@
11000
 /* Get the size in bytes and bits of an object of mode MODE.  */
11001
 
11002
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
11003
-#if GCC_VERSION >= 4001
11004
-#define GET_MODE_SIZE(MODE) \
11005
-  ((unsigned short) (__builtin_constant_p (MODE) \
11006
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
11007
-#else
11008
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
11009
-#endif
11010
 #define GET_MODE_BITSIZE(MODE) \
11011
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
11012
 
11013
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
11014
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
11015
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
11016
@@ -765,10 +765,14 @@
11017
        {
11018
          switch (TYPE_MODE (type))
11019
            {
11020
+#ifdef HAVE_QImode
11021
            case QImode:
11022
              charType = 'C'; break;
11023
+#endif
11024
+#ifdef HAVE_HImode
11025
            case HImode:
11026
              charType = 'S'; break;
11027
+#endif
11028
            case SImode:
11029
              {
11030
                if (type == long_unsigned_type_node)
11031
@@ -788,10 +792,14 @@
11032
        {
11033
          switch (TYPE_MODE (type))
11034
            {
11035
+#ifdef HAVE_QImode
11036
            case QImode:
11037
              charType = 'c'; break;
11038
+#endif
11039
+#ifdef HAVE_HImode
11040
            case HImode:
11041
              charType = 's'; break;
11042
+#endif
11043
            case SImode:
11044
              {
11045
                if (type == long_integer_type_node)
11046
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
11047
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
11048 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
11049
@@ -71,6 +71,14 @@
11050 102 dgisselq
 #include "df.h"
11051
 #include "dbgcnt.h"
11052
 
11053 111 dgisselq
+// #define     DO_ZIP_DEBUGS
11054 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
11055
+extern void zip_debug_rtx(const_rtx);
11056
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11057
+#else
11058
+#define        ZIP_DEBUG_LINE(STR,RTX)
11059
+#endif
11060
+
11061
 static int reload_cse_noop_set_p (rtx);
11062
 static bool reload_cse_simplify (rtx_insn *, rtx);
11063
 static void reload_cse_regs_1 (void);
11064 111 dgisselq
@@ -120,6 +128,8 @@
11065 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
11066
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
11067
 
11068
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
11069
+
11070
   if (GET_CODE (body) == SET)
11071
     {
11072
       int count = 0;
11073 111 dgisselq
@@ -147,6 +157,7 @@
11074 102 dgisselq
        apply_change_group ();
11075
       else
11076
        reload_cse_simplify_operands (insn, testreg);
11077
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11078
     }
11079
   else if (GET_CODE (body) == PARALLEL)
11080
     {
11081 111 dgisselq
@@ -205,6 +216,7 @@
11082 102 dgisselq
        apply_change_group ();
11083
       else
11084
        reload_cse_simplify_operands (insn, testreg);
11085
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11086
     }
11087
 
11088
 done:
11089 111 dgisselq
@@ -246,6 +258,7 @@
11090 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
11091
 
11092
        cselib_process_insn (insn);
11093
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
11094
       }
11095
 
11096
   /* Clean up.  */
11097 111 dgisselq
@@ -276,6 +289,8 @@
11098 102 dgisselq
 #endif
11099
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
11100
 
11101
+
11102
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
11103
   dreg = true_regnum (SET_DEST (set));
11104
   if (dreg < 0)
11105
     return 0;
11106 111 dgisselq
@@ -427,6 +442,7 @@
11107 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
11108
   int *alternative_order;
11109
 
11110
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
11111
   extract_constrain_insn (insn);
11112
 
11113
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
11114 111 dgisselq
@@ -519,6 +535,7 @@
11115 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
11116
     }
11117
 
11118
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
11119
   alternative_mask preferred = get_preferred_alternatives (insn);
11120
   for (i = 0; i < recog_data.n_operands; i++)
11121
     {
11122 111 dgisselq
@@ -617,6 +634,7 @@
11123 102 dgisselq
            }
11124
        }
11125
     }
11126
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
11127
 
11128
   /* Record all alternatives which are better or equal to the currently
11129
      matching one in the alternative_order array.  */
11130 111 dgisselq
@@ -666,6 +684,7 @@
11131 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
11132
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
11133
     }
11134
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11135
 
11136
   for (i = recog_data.n_dups - 1; i >= 0; i--)
11137
     {
11138 111 dgisselq
@@ -679,6 +698,7 @@
11139 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
11140
     }
11141
 
11142
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11143
   return apply_change_group ();
11144
 }
11145
 
11146 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
11147
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
11148 127 dgisselq
+++ gcc-5.3.0-zip/gcc/recog.c   2016-04-14 23:19:07.630839483 -0400
11149 117 dgisselq
@@ -68,6 +68,15 @@
11150
 #include "df.h"
11151
 #include "insn-codes.h"
11152
 
11153
+// #define     DO_ZIP_DEBUGS
11154
+#ifdef DO_ZIP_DEBUGS
11155
+extern void    zip_debug_rtx(const_rtx);
11156
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11157
+#else
11158
+#define        ZIP_DEBUG_LINE(STR,RTX)
11159
+#endif
11160
+
11161
+
11162
 #ifndef STACK_PUSH_CODE
11163
 #ifdef STACK_GROWS_DOWNWARD
11164
 #define STACK_PUSH_CODE PRE_DEC
11165 122 dgisselq
@@ -2283,6 +2292,7 @@
11166
   recog_data.n_dups = 0;
11167
   recog_data.is_asm = false;
11168
 
11169
+ZIP_DEBUG_LINE("Extract-insn", insn);
11170
   switch (GET_CODE (body))
11171
     {
11172
     case USE:
11173
@@ -3671,7 +3681,6 @@
11174 117 dgisselq
            break;
11175
 
11176
          /* The buffer filled to the current maximum, so try to match.  */
11177
-
11178
          pos = peep2_buf_position (peep2_current + peep2_current_count);
11179
          peep2_insn_data[pos].insn = PEEP2_EOB;
11180
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
11181 122 dgisselq
@@ -3704,6 +3713,7 @@
11182 117 dgisselq
     rebuild_jump_labels (get_insns ());
11183
   if (peep2_do_cleanup_cfg)
11184
     cleanup_cfg (CLEANUP_CFG_CHANGED);
11185
+
11186
 }
11187
 #endif /* HAVE_peephole2 */
11188
 
11189
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
11190
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
11191 127 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-20 20:51:38.590252867 -0400
11192 117 dgisselq
@@ -72,6 +72,14 @@
11193
 #include "dumpfile.h"
11194
 #include "rtl-iter.h"
11195
 
11196
+// #define     DO_ZIP_DEBUGS
11197
+#ifdef DO_ZIP_DEBUGS
11198
+extern void    zip_debug_rtx(const_rtx);
11199
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11200
+#else
11201
+#define        ZIP_DEBUG_LINE(STR,RTX)
11202
+#endif
11203
+
11204
 /* This file contains the reload pass of the compiler, which is
11205
    run after register allocation has been done.  It checks that
11206
    each insn is valid (operands required to be in registers really
11207 127 dgisselq
@@ -794,6 +802,20 @@
11208 117 dgisselq
   basic_block bb;
11209
   bool inserted;
11210
 
11211
+#ifdef DO_ZIP_DEBUGS
11212
+  {
11213 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD\n");
11214 117 dgisselq
+       int     total_count = 0, current_count = 0;
11215
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11216
+               total_count++;
11217
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11218
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
11219
+               zip_debug_rtx(insn);
11220
+       }
11221 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD -- END OF INSTRUCTION LIST\n");
11222 117 dgisselq
+  }
11223
+#endif
11224
+
11225
   /* Make sure even insns with volatile mem refs are recognizable.  */
11226
   init_recog ();
11227
 
11228 127 dgisselq
@@ -1366,6 +1388,20 @@
11229 117 dgisselq
 
11230
   reload_completed = !failure;
11231
 
11232
+#ifdef DO_ZIP_DEBUGS
11233
+  {
11234 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD\n");
11235 117 dgisselq
+       int     total_count = 0, current_count = 0;
11236
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11237
+               total_count++;
11238
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11239
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
11240
+               zip_debug_rtx(insn);
11241
+       }
11242 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD -- END OF INSTRUCTION LIST\n");
11243 117 dgisselq
+  }
11244
+#endif
11245
+
11246
   return need_dce;
11247
 }
11248
 
11249 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
11250
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
11251 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-04-06 17:49:33.418613170 -0400
11252
@@ -136,6 +136,15 @@
11253
 #include "target.h"
11254
 #include "ira.h"
11255
 
11256
+// #define     DO_ZIP_DEBUGS
11257
+#ifdef DO_ZIP_DEBUGS
11258
+extern void zip_debug_rtx(const_rtx);
11259
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11260
+#else
11261
+#define        ZIP_DEBUG_LINE(STR,RTX)
11262
+#endif
11263
+
11264
+
11265
 /* True if X is a constant that can be forced into the constant pool.
11266
    MODE is the mode of the operand, or VOIDmode if not known.  */
11267
 #define CONST_POOL_OK_P(MODE, X)               \
11268
@@ -2700,6 +2709,8 @@
11269
   hard_regs_live_known = live_known;
11270
   static_reload_reg_p = reload_reg_p;
11271
 
11272
+ZIP_DEBUG_LINE("Find reloads\n", insn);
11273
+
11274
   /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
11275
      neither are insns that SET cc0.  Insns that use CC0 are not allowed
11276
      to have any input reloads.  */
11277
@@ -2707,8 +2718,17 @@
11278 102 dgisselq
     no_output_reloads = 1;
11279
 
11280
 #ifdef HAVE_cc0
11281
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
11282
+  // cond_exec instruction, we cannot change the input so that the instruction
11283
+  // relies on another register--cc0 is specific.  This requries that the
11284
+  // references be only cc0 and (const_int 0), rather than allowing other
11285
+  // registers here as well.
11286
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
11287
     no_input_reloads = 1;
11288
+  // If the result of an instruction is the cc0 register, that cannot
11289
+  // be changed, therefore no output reloading is allowed.  This only
11290
+  // works if instructions *only* set the cc0 register, and not multiple
11291
+  // registers.
11292
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
11293
     no_output_reloads = 1;
11294
 #endif
11295
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp
11296
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
11297
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
11298
@@ -503,6 +503,11 @@
11299
        return 0
11300
     }
11301
 
11302
+    # Zip CPU doesn't support profiling (yet)
11303
+    if { [istarget zip*] }
11304
+        return 0
11305
+    }
11306
+
11307
     # MinGW does not support -p.
11308
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
11309
        return 0
11310
@@ -986,6 +991,12 @@
11311
        }]
11312
     }
11313
 
11314
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
11315
+    # set supports it, the CPU just isn't ready yet.
11316
+    if { [istarget zip*-*-*] } {
11317
+        return 0
11318
+    }
11319
+
11320
     # This proc is actually checking the availabilty of FPU
11321
     # support for doubles, so on the RX we must fail if the
11322
     # 64-bit double multilib has been selected.
11323
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/tree-ssa-math-opts.c gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c
11324
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
11325
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
11326
@@ -972,7 +972,7 @@
11327
     {
11328
       if (val & 1)
11329
        {
11330
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
11331
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
11332
          result += powi_lookup_cost (digit, cache)
11333
                    + POWI_WINDOW_SIZE + 1;
11334
          val >>= POWI_WINDOW_SIZE;
11335
@@ -1012,7 +1012,7 @@
11336
     }
11337
   else if (n & 1)
11338
     {
11339
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
11340
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
11341
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
11342
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
11343
     }
11344
@@ -1651,7 +1651,7 @@
11345
 };
11346
 
11347
 #define BITS_PER_MARKER 8
11348
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
11349
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
11350
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
11351
 #define HEAD_MARKER(n, size) \
11352
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
11353
@@ -1687,7 +1687,7 @@
11354
   /* Zero out the extra bits of N in order to avoid them being shifted
11355
      into the significant bits.  */
11356
   if (size < 64 / BITS_PER_MARKER)
11357
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11358
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11359
 
11360
   switch (code)
11361
     {
11362
@@ -1714,7 +1714,7 @@
11363
     }
11364
   /* Zero unused bits for size.  */
11365
   if (size < 64 / BITS_PER_MARKER)
11366
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11367
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11368
   return true;
11369
 }
11370
 
11371
@@ -1761,7 +1761,7 @@
11372
   n->n = CMPNOP;
11373
 
11374
   if (size < 64 / BITS_PER_MARKER)
11375
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11376
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11377
 
11378
   return true;
11379
 }
11380
@@ -2020,7 +2020,7 @@
11381
          {
11382
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
11383
            uint64_t val = int_cst_value (rhs2), mask = 0;
11384
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
11385
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
11386
 
11387
            /* Only constants masking full bytes are allowed.  */
11388
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
11389
@@ -2064,7 +2064,7 @@
11390
              {
11391
                /* If STMT casts to a smaller type mask out the bits not
11392
                   belonging to the target type.  */
11393
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
11394
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
11395
              }
11396
            n->type = type;
11397
            if (!n->base_addr)
11398
@@ -2177,7 +2177,7 @@
11399
     {
11400
       uint64_t mask;
11401
 
11402
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
11403
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
11404
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
11405
       cmpnop &= mask;
11406
     }
11407
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
11408
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
11409 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
11410 102 dgisselq
@@ -143,6 +143,13 @@
11411
 #include "rtl-iter.h"
11412
 #include "fibonacci_heap.h"
11413
 
11414 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
11415 102 dgisselq
+#include <stdio.h>
11416
+extern void zip_debug_rtx(const_rtx);
11417
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11418
+#else
11419
+#define ZIP_DEBUG_LINE(STR,RTX)
11420
+#endif
11421
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
11422
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
11423
 
11424
@@ -6356,6 +6363,7 @@
11425
                machine_mode indmode
11426
                  = TYPE_MODE (TREE_TYPE (argtype));
11427
                rtx mem = gen_rtx_MEM (indmode, x);
11428
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
11429
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
11430
                if (val && cselib_preserved_value_p (val))
11431
                  {
11432
@@ -6462,12 +6470,14 @@
11433
       machine_mode mode
11434
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
11435
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
11436
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
11437
       HOST_WIDE_INT token
11438
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
11439
       if (token)
11440
        clobbered = plus_constant (mode, clobbered,
11441
                                   token * GET_MODE_SIZE (mode));
11442
       clobbered = gen_rtx_MEM (mode, clobbered);
11443
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
11444
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
11445
       call_arguments
11446
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
11447
@@ -9790,6 +9800,7 @@
11448
              machine_mode indmode
11449
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
11450
              rtx mem = gen_rtx_MEM (indmode, incoming);
11451
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
11452
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
11453
                                                         VOIDmode,
11454
                                                         get_insns ());
11455
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
11456
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
11457
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
11458
@@ -195,6 +195,9 @@
11459
 tic6x-*-*)
11460
        cpu_type=c6x
11461
        ;;
11462
+zip*)
11463
+       cpu_type=zip
11464
+       ;;
11465
 esac
11466
 
11467
 # Common parts for widely ported systems.
11468
@@ -1300,6 +1303,9 @@
11469
        echo "*** Configuration ${host} not supported" 1>&2
11470
        exit 1
11471
        ;;
11472
+zip*)
11473
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
11474
+       ;;
11475
 esac
11476
 
11477
 case ${host} in
11478
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
11479
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
11480
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
11481
@@ -150,6 +150,9 @@
11482
        # Need to link with -lpthread so libgomp.so is self-contained.
11483
        XLDFLAGS="${XLDFLAGS} -lpthread"
11484
        ;;
11485
+  zip*)
11486
+        config_path="bsd posix"
11487
+        ;;
11488
 
11489
   *)
11490
        ;;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.