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

Subversion Repositories zipcpu

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

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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-04-02 11:53:47.213604913 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-04-02 11:53:47.217604879 -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 117 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-04-02 11:53:47.217604879 -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 117 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-04-01 06:26:30.217272207 -0400
700
@@ -0,0 +1,2341 @@
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
+
777
+// #include "tmp_p.h"
778
+#include "target.h"
779
+#include "target-def.h"
780
+// #include "tm-constrs.h"
781
+// #include "tm-preds.h"
782
+
783
+#include "diagnostic.h"
784
+// #include "integrate.h"
785
+
786
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
787
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
788
+static bool    zip_return_in_memory(const_tree, const_tree);
789
+static bool    zip_frame_pointer_required(void);
790
+// static      bool    zip_must_pass_in_stack(enum machine_mode, const_tree);
791
+
792
+// static      void    zip_setup_incoming_varargs(CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
793
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
794
+               const_tree type, bool named);
795
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
796
+
797
+static void    zip_asm_trampoline_template(FILE *);
798
+static void    zip_trampoline_init(rtx, tree, rtx);
799
+static void    zip_init_builtins(void);
800
+static tree zip_builtin_decl(unsigned, bool);
801
+// static void zip_asm_output_anchor(rtx x);
802
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
803
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
804
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
805
+                       enum machine_mode tmode, int    ignore);
806
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
807
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
808
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
809
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
810
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
811 111 dgisselq
+static          HOST_WIDE_INT  zip_min_opb_imm = -0x200000;
812
+static          HOST_WIDE_INT  zip_max_opb_imm =  0x1fffff;
813 102 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
814
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
815
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
816
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
817
+static int     zip_sched_issue_rate(void) { return 1; }
818
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
819
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
820
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
821
+       void    zip_debug_rtx(const_rtx x);
822
+static void    zip_override_options(void);
823
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
824
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
825 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
826 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void);
827 102 dgisselq
+
828
+
829 103 dgisselq
+#define        ALL_DEBUG_OFF   false
830 102 dgisselq
+#define        ALL_DEBUG_ON    false
831
+
832
+enum ZIP_BUILTIN_ID_CODE {
833
+       ZIP_BUILTIN_RTU,
834
+       ZIP_BUILTIN_HALT,
835
+       ZIP_BUILTIN_IDLE,
836
+       ZIP_BUILTIN_SYSCALL,
837
+       ZIP_BUILTIN_SAVE_CONTEXT,
838
+       ZIP_BUILTIN_RESTORE_CONTEXT,
839
+       ZIP_BUILTIN_BITREV,
840
+       ZIP_BUILTIN_CC,
841 117 dgisselq
+       ZIP_BUILTIN_UCC,
842 102 dgisselq
+       ZIP_BUILTIN_MAX
843
+};
844
+
845
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
846
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
847
+
848
+
849
+#include "gt-zip.h"
850
+
851
+/* The Global 'targetm' Variable. */
852
+struct gcc_target      targetm = TARGET_INITIALIZER;
853
+
854
+
855
+enum   reg_class zip_reg_class(int);
856
+
857
+#define        LOSE_AND_RETURN(msgid, x)               \
858
+       do {                                    \
859
+               zip_operand_lossage(msgid, x);  \
860
+               return;                         \
861
+       } while(0)
862
+
863
+/* Per-function machine data. */
864
+struct GTY(()) machine_function
865
+{
866
+       /* number of pretented arguments for varargs */
867
+       int     pretend_size;
868
+
869
+       /* Number of bytes saved on the stack for local variables. */
870
+       int     local_vars_size;
871
+
872
+       /* Number of bytes saved on stack for register save area */
873
+       int     saved_reg_size;
874
+       int     save_ret;
875
+
876
+       int     sp_fp_offset;
877
+       bool    fp_needed;
878
+       int     size_for_adjusting_sp;
879
+};
880
+
881
+/* Allocate a chunk of memory for per-function machine-dependent data. */
882
+
883
+static struct machine_function *
884
+zip_init_machine_status(void) {
885
+       return ggc_cleared_alloc<machine_function>();
886
+}
887
+
888
+static void
889
+zip_override_options(void)
890
+{
891
+       init_machine_status = zip_init_machine_status;
892
+}
893
+
894
+enum   reg_class
895
+zip_reg_class(int regno)
896
+{
897
+       if (is_ZIP_GENERAL_REG(regno)) {
898
+               return GENERAL_REGS;
899
+       } else if (is_ZIP_REG(regno)) {
900
+               return ALL_REGS;
901
+       } return NO_REGS;
902
+}
903
+
904
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
905
+static bool
906
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
907
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
908
+       return (size == -1)||(size > UNITS_PER_WORD);
909
+}
910
+
911
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
912
+ * insn.  Formatted output isn't easily implemented, since we use output operand
913
+ * lossage to output the actual message and handle the categorization of the
914
+ * error.  */
915
+
916
+static void
917
+zip_operand_lossage(const char *msgid, rtx op) {
918
+       fprintf(stderr, "Operand lossage??\n");
919
+       debug_rtx(op);
920
+       zip_debug_rtx(op);
921
+       output_operand_lossage("%s", msgid);
922
+}
923
+
924
+/* The PRINT_OPERAND_ADDRESS worker.   */
925
+void
926
+zip_print_operand_address(FILE *file, rtx x) {
927
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
928
+
929
+       if (dbg) zip_debug_rtx(x);
930
+       switch(GET_CODE(x)) {
931
+               case REG:
932
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
933
+                       break;
934
+               case SYMBOL_REF:
935
+                       fprintf(file, "%s", XSTR(x,0));
936
+                       break;
937
+               case LABEL_REF:
938
+                       x = LABEL_REF_LABEL(x);
939
+               case CODE_LABEL:
940
+                       { char buf[256];
941
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
942
+#ifdef ASM_OUTPUT_LABEL_REF
943
+                       ASM_OUTPUT_LABEL_REF(file, buf);
944
+#else
945
+                       assemble_name(file, buf);
946
+#endif
947
+                       }
948
+                       break;
949
+               case PLUS:
950 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
951
+                               fprintf(stderr, "Unsupported address construct\n");
952
+                               zip_debug_rtx(x);
953 102 dgisselq
+                               abort();
954 111 dgisselq
+                       } if (CONST_INT_P(XEXP(x, 1))) {
955 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
956
+                                       fprintf(file, "%ld(%s)",
957
+                                       INTVAL(XEXP(x, 1)),
958
+                                       reg_names[REGNO(XEXP(x, 0))]);
959
+                               } else {
960
+                                       fprintf(file, "(%s)",
961
+                                       reg_names[REGNO(XEXP(x, 0))]);
962
+                               }
963
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
964
+                               fprintf(file, "%s(%s)", XSTR(x,0),
965
+                                       reg_names[REGNO(XEXP(x, 0))]);
966
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
967
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
968
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
969
+                               fprintf(file, "%s-%s(%s)",
970
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
971
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
972
+                                       reg_names[REGNO(XEXP(x, 0))]);
973
+                       } else
974
+                               fprintf(file, "#INVALID(%s)",
975
+                                       reg_names[REGNO(XEXP(x, 0))]);
976
+                       /*
977
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
978
+                               fprintf(file, "%s(%s)",
979
+                                       GET_CODE(XEXP(addr, 1)),
980
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
981
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
982
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
983
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
984
+                               fprintf(file, "%s-%s(%s)",
985
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
986
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
987
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
988
+                       }
989
+                       */
990
+                       break;
991
+               // We don't support direct memory addressing within our
992
+               // instruction set, even though the instructions themselves
993
+               // would support direct memory addressing of the lower 18 bits
994
+               // of memory space.
995
+               case MEM:
996
+                       if (dbg) zip_debug_rtx(x);
997
+                       zip_print_operand_address(file, XEXP(x, 0));
998
+                       break;
999 111 dgisselq
+               case CONST_INT:
1000
+                       fprintf(file, "%ld",INTVAL(x));
1001
+                       break;
1002 102 dgisselq
+               default:
1003 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
1004
+                       zip_debug_rtx(x);
1005 102 dgisselq
+                       abort(); break;
1006
+                       // output_addr_const(file, x);
1007
+               break;
1008
+       }
1009
+}
1010
+
1011
+/* The PRINT_OPERAND worker. */
1012
+
1013
+void
1014
+zip_print_operand(FILE *file, rtx x, int code)
1015
+{
1016
+       rtx operand = x;
1017
+       int     rgoff = 0;
1018
+
1019
+       // fprintf(file, "Print Operand!\n");
1020
+
1021
+       /* New code entries should just be added to the switch below.  If
1022
+        * handling is finished, just return.  If handling was just a
1023
+        * modification of the operand, the modified operand should be put in
1024
+        * "operand", and then do a break to let default handling
1025
+        * (zero-modifier) output the operand.
1026
+        */
1027
+       switch(code) {
1028
+               case 0:
1029
+                       /* No code, print as usual. */
1030
+                       break;
1031
+               case 'L':
1032
+                       /* Lower of two registers, print one up */
1033
+                       rgoff = 1;
1034
+                       break;
1035
+               case 'R':
1036
+               case 'H':
1037
+                       /* Higher of a register pair, print normal */
1038
+                       break;
1039
+
1040
+               default:
1041
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1042
+       }
1043
+
1044
+       /* Print an operand as without a modifier letter. */
1045
+       switch (GET_CODE(operand)) {
1046
+       case REG:
1047
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1048
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1049
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1050
+               return;
1051
+       case SCRATCH:
1052
+               LOSE_AND_RETURN("Need a scratch register", x);
1053
+               return;
1054
+
1055
+       case CODE_LABEL:
1056
+       case LABEL_REF:
1057
+       case SYMBOL_REF:
1058
+       case PLUS:
1059
+               PRINT_OPERAND_ADDRESS(file, operand);
1060
+               return;
1061
+       case MEM:
1062
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1063
+               return;
1064
+
1065
+       default:
1066
+               /* No need to handle all strange variants, let
1067
+                * output_addr_const do it for us.
1068
+                */
1069
+               if (CONSTANT_P(operand)) {
1070
+                       output_addr_const(file, operand);
1071
+                       return;
1072
+               }
1073
+
1074
+               LOSE_AND_RETURN("unexpected operand", x);
1075
+       }
1076
+}
1077
+
1078
+static bool
1079
+zip_frame_pointer_required(void)
1080
+{
1081
+       // This should really depend upon whether we have variable sized
1082
+       // arguments in our frame or not.  Once this fails, let's look
1083
+       // at what the problem was and then whether or not we can detect
1084
+       // it.
1085
+       //
1086
+       // Use a GCC global to determine our answer
1087 103 dgisselq
+       if (cfun->calls_alloca)
1088
+               return true;
1089 102 dgisselq
+       return (frame_pointer_needed);
1090
+/*
1091
+       fprintf(stderr, "ZIP_FRAME_POINTER_REQUIRED()\n");
1092
+       if (frame_pointer_needed) {
1093
+               fprintf(stderr, "FRAME_POINTER_NEEDED is true\n");
1094
+               zip_debug_rtx(frame_pointer_rtx);
1095
+               if (frame_pointer_rtx == NULL_RTX)
1096
+                       return true;
1097
+               if (GET_CODE(frame_pointer_rtx)==PLUS) {
1098
+                       if ((REG_P(XEXP(frame_pointer_rtx,0)))
1099
+                               &&(REGNO(XEXP(frame_pointer_rtx, 0))==zip_SP)
1100
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,1))))
1101
+                               return false;
1102
+                       if ((REG_P(XEXP(frame_pointer_rtx,1)))
1103
+                               &&(REGNO(XEXP(frame_pointer_rtx, 1))==zip_SP)
1104
+                               &&(CONST_INT_P(XEXP(frame_pointer_rtx,0))))
1105
+                               return false;
1106
+                       return true;
1107
+               } else if ((REG_P(frame_pointer_rtx))
1108
+                               &&(REGNO(frame_pointer_rtx) == zip_SP))
1109
+                       return false;
1110
+               return true;
1111
+       } else return false;
1112
+*/
1113
+}
1114
+
1115
+/* Determine whether or not a register needs to be saved on the stack or not.
1116
+ */
1117
+static bool
1118
+zip_save_reg(int regno) {
1119
+       if (regno == 0)
1120
+               return ((!crtl->is_leaf)
1121
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1122
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1123
+               return  ((df_regs_ever_live_p(regno))
1124
+                               &&(!call_used_regs[regno]));
1125
+       else if (regno == zip_FP)
1126
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1127
+                               &&(!call_used_regs[regno])));
1128
+       else if (regno < zip_FP)
1129
+               return  ((df_regs_ever_live_p(regno))
1130
+                               &&(!call_used_regs[regno]));
1131
+       return false;
1132
+}
1133
+
1134
+/* Compute the size of the local area and the size to be adjusted by the
1135
+ * prologue and epilogue.
1136
+ *
1137
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1138
+ *
1139
+ *     Stack Pointer ->
1140
+ *                     Local variables (could be variable size)
1141
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1142
+ *                     Saved return address, if saved
1143
+ *                     Other Saved registers
1144
+ *                     Saved frame pointer (if used)
1145
+ *                     Saved R12, if used
1146
+ *                     (Stack pointer is not saved)
1147
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1148
+ *                     Called arguments (not passed in registers)
1149
+ *                     Return arguments (not R1, args.pretend_args_size)
1150
+ *             (Prior function's stack frame ... )
1151
+ *
1152
+ */
1153
+static void
1154
+zip_compute_frame(void) {
1155
+       int     regno;
1156
+       int     args_size;
1157
+
1158
+       // gcc_assert(crtl);
1159
+       gcc_assert(cfun);
1160
+       gcc_assert(cfun->machine);
1161
+
1162
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1163
+
1164
+       if(crtl->args.pretend_args_size > 0) {
1165
+               args_size += crtl->args.pretend_args_size;
1166
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1167
+                       // crtl->args.pretend_args_size);
1168
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1169
+       }
1170
+
1171
+       cfun->machine->local_vars_size = get_frame_size();
1172
+
1173
+       // Save callee-saved registers.
1174
+       cfun->machine->saved_reg_size = 0;
1175
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1176
+               if (zip_save_reg(regno))
1177
+                       cfun->machine->saved_reg_size ++;
1178
+       }
1179
+
1180
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1181
+
1182
+       if ((cfun->machine->fp_needed)&&
1183
+                       (!df_regs_ever_live_p(zip_FP))) {
1184
+               cfun->machine->saved_reg_size ++;
1185
+       }
1186
+
1187
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1188
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1189
+                       + cfun->machine->saved_reg_size
1190
+                       + args_size;
1191
+
1192
+       /*
1193
+       if (cfun->machine->fp_needed)
1194
+               frame_pointer_rtx = gen_rtx_REG(Pmode, zip_FP);
1195
+       else
1196
+               frame_pointer_rtx = plus_constant(Pmode, gen_rtx_REG(Pmode, zip_SP),
1197
+                       cfun->machine->sp_fp_offset);
1198
+       */
1199
+}
1200
+
1201
+void
1202
+zip_expand_prologue(void) {
1203
+       rtx     insn;
1204
+
1205
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1206
+       zip_compute_frame();
1207
+
1208 103 dgisselq
+       if (dbg)  fprintf(stderr, "Computing Prologue instructions\n");
1209 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1210
+               insn = emit_insn(gen_subsi3(stack_pointer_rtx,
1211
+                               stack_pointer_rtx,
1212
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1213
+                               SImode)));
1214
+                       // cfun->machine->sp_fp_offset
1215
+
1216
+               RTX_FRAME_RELATED_P(insn) = 1;
1217
+       }
1218
+
1219
+       {
1220
+               int offset = 0, regno;
1221
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1222
+                       if (zip_save_reg(regno)) {
1223
+                               insn=emit_insn(gen_movsi_sto(
1224
+                                       gen_rtx_MEM(SImode, plus_constant(
1225
+                                               Pmode, stack_pointer_rtx,
1226
+                                               cfun->machine->sp_fp_offset
1227
+                                               +offset++, true)),
1228
+                                       gen_rtx_REG(SImode, regno)));
1229
+                               RTX_FRAME_RELATED_P(insn) = 1;
1230
+                       }
1231
+               }
1232 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1233
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1234 102 dgisselq
+       }
1235
+
1236
+       if (cfun->machine->fp_needed) {
1237
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1238
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1239
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1240
+                               stack_pointer_rtx, gen_int_mode(
1241
+                                               cfun->machine->sp_fp_offset,
1242
+                                               SImode)));
1243
+               RTX_FRAME_RELATED_P(insn) = 1;
1244 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1245 102 dgisselq
+       }
1246
+}
1247
+
1248
+bool
1249
+zip_use_return_insn(void)
1250
+{
1251
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1252
+                       ||(get_frame_size()!=0)) {
1253
+               // If R0 ever gets pushed to the stack, then we cannot
1254
+               // use a master return from anywhere.  We need to clean up the
1255
+               // stack first.
1256
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1257
+                                               &&(!call_used_regs[0]))) {
1258
+                       return false;
1259
+               }
1260
+       }
1261
+       zip_compute_frame();
1262
+       return (cfun->machine->size_for_adjusting_sp == 0);
1263
+}
1264
+
1265
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1266
+ * upon the current stack pointer.  It should use the frame poitner only,
1267
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1268
+ * take advantage of it to omit stack adjustments before returning ...
1269
+ *
1270
+ * Let's see if we can use their approach here.
1271
+ *
1272
+ * We can't.  Consider our choices:
1273
+ *     LOD (FP),R0
1274
+ *     LOD 1(FP),R4
1275
+ *     LOD 2(FP),R5
1276
+ *     LOD 3(FP),R6
1277
+ *     LOD 4(FP),FP
1278
+ *     ... Then what is the stack pointer?
1279
+ * or
1280
+ *     LOD (FP),R0
1281
+ *     LOD 1(FP),R4
1282
+ *     LOD 2(FP),R5
1283
+ *     LOD 3(FP),R6
1284
+ *     MOV FP,SP
1285
+ *     LOD 4(SP),FP
1286
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1287
+ *     exploit our pipeline memory function
1288
+ * or
1289
+ *     MOV FP,SP
1290
+ *     LOD (SP),R0
1291
+ *     LOD 1(SP),R4
1292
+ *     LOD 2(SP),R5
1293
+ *     LOD 3(SP),R6
1294
+ *     LOD 4(SP),FP
1295
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1296
+ *
1297
+ */
1298
+void
1299
+zip_expand_epilogue(void) {
1300
+       int     regno, offset;
1301
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1302
+
1303
+       zip_compute_frame();
1304
+
1305
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1306
+       if (cfun->machine->fp_needed) {
1307
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1308
+               emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1309
+       }
1310
+
1311
+       if (cfun->machine->saved_reg_size != 0) {
1312
+               offset =  (cfun->machine->size_for_adjusting_sp -
1313
+                               cfun->machine->sp_fp_offset
1314
+                       - cfun->machine->saved_reg_size);
1315
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1316
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1317
+                       if (zip_save_reg(regno)) {
1318
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1319
+                               emit_insn(gen_movsi_lod(
1320
+                                               gen_rtx_REG(SImode, regno),
1321
+                                       gen_rtx_MEM(SImode, plus_constant( SImode,
1322
+                                               stack_pointer_rtx, offset++, true))));
1323
+                       }
1324
+               }
1325
+       }
1326
+
1327
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1328
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1329
+                               cfun->machine->size_for_adjusting_sp);
1330
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
1331
+                       gen_int_mode(
1332
+                               cfun->machine->size_for_adjusting_sp
1333
+                               -cfun->machine->sp_fp_offset, SImode)));
1334
+       }
1335
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1336
+
1337
+       emit_jump_insn(ret_rtx);
1338
+}
1339
+
1340
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1341
+ *
1342
+ * We currently only support calculating the return address for the current
1343
+ * frame.
1344
+ */
1345
+
1346
+/*
1347
+rtx
1348
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1349
+{
1350
+       if (count)
1351
+               return NULL_RTX;
1352
+
1353
+       zip_compute_frame();
1354
+
1355
+       // saved return address for current function is at fp - 1
1356
+       if (cfun->machine->save_ret)
1357
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1358
+                               -UNITS_PER_WORD));
1359
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1360
+}
1361
+*/
1362
+
1363
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1364
+ * return the OFFSET.
1365
+ */
1366
+int
1367
+zip_initial_elimination_offset(int from, int to) {
1368
+       int     ret = 0;
1369
+       zip_compute_frame();
1370
+
1371
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1372
+               ret = cfun->machine->sp_fp_offset;
1373 117 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1374
+               ret = cfun->machine->sp_fp_offset;
1375 102 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1376 117 dgisselq
+               // ret = cfun->machine->local_vars_size;
1377
+               ret = 0;
1378 102 dgisselq
+       } else {
1379
+               abort();
1380
+       }
1381
+
1382
+       return ret;
1383
+}
1384
+
1385
+/* Return non-zero if the function argument described by TYPE is to be passed
1386
+ * by reference.
1387
+ */
1388
+/*
1389
+static bool
1390
+zip_pass_by_reference(CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
1391
+               enum machine_mode mode, const_tree type,
1392
+               bool name ATTRIBUTE_UNUSED) {
1393
+       unsigned        HOST_WIDE_INT   size;
1394
+
1395
+       if (type) {
1396
+               if (AGGREGATE_TYPE_P(type)) {
1397
+                       return TRUE;
1398
+               } size = int_size_in_bytes(type);
1399
+       } else
1400
+               size = GET_MODE_SIZE(mode);
1401
+
1402
+       return (size > GET_MODE_SIZE(SImode)); // > 1 word : is this okay?
1403
+       // The idea is to pass everything larger than an int by reference (or
1404
+       // on the stack)
1405
+}
1406
+*/
1407
+
1408
+/*
1409
+ * Code taken from m68k ...
1410
+ */
1411
+static bool
1412
+zip_can_eliminate(int from, int to)
1413
+{
1414
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1415
+       if ((from == zip_FP)&&(to == zip_SP))
1416
+               return !cfun->machine->fp_needed;
1417
+       return true;
1418
+}
1419
+
1420
+/*
1421
+static bool
1422
+zip_must_pass_in_stack(enum machine_mode mode, const_tree type)
1423
+{
1424
+       if (mode == BLKmode) {
1425
+               return true;
1426
+       } if (type == NULL) {
1427
+               return false;
1428
+       } return AGGREGATE_TYPE_P(type);
1429
+}
1430
+*/
1431
+
1432
+/*
1433
+static void
1434
+zip_basic_check(void)
1435
+{
1436
+       gcc_assert(mode_base_align[SImode]==4);
1437
+       if ((BITS_PER_UNIT != 32)
1438
+                       ||(GET_MODE_SIZE(SImode)!=1)
1439
+                       ||(GET_MODE_SIZE(DImode)!=1)
1440
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1441
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1442
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1443
+               gcc_assert(BITS_PER_UNIT==32);
1444
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1445
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1446
+       }
1447
+}
1448
+*/
1449
+
1450
+#define        zip_basic_check()
1451
+
1452
+/* Compute the number of word sized regiters needed to hold a function
1453
+ * argument of mode INT_MODE and tree type TYPE.
1454
+ */
1455
+int
1456
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1457
+       int     size;
1458
+
1459
+       zip_basic_check();
1460
+
1461
+       if (targetm.calls.must_pass_in_stack(mode, type))
1462
+               return 0;
1463
+
1464
+       if ((type)&&(mode == BLKmode))
1465
+               size = int_size_in_bytes(type);
1466
+       else
1467
+               size = GET_MODE_SIZE(mode);
1468
+
1469
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1470
+}
1471
+
1472
+/* pushed in function prologue */
1473
+/*
1474
+static void
1475
+zip_setup_incoming_varargs(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1476
+               tree type, int *pretend_size, int no_rtl) {
1477
+       if (no_rtl)
1478
+               return;
1479
+
1480
+       gcc_assert(mode != BLKmode);
1481
+
1482
+       if (*cum < (ZIP_LAST_ARG_REGNO+1)) {
1483
+               int size = ZIP_FIRST_ARG_REGNO + ZIP_NUM_ARGS_REGS - *cum;
1484
+               rtx     regblock;
1485
+               int     offset = (*cum - ZIP_FIRST_ARG_REGNO) * UNITS_PER_WORD;
1486
+               regblock = gen_rtx_MEM(BLKmode,
1487
+                       plus_constant(arg_pointer_rtx, offset));
1488
+               move_block_from_reg(*cum, regblock, size);
1489
+               *pretend_size = size * UNITS_PER_WORD;
1490
+       }
1491
+
1492
+       if (targetm.calls.strict_argument_naming(cum))
1493
+               *cum = *cum + zip_num_arg_regs(mode, type);
1494
+}
1495
+*/
1496
+
1497
+/*
1498
+static int
1499
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1500
+               tree type, bool name ATTRIBUTE_UNUSED) {
1501
+       int     words;
1502
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1503
+
1504
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1505
+               words = 0;
1506
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1507
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1508
+       else
1509
+               words = 0;
1510
+
1511
+       return words * UNITS_PER_WORD;
1512
+}
1513
+*/
1514
+
1515
+static void
1516
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1517
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1518
+       CUMULATIVE_ARGS *cum;
1519
+       int     nreg;
1520
+
1521
+       zip_basic_check();
1522
+
1523
+       cum = get_cumulative_args(ca);
1524
+       nreg = zip_num_arg_regs(mode, type);
1525
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1526
+               (*cum) = NUM_ARG_REGS;
1527
+       else
1528
+               (*cum) += nreg;
1529
+}
1530
+
1531
+static rtx
1532
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1533
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1534
+       CUMULATIVE_ARGS *cum;
1535
+
1536
+       zip_basic_check();
1537
+
1538
+
1539
+       if (!named)
1540
+               return NULL_RTX;
1541
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1542
+               //return NULL_RTX;
1543
+       cum = get_cumulative_args(ca);
1544
+
1545
+       if ((*cum) >= NUM_ARG_REGS)
1546
+               return NULL_RTX;
1547
+       return
1548
+               gen_rtx_REG(mode, (*cum)+1);
1549
+}
1550
+
1551
+/* NOTICE_UPDATE_CC sends us here
1552
+ */
1553
+void
1554
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1555
+{
1556
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1557
+       enum    attr_ccresult  ccr;
1558
+       enum    attr_conditional  conditionally_executed;
1559
+
1560
+       // The default is that nothing has changed.
1561
+       // cc_status = cc_status_prev;
1562
+       rtx     src, dest;
1563
+
1564
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1565
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1566
+       if (dbg) debug_rtx(exp);
1567
+
1568
+       ccr = get_attr_ccresult(insn);
1569
+       if (ccr == CCRESULT_UNKNOWN) {
1570
+               CC_STATUS_INIT;
1571
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1572
+               return;
1573
+       }
1574
+
1575
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1576
+               // This works up and until we add cc0 parallel instructions
1577
+               // to our instruction set.
1578
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1579
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1580
+       } else if (GET_CODE(exp) == SET) {
1581
+               dest = SET_DEST(exp);
1582
+               src  = SET_SRC (exp);
1583
+       } else {
1584
+               // First, do nothing if we haven't touched the condition codes.
1585
+               // Condition codes can only be changed as a result of a set
1586
+               // expression ...?
1587
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1588
+               return;
1589
+       }
1590
+
1591 111 dgisselq
+
1592
+       if (ccr == CCRESULT_UNCHANGED) {
1593
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1594
+
1595
+               // We can't just run away here ... even though the CC result
1596
+               // hasn't changed, GCC's ability to recognize it as a valid
1597
+               // result has changed.  In other words, if we just 'set' a
1598
+               // value contained within either value1 or value2, then we'll
1599
+               // need to update those values so that they are no longer looked
1600
+               // upon as potentially containing the current CC values.
1601
+
1602
+               if (dest) {
1603
+                       if (dest == cc0_rtx)
1604
+                               CC_STATUS_INIT;
1605
+                       else if ((REG_P(dest))&&(dest != pc_rtx)) {
1606
+                               // An example here might be a load instruction
1607
+                               if (reg_mentioned_p(dest, cc_status.value1))
1608
+                                       cc_status.value1 = NULL_RTX;
1609
+                               if (reg_mentioned_p(dest, cc_status.value2))
1610
+                                       cc_status.value2 = NULL_RTX;
1611
+                       }
1612
+               }
1613
+               return;
1614
+       }
1615
+
1616 102 dgisselq
+       // Gotta wait on this test, until we know whether or not the
1617
+       // conditionally executed instruction was designed to set the
1618
+       // CC0 register.
1619
+       conditionally_executed = get_attr_conditional(insn);
1620
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1621
+               // cc_status is unchanged
1622 111 dgisselq
+               // However, GCC's vision of it may have changed
1623
+               //
1624
+               // Initialize CC_STATUS
1625 102 dgisselq
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1626 111 dgisselq
+               CC_STATUS_INIT;
1627 102 dgisselq
+               return;
1628 111 dgisselq
+       } else if (GET_CODE(src)==IF_THEN_ELSE) {
1629
+               // Same thing as above
1630
+               CC_STATUS_INIT;
1631
+               return;
1632 102 dgisselq
+       }
1633
+
1634
+       if (ccr == CCRESULT_VALIDZN)
1635
+               cc_status.flags = CC_NO_OVERFLOW;
1636
+       else
1637
+               cc_status.flags = 0;
1638
+       cc_status.value1 = dest;
1639
+       if (dest == cc0_rtx)
1640
+               cc_status.value2 = src;
1641
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1642
+               cc_status.value2 = src;
1643
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1644
+               cc_status.value2 = src;
1645
+       else
1646
+               cc_status.value2 = 0;
1647
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1648
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1649
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1650
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1651
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1652
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1653
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1654
+               count_occurrences(dest,src,0));
1655
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1656
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1657
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1658
+               reg_referenced_p(dest,src)?"Is":"Is not");
1659
+
1660
+//
1661
+// These results are only used in final.c, where they are used to remove
1662
+// compare instructions if the optimizer is on.  If I produce nothing, no
1663
+// compare instructions will be removed.  If I produce something, a smart
1664
+// decision may be made to remove compare instructions.
1665
+//
1666
+// cc_status will be compared  with subsequent
1667
+//     (set (cc0) (something)) (i.e. compare only) instructions
1668
+//
1669
+//     (set (cc0) (compare (x) (y)))
1670
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1671
+//             cc0
1672
+//     src1 = (compare (x) (y))
1673
+//     if (src1 == compare)&&(y == (const_int 0))
1674
+//             src2 = (x)
1675
+//     else
1676
+//             src2 = null
1677
+//
1678
+//     Four conditions:
1679
+//     1. if (val1)&&(src1 == val1)
1680
+//             This would be true if I had seen a (set (val1) (src1)) insn
1681
+//             If I have seen a (set (val1) (src1))
1682
+//                     or equivalently a (set (val1) (compare (x) (y)))
1683
+//     or
1684
+//     2. if (val2)&&(src1 == val2)
1685
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1686
+//             and only if val2 was still valid.
1687
+//     or
1688
+//     3. if (src2)&&(value1)&&(src2 == value1)
1689
+//             This would be true if we are comparing against zero, and the
1690
+//             number we are comparing against zero is value 1
1691
+//     or
1692
+//     4. if (src2)&&(value2)&&(src2 == value2)
1693
+//             ... or value2.  This is the common ZipCPU case.
1694
+//
1695
+//             then delete the compare.
1696
+//
1697
+}
1698
+
1699
+
1700
+/* totally buggy - we can't return pointers to nested functions */
1701
+static void
1702
+zip_asm_trampoline_template(FILE *f) {
1703
+       // Whereas at one time I thought I wouldn't need it, now I know I
1704
+       // need this trampoline function, although it is for a completely
1705
+       // different purpose than the one I was familiar with.
1706
+       fprintf(f, "\tldihi 0,r1\n");
1707
+       fprintf(f, "\tldilo 0,r1\n");
1708
+       fprintf(f, "\tjmp r1\n");
1709
+}
1710
+
1711
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1712
+static void
1713
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1714
+       tree fndecl ATTRIBUTE_UNUSED,
1715
+       rtx chain_value ATTRIBUTE_UNUSED) {
1716
+// #warning "This needs to be filled out"
1717
+       abort();
1718
+}
1719
+
1720
+static tree
1721
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1722
+       tree type)
1723
+{
1724
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1725
+       zip_basic_check();
1726
+
1727
+       if(t) {
1728
+               zip_builtins[code] = t;
1729
+               zip_builtins_icode[code] = icode;
1730
+       }
1731
+
1732
+       return t;
1733
+
1734
+}
1735
+
1736
+void   zip_init_builtins(void) {
1737
+       zip_basic_check();
1738
+
1739
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1740
+#ifdef HAVE_zip_rtu
1741
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1742
+#endif
1743
+#ifdef HAVE_zip_halt
1744
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1745
+#endif
1746
+#ifdef HAVE_zip_idle
1747
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1748
+#endif
1749
+
1750
+#ifdef HAVE_zip_syscall
1751
+// Support int SYSCALL(callID, int a, int b, int c);
1752
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1753
+                       build_function_type_list(void_type_node, NULL_TREE));
1754
+#endif
1755
+
1756
+#ifdef HAVE_zip_save_context
1757
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1758
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1759
+#endif
1760
+
1761
+#ifdef HAVE_zip_restore_context
1762
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1763
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1764
+#endif
1765
+
1766
+#ifdef HAVE_zip_bitrev
1767
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1768
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1769
+               NULL_TREE));
1770
+#endif
1771
+
1772
+#ifdef HAVE_zip_cc
1773
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1774
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1775
+#endif
1776
+
1777 117 dgisselq
+#ifdef HAVE_zip_ucc
1778
+  def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
1779
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1780
+#endif
1781
+
1782 102 dgisselq
+}
1783
+
1784
+static tree
1785
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1786
+{
1787
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1788
+    return error_mark_node;
1789
+
1790
+  return zip_builtins[zip_builtin_code];
1791
+}
1792
+
1793
+static rtx
1794
+zip_expand_builtin(tree exp, rtx target,
1795
+               rtx subtarget ATTRIBUTE_UNUSED,
1796
+               machine_mode tmode ATTRIBUTE_UNUSED,
1797
+               int     ignore ATTRIBUTE_UNUSED) {
1798
+
1799
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1800
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1801
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1802
+       enum    insn_code icode = zip_builtins_icode[code];
1803
+       rtx     pat, op[5];
1804
+       call_expr_arg_iterator  iter;
1805
+       tree    arg;
1806
+
1807
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1808
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1809
+               arg = first_call_expr_arg(exp, &iter);
1810
+               if (arg == error_mark_node)
1811
+                       return NULL_RTX;
1812
+               op[0] = expand_normal(arg);
1813
+               if (GET_CODE(op[0]) != REG)
1814
+                       op[0] = force_reg(Pmode, op[0]);
1815
+               pat = GEN_FCN(icode)(op[0]);
1816
+       } else if (code == ZIP_BUILTIN_BITREV) {
1817
+               arg = first_call_expr_arg(exp, &iter);
1818
+               if (arg == error_mark_node) {
1819
+                       return NULL_RTX;
1820
+               }
1821
+               op[0] = expand_normal(arg);
1822
+               if (!target)
1823
+                       target = gen_reg_rtx(SImode);
1824
+               pat = GEN_FCN(icode)(target, op[0]);
1825 117 dgisselq
+       } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
1826 102 dgisselq
+               if (!target)
1827
+                       target = gen_reg_rtx(SImode);
1828
+               pat = GEN_FCN(icode)(target);
1829
+       } else // RTU, HALT, IDLE
1830
+               pat = GEN_FCN(icode)();
1831
+       if (!pat)
1832
+               return NULL_RTX;
1833
+       emit_insn(pat);
1834
+       return (nonvoid ? target : const0_rtx);
1835
+}
1836
+
1837
+static bool
1838
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1839
+       zip_basic_check();
1840
+
1841
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1842
+}
1843
+
1844
+static bool
1845
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1846
+       return ((mode)==SFmode)||((mode)==DFmode);
1847
+}
1848
+
1849
+static int
1850
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1851
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1852
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1853
+       return 1;
1854
+}
1855
+
1856
+static bool
1857
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1858
+       addr_space_t as ATTRIBUTE_UNUSED) {
1859
+       return false;
1860
+}
1861
+
1862
+/*
1863
+static void
1864
+zip_asm_output_anchor(rtx x) {
1865
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1866
+}
1867
+*/
1868
+
1869
+static void
1870
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1871
+       int     i;
1872
+       i = lvl;
1873
+       if ((true)||(lvl == 0))
1874
+               fprintf(stderr, "%s", pfx);
1875
+       else
1876
+               i += strlen(pfx);
1877
+       while(i-->0)
1878
+               fprintf(stderr, "  ");
1879
+       fprintf(stderr, "%s\n", str);
1880
+}
1881
+
1882
+static void
1883
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1884
+       int     i;
1885
+
1886
+       i = lvl;
1887
+       if ((true)||(lvl == 0))
1888
+               fprintf(stderr, "%s", pfx);
1889
+       else
1890
+               i = lvl+strlen(pfx);
1891
+       while(i-->0)
1892
+               fprintf(stderr, "  ");
1893
+       switch(m) {
1894
+               case VOIDmode:
1895
+                       fprintf(stderr, "%s:V\n", str);
1896
+                       break;
1897
+               case BLKmode:
1898
+                       fprintf(stderr, "%s:BLK\n", str);
1899
+                       break;
1900
+               case BImode:
1901
+                       fprintf(stderr, "%s:BI\n", str);
1902
+                       break;
1903
+#ifdef HAVE_QImode
1904
+               case QImode:
1905
+                       fprintf(stderr, "%s:QI\n", str);
1906
+                       break;
1907
+#endif
1908
+#ifdef HAVE_HImode
1909
+               case HImode:
1910
+                       fprintf(stderr, "%s:HI\n", str);
1911
+                       break;
1912
+#endif
1913
+               case SImode:
1914
+                       fprintf(stderr, "%s:SI\n", str);
1915
+                       break;
1916
+               case DImode:
1917
+                       fprintf(stderr, "%s:DI\n", str);
1918
+                       break;
1919
+               default:
1920
+                       fprintf(stderr, "%s:?\n", str);
1921
+       }
1922
+}
1923
+
1924
+static void
1925
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1926
+       if (x == NULL_RTX) {
1927
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1928
+               return;
1929
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1930
+               char    buf[64];
1931
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1932
+               zip_debug_print(pfx, lvl, buf);
1933 117 dgisselq
+               gcc_assert(0 && "Bad RTX Code");
1934 102 dgisselq
+               return;
1935
+       } switch(GET_CODE(x)) { // rtl.def
1936
+       case PARALLEL: zip_debug_print(pfx, lvl, "(PARALLEL");
1937
+               debug_rtx(x); break;
1938
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1939
+       case SEQUENCE: zip_debug_print(pfx, lvl, "(SEQUENCE"); break;
1940
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1941
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1942
+       case INSN:
1943
+               zip_debug_print(pfx, lvl, "(INSN");
1944
+               /*
1945
+               { const rtx_insn *tmp_rtx;
1946
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1947
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1948
+               }}
1949
+               */
1950
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1951
+               zip_debug_print(pfx, lvl, ")");
1952 117 dgisselq
+               debug_rtx(x);
1953 102 dgisselq
+               break;
1954
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1955 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1956
+               zip_debug_print(pfx, lvl, ")");
1957
+               /*
1958 102 dgisselq
+               if (JUMP_LABEL(x)) {
1959 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
1960
+                               char    buf[64];
1961
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
1962
+                               zip_debug_print(pfx, lvl+1, buf);
1963
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
1964
+                               char    buf[64];
1965
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
1966
+                               zip_debug_print(pfx, lvl+1, buf);
1967
+                       } else
1968
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
1969 102 dgisselq
+               } else
1970 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
1971
+               debug_rtx(x);
1972
+               */
1973 102 dgisselq
+               break;
1974
+       case CALL:
1975
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
1976
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
1977
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
1978
+               zip_debug_print(pfx, lvl, ")");
1979
+               break;
1980
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
1981
+               debug_rtx(x);
1982
+               break;
1983
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
1984
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
1985
+       case NOTE:
1986
+               {       char buf[128];
1987
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
1988
+                       zip_debug_print(pfx, lvl, buf);
1989
+               }break;
1990
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
1991
+               debug_rtx(x);
1992
+               break;
1993
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
1994
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
1995
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
1996
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
1997
+       case CODE_LABEL:
1998
+               {
1999
+                       char    buf[64];
2000 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
2001 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2002
+               } break;
2003
+       case SET:
2004
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
2005 117 dgisselq
+               zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
2006
+               zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
2007 102 dgisselq
+               zip_debug_print(pfx, lvl, ")");
2008 117 dgisselq
+               debug_rtx(x);
2009 102 dgisselq
+               break;
2010
+       case REG:
2011
+               if (REGNO(x) == zip_PC)
2012
+                       zip_debug_print(pfx, lvl, "(PC)");
2013
+               else if (REGNO(x) == zip_CC)
2014
+                       zip_debug_print(pfx, lvl, "(CC0)");
2015
+               else if (REGNO(x) == zip_SP)
2016
+                       zip_debug_print(pfx, lvl, "(SP)");
2017
+               else if (REGNO(x) == zip_FP)
2018
+                       zip_debug_print(pfx, lvl, "(REG FP)");
2019
+               else if (REGNO(x) == zip_GOT)
2020
+                       zip_debug_print(pfx, lvl, "(REG GBL)");
2021
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2022
+                       zip_debug_print(pfx, lvl, "(REG RTN-VL)");
2023
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2024
+                       zip_debug_print(pfx, lvl, "(REG RTN-AD)");
2025
+               else { char buf[25];
2026
+               sprintf(buf, "(REG %d)", REGNO(x));
2027
+               zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2028
+               } break;
2029
+       case IF_THEN_ELSE: // 51
2030
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2031
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2032
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2033
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2034
+               zip_debug_print(pfx, lvl, ")");
2035
+               break;
2036
+       case PC:
2037
+               zip_debug_print(pfx, lvl, "(PC)");
2038
+               break;
2039
+       case CC0:
2040
+               zip_debug_print(pfx, lvl, "(CC0)");
2041
+               break;
2042
+       case COMPARE:
2043
+               zip_debug_print(pfx, lvl, "(COMPARE");
2044
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2045
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2046
+               zip_debug_print(pfx, lvl, ")");
2047
+               break;
2048 111 dgisselq
+       case CONST:
2049
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2050
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2051
+               zip_debug_print(pfx, lvl, ")");
2052
+               break;
2053 102 dgisselq
+       case CONST_INT:
2054
+               { char buf[25];
2055
+               if (GET_MODE(x)==SImode)
2056 111 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", INTVAL(x));
2057 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2058 111 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", INTVAL(x));
2059 102 dgisselq
+               else
2060 111 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", INTVAL(x));
2061 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2062
+               } break;
2063
+       case LABEL_REF:
2064 111 dgisselq
+               { char buf[256], *bp;
2065
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2066
+               zip_debug_print(pfx, lvl, buf);
2067
+               }
2068 102 dgisselq
+               break;
2069
+       case SYMBOL_REF:
2070
+               {
2071
+                       char buf[64];
2072
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2073
+                       // fprintf(file, "%s", XSTR(x,0));
2074
+                       zip_debug_print(pfx, lvl, buf);
2075
+               }
2076
+               break;
2077
+       case MEM:
2078
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2079
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2080
+               zip_debug_print(pfx, lvl, ")");
2081
+               break;
2082
+       /*
2083
+       case VALUE:
2084
+               {
2085
+                       char buf[64];
2086
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2087
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2088
+               }
2089
+               break;
2090
+       */
2091
+       case PLUS:
2092
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2093
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2094
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2095
+               zip_debug_print(pfx, lvl, ")");
2096
+               break;
2097
+       case MINUS:
2098
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2099
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2100
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2101
+               zip_debug_print(pfx, lvl, ")");
2102
+               break;
2103
+       case AND:
2104
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2105
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2106
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2107
+               zip_debug_print(pfx, lvl, ")");
2108
+               break;
2109
+       case IOR:
2110
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2111
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2112
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2113
+               zip_debug_print(pfx, lvl, ")");
2114
+               break;
2115
+       case XOR:
2116
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2117
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2118
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2119
+               zip_debug_print(pfx, lvl, ")");
2120
+               break;
2121
+       case MULT:
2122
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2123
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2124
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2125
+               zip_debug_print(pfx, lvl, ")");
2126
+               break;
2127
+       case EQ:        //
2128
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2129
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2130
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2131
+               zip_debug_print(pfx, lvl, ")");
2132
+               break;
2133
+       case NE:        //
2134
+               zip_debug_print_m(pfx, lvl, "(NE", 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 GE:        //
2140
+               zip_debug_print_m(pfx, lvl, "(GE", 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 GT:        //
2146
+               zip_debug_print_m(pfx, lvl, "(GT", 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 LE:        //
2152
+               zip_debug_print_m(pfx, lvl, "(LE", 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 LT:        //
2158
+               zip_debug_print_m(pfx, lvl, "(LT", 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 GEU:       //
2164
+               zip_debug_print_m(pfx, lvl, "(GEU", 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 GTU:       //
2170
+               zip_debug_print_m(pfx, lvl, "(GTU", 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 LEU:       //
2176
+               zip_debug_print_m(pfx, lvl, "(LEU", 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 LTU:       //
2182
+               zip_debug_print_m(pfx, lvl, "(LTU", 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 SCRATCH:   //
2188
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2189
+               break;
2190
+       case SUBREG:
2191
+               { char buf[25];
2192 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2193
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2194
+                               SUBREG_BYTE(x));
2195
+                       zip_debug_print(pfx, lvl, buf);
2196
+               } else if (MEM_P(XEXP(x,0))) {
2197
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2198
+                       zip_debug_print(pfx, lvl, buf);
2199
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2200
+                       zip_debug_print(pfx, lvl, ")");
2201
+               } else {
2202
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2203
+                       zip_debug_print(pfx, lvl, buf);
2204
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2205
+                       zip_debug_print(pfx, lvl, ")");
2206
+               }}
2207
+               break;
2208 102 dgisselq
+       default:
2209 111 dgisselq
+               { char buf[128];
2210 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2211
+               zip_debug_print(pfx, lvl, buf);
2212
+               debug_rtx(x);
2213
+               } break;
2214
+       }
2215
+}
2216
+
2217
+void
2218
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2219
+       zip_debug_rtx_1(pfx, x, 0);
2220
+}
2221
+
2222
+void
2223
+zip_debug_rtx(const_rtx x) {
2224
+       zip_debug_rtx_pfx("", x);
2225
+}
2226
+
2227
+void
2228
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2229
+}
2230
+
2231
+void
2232
+zip_debug_bb(basic_block bb) {
2233
+       rtx_insn        *insn;
2234
+
2235
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2236
+       FOR_BB_INSNS(bb, insn)
2237
+       {
2238
+               zip_debug_rtx(insn);
2239
+       }
2240
+}
2241
+
2242
+
2243
+static bool
2244 111 dgisselq
+zip_legitimate_opb(const_rtx x, bool strict)
2245 102 dgisselq
+{
2246 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2247 102 dgisselq
+
2248 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2249 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2250
+
2251
+       if (NULL_RTX == x)
2252
+               return false;
2253
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2254
+               return false;
2255
+       else if (REG_P(x)) {
2256 111 dgisselq
+               bool    res;
2257 102 dgisselq
+               // Only insist the register b a valid register if strict is true
2258 111 dgisselq
+               res = (!strict)||((is_ZIP_REG(REGNO(x)))&&(REGNO(x) != zip_CC));
2259
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> %s (Reg)\n",
2260
+                       (res)?"YES!":"No");
2261
+               return res;
2262
+       } else if ((!strict)&&(SUBREG_P(x))) {
2263
+               // Only insist the register b a valid register if strict is true
2264
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Subreg(Reg),recurse)\n");
2265
+               return zip_legitimate_opb(XEXP(x,0), strict);
2266
+       } else if ((CONST_INT_P(x))
2267
+               &&(INTVAL(x) >= zip_min_opb_imm)
2268
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2269
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const)\n");
2270
+               return true;
2271 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2272
+               // Is it a valid register?
2273
+               if(!REG_P(XEXP(x,0))) {
2274 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2275 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2276
+                       return false;
2277 111 dgisselq
+               } if ((strict)&&((!is_ZIP_REG(REGNO(XEXP(x,0))))||(REGNO(XEXP(x,0)) == zip_CC))) {
2278
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
2279 102 dgisselq
+                       return false;
2280
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2281
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2282
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2283 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2284 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2285
+                               // gcc_unreachable();
2286 102 dgisselq
+                       return true;
2287
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2288
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2289
+                       // While we can technically support this, the problem
2290
+                       // is that the symbol address could be anywhere, and we
2291
+                       // have no way of recovering if it's outside of our
2292
+                       // 14 allowable bits.
2293 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2294 102 dgisselq
+                       return false;
2295
+               }
2296 111 dgisselq
+               // if ((GET_CODE(XEXP(x, 1)) == MINUS)
2297
+               //      &&((GET_CODE(XEXP(XEXP(x,1),0)) == LABEL_REF)
2298
+               //              ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
2299
+               //              ||(GET_CODE(XEXP(XEXP(x,1),0)) == SYMBOL_REF))
2300
+               //      &&((GET_CODE(XEXP(XEXP(x,1),1)) == LABEL_REF)
2301
+               //              ||(GET_CODE(XEXP(XEXP(x,1),0)) == CONST_INT)
2302
+               //              ||(GET_CODE(XEXP(XEXP(x,1),1)) == SYMBOL_REF))
2303
+               //      &&((GET_CODE(XEXP(XEXP(x,1),0)))
2304
+               //              == (GET_CODE(XEXP(XEXP(x,1),1))))) {
2305
+               //      if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPERAND-ADDRESS -> YES! (lbl-lbl+reg)\n");
2306
+               //      return true;
2307
+               //}
2308 102 dgisselq
+       }
2309
+
2310 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2311 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2312
+       return false;
2313
+}
2314
+
2315
+static bool
2316
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2317
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2318
+
2319
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2320
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2321
+
2322
+       if (NULL_RTX == x)
2323
+               return false;
2324
+       else if (REG_P(x)) {
2325
+               // Only insist the register b a valid register if strict is true
2326
+               if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (Reg)\n");
2327 111 dgisselq
+               return (!strict)||((is_ZIP_REG(REGNO(x)))&&(REGNO(x) !=zip_CC));
2328 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2329 111 dgisselq
+               // if (GET_CODE(XEXP(x,0))==PLUS) {
2330
+               // return (zip_legitimate_opb(XEXP(x,0), strict))
2331
+               // &&(zip_const_address_operand(XEXP(x,0)));
2332
+               // }
2333 102 dgisselq
+               // Is it a valid register?
2334 111 dgisselq
+               if(GET_CODE(XEXP(x,0)) != REG) {
2335 102 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (No reg in +%s)\n",
2336
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2337
+                       return false;
2338 111 dgisselq
+               } if ((strict)&&
2339
+                       ((!is_ZIP_REG(REGNO(XEXP(x,0))))
2340
+                       ||(REGNO(XEXP(x,0)) == zip_CC))) {
2341 102 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No (Wrong reg in +, %d)\n", REGNO(XEXP(x,0)));
2342
+                       return false;
2343
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2344
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_mov_offset)
2345
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_mov_offset)) {
2346
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> YES! (reg+int)\n");
2347
+                       return true;
2348
+               }
2349
+       }
2350
+
2351
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> No\n");
2352
+       if (dbg) zip_debug_rtx(x);
2353
+       return false;
2354
+}
2355
+
2356
+int
2357
+zip_pd_mov_operand(rtx op)
2358
+{
2359
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2360
+
2361
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2362
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2363
+}
2364
+
2365
+int
2366 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2367
+{
2368
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2369
+
2370
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2371
+       if (!CONST_INT_P(op))
2372
+               return false;
2373
+       if (INTVAL(op) > zip_max_mov_offset)
2374
+               return false;
2375
+       if (INTVAL(op) < zip_min_mov_offset)
2376
+               return false;
2377
+       return true;
2378
+}
2379
+
2380
+int
2381
+zip_pd_imm_operand(rtx op)
2382
+{
2383
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2384
+
2385
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2386
+       if (!CONST_INT_P(op))
2387
+               return false;
2388
+       if (INTVAL(op) > zip_max_anchor_offset)
2389
+               return false;
2390
+       if (INTVAL(op) < zip_min_anchor_offset)
2391
+               return false;
2392
+       return true;
2393
+}
2394
+
2395
+int
2396 102 dgisselq
+zip_address_operand(rtx op)
2397
+{
2398
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2399
+
2400
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2401 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2402
+               return false;
2403
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2404
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2405
+               return false;
2406
+       else
2407
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2408 102 dgisselq
+}
2409
+
2410
+int
2411 111 dgisselq
+zip_pd_opb_operand(rtx op)
2412 102 dgisselq
+{
2413
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2414
+
2415 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2416
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2417 102 dgisselq
+}
2418
+
2419
+int
2420
+zip_ct_address_operand(rtx op)
2421
+{
2422
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2423
+
2424
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2425 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2426 102 dgisselq
+}
2427
+
2428
+int
2429
+zip_const_address_operand(rtx x) {
2430
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2431
+
2432
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2433
+       if (dbg) zip_debug_rtx(x);
2434
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2435
+               return false;
2436
+       if ((GET_CODE(x) == LABEL_REF)
2437
+                       ||(GET_CODE(x) == CODE_LABEL)
2438
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2439
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2440
+               return true;
2441
+       } else if (CONST_INT_P(x)) {
2442
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2443
+               return true;
2444
+       } else if (GET_CODE(x) == PLUS) {
2445
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2446
+               return ((zip_const_address_operand(XEXP(x,0)))
2447
+                       &&(CONST_INT_P(XEXP(x,1))));
2448
+       } else if (GET_CODE(x) == MINUS) {
2449
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2450
+               return ((zip_const_address_operand(XEXP(x,0)))
2451
+                       &&(zip_const_address_operand(XEXP(x,1))));
2452
+       }
2453
+
2454
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2455
+       if (dbg) zip_debug_rtx(x);
2456
+       return false;
2457
+}
2458
+
2459
+int
2460
+zip_ct_const_address_operand(rtx x) {
2461
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2462
+
2463
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2464
+       return zip_const_address_operand(x);
2465
+}
2466
+
2467
+int
2468
+zip_pd_const_address_operand(rtx x) {
2469
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2470
+
2471
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2472
+       return zip_const_address_operand(x);
2473
+}
2474
+
2475
+
2476
+static bool
2477
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2478
+{
2479
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2480
+
2481
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2482
+       if (dbg) zip_debug_rtx(x);
2483
+
2484
+       // Only insist the register be a valid register if strict is true
2485 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2486 102 dgisselq
+               return true;
2487 111 dgisselq
+       // else if (zip_const_address_operand(x))
2488
+               // return true;
2489 102 dgisselq
+
2490
+       return false;
2491
+}
2492
+
2493 111 dgisselq
+static rtx
2494
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2495
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2496
+
2497
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2498
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2499
+               return x;
2500
+
2501
+       if (GET_CODE(x)==PLUS) {
2502
+               if (!REG_P(XEXP(x,0)))
2503
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2504
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2505
+                       &&(!CONST_INT_P(XEXP(x,1))))
2506
+                       x = force_reg(GET_MODE(x),x);
2507
+       } else if (MEM_P(x))
2508
+               x = force_reg(GET_MODE(x),x);
2509
+
2510
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2511
+       return x;
2512
+}
2513
+
2514 102 dgisselq
+void
2515
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2516
+{
2517
+       assemble_name(stream, name);
2518
+       fprintf(stream, "\t.equ ");
2519
+       assemble_name(stream, value);
2520
+       fputc('\n', stream);
2521
+}
2522
+
2523
+/*
2524
+bool   zip_load_address_lod(rtx regrx, rtx memrx) {
2525
+       fprintf(stderr, "ZIP-LOAD-ADDRESS-LOD\n");
2526
+       if (!MEM_P(memrx))
2527
+               return false;
2528
+       if (GET_CODE(regrx) != REG)
2529
+               return false;
2530
+       enum    rtx_code ic = GET_CODE(memrx);
2531
+       if ((ic == SYMBOL_REF)
2532
+               ||(ic == CODE_LABEL)
2533
+               ||(ic == LABEL_REF)) {
2534
+               if (can_create_pseudo_p()) {
2535
+                       rtx scratch_reg;
2536
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
2537
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
2538
+                       emit_insn(gen_movsi_lod(regrx, scratch_reg));
2539
+                       return true;
2540
+               } else return false;
2541
+       } else return false;
2542
+}
2543
+
2544
+bool   zip_load_address_sto(rtx memrx, rtx regrx) {
2545
+       fprintf(stderr,  "CHECKING-IN-W/ZIP_LOAD_ADDRESS_STORE\n");
2546
+       if (!MEM_P(memrx))
2547
+               return false;
2548
+       if (GET_CODE(regrx) != REG)
2549
+               return false;
2550
+       enum    rtx_code ic = GET_CODE(memrx);
2551
+       if ((ic == SYMBOL_REF)
2552
+               ||(ic == CODE_LABEL)
2553
+               ||(ic == LABEL_REF)) {
2554
+               if (can_create_pseudo_p()) {
2555
+                       rtx scratch_reg;
2556
+                       scratch_reg = gen_rtx_SCRATCH(SImode);
2557
+                       emit_insn(gen_movsi_ldi(scratch_reg, XEXP(memrx, 0)));
2558
+                       emit_insn(gen_movsi_sto(scratch_reg, regrx));
2559
+                       return true;
2560
+               } else return false;
2561
+       } return false;
2562
+}
2563
+*/
2564
+
2565 111 dgisselq
+#define        USE_SUBREG
2566
+#ifdef USE_SUBREG
2567
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2568
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2569
+#else
2570
+#define        SREG_P(RTX)     false
2571
+#define        SMEM_P(RTX)     false
2572
+#endif
2573 102 dgisselq
+
2574
+bool   zip_gen_move_rtl(rtx dst, rtx src) {
2575 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2576 102 dgisselq
+
2577
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE\n");
2578
+       if (dbg) zip_debug_rtx_pfx("FROM: ", src);
2579
+       if (dbg) zip_debug_rtx_pfx("TO  : ", dst);
2580
+       if (dbg) fprintf(stderr, "PSEUDOs: %s\n", can_create_pseudo_p()?"true":"false");
2581 111 dgisselq
+       if (((REG_P(dst))||(SREG_P(dst)))
2582
+                       &&((REG_P(src))||(SREG_P(src)))) {
2583 102 dgisselq
+               // First type of move... register to register
2584
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG -- EMIT\n");
2585 111 dgisselq
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2586
+               // if (SREG_P(src)) src = gen_raw_REG(SImode,REGNO(XEXP(src,0))+SUBREG_BYTE(src));
2587 102 dgisselq
+               emit_insn(gen_movsi_reg(dst, src));
2588
+       } else if ((MEM_P(dst))&&(MEM_P(XEXP(dst,0)))) {
2589 111 dgisselq
+               // An indirect store, (mem (mem (addr .))) = whatever ...
2590 102 dgisselq
+               if (can_create_pseudo_p()) {
2591
+                       rtx     tmp = gen_reg_rtx(Pmode);
2592
+                       zip_gen_move_rtl(tmp, XEXP(dst,0));
2593 103 dgisselq
+                       // mark_reg_pointer(tmp,0);
2594 102 dgisselq
+                       zip_gen_move_rtl(gen_rtx_MEM(GET_MODE(src), tmp), src);
2595
+               } else {
2596
+                       fprintf(stderr, "ZIP:Cannot move into mem w/o pseudo\n");
2597
+                       return false;
2598
+               }
2599
+       } else if ((MEM_P(src))&&(MEM_P(XEXP(src,0)))) {
2600 111 dgisselq
+               // If this is an indirect load, Rx = (mem (mem (addr)))
2601 102 dgisselq
+               if (can_create_pseudo_p()) {
2602
+                       rtx     tmp = gen_reg_rtx(Pmode);
2603
+                       zip_gen_move_rtl(tmp, XEXP(src,0));
2604 103 dgisselq
+                       // mark_reg_pointer(tmp,0);
2605 102 dgisselq
+                       zip_gen_move_rtl(dst, gen_rtx_MEM(GET_MODE(src), tmp));
2606
+               } else {
2607
+                       fprintf(stderr, "ZIP: Cannot move from mem(mem(ptr)) w/o pseudo\n");
2608
+                       return false;
2609
+               }
2610 111 dgisselq
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(GET_CODE(src)==PLUS)
2611 102 dgisselq
+                       &&(REG_P(XEXP(src,0)))
2612
+                       &&(CONST_INT_P(XEXP(src,1)))) {
2613 111 dgisselq
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2614 102 dgisselq
+               // Second type of move... register plus offset to register
2615
+               if ((INTVAL(XEXP(src, 1)) <= zip_max_mov_offset)
2616
+                       &&(INTVAL(XEXP(src, 1)) >= zip_min_mov_offset)) {
2617
+                       // The offset is within bounds
2618
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/REG+OFF -- EMIT\n");
2619
+                       emit_insn(gen_movsi_reg_off(dst, XEXP(src,0),XEXP(src,1)));
2620
+               } else if (can_create_pseudo_p()) {
2621
+                       // The offset is out of bounds, get a new register and
2622
+                       // generate an add instruction to split this up.
2623
+                       rtx     tmp = gen_reg_rtx(GET_MODE(XEXP(src,0)));
2624
+
2625
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LDI\n");
2626
+                       emit_insn(gen_movsi_ldi(tmp, XEXP(src,1)));
2627
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/ADD\n");
2628
+                       emit_insn(gen_addsi3(tmp, tmp, XEXP(src,0)));
2629
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/DST\n");
2630
+                       emit_insn(gen_movsi_reg(dst, tmp));
2631
+               } else {
2632
+                       fprintf(stderr, "ZIP: Cannot move a(r),b w/o pseudo for out of bounds a\n");
2633
+                       return false;
2634
+               }
2635
+       } else if ((MEM_P(dst))&&(MEM_P(src))) {
2636
+               rtx     tmp;
2637
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/MEM/MEM\n");
2638
+               if (can_create_pseudo_p()) {
2639
+                       tmp = gen_reg_rtx(GET_MODE(src));
2640
+                       emit_insn(gen_movsi(tmp, src));
2641
+                       emit_insn(gen_movsi(dst, tmp));
2642
+               } else {
2643
+                       fprintf(stderr, "ZIP: Cannot move mem(A) to mem(B) w/o pseudo\n");
2644
+                       return false;
2645
+               }
2646 111 dgisselq
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(MEM_P(src))) {
2647 102 dgisselq
+               // Memory load
2648 111 dgisselq
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2649 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD\n");
2650 111 dgisselq
+               if (zip_legitimate_opb(XEXP(src, 0), false)) {
2651 102 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/SIMPLE-LOD(ADDR)\n");
2652
+                       if (dbg) zip_debug_rtx_pfx("Smple-Addr: ", src);
2653
+                       emit_insn(gen_movsi_lod(dst, src));
2654
+               } else if (zip_const_address_operand(XEXP(src,0))) {
2655
+                       if (can_create_pseudo_p()) {
2656
+                               rtx     tmp;
2657
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR)\n");
2658
+                               tmp = gen_reg_rtx(Pmode);
2659
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(src,0)));
2660
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),tmp)));
2661
+                       } else {
2662
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LOD(CONST-ADDR,SELF)\n");
2663
+                               emit_insn(gen_movsi_ldi(dst, XEXP(src,0)));
2664
+                               emit_insn(gen_movsi_lod(dst, gen_rtx_MEM(GET_MODE(src),dst)));
2665
+                       }
2666
+               } else {
2667
+                       internal_error("%s", "ZIP/No usable load\n");
2668
+               }
2669 111 dgisselq
+       } else if ((MEM_P(dst))&&((REG_P(src))||(SREG_P(src)))) {
2670 102 dgisselq
+               // Memory store
2671 111 dgisselq
+               // if (SREG_P(src)) src = gen_raw_REG(SImode,REGNO(XEXP(src,0))+SUBREG_BYTE(src));
2672 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO\n");
2673 111 dgisselq
+               if (zip_legitimate_opb(XEXP(dst, 0), false)) {
2674 102 dgisselq
+                       // If it's a legitimate address already, do nothing mor
2675
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Legit Addr)--EMIT\n");
2676 103 dgisselq
+                       // if (REG_P(XEXP(dst,0)))
2677
+                               // mark_reg_pointer(XEXP(dst,0),0);
2678
+                       // else if ((GET_CODE(XEXP(dst,0))==PLUS)
2679
+                                       // &&(REG_P(XEXP(XEXP(dst,0),0))))
2680
+                               // mark_reg_pointer(XEXP(XEXP(dst,0),0),0);
2681 102 dgisselq
+                       emit_insn(gen_movsi_sto(dst, src));
2682
+               } else if (zip_const_address_operand(XEXP(dst,0))) {
2683
+                       rtx     tmp;
2684
+
2685
+                       if (can_create_pseudo_p()) {
2686
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO(Const Addr,Reg) -- EMIT\n");
2687
+                               // Otherwise we need to load the memory address
2688
+                               // into a register
2689
+                               tmp = gen_reg_rtx(Pmode);
2690 103 dgisselq
+                               // mark_reg_pointer(tmp,0);
2691 102 dgisselq
+                               emit_insn(gen_movsi_ldi(tmp, XEXP(dst,0)));
2692
+                               //
2693
+                               // Then we can do our load
2694
+                               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- emit\n");
2695
+                               emit_insn(gen_movsi_sto(gen_rtx_MEM(GET_MODE(src), tmp), src));
2696
+                       } else {
2697
+                               fprintf(stderr, "Cannot move src -> mem(dst) w/o pseudo\n");
2698
+                               return false;
2699
+                       }
2700
+               } else if (can_create_pseudo_p())
2701
+                       internal_error("%s", "ZIP/No usable store\n");
2702
+               else {
2703
+                       fprintf(stderr, "ZIP/Unanticipated store problem\n");
2704
+                       return false;
2705
+               }
2706
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/STO -- DONE\n");
2707
+       } else if ((MEM_P(dst))&&((CONST_INT_P(src))||(GET_CODE(src)==SYMBOL_REF))) {
2708
+               // Store a constant into memory
2709
+               rtx     tmp;
2710
+
2711
+               if (can_create_pseudo_p()) {
2712
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM\n");
2713
+                       // Load the source constant into a register first
2714
+                       tmp = gen_reg_rtx((GET_MODE(src)==VOIDmode)?GET_MODE(dst):GET_MODE(src));
2715
+                       emit_insn(gen_movsi_ldi(tmp,src));
2716
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG->MEM -- RECURSE\n");
2717
+
2718
+                       // Then do a normal move, recursing to handle memory
2719
+                       // properly
2720
+                       zip_gen_move_rtl(dst, tmp);
2721
+                       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->MEM -- DONE\n");
2722
+               } else {
2723
+                       fprintf(stderr, "ZIP/Cannot store constant into mem w/o pseudo\n");
2724
+                       return false;
2725
+               }
2726 111 dgisselq
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(CONST_INT_P(src))) {
2727
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2728 102 dgisselq
+               // Load a constant into a register
2729
+               // The assembler really takes care of all of this, since
2730
+               // the assembler will split the constant if it doesn't fit
2731
+               // into a single instruction.
2732
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/CONST->REG\n");
2733
+               // if ((GET_MODE(dst)==VOIDmode)&&(GET_MODE(src)==VOIDmode))
2734
+                       // PUT_MODE(dst,SImode);
2735
+               emit_insn(gen_movsi_ldi(dst, src));
2736
+       } else if ((REG_P(dst))&&
2737
+                       ((LABEL_P(src))
2738
+                       ||(GET_CODE(src)==SYMBOL_REF)
2739
+                       ||(GET_CODE(src)==LABEL_REF))) {
2740
+               // Load a constant into a register
2741
+               // The assembler really takes care of all of this, since
2742
+               // the assembler will split the constant if it doesn't fit
2743
+               // into a single instruction.
2744
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LABEL->REG\n");
2745
+               emit_insn(gen_movsi_ldi(dst, src));
2746 111 dgisselq
+       } else if ((REG_P(dst))&&
2747
+                       ((GET_CODE(src)==PLUS)
2748
+                       &&((GET_CODE(XEXP(src,0))==SYMBOL_REF)
2749
+                               ||(GET_CODE(XEXP(src,0))==LABEL_REF))
2750
+                       &&(CONST_INT_P(XEXP(src,1))))) {
2751
+               if (dbg) fprintf(stderr, "ZIP-GEN-MOVE/LABEL+OFFSET->REG\n");
2752
+               if ((INTVAL(XEXP(src,1))>=zip_min_mov_offset)
2753
+                       &&(INTVAL(XEXP(src,1))<=zip_max_mov_offset)) {
2754
+                       emit_insn(gen_movsi_ldi(dst, XEXP(src,1)));
2755
+                       emit_insn(gen_movsi_reg_off(dst, dst, XEXP(src,1)));
2756
+               } else if (can_create_pseudo_p()) {
2757
+                       rtx tmp = gen_reg_rtx(Pmode);
2758
+                       emit_insn(gen_movsi_ldi(tmp, XEXP(src,1)));
2759
+                       emit_insn(gen_movsi_ldi(dst, src));
2760
+                       emit_insn(gen_addsi3(dst,dst,tmp));
2761
+                       return true;
2762
+               } else {
2763
+                       fprintf(stderr, "Cannot move LABEL+OFFSET -> dst w/o pseudo\n");
2764
+                       return false;
2765
+               }
2766
+       } else if (((REG_P(dst))||(SREG_P(dst)))&&(GET_CODE(src) == CONST)) {
2767
+               // if (SREG_P(dst)) dst = gen_raw_REG(SImode,REGNO(XEXP(dst,0))+SUBREG_BYTE(dst));
2768
+               zip_gen_move_rtl(dst, XEXP(src,0));
2769
+       } else if (SMEM_P(dst)) {
2770
+               rtx     addr = XEXP(XEXP(dst,0),0);
2771
+               if (REG_P(addr)) {
2772
+                       zip_gen_move_rtl(
2773
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addr,
2774
+                                       SUBREG_BYTE(dst),false)),src);
2775
+               } else if ((GET_CODE(addr)==PLUS)
2776
+                               &&(REG_P(XEXP(addr,0)))
2777
+                               &&(CONST_INT_P(XEXP(addr,1)))) {
2778
+                       rtx addreg = XEXP(addr,0);
2779
+                       zip_gen_move_rtl(
2780
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addreg,
2781
+                                       INTVAL(XEXP(addr,1))+SUBREG_BYTE(dst),
2782
+                                       false)),src);
2783
+               } else fprintf(stderr, "ZIP/Cannot understand SUBREG\n");
2784
+       } else if (SMEM_P(src)) {
2785
+               rtx     addr = XEXP(XEXP(src,0),0);
2786
+               if (REG_P(addr)) {
2787
+                       zip_gen_move_rtl(dst,
2788
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addr,
2789
+                                       SUBREG_BYTE(src),false)));
2790
+               } else if ((GET_CODE(addr)==PLUS)
2791
+                               &&(REG_P(XEXP(addr,0)))
2792
+                               &&(CONST_INT_P(XEXP(addr,1)))) {
2793
+                       rtx addreg = XEXP(addr,0);
2794
+                       zip_gen_move_rtl(dst,
2795
+                               gen_rtx_MEM(SImode, plus_constant(Pmode,addreg,
2796
+                                       INTVAL(XEXP(addr,1))+SUBREG_BYTE(src),
2797
+                                       false)));
2798
+               } else fprintf(stderr, "ZIP/Cannot understand SUBREG\n");
2799 102 dgisselq
+       } else {
2800
+               fprintf(stderr, "ZIP/No usable move\n");
2801
+               zip_debug_rtx_pfx("TO  : ", dst);
2802
+               zip_debug_rtx_pfx("FROM: ", src);
2803
+               debug_rtx(dst);
2804
+               debug_rtx(src);
2805
+               return false;
2806
+       }
2807
+       if (dbg) fprintf(stderr, "ZIP-GEN-MOVE -- DONE\n");
2808
+       return true;
2809
+}
2810
+
2811
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2812 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2813 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2814
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2815
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2816
+       switch(GET_CODE(condition)) {
2817
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2818
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2819
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2820
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2821
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2822
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2823
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2824
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2825
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2826
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2827
+       default:
2828
+               zip_debug_rtx(condition);
2829
+               internal_error("CSTORE Unsupported condition");
2830
+               return NULL;
2831
+       }
2832
+}
2833
+
2834
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2835
+       static char     result[64] = "";
2836
+       switch(condition) {
2837
+               //
2838
+               // Result already exists in the iffalse register
2839
+               // Can't change it.  Therefore, on the
2840
+               // condition ... move true register to the
2841
+               // destination
2842
+               //
2843
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2844
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2845
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2846
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2847
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2848
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2849
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2850
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2851
+               //
2852
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2853
+               // .C will never be set on an equal condition.  Therefore, we
2854
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2855
+               // as long as .Z wasn't true.  We then undo this when we're
2856
+               // done.  This is possible since none of these instructions
2857
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2858
+               // the condition codes.
2859
+               //
2860
+               // This is obviously not very optimal.  Avoid this by all means
2861
+               // if you can
2862
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2863
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2864
+               // two instructions
2865
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2866
+               //
2867
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2868
+               // painful.  We can change the condition codes to make it so,
2869
+               // but the instruction requires the condition codes not be
2870
+               // changed.  Hence, we must change them back if we do so.
2871
+               //
2872
+               // .C will be set on less than but not equal.  Hence !.C will
2873
+               // be true on greater than or equal.
2874
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2875
+               default:
2876
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2877
+                       return NULL;
2878
+       } return result;
2879
+}
2880
+
2881
+const char *zip_tertiary_movsicc(rtx condition, const char *optrue, const char *opfalse) {
2882
+       static  char    result[64] = "";
2883
+       switch(GET_CODE(condition)) {
2884
+               case EQ:        sprintf(result,"%s\t%%3,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue); break;
2885
+               case NE:        sprintf(result,"%s\t%%3,%%0\n\t%s.NZ\t%%2,%%0", opfalse, optrue); break;
2886
+               case LT:        sprintf(result,"%s\t%%3,%%0\n\t%s.LT\t%%2,%%0", opfalse, optrue); break;
2887
+               case GT:        sprintf(result,"%s\t%%3,%%0\n\t%s.GT\t%%2,%%0", opfalse, optrue); break;
2888
+               // LE doesn't exist on a Zip CPU.  Accomplish this by
2889
+               // reversing the condition: i.e., load the false value into
2890
+               // the register, and the on condition load the true value.
2891
+               case LE:        sprintf(result,"%s\t%%2,%%0\n\t%s.GT\t%%3,%%0", optrue, opfalse); break;
2892
+               case GE:        sprintf(result,"%s\t%%3,%%0\n\t%s.GE\t%%2,%%0", opfalse, optrue); break;
2893
+               case LTU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0", opfalse, optrue); break;
2894
+               //
2895
+               case GTU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n\t%s.Z\t%%3,%%0", optrue, opfalse, opfalse); break;
2896
+               case LEU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue, optrue); break;
2897
+               case GEU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n", optrue, opfalse); break;
2898
+               default:
2899
+                       internal_error("MOVSICC Unsupported condition");
2900
+                       return NULL;
2901
+       } return result;
2902
+}
2903
+
2904
+const char *zip_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2905 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2906 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2907
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2908
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2909
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2910
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2911
+       if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2912
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(X) -> R\n");
2913
+               if (zip_legitimate_move_operand_p(SImode, iffalse, true))
2914
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "MOV", 3);
2915
+               else if (zip_const_address_operand(iffalse))
2916
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2917
+               else if (zip_const_address_operand(iffalse))
2918
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2919 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2920 102 dgisselq
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LOD", 3);
2921
+               else {
2922
+                       internal_error("MOVSICC Unsupported mode");
2923
+                       return NULL;
2924
+               }
2925
+       } if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2926
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(!X) -> R\n");
2927
+               if (zip_legitimate_move_operand_p(SImode, iftrue, true))
2928
+                       return zip_binary_movsicc(GET_CODE(condition), "MOV",2);
2929
+               else if (zip_const_address_operand(iffalse))
2930
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2931
+               else if (zip_const_address_operand(iffalse))
2932
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2933 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2934 102 dgisselq
+                       return zip_binary_movsicc(GET_CODE(condition), "LOD",2);
2935
+               else {
2936
+                       internal_error("MOVSICC Unsupported mode");
2937
+                       return NULL;
2938
+               }
2939
+       } if ((zip_const_address_operand(iftrue))&&(zip_const_address_operand(iffalse))) {
2940
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE #2\n");
2941
+               return zip_tertiary_movsicc(condition, "LDI", "LDI");
2942
+       } if ((zip_const_address_operand(iftrue))&&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2943
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE A+B\n");
2944
+               return zip_tertiary_movsicc(condition, "LDI", "MOV");
2945
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))&&(zip_const_address_operand(iffalse))) {
2946
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE #x\n");
2947
+               return zip_tertiary_movsicc(condition, "MOV", "LDI");
2948
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2949
+                       &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2950
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C+D\n");
2951
+               return zip_tertiary_movsicc(condition, "MOV", "MOV");
2952
+       }
2953
+       if ((MEM_P(iftrue))
2954 111 dgisselq
+               &&(zip_legitimate_opb(XEXP(iftrue,0), true))
2955 102 dgisselq
+               &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2956
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C+D\n");
2957
+               return zip_tertiary_movsicc(condition, "LOD", "MOV");
2958
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2959 111 dgisselq
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2960 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C[D]\n");
2961
+               return zip_tertiary_movsicc(condition, "MOV", "LOD");
2962 111 dgisselq
+       } if ((MEM_P(iftrue))&&(zip_legitimate_opb(XEXP(iftrue,0), true))
2963
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2964 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C[D]\n");
2965
+               return zip_tertiary_movsicc(condition, "LOD", "LOD");
2966 111 dgisselq
+       } if ((MEM_P(iftrue))
2967
+               &&(zip_legitimate_opb(XEXP(iftrue,0),true))
2968
+               &&(zip_const_address_operand(iffalse))) {
2969
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE #x\n");
2970
+               return zip_tertiary_movsicc(condition, "LOD", "LDI");
2971
+       } if ((MEM_P(iffalse))
2972
+               &&(zip_legitimate_opb(XEXP(iffalse,0),true))
2973
+               &&(zip_const_address_operand(iftrue))) {
2974
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #x ELSE A[B]\n");
2975
+               return zip_tertiary_movsicc(condition, "LDI", "LOD");
2976 102 dgisselq
+       }
2977
+
2978
+       internal_error("MOVSICC Operands not supported");
2979
+}
2980
+
2981
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2982
+       // We know upon entry that REG_P(dst) must be true
2983
+       if (!REG_P(dst))
2984
+               internal_error("%s","ADDSICC into something other than register");
2985
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2986
+               switch (GET_CODE(condition)) {
2987
+               case EQ: return "ADD.Z\t%3,%0";
2988
+               case NE: return "ADD.NZ\t%3,%0";
2989
+               case LT: return "ADD.LT\t%3,%0";
2990
+               case GT: return "ADD.GT\t%3,%0";
2991
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2992
+               case GE: return "ADD.GE\t%3,%0";
2993
+               case LTU: return "ADD.C\t%3,%0";
2994
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2995
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2996
+               // Can do a GEU comparison, and then undo on the Zero condition
2997
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2998
+               default:
2999
+                       internal_error("%s", "Zip/No usable addsi expansion");
3000
+                       break;
3001
+               }
3002
+       } else {
3003
+               // MOV A+REG,REG
3004
+               switch (GET_CODE(condition)) {
3005
+               case EQ: return "MOV.Z\t%3+%2,%0";
3006
+               case NE: return "MOV.NZ\t%3+%2,%0";
3007
+               case LT: return "MOV.LT\t%3+%2,%0";
3008
+               case GT: return "MOV.GT\t%3+%2,%0";
3009
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
3010
+               case GE: return "MOV.GE\t%3+%2,%0";
3011
+               case LTU: return "MOV.C\t%3+%2,%0";
3012
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
3013
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
3014
+               // Can do a GEU comparison, and then undo on the Zero condition
3015
+               // EXCEPT: with a move instruction, what's there to undo?  We
3016
+               // just clobbered our register!
3017
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
3018
+               default:
3019
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
3020
+                       break;
3021
+               }
3022
+       }
3023
+
3024
+       return "BREAK";
3025
+}
3026
+
3027 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
3028 102 dgisselq
+       int     rv = 14;
3029
+       if ((mode == DImode)||(mode == DFmode))
3030
+               rv += 2;
3031
+       return rv;
3032
+}
3033
+
3034 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
3035 102 dgisselq
+
3036 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void) {
3037
+       // Let's try their suggested approach, keeping us from modifying jumps
3038
+       // after reload.  This should also allow our peephole2 optimizations
3039
+       // to adjust things back to what they need to be if necessary.
3040
+       return (reload_completed || reload_in_progress);
3041
+}
3042 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
3043
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
3044 117 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-04-01 06:33:55.090614401 -0400
3045
@@ -0,0 +1,3898 @@
3046 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
3047
+//
3048
+// Filename:   gcc/config/zip/zip.h
3049
+//
3050
+// Project:    Zip CPU backend for the GNU Compiler Collection
3051
+//
3052
+// Purpose:
3053
+//
3054
+// Creator:    Dan Gisselquist, Ph.D.
3055
+//             Gisselquist Technology, LLC
3056
+//
3057
+////////////////////////////////////////////////////////////////////////////////
3058
+//
3059
+// Copyright (C) 2016, Gisselquist Technology, LLC
3060
+//
3061
+// This program is free software (firmware): you can redistribute it and/or
3062
+// modify it under the terms of  the GNU General Public License as published
3063
+// by the Free Software Foundation, either version 3 of the License, or (at
3064
+// your option) any later version.
3065
+//
3066
+// This program is distributed in the hope that it will be useful, but WITHOUT
3067
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
3068
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3069
+// for more details.
3070
+//
3071
+// You should have received a copy of the GNU General Public License along
3072
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
3073
+// target there if the PDF file isn't present.)  If not, see
3074
+// <http://www.gnu.org/licenses/> for a copy.
3075
+//
3076
+// License:    GPL, v3, as defined and found on www.gnu.org,
3077
+//             http://www.gnu.org/licenses/gpl.html
3078
+//
3079
+//
3080
+////////////////////////////////////////////////////////////////////////////////
3081
+#ifndef        GCC_ZIP_H
3082
+#define        GCC_ZIP_H
3083
+
3084
+
3085
+//
3086
+//
3087
+// Zip CPU configuration registers
3088
+//
3089
+//
3090
+#define        ZIP_USER        0        // Assume we are in supervisor mode
3091
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
3092
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
3093
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
3094
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
3095
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
3096
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
3097
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
3098
+#define        ZIP_HAS_DI      1
3099
+
3100
+// Zip has 16 registers in each user mode.
3101
+//     Register 15 is the program counter (PC)
3102
+//     Register 14 is the condition codes (CC)
3103
+//     Register 13 is the stack pointer   (SP)
3104
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
3105
+//     Register  0 (may be) the return address pointer
3106
+// Registers 16-31 may only be used in supervisor mode.
3107
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
3108
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
3109
+
3110 103 dgisselq
+// #define     zip_FP_PSEUDO   16
3111
+#define        zip_PC          15
3112
+#define        zip_CC          14
3113
+#define        zip_SP          13
3114
+#define        zip_FP          12
3115
+#define        zip_GOT         11
3116
+#define        zip_AP          10
3117
+#define        zip_R1          1
3118
+#define        zip_R0          0
3119 102 dgisselq
+
3120
+#define        ZIP_FIRST_ARG_REGNO     1
3121
+#define        ZIP_LAST_ARG_REGNO      5
3122 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3123
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3124 102 dgisselq
+
3125
+/* The overall framework of an assembler file */
3126
+
3127
+#define        ASM_COMMENT_START       ";"
3128
+#define        ASM_APP_ON              ""
3129
+#define        ASM_APP_OFF             ""
3130
+
3131
+#define        FILE_ASM_OP             "\t.file\n"
3132
+
3133
+/* Output and Generation of Labels */
3134
+#define        GLOBAL_ASM_OP           "\t.global\t"
3135
+
3136
+#undef BITS_PER_UNIT
3137
+#define        BITS_PER_UNIT   (32)
3138
+
3139
+/* Assembler Commands for Alignment */
3140
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
3141
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
3142
+
3143
+
3144
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
3145
+ * for an instruction operand X. */
3146
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
3147
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
3148
+
3149
+/* Passing arguments in registers */
3150
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
3151
+
3152
+/* Define how to find the value returned by a function.  VALTYPE is the data
3153
+ * type of the value (as a tree).  If the precise function being called is known
3154
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
3155
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
3156
+
3157
+/* Define how to find the value returned by a library function assuming the
3158
+ * value has mode MODE.
3159
+ */
3160
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
3161
+
3162
+
3163
+/* STACK AND CALLING */
3164
+
3165
+
3166
+/* Define this macro as a C expression that is nonzero for registers that are
3167
+ * used by the epilogue or the return pattern.  The stack and frame pointer
3168
+ * registers are already assumed to be used as needed.
3169
+ */
3170
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
3171
+
3172
+
3173
+/* Normal alignment required for function parameters on the stack, in bits.  All
3174
+ * stack parameters receive at leaswt this much alignment regardless of data
3175
+ * type. */
3176
+#define        PARM_BOUNDARY   32
3177
+
3178
+/* Alignment of field after 'int : 0' in a structure. */
3179
+#define        EMPTY_FIELD_BOUNDARY    32
3180
+
3181
+/* No data type wants to be aligned rounder than this. */
3182
+#define        BIGGEST_ALIGNMENT       32
3183
+
3184
+/* The best alignment to use in cases where we have a choice. */
3185
+#define        FASTEST_ALIGNMENT       32
3186
+
3187
+/* Every structures size must be a multiple of 32-bits. */
3188
+#define        STRUCTURE_SIZE_BOUNDARY 32
3189
+
3190
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3191
+ * other C compilers handle alignment of bit-fields and the structures that
3192
+ * contain them.
3193
+ *
3194
+ * The behavior is that the type written for a named bit-field (int, short, or
3195
+ * other integer type) imposes an alignment for the entire structure, as if the
3196
+ * structure really did contain an ordinary field of that type.  In addition,
3197
+ * the bit-field is placed within the structure so that it would fit within
3198
+ * such a field, not crossing a boundary for it.
3199
+ *
3200
+ * Thus, no most machines, a named bit-field whose type is written as int would
3201
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3202
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3203
+ * by other alignment parameters.)
3204
+ *
3205
+ * An unnamed bit-field will not affect the alignment of the containing
3206
+ * structure.
3207
+ *
3208
+ * If thhe macro is defined, its definition should be a C expression, a non
3209
+ * zero value for the expression enables this behavior.
3210
+ * Look at the fundamental type that is used for a bit-field and use that to
3211
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3212
+ * have the same alignment as 'int', not 'char'.
3213
+ */
3214
+#undef PCC_BITFIELD_TYPE_MATTERS
3215
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3216
+
3217
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3218
+ * largest integer machine mode that should actually be used.  All integer
3219
+ * machine modes of this size and smaller can be used for structures and unions
3220
+ * with the appropriate sizes.  If this macro is undefined,
3221
+ * GET_MODE_BITSIZE(DImode) is assumed.
3222
+ *
3223
+ * ZipCPU -- The default looks good enough for us.
3224
+ */
3225
+
3226
+/* Make strings word-aligned so strcpy from constants will be faster. */
3227
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  (((TREE_CODE(EXP)==STRING_CST)  \
3228
+       && ((ALIGN) < FASTEST_ALIGNMENT)) ? FASTEST_ALIGNMENT : (ALIGN))
3229
+
3230
+/* Make arrays of chars word-aligned for the same reasons. */
3231
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     ((TREE_CODE(TYPE) == ARRAY_TYPE) \
3232
+       && (TYPE_MODE(TREE_TYPE(TYPE)) == QImode)               \
3233
+       && ((ALIGN < FASTEST_ALIGNMENT) ? FASTEST_ALIGNMENT : (ALIGN)))
3234
+
3235
+/* Generate Code for Profiling
3236
+ */
3237
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3238
+
3239
+
3240
+/* A C expression which is nonzero if register number NUM is suitable for use
3241
+ * as an index register in operand addresses.
3242
+ */
3243
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3244
+
3245
+
3246
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3247
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3248
+ * operand of mode MODE.
3249
+ */
3250 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3251
+// DRIVER_SELF_SPECS
3252
+// OPTION_DEFAULT_SPECS
3253
+// CPP_SPEC
3254
+// CPLUSPLUS_CPP_SPEC
3255
+// CC1_SPEC
3256
+// CC1PLUS_SPEC
3257
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3258
+ * to pass to the assembler.  It can also specify how to translate options you
3259
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3260
+ * 'sun3.h' for an example of this.
3261
+ *
3262
+ * Do not define thismacro if it does not need to do anything.
3263
+ */
3264
+// #undef      ASM_SPEC
3265
+// ASM_FINAL_SPEC
3266
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3267
+
3268
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3269
+ * to pass to the linker.  It can also specify how to translate options you give
3270
+ * to GCC into options for GCC to pass to the linker.
3271
+ *
3272
+ * Do not define this macro if it does not need to do anything.
3273
+ */
3274
+
3275
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3276
+ * difference between the two is that LIB_SPEC is used at the end of the
3277
+ * command given to the linker.
3278
+ *
3279
+ * If this macro is not defined, a default is provided that loads the standard
3280
+ * C library from the usual place.  See 'gcc.c'.
3281
+ */
3282
+#undef LIB_SPEC
3283
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3284
+#define        LIB_SPEC        ""
3285
+
3286
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3287
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3288
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3289
+ *
3290
+ * If this macro is not defined, the GCC driver provides a default that passes
3291
+ * the string '-lgcc' to the linker.
3292
+ */
3293
+#undef LIBGCC_SPEC
3294
+#define        LIBGCC_SPEC     ""
3295
+
3296
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3297
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3298
+ * modified to refer to different versions of 'libgcc.a' depending on the
3299
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3300
+ * and '-shared-libgcc'.  On targets where these modifications are
3301
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3302
+ * driver how to place a reference to 'libgcc' on the link command line, but
3303
+ * unlike LIBGCC_SPEC, it is used unmodified.
3304
+ */
3305
+#define        REAL_LIBGCC_SPEC        ""
3306
+
3307
+// USE_LD_AS_NEEDED
3308
+// LINK_EH_SPEC
3309
+
3310
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3311
+ * difference between the two is that STARTFILE_SPEC is used at the very
3312
+ * beginning of the command given to the linker.
3313
+ *
3314
+ * If this macro is not defined, a default is provided that loads the standard
3315
+ * C startup file from the usual place.  See 'gcc.c'
3316
+ */
3317
+#undef STARTFILE_SPEC
3318
+#define        STARTFILE_SPEC  ""
3319
+
3320
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3321
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3322
+ * of the command given to the linker.
3323
+ *
3324
+ * Do not define this macro if it does not do anything.
3325
+ */
3326
+// #undef      ENDFILE_SPEC
3327
+// #define     ENDFILE_SPEC    ""
3328
+
3329
+// THREAD_MODEL_SPEC
3330
+// SYSROOT_SUFFIX_SPEC
3331
+// SYSROOT_HEADERS_SUFFIX_SPEC
3332
+// EXTRA_SPECS
3333
+// LINK_LIBGCC_SPECIAL_1
3334
+// LINK_GCC_C_SEQUENCE_SPEC
3335
+// LINK_COMMAND_SPEC
3336
+// TARGET_ALWAYS_STRIP_DOTDOT
3337
+// MULTILIB_DEFAULTS
3338
+// RELATIVE_PREFIX_NOT_LINKDIR
3339
+// MD_EXEC_PREFIX
3340
+// STANDARD_STARTFILE_PREFIX
3341
+// STANDARD_STARTFILE_PREFIX_1
3342
+// STANDARD_STARTFILE_PREFIX_2
3343
+// MD_STARTFILE_PREFIX
3344
+// MD_STARTFILE_PREFIX_1
3345
+// INIT_ENVIRONMENT
3346
+// LOCAL_INCLUDE_DIR
3347
+#undef LOCAL_INCLUDE_DIR
3348
+
3349
+// NATIVE_SYSTEM_HEADER_COMPONENT
3350
+// INCLUDE_DEFAULTS
3351
+
3352 102 dgisselq
+/* 17.03 Run-time Target Specification */
3353
+
3354
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3355
+ * code that defines built-in preprocessor macros and assertions for the target
3356
+ * CPU, using the functions builtin_define, builtin_define_std, and
3357
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3358
+ * semicolon, and since it has finished command line option proccessing your
3359
+ * code can use those results freely.
3360
+ *
3361
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3362
+ * command line parameters we've been given indicate that our CPU has.  That
3363
+ * way, code can be adjusted depending upon the CPU's capabilities.
3364
+ */
3365
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3366
+       { builtin_define("__ZIPCPU__");                 \
3367
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3368
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3369
+       }
3370
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3371
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3372
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3373
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3374
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3375
+       // If (we support int64s) builtin_define("___int64_t_defined");
3376
+
3377
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3378
+ * macro is optional and is used for the target operating system instead.
3379
+ */
3380
+
3381
+/* Option macros: (we need to define these eventually ... )
3382
+ *
3383
+ *     TARGET_HANDLE_OPTION
3384
+ *     TARGET_HANDLE_C_OPTION
3385
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3386
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3387
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3388
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3389
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3390
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3391
+ *     C_COMMON_OVERRIDE_OTPTIONS
3392
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3393
+ *     TARGET_OPTION_INIT_STRUCT
3394
+ *     TARGET_OPTION_DEFAULT_PARAMS
3395
+ */
3396
+
3397
+/* SWITCHABLE_TARGET
3398
+ *
3399
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3400
+ * here.
3401
+ */
3402
+
3403
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3404
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3405
+ * otherwise.  This is intended to relate to the float and double types, but not
3406
+ * necessarily "long double".  By default, returns true if the adddf3
3407
+ * instruction pattern is available and false otherwise, on the assumption that
3408
+ * hardware floating point supports exceptions and rounding modes but software
3409
+ * floating point does not.
3410
+ *
3411
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3412
+ * support all of these bells and whistles when full functionality is even
3413
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3414
+ * set this to zero, so let's come back to this.
3415
+ */
3416
+// #warning "Wrong answer encoded to date"
3417 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3418 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3419
+
3420
+/* 17.04 Defining data structures for per-function information */
3421
+
3422
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3423
+ * information.  This macro is called once per function, before generation of
3424
+ * any RTL has begun.  The intention is to allow the initialization of the
3425
+ * function pointer init_machine_status.
3426
+ */
3427
+// #warning "I may need to define this to handle function return addresses ..."
3428
+
3429
+/* 17.05 Storage Layout */
3430
+
3431
+/* Storage Layout */
3432
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3433
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3434
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3435
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3436
+#define        BITS_PER_WORD           32
3437
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3438
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3439
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3440
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3441
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3442
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3443
+ * default is BITS_PER_WORD.
3444
+ *
3445
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3446
+ */
3447
+#define        POINTER_SIZE            32      // Ptr width in bits
3448
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3449
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3450
+ * than zero if pointers should be zero-extended, zero if they should be sign
3451
+ * extended, and negative if some other conversion is needed.  In the last case,
3452
+ * the extension is done by the target's ptr_extend instruction.
3453
+ *
3454
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3455
+ * the same width.
3456
+ *
3457
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3458
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3459
+ * two.  Hence, we specify how we would do that here.
3460
+ */
3461
+#define        POINTERS_EXTEND_UNSIGNED        0
3462
+
3463
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3464
+ * object whose type is type and which has he specified mode and signedness is
3465
+ * to be stored in a register.  This macro is only called when type is a scalar
3466
+ * type.
3467
+ *
3468
+ * On most RISC machines, which only have operations that operate on a full
3469
+ * register, define this macro to set m to word_mode if m is an integer mode
3470
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3471
+ * widened because wider precision floating-point operations are usually more
3472
+ * expensive than their narrower counterparts.
3473
+ *
3474
+ * For most machines, the macro definition does not change unsigndep.  However,
3475
+ * some machines, have instructions that preferentially handle either signed or
3476
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3477
+ * loads from memory and 32-bit add instructions sign-extend the result to
3478
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3479
+ * is more efficient.
3480
+ *
3481
+ * Do not define this macro if it would never modify m.
3482
+ *
3483
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3484
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3485
+ */
3486
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3487
+
3488
+// TARGET_PROMOTE_FUNCTION_MODE
3489
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3490
+ * stack, in bits.  All stack parameters receive at least this much alignment
3491
+ * regardless of data type.  On most machines, this is the same as the size of
3492
+ * an integer.
3493
+ */
3494
+#define        PARM_BOUNDARY   32
3495
+
3496
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3497
+ * hardware for the stack pointer on this machine.  The definition is a C
3498
+ * expression for the desired alignment (measured in bits).  This value is used
3499
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3500
+ * this should be the same as PARM_BOUNDARY.
3501
+ */
3502
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3503
+
3504
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3505
+
3506
+/* INCOMING_STACK_BOUNDARY
3507
+ */
3508
+
3509
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3510
+ */
3511
+#define        FUNCTION_BOUNDARY       32
3512
+
3513
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3514
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3515
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3516
+ */
3517
+#define BIGGEST_ALIGNMENT      32
3518
+
3519
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3520
+ * given to an object that can be referenced in one operation, without
3521
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3522
+ * larger on machines that don't have byte or halfword store operations.
3523
+ */
3524
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3525
+
3526
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3527
+ * fail to work when given unaligned data.  If instructions will merely go
3528
+ * slower in that case, define this macro as 0.
3529
+ */
3530
+#define        STRICT_ALIGNMENT        1
3531
+
3532
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3533
+ * largest integer machine mode that should actually be used.  All integer
3534
+ * machine modes of this size or smaller can be used for structures and unions
3535
+ * with the appropriate sizes.  If this macro is undefined,
3536
+ * GET_MODE_BITSIZE(DImode) is assumed.
3537
+ *
3538
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3539
+ * size on bits of the largest integer machine mode.  However, that's the case
3540
+ * with most DI implementations: A long is two words, spliced together.  We'd
3541
+ * like to support that eventually, but we need to get there.  Hence, let's use
3542
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3543
+ */
3544
+#if (ZIP_HAS_DI != 0)
3545
+#define        MAX_FIXED_MODE_SIZE     64
3546
+#else
3547
+#define        MAX_FIXED_MODE_SIZE     32
3548
+#endif
3549
+
3550
+
3551
+/* 17.06 Layout of Source Language Data Types */
3552
+
3553
+#undef CHAR_TYPE_SIZE
3554
+#undef SHORT_TYPE_SIZE
3555
+#undef INT_TYPE_SIZE
3556
+#undef LONG_TYPE_SIZE
3557
+#undef LONG_LONG_TYPE_SIZE
3558
+//
3559
+#define        CHAR_TYPE_SIZE  32
3560
+#define        SHORT_TYPE_SIZE 32
3561
+#define        INT_TYPE_SIZE   32
3562
+#define        LONG_TYPE_SIZE  32
3563
+#define        LONG_LONG_TYPE_SIZE     64
3564
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3565
+#undef FLOAT_TYPE_SIZE
3566
+#undef DOUBLE_TYPE_SIZE
3567
+#undef LONG_DOUBLE_TYPE_SIZE
3568
+#define        FLOAT_TYPE_SIZE         32
3569
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3570
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3571
+// SHORT_FRAC_TYPE_SIZE
3572
+// LONG_FFRACT_TYPE_SIZE
3573
+// LONG_LONG_FRACT_TIME_SIZE
3574
+#undef SHORT_ACCUM_TYPE_SIZE
3575
+#undef ACCUM_TYPE_SIZE
3576
+#undef LONG_ACCUM_TYPE_SIZE
3577
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3578
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3579
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3580
+
3581
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3582
+ * hook and should be defined if that hook is overriden to be true.  It causes
3583
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3584
+ * rather than the default __.  A port which uses this macro should also arrange
3585
+ * to use t-gnu-prefix in the libgcc config.host.
3586
+ *
3587
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3588
+ */
3589
+
3590
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3591
+ * in float.h,, assuming, if applicable, that the floating-point control word
3592
+ * is in its default state.  If you do not define this macro the value of
3593
+ * FLT_EVAL_METHOD will be zero.
3594
+ *
3595
+ * ZipCPU --- ???
3596
+ */
3597
+
3598
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3599
+ * floating-point format supported by the hardware.  If you define this macro,
3600
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3601
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3602
+ * default.
3603
+ *
3604
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3605
+ * really needs to be determined, then, based upon a compile time parameter
3606
+ * where the one compiling the code states whether or not the H/W even has
3607
+ * floating point support.
3608
+ *
3609
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3610
+ * need to change this.
3611
+ */
3612
+#undef WIDEST_HARDWARE_FP_SIZE
3613
+// #warning "Definition needs to change if no FPU present"
3614
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3615
+
3616
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3617
+ * whether the type char should be signed or unsigned by default.  The user
3618
+ * can always override this default with the options -fsigned-char and
3619
+ * -funsigned-char.
3620
+ *
3621
+ * ZipCPU--let's go with the default behavior.
3622
+ */
3623
+#define        DEFAULT_SIGNED_CHAR     1
3624
+
3625
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3626 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3627 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3628
+ * false if all enum types should be allocated like int.
3629
+ *
3630
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3631
+ * override it.
3632
+ */
3633
+
3634
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3635
+ * type to use for size values.  The typedef name size_t is defined using the
3636
+ * contents of the string.
3637
+ *
3638
+ * If you don't define this macro, the default is "long unsigned int".  Since
3639
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3640
+ * the default seems perfect for us.
3641
+ */
3642
+#define        SIZE_TYPE       "unsigned int"
3643
+
3644
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3645
+ * This macro is a C expression for a string describing the name of the data
3646
+ * type from which the precision of sizetype is extracted.  The string has the
3647
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3648
+ * default is SIZE_TYPE --- which seems good enough for us.
3649
+ */
3650
+
3651
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3652
+ * type to use fo rthe result of subtracting two pointers.  The typedef name
3653
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3654
+ * more information.
3655
+ *
3656
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3657
+ * for us.
3658
+ */
3659
+#define        PTRDIFF_TYPE    "int"
3660
+
3661
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3662
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3663
+ * the contents of  the string.  If you don't define this macro, the default is
3664
+ * 'int'--good enough for ZipCPU.
3665
+ */
3666
+
3667
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3668
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3669
+ */
3670
+#undef WCHAR_TYPE_SIZE
3671
+#define        WCHAR_TYPE_SIZE 32
3672
+
3673
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3674
+ * type to use for wide characters passed to printf and returned from getwc.
3675
+ * The typedef name wint_t is defined using the contents of the string.  See
3676
+ *
3677 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3678
+ * best for us again.
3679 102 dgisselq
+ */
3680
+
3681
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3682
+ * data type that can represent any value of any standard or extended signed
3683
+ * integer type.  The typedef name intmax_t is defined using the contents of
3684
+ * the string.
3685
+ *
3686
+ * If you don't define this macro, the default is the first of "int", "long int"
3687
+ * or "long long int" that has as much precision as "long long int".
3688
+ */
3689
+
3690
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3691
+ */
3692
+
3693
+#undef SIG_ATOMIC_TYPE
3694
+#if (ZIP_ATOMIC != 0)
3695
+#define        SIG_ATOMIC_TYPE "int"
3696
+#else
3697
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3698
+#endif
3699
+#undef INT8_TYPE
3700
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3701
+#undef INT16_TYPE
3702
+#define        INT16_TYPE              NULL
3703
+#undef INT32_TYPE
3704
+#define        INT32_TYPE              "int"
3705
+#undef UINT8_TYPE
3706
+#define        UINT8_TYPE              NULL
3707
+#undef UINT16_TYPE
3708
+#define        UINT16_TYPE             NULL
3709
+#undef UINT32_TYPE
3710
+#define        UINT32_TYPE             "unsigned int"
3711
+#undef INT_LEAST8_TYPE
3712
+#define        INT_LEAST8_TYPE         "int"
3713
+#undef INT_LEAST16_TYPE
3714
+#define        INT_LEAST16_TYPE        "int"
3715
+#undef INT_LEAST32_TYPE
3716
+#define        INT_LEAST32_TYPE        "int"
3717
+#undef UINT_LEAST8_TYPE
3718
+#define        UINT_LEAST8_TYPE        "unsigned int"
3719
+#undef UINT_LEAST16_TYPE
3720
+#define        UINT_LEAST16_TYPE       "unsigned int"
3721
+#undef UINT_LEAST32_TYPE
3722
+#define        UINT_LEAST32_TYPE       "unsigned int"
3723
+#undef INT_FAST8_TYPE
3724
+#define        INT_FAST8_TYPE          "int"
3725
+#undef INT_FAST16_TYPE
3726
+#define        INT_FAST16_TYPE         "int"
3727
+#undef INT_FAST32_TYPE
3728
+#define        INT_FAST32_TYPE         "int"
3729
+#undef UINT_FAST8_TYPE
3730
+#define        UINT_FAST8_TYPE         "unsigned int"
3731
+#undef UINT_FAST16_TYPE
3732
+#define        UINT_FAST16_TYPE        "unsigned int"
3733
+#undef UINT_FAST32_TYPE
3734
+#define        UINT_FAST32_TYPE        "unsigned int"
3735
+#undef INTPTR_TYPE
3736
+#define        INTPTR_TYPE             "unsigned int"
3737
+#undef UINTPTR_TYPE
3738
+#define        UINTPTR_TYPE            "unsigned int"
3739
+
3740
+#undef INT64_TYPE
3741
+#undef UINT64_TYPE
3742
+#undef INT_LEAST64_TYPE
3743
+#undef UINT_LEAST64_TYPE
3744
+#undef INT_FAST64_TYPE
3745
+#undef UINT_FAST64_TYPE
3746
+
3747
+#if (ZIP_HAS_DI != 0)
3748
+#define        INT64_TYPE              "long int"
3749
+#define        UINT64_TYPE             "long unsigned int"
3750
+#define        INT_LEAST64_TYPE        "long int"
3751
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3752
+#define        INT_FAST64_TYPE         "long int"
3753
+#define        UINT_FAST64_TYPE        "long unsigned int"
3754
+#else
3755
+#define        INT64_TYPE              NULL
3756
+#define        UINT64_TYPE             NULL
3757
+#define        INT_LEAST64_TYPE        NULL
3758
+#define        UINT_LEAST64_TYPE       NULL
3759
+#define        INT_FAST64_TYPE         NULL
3760
+#define        UINT_FAST64_TYPE        NULL
3761
+#endif
3762
+
3763
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3764
+
3765
+
3766
+/* 17.07 Register Usage / Register definitions */
3767
+
3768
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3769
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3770
+ * pseudo register's numbrer really is assigned the number
3771
+ * FIRST_PSEUDO_REGISTER.
3772
+ *
3773
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3774
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3775
+ * compiler can take register number 16 and above and do whatever it wants
3776
+ * with it.
3777
+ */
3778
+#ifdef DEFINE_USER_REGS
3779 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3780 102 dgisselq
+#else
3781 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3782
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3783
+#  else
3784
+#    define    FIRST_PSEUDO_REGISTER   16
3785
+#  endif
3786 102 dgisselq
+#endif
3787
+
3788
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3789
+ * fixed purposes all throughout the compiled code and are therefore not
3790
+ * available for general allocation.  These would include the stack pointer, the
3791
+ * frame pointer (except on machines where that can be used as a general
3792
+ * register when no frame pointer is needed), the program counter on machines
3793
+ * where that is considered one of the addressable registers, and any other
3794
+ * numbered register with a standard use.
3795
+ *
3796
+ * This information is expressed as a sequence of numbers, separated by commas,
3797
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3798
+ * otherwise.
3799
+ *
3800
+ * For the Zip CPU, we have three fixed registers that are not available for
3801
+ * general allocation:
3802
+ *
3803
+ *     SP      The stack pointer
3804
+ *     CC      The condition codes and CPU state register
3805
+ *     PC      The program counter
3806
+ *
3807
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3808
+ * table pointer) are registers that we hope will not be so fixed.
3809
+ */
3810 103 dgisselq
+#ifdef zip_FP_PSEUDO
3811
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3812
+#else
3813
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3814
+#endif
3815 102 dgisselq
+
3816
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3817
+ * that is clobbered (in general) by function calls as well as for fixed
3818
+ * registers.  This macro therefore identifies the registers that are not
3819
+ * available for general allocation of values that must live across function
3820
+ * calls.
3821
+ *
3822
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3823
+ * it on function entry and restores it on function exit, if the register is
3824
+ * used within the function.
3825
+ *
3826
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3827
+ * register above R5.
3828
+ */
3829 103 dgisselq
+#ifdef zip_FP_PSEUDO
3830
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3831
+#else
3832
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3833
+#endif
3834 102 dgisselq
+
3835
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3836
+ * to the value of CALL_USED_REGISTERS.
3837
+ */
3838
+
3839
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3840
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3841
+ * across a call without some part of it being clobbbered.  For most machines,
3842
+ * this macro need not be defined.  It is only required for machines that do
3843 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3844 102 dgisselq
+ *
3845
+ * In the Zip CPU, we clobber R0 with our return address during a call, so let's
3846
+ * make sure this gets included here.
3847
+ */
3848
+#define        HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3849
+
3850
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3851
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3852
+ * reg_class_contents, to take into account any dependence of these register
3853
+ * sets on target flags.  The first three of these are of type char[]
3854
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3855
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3856
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3857
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3858
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3859
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3860
+ * applied.
3861
+ *
3862
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3863
+ * GBL register allocation go.  But for now, we'll leave this at its default
3864
+ * value.
3865
+ */
3866
+// #warning "Revisit me after FP and GBL allocation"
3867
+
3868
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3869
+ * windows. ...
3870
+ *
3871
+ * Zip CPU has no register windows.
3872
+ */
3873
+
3874
+/* OUTGOING_REGNO ... same thing.
3875
+ */
3876
+
3877
+/* LOCAL_REGNO ... same thing.
3878
+ */
3879
+
3880
+/* PC_REGNUM ... If the program counter has a register number, define this as
3881
+ * that register number.  Otherwise do not define it.
3882
+ */
3883
+#define        PC_REGNUM       zip_PC
3884
+
3885
+
3886
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3887
+ * containing the number of hard registers in the order in which GCC should
3888
+ * prefer to use them (from most preferred to least.
3889
+ *
3890 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3891 102 dgisselq
+ * else being equal).
3892
+ *
3893
+ * Since the default is the ZipCPU desired case, we won't define this here.
3894
+ */
3895
+
3896
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3897
+ * this macro, so we won't either.
3898
+ */
3899
+
3900
+/* HONOR_REG_ALLOC_ORDER ...
3901
+ */
3902
+
3903
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3904
+ * this macro, so we won't either.
3905
+ */
3906
+
3907
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3908
+ * consecutive hard registers, starting at register number REGNO, required to
3909
+ * hold a value of mode MODE.
3910
+ *
3911
+ * On a machine where all registers are exactly one word, a suitable definition
3912
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3913
+ *
3914
+ * On ZipCPU, we might do
3915
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3916
+ * but I think the default (above) code should work as well.  Hence, let's stick
3917
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3918
+ * XImode) and expect us to follow them properly some how.
3919
+ *
3920
+ * Okay, now in hind sight, we know that the default doesn't work for our
3921
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3922
+ * this expression to work in bits rather than in bytes and we'll know more
3923
+ * of what we are doing.
3924
+ */
3925
+#undef HARD_REGNO_NREGS
3926
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3927
+               / (UNITS_PER_WORD))
3928
+
3929
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3930
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3931
+ * to take up more space than in registers starting at register number REGNO
3932
+ * (as determined by multiplying GCC's notion of the size of the register when
3933
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3934
+ * By default this is zero.
3935
+ *
3936
+ * Zip CPU --- The default looks good enough to me.
3937
+ */
3938
+
3939
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3940
+ *
3941
+ * ZipCPU ---
3942
+ */
3943
+
3944
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3945
+ * registers that hold values of mode mode is not the word size.  It is a C
3946
+ * expression that should give the natural size in bytes for the specified mode.
3947
+ * It is used by the register allocator to try to optimize its results.
3948
+ *
3949
+ * ZipCPU ---
3950
+ */
3951
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3952
+
3953
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3954 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3955 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3956
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3957
+ * for the numbers of fixed registers, because the allocation mechanism
3958
+ * considered them to be always occupied.
3959
+ *
3960
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3961
+ * suitable default definition mentioned above should be sufficient.
3962
+ */
3963
+#undef HARD_REGNO_MODE_OK
3964 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3965 102 dgisselq
+
3966
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3967
+ * okay to rename a hard register FROM to another hard register TO.  One common
3968
+ * use of this macro is to prevernt renaming of a register to another register
3969
+ * that is not saved by a prologue in an interrupt handler.  The default is
3970
+ * always nonzero.
3971
+ *
3972
+ * ZipCPU --- The default looks good enough to us.
3973
+ */
3974
+#undef HARD_REGNO_RENAME_OK
3975
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3976
+
3977
+
3978
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
3979
+ * M1 is accessible in mode M2 without copying.
3980
+ *
3981
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
3982
+ * so lets' set to one.
3983
+ */
3984
+#define        MODES_TIEABLE_P(M1,M2)  1
3985
+
3986
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
3987
+ * This target hook should return true if it is OK to use a hard register
3988
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
3989
+ * to prevent using of a register that is not saved by a prologue in an
3990
+ * interrupt handler.  The default version of this hook always returns true.
3991
+ *
3992
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
3993
+ * context, you have an entirely new set of registers (the supervisor set), so
3994
+ * this is a non-issue.
3995
+ */
3996
+
3997
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
3998
+ * copies to/from CCmode register(s).  You should only define this macro if
3999
+ * support for copying to/from CCmode is incomplete.
4000
+ *
4001
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
4002
+ * default definition.
4003
+ */
4004
+
4005
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
4006
+ *
4007
+ * Zip CPU has no stack-like registers, as their definition is different from
4008
+ * the ZipCPU stack pointer register.
4009
+ */
4010
+
4011
+#define        ZIP_REG_BYTE_SIZE       1
4012
+
4013
+/* 17.08 Register Classes */
4014
+
4015
+/* enum reg_class ... An enumerate type that must be defined with all the
4016
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
4017
+ * must be the last register class, followed by one more enumerated value,
4018
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
4019
+ * classes there are.
4020
+ *
4021
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
4022
+ * all_regs, and go from there.
4023
+ */
4024
+enum   reg_class {
4025
+       NO_REGS, GENERAL_REGS,
4026
+#ifdef DEFINE_USER_REGS
4027
+       USER_REGS,
4028
+#endif
4029
+       ALL_REGS, LIM_REG_CLASSES
4030
+};
4031
+
4032
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
4033
+ */
4034
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
4035
+
4036
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
4037
+ * classes as C string constants.  These names are used in writing some of the
4038
+ * debugging dumps.
4039
+ */
4040
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
4041
+
4042
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
4043
+ * classes, as integerss which are bit masks.  The nth integer specifies the
4044
+ * contents of class n.  That way the integer mask is interpreted as that
4045
+ * register r is in the class if (mask&(1<<r)) is 1.
4046
+ *
4047
+ * When the machine has more than 32 registers ... that's not us.
4048
+ *
4049
+ * ZipCPU --- This is straight forward, three register classes, etc.
4050
+ */
4051 103 dgisselq
+#ifdef zip_FP_PSEUDO
4052
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
4053
+#else
4054 102 dgisselq
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
4055 103 dgisselq
+#endif
4056 102 dgisselq
+
4057
+#ifdef DEFINE_USER_REGS
4058
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
4059
+#define        REG_CLASS_CONTENTS { { 0x00000},{0x03fff},{0x0ffff0000},{0x0ffffffff} }
4060
+#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 }
4061
+#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 }
4062
+#endif
4063
+
4064
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
4065
+ * containing hard register REGNO.  In general there is more than one such
4066
+ * class;  Choose a class which is minimal, meaning that no smaller class also
4067
+ * contains the register.
4068
+ */
4069
+#undef REGNO_REG_CLASS
4070 103 dgisselq
+#ifdef zip_FP_PSEUDO
4071
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
4072
+#else
4073 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
4074 103 dgisselq
+#endif
4075 102 dgisselq
+
4076
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
4077
+ * a valid base register must belong.  A base register is one used in an address
4078
+ * which is the register value plus a displacement.
4079
+ */
4080
+#undef BASE_REG_CLASS
4081
+#define        BASE_REG_CLASS  GENERAL_REGS
4082
+
4083
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
4084
+ * which allows the selection of a bse register in a mode dependent manner.  If
4085
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
4086
+ */
4087
+#undef MODE_BASE_CLASS
4088
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
4089
+
4090
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
4091
+ * class to which a valid base register must belong in order to be used in a
4092
+ * base plus index register address.  You should define this macro if base plus
4093
+ * index addresses have different requirements than other base register uses.
4094
+ *
4095
+ * Zip CPU does not support the base plus index addressing mode, thus ...
4096
+ */
4097 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
4098
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
4099 102 dgisselq
+
4100
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
4101
+ * which a valid index register must belong.  An index register is one used in
4102
+ * an address where its value is either multiplied by a scale factor or added
4103
+ * to another register (as well as added to a displacement).
4104
+ *
4105
+ * ZipCPU -- Has no index registers.
4106
+ */
4107
+#undef INDEX_REG_CLASS
4108
+#define        INDEX_REG_CLASS NO_REGS
4109
+
4110
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
4111
+ * number num is suitable for use as a base register in operand addresses.
4112
+ */
4113
+#undef REGNO_OK_FOR_BASE_P
4114
+#ifdef DEFINE_USER_REGS
4115
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM != zip_CC)&&(NUM < 16))
4116
+#else
4117
+# define REGNO_OK_FOR_BASE_P(NUM)      (NUM != zip_CC)
4118
+#endif
4119
+
4120
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
4121
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
4122 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
4123 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
4124
+ *
4125
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
4126
+ */
4127
+
4128
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
4129
+ * addresses, accessing memory in mode mode.
4130
+ *
4131
+ * Use of this macro is deprecated.
4132
+ */
4133
+
4134 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
4135 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
4136
+ * operand addresses, accessing memory in mode M in address space AS.  This is
4137
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
4138
+ * the context in which the register appears in the memory reference.
4139
+ *
4140
+ * ZipCPU---We aren't specific in how we use our registers.
4141
+ */
4142
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
4143
+
4144
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
4145
+ * num is suitable for use as an index register in opernad addressess.  It may
4146
+ * be either a suitable hard register or a pseudo register that has been
4147 111 dgisselq
+ * allocated such as a hard register.
4148 102 dgisselq
+ *
4149
+ * ZipCPU has no index registers, therefore we declare this to be zero.
4150
+ */
4151
+#undef REGNO_OK_FOR_INDEX_P
4152
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
4153
+
4154
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
4155
+ * additional preference on the register class to use when it is necessary to
4156
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
4157
+ * preferred register class is found or hook preferred_rename_class is not
4158
+ * implemented.  SOmething returning a more restrictive class makes better code.
4159
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
4160
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
4161
+ * preferred_rename_class, code size can be reduced.
4162
+ */
4163
+// #undef TARGET_PREFERRED_RENAME_CLASS
4164
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
4165
+
4166
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
4167
+ * restri tions on the register class to use when it is necessary to copy value
4168
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
4169
+ * perhaps a smaller class.
4170
+ *
4171
+ * The default fversion of this hook always returns value of RC argument, which
4172
+ * sounds quite appropriate for the ZipCPU.
4173
+ */
4174
+
4175
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
4176
+ * restrictions on the register class to use when it is necessary to copy
4177
+ * value X into a register in class CLASS.  On many machines, the following
4178
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
4179
+ * Sometimes returning a more restrictive class makes better code.  For example,
4180
+ * on the 68k, when x is an integer constant that is in range for a moveq
4181
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
4182 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
4183 102 dgisselq
+ * 'moveq' will be used.
4184
+ *
4185
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
4186
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
4187
+ * Hence, we only allow loads into the GENERAL_REG class.
4188
+ */
4189
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
4190
+
4191
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
4192
+ * RELOAD_CLASS, but for output instead of input reloads.
4193
+ *
4194
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
4195
+ */
4196
+
4197
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
4198
+ *
4199
+ * Don't define this macro unless the target machine has limitations which
4200
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
4201
+ */
4202
+
4203
+/* TARGET_SECONDARY_RELOAD
4204
+ * SECONDARY_ ...
4205
+ * Don't think we need these ...
4206
+ */
4207
+
4208
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
4209
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
4210
+ *
4211
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
4212
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
4213
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
4214
+ *
4215
+ * This macro helps control the handling of multiple word values in the reload
4216
+ * pass.
4217
+ *
4218
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
4219
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
4220
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
4221
+ */
4222
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
4223
+
4224
+/* CANNOT_CHANGE_MODE_CLASS
4225
+ * ???
4226
+ */
4227
+
4228
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
4229
+ */
4230
+
4231
+/* TARRGET_LRA_P
4232
+ * Default looks good.
4233
+ */
4234
+
4235
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
4236 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
4237 102 dgisselq
+ * number
4238
+ *
4239
+ * The default version of this target hook returns always zero---good enough for
4240
+ * the ZipCPU.
4241
+ */
4242
+
4243
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4244
+ * if we need register usage leveling.  That means if a few hard registers are
4245
+ * equally good for the assignment, we choose the least used hard register.  The
4246
+ * register usage leveling may be profitable for some targets.  Don't use usage
4247
+ * leveling for targets with conditional execution or targets with big register
4248
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4249
+ * version of this target hook returns always false.
4250
+ *
4251
+ * ZipCPU --- Default is the right answer.
4252
+ */
4253
+
4254
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4255
+ * Default looks good.
4256
+ */
4257
+
4258
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4259
+ * Default looks good.
4260
+ */
4261
+
4262
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4263
+ */
4264
+
4265
+/* TARGET_SPILL_CLASS
4266
+ *
4267
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4268
+ * user set of registers.  However, we're not building for that mode (now),
4269
+ * so we'll leave this at the default of NO_REGS.
4270
+ */
4271
+
4272
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4273
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4274
+ * instruction code for the cstore being performed.  Not defining this hook is
4275
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4276
+ * patterns.
4277
+ *
4278
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4279
+ * default therefore.
4280
+ */
4281
+
4282
+/* 17.09 Stack Layout and Calling Conventions */
4283
+
4284
+
4285
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4286
+ * moves the stack pointer to a smaller address, and false otherwise.
4287
+ *
4288
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4289
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4290
+ * is our convention, we'll define it as such.
4291
+ */
4292
+#undef STACK_GROWS_DOWNWARD
4293
+#define        STACK_GROWS_DOWNWARD    1
4294
+
4295
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4296
+ * pushed on the stack.  In RTL, a push operation will be
4297
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4298
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4299
+ * direction and on whether the stack pointer points to the last item on the
4300
+ * stack or whether it points to the space for the next item on the stack.
4301
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4302
+ * always right, and PRE_INC otherwise, which is often wrong.
4303
+ *
4304
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4305
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4306
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4307
+ */
4308
+
4309
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4310
+ * local variable slots are at negative offsets from the frame pointer.
4311
+ *
4312
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4313 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4314 102 dgisselq
+ * this should be the case as well.
4315
+ */
4316
+#undef FRAME_GROWS_DOWNWARD
4317
+#define        FRAME_GROWS_DOWNWARD    1
4318
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4319
+
4320
+
4321
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4322
+ * function occupy decreasing addresses on the stack.
4323
+ *
4324
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4325
+ * it is of no consequence to the hardware.
4326
+ */
4327
+
4328
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4329
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4330
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4331
+ * Otherwise it is found by adding the length of the first slot to the value
4332
+ * START_FRAME_OFFSET.
4333
+ *
4334
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4335
+ * the code is getting generated.  However, the ECO32 code I am copying from
4336
+ * suggests that 0 is the right value, so we'll use that here.
4337
+ */
4338
+// #warning "Re-evaluate me"
4339
+#define        STARTING_FRAME_OFFSET   0
4340
+
4341
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4342
+ * stack during reload.  The nonzero default for this macro is suitable for most
4343
+ * ports.
4344
+ *
4345
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4346
+ * shows up on the stack we may need to adjust it.
4347
+ */
4348
+
4349
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4350
+ * which outgoing arguments are placed.  If not specified, the default value
4351
+ * of zero is used.  This is the proper value for most machines.
4352
+ */
4353
+#define        STACK_POINTER_OFFSET    0
4354
+
4355
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4356
+ * argument's address.  On some machines it may depend on the data type of the
4357
+ * function.
4358
+ */
4359
+#define        FIRST_PARM_OFFSET(F)    0
4360
+
4361
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4362
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4363
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4364
+ * The default is correct for most machines, ...
4365
+ *
4366
+ * ZipCPU --- so we'll use it for the ZipCPU.
4367
+ */
4368
+
4369
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4370
+ * the address of the initial stack frame.  This address is passed to
4371
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4372
+ * a reasonable default value will be used.  Define this macro in order to make
4373
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4374
+ * and __builtin_return_address(C) for (C) not equal to zero.
4375
+ *
4376
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4377
+ */
4378
+
4379
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4380
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4381
+ * example, on the SPARC, we must flush all of the register windows to the stack
4382
+ * before we can access arbitrary stack frames.  You will seldom need to define
4383
+ * this macro.  The default is to do nothing.
4384
+ *
4385
+ * ZipCPU --- which is what we shall do here.
4386
+ */
4387
+
4388
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4389
+ * an RTX that is used to store the address of the current frame into the
4390
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4391
+ * for most machines.  One reason you may need to define this target hook is if
4392
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4393
+ *
4394
+ * ZipCPU --- leave this undefined, since the default value should be correct
4395
+ * for "most" machines.
4396
+ */
4397
+
4398
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4399
+ */
4400
+
4401
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4402
+ * representing the value of the return address for the frame COUNT steps up
4403
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4404
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4405
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4406
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4407
+ * there is no way to determine the return address of other frames.
4408
+ *
4409
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4410
+ */
4411
+#undef RETURN_ADDR_RTX
4412
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4413
+
4414
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4415
+ * return address of a particular stack frame is accessed from the frame pointer
4416
+ * of the previous stack frame.  The zero default for this macro is suitable
4417
+ * for most ports.
4418
+ *
4419
+ * ZipCPU---Default works here as well.
4420
+ */
4421
+
4422
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4423
+ * the location of the incoming return address at the beginning of any function,
4424
+ * before the prologue.  This RTL is either a REG, indicating that the return
4425
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4426
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4427
+ * DWARF_FRAME_REGNUM(REGNO).
4428
+ *
4429
+ * ZipCPU --- While our incoming return address could theoretically be in any
4430
+ * register, our machine description file is going to place it into register
4431
+ * R0, so that's what we return here.
4432
+ */
4433
+#undef INCOMING_RETURN_ADDR_RTX
4434
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4435
+
4436
+
4437
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4438
+ */
4439
+
4440
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4441
+ * register number that is considered to always have the value zero.  This
4442
+ * should only be defined if the target has an architected zero register (ZipCPU
4443
+ * does not), and someone decided it was a good idea to use that register number
4444
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4445
+ * ZipCPU port will avoid it as well).
4446
+ *
4447
+ */
4448
+
4449
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4450
+ */
4451
+
4452
+/* INCOMING_FRAME_SP_OFFSET
4453
+ */
4454
+#define        INCOMING_FRAME_SP_OFFSET        0
4455
+
4456
+/* ARG_POINTER_CFA_OFFSET
4457
+ */
4458
+
4459
+/* FRAME_POINTER_CFA_OFFSET
4460
+ */
4461
+
4462
+/* CFA_FRAME_BASE_OFFSET
4463
+ */
4464
+
4465
+/* 17.09.02 Exception handling support */
4466
+
4467
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4468
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4469
+ * N registers are usable.  The exception handling library routines communicate
4470
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4471
+ * these registers should be call clobbered; it is possible to use call-saved
4472
+ * registers, but may negatively impact code size.  The target must support at
4473
+ * least 2 data registers, but should define 4 if their are enough free
4474
+ * registers.
4475
+ *
4476
+ * You must define this macro if you want to support call frame exception
4477
+ * handling like that provided by DWARF 2.
4478
+ */
4479
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4480
+
4481
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4482
+ * a location in which to store a stack adjustment to be applied before function
4483
+ * return.  This is used to unwind the stack to an exception handler's call
4484
+ * frame.  It will be assigned zero on code paths that return normally.
4485
+ *
4486
+ * Do not define this macro if the stack pointer is saved and restored by the
4487
+ * regular prolog and epilog code in the call frame itself (which it is for the
4488
+ * ZipCPU); in this case, the exception handling library routines will update
4489
+ * the stack location to be restored in place.  Otherwise, you must define this
4490
+ * macro if you want to support call frame exception handling like that provided
4491
+ * by DWARF 2.
4492
+ *
4493
+ */
4494
+
4495
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4496
+ * location in which to store the address of an exception handler to which we
4497
+ * should return.  It will not be assigned on code paths that return normally.
4498
+ *
4499
+ * Typcally this is the location in the call frame at which the normal return
4500
+ * address is stored.  For targets that return by popping an address of the
4501
+ * stack, this might be a memory address just below the target callf rame
4502
+ * rather than inside the current call frame.  If defined,
4503
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4504
+ * to calculate the location of the target call frame.
4505
+ *
4506
+ * If you want to support call frame exception handling, you must define either
4507
+ * this macro or the eh_return instruction pattern.
4508
+ */
4509
+// #warning "I don't know what to do here."
4510
+
4511
+/*
4512
+ *
4513
+ *
4514
+ *
4515
+ *   REST OF SECTION SKIPPED ...
4516
+ *
4517
+ *
4518
+ *
4519
+ */
4520
+
4521
+/* 17.09.03 Specifying how stack checking is done */
4522
+
4523
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4524
+ * configuration files in a machine-dependent manner.  You should define this
4525
+ * macro if stack checking is required by the ABI of your machine or if you
4526
+ * would like to do stack checking in some more efficient way than the generic
4527
+ * appraoch.  The default value of this macro is zero.
4528
+ *
4529
+ * ZipCPU --- The default makes sense for us.
4530
+ */
4531
+// #define STACK_CHECK_BUILTIN 0
4532
+
4533
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4534
+ * done by the configuration files in a machine-dependent manner.  You should
4535
+ * define this macro if you would like to do static stack checking in some more
4536
+ * efficient way than the generic approach.  The default value of this macro
4537
+ * is zero.
4538
+ *
4539
+ * ZipCPU --- The default makes sense for us.
4540
+ */
4541
+
4542
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4543
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4544
+ * interval.  You will normally define this macro so that the interval is no
4545
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4546
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4547
+ *
4548
+ * ZipCPU --- Default.
4549
+ */
4550
+
4551
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4552
+ * the stack pointer page by page when doing probes.  This can be necessary
4553
+ * on systems where the stack pointer contains the bottom address of the memory
4554
+ * area accessible to the executing thread at any point in time.  In this
4555
+ * situation, an alternate signal stack is required in order to be able to
4556
+ * recover from a stack overflow.  The default value of this macro is zero.
4557
+ *
4558
+ * ZipCPU -- Default.
4559
+ */
4560
+
4561
+/* STACK_CHECK_PROTECT
4562
+ */
4563
+/* STACK_CHECK_MAX_FRAME_SIZE
4564
+ * ... you should normally not change the default value of this macro.
4565
+ */
4566
+/* STACK_CHECK_FIXED_FRAME_SIZE
4567
+ * ... you ... will normally use the default of four words.
4568
+ */
4569
+
4570
+/* STACK_CHECK_MAX_VAR_SIZE
4571
+ * ... you will normally not need to override that default.
4572
+ */
4573
+
4574
+/* 17.09.04 Registers that Address the Stack Frame*/
4575
+
4576
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4577
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4578
+ * machines, the hardware determines which register this is.
4579
+ */
4580
+#undef STACK_POINTER_REGNUM
4581
+#define        STACK_POINTER_REGNUM    zip_SP
4582
+
4583
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4584
+ * which is used to access certain automatic variables in the stack frame.  On
4585
+ * some machines, the hardware determines which register this is.  On other
4586
+ * machines you can choose any register you wish for this purpose.
4587
+ *
4588
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4589
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4590
+ * this purpose and watch what the compiler does with it.
4591
+ */
4592 103 dgisselq
+#ifdef zip_FP_PSEUDO
4593
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4594
+#else
4595 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4596 103 dgisselq
+#endif
4597 102 dgisselq
+
4598
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4599
+ * pointer and starting offset of the automatic variables is not known until
4600
+ * after register allocation has been done (for example, because the saved
4601
+ * registers are between these two locations).  On those machines, define
4602
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4603
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4604
+ * to be the actual hard register number used for the frame pointer.
4605
+ *
4606
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4607
+ *
4608
+ * ZipCPU --- we do not define this macro.
4609
+ */
4610 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4611
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4612
+#endif
4613 102 dgisselq
+
4614
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4615
+ * is used to access the function's argument list.  On some machines, this is
4616
+ * the same as the frame pointer register.  On some machines, the hardware
4617
+ * determines which register this is.  On other machines, you can choose any
4618
+ * register you wish for this purpose.  If this is not the same register as the
4619
+ * frame pointer register, then you must mark it as a fixed register according
4620
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4621
+ *
4622
+ * ZipCPU --- We really don't want to lose another register to something
4623
+ * pointless, so let's set this to be the frame pointer register.  Especially
4624
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4625
+ * should work for a rather large stack frame.
4626
+ */
4627 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4628 102 dgisselq
+
4629
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4630
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4631
+ * should be the same.  The default definition is sufficient for us.
4632
+ */
4633
+
4634
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4635
+ * ZipCPU doesn't need this macro
4636
+ */
4637
+
4638
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4639
+ * pointer register, which is used to access the current function's return
4640
+ * address from the stack.  On some machines, the return address is not at a
4641
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4642
+ * This register can be defined to point to the return address on the stack, and
4643
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4644
+ * stack pointer.
4645
+ *
4646
+ * Do not define this macro unless there is no other way to get the return
4647
+ * address from the stack.
4648
+ *
4649
+ * ZipCPU---we need this.
4650
+ */
4651
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4652
+
4653
+
4654
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4655
+ * static chain pointer.  If register windows are used, the register number as
4656
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4657
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4658
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4659
+ * defined.
4660
+ *
4661
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4662
+ */
4663
+// #warning "I have no reason to believe this will even work"
4664
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4665
+
4666
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4667
+ * al for targets that may use different static chain locations for different
4668
+ * nested functions.  This may be required if the target has function attributes
4669
+ * that affect the calling conventions of the function and those calling
4670
+ * conventions use different static chain locations.
4671
+ *
4672
+ * ZipCPU --- don't need this.
4673
+ */
4674
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4675
+
4676
+
4677
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4678
+ * registers that can be saved in a call frame.  This is used to size data
4679
+ * structures used in DWARF2 exception handling.
4680
+ *
4681
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4682
+ * exception handling ABI in the face of adding new hard registers for ISA
4683
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4684
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4685
+ * reduce the runtime memory requirements of the exception handling routines,
4686
+ * which can be substantial if the ISA contains a lot of registers that are not
4687
+ * call-saved.
4688
+ *
4689
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4690
+ *
4691
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4692
+ * be saved and examined as well in any debug/exception context.  Hence, we
4693
+ * define this to be all of our registers.
4694
+ */
4695
+#undef DWARF_FRAME_REGISTERS
4696
+#define        DWARF_FRAME_REGISTERS   16
4697
+
4698
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4699
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4700
+ *
4701
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4702
+ * the ZipCPU.
4703
+ */
4704
+
4705
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4706
+ * representation for dwarf registers is different than the internal
4707
+ * representation for unwind column.  Given a dwarf register, this macro should
4708
+ * return the unwind column number to use instead.
4709
+ *
4710
+ * ... ???
4711
+ */
4712
+
4713
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4714
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4715
+ * different from that used in other debug info sections.  Given a GCC hard
4716
+ * register number, this macro should return the .eh_frame register number.
4717
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4718
+ *
4719
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4720
+ * should still work for us.
4721
+ */
4722
+
4723
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4724
+ * numbers held in the call frame info that GCC has collected using
4725
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4726
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4727
+ *
4728
+ * ZipCPU --- Default is good enough.
4729
+ */
4730
+
4731
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4732
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4733
+ * if target register size is larger than the size of void *.  The default
4734
+ * is to store register values as void *type.
4735
+ *
4736
+ * ZipCPU --- Default is what we need.
4737
+ */
4738
+
4739
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4740
+ * always uses extended unwind context with version, args_size, and by_value
4741
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4742
+ *
4743
+ */
4744
+
4745
+
4746
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4747
+
4748
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4749
+ * if a function must have and use a frame pointer.  This target hook is
4750
+ * called in the reload pass.  If its return value is true, the function will
4751
+ * have a frame pointer.
4752
+ *
4753
+ * This target hook can in principle examine the current function and decide
4754
+ * according to the facts, but on most machines the constant false or the
4755
+ * constant true suffices.  Use false when the machine allows code to be
4756
+ * generated with no frame pointer, and doing so saves some time or space.
4757
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4758
+ *
4759
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4760
+ * we'll treat this as a constant false--which is also the default value.
4761
+ */
4762
+#define        target_frame_pointer_required   zip_frame_pointer_required
4763
+
4764
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4765
+ * depth-var the difference between the frame pointer and the stack pointer
4766
+ * values immediately after the function prologue.  The value would be computed
4767
+ * from information such as the result of get_frame_size() and the tables of
4768
+ * registers regs_ever_live and call_used_regs.
4769
+ *
4770
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4771
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4772
+ * always returns true; in that case you may set depth-var to anything.
4773
+ *
4774
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4775
+ */
4776
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4777
+
4778
+
4779
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4780
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4781
+ * If it is not defined, the only elimination attempted by the compiler is to
4782
+ * replace references to the frame pointer with references to the stack pointer.
4783
+ *
4784
+ * On some machines, the position of the argument pointer is not known until
4785
+ * the compilation is completed.  In such a case, a separate hard register
4786
+ * must be used for the argument pointer.  This register can be eliminated by
4787
+ * replacing it with either the frame pointer or the argument pointer,
4788
+ * depending on whether or not the frame pointer has been eliminated.
4789
+ *
4790
+ * ZipCPU we'll take their suggestion and define this as:
4791
+ */
4792
+#undef ELIMINABLE_REGS
4793 103 dgisselq
+#ifdef zip_FP_PSEUDO
4794 102 dgisselq
+#define        ELIMINABLE_REGS \
4795 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4796
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4797
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4798
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4799
+#else
4800
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4801
+#  define      ELIMINABLE_REGS \
4802
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4803
+# else
4804
+#  define      ELIMINABLE_REGS \
4805 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4806
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4807
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4808 103 dgisselq
+# endif
4809
+#endif
4810 102 dgisselq
+
4811
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4812
+ * true if the compiler is allowed to try to replace register number FROM with
4813
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4814
+ * is defined, and will usually return true since most of the cases preventing
4815
+ * register elimination are things that the compiler  already knows about.
4816
+ *
4817
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4818 117 dgisselq
+ * the frame pointer was needed?  Yes it does, but it's kept separately.  We'll
4819
+ * just say everything can be eliminated.
4820 102 dgisselq
+ */
4821
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4822
+
4823
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4824
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4825
+ * the specified pair of registers.  This macro must be defined if
4826
+ * ELIMINABLE_REGS is defined.
4827
+ *
4828 117 dgisselq
+ * ZipCPU---We had at one time set this to a default offset of 0.  This didn't
4829
+ * work.  It turns out that this is not only the *initial* elimination offset,
4830
+ * but also the offset along the way.  Hence, when a variable needs to be
4831
+ * spilled to the stack, this offset must change.  Reload goes and checks for
4832
+ * this, and adjusts registers if the offset has changed.  Hence, without this,
4833
+ * we get negative (i.e. illegal) stack offsets.
4834 102 dgisselq
+ */
4835
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4836
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4837
+       while(0)                                        \
4838
+
4839
+/* 17.09.06 Passing function arguments on the stack */
4840
+
4841
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4842
+ * prototype as an integral type smaller than int should actually be
4843
+ * passed as an int.  In addition to avoiding errors in certain cases of
4844
+ * mismatch, it also makes for better code on certain machines.  The default is
4845
+ * to not promote prototypes.
4846
+ *
4847
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4848
+ * (which should still be an int) up to an int anyway.
4849
+ */
4850
+#undef TARGET_PROMOTE_PROTOTYPES
4851
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4852
+
4853
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4854
+ * pass outgoing arguments.  If the target machine does not have a push
4855
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4856
+ * to allocate the entire argument block and then store the arguments into it.
4857
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4858
+ *
4859
+ * ZipCPU does not have a push instruction, so we set this to zero.
4860
+ */
4861
+#undef PUSH_ARGS
4862
+#define        PUSH_ARGS       0
4863
+
4864
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4865
+ * be evaluated last to first, rather than first to last.  If this macro is
4866
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4867
+ * grow in opposite directions, and zero otherwise.
4868
+ *
4869
+ * ZipCPU---Let's evaluate our arguments first to last.
4870
+ */
4871
+#define        PUSH_ARGS_REVERSED      1
4872
+
4873
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4874
+ * actually pushed onto the stack when an instruction attempts to push
4875
+ * (NPUSHED) bytes.
4876
+ *
4877
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4878
+ * happens.
4879
+ */
4880
+// #warning "No appropriate definition seemed right."
4881
+
4882
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4883
+ * of space required for outgoing arguments will be computed and placed into
4884
+ * 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
4885
+ * amount.
4886
+ *
4887
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4888
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4889
+ * for good performance.  I mean, think of it, free performance increase?  Who
4890
+ * could argue with that?
4891
+ */
4892
+#undef ACCUMULATE_OUTGOING_ARGS
4893
+#define        ACCUMULATE_OUTGOING_ARGS        1
4894
+
4895
+
4896
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4897
+ * that stack space has been allocated for arguments even when their values
4898
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4899
+ * the area reserved for arguments passed in registers for the function
4900
+ * represented by FN, which can be zero if GCC is calling a library function.
4901
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4902
+ *
4903
+ * This space can be allocated by the caller, or be part of the machine
4904
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4905
+ *
4906
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4907
+ * therefore.
4908
+ */
4909
+// #undef      REG_PARM_STACK_SPACE
4910
+
4911
+
4912
+
4913
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4914
+ * incoming register arguments.  Define this macro if space guaranteed when
4915
+ * compiling a function body is different to space required when making a call,
4916
+ * a situation that can arise with K&R style function definitions.
4917
+ *
4918
+ */
4919
+
4920
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4921
+ * is the responsibility of the caller to allocate the area reserved for
4922
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4923
+ * if the function called is a library function.
4924
+ *
4925
+ * ZipCPU---Why allocate space you don't need?
4926
+ */
4927
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4928
+
4929
+
4930
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4931
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4932
+ *
4933
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4934
+ */
4935
+
4936
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4937
+ * number of bytes of its own arguments that a function pops on returning, or 0
4938
+ * if the function pops no arguments and the caller must therefore pop them all
4939
+ * after the function returns.
4940
+ *
4941
+ * ZipCPU --- If we define this, we'll lose our gain from
4942
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4943
+ */
4944
+
4945
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4946
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4947
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4948
+ * which all arguments to the function have been accumulated.
4949
+ *
4950
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4951
+ * this is zero.
4952
+ */
4953
+#undef CALL_POPS_ARGS
4954
+#define        CALL_POPS_ARGS(CUM)     0
4955
+
4956
+
4957
+/* 17.09.07 Passing arguments in registers */
4958
+
4959
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4960
+ * is passed in a register, and if so, which register.
4961
+ */
4962
+/*
4963
+ * This has been poisoned ... so let's not define it anymore and look for
4964
+ * a better way to do this ...
4965
+ *
4966
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4967
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4968
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4969
+ *     : gen_rtx_REG(MODE, CUM))
4970
+ */
4971
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4972
+
4973
+
4974
+/* TARGET_MUST_PASS_IN_STACK ...
4975
+ */
4976
+// #undef      TARGET_MUST_PASS_IN_STACK
4977
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4978
+
4979
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4980
+ * has register windows, ... which ZipCPU does not have.
4981
+ */
4982
+
4983
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4984
+ * pseudo register should be created for pic_offset_table_rtx during function
4985
+ * expand.
4986
+ *
4987
+ * This should be defined by global parameters, isn't it?
4988
+ */
4989
+
4990
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4991
+ * pic_offset_table_rtx.  This hook is called at the start of register
4992
+ * allocation.
4993
+ *
4994
+ * ZipCPU---Let's revisit this.
4995
+ */
4996
+// #warning "Come back and relook at relocations"
4997
+
4998
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
4999
+ * at the beginning of an argument that must be put in registers.  The value
5000
+ * must be zero for arguments that are passed entirely in registers or that
5001
+ * are entirely pushed on the stack.
5002
+ */
5003
+// #undef      TARGET_ARG_PARTIAL_BYTES
5004
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
5005
+
5006
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
5007
+ * return true if an argument at the position indicated by CUM should be passed
5008
+ * by reference.  This predicate is queried after target independent reasons
5009
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
5010
+ *
5011
+ */
5012
+// #undef      TARGET_PASS_BY_REFERENCE
5013
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
5014
+
5015
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
5016
+ * first argument of 'FUNCTION_ARG' and other related values.
5017
+ *
5018
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
5019
+ */
5020
+#define        CUMULATIVE_ARGS int
5021
+
5022
+/*
5023
+ * OVERRIDE_ABI_FORMAT
5024
+ */
5025
+
5026
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
5027
+ * variable CUM for the state at the beginning of the argument list.
5028
+ *
5029
+ *
5030
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
5031
+ * R1 (unless it has been redefined above ...)
5032
+ */
5033
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
5034
+
5035
+/* INIT_CUMULATIVE_LIBCALL_ARGS
5036
+ * INIT_CUMULATIVE_INCOMING_ARGS
5037
+ *
5038
+ * These default to the last INIT_CUM_ARGS value above.
5039
+ */
5040
+
5041
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
5042
+ * the summarizer variable pointed to by CUM to advance past an argument in
5043
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
5044
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
5045
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
5046
+ * anything if the argument in question was passed on the stack.  The compiler
5047
+ * knows how to track the amount of stack space used for arguments without
5048
+ * any special help.
5049
+ *
5050
+ * ZipCPU---Here we simply copy from ECO32.
5051
+ */
5052
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
5053
+
5054
+/*
5055
+ * TARGET_ARG_OFFSET --- not necessary
5056
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
5057
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
5058
+ * BLOCK_REG_PADDING
5059
+ * TARGET_FUNCTION_ARG_BOUNDARY
5060
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
5061
+ */
5062
+
5063
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
5064
+ * the number of a hard register in which function arguments are sometimes
5065
+ * passed.  This does not include implicit arguments such as the static chain
5066
+ * and the structure-value address.  On many machines, no registers can be used
5067
+ * for this purpose since all function arguments are pushed on the stack.
5068
+ */
5069
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
5070
+
5071
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
5072
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
5073
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
5074
+ * require complex arguments to be split and treated as their individual
5075
+ * components.
5076
+ *
5077
+ * The default value of this hook is NULL, which is treated as always false,
5078
+ * and which should be good enough for ZipCPU--which can go either way.
5079
+ */
5080
+
5081
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
5082
+ * for the target.  The default version of the hook returns void*.
5083
+ *
5084
+ */
5085
+
5086
+/* TARGET_ENUM_VA_LIST_P
5087
+ */
5088
+
5089
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
5090
+ * convention specified by FN.  The default version of this returns va_list_type_node.
5091
+ */
5092
+
5093
+/* TARGET_FN_ABI_VA_LIST
5094
+ */
5095
+
5096
+/* TARGET_CANONICAL_VA_LIST_TYPE
5097
+ */
5098
+
5099
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
5100
+ */
5101
+
5102
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
5103
+ * port can handle pointers with machine mode MODE.  The default version of this
5104
+ * hook returns true for both ptr_mode and Pmode.
5105
+ *
5106
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
5107
+ * default behavior is quite appropriate.
5108
+ */
5109
+
5110
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
5111
+ * memory reference REF may alias with the system C library errno location.
5112
+ * The default version of this hook assumes the system C library errno location
5113
+ * is either a declaration of type int or accessed by dereferencing a pointer
5114
+ * to int.
5115
+ *
5116
+ * ZipCPU --- Default sounds good to me.
5117
+ */
5118
+
5119
+
5120
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
5121
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
5122
+ * a scalar mode to be considered supported, all the basic arithmetic and
5123
+ * comparisons must work.
5124
+ *
5125
+ * The default version of this hook returns true for any mode required to
5126
+ * handle the basic C types (as defined by the port).  Included here are the
5127
+ * double-word arithmetic supported by the code in optabs.c.
5128
+ */
5129
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
5130
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
5131
+
5132
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
5133
+ * port is prepared to handle instructions involving vector mode MODE.  At the
5134
+ * very least, it must have move patterns for this mode.
5135
+ *
5136
+ * ZipCPU---does not support any vector modes.
5137
+ */
5138
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
5139
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
5140
+
5141
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
5142
+ * try to use a scalar mode to store an array of NELEMS elements, given that
5143
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
5144
+ *
5145
+ * ZipCPU---Sounds good.
5146
+ */
5147
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
5148
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
5149
+
5150
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
5151
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
5152
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
5153
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
5154
+ * modes exist.
5155
+ *
5156
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
5157
+ * (if we can).  Let's allow both of those and see how far we get.
5158
+ */
5159
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
5160
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
5161
+
5162
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
5163
+ * nonzero for machine modes for which the port has small register classes.  If
5164
+ * target hook returns nonzero for a given MODE, the compiler will try to
5165
+ * minimize the lifetime of registers in MODE.  The hook may be called with
5166
+ * VOIDmode as an argument.  In this case, the hook is expected to return
5167
+ * nonzero if it returns nonzero for any mode.
5168
+ *
5169
+ * The default version of this hook returns false for any mode.
5170
+ *
5171
+ * ZipCPU---Default sounds good.
5172
+ */
5173
+
5174
+/* 17.09.08 How scalar function values are returned */
5175
+
5176
+/* TARGET_FUNCTION_VALUE
5177
+ */
5178
+
5179
+/* LIBCALL_VALUE
5180
+ */
5181
+
5182
+
5183
+/* 17.09.09 How large values are returned */
5184
+
5185
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
5186
+ * nonzero value to say to return the function value in memory, just as large
5187
+ * structures are always returned.  Here type will be the data type of the value
5188
+ * and FNTYP will be the type of the function doing the returning, or NULL
5189
+ * for libcalls.
5190
+ *
5191
+ */
5192
+#undef TARGET_RETURN_IN_MEMORY
5193
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
5194
+
5195
+/* DEFAULT_PCC_STRUCT_RETURN
5196
+ * TARGET_STRUCT_VALUE_RTX
5197
+ * PCC_STATIC_STRUCT_RETURN
5198
+ * TARGET_GET_RAW_RESULT_MODE
5199
+ * TARGET_GET_RAW_ARG_MODE
5200
+ */
5201
+
5202
+
5203
+/* 17.09.10 Caller-Saves Register Allocation */
5204
+/* 17.09.11 Function Entry and Exit */
5205 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
5206
+// TARGET_ASM_FUNCTION_END_PROLOGUE
5207
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
5208
+// TARGET_ASM_FUNCTION_EPILOGUE
5209
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
5210
+ * if the return instruction or the function epilogue ignores the value of the
5211
+ * stack pointer; in other words, if it is safe to delete an instruction to
5212
+ * adjust the stack pointer before a return from the function.
5213
+ *
5214
+ * The default is 0.
5215
+ *
5216
+ * Note that this macro's value is relevant only for functions for which frame
5217
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
5218
+ * in a function that has no frame pointer, and the compiler knows this
5219
+ * regardless of EXIT_IGNORE_STACK.
5220
+ *
5221
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
5222
+ * our options otherwise could have been, our epilogue code does not use the
5223
+ * stack register at all, but rather starts by moving the frame register into
5224
+ * the stack register.
5225
+ */
5226
+#define EXIT_IGNORE_STACK      1
5227
+// EPILOGUE_USES(regno)
5228
+// EH_USES(regno)
5229
+// TARGET_ASM_OUTPUT_MI_THUNK
5230
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
5231
+
5232 102 dgisselq
+/* 17.09.12 Generating code for profiling */
5233 111 dgisselq
+// FUNCTION_PROFILER
5234
+// PROFILE_HOOK
5235
+// NO_PROFILE_COUNTERS
5236
+// PROFILE_BEFORE_PROLOGUE
5237
+// TARGET_KEEP_LEAF_WHEN_PROFILED
5238
+
5239 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
5240 111 dgisselq
+
5241
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5242
+ * call optimizations for the specified call expression EXP.  DECL will be the
5243
+ * called function, or NULL if this is an indirect call.
5244
+ *
5245
+ * It is not uncommon for limitations of calling conventions to prevent tail
5246
+ * calls to functions outside the current unit of translation, or during PIC
5247
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5248
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5249
+ * successful sibling call optimization may vary greatly between different
5250
+ * architectures.
5251
+ *
5252
+ * ?? What's a sibling call?
5253
+ */
5254
+
5255
+// TARGET_EXTRA_LIVE_ON_ENTRY
5256
+// TARGET_SET_UP_BY_PROLOGUE
5257
+// TARGET_WARN_FUNC_RETURN
5258
+
5259 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5260 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5261
+// TARGET_STACK_PROTECT_FAIL
5262
+// TARGET_SUPPORTS_SPLIT_STACK
5263
+
5264 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5265
+
5266 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5267
+
5268 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5269
+ * ZipCPU --- default is good enough for us.
5270
+ */
5271
+
5272
+/* 17.10 Implementing VARARGS MACROS */
5273
+
5274
+/* ...
5275
+ */
5276
+
5277
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5278
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5279
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5280
+ * stack so that all the arguments appear to have been passed consecutively
5281
+ * on the stack.  Once this is done, you can use the standard implementation
5282
+ * of varargs that works for machines that pass all their arguments on the
5283
+ * stack.
5284
+ */
5285
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5286
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5287
+
5288
+/* ...
5289
+ */
5290
+
5291
+/* 17.11 Trampolines for Nested Functions */
5292
+
5293
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5294
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5295
+ * a block of data that contains the constant parts of a trampoline.  This code
5296
+ * should not include a label--the label is taken care of automatically.
5297
+ *
5298
+ * ZipCPU -- looks like we need to do this.
5299
+ */
5300
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5301
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5302
+
5303
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5304
+ * is to be placed.  The default value is readonly_data_section.
5305
+ *
5306
+ * ZipCPU--default should be good enough.
5307
+ */
5308
+
5309
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5310
+ * as an integer.
5311
+ *
5312
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5313
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5314
+ * of bytes, but we may need to change this later.
5315
+ *
5316
+ */
5317
+// #warning "May need to redefine trampoline_size in words, not bytes"
5318
+#undef TRAMPOLINE_SIZE
5319
+#define        TRAMPOLINE_SIZE 3
5320
+
5321
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5322
+ *
5323
+ * Well that's well known in ZipCPU --- 32-bits.
5324
+ */
5325
+#undef TRAMPOLINE_ALIGNMENT
5326
+#define        TRAMPOLINE_ALIGNMENT    32
5327
+
5328
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5329
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5330
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5331
+ * rtx for the static chain value that should be passed to the function when
5332
+ * it is called.
5333
+ *
5334
+ * ZipCPU ... Can we get by without this?
5335
+ */
5336
+#undef TARGET_TRAMPOLINE_INIT
5337
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5338
+
5339
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5340
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5341
+ * contains the address of the memory block that was passed to
5342
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5343
+ * should be different from the address at which the template was stored, the
5344
+ * different address should be returned; otherwise addr should be returned
5345
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5346
+ * calls.
5347
+ *
5348
+ * ZipCPU--works for us!
5349
+ */
5350
+
5351
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5352
+ * the instruction cache in the specified interval.  The definition of this
5353
+ * macro would typically be a series of asm statements.   Both BEG and END are
5354
+ * pointer expressions.
5355
+ *
5356
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5357
+ */
5358
+
5359
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5360 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5361 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5362
+ * named __transfer_from_trampoline.
5363
+ *
5364
+ * We may need to rethink trampolines on ZipCPU.
5365
+ */
5366
+
5367
+
5368
+/* 17.12 Implicit Calls to Library Routines */
5369
+
5370
+/* DECLARE_LIBRARY_RENAMES
5371
+ *
5372
+ * ZipCPU: Don't need it.
5373
+ */
5374
+
5375
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5376
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5377
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5378
+ * initializing all the normal library routines.
5379
+ *
5380
+ * Most ports don't need to define this hook, so we won't either.
5381
+ */
5382
+
5383
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5384
+ * routines start with two underscores.  If set to true, these routines start
5385
+ * with __gnu_ instead.
5386
+ *
5387
+ * ZipCPU: No change necessary.
5388
+ */
5389
+
5390
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5391
+ * true if the library routine that implements the floating point comparison
5392
+ * operator comparison in mode mode will return a boolean and false if it will
5393
+ * return a tristate.
5394
+ *
5395
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5396
+ */
5397
+
5398
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5399
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5400
+ * algorithm which makes use of simple logical and arithmetic operations for
5401
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5402
+ * which makes use of a 64-bit by 32-bit divide primitive.
5403
+ *
5404
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5405
+ * we have no HW DIVIDE (for now).
5406
+ */
5407
+#define        TARGET_HAS_NO_HW_DIVIDE
5408
+
5409
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5410
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5411
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5412
+ * the value of EDOM on your system.
5413
+ *
5414
+ * EDOM is the error created when a math argument is out of the domain of the
5415
+ * function.
5416
+ *
5417
+ * ZipCPU: Don't need it---I don't think.
5418
+ */
5419
+
5420
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5421
+ * expression that refers to the global "variable" errno.  (On certain
5422
+ * systems, errno may not actually be a variable.)  If you don't define this
5423
+ * macro, a reasonable default is used.
5424
+ *
5425
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5426
+ * I doubt we'll be using errno for a while.
5427
+ */
5428
+
5429
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5430
+ * message sending conventions by default.  This calling convention involves
5431
+ * passing the object, the selector and the method arguments all at once to the
5432
+ * method-lookup library function.  This is the usual setting when targetting
5433
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5434
+ *
5435
+ * If the macro is set to 0, ...
5436
+ *
5437
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5438
+ * an O/S yet.
5439
+ */
5440
+
5441
+
5442
+
5443
+/* 17.13 Addressing Modes */
5444
+
5445
+/* C expressions that are nonzero if the machine supports pre-increment,
5446
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5447
+ */
5448
+#define        HAVE_PRE_INCREMENT      (0)
5449
+#define        HAVE_PRE_DECREMENT      (0)
5450
+#define        HAVE_POST_INCREMENT     (0)
5451
+#define        HAVE_POST_DECREMENT     (0)
5452
+
5453
+/* C expression that is nonzero if the machine supports pre- or post- address
5454
+ * side-effect generation involving constants other than the size of the memory
5455
+ * operand.
5456
+ */
5457
+#define        HAVE_PRE_MODIFY_DISP    (0)
5458
+#define        HAVE_POST_MODIFY_DISP   (0)
5459
+
5460
+/* C expression that is non-zero if the machine supports pre- or post-address
5461
+ * side-effect generation involving a register displacement.
5462
+ */
5463
+#define        HAVE_PRE_MODIFY_REG     (0)
5464
+#define        HAVE_POST_MODIFY_REG    (0)
5465
+
5466
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5467
+ * which is a valid address.  On most machines the default definition ... is
5468
+ * acceptable, but a few machines are more restrictive as to which constant
5469
+ * addresses are supported.
5470
+ *
5471
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5472
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5473
+ * general programming model do not.  Further, without knowing where the final
5474
+ * address will be located, this is an unusable model.  Therefore we will
5475
+ * define this as not supported.
5476
+ *
5477
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5478
+ * they are also constant addresses.  Hence, we leave this at its default.
5479
+ */
5480
+// #undef      CONSTANT_ADDRESS_P
5481
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5482
+
5483 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5484
+ * accepts integer values expressions whose values are not explicitly known,
5485
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5486
+ * expressions, in addition to const_int and const_double expressions.
5487 102 dgisselq
+ *
5488
+ * Huh???
5489
+ */
5490
+// #define CONSTANT_P(X) ???
5491
+
5492 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5493
+ * appear in a valid memory address.  Note that it is up to you to specify a
5494
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5495
+ * ever accept.
5496 102 dgisselq
+ */
5497
+#define        MAX_REGS_PER_ADDRESS    1
5498
+
5499
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5500
+ * whether RTX is a legitimate memory address on the target machine for a
5501
+ * memory operation of mode MODE.
5502
+ */
5503
+#undef TARGET_LEGITIMATE_ADDRESS_P
5504
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5505
+
5506
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5507
+ * default 'm' character for general memory addresses.  This defines the
5508
+ * constraint letter which matches the memory addresses accepted by
5509
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5510
+ * address format in your back end without changing the semantics of the 'm'
5511
+ * constraint.  This is necessary in order to preserve functionality of inline
5512
+ * assembly constructs using the 'm' constraint.
5513
+ *
5514
+ * ZipCPU--doesn't look like we need to define this at all.
5515
+ */
5516
+
5517
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5518
+ * X or to provide a simplified version of X from which alias.c can easily find
5519
+ * the base term.  This macro is used in only two places: find_base_value and
5520
+ * find_base_term in alias.c.
5521
+ *
5522
+ * It is always safe for this macro  to not be defined.  It exists so that
5523
+ * alias analysis can understand machine-dependent addresses.
5524
+ *
5525
+ * ZipCPU: We'll skip this then.
5526
+ */
5527
+
5528
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5529
+ * memory address RTX for an operand of mode MODE and should try to return a
5530
+ * valid memory address.  RTX will always be the result of a call to
5531
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5532
+ * function to produce RTX.
5533
+ *
5534 111 dgisselq
+ * ZipCPU --
5535 102 dgisselq
+ */
5536 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5537
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5538 102 dgisselq
+
5539
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5540
+ * that attempts to replace X, which is an address that needs reloading, with
5541
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5542
+ * statement label elsewhere in the code.  It is not necessary to define this
5543
+ * macro, but it might be useful for performance reasons.
5544
+ *
5545
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5546
+ * may also be a difficult macro to use.  Look at other implementations before
5547
+ * we dive into this.
5548
+ */
5549
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5550
+// #define LEGITIMIZE_RELOAD_ADDRESS
5551
+
5552
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5553
+ * if memory address addr in address space addrspace can have different meanings
5554
+ * depending on the machine mode of the memory reference it is used for or if
5555
+ * the address is valid for some modes but not others.
5556
+ */
5557
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5558
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5559
+
5560 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5561
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5562
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5563
+ *
5564
+ * The default definition returns true.
5565 102 dgisselq
+ */
5566
+
5567
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5568
+ */
5569
+
5570
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5571
+ * should not be emitted into debug sections.
5572
+ */
5573
+
5574
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5575
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5576
+ * MODE is the mode of X.  The default version returns false.
5577
+ */
5578 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5579 102 dgisselq
+
5580
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5581
+ * if pool entries for constant RTX can be placed in an object_block structure.
5582
+ * MODE is the mode of X.  The default version returns false for all constants.
5583
+ *
5584
+ *????
5585
+ */
5586
+// #warning "Huh?"
5587
+
5588
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5589
+ * entries for DECL should be placed in an object_block structure.  The default
5590
+ * version returns true for all DECL's.
5591
+ *
5592
+ * Sounds good.
5593
+ */
5594
+
5595
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5596
+ * function that implements the reciprocal of the machine specific builtin
5597
+ * function fndecl, or NULL_TREE if such a function is not available.
5598
+ */
5599
+
5600
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5601
+ * DECL of a function f that given an address addr as an argument returns a mask
5602
+ * m that can be used to extrract from two vectors the relevant data that
5603
+ * resides in addr in case addr is not properly aligned.
5604
+ *
5605
+ * Zip CPU does not support vectorization.
5606
+ */
5607
+
5608
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5609
+ * such data accesses and manipulation.
5610
+ */
5611
+
5612
+/* 17.14 Anchored Addresses */
5613
+
5614
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5615
+ * a section anchor.  On most targets, it should be the smallest offset that
5616
+ * can be applied to a base register while still giving a legitimate address for
5617
+ * every mode.  The default value is 0.
5618
+ *
5619
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5620
+ * operation, which would be a signed 14 bit number.
5621
+ */
5622
+#undef TARGET_MIN_ANCHOR_OFFSET
5623
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5624
+
5625
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5626
+ * (inclusive) offset that should be applied to section anchors.  The default
5627
+ * value is 0.
5628
+ */
5629
+#undef TARGET_MAX_ANCHOR_OFFSET
5630
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5631
+
5632
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5633
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5634
+ * true.  The hook is called with the assembly output position set to the
5635
+ * beginning of SYMBOL_REF_BLOCK(X).
5636
+ *
5637
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5638
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5639
+ * is not available, the hook's default definition is NULL, which disables the
5640
+ * use of section anchors altogether.
5641
+ *
5642
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5643
+ * must define this hook.
5644
+ */
5645
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5646
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5647
+
5648
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5649
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5650
+ *
5651
+ * 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.
5652
+ *
5653
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5654
+ */
5655
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5656
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5657
+
5658
+/* 17.15 Condition Code Status */
5659
+
5660
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5661
+
5662
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5663
+ * the mdep component of cc_status.  It defaults to int.
5664
+ *
5665
+ * ZipCPU---Int is good for us.
5666
+ */
5667
+
5668
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5669
+ * "empty".  The default definition does nothing, since most machines don't
5670
+ * use the field anyway.  If you want to use the field, you should probably
5671
+ * define  this macro to initialize it.
5672
+ */
5673
+
5674
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5675
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5676
+ * macro's responsibility to recognize insns that set the condition code as
5677
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5678
+ *
5679
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5680
+ *
5681
+ */
5682
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5683
+
5684
+
5685
+/* 17.15.2 Representation of condition codes using registers */
5686
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5687
+ * this section isn't supposed to apply.
5688
+ */
5689
+
5690
+/* SELECT_CC_MODE(op, x, y)
5691
+ */
5692
+
5693
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5694
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5695
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5696
+ * does not have a GT comparison, but you can use an LT comparison instead and
5697
+ * swap the order of the operands.
5698
+ *
5699
+ * On such machines, implement this hook to do any required conversions:  code
5700
+ * is the initial comparison code and op0 and op1 are the left and right
5701
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5702
+ * implementation is not allowed to change the value of op0 since the value
5703
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5704
+ * not allowed to swap operands in that case.
5705
+ *
5706
+ * GCC will not assume that the comparison resulting from this macro is valid
5707
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5708
+ *
5709
+ * You need not implement this hook if it would never change the comparison
5710
+ * code or operands.
5711
+ *
5712
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5713
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5714
+ * painful.  Therefore, we *need* this capability to make certain we can use
5715
+ * our comparisons successfully.
5716
+ *
5717
+ * The only problem is ... this hook appears to only be called on non-CC0
5718
+ * machines.  Hence, defining it hasn't done anything for us.
5719
+ */
5720
+// #define     TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5721
+
5722
+/* 17.16 Relative costs of operations */
5723
+
5724
+
5725
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5726
+// #define     TARGET_REGISTER_MOVE_COST
5727
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5728
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5729
+ * cost of moving data of mode M from a register in class FRM to one in class
5730
+ * TO.  The classes are expressed using the enumeration values such as
5731
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5732
+ * relative to that.
5733
+ *
5734
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5735
+ * on some machines it is expensive to move between registers if they are not
5736
+ * general registers.
5737
+ *
5738
+ * If reload sees ...
5739
+ *
5740
+ * ZipCPU ... We can leave this at its default value of 2.
5741
+ */
5742
+
5743
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5744
+ * cost of moving data of mode MOD between a register of class CL and memory.
5745
+ * IN is false if the value is to be written to memory, true if it is to be
5746
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5747
+ * If moving between registers and memory is more expensive that between two
5748
+ * registers, you should add this target hook to express the relative cost.
5749
+ *
5750
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5751
+ * cost of copying via a secondary reload register, if one is needed.  If your
5752
+ * machine requires a secondary reload register to copy between memory and a
5753
+ * register of CL but the reload mechanism is more complex than copying via
5754
+ * an intermediate, use this target hook to reflect the actual cost of the
5755
+ * move.
5756
+ *
5757
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5758
+ * moves, so let's make certain this is defined.
5759
+ */
5760
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5761
+
5762
+// #warning "This needs to be double checked, and annotated"
5763 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5764 102 dgisselq
+
5765
+/* Define this macro as a C expression which is nonzero if accessing less than
5766
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5767
+ * a word of memory.
5768
+ */
5769
+#define        SLOW_BYTE_ACCESS        1
5770
+
5771
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5772
+ * instructions, below which a sequence of instructions should be generated
5773
+ * instead of a string move instruction or a library call.  Increasing the
5774
+ * value will always make code faster, but eventually incurs high cost in
5775
+ * increased code size.
5776
+ */
5777
+#define        MOVE_RATIO(SPD) 5
5778
+
5779
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5780
+ */
5781
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5782
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5783
+
5784
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5785
+ * which a sequence of instructions should be generated to clear memory instead
5786
+ * of a string clear instruction or a library call.  Increasing the value will
5787
+ * always make the code faster, but eventually incurs high cost in increased
5788
+ * code size.
5789
+ */
5790
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5791
+
5792
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5793
+ * to call a constant function address than to call an address kept in a
5794
+ * register.
5795
+ *
5796
+ * On the Zip CPU, constant function addresses--especially relative ones,
5797
+ * can be optimized into a single cycle delay.  Register jumps will always
5798
+ * stall the whole (5-stage) pipeline.
5799
+ */
5800
+#define        NO_FUNCTION_CSE
5801
+
5802 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5803
+ * the relative costs of RTL expressions.
5804
+ *
5805
+ * The cost may depend on the precise form of the expression, which is avaialble
5806
+ * for examination in X, and the fact that X appears as operand OPNO of an
5807
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5808
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5809
+ * == X or (b) XVEC(Y,OPNO) contains X.
5810
+ *
5811
+ * ...
5812
+ * The hook returns true when all subexpressions of x have been processed and
5813
+ * false when rtx_cost should recurse.
5814 102 dgisselq
+ */
5815 111 dgisselq
+
5816 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5817
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5818
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5819
+ * than one form of an address is known, the form with the lowest cost will be
5820
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5821
+ * most complex will be used.
5822
+ *
5823
+ * ZipCPU really has only one address cost, the only type of address it
5824
+ * supports.  Sure, index addressing would cost us more, but we don't support
5825
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5826
+ * docs state that, "On RISC amchines, all instructions normally have the same
5827
+ * length and execution time.  Hence all addresses will have equal costs."
5828
+ */
5829
+#undef TARGET_ADDRESS_COST
5830
+#define        TARGET_ADDRESS_COST     zip_address_cost
5831
+
5832
+
5833
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5834
+ * of the eager delay slot filler to disallow speculatively executed
5835
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5836
+ * architectures posess both branches with and without delay slots.  As the
5837
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5838
+ * when ordinary branches are available.  Use of delay slot branches filled
5839
+ * using basic filler is often still desirable as the delay slot can hide a
5840
+ * pipeline bubble.
5841
+ */
5842
+// How should Zip CPU define this--we have no delay slots.
5843
+
5844
+
5845
+/* 17.17 Instruction Scheduler */
5846
+
5847
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5848
+
5849
+/* 17.18 Dividing the Output into Sections */
5850
+
5851
+/* Switch to the text or data segment. */
5852
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5853
+#define        DATA_SECTION_ASM_OP     "\t.data"
5854
+
5855
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5856
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5857
+
5858
+
5859
+/* 17.19 Position Independent Code */
5860
+
5861
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5862
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5863
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5864
+
5865
+/* 17.20 Defining the Output Assembler Language */
5866
+
5867
+/* 17.20.4 Output and Generation of Labels */
5868
+
5869
+/* ASM_OUTPUT_LABEL
5870
+ * ... A default definition of this macro is provided which is correct for
5871
+ * most systems.
5872
+ */
5873
+
5874
+/* ASM_OUTPUT_FUNCTION_LABEL
5875
+ * ... if not defined, then the function name is defined in the usual manner
5876
+ * as a label.
5877
+ */
5878
+
5879
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5880
+ * is known to refer to a compiler-generated label.  The default definition
5881
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5882
+ * efficient.
5883
+ */
5884
+
5885
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5886
+ * to specify the size of a symbol, without any arguments.  ON systems that
5887
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5888
+ * define this macro.
5889
+ *
5890
+ * Define this amcro only if it is correct to use the default definitions of
5891
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5892
+ * If you need your own custom definitions of those macros, or if you do not
5893
+ * need explicit symbol sizes at all, do not define this macro.
5894
+ */
5895
+
5896
+/* ASM_OUTPUT_SIZE_DIRECTIVE
5897
+ * ASM_OUTPUT_MEASURED_SIZE
5898
+ */
5899
+
5900
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
5901
+ * the character '$' in label names.  By default constructors and destructors
5902
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
5903
+ * used instead.
5904
+ */
5905
+
5906
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
5907
+ * character '.' in label names.  By default constructors and destructors in
5908
+ * G++ have names that use '.'.  If this macro is defined, these names are
5909
+ * rewritten to avoid '.'.
5910
+ */
5911
+
5912
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
5913
+ * specify the type of a symbol, without any arguments.  On systems that use
5914
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
5915
+ *
5916
+ * Define this macro only if it is correct to use the default definition of
5917
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
5918
+ * definition of this macr, or if you do not need explicit symbol types at all,
5919
+ * do not define this macro.
5920
+ */
5921
+
5922
+/* TYPE OPERAND_FMD ... A
5923
+ */
5924
+
5925
+/* ASM_OUTPUT_TYPE_DIRECTIVE
5926
+ */
5927
+
5928
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
5929
+ * if this macro is not defined, then the function name is defined in the usual
5930
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
5931
+ */
5932
+
5933
+/* ASM_DECLARE_FUNCTION_SIZE
5934
+ * ASM_DECLARE_COLD_FUNCTION_NAME
5935
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
5936
+ * ASM_DECLARE_OBJECT_NAME
5937
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
5938
+ */
5939
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
5940
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
5941
+ * claiming a register REGNO for a global variable DECL with name NAME.
5942
+ *
5943
+ * If you don't defin this macro, that is equivalent to dfining it to do
5944
+ * nothing.
5945
+ */
5946
+
5947
+/* ASM_FINISH_DECLARE_OBJECT
5948
+ * TARGET_ASM_GLOBALIZE_LABEL
5949
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
5950
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
5951
+ * ASM_WEAKEN_LABEL
5952
+ * ASM_WEAKEN_DECL
5953
+ * ASM_OUTPUT_WEAKREF
5954
+ * SUPPORTS_WEAK
5955
+ * TARGET_SUPPORTS_WEAK
5956
+ * MAKE_DECL_ONE_ONLY
5957
+ * SUPPORTS_ONE_ONLY
5958
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
5959
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
5960
+ * ASM_OUTPUT_EXTERNAL
5961
+ * TARGET_ASM_EXTERNAL_LIBCALL
5962
+ * TARGET_ASM_MARK_DECLPRESERVED
5963
+ * ASM_OUTPUT_LABELREF
5964
+ * TARGET_MANGLE_ASSEMBLER_NAME
5965
+ * ASM_OUTPUT_SYMBOL_REF
5966
+ * ASM_OUTPUT_LABEL_REF
5967
+ * TARGET_ASM_INTERNAL_LABEL
5968
+ * ASM_OUTPUT_DEBUG_LABEL
5969
+ * ASM_GENERATE_INTERNAL_LABEL
5970
+ * ASM_FORMAT_PRIVATE_NAME
5971
+ */
5972
+
5973
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
5974
+ * assembler code which defines (equates) the symbol NAME to have the value
5975
+ * VALUE.
5976
+ *
5977
+ * ZipCPU---So many other things that we need depend upon this, that we need
5978
+ * to implement a non-default version.
5979
+ */
5980
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
5981
+
5982
+/* ASM_OUTPUT_DEF_FROM_DECLS
5983
+ * TARGET_DEFERRED_OUTPUT_DEFS
5984
+ * ASM_OUTPUT_WEAK_ALIAS
5985
+ * OBJ_GEN_METHOD_LABEL
5986
+ */
5987
+
5988
+
5989
+/* 17.20.7 Output of Assembler Instructions */
5990
+
5991
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
5992
+       "R10","R11","R12","SP","CC","PC" }
5993
+
5994
+/* REGISTER_PREFIX     (Undefined by default)
5995
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
5996
+ * USER_LABEL_PREFIX   defaults to "*"
5997
+ * IMMEDIATE_PREFIX    (Undefined by default)
5998
+ *
5999
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
6000
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
6001
+ * 'md' file must support multiple assembler formats.  In that case, the various
6002
+ * 'tm.h' files can define these macros differently.
6003
+ */
6004
+// #define     USER_LABEL_PREFIX       "*"
6005
+
6006
+/* Defining memory operand address formats is in this section. */
6007
+
6008
+/* 17.20.10 Assembler Commands for Alignment */
6009
+
6010
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
6011
+ * which is a common destination of jumps and has no fallthru incoming
6012
+ * edge.  This macro need not be defined if you don't want any special alignment
6013
+ * to be done at such a time.  Most machine descriptions do not currently define
6014
+ * this macro.
6015
+ *
6016
+ * ZipCPU---The assembler should automatically deal with label alignment, so
6017
+ * let's not do anything about it here.
6018
+ */
6019
+
6020
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
6021
+ */
6022
+
6023
+/* LABEL_ALIGN_AFTER_BARRIER
6024
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
6025
+ */
6026
+
6027
+/* LOOP_ALIGN(label)
6028
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
6029
+ * LABEL_ALIGN
6030
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
6031
+ */
6032
+
6033
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
6034
+ * stream an assembler instruction to advance the location counter by nbytes
6035
+ * bytes.
6036
+ */
6037
+
6038
+/* TARGET_ASM_LABEL_ALIGN */
6039
+/* Assembler Commands for Alignment */
6040
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
6041
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
6042
+
6043
+
6044
+
6045
+/* 17.21 Controlling Debugging Information Format */
6046
+/* 17.22 Cross Compilation and Floating Point */
6047 111 dgisselq
+
6048
+// REAL_VALUE_TYPE
6049
+// REAL_VALUES_EQUAL
6050
+// REAL_VALUES_LESS ... Tess whether x is less than y
6051
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
6052
+ * If x is negative, returns zero.
6053
+ */
6054
+// REAL_VALUE_ATOF
6055
+// REAL_VALUE_NEGATIVE
6056
+// REAL_VALUE_ISINF
6057
+// REAL_VALUE_ISNAN
6058
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
6059
+ * on two floating point values X and Y, storing the result in OUT (which must
6060
+ * be a variable).
6061
+ *
6062
+ * The operation to be performed is specified by CODE.  Only the following
6063
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
6064
+ * MIN_EXPR.
6065
+ *
6066
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
6067
+ * floating point format cannot represent infinity, it will call abort().
6068
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
6069
+ */
6070
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
6071
+ * value X.
6072
+ */
6073
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
6074
+ */
6075 102 dgisselq
+/* 17.23 Mode switching instructions */
6076
+/* 17.24 Defining target-specific uses of __attribute__ */
6077
+#undef TARGET_OPTION_OVERRIDE
6078
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
6079
+
6080
+/* 17.25 Emulating TLS */
6081
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
6082
+
6083
+ // ZipCPU isn't MIPS.
6084
+
6085
+/* 17.27 Parameters for Precompiled Header Validity Checking */
6086
+/* 17.28 C++ ABI parameters */
6087
+/* 17.29 Adding support for named address spaces */
6088
+/* 17.30 Miscellaneous Parameters */
6089
+
6090
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
6091
+ * not your architecture has conditional branches that can span all of memory.
6092
+ * It is used in conjunction with an optimization that partitions hot and
6093
+ * cold basic blocks into separate sections of the executable.  If this macro
6094
+ * is set to false, gcc will convert any conditional branches that attempt to
6095
+ * cross between sections into unconditional branches or indirect jumps.
6096
+ *
6097
+ * ZipCPU --- The assembler renders long unconditional branch code without
6098
+ * problems, so we can pretend that such long branches exist.
6099
+ */
6100
+#define        HAS_LONG_COND_BRANCH true
6101
+
6102
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
6103
+ * or not your architecture has unconditional branches that can span all of
6104
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
6105
+ * conjunction with an optimization that partitions hot and cold basic blocks
6106
+ * into separate sections of the executable.  If this macro is set to false,
6107
+ * gcc will convert any unconditional branches that attempt to cross between
6108
+ * sections into indirect jumps.
6109
+ *
6110
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
6111
+ * jump.
6112
+ */
6113
+#define        HAS_LONG_UNCOND_BRANCH  true
6114
+
6115
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
6116
+ * mode that eleemnts of a jump-table should have.
6117
+ *
6118
+ */
6119
+#define        CASE_VECTOR_MODE        SImode
6120
+
6121
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
6122
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
6123
+ * If you define this, it enables extra code in branch shortening to deal with
6124
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
6125
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
6126
+ *
6127
+ * ZipCPU---No advantage here.
6128
+ */
6129
+
6130
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
6131
+ * jump-tables should contain relative addresses.  You need not define this
6132
+ * macro if jump-tables never contain relative addresses, or jump-tables
6133
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6134
+ *
6135
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6136
+ * code.
6137
+ */
6138
+
6139
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6140
+ * number of different values for which it is best to use a jump-table instead
6141
+ * of a tree of conditional branches.  The default is four for machines with a
6142
+ * casesi instruction and five otherwise.  This is best for most machines.
6143
+ *
6144
+ * ZipCPU---Leave at the default.
6145
+ */
6146
+
6147
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6148
+ * registers with integral mode smaller than a word are always performed on the
6149
+ * entire register.  Most RISC machines have this property and most CISC
6150
+ * machines do not.
6151
+ *
6152
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6153
+ */
6154
+#undef WORD_REGISTER_OPERATIONS
6155
+#define        WORD_REGISTER_OPERATIONS        1
6156
+
6157
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6158
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6159
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6160
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6161
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6162
+ * UNKNOWN for other modes.
6163
+ *
6164
+ * Do not define this macro if it would always return UNKNOWN.
6165
+ *
6166
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6167
+ */
6168
+#undef LOAD_EXTEND_OP
6169
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6170
+
6171
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6172
+ *
6173
+ * ZipCPU---All immediates are sign extended, so yes.
6174
+ */
6175
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6176
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6177
+
6178
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6179
+ */
6180
+
6181
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6182
+ * quickly between memory and registers or between two memory locations.
6183
+ *
6184
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6185
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6186
+ * Therefore, this is defined to be one.
6187
+ */
6188
+#define        MOVE_MAX        1
6189
+
6190
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6191
+ * move quickly between memory and registers or between two memory ...
6192
+ *
6193
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6194
+ * definition of this.
6195
+ */
6196
+
6197
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6198
+ * the number of bits actually used for the count of a shift operation is equal
6199
+ * to the number of bits needed to represent the size of the object being
6200
+ * shifted.
6201
+ *
6202
+ * You need not define this macro if it would have the value of zero.
6203
+ *
6204
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6205
+ * value in the register, therefore this value should be zero, the default.
6206
+ */
6207
+
6208
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6209
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6210
+ * more than the width of the mode.
6211
+ *
6212
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6213
+ * This is the case for the ZipCPU as well.
6214
+ */
6215
+
6216
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6217
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6218
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6219
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6220
+ *
6221
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6222
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6223
+ */
6224
+#undef TRULY_NOOP_TRUNCATION
6225
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6226
+
6227
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6228
+ * mode can be such that the values are always extended to a wider integral
6229
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6230
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6231
+ * use zero-extended.
6232
+ *
6233
+ */
6234
+// #undef      TARGET_MODE_REP_EXTENDED
6235
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6236
+
6237
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6238
+ * comparison operator with an integral mode and stored by a store-flag
6239
+ * instruction (cstoremode4) when the condition is true.  This description
6240
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6241
+ * whose results have MODE_INT mode.
6242
+ *
6243
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6244
+ */
6245
+
6246
+/* FLOAT_STORE_FLAG_VALUE
6247
+ *
6248
+ * ZipCPU
6249
+ */
6250
+
6251
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6252
+ * comparison operations that return a vector result ...
6253
+ *
6254
+ * ZipCPU---Doesn't support vector operations.
6255
+ */
6256
+
6257
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6258
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6259
+ *
6260
+ * A C expression that indicates whetther the architecture defines a value for
6261
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6262
+ * 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
6263
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6264
+ * defined, value should be set to this value.
6265
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6266
+ * be undefined.
6267
+ *
6268
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6269
+ */
6270
+
6271
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6272
+ * define this to be the integer mode corresponding to the width of a
6273
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6274
+ * On some machines you must define this to be one of the partial
6275
+ * integer modes, such as PSImode.
6276
+ */
6277
+#undef Pmode
6278
+#define        Pmode   SImode
6279
+
6280
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6281
+ * function being called, in call RTL expressions.  On most CISC machines, where
6282
+ * an instruction can begin at any byte address, this should be QImode.  On most
6283
+ * RISC machines, where all instructions have fixed size and alignment, this
6284
+ * should be a mode with the same size and alignment as the machine instruction
6285
+ * words--typically SImode or HImode.
6286
+ *
6287
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6288
+ * addresses on the ZipCPU.
6289
+ */
6290
+#undef FUNCTION_MODE
6291
+#define        FUNCTION_MODE   SImode
6292
+
6293
+/* STDC_0_IN_SYSTEM_HEADERS
6294
+ */
6295
+
6296
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6297
+ * file to be included at the start of all compilations, as if it had been
6298
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6299
+ * or if the header is not found, or if the user specifies -ffreestanding or
6300
+ * -nostdinc, no header is included.
6301
+ *
6302
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6303
+ * as NULL.
6304
+ */
6305
+#undef TARGET_C_PREINCLUDE
6306
+#define        TARGET_C_PREINCLUDE     NULL
6307
+
6308
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6309
+ * specific C++ implicit extern C functions.  If this function returns true
6310
+ * for the name of a file-scope function, that function implicitly gets extern
6311
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6312
+ * An example of such function is WinMain on Win32 targets.
6313
+ *
6314
+ * ZipCPU---Not ready to deal with this yet.
6315
+ */
6316
+
6317
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6318
+ * support C++ as well as C.  This macro inhibits the usual method of using
6319
+ * system header files in C++, which is to pretend that the file's contents
6320
+ * are enclosed in 'extern "C" {...}'.
6321
+ *
6322
+ *
6323
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6324
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6325
+ */
6326
+
6327
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6328
+ * target specific pragmas.
6329
+ *
6330
+ * ZipCPU --- let's not.
6331
+ */
6332
+
6333
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6334
+ * expanded in the arguments of #pragma pack().
6335
+ *
6336
+ * ZipCPU ... why?
6337
+ */
6338
+
6339
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6340
+ * default other than 0 (meaning the machine default), define this macro to
6341
+ * the necessary value (in bytes).  This must be a value that would also be
6342
+ * valid to use with #pragma pack() (that is a small power of two.
6343
+ */
6344
+
6345
+/* DOLLARS_IN_IDENTIFIERS
6346
+ * ZipCPU --- Default (not changing C)
6347
+ */
6348
+
6349
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6350
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6351
+ * in the delay slot of INSN, even if they appear to use a resource set or
6352
+ * clobbered in INSN.  INSN is always a ...
6353
+ *
6354
+ * ZipCPU --- You need not define this macro if it would always return zero.
6355
+ */
6356
+
6357
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6358
+ * that is nonzero if it is safe for the delay slot schedule to place
6359
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6360
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6361
+ * machines where some insn or jump_insn is really a function call and ...
6362
+ *
6363
+ * ZipCPU --- You need not define this macro if it would always return zero.
6364
+ */
6365
+
6366
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6367
+ * nonzero if, in some cases, global symbols from one translation unit may not
6368
+ * be bound to undefined symbols in another translation unit without user
6369
+ * intervention.  For instance, under Microsoft Windows symbols must be
6370
+ * explicitly imported from shared libraries (DLLs).
6371
+ *
6372
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6373
+ * so we won't.
6374
+ */
6375
+
6376
+/* TARGET_MD_ASM_ADJUST
6377
+ */
6378
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6379
+ * define this macro if the default of "m" is wrong.
6380
+ *
6381
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6382
+ * works doesn't sound like a problem.  Let's not define this.
6383
+ */
6384
+
6385
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6386
+ * variable that specifies where the linker should look for libraries.
6387
+ *
6388
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6389
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6390
+ * libraries.
6391
+ */
6392
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6393
+
6394
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6395
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6396
+ *
6397
+ * ZipCPU does not.
6398
+ */
6399
+
6400
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6401
+ * instructions to execute via conditional execution instructions instead of a
6402
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6403
+ * cc0 and 1 if it does use cc0.
6404
+ *
6405
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6406
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6407
+ * something else, so let's keep looking into this.
6408
+ */
6409
+
6410
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6411 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6412 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6413
+ * structure, struct ce_if_block, which contains information about the currently
6414
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6415
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6416
+ * or FALSE to a null pointer if the tests cannot be converted.
6417
+ *
6418
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6419
+ * execution and conditional testing capabilities.
6420
+ */
6421
+// #warning "Need to come back to this."
6422
+
6423
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6424
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6425
+ * into conditions combined by and and or operations.  BB contains the basic
6426
+ * block that contains the test that is currently being processed and about to
6427
+ * be turned into a condition.
6428
+ *
6429
+ *
6430
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6431
+ * execution and conditional testing capabilities.
6432
+ */
6433
+// #warning "Need to come back to this."
6434
+
6435
+
6436
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6437
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6438
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6439
+ * information about the currently processed blocks.
6440
+ *
6441
+ *
6442
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6443
+ * execution and conditional testing capabilities.
6444
+ */
6445
+// #warning "Need to come back to this."
6446
+
6447
+
6448
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6449
+ * machine dependent modifications in converting code to conditional
6450
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6451
+ * structure pointed to be CEINFO.
6452
+ *
6453
+ *
6454
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6455
+ * execution and conditional testing capabilities.
6456
+ */
6457
+// #warning "Need to come back to this."
6458
+
6459
+
6460
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6461
+ * dependent modifications in converting code to conditional execution.  The
6462
+ * involved basic blocks can be found in the struct ce_if_block structure that
6463
+ * is pointed to by CEINFO.
6464
+ *
6465
+ *
6466
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6467
+ * execution and conditional testing capabilities.
6468
+ */
6469
+// #warning "Need to come back to this."
6470
+
6471
+
6472
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6473
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6474
+ * that is pointed by CEINFO.
6475
+ *
6476
+ *
6477
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6478
+ * execution and conditional testing capabilities.
6479
+ */
6480
+// #warning "Need to come back to this."
6481
+
6482
+
6483
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6484
+ * target specific pass over the instruction stream.  The compiler will run it
6485
+ * at all optimization levels, just before the point at which it normally does
6486
+ * delayed branch scheduling.
6487
+ *
6488
+ * You need not implement the hook if it has nothing to do.
6489
+ *
6490
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6491
+ * just get us started.
6492
+ */
6493
+
6494
+
6495
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6496
+ * specific builtin functions that need to be defined.  It should be a function
6497
+ * that performs the necessary setup.  Machine specific builtin functions can be
6498
+ * useful to expand special machine instructions that would otherwise not
6499
+ * normally be generated because they have no equivalent in the source language.
6500
+ *
6501
+ * To create a built in function, call the function lang_hooks.builtin_function
6502
+ * which is defined by the language front end.  You can use any type nodes
6503
+ * set up by build_common_tree_nodes; only language front ends that use those
6504
+ * two functions will call "TARGET_INIT_BUILTINS".
6505
+ *
6506
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6507
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6508
+ * restore_context(cstackregno).
6509
+ *
6510
+ */
6511
+#undef TARGET_INIT_BUILTINS
6512
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6513
+
6514
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6515
+ * machine specific builtin functions that need to be defined.  It should be a
6516
+ * function that returns the builtin function declaration for the builtin
6517
+ * function code code.  If there is no such builtin and it cannot be initialized
6518
+ * at this time if INITP is true the function should return NULL_TREE.  If
6519
+ * CODE is out of range the fucntion should return error-mark_node.
6520
+ *
6521
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6522
+ */
6523
+#undef TARGET_BUILTIN_DECL
6524
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6525
+
6526
+
6527
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6528
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6529
+ * TREE is the expression for the function call; the result should go to
6530
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6531
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6532
+ * non-zero if the value is to be ignored.  This function should return the
6533
+ * result of the call to the built-in function.
6534
+ *
6535
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6536
+ */
6537
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6538
+
6539
+
6540
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6541
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6542
+ *
6543
+ * ZipCPU --- not interested.
6544
+ */
6545
+/* TARGET_CHKP_BOUND_TYPE
6546
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6547
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6548
+ *
6549
+ * ZipCPU --- Same as last one.
6550
+ */
6551
+
6552
+
6553
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6554
+ * for a machine specific built-in function that was set up by
6555
+ * TARGET_INIT_BUILTINS.
6556
+ *
6557
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6558
+ * to then overload it?
6559
+ */
6560
+
6561
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6562
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6563
+ * is the declaration of the built-in function.  NARGS is the number of
6564
+ * arguments passed to the function; the arguments themselves are pointed to by
6565
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6566
+ * containing as simplified expression for the call's result.  If IGNORE is
6567
+ * true the value will be ignored.
6568
+ *
6569
+ * ZipCPU --- You know, this and the previous couple sound like something
6570
+ * whereby I might be able replace bit-reversal code with my bit reverse
6571
+ * instruction.  That would be very useful, but not necessary to get me
6572
+ * started.
6573
+ */
6574
+
6575
+/* TARGET_GIMPLE_FOLD_BUILTIN
6576
+ * TARGET_COMPARE_VERSION_PRIORITY
6577
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6578
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6579
+ * TARGET_CAN_USE_DOLOOP_P
6580
+ * TARGET_INVALID_WITHIN_DOOLOOP
6581
+ * TARGET_LEGITIMATE_COMBINED_INSN
6582
+ * TARGET_CAN_FOLLOW_JUMP
6583
+ * TARGET_COMMUTATIVE_P
6584
+ */
6585
+
6586
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6587
+ * register has been copied in a pseudo register, it is often not necessary
6588
+ * ...
6589
+ */
6590
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6591
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6592
+ * can use this hook to enhance precision of analysis for unspec and
6593
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6594
+ * elements of RTX in which case flags should be passed along.
6595
+ */
6596
+
6597
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6598
+ * it changes its current function context (CFUN).  You can define this
6599
+ * function if the back end needs to perform any initialization or reset
6600
+ * actions on a per-function basis.  For example, it may be used to implement
6601
+ * function attributes that affect register usage or code generation patterns.
6602
+ */
6603
+
6604
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6605
+ * suffix for object files on your target machine.  If you do not define this
6606
+ * macro, GCC will use ".o" as the suffix for object files.
6607
+ */
6608
+#define        TARGET_OBJECT_SUFFIX    ".o"
6609
+
6610
+/* TARGET_EXECUTABLE_SUFFIX
6611
+ */
6612
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6613
+
6614
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6615
+ * files specified on its command line and create an export list for the linker.
6616
+ * Define this macro for systems like AIX, where the linker discards object
6617
+ * files that are not referenced from main and uses export lists.
6618
+ *
6619
+ * ZipCPU --- shoudln't need this.
6620
+ */
6621
+
6622
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6623
+ * representing a variant of the method call mdecl, if Java Native Interface
6624
+ * (JNI) methods must be invoked differently from other methods on your
6625
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6626
+ * using the stdcall calling convention and this macro is then ...
6627
+ *
6628
+ * ZipCPU----Don't need this.  (yet)
6629
+ */
6630
+
6631
+
6632
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6633
+ * point in which a new jump instructions could be created.  On machines that
6634
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6635
+ * would typically be reload, so thiss target hook should be defined to a
6636
+ * function such as:
6637
+ *
6638 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6639
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6640
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6641
+ * fortch, preventing our comparison optimizations from being used.  By setting
6642
+ * this function appropriately, we can prevent it from reversing conditions into
6643
+ * conditions we don't support.
6644 102 dgisselq
+ */
6645 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6646 102 dgisselq
+
6647
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6648
+ * class for which branch target register optimizations should be applied.  All
6649
+ * registers in this class should be usable interchangably.  After reload,
6650
+ * registers in this class will be re-allocated and loads will be hoisted out of
6651
+ * loops and be subjected to inter-block scheduling.
6652
+ *
6653
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6654
+ */
6655
+
6656
+
6657
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6658
+ * optimization will by default exclude callee-saved registers that are not
6659
+ * already live during the current function.  If this target hook returns true,
6660
+ * they will be included.  The target code must then make sure that all target
6661
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6662
+ * be saved are saaved.
6663
+ *
6664
+ * ZipCPU---
6665
+ */
6666
+
6667
+
6668
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6669
+ * if the target supports conditional execution.  This target hook is required
6670
+ * only when the target has several different modes and they have different
6671
+ * conditional execution capability, such as ARM.
6672
+ *
6673
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6674
+ * long version load immediate ...)
6675
+ */
6676
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6677
+
6678
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6679
+ * emit a comparison instruction for the first compare in a sequence of
6680
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6681
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6682
+ * compare are saved in prep_seq and the compare instructions are saved in
6683
+ * gen_seq.  They will be emitted when all the compares in the conditional
6684
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6685
+ * for op0 and op1.
6686
+ *
6687
+ *
6688
+ * ZipCPU---???
6689
+ */
6690
+
6691
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6692
+ * prepares to emit a conditional comparison within a sequence of conditional
6693
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6694
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6695
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6696
+ * emitted when all the compares in the conditional comparison are generated
6697
+ * without error.  The pPREV expression is the result of a prior call to either
6698
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6699
+ * PREV and this comparison is not supported, otherwise the result must be the
6700
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6701
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6702
+ * on the compares.
6703
+ *
6704
+ *
6705
+ * ZipCPU --- ???
6706
+ */
6707
+
6708
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6709
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6710
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6711
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6712
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6713
+ *
6714
+ *
6715
+ * ZipCPU -- ???
6716
+ */
6717
+
6718
+
6719
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6720
+ * C expression that specifies the maximum number of floating point
6721
+ * multiplications that should be emitted when expanding exponentiation by an
6722
+ * integer constant inline.  When this value is defined, exponentiation
6723
+ * requiring more than this number of multiplications is implemented by calling
6724
+ * the system library's pow, powf, or powl routines.  The default value
6725
+ places no upper bound on the multiplication count.
6726
+ *
6727
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6728
+ * ready for this macro.
6729
+ */
6730
+
6731
+
6732
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6733
+ * register any extra include files for the target.  The parameter stdinc
6734
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6735
+ * system root directory.  The parameter PFX is the prefix for the GCC
6736
+ * directoiry.
6737
+ *
6738
+ *
6739
+ * ZipCPU---None yet.
6740
+ */
6741
+
6742
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6743
+ * register any extrra include files for the target before any standard headers.
6744
+ * The parameter stdinc indicates if normal include files are present.
6745
+ *
6746
+ * ZipCPU --- None.
6747
+ */
6748
+
6749
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6750
+ * for the target.  The parameter path is the integer to register.  On Darwin
6751
+ * systems, this is used for Framework includes, which have semantics that are
6752
+ * different from -I.
6753
+ *
6754
+ *
6755
+ * ZipCPU --- None.
6756
+ */
6757
+
6758
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6759
+ * safe to use a local alias for a virtual function FN when constructing
6760
+ * thunks, false otherwise.  By default, the macro returns true for all
6761
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6762
+ * false otherwise.
6763
+ *
6764
+ *
6765
+ * ZipCPU --- ???
6766
+ */
6767
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6768
+
6769
+
6770
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6771
+ * variable containing target-specific format checking information for the
6772
+ * -Wformat option.  The default is to have no target-specific format checks.
6773
+ *
6774
+ * ZipCPU --- Default
6775
+ */
6776
+
6777
+/* TARGET_N_FORMAT_TYPES
6778
+ *
6779
+ * ZipCPU --- Default
6780
+ */
6781
+
6782
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6783
+ * a global variable containing target-specific format overrides for the
6784
+ * -Wformat option.  The default is to have no target specific format overrides.
6785
+ *
6786
+ * ZipCPU --- Default
6787
+ */
6788
+
6789
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6790
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6791
+ *
6792
+ * If defined, the (first) macro is the name of a global variable containing
6793
+ * target-specific format overrides for the -Wformat option.
6794
+ */
6795
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6796
+ * optional initialization routine for target specific customizations of the
6797
+* system printf and scanf formatter settings.
6798
+ */
6799
+
6800
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6801
+ * macro returns the diagnostic message when it is illegal to pass an argument
6802
+ * VAL to function FN with prototype TLIST.
6803
+ *
6804
+ * ZipCPU---Default.
6805
+ */
6806
+
6807
+/* TARGET_INVALID_CONVERSION
6808
+ * TARGET_INVALID_UNARY_OP
6809
+ * TARGET_INVALID_BINARY_OP
6810
+ * TARGET_INVALID_PARAMETER_TYPE
6811
+ * TARGET_INVALID_RETURN_TYPE
6812
+ * TARGET_PROMOTED_TYPE
6813
+ * TARGET_CONVERT_TO_TYPE
6814
+ * TARGET_USE_JCR_SECTION_TYPE
6815
+ * OBJC_JBLEN
6816
+ * LIBGCC2_UNWIND_ATTRIBUTE
6817
+ * TARGET_UPDATE_STACK_BOUNDARY
6818
+ * TARGET_GET_DRAP_RTX
6819
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6820
+ */
6821
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6822
+ * instructions to synthesize a constant. If there is another constant already
6823
+ * in a register that is close enough in value then it is preferable that the
6824
+ * new constant is computed from the register using immediate addition or
6825
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6826
+ * constant we also add a lower and an upper constant anchor to the available
6827
+ * expressions.  These are then queried when encountering new constants.  The
6828
+ * anchors are computed by rounding the constant up and down to a multiple of
6829
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6830
+ * positive value accepted by immediate-add plus one.  We currently assume that
6831
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6832
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6833
+ * to 0x8000.  The default value is zero, which disables this optimization.
6834
+ *
6835
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6836
+ * access registers plus immediates.  To use this, we *need* this capability.
6837
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6838
+ * signed immediate offsets)
6839
+ *
6840
+ * On ZipCPU---2^17
6841
+ */
6842
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6843
+
6844
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6845
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6846
+ * if address Sanitizer is not supported by the target.
6847
+ */
6848
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6849
+
6850
+/* TARGET_MEMMODEL_CHECK
6851
+ */
6852
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6853
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6854
+ */
6855
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6856
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6857
+ * The default value of this hook is based on target's libc.
6858
+ */
6859
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6860
+
6861
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6862
+ * an appropriate alignment in bits for an atomic object of machine mode
6863
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6864
+ * is used.
6865
+ *
6866
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6867
+ */
6868
+
6869
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6870
+ * assignments that may raise floating-point exceptions to raise exceptions
6871
+ * corresponding to the arithmetic operation whose result was successfully
6872
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6873
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6874
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6875
+ * set *hold to an expression equivalent
6876
+ *
6877
+ * ZipCPU --- ???
6878
+ */
6879
+
6880
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6881
+ * the compilation unit and no named sections are available.  It is called once
6882
+ * for each symbol that must be recorded in the offload function and variable
6883
+ * table.
6884
+ *
6885
+ * ZipCPU --- Offloaded functions?
6886
+ */
6887
+
6888
+/* TARGET_OFFLOAD_OPTIONS
6889
+ *
6890
+ * ZipCPU---none defined
6891
+ */
6892
+
6893
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
6894
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
6895
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
6896
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
6897
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
6898
+ * HOST_WIDE_INT representation.
6899
+ *
6900
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
6901
+ * are wider than DImode ...)
6902
+ */
6903
+#define        TARGET_SUPPORTS_WIDE_INT        0
6904
+
6905
+
6906
+/* Now, for the prototype functions ...*/
6907
+// These have been moved to zip-protos.h
6908
+
6909
+// extern void zip_init_builtins(void);
6910
+// extern void zip_asm_output_anchor(rtx x);
6911
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
6912
+// extern void zip_asm_trampoline_template(FILE *);
6913
+// extern void zip_initial_elimination_offset(int from, int to);
6914
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
6915
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
6916
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
6917
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
6918
+// extern      int zip_address_operand(rtx op);
6919
+// extern      int zip_const_address_operand(rtx op);
6920
+// extern void zip_expand_prologue(void);
6921
+// extern void zip_expand_epilogue(void);
6922
+// extern bool zip_gen_move_rtl(rtx, rtx);
6923
+// extern bool zip_load_address_lod(rtx, rtx);
6924
+// extern bool zip_load_address_sto(rtx, rtx);
6925
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
6926
+// extern void zip_print_operand_address(FILE *fp, rtx x);
6927
+// extern bool zip_use_return_insn(void);
6928
+
6929 111 dgisselq
+#define        UQQmode USQmode
6930
+#define        UHQmode USQmode
6931
+#define        UHAmode USAmode
6932
+#define        QQmode  SQmode
6933
+#define        HQmode  SQmode
6934 102 dgisselq
+#define        QImode  SImode
6935
+#define        HImode  SImode
6936 111 dgisselq
+#define        QAmode  SAmode
6937
+#define        HAmode  SAmode
6938 102 dgisselq
+
6939
+#include "insn-modes.h"
6940
+#include "zip-protos.h"
6941
+
6942
+#endif /* GCC_ZIP_H */
6943
+
6944
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
6945
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
6946 117 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-04-01 19:21:20.490611131 -0400
6947
@@ -0,0 +1,2122 @@
6948 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6949
+;;
6950
+;; Filename:   zip.md
6951
+;;
6952
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
6953
+;;
6954
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
6955
+;;             GNU compiler collection (GCC).
6956
+;;
6957
+;;
6958
+;; Creator:    Dan Gisselquist, Ph.D.
6959
+;;             Gisselquist Technology, LLC
6960
+;;
6961
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6962
+;;
6963
+;; Copyright (C) 2015, Gisselquist Technology, LLC
6964
+;;
6965
+;; This program is free software (firmware): you can redistribute it and/or
6966
+;; modify it under the terms of  the GNU General Public License as published
6967
+;; by the Free Software Foundation, either version 3 of the License, or (at
6968
+;; your option) any later version.
6969
+;;
6970
+;; This program is distributed in the hope that it will be useful, but WITHOUT
6971
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
6972
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6973
+;; for more details.
6974
+;;
6975
+;; License:    GPL, v3, as defined and found on www.gnu.org,
6976
+;;             http://www.gnu.org/licenses/gpl.html
6977
+;;
6978
+;;
6979
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6980
+;;
6981
+;;
6982
+;; - Immediate integer operand constraints
6983
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
6984
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
6985
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
6986
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
6987
+;;     'R'     0...31                                          (Shift value)
6988
+;; - Memory constraints
6989 111 dgisselq
+;;     "Q"     Op-B capable references to memory
6990
+;;     "S"     References to constant memory
6991 102 dgisselq
+;; - Address constraints
6992 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
6993
+;;     "T"     Constant memory addresses
6994 102 dgisselq
+(define_constraint "M"
6995
+  "An 13-bit signed immediate such as a MOV instruction can handle"
6996
+  (and (match_code "const_int")
6997
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
6998
+(define_constraint "N"
6999
+  "An 14-bit signed immediate offset such as an Op-B register offset"
7000
+  (and (match_code "const_int")
7001
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
7002
+(define_constraint "O"
7003
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
7004
+  (and (match_code "const_int")
7005
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
7006
+(define_constraint "R"
7007
+  "Bits that a value may be shifted"
7008
+  (and (match_code "const_int")
7009
+       (match_test "(ival < 32) && (ival >= 0)")))
7010
+;;
7011
+;
7012
+;
7013
+; Our builtin functions, by identifier
7014
+;
7015
+(define_constants
7016 117 dgisselq
+       [(UNSPEC_RTU             1)
7017
+       (UNSPEC_HALT             2)
7018
+       (UNSPEC_IDLE             3)
7019
+       (UNSPEC_SYSCALL          4)
7020
+       (UNSPEC_SAVE_CONTEXT     5)
7021
+       (UNSPEC_RESTORE_CONTEXT  6)
7022
+       (UNSPEC_BITREV           7)
7023
+       (UNSPEC_GETUCC           8)
7024
+       (UNSPEC_GETCC            9)
7025
+       (UNSPEC_LDILO           10)
7026 102 dgisselq
+       ])
7027
+;
7028
+;
7029
+; Registers by name
7030
+(define_constants
7031
+  [(RTN_REG            0)      ; Return address register
7032
+   (RTNV_REG           1)      ; Subroutine return value register
7033
+   (AP_REG             10)     ; Hopefully never used
7034
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
7035
+   (FP_REG             12)
7036
+   (SP_REG             13)
7037
+   (CC_REG             14)
7038
+   (PC_REG             15)
7039
+  ])
7040
+;
7041
+;
7042
+;
7043
+
7044
+;; Predicates
7045
+(define_predicate "zip_const_address_operand_p"
7046
+       (match_code "symbol_ref,const,label_ref,code_label")
7047
+{
7048
+       return zip_const_address_operand(op);
7049
+})
7050
+
7051
+(define_predicate "zip_address_operand_p"
7052
+       (match_code "reg,plus")
7053
+{
7054 111 dgisselq
+       return zip_pd_opb_operand(op);
7055 102 dgisselq
+})
7056
+
7057 111 dgisselq
+(define_predicate "zip_opb_operand_p"
7058
+       (match_code "reg,plus,const_int")
7059
+{
7060
+       return zip_pd_opb_operand(op);
7061
+})
7062
+
7063
+(define_predicate "zip_opb_single_operand_p"
7064
+       (match_code "reg,const_int")
7065
+{
7066
+       return zip_pd_opb_operand(op);
7067
+})
7068
+
7069 102 dgisselq
+(define_predicate "zip_mov_operand_p"
7070
+       (match_code "reg,plus")
7071
+{
7072
+       return zip_pd_mov_operand(op);
7073
+})
7074
+
7075
+(define_predicate "zip_memory_operand_p"
7076
+       (match_code "mem")
7077
+{
7078 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
7079 102 dgisselq
+})
7080
+
7081 111 dgisselq
+(define_predicate "zip_imm_operand_p"
7082
+       (match_code "const_int")
7083
+{
7084
+       return zip_pd_imm_operand(op);
7085
+})
7086
+
7087
+(define_predicate "zip_mvimm_operand_p"
7088
+       (match_code "const_int")
7089
+{
7090
+       return zip_pd_mvimm_operand(op);
7091
+})
7092
+
7093
+(define_predicate "zip_movdst_operand_p"
7094
+       (match_code "mem,reg,subreg")
7095
+{
7096
+       if (MEM_P(op)) // Check for valid store address
7097
+               return zip_pd_opb_operand(XEXP(op,0));
7098
+       return 1;
7099
+})
7100
+
7101
+(define_predicate "zip_movsrc_operand_p"
7102
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
7103
+{
7104
+       if (MEM_P(op))
7105
+               return zip_pd_opb_operand(XEXP(op,0));
7106
+       else if (GET_CODE(op)==PLUS)
7107
+               return zip_pd_opb_operand(op);
7108
+       return 1;
7109
+})
7110
+
7111 102 dgisselq
+;; Constraints
7112
+;
7113
+(define_memory_constraint "S"
7114
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7115
+       (and (match_code "mem")
7116
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7117
+(define_memory_constraint "Q"
7118
+       "Any memory addressed suitably for a load or store instruction"
7119
+       (and (match_code "mem")
7120
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7121
+(define_address_constraint "U"
7122
+       "An address suitable for a load or store instruction"
7123
+       (and (match_code "reg,plus")
7124
+               (match_test "zip_ct_address_operand(op)")))
7125
+(define_address_constraint "T"
7126
+       "Any constant address, to include those made by symbols unknown at compile time"
7127
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7128
+               (match_test "zip_ct_const_address_operand(op)")))
7129
+;
7130
+;
7131
+;; Attributes
7132
+;
7133
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7134
+(define_attr "conditional" "no,yes" (const_string "no"))
7135
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7136
+;
7137
+; Mode attributes
7138
+; (define_mode_iterator ZI [QI HI SI])
7139
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7140
+(define_mode_iterator ZI [SI])
7141
+(define_mode_attr zipa [(SI "")])
7142
+;
7143
+;
7144
+;
7145
+;; Instructions
7146
+;
7147
+; (define_insn
7148
+;      optional name
7149
+;      RTL template -- a vector of incomplete RTL expressions describing the
7150
+;              semantics of the instruction.  It is incomplete because it may
7151
+;              contain match_operand, match_operator, and match_dup expressions
7152
+;      The condition --- contains a C expression, may be an empty string
7153
+;      output template or output statement--fragment of C code returning a str
7154
+;      Attributes --
7155
+;      )
7156
+;
7157
+; (match_operand:m n predicate constraint)
7158
+;      Placeholder for operand #n of the instruction
7159
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7160
+;                              (expression, machine mode)
7161
+;              we can build functions:
7162
+;                      "isregister"    to describe a register
7163
+;                      "isimmediate"   to describe an immediate
7164
+;                      "offsetreg"     to describe a register plus offset
7165
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7166
+;              But ... functions "address_operand", "immediate_operand",
7167
+;                      "register_operand", "indirect_operand"
7168
+;              "comparison_operatot" and "ordered_comparison_operator"
7169
+;              are also available--be aware, they include more comparisons
7170
+;              than Zip CPU can do.
7171
+;
7172
+;
7173
+;
7174
+;
7175
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7176
+;;
7177
+;; Move instructions: both
7178
+;      (arbitrary) from variables to variables, but this gets
7179
+;              expanded into:
7180
+;      from registers to registers
7181
+;      from immediates to registers
7182
+;;
7183
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7184
+;
7185
+;
7186
+;
7187
+(define_expand "mov<mode>"
7188 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7189
+               (match_operand:ZI 1 "general_operand" ""))]
7190 102 dgisselq
+       ""
7191 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7192
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7193
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7194
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7195
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7196
+
7197
+       //; Need to load into a register between memory slots
7198
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7199
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7200
+               if (can_create_pseudo_p()) {
7201
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7202
+                       emit_insn(gen_movsi(tmp,operands[1]));
7203
+                       operands[1] = tmp;
7204
+               }
7205 102 dgisselq
+       }
7206 111 dgisselq
+
7207
+       //; Op[0] has a bad address, need to legitimize it
7208
+       if ((MEM_P(operands[0]))&&
7209
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7210
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7211
+               )
7212
+               {
7213
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7214
+               if (can_create_pseudo_p()) {
7215
+                       rtx tmp = gen_reg_rtx(Pmode);
7216
+                       //; Load the address into a register
7217
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7218
+                       XEXP(operands[0],0) = tmp;
7219
+                       mark_reg_pointer(tmp,1);
7220
+               }
7221
+       }
7222
+       //; Op[1] is a constant.  Need to load into a register before we can
7223
+       //; place it into memory.
7224
+       if ((MEM_P(operands[0]))&&
7225
+               ((CONSTANT_P(operands[1]))
7226
+               ||(CONST_INT_P(operands[1])))) {
7227
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7228
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7229
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7230
+               if (can_create_pseudo_p()) {
7231
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7232
+                       emit_insn(gen_movsi(tmp,operands[1]));
7233
+                       operands[1] = tmp;
7234
+               }
7235
+       }
7236
+       //; Op[1] has a bad address, need to legitimize it
7237
+       if ((MEM_P(operands[1]))&&
7238
+               //; (!REG_P(XEXP(operands[1],0)))
7239
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7240
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))
7241
+               )
7242
+               {
7243
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7244
+               if (can_create_pseudo_p()) {
7245
+                       rtx tmp = gen_reg_rtx(Pmode);
7246
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7247
+                       XEXP(operands[1],0) = tmp;
7248
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7249
+                       rtx tmp = operands[0];
7250
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7251
+                       XEXP(operands[1],0) = tmp;
7252
+               }
7253
+       }
7254
+       }
7255 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7256 111 dgisselq
+(define_insn "movsi_raw"
7257
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7258
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7259
+       "(REG_P(operands[0]))||(REG_P(operands[1]))"
7260
+       "@
7261
+       MOV\t%1,%0
7262
+       STO\t%1,%0
7263
+       LOD\t%1,%0
7264
+       LDI\t%1,%0"
7265
+       [(set_attr "ccresult" "unchanged")])
7266 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7267
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7268
+               (match_operand:ZI 1 "register_operand" "r"))]
7269
+       ""
7270
+       "MOV    %1,%0"
7271
+       [(set_attr "ccresult" "unchanged")])
7272
+(define_insn "mov<mode>_reg_off"       ; Register to register move
7273
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7274
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7275 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7276
+               ]
7277 102 dgisselq
+       ""
7278
+       "MOV    %2(%1),%0"
7279
+       [(set_attr "ccresult" "unchanged")])
7280 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7281
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7282
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7283
+;      ""
7284
+;      "LOD    %1,%0"
7285
+;      [(set_attr "ccresult" "unchanged")])
7286
+;(define_insn "mov<mode>_sto"  ; Store into memory
7287
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7288
+;              (match_operand:ZI 1 "register_operand" "r"))]
7289
+;      ""
7290
+;      "STO    %1,%0"
7291
+;      [(set_attr "ccresult" "unchanged")])
7292
+(define_expand "mov<mode>_lod" ; Load from memory
7293 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7294
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7295 103 dgisselq
+       "")
7296
+(define_insn "*movsi_lod"
7297
+       [(set (match_operand:SI 0 "register_operand" "=r")
7298 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7299 102 dgisselq
+       ""
7300 103 dgisselq
+       "LOD\t%1,%0"
7301
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7302 111 dgisselq
+;(define_insn "*movsi_lod_off"
7303
+       ;[(set (match_operand:SI 0 "register_operand" "=r")
7304
+               ;(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7305
+                       ;(match_operand:SI 2 "const_int_operand" "N"))))]
7306
+       ;""
7307
+       ;"LOD\t%2(%1),%0"
7308
+       ;[(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7309 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7310 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7311
+               (match_operand:ZI 1 "register_operand" "r"))]
7312 103 dgisselq
+       "")
7313
+(define_insn "*movsi_sto"
7314 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7315 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7316 102 dgisselq
+       ""
7317 111 dgisselq
+       "STO\t%1,%0"
7318 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7319 111 dgisselq
+;(define_insn "*movsi_sto_off"
7320
+       ;[(set (mem:SI (plus:SI
7321
+                       ;(match_operand:SI 0 "register_operand" "r")
7322
+                       ;(match_operand:SI 1 "const_int_operand" "N")))
7323
+               ;(match_operand:SI 2 "register_operand" "r"))]
7324
+       ;""
7325
+       ;"STO\t%2,%1(%0)"
7326
+       ;[(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7327 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7328
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7329
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7330
+       ""
7331
+       "LDI    %1,%0"
7332
+       [(set_attr "ccresult" "unchanged")])
7333
+;
7334
+;
7335
+;
7336
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7337
+;;
7338
+;; Load and store multiple values
7339
+;;
7340
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7341
+;
7342
+; So far, from the code I've seen from GCC's output,
7343
+; these instructions do not appear to be necessary.
7344
+;
7345
+;(define_insn "load_multiple"
7346
+;      for(a=0; a<%2; a++)
7347
+;              LOD a(%1),%0+a
7348
+;(define_insn "store_multiple"
7349
+;      for(a=0; a<%2; a++)
7350
+;              STO %0+a,a(%1)
7351
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7352
+;
7353
+;
7354
+;
7355
+;
7356
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7357
+;;
7358
+;; General arithmetic instructions
7359
+;;
7360
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7361
+;
7362
+;
7363
+;
7364
+;
7365 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7366 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7367 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7368 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7369
+(define_insn "*addsi3_reg" ; Fastest/best instruction always goes first
7370
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7371
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7372
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7373 102 dgisselq
+       ]
7374
+       ""
7375
+       "ADD    %2,%0"
7376
+       [(set_attr "ccresult" "set")])
7377
+(define_insn "add<mode>3_off" ; Fastest/best instruction always goes first
7378
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7379 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7380
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7381 111 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
7382 102 dgisselq
+       ""
7383
+       "ADD    %3+%2,%0"
7384
+       [(set_attr "ccresult" "set")])
7385
+;
7386
+;
7387
+;
7388 103 dgisselq
+(define_expand "sub<mode>3"
7389 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7390 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7391 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7392 103 dgisselq
+       ])
7393 111 dgisselq
+(define_insn "sub<mode>3_reg"
7394 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7395
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7396 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7397 102 dgisselq
+       ]
7398
+       ""
7399
+       "SUB    %2,%0"
7400
+       [(set_attr "ccresult" "set")])
7401
+(define_insn "sub<mode>3_off"
7402
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7403 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7404
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7405 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
7406
+       ]
7407
+       ""
7408
+       "SUB    %3+%2,%0"
7409
+       [(set_attr "ccresult" "set")])
7410
+(define_insn "mul<mode>3"
7411
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7412
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7413
+                       (match_operand:ZI 2 "register_operand" "r")))
7414
+       (clobber (match_scratch:ZI 3 "=r"))]
7415
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7416
+       ""
7417
+       "MOV    %1,%0
7418
+       MPYS    %2,%0
7419
+       MOV     %1,%3
7420
+       ROL     16,%3
7421
+       MPYS    %2,%3
7422
+       ROL     16,%3
7423
+       AND     0x0ffff,%3
7424
+       ADD     %3,%0
7425
+       MOV     %2,%3
7426
+       ROL     16,%3
7427
+       MPYS    %1,%3
7428
+       ROL     16,%3
7429
+       AND     0x0ffff,%3
7430
+       ADD     %3,%0"
7431
+       [(set_attr "ccresult" "unknown")])
7432
+
7433 111 dgisselq
+(define_expand "div<mode>3"
7434 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7435 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7436 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7437
+       "(ZIP_DIVIDE)")
7438
+(define_insn "div<mode>3_reg"
7439
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7440
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7441 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))]
7442 111 dgisselq
+       "(ZIP_DIVIDE)"
7443 102 dgisselq
+       "DIVS   %2,%0"
7444
+       [(set_attr "ccresult" "set")])
7445
+(define_insn "div<mode>3_off"
7446
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7447 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7448
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7449 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
7450 111 dgisselq
+       "(ZIP_DIVIDE)"
7451 102 dgisselq
+       "DIVS   %3+%2,%0"
7452
+       [(set_attr "ccresult" "set")])
7453 111 dgisselq
+(define_expand "udiv<mode>3"
7454 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7455 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7456 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7457
+       "(ZIP_DIVIDE)")
7458
+(define_insn "udiv<mode>3_reg"
7459
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7460
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7461 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))]
7462 111 dgisselq
+       "(ZIP_DIVIDE)"
7463 102 dgisselq
+       "DIVU   %2,%0"
7464
+       [(set_attr "ccresult" "set")])
7465
+(define_insn "udiv<mode>3_off"
7466
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7467 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7468
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7469 102 dgisselq
+                               (match_operand:ZI 3 "const_int_operand" "N"))))]
7470 111 dgisselq
+       "(ZIP_DIVIDE)"
7471 102 dgisselq
+       "DIVU   %3+%2,%0"
7472
+       [(set_attr "ccresult" "set")])
7473
+;;
7474
+;; modsi3
7475
+;; umodsi3
7476
+;;
7477
+(define_insn "umin<mode>3"
7478
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7479
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7480
+                       (match_operand:ZI 2 "register_operand" "r")))
7481
+       ]
7482
+       ""
7483
+       "CMP    %0,%2
7484
+       MOV.C   %2,%0"
7485
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7486
+(define_insn "umax<mode>3"
7487
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7488
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7489
+                       (match_operand:ZI 2 "register_operand" "r")))
7490
+       ]
7491
+       ""
7492
+       "CMP    %2,%0
7493
+       MOV.C   %2,%0"
7494
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7495
+(define_insn "smin<mode>3"
7496
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7497
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
7498
+                       (match_operand:ZI 2 "register_operand" "r")))
7499
+       ]
7500
+       ""
7501
+       "CMP    %2,%0
7502
+       MOV.GT  %2,%0"
7503
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7504
+(define_insn "smax<mode>3"
7505
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7506
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
7507
+                       (match_operand:ZI 2 "register_operand" "r")))
7508
+       ]
7509
+       ""
7510
+       "CMP    %0,%2
7511
+       MOV.LT  %2,%0"
7512
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7513 111 dgisselq
+(define_expand "and<mode>3"
7514 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7515
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7516 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7517
+(define_insn "and<mode>3_reg"
7518
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7519
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7520
+                       (match_operand:ZI 2 "zip_opb_operand_p" "rO")))]
7521 102 dgisselq
+       ""
7522
+       "AND    %2,%0"
7523
+       [(set_attr "ccresult" "set")])
7524
+(define_insn "and<mode>3_off"
7525
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7526
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7527
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7528
+                               (match_operand:ZI 3 "const_int_operand" "N"))))
7529
+       ]
7530
+       ""
7531
+       "AND    %3+%2,%0"
7532
+       [(set_attr "ccresult" "set")])
7533 111 dgisselq
+(define_expand "ior<mode>3"
7534 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7535
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7536 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7537
+(define_insn "ior<mode>3_reg"
7538
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7539
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7540 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
7541 102 dgisselq
+       ]
7542
+       ""
7543
+       "OR     %2,%0"
7544
+       [(set_attr "ccresult" "set")])
7545
+(define_insn "ior<mode>3_off"
7546
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7547
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
7548
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7549 103 dgisselq
+                               (match_operand:ZI 3 "nonmemory_operand" "N"))))
7550 102 dgisselq
+       ]
7551
+       ""
7552
+       "OR     %3+%2,%0"
7553
+       [(set_attr "ccresult" "set")])
7554 111 dgisselq
+(define_expand "xor<mode>3"
7555 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7556
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7557 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7558
+(define_insn "xor<mode>3_reg"
7559
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7560
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7561 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rO")))
7562 102 dgisselq
+       ]
7563
+       ""
7564
+       "XOR    %2,%0"
7565
+       [(set_attr "ccresult" "set")])
7566
+(define_insn "xor<mode>3_off"
7567
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7568
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
7569
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7570 103 dgisselq
+                               (match_operand:ZI 3 "nonmemory_operand" "N"))))
7571 102 dgisselq
+       ]
7572
+       ""
7573
+       "XOR    %3+%2,%0"
7574
+       [(set_attr "ccresult" "set")])
7575
+;(define_insn "addv<mode>4"
7576
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
7577
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
7578
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
7579
+       ;(set (pc) (if_then_else (eq (cc0) (const_int 0))
7580
+                       ;(label_ref (match_operand 3))
7581
+                       ;(pc)))]
7582
+       ;""
7583
+       ;"MOV   %1,%0
7584
+       ;ADD    %2,%0
7585
+       ;BV     %3"
7586
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7587
+;;(define_insn "subvsi4"
7588
+;;     MOV     %1,%0
7589
+;;     SUB     %2,%0
7590
+;;     BV      %3
7591
+;;(mulvsi4)
7592
+;;(define_insn "uaddvsi4"
7593
+;;     ADD     %2,%0
7594
+;;     BC      %3
7595
+;;(define_insn "usubvsi4"
7596
+;;     MOV     %1,%0
7597
+;;     SUB     %2,%0
7598
+;;     BC      %3
7599
+;;
7600
+;; (define_insn "umulvsi4"
7601
+;;     ... ???)
7602
+;;
7603
+(define_insn "ashr<mode>3"
7604
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7605
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7606 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7607 102 dgisselq
+       ""
7608
+       "ASR    %2,%0"
7609
+       [(set_attr "ccresult" "set")])
7610 111 dgisselq
+(define_insn "ashl<mode>3"
7611
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7612
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
7613
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7614
+       ""
7615
+       "ASR    %2,%0"
7616
+       [(set_attr "ccresult" "set")])
7617 102 dgisselq
+(define_insn "lshr<mode>3"
7618
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7619
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7620
+                       (match_operand:ZI 2 "register_operand" "rR")))]
7621
+       ""
7622
+       "LSR    %2,%0"
7623
+       [(set_attr "ccresult" "set")])
7624
+(define_insn "rotl<mode>3"
7625
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7626
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
7627 103 dgisselq
+                       (match_operand:ZI 2 "nonmemory_operand" "rR")))]
7628 102 dgisselq
+       ""
7629
+       "ROL    %2,%0"
7630
+       [(set_attr "ccresult" "set")])
7631
+;
7632
+(define_insn "neg<mode>2"
7633
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7634
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
7635
+       ]
7636
+       ""
7637
+       "NEG    %1,%0"
7638
+       [(set_attr "ccresult" "validzn")])
7639
+(define_insn "abs<mode>2"
7640
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7641
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7642
+       ]
7643
+       ""
7644
+       "TEST   %0
7645
+       NEG.LT  %0"
7646
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7647
+(define_insn "popcount<mode>2"
7648
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7649
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7650
+       ]
7651
+       ""
7652
+       "POPC   %1,%0"
7653
+       [(set_attr "ccresult" "set")])
7654
+(define_expand "parity<mode>2"
7655
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7656
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7657
+       (set (match_dup:ZI 0) (and:ZI (match_dup:ZI 0) (const_int -2)))
7658
+       ])
7659
+(define_insn "one_cmpl<mode>2"
7660
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7661
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
7662
+       ]
7663
+       ""
7664
+       "XOR    -1,%0"
7665
+       [(set_attr "ccresult" "set")])
7666
+;
7667
+;
7668 117 dgisselq
+;(define_extract "ssadsi"
7669
+;      [(set (cc0) (compare (match_operand:SI 1 "register_operand" "+r")
7670
+;                      (match_operand:SI 2 "register_operand" "+r")))
7671
+;      (cond_exec (lt (cc0) (const_int 0))
7672
+;         (set (match_dup:SI 2) (xor:SI (match_dup:SI 1) (match_dup:SI 2))))
7673
+;      (cond_exec (lt (cc0) (const_int 0))
7674
+;         (set (match_dup:SI 2) (xor:SI (match_dup:SI 2) (match_dup:SI 1))))
7675
+;      (cond_exec (lt (cc0) (const_int 0))
7676
+;         (set (match_dup:SI 2) (xor:SI (match_dup:SI 1) (match_dup:SI 2))))
7677
+;      (set (match_dup:SI 2) (subtract (match_dup:SI 1) (match_dup:SI 2)))
7678
+;      (set (match_operand:SI 3 "register_operand" "=r") (add:SI (match_dup:SI 2) (match_dup:SI 3)))
7679
+;              ]
7680
+;      "")
7681
+;(define_expand "usadsi"
7682
+;      [(set (cc0) (compare (match_operand:SI 1 "register_operand" "+r")
7683
+;                      (match_operand:SI 2 "register_operand" "+r")))
7684
+;      (cond_exec (ltu (cc0) (const_int 0))
7685
+;         (set (match_dup:SI 2) (xor:SI (match_dup:SI 1) (match_dup:SI 2))))
7686
+;      (cond_exec (ltu (cc0) (const_int 0))
7687
+;         (set (match_dup:SI 2) (xor:SI (match_dup:SI 2) (match_dup:SI 1))))
7688
+;      (cond_exec (ltu (cc0) (const_int 0))
7689
+;         (set (match_dup:SI 2) (xor:SI (match_dup:SI 1) (match_dup:SI 2))))
7690
+;      (set (match_dup:SI 2) (subtract (match_dup:SI 1) (match_dup:SI 2)))
7691
+;      (set (match_operand:SI 3 "register_operand" "=r") (add:SI (match_dup:SI 2) (match_dup:SI 3)))
7692
+;              ]
7693
+;      "")
7694 102 dgisselq
+;
7695
+;
7696 117 dgisselq
+;
7697
+;
7698 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7699
+;;
7700
+;; General arithmetic instructions -- double words
7701
+;;
7702
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7703
+;
7704
+;
7705
+;
7706 111 dgisselq
+(define_expand "movdi3"
7707
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
7708
+               (match_operand:DI 1 "general_operand" ""))])
7709
+(define_insn "movdi_lod"
7710
+       [(set (match_operand:DI 0 "register_operand" "=r")
7711
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "r")))]
7712
+       ""
7713
+       {
7714
+               if (REG_P(operands[0]))
7715
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
7716
+               else if (GET_CODE(operands[0])==PLUS) {
7717
+                       if ((REG_P(XEXP(operands[0],0)))
7718
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
7719
+                               static  char    buf[64];
7720
+                               sprintf(buf,
7721
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
7722
+                                       INTVAL(XEXP(operands[0],1)),
7723
+                                       INTVAL(XEXP(operands[0],1)+1));
7724
+                               return buf;
7725
+                       }
7726
+               } else return "BREAK";
7727
+       }
7728
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7729
+(define_insn "movdi_sto"
7730
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
7731
+               (match_operand:DI 1 "register_operand" "r"))]
7732
+       ""
7733
+       {
7734
+               if (REG_P(operands[0]))
7735
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
7736
+               else if (GET_CODE(operands[0])==PLUS) {
7737
+                       if ((REG_P(XEXP(operands[0],0)))
7738
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
7739
+                               static  char    buf[64];
7740
+                               sprintf(buf,
7741
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
7742
+                                       INTVAL(XEXP(operands[0],1)),
7743
+                                       INTVAL(XEXP(operands[0],1)+1));
7744
+                               return buf;
7745
+                       }
7746
+               } else return "BREAK";
7747
+       }
7748
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7749
+(define_insn "movdi_ldi"
7750
+       [(set (match_operand:DI 0 "register_operand" "=r")
7751
+               (match_operand:DI 1 "immediate_operand" "i"))]
7752
+       ""
7753
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
7754
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7755 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
7756
+       [(set (match_operand:DI 0 "register_operand" "=r")
7757 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
7758 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7759
+       ]
7760
+       ""
7761
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
7762
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7763
+;
7764
+(define_insn "subdi3"
7765
+       [(set (match_operand:DI 0 "register_operand" "=r")
7766 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
7767 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7768
+       ]
7769
+       ""
7770
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
7771
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7772
+;
7773
+(define_insn "anddi3"
7774
+       [(set (match_operand:DI 0 "register_operand" "=r")
7775
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
7776
+                       (match_operand:DI 2 "register_operand" "r")))
7777
+       ]
7778
+       ""
7779
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
7780
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7781
+;
7782
+(define_insn "iordi3"
7783
+       [(set (match_operand:DI 0 "register_operand" "=r")
7784
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
7785
+                       (match_operand:DI 2 "register_operand" "r")))
7786
+       ]
7787
+       ""
7788
+       "OR     %2,%0\n\tOR\t%H2,%H0"
7789
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7790
+;
7791
+(define_insn "xordi3"
7792
+       [(set (match_operand:DI 0 "register_operand" "=r")
7793
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
7794
+                       (match_operand:DI 2 "register_operand" "r")))
7795
+       ]
7796
+       ""
7797
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
7798
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7799
+;
7800
+(define_insn "negdi2"
7801
+       [(set (match_operand:DI 0 "register_operand" "=r")
7802
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))]
7803
+       ""
7804
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
7805
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7806
+;
7807
+(define_insn "absdi2"
7808
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7809
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7810
+       (clobber (match_scratch:SI 2 "=r"))]
7811
+       ""
7812
+       "CLR    %2
7813
+       TEST    %H0             ; Problem, we can't tell conditions
7814
+       LDILO.LT        1,%2
7815
+       XOR.LT  -1,%L0
7816
+       XOR.LT  -1,%H0
7817
+       ADD     %2,%L0
7818
+       ADD.C   %1,%HI"
7819
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7820
+(define_insn "one_cmpldi2"
7821
+       [(set (match_operand:DI 0 "register_operand" "=r")
7822
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
7823
+       ]
7824
+       ""
7825
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
7826
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7827
+(define_insn "umindi3"
7828
+       [(set (match_operand:DI 0 "register_operand" "=r")
7829
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
7830
+                       (match_operand:DI 2 "register_operand" "r")))
7831
+       ]
7832
+       ""
7833
+       "CMP    %H0,%H2
7834
+       CMP.Z   %L0,%L2
7835
+       MOV.C   %H2,%H0
7836
+       MOV.C   %L2,%L0"
7837
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7838
+(define_insn "umaxdi3"
7839
+       [(set (match_operand:DI 0 "register_operand" "=r")
7840
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
7841
+                       (match_operand:DI 2 "register_operand" "r")))
7842
+       ]
7843
+       ""
7844
+       "CMP    %H2,%H0
7845
+       CMP.Z   %L2,%L0
7846
+       MOV.C   %H2,%H0
7847
+       MOV.C   %L2,%L0"
7848
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7849
+(define_insn "popcountdi2"
7850
+       [(set (match_operand:SI 0 "register_operand" "=r")
7851
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7852
+       (clobber (match_scratch:SI 2 "=r"))
7853
+       ]
7854
+       ""
7855
+       "POPC   %L1,%0
7856
+       POPC    %H1,%2
7857
+       ADD     %2,%0"
7858
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7859
+(define_expand "paritydi2"
7860
+       [(set (match_operand:SI 0 "register_operand" "=r")
7861
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7862
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
7863
+       ])
7864 117 dgisselq
+;(define_insn "extendsidi2"
7865
+;      [(set (match_operand:DI 0 "register_operand" "=r")
7866
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
7867
+;      ""
7868
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
7869
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7870
+;(define_insn "mulsidi3"
7871
+;      [(set (match_operand:DI 0 "register_operand" "=r")
7872
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
7873
+;                      (match_operand:SI 2 "register_operand" "r")))
7874
+;      (clobber (match_scratch:SI 3 "=r"))]
7875
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7876
+;      ""
7877
+;      "MOV    %1,%L0
7878
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
7879
+;      MOV     %1,%3                   ; R3 = R1
7880
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
7881
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
7882
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
7883
+;      AND     0x0ffff,%3
7884
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
7885
+;      MOV     %2,%3
7886
+;      ROL     16,%3
7887
+;      MPYS    %1,%3
7888
+;      ROL     16,%3
7889
+;      AND     0x0ffff,%3
7890
+;      ADD     %3,%0"
7891
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7892
+
7893 102 dgisselq
+;
7894
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
7895
+;      mult:di, div:di, divu:di
7896
+;
7897
+;
7898
+;
7899
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7900
+;;
7901
+;; Conditional arithmetic instructions
7902
+;;
7903
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7904
+;
7905
+;
7906
+;
7907
+;
7908
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7909
+       [(set (cc0) (compare (match_operand:ZI 2 "register_operand" "r")
7910
+               (match_operand:ZI 3 "nonmemory_operand" "rO")))
7911
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7912
+                       (match_operator 1 "ordered_comparison_operator"
7913
+                                       [(cc0) (const_int 0)])
7914
+                       (const_int 1) (const_int 0)))]
7915
+       ""
7916
+       )
7917
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7918
+       [(set (match_operand:SI 0 "register_operand" "=r")
7919
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
7920
+                       [(compare (match_operand:DI 2 "register_operand" "r")
7921
+                               (match_operand:DI 3 "register_operand" "r"))])
7922
+                       (const_int 1) (const_int 0)))]
7923
+       ""
7924
+       {
7925
+               switch(GET_CODE(operands[1])) {
7926
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
7927
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
7928
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
7929
+               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";
7930
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
7931
+               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";
7932
+               default:
7933
+                       gcc_unreachable();
7934
+               }
7935
+       }
7936
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7937
+;
7938
+;
7939
+;
7940
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7941
+;;
7942
+;; Comparison instructions, both compare and test
7943
+;;
7944
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7945
+;
7946
+;
7947
+;
7948
+;; This will only work so well, since the direction of the compare is
7949
+;; important in unsigned compares.
7950
+;;
7951
+(define_insn "cmp<mode>"
7952
+       [(set (cc0) (compare (match_operand:ZI 0 "register_operand" "r")
7953
+               (match_operand:ZI 1 "nonmemory_operand" "rO")))]
7954
+       ""
7955
+       "CMP\t%1,%0"
7956
+       [(set_attr "ccresult" "set")])
7957
+(define_insn "cmp<mode>_off"
7958
+       [(set (cc0) (compare (match_operand:ZI 0 "register_operand" "r")
7959 117 dgisselq
+               (plus (match_operand:ZI 1 "register_operand" "r")
7960
+                       (match_operand 2 "const_int_operand" "N"))))]
7961 102 dgisselq
+       ""
7962
+       "CMP\t%2+%1,%0"
7963
+       [(set_attr "ccresult" "set")])
7964
+(define_insn "test<mode>"
7965
+       [(set (cc0) (compare (and:ZI (match_operand:ZI 0 "register_operand" "r")
7966
+                               (match_operand:ZI 1 "nonmemory_operand" "rO"))
7967
+                       (const_int 0)))]
7968
+       ""
7969
+       "TEST   %1,%0"
7970
+       [(set_attr "ccresult" "set")])
7971
+(define_insn "test<mode>_off"
7972
+       [(set (cc0) (compare (and:ZI (match_operand:ZI 0 "register_operand" "r")
7973
+                               (plus:ZI
7974
+                                 (match_operand:ZI 1 "register_operand" "r")
7975
+                                 (match_operand:ZI 2 "const_int_operand" "N")))
7976
+                       (const_int 0)))]
7977
+       ""
7978
+       "TEST   %2+%1,%0"
7979
+       [(set_attr "ccresult" "set")])
7980
+(define_insn "nop"
7981
+       [(const_int 0)]
7982
+       ""
7983
+       "NOOP"
7984
+       [(set_attr "ccresult" "unchanged")])
7985
+;
7986
+;
7987
+;
7988
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7989
+;;
7990
+;; Conditional execution predicates
7991
+;;
7992
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7993
+;
7994
+; Sadly, these aren't complete like they should be.  Although these are all of
7995
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
7996
+; other conditions then these.  That is, (cond_exec ...) is not as well
7997
+; recognized as (if_then_else ...).  So we have to duplicate things to support
7998
+; both methods.
7999
+;
8000
+(define_cond_exec
8001
+       [(ne (cc0) (const_int 0))]
8002
+       ""
8003
+       "(NZ)"
8004
+       [(set_attr "conditional" "yes")])
8005
+(define_cond_exec
8006
+       [(lt (cc0) (const_int 0))]
8007
+       ""
8008
+       "(LT)"
8009
+       [(set_attr "conditional" "yes")])
8010
+(define_cond_exec
8011
+       [(eq (cc0) (const_int 0))]
8012
+       ""
8013
+       "(Z)"
8014
+       [(set_attr "conditional" "yes")])
8015
+(define_cond_exec
8016
+       [(gt (cc0) (const_int 0))]
8017
+       ""
8018
+       "(GT)"
8019
+       [(set_attr "conditional" "yes")])
8020
+(define_cond_exec
8021
+       [(ge (cc0) (const_int 0))]
8022
+       ""
8023
+       "(GE)"
8024
+       [(set_attr "conditional" "yes")])
8025
+(define_cond_exec
8026
+       [(ltu (cc0) (const_int 0))]
8027
+       ""
8028
+       "(C)"
8029
+       [(set_attr "conditional" "yes")])
8030
+;
8031
+;
8032
+;
8033
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8034
+;;
8035
+;; Conditional move instructions, since these won't accept conditional
8036
+;;     execution RTL
8037
+;;
8038
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8039
+;
8040
+; // Look for #define HAVE_conditional_move to understand how these might be
8041
+; // used.
8042
+;
8043
+(define_insn "set_zero_or_one<mode>"
8044
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8045
+                       (match_operator 1 "ordered_comparison_operator"
8046
+                                       [(cc0) (const_int 0)])
8047
+                       (const_int 1) (const_int 0)))]
8048
+       ""
8049
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
8050
+       }
8051
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8052
+(define_insn "mov<mode>cc"
8053
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8054
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8055
+                       [(cc0) (const_int 0)])
8056
+                       (match_operand:ZI 2 "general_operand" "rio")
8057
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
8058
+       ""
8059
+       {
8060
+       return zip_movsicc(operands[0], operands[1], operands[2], operands[3]);
8061
+       }
8062
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8063
+(define_insn "add<mode>cc"
8064
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
8065
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8066
+                       [(cc0) (const_int 0)])
8067
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
8068
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
8069
+                       (match_dup 0)))]
8070
+       ""
8071
+       {
8072
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
8073
+       }
8074
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8075
+;
8076
+;
8077
+;(define_expand "mov<mode>cc"
8078
+;      [(set (match_operand:ZI 0 "general_operand" "=rm,rm,r,r,r"
8079
+;              (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8080
+;                      [(cc0) (const_int 0)])
8081
+;                      (match_operand:ZI 2 "general_operand" "0,r,0,m,rm")
8082
+;                      (match_operand:ZI 3 "general_operand" "r,0,m,0,rm"))))]
8083
+;      )
8084
+;
8085
+;
8086
+;
8087
+; While an interesting approach, the following suffers from problems when the
8088
+; move amount is constant.  At anything less than four, moves should not require
8089
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
8090
+; are not required and should result in a hardcoded result.  Practically,
8091
+; though, this should really be a define_expand instruction, calling on the
8092
+; RTX's of all the respective subinstructions found below.
8093
+;
8094
+;(define_insn "movmemSI"
8095
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
8096
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
8097
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
8098
+;              (match_operand 3 "" "")                 ;Alignment
8099
+;              (clobber (match_scratch:SI 4 "=r"))
8100
+;              (clobber (match_scratch:SI 5 "=r"))
8101
+;              (clobber (match_scratch:SI 6 "=r"))
8102
+;              (clobber (match_scratch:SI 7 "=r"))]
8103
+;      ""
8104
+;      "TEST\t1,%2
8105
+;      LOD.NZ\t%1,%4
8106
+;      STO.NZ\t%4,%0
8107
+;      ADD.NZ\t1,%0
8108
+;      ADD.NZ\t1,%1
8109
+;      TEST\t2,%2
8110
+;      LOD.NZ\t%1,%4
8111
+;      LOD.NZ\t1(%1),%5
8112
+;      STO.NZ\t%4,(%0)
8113
+;      STO.NZ\t%4,1(%0)
8114
+;      ADD.NZ\t2,%0
8115
+;      ADD.NZ\t2,%1
8116
+;      AND\t-4,%2
8117
+;      BZ\t.Lskp%=\n.Ltop%=:
8118
+;      LOD\t(%1),%4
8119
+;      LOD\t1(%1),%5
8120
+;      LOD\t2(%1,%6
8121
+;      LOD\t3(%1),%7
8122
+;      STO\t%4,(%1)
8123
+;      STO\t%5,1(%1)
8124
+;      STO\t%6,2(%1)
8125
+;      STO\t%7,3(%1)
8126
+;      SUB\t4,%2
8127
+;      BZ\t%.Lskp%=
8128
+;      BRA\t.Ltop%=\n.Lskp%=:"
8129
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8130
+;(define_insn "setmemsi"
8131
+;      [(parallel
8132
+;              [(set (mem:BLK
8133
+;                      (match_operand 0 "register_operand" "+r")); Destination
8134
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8135
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8136
+;              (match_operand 3 "" "")]
8137
+;      ""
8138
+;      "TEST\t1,%1
8139
+;      STO.NZ\t%2,(%0)
8140
+;      ADD.NZ\t1,%0
8141
+;      TEST\t2,%1
8142
+;      STO.NZ\t%2,(%0)
8143
+;      STO.NZ\t%2,1(%0)
8144
+;      ADD.NZ\t2,%0
8145
+;      AND\t-4,%1
8146
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8147
+;      STO\t%2,(%0)
8148
+;      STO\t%2,1(%0)
8149
+;      STO\t%2,2(%0)
8150
+;      STO\t%2,3(%0)
8151
+;      SUB\t%4,%0
8152
+;      BZ\t.Lskp%=
8153
+;      BRA\t.Ltop%=\n.Lskp%=:"
8154
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8155
+;;
8156
+;
8157
+;
8158
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8159
+;;
8160
+;; Control flow instructions
8161
+;;
8162
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8163
+;
8164
+;
8165
+;
8166
+(define_expand "jump"
8167
+       [(set (pc)
8168
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8169
+(define_insn "jump_const"      ; Must be modeless, VOIDmode, not SI or any othr
8170
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8171
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8172
+       ""
8173
+       "BRA    %0"
8174
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8175
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8176
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8177
+               (label_ref (match_operand 0 "" "")))]
8178
+       ""
8179
+       "BRA    %0"
8180
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8181
+;
8182
+; This is really the same thing as an indirect jump ... the big difference
8183
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8184
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8185
+; should be able to catch and except on it ...)
8186
+;
8187
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8188
+(define_insn "jump_variable"
8189
+       [(set (pc)
8190
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8191
+       ""
8192
+       "JMP    %0"
8193
+       [(set_attr "ccresult" "unchanged")])
8194
+;
8195
+; Indirect jumps ... both to registers, and registers plus offsets
8196
+;
8197
+(define_insn "indirect_jump"
8198
+       [(set (pc)
8199
+               (match_operand:SI 0 "register_operand" "r"))]
8200
+       ""
8201
+       "JMP    %0"
8202
+       [(set_attr "ccresult" "unchanged")])
8203
+(define_insn "indirect_jump_mem"
8204
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8205
+       ""
8206
+       "LOD    %0,PC"
8207
+       [(set_attr "ccresult" "unchanged")])
8208
+(define_insn "indirect_jump_off"
8209
+       [(set (pc)
8210
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8211
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8212
+       ""
8213
+       "JMP    %1(%0)"
8214
+       [(set_attr "ccresult" "unchanged")])
8215
+;;
8216
+; cbranchsi4
8217
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8218
+;;     Op 1&2 the operands of the compare instruction
8219
+;;     Op 3 is the jump label
8220
+;;
8221
+;;
8222
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8223
+;;
8224
+(define_expand "cbranch<mode>4"
8225
+       [(set (cc0) (compare (match_operand:ZI 1 "register_operand" "r")
8226
+               (match_operand:ZI 2 "nonmemory_operand" "rO")))
8227
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8228
+                       [(cc0) (const_int 0)])
8229
+                       (label_ref (match_operand 3 "" ""))
8230
+                       (pc)))]
8231
+       ""
8232
+       {
8233 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
8234 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
8235
+               //; Let's check for these two branch codes, and swap the
8236
+               //; comparison to simplify them.
8237
+               // fprintf(stderr, "CBRANCH\n");
8238 117 dgisselq
+               // zip_debug_rtx_pfx("- CMP: ", operands[0]);
8239
+               // zip_debug_rtx_pfx("- A  : ", operands[1]);
8240
+               // zip_debug_rtx_pfx("- B  : ", operands[2]);
8241
+               // zip_debug_rtx_pfx("- JMP: ", operands[3]);
8242
+               //; Can we do better if we reverse some compares?
8243 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
8244
+                       // fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
8245
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8246
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
8247
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8248
+                       DONE;
8249
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
8250 103 dgisselq
+                       // fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
8251 102 dgisselq
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8252
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
8253
+                       emit_jump_insn(gen_cbranch_jmp_leu(operands[3]));
8254
+                       DONE;
8255 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
8256
+                       // fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
8257
+                       //; Swap operands, turn into a GTE compare
8258
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8259
+                               gen_rtx_COMPARE(VOIDmode, operands[2], operands[1])));
8260
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
8261
+                       DONE;
8262 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
8263
+
8264
+               //; Except ... we can do better for some instructions, such as
8265
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
8266
+               //; would be difficult to explain to users why MIN_INT didn't
8267
+               //; compare properly.  Hence we only adjust constant integers.
8268
+               //;
8269
+               if ((GET_CODE(operands[0])==LE)
8270
+                               &&(CONST_INT_P(operands[2]))
8271 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8272 102 dgisselq
+                       // fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
8273
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8274
+                               gen_rtx_COMPARE(VOIDmode, operands[1],
8275
+                                       GEN_INT(INTVAL(operands[2])+1))));
8276 111 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8277 102 dgisselq
+                       DONE;
8278
+               } else if ((GET_CODE(operands[0])==LEU)
8279
+                               &&(CONST_INT_P(operands[2]))
8280
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8281
+                       // fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
8282
+                       emit_insn(gen_rtx_SET(VOIDmode, cc0_rtx,
8283
+                               gen_rtx_COMPARE(VOIDmode, operands[1],
8284
+                                       GEN_INT(INTVAL(operands[2])+1))));
8285 111 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8286 102 dgisselq
+                       DONE;
8287
+               }
8288
+       })
8289
+(define_insn "cbranch_jmp_eq"
8290
+       [(set (pc) (if_then_else (eq (cc0) (const_int 0))
8291
+                (label_ref (match_operand 0 "" ""))
8292
+                (pc)))]
8293
+       ""
8294
+       "BZ\t%0"
8295
+       [(set_attr "predicable" "no")
8296
+               (set_attr "conditional" "yes")
8297
+               (set_attr "ccresult" "unchanged")])
8298
+(define_insn "cbranch_jmp_neq"
8299
+       [(set (pc) (if_then_else (ne (cc0) (const_int 0))
8300
+                (label_ref (match_operand 0 "" ""))
8301
+                (pc)))]
8302
+       ""
8303
+       "BNZ\t%0"
8304
+       [(set_attr "predicable" "no")
8305
+               (set_attr "conditional" "yes")
8306
+               (set_attr "ccresult" "unchanged")])
8307
+(define_insn "cbranch_jmp_lt"
8308
+       [(set (pc) (if_then_else (lt (cc0) (const_int 0))
8309
+                (label_ref (match_operand 0 "" ""))
8310
+                (pc)))]
8311
+       ""
8312
+       "BLT\t%0"
8313
+       [(set_attr "predicable" "no")
8314
+               (set_attr "conditional" "yes")
8315
+               (set_attr "ccresult" "unchanged")])
8316
+(define_insn "cbranch_jmp_le"
8317
+       [(set (pc) (if_then_else (le (cc0) (const_int 0))
8318
+                (label_ref (match_operand 0 "" ""))
8319
+                (pc)))]
8320
+       ""
8321
+       "BLT\t%0
8322
+       BZ\t%0"
8323
+       [(set_attr "predicable" "no")
8324
+               (set_attr "conditional" "yes")
8325
+               (set_attr "ccresult" "unchanged")])
8326
+(define_insn "cbranch_jmp_gt"
8327
+       [(set (pc) (if_then_else (gt (cc0) (const_int 0))
8328
+                (label_ref (match_operand 0 "" ""))
8329
+                (pc)))]
8330
+       ""
8331
+       "BGT\t%0"
8332
+       [(set_attr "predicable" "no")
8333
+               (set_attr "conditional" "yes")
8334
+               (set_attr "ccresult" "unchanged")])
8335
+(define_insn "cbranch_jmp_ge"
8336
+       [(set (pc) (if_then_else (ge (cc0) (const_int 0))
8337
+                (label_ref (match_operand 0 "" ""))
8338
+                (pc)))]
8339
+       ""
8340
+       "BGE\t%0"
8341
+       [(set_attr "predicable" "no")
8342
+               (set_attr "conditional" "yes")
8343
+               (set_attr "ccresult" "unchanged")])
8344
+(define_insn "cbranch_jmp_ltu"
8345
+       [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
8346
+                (label_ref (match_operand 0 "" ""))
8347
+                (pc)))]
8348
+       ""
8349
+       "BC\t%0"
8350
+       [(set_attr "predicable" "no")
8351
+               (set_attr "conditional" "yes")
8352
+               (set_attr "ccresult" "unchanged")])
8353
+(define_insn "cbranch_jmp_gtu"
8354
+       [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
8355
+                (label_ref (match_operand 0 "" ""))
8356
+                (pc)))]
8357
+       ""      ; Flip the condition, and then we can jump
8358
+       "XOR\t2,CC
8359
+       BC\t%0"
8360
+       [(set_attr "predicable" "no")
8361
+               (set_attr "conditional" "yes")
8362
+               (set_attr "ccresult" "unknown")])
8363
+(define_insn "cbranch_jmp_leu"
8364
+       [(set (pc) (if_then_else (leu (cc0) (const_int 0))
8365
+                (label_ref (match_operand 0 "" ""))
8366
+                (pc)))]
8367
+       ""      ; Need to check for both LTU (i.e. C) and Z
8368
+       "BC\t%0
8369
+       BZ\t%0"
8370
+       [(set_attr "predicable" "no")
8371
+               (set_attr "conditional" "yes")
8372
+               (set_attr "ccresult" "unchanged")])
8373
+(define_insn "cbranch_jmp_geu"
8374
+       [(set (pc) (if_then_else (geu (cc0) (const_int 0))
8375
+                (label_ref (match_operand 0 "" ""))
8376
+                (pc)))]
8377
+       ""      ; Flip the comparison, then check for GEU (once flipped)a
8378
+               ; Z is naturally checked for, as C would've never been set on Z
8379
+               ; so by flipping it, it is tantamount to saying Z or GTU.
8380
+       "BZ\t%0
8381
+       XOR\t2,CC
8382
+       BC\t%0"
8383
+       [(set_attr "predicable" "no")
8384
+               (set_attr "conditional" "yes")
8385
+               (set_attr "ccresult" "unknown")])
8386
+(define_insn "cbranchdi4"
8387
+       [(set (pc) (if_then_else
8388
+               (match_operator 0 "ordered_comparison_operator"
8389
+                       [(match_operand:DI 1 "register_operand" "r")
8390
+                               (match_operand:DI 2 "nonmemory_operand" "rO")])
8391
+                       (label_ref (match_operand 3 "" ""))
8392
+                       (pc)))
8393
+       (clobber (cc0))]
8394
+       ""
8395
+       {
8396
+               switch(GET_CODE(operands[0])) {
8397
+               case EQ:
8398
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
8399
+               case NE:
8400
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
8401
+               case LE:
8402
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8403
+               case GT:
8404
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
8405
+               case LT:
8406
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
8407
+               case GE:
8408
+                       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%=:";
8409
+               case LTU:
8410
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
8411
+               case LEU:
8412
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8413
+               case GTU:
8414
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
8415
+               case GEU:
8416
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
8417
+               default:
8418
+                       gcc_unreachable();
8419
+               }
8420
+       }
8421
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8422
+;
8423
+;
8424
+;
8425
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8426
+;;
8427
+;; Subroutine call
8428
+;;
8429
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8430
+;
8431
+;
8432
+; There are two types of calls: "call" and "call_value".
8433
+;
8434
+; Each of these types of calls are then expanded into one of:
8435
+;
8436
+;      _const          - A call to a constant address, such as a symbol
8437
+;                      reference or a fixed location
8438
+;
8439
+;      _label          - This should be the same as _const, except that for
8440
+;                      some reason the RTL and matching rules are separate.
8441
+;                      Hence we have a separate rule for this.
8442
+;
8443
+;      _mem            - The memory address we wish to jump to is stored in
8444
+;                      memory somewhere, and we have only a pointer.  In this
8445
+;                      case, we load that pointer straight to the PC and go.
8446
+;
8447
+;      _var            - The address to jump to is given as an offset to a
8448
+;                      register, such as X+R3.  This is an indirect jump.
8449
+;                      Although we support it, it does require different RTL
8450
+;                      code.
8451
+;
8452
+(define_expand "call"
8453
+       [(call (match_operand 0 "" "")
8454
+               (match_operand 1 "" ""))]
8455
+       ""
8456
+       {
8457
+               if (MEM_P(operands[0])) {
8458
+                       // This should always be the case
8459
+                       rtx addr = XEXP(operands[0],0);
8460
+                       if (zip_const_address_operand_p(addr, SImode)) {
8461
+                               // fprintf(stderr, "Generating gen_void_call_const()\n");
8462
+                               emit_call_insn(gen_void_call_const(addr,
8463
+                                               operands[1]));
8464
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
8465
+                                                       XEXP(addr,0)))) {
8466
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
8467
+                                                                operands[1]));
8468
+                       } else {
8469
+                               emit_call_insn(gen_void_call_var(addr,
8470
+                                                                operands[1]));
8471
+                       }
8472
+                       DONE;
8473
+               }
8474
+       })
8475
+;
8476
+;
8477
+;
8478
+; How do we want to do this better?
8479
+;      Replace the RTL w/
8480
+;              return_label= gen_label_rtx();
8481
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
8482
+;                      gen_rtx_REG(zip_PC),return_label));
8483
+;              emit_jump(label_rtx(
8484
+;
8485
+;              emit_label(return_label);
8486
+;
8487
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
8488
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
8489
+; label gets removed and the call gets lost.  Hence we do it this way (below).
8490
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
8491
+; recognize as such, but for now we'll use .Lcall# as our label.
8492
+;
8493
+(define_insn "void_call_const"
8494
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8495 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8496 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8497
+       ""
8498
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8499
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8500
+(define_insn "void_call_mem"
8501 111 dgisselq
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8502
+                       (match_operand 1 "const_int_operand" "n"))
8503 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8504
+       ""
8505
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
8506
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8507
+;
8508
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8509
+(define_insn "void_call_var"
8510
+       [(parallel [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8511 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8512 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8513
+       ""
8514
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
8515
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8516
+(define_expand "call_value"
8517
+       [(set (reg:SI RTNV_REG)
8518
+               (call (match_operand:SI 1 "" "")
8519 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
8520 102 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))]
8521
+       ""
8522
+       {
8523
+               // extern void zip_debug_rtx(const_rtx);
8524
+               // fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
8525
+               // zip_debug_rtx(operands[1]);
8526
+               if (MEM_P(operands[1])) {
8527
+                       // fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
8528
+                       // zip_debug_rtx(operands[1]);
8529
+                       // This should always be the case
8530
+                       rtx addr = XEXP(operands[1],0);
8531
+                       if (zip_const_address_operand_p(addr, SImode)) {
8532
+                               // fprintf(stderr, "Generating gen_reg_call_const()\n");
8533
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
8534
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
8535
+                               // fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8536
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
8537
+                       } else {
8538
+                               // fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8539
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
8540
+                       }
8541
+                       DONE;
8542
+               }
8543
+       })
8544
+(define_insn "reg_call_const"
8545
+       [(parallel [(set (reg:SI RTNV_REG)
8546
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8547 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8548 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8549
+       ""
8550
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8551
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8552
+(define_insn "reg_call_mem"
8553
+       [(set (reg:SI RTNV_REG)
8554 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8555
+                       (match_operand 1 "const_int_operand" "n")))
8556 102 dgisselq
+               (clobber (reg:SI RTN_REG))]
8557
+       ""
8558 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
8559 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8560 111 dgisselq
+;
8561 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8562
+(define_insn "reg_call_var"
8563
+       [(parallel [(set (reg:SI RTNV_REG)
8564
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8565 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8566 102 dgisselq
+               (clobber (reg:SI RTN_REG))])]
8567
+       ""
8568 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
8569 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8570
+;
8571
+;
8572
+;
8573
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8574
+;;
8575
+;; Frame manipulation RTX
8576
+;;
8577
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8578
+;
8579
+;
8580
+;
8581
+(define_expand "prologue"
8582
+       [(const_int 0)]
8583
+       ""
8584
+       "{ zip_expand_prologue(); DONE; }")
8585
+(define_expand "epilogue"
8586
+       [(return)]
8587
+       ""
8588
+       "{ zip_expand_epilogue(); DONE; }")
8589
+(define_expand "return" ; In order to use the function predicate, this *must*
8590
+       [(return)]      ; be a define_expand
8591
+       "zip_use_return_insn()")
8592
+       ; "JMP  R0"
8593
+       ; [(set_attr "ccresult" "unchanged")])
8594
+(define_insn "*return" ; A "*" -- means it cannot be called from C
8595
+       [(return)]
8596
+       ""
8597
+       "JMP    R0"
8598
+       [(set_attr "ccresult" "unchanged")])
8599
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
8600
+       [(simple_return)]
8601
+       ""
8602
+       "JMP    R0"
8603
+       [(set_attr "ccresult" "unchanged")])
8604
+;
8605
+;
8606
+;
8607
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8608
+;;
8609
+;; Zip Builtin Functions
8610
+;;
8611
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8612
+;
8613
+;
8614
+;
8615
+(define_insn "zip_rtu"
8616
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
8617
+       (clobber (cc0))]
8618
+       "(!ZIP_USER)"
8619
+       "RTU"
8620
+       [(set_attr "ccresult" "unknown")])
8621
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
8622
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
8623
+       (clobber (cc0))]
8624
+       "(!ZIP_USER)"
8625
+       "HALT"
8626
+       [(set_attr "ccresult" "unknown")])
8627
+(define_insn "zip_idle"
8628
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
8629
+       (clobber (cc0))]
8630
+       ""
8631
+       "WAIT"
8632
+       [(set_attr "ccresult" "unknown")])
8633
+(define_insn "zip_syscall"
8634
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
8635
+       ""
8636
+       "CLR\tCC"
8637
+       [(set_attr "ccresult" "unknown")])
8638
+;
8639
+;
8640
+; Operator "save_context"
8641
+;
8642 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
8643
+;      if we don't list it as a "+r" register, the compiler may allocate it
8644
+;      among the other registers, thus we clobber it in the middle of the
8645
+;      operation before the task is complete.
8646 102 dgisselq
+;
8647
+(define_insn "zip_save_context"
8648 117 dgisselq
+       [(unspec_volatile
8649
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
8650 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
8651
+               (clobber (match_scratch:SI 1 "=r"))
8652
+               (clobber (match_scratch:SI 2 "=r"))
8653
+               (clobber (match_scratch:SI 3 "=r"))
8654 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
8655 102 dgisselq
+       "(!ZIP_USER)"
8656
+       "MOV\tuR0,%1
8657
+       MOV\tuR1,%2
8658
+       MOV\tuR2,%3
8659
+       MOV\tuR3,%4
8660
+       STO\t%1,%0
8661
+       STO\t%2,1(%0)
8662
+       STO\t%3,2(%0)
8663
+       STO\t%4,3(%0)
8664
+       MOV\tuR4,%1
8665
+       MOV\tuR5,%2
8666
+       MOV\tuR6,%3
8667
+       MOV\tuR7,%4
8668
+       STO\t%1,4(%0)
8669
+       STO\t%2,5(%0)
8670
+       STO\t%3,6(%0)
8671
+       STO\t%4,7(%0)
8672
+       MOV\tuR8,%1
8673
+       MOV\tuR9,%2
8674
+       MOV\tuR10,%3
8675
+       MOV\tuR11,%4
8676
+       STO\t%1,8(%0)
8677
+       STO\t%2,9(%0)
8678
+       STO\t%3,10(%0)
8679
+       STO\t%4,11(%0)
8680
+       MOV\tuR12,%1
8681
+       MOV\tuSP,%2
8682
+       MOV\tuCC,%3
8683
+       MOV\tuPC,%4
8684
+       STO\t%1,12(%0)
8685
+       STO\t%2,13(%0)
8686
+       STO\t%3,14(%0)
8687
+       STO\t%4,15(%0)"
8688
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8689 117 dgisselq
+;
8690
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
8691
+; even though we don't really read (or change) its value throughout this
8692
+; operation.
8693
+;
8694 102 dgisselq
+(define_insn "zip_restore_context"
8695
+       [(unspec_volatile [
8696 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
8697 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
8698
+       (clobber (match_scratch:SI 2 "=r"))
8699
+       (clobber (match_scratch:SI 3 "=r"))
8700 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
8701 102 dgisselq
+       "(!ZIP_USER)"
8702
+       "LOD\t0(%0),%1
8703
+       LOD\t1(%0),%2
8704
+       LOD\t2(%0),%3
8705
+       LOD\t3(%0),%4
8706
+       MOV\t%1,uR0
8707
+       MOV\t%2,uR1
8708
+       MOV\t%3,uR2
8709
+       MOV\t%4,uR3
8710
+       LOD\t4(%0),%1
8711
+       LOD\t5(%0),%2
8712
+       LOD\t6(%0),%3
8713
+       LOD\t7(%0),%4
8714
+       MOV\t%1,uR4
8715
+       MOV\t%2,uR5
8716
+       MOV\t%3,uR6
8717
+       MOV\t%4,uR7
8718
+       LOD\t8(%0),%1
8719
+       LOD\t9(%0),%2
8720
+       LOD\t10(%0),%3
8721
+       LOD\t11(%0),%4
8722
+       MOV\t%1,uR8
8723
+       MOV\t%2,uR9
8724
+       MOV\t%3,uR10
8725
+       MOV\t%4,uR11
8726
+       LOD\t12(%0),%1
8727
+       LOD\t13(%0),%2
8728
+       LOD\t14(%0),%3
8729
+       LOD\t15(%0),%4
8730
+       MOV\t%1,uR12
8731
+       MOV\t%2,uSP
8732
+       MOV\t%3,uCC
8733
+       MOV\t%4,uPC"
8734
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8735
+(define_insn "zip_bitrev"
8736
+       [(set (match_operand:SI 0 "register_operand" "=r")
8737
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
8738
+       ]
8739
+       ""
8740
+       "BREV\t%1,%0"
8741
+       [(set_attr "ccresult" "set")])
8742
+(define_insn "zip_cc"
8743
+       [(set (match_operand:SI 0 "register_operand" "=r")
8744
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8745
+       ""
8746
+       "MOV\tCC,%0"
8747
+       [(set_attr "ccresult" "unchanged")])
8748 117 dgisselq
+(define_insn "zip_ucc"
8749
+       [(set (match_operand:SI 0 "register_operand" "=r")
8750
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
8751
+       ""
8752
+       "MOV\tuCC,%0"
8753
+       [(set_attr "ccresult" "unchanged")])
8754 111 dgisselq
+(define_insn "zip_cc_sto"
8755
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
8756 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8757 111 dgisselq
+       ""
8758
+       "STO\tCC,(%0)"
8759
+       [(set_attr "ccresult" "unchanged")])
8760
+(define_insn "zip_cc_sto_off"
8761
+       [(set (mem:SI (plus:SI
8762
+                       (match_operand:SI 0 "register_operand" "r")
8763
+                       (match_operand:SI 1 "const_int_operand" "N")))
8764 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8765 111 dgisselq
+       ""
8766
+       "STO\tCC,%1(%0)"
8767
+       [(set_attr "ccresult" "unchanged")])
8768 102 dgisselq
+(define_insn "ldilo"
8769
+       [(set (match_operand:SI 0 "register_operand" "=r")
8770
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
8771
+       ""
8772
+       "LDILO  %1,%0"
8773
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8774
+
8775
+;
8776
+;
8777
+;
8778
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8779
+;;
8780
+;; Floating point Op-codes
8781
+;;
8782
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8783
+;
8784
+;
8785
+;
8786
+(define_insn "addsf3"
8787
+       [(set (match_operand:SF 0 "register_operand" "=r")
8788
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
8789
+                       (match_operand:SF 2 "register_operand" "r")))]
8790
+       "(ZIP_FPU)"
8791
+       "FPADD  %2,%0"
8792
+       [(set_attr "ccresult" "unknown")])
8793
+(define_insn "subsf3"
8794
+       [(set (match_operand:SF 0 "register_operand" "=r")
8795
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
8796
+                       (match_operand:SF 2 "register_operand" "r")))]
8797
+       "(ZIP_FPU)"
8798
+       "FPSUB  %2,%0"
8799
+       [(set_attr "ccresult" "unknown")])
8800
+(define_insn "mulsf3"
8801
+       [(set (match_operand:SF 0 "register_operand" "=r")
8802
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
8803
+                       (match_operand:SF 2 "register_operand" "r")))]
8804
+       "(ZIP_FPU)"
8805
+       "FPMUL  %2,%0"
8806
+       [(set_attr "ccresult" "unknown")])
8807
+(define_insn "divsf3"
8808
+       [(set (match_operand:SF 0 "register_operand" "=r")
8809
+               (div:SF (match_operand:SF 1 "register_operand" "0")
8810
+                       (match_operand:SF 2 "register_operand" "r")))]
8811
+       "(ZIP_FPU)"
8812
+       "FPDIV  %2,%0"
8813
+       [(set_attr "ccresult" "unknown")])
8814 111 dgisselq
+(define_expand "negsf2"
8815
+       [(set (match_operand:SF 0 "register_operand" "=r")
8816
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
8817
+       ]
8818
+       ""
8819
+       {
8820
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8821
+               if (can_create_pseudo_p()) {
8822
+                       rtx tmp = gen_reg_rtx(SImode);
8823
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
8824
+                       emit_insn(gen_rtx_SET(SImode, operands[0], gen_rtx_XOR(SImode, operands[0], tmp)));
8825
+                       DONE;
8826
+               } else {
8827
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8828
+                       emit_insn(gen_rtx_SET(SImode, operands[0], gen_rtx_IOR(SImode, operands[0],gen_int_mode(1,SImode))));
8829
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8830
+                       DONE;
8831
+               }
8832
+       })
8833
+(define_expand "abssf2"
8834
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8835
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
8836
+       ]
8837
+       ""
8838
+       {
8839
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8840
+               if (can_create_pseudo_p()) {
8841
+                       rtx tmp = gen_reg_rtx(SImode);
8842
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
8843
+                       emit_insn(gen_rtx_SET(SImode, operands[0], gen_rtx_AND(SImode, operands[0], tmp)));
8844
+                       DONE;
8845
+               } else {
8846
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8847
+                       emit_insn(gen_rtx_SET(SImode, operands[0],
8848
+                               gen_rtx_AND(SImode, operands[0],
8849
+                               gen_int_mode(-2,SImode))));
8850
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8851
+                       DONE;
8852
+               }
8853
+       })
8854 102 dgisselq
+;
8855
+;
8856
+;
8857
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8858
+;;
8859
+;; Trap Instruction
8860
+;;
8861
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8862
+;
8863
+;
8864
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
8865
+; *nothing* should ever trap, and so we should never get here.  However, the
8866
+; compiler seems to want a trap instruction for some reason.  (It keeps us
8867
+; from calling the abort() function, if we don't define these ...)  So let's
8868
+; just grab onto the break instruction and declare it to be a trap instruction
8869
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
8870
+; will work for both user and system instructions.
8871
+;
8872
+(define_insn "trap"
8873
+       [(trap_if (const_int 1) (const_int 0))]
8874
+       ""
8875
+       "BREAK"
8876
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8877
+;
8878
+(define_expand "ctrap<mode>4"
8879
+       [(set (cc0) (compare (match_operand:ZI 1 "register_operand" "r")
8880
+               (match_operand:ZI 2 "nonmemory_operand" "rO")))
8881
+       (trap_if (match_operator 0 "ordered_comparison_operator"
8882
+                       [(cc0) (const_int 0)])
8883
+                       (match_operand 3 "const_int_operand" "O"))]
8884
+       ""
8885
+       )
8886
+(define_insn "trapif"
8887
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
8888
+                       [(cc0) (const_int 0)])
8889
+                       (match_operand 1 "const_int_operand" "O"))]
8890
+       ""
8891
+       "BREAK\t%1"
8892
+       [(set_attr "predicable" "no")])
8893
+;
8894
+;
8895
+;
8896
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8897
+;;
8898
+;; Unimplemented (or not yet implemented) RTL Codes
8899
+;;
8900
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8901
+;
8902
+;
8903
+;
8904
+; The book says that add<mode>3 is used if addptr<mode>3 is undefined.
8905
+; Hence we leave this as unimplemented.
8906
+;
8907
+;(define_insn "addptrsi3"
8908
+;      [(set (match_operand:SI 0 "register_operand" "=r")
8909
+;              (plus:SI (match_operand:SI 1 "register_operand" "r")
8910
+;                      (match_operand:SI 2 "general_operand" "M")))]
8911
+;      ; Addptr is not allowed to clobber condition codes, thus we *must*
8912
+;      ; use the mov (A+B),C form of the add.
8913
+;      ""
8914
+;      "MOV    %2(%1),%0"
8915
+;      [(set_attr "ccresult" "unchanged")])
8916
+;
8917
+; (define_insn "casesi"
8918
+;      "LDI    %4,R0
8919
+;      SUB     %2,%1
8920
+;      BLT     %5
8921
+;      CMP     %3,%1
8922
+;      BGT     %5
8923
+;      ADD     %1,R0
8924
+;      LOD     (R0),pc"
8925
+;      "")
8926
+; (define_insn "decrement_and_branch_until_zero"
8927
+       ; [(parallel [
8928
+               ; (set (match_operand:SI 0 "regiser_operand" "r")
8929
+                       ; (minus:SI (match_dup 0) (const_int 1)))
8930
+               ; (set (pc) (if_then_else
8931
+                               ; (ge (minus:SI (match_dup 0) (const_int 1)))
8932
+                               ; (label_ref (match_operand 1 "" ""))
8933
+                               ; (pc)))])]
8934
+       ; ""
8935
+; ;    SUB     1,%0
8936
+; ;    BNZ     %1
8937
+; ;     .vice the faster (optimize for speed)
8938
+       ; "SUB  1,%0
8939
+       ; BZ    %=
8940
+       ; BRA   %1
8941
+       ; %=:"
8942
+       ; [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8943
+; doloop_end - do not define--would require cost of an unopt register to use
8944
+; allocate_stack       - do not define ...
8945
+; nonlocal_goto - do not define
8946
+;(define_insn "ctrapmm4"
8947
+;      CMP     %1,%2
8948
+;      MOV.%0  %3,R0
8949
+;      LDILO.%0 0,(CC)
8950
+;
8951
+;(define_insn "sync_compare_and_swapsi"
8952
+;      [(set ...
8953
+;              )]
8954
+;      "(ZIP_ATMOC)"
8955
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
8956
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
8957
+;      CMP     %0,%2   DCD-valid
8958
+;      STO.Z   %2,%1   PF-valid
8959
+;
8960
+;(define_insn "sync_lock_test_and_setsi"
8961
+;      LOCK
8962
+;      LOD     %1,%0
8963
+;      STO     %0,%1
8964
+;
8965
+;(define_insn "sync_lock_releasesi"
8966
+;      STO     %1,%0
8967
+;
8968
+;
8969
+;(define_insn "negvsi3"
8970
+;      "MOV    %1,%0
8971
+;      XOR     -1,%0
8972
+;      ADD     1,%0
8973
+;      BV      %2"
8974
+;      "")
8975
+
8976 117 dgisselq
+(define_peephole2
8977
+       [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
8978
+               (match_operand:SI 1 "register_operand" "")))
8979
+       (set (pc) (if_then_else (gtu (cc0) (const_int 0))
8980
+                       (label_ref (match_operand 2 "" ""))
8981
+                       (pc)))]
8982
+       ""
8983
+       [(set (cc0) (compare (match_dup 1) (match_dup 0)))
8984
+       (set (pc) (if_then_else (ltu (cc0) (const_int 0))
8985
+                       (label_ref (match_dup 2))
8986
+                       (pc)))]
8987
+       "")
8988
+(define_peephole2
8989
+       [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
8990
+               (match_operand:SI 1 "register_operand" "")))
8991
+       (set (pc) (if_then_else (geu (cc0) (const_int 0))
8992
+                       (label_ref (match_operand 2 "" ""))
8993
+                       (pc)))]
8994
+       ""
8995
+       [(set (cc0) (compare (match_dup 1) (plus (match_dup 0) (const_int 1))))
8996
+       (set (pc) (if_then_else (ltu (cc0) (const_int 0))
8997
+                       (label_ref (match_dup 2))
8998
+                       (pc)))]
8999
+       "")
9000
+(define_peephole2
9001
+       [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
9002
+               (match_operand:SI 1 "register_operand" "")))
9003
+       (set (pc) (if_then_else (ge (cc0) (const_int 0))
9004
+                       (label_ref (match_operand 2 "" ""))
9005
+                       (pc)))]
9006
+       ""
9007
+       [(set (cc0) (compare (match_dup 1) (match_dup 0)))
9008
+       (set (pc) (if_then_else (le (cc0) (const_int 0))
9009
+                       (label_ref (match_dup 2))
9010
+                       (pc)))]
9011
+       "")
9012
+(define_peephole2
9013
+       [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
9014
+               (match_operand:SI 1 "register_operand" "")))
9015
+       (set (pc) (if_then_else (leu (cc0) (const_int 0))
9016
+                       (label_ref (match_operand 2 "" ""))
9017
+                       (pc)))]
9018
+       ""
9019
+       [(set (cc0) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
9020
+       (set (pc) (if_then_else (ltu (cc0) (const_int 0))
9021
+                       (label_ref (match_dup 2))
9022
+                       (pc)))]
9023
+       "")
9024
+;
9025
+; I need to revisit these peephole optimizations when I can come up with another
9026
+; way of adding one to the constant integer.  The approach listed below just
9027
+; ... doesn't work.
9028 102 dgisselq
+;
9029 117 dgisselq
+;(define_peephole2
9030
+;      [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
9031
+;              (match_operand:SI 1 "const_int_operand" "")))
9032
+;      (set (pc) (if_then_else (le (cc0) (const_int 0))
9033
+;                      (label_ref (match_operand 2 "" ""))
9034
+;                      (pc)))]
9035
+;      "(INTVAL(operands[1])<((1<<17)-2))"
9036
+;      [(set (cc0) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
9037
+;      (set (pc) (if_then_else (lt (cc0) (const_int 0))
9038
+;                      (label_ref (match_dup 2))
9039
+;                      (pc)))]
9040
+;      "")
9041
+;(define_peephole2
9042
+;      [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
9043
+;              (match_operand:SI 1 "const_int_operand" "")))
9044
+;      (set (pc) (if_then_else (leu (cc0) (const_int 0))
9045
+;                      (label_ref (match_operand 2 "" ""))
9046
+;                      (pc)))]
9047
+;      "(INTVAL(operands[1])<((1<<17)-2))"
9048
+;      [(set (cc0) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
9049
+;      (set (pc) (if_then_else (lt (cc0) (const_int 0))
9050
+;                      (label_ref (match_dup 2))
9051
+;                      (pc)))]
9052
+;      "")
9053
+;
9054
+;
9055
+;
9056
+; Need a peephole optimizer (not peephole2) for
9057
+;      [(call ...
9058
+;      (set (pc) (label))]
9059
+;      To result with
9060
+;      "MOV\tlabel,R0
9061
+;      JMP\tsubroutine"
9062
+;
9063 102 dgisselq
+; STILL MISSING:
9064
+;      SYSCALL(ID)
9065
+;              MOV %ID,R0
9066
+;              CLR     CC
9067
+;      cmove   ... the conditional move, created from a
9068
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
9069
+;      pattern
9070
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
9071
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
9072 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
9073
@@ -0,0 +1,23 @@
9074 102 dgisselq
+/*
9075
+ * Commends in C-long comment form
9076
+ * class
9077
+ *     Mode = "SI"
9078
+ *     PRECISION, BYTESIZE, COUNT ??
9079
+ *     FORMAT
9080
+ *     EXPR
9081 111 dgisselq
+ *
9082
+ * The manual says I need to define BITS_PER_UNIT here.
9083 102 dgisselq
+ */
9084
+// INT_MODE(QI, 1);
9085
+// INT_MODE(HI, 1);
9086
+// INT_MODE(SI, 1);
9087
+// INT_MODE(DI, 2);
9088
+
9089
+// FLOAT_MODE(SF, 1, ieee_single_format);
9090
+// FLOAT_MODE(DF, 2, ieee_single_format);
9091
+
9092
+// We cannot override machmodes.def from here.  Thus, even though our QI,
9093
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
9094
+// change needed to be made in machmodes.def.  Hence, here is a target
9095
+// configuration change--in machmodes.def--that properly belonged in the
9096
+// config directory.
9097
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
9098
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
9099 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-03-12 17:39:02.331344108 -0500
9100
@@ -0,0 +1,70 @@
9101 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
9102
+//
9103
+// Filename:   zip-protos.h
9104
+//
9105
+// Project:    Zip CPU backend for the GNU Compiler Collection
9106
+//
9107
+// Purpose:
9108
+//
9109
+// Creator:    Dan Gisselquist, Ph.D.
9110
+//             Gisselquist Technology, LLC
9111
+//
9112
+////////////////////////////////////////////////////////////////////////////////
9113
+//
9114
+// Copyright (C) 2016, Gisselquist Technology, LLC
9115
+//
9116
+// This program is free software (firmware): you can redistribute it and/or
9117
+// modify it under the terms of  the GNU General Public License as published
9118
+// by the Free Software Foundation, either version 3 of the License, or (at
9119
+// your option) any later version.
9120
+//
9121
+// This program is distributed in the hope that it will be useful, but WITHOUT
9122
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
9123
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9124
+// for more details.
9125
+//
9126
+// You should have received a copy of the GNU General Public License along
9127
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
9128
+// target there if the PDF file isn't present.)  If not, see
9129
+// <http://www.gnu.org/licenses/> for a copy.
9130
+//
9131
+// License:    GPL, v3, as defined and found on www.gnu.org,
9132
+//             http://www.gnu.org/licenses/gpl.html
9133
+//
9134
+//
9135
+////////////////////////////////////////////////////////////////////////////////
9136
+#ifndef        ZIP_PROTOS_H
9137
+#define        ZIP_PROTOS_H
9138
+
9139
+extern void    zip_expand_prologue(void);
9140
+extern void    zip_expand_epilogue(void);
9141
+extern int     zip_initial_elimination_offset(int, int);
9142
+extern void    zip_print_operand(FILE *, rtx, int);
9143
+extern void    zip_print_operand_address(FILE *, rtx);
9144
+extern enum    reg_class       zip_reg_class(int);
9145
+extern rtx     zip_return_addr_rtx(int, rtx);
9146
+extern int     zip_num_arg_regs(enum machine_mode, tree);
9147
+
9148
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
9149
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
9150
+extern int     zip_address_operand(rtx op);
9151
+extern int     zip_const_address_operand(rtx op);
9152
+extern bool    zip_gen_move_rtl(rtx, rtx);
9153
+// extern      bool    zip_load_address_lod(rtx, rtx);
9154
+// extern      bool    zip_load_address_sto(rtx, rtx);
9155
+extern bool    zip_use_return_insn(void);
9156
+extern const char *zip_set_zero_or_one(rtx, rtx);
9157
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
9158
+
9159
+extern int     zip_ct_address_operand(rtx op);
9160 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
9161 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
9162 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
9163
+extern int     zip_pd_mvimm_operand(rtx op);
9164 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
9165
+extern int     zip_pd_const_address_operand(rtx op);
9166
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
9167
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
9168
+
9169
+#endif
9170
+
9171
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
9172
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
9173
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
9174
@@ -479,6 +479,10 @@
9175
 tilepro*-*-*)
9176
        cpu_type=tilepro
9177
        ;;
9178
+zip*)
9179
+       cpu_type=zip
9180
+       tmake_file=zip/t-zip
9181
+       ;;
9182
 esac
9183
 
9184
 tm_file=${cpu_type}/${cpu_type}.h
9185
@@ -2972,6 +2976,15 @@
9186
        c_target_objs="m32c-pragma.o"
9187
        cxx_target_objs="m32c-pragma.o"
9188
        ;;
9189
+zip-*-netbsd*)
9190
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
9191
+       tmake_file="${tmake_file} zip/t-zip"
9192
+       ;;
9193
+zip*)
9194
+       target_has_targetm_common=yes
9195
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
9196
+       tmake_file="${tmake_file} zip/t-zip"
9197
+       ;;
9198
 *)
9199
        echo "*** Configuration ${target} not supported" 1>&2
9200
        exit 1
9201
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
9202
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
9203 111 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-03-19 12:28:45.584701098 -0400
9204
@@ -634,6 +634,15 @@
9205 102 dgisselq
 
9206
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
9207
 
9208 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9209 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9210
+#include <stdio.h>
9211
+extern void zip_debug_rtx(const_rtx);
9212
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
9213
+#else
9214
+#define        ZIP_DEBUG_LINE(STR,RTX)
9215
+#endif
9216
+
9217
 static bool
9218
 fixed_base_plus_p (rtx x)
9219
 {
9220
@@ -2898,6 +2907,7 @@
9221
          validate_canon_reg (&XVECEXP (x, i, j), insn);
9222
     }
9223
 
9224
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
9225
   return x;
9226
 }
9227
 
9228
@@ -3144,14 +3154,16 @@
9229
   if (x == 0)
9230
     return x;
9231
 
9232
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
9233
   /* Try to perform some initial simplifications on X.  */
9234
   code = GET_CODE (x);
9235
   switch (code)
9236
     {
9237
     case MEM:
9238
     case SUBREG:
9239
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
9240
-        return new_rtx;
9241
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
9242
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
9243
+        return new_rtx; }
9244
       return x;
9245
 
9246
     case CONST:
9247
@@ -3208,6 +3220,8 @@
9248
        rtx folded_arg = XEXP (x, i), const_arg;
9249
        machine_mode mode_arg = GET_MODE (folded_arg);
9250
 
9251
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
9252
+
9253
        switch (GET_CODE (folded_arg))
9254
          {
9255
          case MEM:
9256
@@ -3317,6 +3331,7 @@
9257
        }
9258
 
9259
       apply_change_group ();
9260
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
9261
     }
9262
 
9263
   /* If X is an arithmetic operation, see if we can simplify it.  */
9264
@@ -4203,6 +4218,7 @@
9265
 {
9266
   rtx dest = SET_DEST (set);
9267
   rtx src = SET_SRC (set);
9268
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
9269
 
9270
   if (REG_P (dest)
9271
       && REG_P (src) && ! HARD_REGISTER_P (src)
9272
@@ -4258,6 +4274,7 @@
9273
            }
9274
        }
9275
     }
9276
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
9277
 }
9278
 
9279
 /* Record all the SETs in this instruction into SETS_PTR,
9280
@@ -4351,6 +4368,7 @@
9281
   rtx tem;
9282
   rtx x = PATTERN (insn);
9283
   int i;
9284
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
9285
 
9286
   if (CALL_P (insn))
9287
     {
9288
@@ -4364,6 +4382,7 @@
9289
       canon_reg (SET_SRC (x), insn);
9290
       apply_change_group ();
9291
       fold_rtx (SET_SRC (x), insn);
9292
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
9293
     }
9294
   else if (GET_CODE (x) == CLOBBER)
9295
     {
9296
@@ -4400,6 +4419,7 @@
9297
     canon_reg (PATTERN (insn), insn);
9298
   else if (GET_CODE (x) == PARALLEL)
9299
     {
9300
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
9301
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
9302
        {
9303
          rtx y = XVECEXP (x, 0, i);
9304
@@ -4491,6 +4511,7 @@
9305
 
9306
      The result of apply_change_group can be ignored; see canon_reg.  */
9307
 
9308
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
9309
   apply_change_group ();
9310
 }
9311
 
9312
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
9313
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
9314
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
9315
@@ -480,6 +480,8 @@
9316
 #define LOG2_BITS_PER_UNIT 3
9317
 #elif BITS_PER_UNIT == 16
9318
 #define LOG2_BITS_PER_UNIT 4
9319
+#elif BITS_PER_UNIT == 32
9320
+#define LOG2_BITS_PER_UNIT 5
9321
 #else
9322
 #error Unknown BITS_PER_UNIT
9323
 #endif
9324
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
9325
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
9326
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
9327
@@ -0,0 +1,214 @@
9328
+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
9329
+entering extended mode
9330
+ restricted \write18 enabled.
9331
+ file:line:error style messages enabled.
9332
+ %&-line parsing enabled.
9333
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
9334
+gcc.texi
9335
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
9336
+Loading texinfo [version 2013-09-11.11]:
9337
+\bindingoffset=\dimen16
9338
+\normaloffset=\dimen17
9339
+\pagewidth=\dimen18
9340
+\pageheight=\dimen19
9341
+\outerhsize=\dimen20
9342
+\outervsize=\dimen21
9343
+\cornerlong=\dimen22
9344
+\cornerthick=\dimen23
9345
+\topandbottommargin=\dimen24
9346
+\headlinebox=\box16
9347
+\footlinebox=\box17
9348
+\margin=\insert252
9349
+\EMsimple=\toks13
9350
+\groupbox=\box18
9351
+\groupinvalidhelp=\toks14
9352
+\mil=\dimen25
9353
+\exdentamount=\skip18
9354
+\inmarginspacing=\skip19
9355
+\centerpenalty=\count27
9356
+ pdf,
9357
+\tempnum=\count28
9358
+\lnkcount=\count29
9359
+\filename=\toks15
9360
+\filenamelength=\count30
9361
+\pgn=\count31
9362
+\toksA=\toks16
9363
+\toksB=\toks17
9364
+\toksC=\toks18
9365
+\toksD=\toks19
9366
+\boxA=\box19
9367
+\countA=\count32
9368
+\nopdfimagehelp=\toks20
9369
+ fonts,
9370
+\sffam=\fam8
9371
+\textleading=\dimen26
9372
+ markup,
9373
+\fontdepth=\count33
9374
+ glyphs,
9375
+\errorbox=\box20
9376
+
9377
+page headings,
9378
+\titlepagetopglue=\skip20
9379
+\titlepagebottomglue=\skip21
9380
+\evenheadline=\toks21
9381
+\oddheadline=\toks22
9382
+\evenfootline=\toks23
9383
+\oddfootline=\toks24
9384
+ tables,
9385
+\tableindent=\dimen27
9386
+\itemindent=\dimen28
9387
+\itemmargin=\dimen29
9388
+\itemmax=\dimen30
9389
+\itemno=\count34
9390
+\multitableparskip=\skip22
9391
+\multitableparindent=\skip23
9392
+\multitablecolspace=\dimen31
9393
+\multitablelinespace=\skip24
9394
+\colcount=\count35
9395
+\everytab=\toks25
9396
+ conditionals,
9397
+\doignorecount=\count36
9398
+ indexing,
9399
+\whatsitskip=\skip25
9400
+\whatsitpenalty=\count37
9401
+\secondaryindent=\skip26
9402
+\partialpage=\box21
9403
+\doublecolumnhsize=\dimen32
9404
+ sectioning,
9405
+\unnumberedno=\count38
9406
+\chapno=\count39
9407
+\secno=\count40
9408
+\subsecno=\count41
9409
+\subsubsecno=\count42
9410
+\appendixno=\count43
9411
+\absseclevel=\count44
9412
+\secbase=\count45
9413
+\chapheadingskip=\skip27
9414
+\secheadingskip=\skip28
9415
+\subsecheadingskip=\skip29
9416
+ toc,
9417
+\tocfile=\write0
9418
+\contentsrightmargin=\skip30
9419
+\savepageno=\count46
9420
+\lastnegativepageno=\count47
9421
+\tocindent=\dimen33
9422
+ environments,
9423
+\lispnarrowing=\skip31
9424
+\envskipamount=\skip32
9425
+\circthick=\dimen34
9426
+\cartouter=\dimen35
9427
+\cartinner=\dimen36
9428
+\normbskip=\skip33
9429
+\normpskip=\skip34
9430
+\normlskip=\skip35
9431
+\lskip=\skip36
9432
+\rskip=\skip37
9433
+\nonfillparindent=\dimen37
9434
+\tabw=\dimen38
9435
+\verbbox=\box22
9436
+
9437
+defuns,
9438
+\defbodyindent=\skip38
9439
+\defargsindent=\skip39
9440
+\deflastargmargin=\skip40
9441
+\defunpenalty=\count48
9442
+\parencount=\count49
9443
+\brackcount=\count50
9444
+ macros,
9445
+\paramno=\count51
9446
+\macname=\toks26
9447
+ cross references,
9448
+\auxfile=\write1
9449
+\savesfregister=\count52
9450
+\toprefbox=\box23
9451
+\printedrefnamebox=\box24
9452
+\infofilenamebox=\box25
9453
+\printedmanualbox=\box26
9454
+ insertions,
9455
+\footnoteno=\count53
9456
+\SAVEfootins=\box27
9457
+\SAVEmargin=\box28
9458
+
9459
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
9460
+This is `epsf.tex' v2.7.4 <14 February 2011>
9461
+\epsffilein=\read1
9462
+\epsfframemargin=\dimen39
9463
+\epsfframethickness=\dimen40
9464
+\epsfrsize=\dimen41
9465
+\epsftmp=\dimen42
9466
+\epsftsize=\dimen43
9467
+\epsfxsize=\dimen44
9468
+\epsfysize=\dimen45
9469
+\pspoints=\dimen46
9470
+)
9471
+\noepsfhelp=\toks27
9472
+ localization,
9473
+\nolanghelp=\toks28
9474
+\countUTFx=\count54
9475
+\countUTFy=\count55
9476
+\countUTFz=\count56
9477
+ formatting,
9478
+\defaultparindent=\dimen47
9479
+ and turning on texinfo input format.)
9480
+\openout1 = `gcc.aux'.
9481
+
9482
+@cpindfile=@write2
9483
+@fnindfile=@write3
9484
+@vrindfile=@write4
9485
+@tpindfile=@write5
9486
+@kyindfile=@write6
9487
+@pgindfile=@write7
9488
+texinfo.tex: doing @include of gcc-common.texi
9489
+
9490
+
9491
+./gcc.texi:25: I can't find file `gcc-common.texi'.
9492
+@temp ->@input gcc-common.texi
9493
+
9494
+@includezzz ...and @input #1 }@expandafter }@temp
9495
+                                                  @popthisfilestack
9496
+l.25 @include gcc-common.texi
9497
+
9498
+(Press Enter to retry, or Control-D to exit)
9499
+Please type another input file name: include/gcc-common.texi
9500
+(./include/gcc-common.texi
9501
+texinfo.tex: doing @include of gcc-vers.texi
9502
+
9503
+
9504
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
9505
+@temp ->@input gcc-vers.texi
9506
+
9507
+@includezzz ...and @input #1 }@expandafter }@temp
9508
+                                                  @popthisfilestack
9509
+l.11 @include gcc-vers.texi
9510
+
9511
+(Press Enter to retry, or Control-D to exit)
9512
+Please type another input file name: include/gcc-vers.texi
9513
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
9514
+@temp ->@input gcc-vers.texi
9515
+
9516
+@includezzz ...and @input #1 }@expandafter }@temp
9517
+                                                  @popthisfilestack
9518
+l.11 @include gcc-vers.texi
9519
+
9520
+(Press Enter to retry, or Control-D to exit)
9521
+Please type another input file name:
9522
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
9523
+@temp ->@input gcc-vers.texi
9524
+
9525
+@includezzz ...and @input #1 }@expandafter }@temp
9526
+                                                  @popthisfilestack
9527
+l.11 @include gcc-vers.texi
9528
+
9529
+(Press Enter to retry, or Control-D to exit)
9530
+Please type another input file name:
9531
+./include/gcc-common.texi:11: Emergency stop.
9532
+@temp ->@input gcc-vers.texi
9533
+
9534
+@includezzz ...and @input #1 }@expandafter }@temp
9535
+                                                  @popthisfilestack
9536
+l.11 @include gcc-vers.texi
9537
+
9538
+End of file on the terminal!
9539
+
9540
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
9541
+duced!
9542 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
9543
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
9544
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-04-01 06:40:42.812171791 -0400
9545
@@ -81,6 +81,15 @@
9546
 #include "builtins.h"
9547
 #include "rtl-iter.h"
9548
 
9549
+// #define     DO_ZIP_DEBUGS
9550
+#include <stdio.h>
9551
+#ifdef DO_ZIP_DEBUGS
9552
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9553
+extern void    zip_debug_rtx(const_rtx);
9554
+#else
9555
+#define        ZIP_DEBUG_LINE(STR,RTX)
9556
+#endif
9557
+
9558
 struct target_rtl default_target_rtl;
9559
 #if SWITCHABLE_TARGET
9560
 struct target_rtl *this_target_rtl = &default_target_rtl;
9561
@@ -2925,6 +2934,8 @@
9562
   int copied = 0;
9563
   int length;
9564
 
9565
+ZIP_DEBUG_LINE("Copy RTX if shared",*orig1);
9566
+
9567
   /* Repeat is used to turn tail-recursion into iteration.  */
9568
 repeat:
9569
   x = *orig1;
9570
@@ -2979,6 +2990,8 @@
9571
       break;
9572
     }
9573
 
9574
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
9575
+
9576
   /* This rtx may not be shared.  If it has already been seen,
9577
      replace it with a copy of itself.  */
9578
 
9579
@@ -2989,6 +3002,8 @@
9580
     }
9581
   RTX_FLAG (x, used) = 1;
9582
 
9583
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
9584
+
9585
   /* Now scan the subexpressions recursively.
9586
      We can store any replaced subexpressions directly into X
9587
      since we know X is not shared!  Any vectors in X
9588 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
9589
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
9590 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
9591 102 dgisselq
@@ -7999,6 +7999,8 @@
9592
    the back of the caller.
9593
    The normal operating mode is to pass FALSE for this parameter.  */
9594
 
9595
+#include "print-tree.h"
9596
+
9597
 rtx
9598
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
9599
                  enum expand_modifier modifier, rtx *alt_rtl,
9600 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
9601
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
9602 117 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-03-29 08:41:03.919647461 -0400
9603 111 dgisselq
@@ -109,6 +109,14 @@
9604
 #include "wide-int-print.h"
9605
 #include "rtl-iter.h"
9606
 
9607
+
9608
+#ifdef DO_ZIP_DEBUGS
9609
+extern void zip_debug_rtx(const_rtx);
9610
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9611
+#else
9612
+#define        ZIP_DEBUG_LINE(STR,RTX)
9613
+#endif
9614
+
9615
 #ifdef XCOFF_DEBUGGING_INFO
9616
 #include "xcoffout.h"          /* Needed for external data
9617
                                   declarations for e.g. AIX 4.x.  */
9618
@@ -2071,6 +2079,8 @@
9619
   /* Output the insns.  */
9620
   for (insn = first; insn;)
9621
     {
9622
+       ZIP_DEBUG_LINE("final()\n", insn);
9623
+
9624
       if (HAVE_ATTR_length)
9625
        {
9626
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
9627 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
9628
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
9629
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
9630
@@ -330,7 +330,8 @@
9631
         the size of a CC mode is four units.  */
9632
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
9633
 
9634
-      m->bytesize = 4;
9635
+       /* For the ZipCPU, however, it is only one unit */
9636
+      m->bytesize = 1;
9637
       m->ncomponents = 1;
9638
       m->component = 0;
9639
       break;
9640
@@ -766,11 +767,12 @@
9641
 
9642
   /* So put the default value unless the target needs a non standard
9643
      value. */
9644
-#ifdef BITS_PER_UNIT
9645
-  bits_per_unit = BITS_PER_UNIT;
9646
-#else
9647
-  bits_per_unit = 8;
9648
-#endif
9649
+// #ifdef BITS_PER_UNIT
9650
+  // bits_per_unit = BITS_PER_UNIT;
9651
+// #else
9652
+  bits_per_unit = 32;
9653
+#warning "Is there a more automated way to set bits per unit?"
9654
+// #endif
9655
 
9656
 #ifdef MAX_BITSIZE_MODE_ANY_INT
9657
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
9658
@@ -1083,7 +1085,7 @@
9659
       first = modes[c];
9660
       last = 0;
9661
       for (m = first; m; last = m, m = m->next)
9662
-       ;
9663
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
9664
 
9665
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
9666
         end will try to use it for bitfields in structures and the
9667
@@ -1268,7 +1270,7 @@
9668
            continue;
9669
          if (m->precision != (unsigned int) -1)
9670
            {
9671
-             if (m2->precision != 2 * m->precision)
9672
+             if (m2->precision < 2 * m->precision)
9673
                continue;
9674
            }
9675
          else
9676
@@ -1323,7 +1325,6 @@
9677
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
9678
     else
9679
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
9680
-
9681
   puts ("#undef MODE_MASK");
9682
   print_closer ();
9683
 }
9684
@@ -1351,12 +1352,23 @@
9685
   int c;
9686
   struct mode_data *m;
9687
 
9688
+  puts(
9689
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
9690
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
9691
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
9692
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
9693
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
9694
+" * of the target word in size.  However, this tries to do a little something\n"
9695
+" * teach our compiler what we are doing.\n"
9696
+" */\n");
9697
   print_maybe_const_decl ("%sunsigned char",
9698
                          "mode_base_align", "NUM_MACHINE_MODES",
9699
                          alignment);
9700
 
9701
   for_all_modes (c, m)
9702
-    tagged_printf ("%u", m->alignment, m->name);
9703
+    tagged_printf ("%u", 4*m->bytesize,
9704
+               // m->alignment,
9705
+               m->name);
9706
 
9707
   print_closer ();
9708
 }
9709 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
9710
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
9711
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-01 06:41:10.724002408 -0400
9712
@@ -80,6 +80,14 @@
9713
 #include "target.h"
9714
 #include "rtl-iter.h"
9715
 
9716
+// #define     DO_ZIP_DEBUGS
9717
+#ifdef DO_ZIP_DEBUGS
9718
+#include <stdio.h>
9719
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
9720
+extern void zip_debug_rtx(const_rtx);
9721
+#else
9722
+#define        ZIP_DEBUG_LINE(STR,RTX)
9723
+#endif
9724
 /* Optimize jump y; x: ... y: jumpif... x?
9725
    Don't know if it is worth bothering with.  */
9726
 /* Optimize two cases of conditional jump to conditional jump?
9727
@@ -1136,6 +1144,7 @@
9728
   int i;
9729
   const char *fmt;
9730
 
9731
+ZIP_DEBUG_LINE("Mark jump label",insn);
9732
   switch (code)
9733
     {
9734
     case PC:
9735
@@ -1248,6 +1257,8 @@
9736
       break;
9737
     }
9738
 
9739
+ZIP_DEBUG_LINE("Post case",insn);
9740
+
9741
   fmt = GET_RTX_FORMAT (code);
9742
 
9743
   /* The primary target of a tablejump is the label of the ADDR_VEC,
9744 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
9745
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
9746 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
9747 102 dgisselq
@@ -184,11 +184,11 @@
9748
    larger types, then corresponding modes must be added here.  The
9749
    name OI is reserved for a 256-bit type (needed by some back ends).
9750
     */
9751
-INT_MODE (QI, 1);
9752
-INT_MODE (HI, 2);
9753
-INT_MODE (SI, 4);
9754
-INT_MODE (DI, 8);
9755
-INT_MODE (TI, 16);
9756
+// INT_MODE (QI, 1);
9757
+// INT_MODE (HI, 1);
9758
+INT_MODE (SI, 1);
9759
+INT_MODE (DI, 2);
9760
+INT_MODE (TI, 4);
9761
 
9762
 /* No partial integer modes are defined by default.  */
9763
 
9764 111 dgisselq
@@ -206,35 +206,35 @@
9765 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
9766
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
9767
 
9768
-FLOAT_MODE (SF, 4, ieee_single_format);
9769
-FLOAT_MODE (DF, 8, ieee_double_format);
9770
+FLOAT_MODE (SF, 1, ieee_single_format);
9771
+FLOAT_MODE (DF, 2, ieee_double_format);
9772
 
9773
 /* Basic CC modes.
9774
    FIXME define this only for targets that need it.  */
9775 111 dgisselq
 CC_MODE (CC);
9776 102 dgisselq
 
9777
 /* Fixed-point modes.  */
9778 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
9779 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
9780
-FRACT_MODE (SQ, 4, 31); /* s.31 */
9781
-FRACT_MODE (DQ, 8, 63); /* s.63 */
9782
-FRACT_MODE (TQ, 16, 127); /* s.127 */
9783 111 dgisselq
-
9784
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
9785 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
9786
-UFRACT_MODE (USQ, 4, 32); /* .32 */
9787
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
9788
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
9789 111 dgisselq
-
9790
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9791
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
9792
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
9793
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
9794
-
9795
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9796
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
9797
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
9798
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
9799
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
9800
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
9801
+FRACT_MODE (SQ, 1, 31); /* s.31 */
9802
+FRACT_MODE (DQ, 2, 63); /* s.63 */
9803
+FRACT_MODE (TQ, 4, 127); /* s.127 */
9804
+
9805
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
9806
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
9807 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
9808
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
9809
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
9810 111 dgisselq
+
9811
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9812
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
9813
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
9814
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
9815
+
9816
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9817
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
9818
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
9819
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
9820 102 dgisselq
 
9821 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
9822
 #if HAVE_EXTRA_MODES
9823 102 dgisselq
@@ -246,9 +246,9 @@
9824
 COMPLEX_MODES (FLOAT);
9825
 
9826
 /* Decimal floating point modes.  */
9827
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
9828
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
9829
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
9830
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
9831
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
9832
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
9833
 
9834
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
9835
    The tm.h file specifies which one.  It is not a distinct mode.  */
9836
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
9837
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
9838
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
9839
@@ -180,13 +180,7 @@
9840
 /* Get the size in bytes and bits of an object of mode MODE.  */
9841
 
9842
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
9843
-#if GCC_VERSION >= 4001
9844
-#define GET_MODE_SIZE(MODE) \
9845
-  ((unsigned short) (__builtin_constant_p (MODE) \
9846
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
9847
-#else
9848
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
9849
-#endif
9850
 #define GET_MODE_BITSIZE(MODE) \
9851
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
9852
 
9853
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
9854
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
9855
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
9856
@@ -765,10 +765,14 @@
9857
        {
9858
          switch (TYPE_MODE (type))
9859
            {
9860
+#ifdef HAVE_QImode
9861
            case QImode:
9862
              charType = 'C'; break;
9863
+#endif
9864
+#ifdef HAVE_HImode
9865
            case HImode:
9866
              charType = 'S'; break;
9867
+#endif
9868
            case SImode:
9869
              {
9870
                if (type == long_unsigned_type_node)
9871
@@ -788,10 +792,14 @@
9872
        {
9873
          switch (TYPE_MODE (type))
9874
            {
9875
+#ifdef HAVE_QImode
9876
            case QImode:
9877
              charType = 'c'; break;
9878
+#endif
9879
+#ifdef HAVE_HImode
9880
            case HImode:
9881
              charType = 's'; break;
9882
+#endif
9883
            case SImode:
9884
              {
9885
                if (type == long_integer_type_node)
9886
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
9887
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
9888 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
9889
@@ -71,6 +71,14 @@
9890 102 dgisselq
 #include "df.h"
9891
 #include "dbgcnt.h"
9892
 
9893 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9894 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9895
+extern void zip_debug_rtx(const_rtx);
9896
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9897
+#else
9898
+#define        ZIP_DEBUG_LINE(STR,RTX)
9899
+#endif
9900
+
9901
 static int reload_cse_noop_set_p (rtx);
9902
 static bool reload_cse_simplify (rtx_insn *, rtx);
9903
 static void reload_cse_regs_1 (void);
9904 111 dgisselq
@@ -120,6 +128,8 @@
9905 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
9906
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
9907
 
9908
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
9909
+
9910
   if (GET_CODE (body) == SET)
9911
     {
9912
       int count = 0;
9913 111 dgisselq
@@ -147,6 +157,7 @@
9914 102 dgisselq
        apply_change_group ();
9915
       else
9916
        reload_cse_simplify_operands (insn, testreg);
9917
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9918
     }
9919
   else if (GET_CODE (body) == PARALLEL)
9920
     {
9921 111 dgisselq
@@ -205,6 +216,7 @@
9922 102 dgisselq
        apply_change_group ();
9923
       else
9924
        reload_cse_simplify_operands (insn, testreg);
9925
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9926
     }
9927
 
9928
 done:
9929 111 dgisselq
@@ -246,6 +258,7 @@
9930 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
9931
 
9932
        cselib_process_insn (insn);
9933
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
9934
       }
9935
 
9936
   /* Clean up.  */
9937 111 dgisselq
@@ -276,6 +289,8 @@
9938 102 dgisselq
 #endif
9939
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
9940
 
9941
+
9942
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
9943
   dreg = true_regnum (SET_DEST (set));
9944
   if (dreg < 0)
9945
     return 0;
9946 111 dgisselq
@@ -427,6 +442,7 @@
9947 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
9948
   int *alternative_order;
9949
 
9950
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
9951
   extract_constrain_insn (insn);
9952
 
9953
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
9954 111 dgisselq
@@ -519,6 +535,7 @@
9955 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
9956
     }
9957
 
9958
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
9959
   alternative_mask preferred = get_preferred_alternatives (insn);
9960
   for (i = 0; i < recog_data.n_operands; i++)
9961
     {
9962 111 dgisselq
@@ -617,6 +634,7 @@
9963 102 dgisselq
            }
9964
        }
9965
     }
9966
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
9967
 
9968
   /* Record all alternatives which are better or equal to the currently
9969
      matching one in the alternative_order array.  */
9970 111 dgisselq
@@ -666,6 +684,7 @@
9971 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
9972
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
9973
     }
9974
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9975
 
9976
   for (i = recog_data.n_dups - 1; i >= 0; i--)
9977
     {
9978 111 dgisselq
@@ -679,6 +698,7 @@
9979 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
9980
     }
9981
 
9982
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9983
   return apply_change_group ();
9984
 }
9985
 
9986 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
9987
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
9988
+++ gcc-5.3.0-zip/gcc/recog.c   2016-03-29 08:44:33.142234843 -0400
9989
@@ -68,6 +68,15 @@
9990
 #include "df.h"
9991
 #include "insn-codes.h"
9992
 
9993
+// #define     DO_ZIP_DEBUGS
9994
+#ifdef DO_ZIP_DEBUGS
9995
+extern void    zip_debug_rtx(const_rtx);
9996
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9997
+#else
9998
+#define        ZIP_DEBUG_LINE(STR,RTX)
9999
+#endif
10000
+
10001
+
10002
 #ifndef STACK_PUSH_CODE
10003
 #ifdef STACK_GROWS_DOWNWARD
10004
 #define STACK_PUSH_CODE PRE_DEC
10005
@@ -3671,7 +3680,6 @@
10006
            break;
10007
 
10008
          /* The buffer filled to the current maximum, so try to match.  */
10009
-
10010
          pos = peep2_buf_position (peep2_current + peep2_current_count);
10011
          peep2_insn_data[pos].insn = PEEP2_EOB;
10012
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
10013
@@ -3704,6 +3712,7 @@
10014
     rebuild_jump_labels (get_insns ());
10015
   if (peep2_do_cleanup_cfg)
10016
     cleanup_cfg (CLEANUP_CFG_CHANGED);
10017
+
10018
 }
10019
 #endif /* HAVE_peephole2 */
10020
 
10021
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
10022
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
10023
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-01 06:34:13.138506735 -0400
10024
@@ -72,6 +72,14 @@
10025
 #include "dumpfile.h"
10026
 #include "rtl-iter.h"
10027
 
10028
+// #define     DO_ZIP_DEBUGS
10029
+#ifdef DO_ZIP_DEBUGS
10030
+extern void    zip_debug_rtx(const_rtx);
10031
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10032
+#else
10033
+#define        ZIP_DEBUG_LINE(STR,RTX)
10034
+#endif
10035
+
10036
 /* This file contains the reload pass of the compiler, which is
10037
    run after register allocation has been done.  It checks that
10038
    each insn is valid (operands required to be in registers really
10039
@@ -794,6 +802,18 @@
10040
   basic_block bb;
10041
   bool inserted;
10042
 
10043
+#ifdef DO_ZIP_DEBUGS
10044
+  {
10045
+       int     total_count = 0, current_count = 0;
10046
+       for (insn = first; insn; insn = NEXT_INSN (insn))
10047
+               total_count++;
10048
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
10049
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
10050
+               zip_debug_rtx(insn);
10051
+       }
10052
+  }
10053
+#endif
10054
+
10055
   /* Make sure even insns with volatile mem refs are recognizable.  */
10056
   init_recog ();
10057
 
10058
@@ -1366,6 +1386,18 @@
10059
 
10060
   reload_completed = !failure;
10061
 
10062
+#ifdef DO_ZIP_DEBUGS
10063
+  {
10064
+       int     total_count = 0, current_count = 0;
10065
+       for (insn = first; insn; insn = NEXT_INSN (insn))
10066
+               total_count++;
10067
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
10068
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
10069
+               zip_debug_rtx(insn);
10070
+       }
10071
+  }
10072
+#endif
10073
+
10074
   return need_dce;
10075
 }
10076
 
10077 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
10078
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
10079 111 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-03-19 12:28:30.592811127 -0400
10080 102 dgisselq
@@ -2707,8 +2707,17 @@
10081
     no_output_reloads = 1;
10082
 
10083
 #ifdef HAVE_cc0
10084
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
10085
+  // cond_exec instruction, we cannot change the input so that the instruction
10086
+  // relies on another register--cc0 is specific.  This requries that the
10087
+  // references be only cc0 and (const_int 0), rather than allowing other
10088
+  // registers here as well.
10089
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
10090
     no_input_reloads = 1;
10091
+  // If the result of an instruction is the cc0 register, that cannot
10092
+  // be changed, therefore no output reloading is allowed.  This only
10093
+  // works if instructions *only* set the cc0 register, and not multiple
10094
+  // registers.
10095
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
10096
     no_output_reloads = 1;
10097
 #endif
10098
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
10099
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
10100
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
10101
@@ -503,6 +503,11 @@
10102
        return 0
10103
     }
10104
 
10105
+    # Zip CPU doesn't support profiling (yet)
10106
+    if { [istarget zip*] }
10107
+        return 0
10108
+    }
10109
+
10110
     # MinGW does not support -p.
10111
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
10112
        return 0
10113
@@ -986,6 +991,12 @@
10114
        }]
10115
     }
10116
 
10117
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
10118
+    # set supports it, the CPU just isn't ready yet.
10119
+    if { [istarget zip*-*-*] } {
10120
+        return 0
10121
+    }
10122
+
10123
     # This proc is actually checking the availabilty of FPU
10124
     # support for doubles, so on the RX we must fail if the
10125
     # 64-bit double multilib has been selected.
10126
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
10127
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
10128
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
10129
@@ -972,7 +972,7 @@
10130
     {
10131
       if (val & 1)
10132
        {
10133
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
10134
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
10135
          result += powi_lookup_cost (digit, cache)
10136
                    + POWI_WINDOW_SIZE + 1;
10137
          val >>= POWI_WINDOW_SIZE;
10138
@@ -1012,7 +1012,7 @@
10139
     }
10140
   else if (n & 1)
10141
     {
10142
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
10143
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
10144
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
10145
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
10146
     }
10147
@@ -1651,7 +1651,7 @@
10148
 };
10149
 
10150
 #define BITS_PER_MARKER 8
10151
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
10152
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
10153
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
10154
 #define HEAD_MARKER(n, size) \
10155
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
10156
@@ -1687,7 +1687,7 @@
10157
   /* Zero out the extra bits of N in order to avoid them being shifted
10158
      into the significant bits.  */
10159
   if (size < 64 / BITS_PER_MARKER)
10160
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10161
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10162
 
10163
   switch (code)
10164
     {
10165
@@ -1714,7 +1714,7 @@
10166
     }
10167
   /* Zero unused bits for size.  */
10168
   if (size < 64 / BITS_PER_MARKER)
10169
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10170
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10171
   return true;
10172
 }
10173
 
10174
@@ -1761,7 +1761,7 @@
10175
   n->n = CMPNOP;
10176
 
10177
   if (size < 64 / BITS_PER_MARKER)
10178
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10179
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10180
 
10181
   return true;
10182
 }
10183
@@ -2020,7 +2020,7 @@
10184
          {
10185
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
10186
            uint64_t val = int_cst_value (rhs2), mask = 0;
10187
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
10188
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
10189
 
10190
            /* Only constants masking full bytes are allowed.  */
10191
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
10192
@@ -2064,7 +2064,7 @@
10193
              {
10194
                /* If STMT casts to a smaller type mask out the bits not
10195
                   belonging to the target type.  */
10196
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
10197
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
10198
              }
10199
            n->type = type;
10200
            if (!n->base_addr)
10201
@@ -2177,7 +2177,7 @@
10202
     {
10203
       uint64_t mask;
10204
 
10205
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
10206
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
10207
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
10208
       cmpnop &= mask;
10209
     }
10210
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
10211
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
10212 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
10213 102 dgisselq
@@ -143,6 +143,13 @@
10214
 #include "rtl-iter.h"
10215
 #include "fibonacci_heap.h"
10216
 
10217 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
10218 102 dgisselq
+#include <stdio.h>
10219
+extern void zip_debug_rtx(const_rtx);
10220
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10221
+#else
10222
+#define ZIP_DEBUG_LINE(STR,RTX)
10223
+#endif
10224
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
10225
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
10226
 
10227
@@ -6356,6 +6363,7 @@
10228
                machine_mode indmode
10229
                  = TYPE_MODE (TREE_TYPE (argtype));
10230
                rtx mem = gen_rtx_MEM (indmode, x);
10231
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
10232
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
10233
                if (val && cselib_preserved_value_p (val))
10234
                  {
10235
@@ -6462,12 +6470,14 @@
10236
       machine_mode mode
10237
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
10238
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
10239
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
10240
       HOST_WIDE_INT token
10241
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
10242
       if (token)
10243
        clobbered = plus_constant (mode, clobbered,
10244
                                   token * GET_MODE_SIZE (mode));
10245
       clobbered = gen_rtx_MEM (mode, clobbered);
10246
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
10247
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
10248
       call_arguments
10249
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
10250
@@ -9790,6 +9800,7 @@
10251
              machine_mode indmode
10252
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
10253
              rtx mem = gen_rtx_MEM (indmode, incoming);
10254
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
10255
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
10256
                                                         VOIDmode,
10257
                                                         get_insns ());
10258
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
10259
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
10260
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
10261
@@ -195,6 +195,9 @@
10262
 tic6x-*-*)
10263
        cpu_type=c6x
10264
        ;;
10265
+zip*)
10266
+       cpu_type=zip
10267
+       ;;
10268
 esac
10269
 
10270
 # Common parts for widely ported systems.
10271
@@ -1300,6 +1303,9 @@
10272
        echo "*** Configuration ${host} not supported" 1>&2
10273
        exit 1
10274
        ;;
10275
+zip*)
10276
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
10277
+       ;;
10278
 esac
10279
 
10280
 case ${host} in
10281
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
10282
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
10283
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
10284
@@ -150,6 +150,9 @@
10285
        # Need to link with -lpthread so libgomp.so is self-contained.
10286
        XLDFLAGS="${XLDFLAGS} -lpthread"
10287
        ;;
10288
+  zip*)
10289
+        config_path="bsd posix"
10290
+        ;;
10291
 
10292
   *)
10293
        ;;

powered by: WebSVN 2.1.0

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